Class ArchivePVAction
- java.lang.Object
-
- org.epics.archiverappliance.mgmt.bpl.ArchivePVAction
-
- All Implemented Interfaces:
BPLAction
public class ArchivePVAction extends Object implements BPLAction
BPL for archiving a PV. Here's an example of how to archive a couple of PV's using a JSON request.$ cat archivePVs.json [ {"samplingperiod": "1.0", "pv": "mshankar:arch:sine", "samplingmethod": "SCAN"}, {"samplingperiod": "2.0", "pv": "mshankar:arch:cosine", "samplingmethod": "MONITOR"} ] $ curl -H "Content-Type: application/json" --data @archivePVs.json http://localhost:17665/mgmt/bpl/archivePV [ { "pvName": "mshankar:arch:sine", "status": "Archive request submitted" }, { "pvName": "mshankar:arch:cosine", "status": "Archive request submitted" } ] After some time... $ GET "http://localhost:17665/mgmt/bpl/getPVStatus?pv=mshankar:arch:*" [ {"lastRotateLogs":"Never","appliance":"appliance0","pvName":"mshankar:arch:cosine","pvNameOnly":"mshankar:arch:cosine","connectionState":"true","lastEvent":"Oct\/12\/2015 13:54:53 -07:00","samplingPeriod":"2.0","isMonitored":"true","connectionLastRestablished":"Never","connectionFirstEstablished":"Oct\/12\/2015 13:53:05 -07:00","connectionLossRegainCount":"0","status":"Being archived"}, {"lastRotateLogs":"Never","appliance":"appliance0","pvName":"mshankar:arch:sine","pvNameOnly":"mshankar:arch:sine","connectionState":"true","lastEvent":"Oct\/12\/2015 13:54:53 -07:00","samplingPeriod":"1.0","isMonitored":"false","connectionLastRestablished":"Never","connectionFirstEstablished":"Oct\/12\/2015 13:53:05 -07:00","connectionLossRegainCount":"0","status":"Being archived"} ]
- Author:
- mshankar
Access using:http://mgmt_url/bpl/archivePV
- Archive one or more PV's. - pv The name of the pv to be archived. If archiving more than one PV, use a comma separated list. You can also send the PV list as part of the POST body using standard techniques. If you need to specify different archiving parameters for each PV, send the data as a JSON array (remember to send the content type correctly).
- samplingperiod The sampling period to be used. Optional, default value is 1.0 seconds.
- samplingmethod The sampling method to be used. For now, this is one of SCAN or MONITOR. Optional, default value is MONITOR.
- controllingPV The controlling PV for coditional archiving. Optional; if unspecified, we do not use conditional archiving.
- policy Override the policy execution process and use this policy instead. Optional; if unspecified, we go thru the normal policy execution process.
- appliance Optional; you can specify an appliance in a cluster. If specified (value is the identity of the appliance), the sampling and archiving are done on the specified appliance.
-
-
Field Summary
Fields Modifier and Type Field Description static org.apache.log4j.Logger
logger
-
Constructor Summary
Constructors Constructor Description ArchivePVAction()
-
Method Summary
Modifier and Type Method Description static void
archivePV(PrintWriter out, String pvName, boolean overridePolicyParams, PolicyConfig.SamplingMethod overriddenSamplingMethod, float overRiddenSamplingPeriod, String controllingPV, String policyName, String alias, boolean skipCapacityPlanning, ConfigService configService, List<String> fieldsArchivedAsPartOfStream)
This is the main method for adding PVs into the archiver.void
execute(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, ConfigService configService)
static List<String>
getFieldsAsPartOfStream(ConfigService configService)
Performance optimization - pass in fieldsArchivedAsPartOfStream as part of archivePV call.static boolean
usePVAccess(String pvName, String defaultProtocol)
Does this pvName imply a connection using PVAccess?
-
-
-
Method Detail
-
execute
public void execute(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, ConfigService configService) throws IOException
- Specified by:
execute
in interfaceBPLAction
- Throws:
IOException
-
getFieldsAsPartOfStream
public static List<String> getFieldsAsPartOfStream(ConfigService configService)
Performance optimization - pass in fieldsArchivedAsPartOfStream as part of archivePV call.- Parameters:
configService
- ConfigService- Returns:
- All Fields as stream
-
usePVAccess
public static boolean usePVAccess(String pvName, String defaultProtocol)
Does this pvName imply a connection using PVAccess?- Parameters:
pvName
- The name of PV.defaultProtocol
- The defaultProtocol see org.epics.archiverappliance.mgmt.config.defaultAccessProtocol default is CA- Returns:
- boolean True or False
-
archivePV
public static void archivePV(PrintWriter out, String pvName, boolean overridePolicyParams, PolicyConfig.SamplingMethod overriddenSamplingMethod, float overRiddenSamplingPeriod, String controllingPV, String policyName, String alias, boolean skipCapacityPlanning, ConfigService configService, List<String> fieldsArchivedAsPartOfStream) throws IOException
This is the main method for adding PVs into the archiver. All other entry points should eventually call this method.- Parameters:
out
- PrintWriterpvName
- The name of PV.overridePolicyParams
- True or FalseoverriddenSamplingMethod
- SamplingMethodoverRiddenSamplingPeriod
-controllingPV
- The PV used for controlling whether we archive this PV or not in conditional archiving.policyName
- If you want to override the policy on a per PV basis.alias
- Optional, any alias that you'd like to register at the same time.skipCapacityPlanning
- By default false. However, if you want to skip capacity planning and assign to this appliance, set this to true.configService
- ConfigServicefieldsArchivedAsPartOfStream
-- Throws:
IOException
-
-
-