java.lang.Object
org.scictrl.csshell.epics.server.application.orbitserver.ArchiveClient

public class ArchiveClient extends Object

ArchiveClient class.

Author:
igor@scictrl.com
  • Field Details

    • SAMPLES_SEARCH_COUNT

      public static final int SAMPLES_SEARCH_COUNT
      Constant SAMPLES_SEARCH_COUNT=50
      See Also:
    • log

      public static org.apache.logging.log4j.Logger log
      Constant log
  • 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 for
      tsStart - Start of time interval for PV data in nanosecond timestamp format
      tsEnd - End of time interval for PV data in nanosecond timestamp format
      count - Max. number of elements to retrieve from archive server
      archive_url - a String object
      Returns:
      InputStream with JSON data, null if an error occurred
    • getJsonPVValues

      public static Vector<Object[]> getJsonPVValues(InputStream jsonInputStream)
      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

      public static Object[] getClosestTimeValuePoint(InputStream jsonInputStream, long targetTime)
      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

      public static Object[] getClosestPVValue(Vector<Object[]> pvData, long targetTimestamp)
      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 value
      targetTimestamp - 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 archiver
      targetTime - in milliseconds
      timeWindow - in milliseconds
      archiver_url - a String object
      Returns:
      Double array with PV values from archiver