Class EpicsArchiverClient

java.lang.Object
uk.ac.gda.epics.archiverclient.EpicsArchiverClient
All Implemented Interfaces:
Findable

public class EpicsArchiverClient extends Object implements Findable
Provides access to the EPICS Archiver REST API. Can be used to retrieve the whole record for a given PV, filtered by start and finish dates and times if required, or to retrieve individual PV values for a given date and time.
See Also:
  • Constructor Details

    • EpicsArchiverClient

      public EpicsArchiverClient(String archiverUrl)
  • Method Details

    • setName

      public void setName(String name)
      Description copied from interface: Findable
      Set or change the name of the object (as defined in XML).
      Specified by:
      setName in interface Findable
      Parameters:
      name - the object name
    • getName

      public String getName()
      Description copied from interface: Findable
      Get the object name. Used by Castor to check if the object name has been set before calling the Findable.setName(String) method.
      Specified by:
      getName in interface Findable
      Returns:
      a String containing the object name.
    • getRecordForPv

      public Optional<EpicsArchiverRecord> getRecordForPv(String pvName) throws EpicsArchiverClientException
      Queries the EPICS archiver API for a specific PV name and returns all data.
      Parameters:
      pvName - - The name of the PV you wish to query the archiver for.
      Returns:
      An EpicsArchiverRecord representing the archived data for the queried PV.
      Throws:
      EpicsArchiverClientException
    • getRecordForPv

      public Optional<EpicsArchiverRecord> getRecordForPv(String pvName, LocalDateTime from) throws EpicsArchiverClientException
      Queries the EPICS archiver API for a specific PV name and returns all date after the starting time-stamp.
      Parameters:
      pvName - - The name of the PV you wish to query the archiver for.
      from - - The starting date and time from which you would like data.
      Returns:
      An EpicsArchiverRecord representing the archived data for the queried PV.
      Throws:
      EpicsArchiverClientException
    • getRecordForPv

      public Optional<EpicsArchiverRecord> getRecordForPv(String pvName, LocalDateTime from, LocalDateTime to) throws EpicsArchiverClientException
      Queries the EPICS archiver API for a specific PV name and returns all data between the start and end time-stamps.
      Parameters:
      pvName - - The name of the PV you wish to query the archiver for.
      from - - The starting date and time from which you would like data.
      to - - The end date and time to which you would like data.
      Returns:
      An EpicsArchiverRecord representing the archived data for the queried PV.
      Throws:
      EpicsArchiverClientException
    • getOptionalValueForPv

      public Optional<Double> getOptionalValueForPv(String pvName, LocalDateTime dateTime) throws EpicsArchiverClientException
      Queries the EPICS archiver API for a specific PV's value on a specific date and time.
      Parameters:
      pvName - - The name of the PV you wish to query the archiver for.
      dateTime - - The date and time for which you would like the PV value.
      Returns:
      An Optional of Double representing the value.
      Throws:
      EpicsArchiverClientException
    • getOptionalValueForPv

      public Optional<Double> getOptionalValueForPv(String pvName, int year, int month, int day, int hour, int minute, int second) throws EpicsArchiverClientException
      Queries the EPICS archiver API for a specific PV's value on a specific date and time.
      Parameters:
      pvName - - The name of the PV you wish to query the archiver for
      year - - The year for which you would like the PV value.
      month - - The month for which you would like the PV value.
      day - - The day of the month for which you would like the PV value.
      hour - - The hour of the day for which you would like the PV value.
      minute - - The minute of the hour for which you would like the PV value.
      second - - The year for which you would like the PV value.
      Returns:
      An OptionalDouble representing the value.
      Throws:
      EpicsArchiverClientException
    • getOptionalValueForPv

      public Optional<Double> getOptionalValueForPv(String pvName, String dateTime) throws EpicsArchiverClientException
      Queries the EPICS archiver API for a specific PV's value on a specific date and time.
      Parameters:
      pvName - - The name of the PV you wish to query the archiver for
      dateTime - - The date and time for which you would like the PV value, as a string in the format "yyyy-MM-dd HH:mm:ss".
      Returns:
      An Optional of Double representing the value.
      Throws:
      EpicsArchiverClientException
    • getValueForPv

      public double getValueForPv(String pvName, LocalDateTime dateTime) throws EpicsArchiverClientException
      Queries the EPICS archiver API for a specific PV's value on a specific date and time. Throws an exception if not found. Using getOptionalValueForPv is probably preferable, these are intended for use over RMI (Optional is not serializable, or for people who with to use the client from the Jython console and don't want to deal with Optional.
      Parameters:
      pvName - - The name of the PV you wish to query the archiver for.
      dateTime - - The date and time for which you would like the PV value.
      Returns:
      A double representing the value.
      Throws:
      EpicsArchiverClientException
    • getValueForPv

      public double getValueForPv(String pvName, int year, int month, int day, int hour, int minute, int second) throws EpicsArchiverClientException
      Queries the EPICS archiver API for a specific PV's value on a specific date and time. Throws an exception if not found. Using getOptionalValueForPv is probably preferable, these are intended for use over RMI (Optional is not serializable, or for people who with to use the client from the Jython console and don't want to deal with Optional.
      Parameters:
      pvName - - The name of the PV you wish to query the archiver for
      year - - The year for which you would like the PV value.
      month - - The month for which you would like the PV value.
      day - - The day of the month for which you would like the PV value.
      hour - - The hour of the day for which you would like the PV value.
      minute - - The minute of the hour for which you would like the PV value.
      second - - The year for which you would like the PV value.
      Returns:
      A double representing the value.
      Throws:
      EpicsArchiverClientException
    • getValueForPv

      public double getValueForPv(String pvName, String dateTime) throws EpicsArchiverClientException
      Queries the EPICS archiver API for a specific PV's value on a specific date and time. Throws an exception if not found. Using getOptionalValueForPv is probably preferable, these are intended for use over RMI (Optional is not serializable, or for people who with to use the client from the Jython console and don't want to deal with Optional.
      Parameters:
      pvName - - The name of the PV you wish to query the archiver for
      dateTime - - The date and time for which you would like the PV value, as a string in the format "yyyy-MM-dd HH:mm:ss".
      Returns:
      A double representing the value.
      Throws:
      EpicsArchiverClientException