-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2961 from KIT-IBPT/json-archive-reader
Add JSON archive reader
- Loading branch information
Showing
14 changed files
with
3,449 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.phoebus</groupId> | ||
<artifactId>app</artifactId> | ||
<version>4.7.4-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>app-databrowser-json</artifactId> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter</artifactId> | ||
<version>${junit.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-all</artifactId> | ||
<version>1.3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.phoebus</groupId> | ||
<artifactId>app-databrowser</artifactId> | ||
<version>4.7.4-SNAPSHOT</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.phoebus</groupId> | ||
<artifactId>core-framework</artifactId> | ||
<version>4.7.4-SNAPSHOT</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-core</artifactId> | ||
<version>${jackson.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<version>${guava.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.epics</groupId> | ||
<artifactId>epics-util</artifactId> | ||
<version>${epics.util.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.epics</groupId> | ||
<artifactId>vtype</artifactId> | ||
<version>${vtype.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
66 changes: 66 additions & 0 deletions
66
...atabrowser-json/src/main/java/org/phoebus/archive/reader/json/JsonArchivePreferences.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 aquenos GmbH. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
******************************************************************************/ | ||
|
||
package org.phoebus.archive.reader.json; | ||
|
||
import org.phoebus.framework.preferences.PreferencesReader; | ||
|
||
import java.util.logging.Logger; | ||
|
||
/** | ||
* <p> | ||
* Preferences used by the {@link JsonArchiveReader}. | ||
* </p> | ||
* <p> | ||
* Each of the parameters corresponds to a property in the preferences system, | ||
* using the <code>org.phoebus.archive.reader.json</code> namespace. | ||
* </p> | ||
* <p> | ||
* Please refer to the <code>archive_reader_json_preferences.properties</code> | ||
* file for a full list of available properties and their meanings. | ||
* </p> | ||
* | ||
* @param honor_zero_precision | ||
* flag indicating whether a floating-point value specifying a precision of | ||
* zero shall be printed without any fractional digits (<code>true</code>) or | ||
* whether such a value should be printed using a default format | ||
* (<code>false</code>). | ||
*/ | ||
public record JsonArchivePreferences( | ||
boolean honor_zero_precision) { | ||
|
||
private final static JsonArchivePreferences DEFAULT_INSTANCE; | ||
|
||
static { | ||
DEFAULT_INSTANCE = loadPreferences(); | ||
} | ||
|
||
/** | ||
* Returns the default instance of the preferences. This is the instance | ||
* that is automatically configured through Phoebus’s | ||
* {@link PreferencesReader}. | ||
* | ||
* @return preference instance created using the {@link PreferencesReader}. | ||
*/ | ||
public static JsonArchivePreferences getDefaultInstance() { | ||
return DEFAULT_INSTANCE; | ||
} | ||
|
||
private static JsonArchivePreferences loadPreferences() { | ||
final var logger = Logger.getLogger( | ||
JsonArchivePreferences.class.getName()); | ||
final var preference_reader = new PreferencesReader( | ||
JsonArchivePreferences.class, | ||
"/archive_reader_json_preferences.properties"); | ||
final var honor_zero_precision = preference_reader.getBoolean( | ||
"honor_zero_precision"); | ||
logger.config("honor_zero_precision = " + honor_zero_precision); | ||
return new JsonArchivePreferences(honor_zero_precision); | ||
} | ||
|
||
} |
Oops, something went wrong.