Class ArchiveClient
java.lang.Object
org.scictrl.csshell.epics.server.application.orbitserver.ArchiveClient
ArchiveClient class.
- Author:
- igor@scictrl.com
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic org.apache.logging.log4j.LoggerConstantlogstatic final intConstantSAMPLES_SEARCH_COUNT=50 -
Method Summary
Modifier and TypeMethodDescriptionstatic InputStreamgetArchiveDataStream(String pvName, long tsStart, long tsEnd, int count, String archive_url) Query JSON Archive Proxy server for PV data.static Object[]getClosestPVValue(Vector<Object[]> pvData, long targetTimestamp) Find PV value in pvData whose timestamp is closest to targetTimestamp.static Object[]getClosestTimeValuePoint(InputStream jsonInputStream, long targetTime) Parse InputStream with PV data in JSON format.getJsonPVValues(InputStream jsonInputStream) Parse InputStream with PV data in JSON format.static double[]getTimeInstant(String[] pvs, long targetTime, long timeWindow, String archiver_url) Retrieve PV values from JSON Archive Proxy server for PV names specified in pvs.
-
Field Details
-
SAMPLES_SEARCH_COUNT
public static final int SAMPLES_SEARCH_COUNTConstantSAMPLES_SEARCH_COUNT=50- See Also:
-
log
public static org.apache.logging.log4j.Logger logConstantlog
-
-
Method Details
-
getArchiveDataStream
public static InputStream getArchiveDataStream(String pvName, long tsStart, long tsEnd, int count, String archive_url) Query JSON Archive Proxy server for PV data.- Parameters:
pvName- Name of PV we're querying the archiver fortsStart- Start of time interval for PV data in nanosecond timestamp formattsEnd- End of time interval for PV data in nanosecond timestamp formatcount- Max. number of elements to retrieve from archive serverarchive_url- aStringobject- Returns:
- InputStream with JSON data, null if an error occurred
-
getJsonPVValues
Parse InputStream with PV data in JSON format.- Parameters:
jsonInputStream- InputStream with PV data from Archive Proxy server in JSON format.- Returns:
- Vector with PV data; each element is an 2-element array where [0] is Long nanosecond timestamp and [1] is Double PV value. Null is returned on error or if no data is found.
-
getClosestTimeValuePoint
Parse InputStream with PV data in JSON format.- Parameters:
jsonInputStream- InputStream with PV data from Archive Proxy server in JSON format.targetTime- a long- Returns:
- Vector with PV data; each element is an 2-element array where [0] is Long nanosecond timestamp and [1] is Double PV value. Null is returned on error or if no data is found.
-
getClosestPVValue
Find PV value in pvData whose timestamp is closest to targetTimestamp.- Parameters:
pvData- Vector containing arrays where [0] is Long nanosecond timestamp and [1] is Double PV valuetargetTimestamp- target nanosecond timestamp- Returns:
- Array element from pvData that is closest to targetTimestamp
-
getTimeInstant
public static double[] getTimeInstant(String[] pvs, long targetTime, long timeWindow, String archiver_url) Retrieve PV values from JSON Archive Proxy server for PV names specified in pvs.- Parameters:
pvs- String array of PV names that will be queried from archivertargetTime- in millisecondstimeWindow- in millisecondsarchiver_url- aStringobject- Returns:
- Double array with PV values from archiver
-