Class ArchiveEngine


  • public class ArchiveEngine
    extends Object
    This class provides the static methods:
    1. create channel
    2. get pv meta data before archiving this pv
    3. pause archiving pv
    4. resume archiving pv
    5. get metics of one pv
    6. change the archival parameter of one pv
    7. destory pv
    Author:
    Luofeng Li
    • Constructor Detail

      • ArchiveEngine

        public ArchiveEngine()
    • Method Detail

      • getArchiveInfo

        public static void getArchiveInfo​(String pvName,
                                          ConfigService configservice,
                                          String[] metadatafields,
                                          boolean usePVAccess,
                                          MetaCompletedListener metaListener)
                                   throws Exception
        Get the meta data for pv - used for policy computation.
        Parameters:
        pvName - Name of the channel (PV)
        configservice - ConfigService
        metadatafields - other field such as MDEL,ADEL, except basical info in DBR_CTRL
        usePVAccess - Should we use PV access to connect to this PV.
        metaListener - the callback interface where you handle the info.
        Throws:
        Exception - On error in getting pv's info
      • archivePV

        public static void archivePV​(String pvName,
                                     float samplingPeriod,
                                     PolicyConfig.SamplingMethod mode,
                                     int secondstoBuffer,
                                     Writer writer,
                                     ConfigService configservice,
                                     ArchDBRTypes archdbrtype,
                                     Timestamp lastKnownEventTimeStamp,
                                     String controllingPVName,
                                     boolean usePVAccess,
                                     boolean useDBEProperties)
                              throws Exception
        Parameters:
        pvName - Name of the channel (PV)
        samplingPeriod - The minimal sample period for channel in scan mode. Attention: the same data with same value and timestamp is not saved again in scan mode. This period is meanlingless for channel in monitor mode.
        mode - scan or monitor
        secondstoBuffer - Not really used
        writer - First destination
        configservice - ConfigService
        archdbrtype - Expected DBR type.
        lastKnownEventTimeStamp - Last known event from all the stores.
        controllingPVName - The PV that controls archiving for this PV
        usePVAccess - Should we use PVAccess to connect to this PV.
        useDBEProperties -  
        Throws:
        Exception -  
      • archivePV

        public static void archivePV​(String pvName,
                                     float samplingPeriod,
                                     PolicyConfig.SamplingMethod mode,
                                     int secondstoBuffer,
                                     Writer writer,
                                     ConfigService configservice,
                                     ArchDBRTypes archdbrtype,
                                     Timestamp lastKnownEventTimeStamp,
                                     boolean usePVAccess,
                                     boolean useDBEProperties)
                              throws Exception
        Parameters:
        pvName - Name of the channel (PV)
        samplingPeriod - The minimal sample period for channel in scan mode. Attention: the same data with same value and timestamp is not saved again in scan mode. This period is meanlingless for channel in monitor mode.
        mode - scan or monitor
        secondstoBuffer - Not really used
        writer - First destination
        configservice - ConfigService
        archdbrtype - Expected DBR type.
        lastKnownEventTimeStamp - Last known event from all the stores.
        usePVAccess - Should we use PVAccess to connect to this PV.
        useDBEProperties -  
        Throws:
        Exception -  
      • archivePV

        public static void archivePV​(String pvName,
                                     float samplingPeriod,
                                     PolicyConfig.SamplingMethod mode,
                                     int secondstoBuffer,
                                     Writer writer,
                                     ConfigService configservice,
                                     ArchDBRTypes archdbrtype,
                                     Timestamp lastKnownEventTimeStamp,
                                     String[] metaFieldNames,
                                     boolean usePVAccess,
                                     boolean useDBEProperties)
                              throws Exception
        Parameters:
        pvName - Name of the channel (PV)
        samplingPeriod - The minimal sample period for channel in scan mode. Attention: the same data with same value and timestamp is not saved again in scan mode. This period is meanlingless for channel in monitor mode.
        mode - scan or monitor
        secondstoBuffer - Not really used
        writer - First destination
        configservice - ConfigService
        archdbrtype - Expected DBR type.
        lastKnownEventTimeStamp - Last known event from all the stores.
        metaFieldNames - An array of EPICS fields that gets stored along with the stream. Needs rethinking once we have EPICS V4
        usePVAccess - Should we use PVAccess to connect to this PV.
        useDBEProperties -  
        Throws:
        Exception -  
      • archivePV

        public static void archivePV​(String pvName,
                                     float samplingPeriod,
                                     PolicyConfig.SamplingMethod mode,
                                     int secondstoBuffer,
                                     Writer writer,
                                     ConfigService configservice,
                                     ArchDBRTypes archdbrtype,
                                     Timestamp lastKnownEventTimeStamp,
                                     String controllingPVName,
                                     String[] metaFieldNames,
                                     String iocHostName,
                                     boolean usePVAccess,
                                     boolean useDBEProperties)
                              throws Exception
        Create a new channel in monitor mode or in scan mode
        Parameters:
        pvName - Name of the channel (PV)
        samplingPeriod - The minimal sample period for channel in scan mode. Attention: the same data with same value and timestamp is not saved again in scan mode. This period is meanlingless for channel in monitor mode.
        mode - scan or monitor
        secondstoBuffer - - Not really used
        writer - First destination
        configservice - ConfigService
        archdbrtype - Expected DBR type.
        lastKnownEventTimeStamp - Last known event from all the stores.
        controllingPVName - The PV that controls archiving for this PV
        metaFieldNames - An array of EPICS fields that gets stored along with the stream. Needs rethinking once we have EPICS V4
        iocHostName - IOC hosting this PV; this is used for some optimization. This will often be null.
        usePVAccess - Should we use PVAccess to connect to this PV.
        useDBEProperties -  
        Throws:
        Exception -  
      • pauseArchivingPV

        public static void pauseArchivingPV​(String pvName,
                                            ConfigService configservice)
                                     throws Exception
        pause the pv
        Parameters:
        pvName - Name of the channel (PV)
        configservice - ConfigService
        Throws:
        Exception - error in pausing the channel .
      • resumeArchivingPV

        public static void resumeArchivingPV​(String pvName,
                                             ConfigService configservice)
                                      throws Exception
        restart the pv
        Parameters:
        pvName - Name of the channel (PV)
        configservice - ConfigService
        Throws:
        Exception - error in restarting the channel .
      • startChannelsForPV

        public static void startChannelsForPV​(String pvName,
                                              ConfigService configservice)
                                       throws IOException,
                                              Exception
        Start up the channels for a PV. Should be called on startup or on resume of a PV that was paused on startup.
        Parameters:
        pvName - The Name of PV.
        configservice - ConfigService
        Throws:
        IOException -  
        Exception -  
      • getMetricsforPV

        public static PVMetrics getMetricsforPV​(String pvName,
                                                ConfigService configservice)
                                         throws Exception
        get the pv's info and status
        Parameters:
        pvName - Name of the channel (PV)
        configservice - ConfigService
        Returns:
        PVMetrics  
        Throws:
        Exception - On error in getting the pv info and status .
      • getLowLevelStateInfo

        public static void getLowLevelStateInfo​(String pvName,
                                                ConfigService configservice,
                                                LinkedList<Map<String,​String>> statuses)
                                         throws Exception
        Return info from CAJ
        Parameters:
        pvName - The name of PV.
        configservice - ConfigService
        statuses - Add a list of key value pairs to the status
        Throws:
        Exception -  
      • changeArchivalParameters

        public static void changeArchivalParameters​(String pvName,
                                                    float samplingPeriod,
                                                    PolicyConfig.SamplingMethod mode,
                                                    ConfigService configservice,
                                                    Writer writer,
                                                    boolean usePVAccess,
                                                    boolean useDBEPropeties)
                                             throws Exception
        change pv's sample period or sample mode
        Parameters:
        pvName - Name of the channel (PV)
        samplingPeriod - new sampling Period of the channel (PV)
        mode - scan or monitor
        configservice - ConfigService
        writer - the writer to protocol buffer
        usePVAccess - Should we use PVAccess to connect to this PV.
        useDBEPropeties -  
        Throws:
        Exception - On error in getting the pv info and status .
      • destoryPv

        public static void destoryPv​(String pvName,
                                     ConfigService configservice)
                              throws Exception
        destroy the pv
        Parameters:
        pvName - the pv's name to destroy
        configservice - the configSerivice of the application
        Throws:
        Exception - error when destroy the PV