Class DefaultConfigService
- java.lang.Object
-
- org.epics.archiverappliance.config.DefaultConfigService
-
- All Implemented Interfaces:
ConfigService
- Direct Known Subclasses:
ConfigServiceForTests
public class DefaultConfigService extends Object implements ConfigService
This is the default config service for the archiver appliance. There is a subclass that is used in the junit tests.- Author:
- mshankar
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.epics.archiverappliance.config.ConfigService
ConfigService.STARTUP_SEQUENCE, ConfigService.WAR_FILE
-
-
Field Summary
-
Fields inherited from interface org.epics.archiverappliance.config.ConfigService
ARCHAPPL_APPLIANCES, ARCHAPPL_CONFIGSERVICE_IMPL, ARCHAPPL_MYIDENTITY, ARCHAPPL_NAMEDFLAGS_PROPERTIES_FILE_PROPERTY, ARCHAPPL_PERSISTENCE_LAYER, ARCHAPPL_POLICIES, ARCHAPPL_PROPERTIES_FILENAME, ARCHAPPL_SITEID, CONFIG_SERVICE_NAME, DEFAULT_ARCHAPPL_PROPERTIES_FILENAME
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultConfigService()
-
Method Summary
Modifier and Type Method Description void
addAlias(String aliasName, String realName)
Register an aliasvoid
addExternalArchiverDataServer(String serverURL, String archivesCSV)
Add a external Archiver Data Server into the system.void
addShutdownHook(Runnable runnable)
Add an appserver agnostic shutdown hook; for example, to close the CA channels on shutdownvoid
addToArchiveRequests(String pvName, UserSpecifiedSamplingParams userSpecifiedSamplingParams)
The workflow for requesting a PV to be archived consists of multiple steps This method adds a PV to the persisted list of PVs that are currently engaged in this workflow in addition to any user specified overridesvoid
archiveRequestWorkflowCompleted(String pvName)
Mark this pv as having it archive pv request completed and pull this request out of persistent store Can be used in the case of aborting a PV archive request as wellPolicyConfig
computePolicyForPV(String pvName, MetaInfo metaInfo, UserSpecifiedSamplingParams userSpecParams)
Given a pvName (for now, we should have a pv details object of some kind soon), determine the policy applicable for archiving this PV.boolean
doesPVHaveArchiveRequestInWorkflow(String pvname)
Is this pv in the archive request workflow.ApplianceAggregateInfo
getAggregatedApplianceInfo(ApplianceInfo applianceInfo)
Facilitates various optimizations for BPL that uses appliance wide information by caching and maintaining this information on a per appliance basisList<String>
getAllAliases()
Get all the aliases in the system.void
getAllExpandedNames(Consumer<String> func)
For automated PV submission, IOC engineers could add .VAL, fields, aliases etc.Collection<String>
getAllPVs()
Get an exhaustive list of all the PVs this cluster of appliances knows about Much goodness is facilitated if the objects are returned in the same order (perhaps order of creation) all the time.ApplianceInfo
getAppliance(String identity)
Given an identity of an appliance, return the appliance info for that applianceApplianceInfo
getApplianceForPV(String pvName)
Given a PV, get us the appliance that is responsible for archiving it.Collection<ApplianceInfo>
getAppliancesInCluster()
Get all the appliances in this cluster.Set<String>
getArchiveRequestsCurrentlyInWorkflow()
Gets a list of PVs that are currently engaged in the archive PV workflowTypeSystem
getArchiverTypeSystem()
Returns a TypeSystem object that is used to convert from JCA DBR's to Event's (actually, DBRTimeEvents)List<ChannelArchiverDataServerPVInfo>
getChannelArchiverDataServers(String pvName)
Return a list of ChannelArchiverDataServerPVInfos for a PV if one exists; otherwise return null.EngineContext
getEngineContext()
Return the runtime state for the engine.PBThreeTierETLPVLookup
getETLLookup()
Return the runtime state for ETL.com.google.common.eventbus.EventBus
getEventBus()
Get the event bus used for events within this appliance.Map<String,String>
getExternalArchiverDataServers()
This product has the ability to proxy data from other archiver data servers.String[]
getExtraFields()
Get a list of extra fields that are obtained when we initially make a request for archiving.String
getFailoverApplianceURL(String pvName)
Get the first external archiver appliance that also archives this PV and is configured with a mergeDuringRetrieval query parameter.Set<String>
getFailoverServerURLs()
Get a list of external archiver appliances configured for failover.List<String>
getFieldsArchivedAsPartOfStream()
This product offers the ability to archive certain fields (like HIHI, LOLO etc) as part of every PV.int
getInitialDelayBeforeStartingArchiveRequestWorkflow()
In clustered environments, to give capacity planning a chance to work correctly, we want to kick off the archive PV workflow only after all the machines have started.Properties
getInstallationProperties()
An arbitrary list of name/value pairs can be specified in a file called archappl.properties that is loaded from the classpath.MgmtRuntimeState
getMgmtRuntimeState()
Return the runtime state for the mgmt webapp.ApplianceInfo
getMyApplianceInfo()
Get the appliance information for this appliance.boolean
getNamedFlag(String name)
Named flags are used to control various process in the appliance; for example, the ETL process in a PlainPBStoragePlugin Named flags are not persistent; each time the server starts up, all the named flags are set to false You can optionally load values for named flags from a file by specifying the ARCHAPPL_NAMEDFLAGS_PROPERTIES_FILE_PROPERTY property in archappl.properties.Set<String>
getNamedFlagNames()
Return the names of all the named flags that we know aboutSet<String>
getPausedPVsInThisAppliance()
Get a set of PVs that have been paused in this appliance.HashMap<String,String>
getPoliciesInInstallation()
Return a map of name to description of all the policies in the system This is used to drive a dropdown in the UI.InputStream
getPolicyText()
Return the text of the policy for this installation.ProcessMetrics
getProcessMetrics()
PVNameToKeyMapping
getPVNameToKeyConverter()
Implementation for converting a PV name to something that forms the prefix of a chunk's key.Iterable<String>
getPVsForAppliance(ApplianceInfo info)
Get all PVs being archived by this appliance.Set<String>
getPVsForApplianceMatchingRegex(String nameToMatch)
Get the pvNames for this appliance matching the given regex.Iterable<String>
getPVsForThisAppliance()
Get all the PVs for this appliance.String
getRealNameForAlias(String aliasName)
Gets the .NAME field for a PV if it exists.RetrievalState
getRetrievalRuntimeState()
Returns the runtime state for the retrieval appSet<String>
getRuntimeFields()
Get a list of fields for PVs that are monitored and maintained in the engine.ConfigService.STARTUP_SEQUENCE
getStartupState()
Used for inter-appliance startup checks.long
getTimeOfAppserverStartup()
Get an approximate time in epoch seconds when the appserver started up.PVTypeInfo
getTypeInfoForPV(String pvName)
Gets information about a PV's type, i.e its DBR type, graphic limits etc.UserSpecifiedSamplingParams
getUserSpecifiedSamplingParams(String pvName)
Returns any user specified parameters for the archive request.ConfigService.WAR_FILE
getWarFile()
Which component is this configservice instance.String
getWebInfFolder()
We expect to live within a servlet container.void
initialize(javax.servlet.ServletContext sce)
If you have a null constructor and need a ServletContext, implement this method.boolean
isBeingArchivedOnThisAppliance(String pvName)
Is this PV archived on this appliance.boolean
isShuttingDown()
Is this appliance component shutting down?boolean
isStartupComplete()
Have we completed all the startup steps?void
postStartup()
This method is called after the mgmt WAR file has started up and set up the cluster and recovered data from persistence.void
publishEventIntoCluster(PubSubEvent pubSubEvent)
void
refreshPVDataFromChannelArchiverDataServers()
For all the Channel Archiver XMLRPC data servers in the mix, update the PV info.void
registerPVToAppliance(String pvName, ApplianceInfo applianceInfo)
Make changes in the config service to register this PV to an appliancevoid
removeAlias(String aliasName, String realName)
Remove an alias for the specified realnamevoid
removeExternalArchiverDataServer(String serverURL, String archivesCSV)
Removes an entry for an external Archiver Data Server from the system Note; we may need to restart the entire cluster for this change to take effect.void
removePVFromCluster(String pvName)
Remove the pv from all cached and persisted configuration.void
resetFailoverCaches()
Each retrieval component in a cluster caches the PV's from remote failover appliances.void
setNamedFlag(String name, boolean value)
Sets the value of the named flag specified by name to the specified valuevoid
shutdownNow()
Call the registered shutdown hooks and shut the archive appliance down.void
updateArchiveRequest(String pvName, UserSpecifiedSamplingParams userSpecifiedSamplingParams)
Update the archive request (mostly with aliases) if and only if we have this in our persistence.void
updatePVSForThisAppliance(PVTypeInfoEvent event)
void
updateTypeInfoForPV(String pvName, PVTypeInfo typeInfo)
Update the type information about a PV; updating both ther persistent and cached versions of the information.
-
-
-
Field Detail
-
SITE_FOR_UNIT_TESTS_NAME
public static final String SITE_FOR_UNIT_TESTS_NAME
- See Also:
- Constant Field Values
-
SITE_FOR_UNIT_TESTS_VALUE
public static final String SITE_FOR_UNIT_TESTS_VALUE
- See Also:
- Constant Field Values
-
ARCHAPPL_PVNAME_TO_KEY_MAPPING_CLASSNAME
public static final String ARCHAPPL_PVNAME_TO_KEY_MAPPING_CLASSNAME
Add a property in archappl.properties under this key to identify the class that implements the PVNameToKeyMapping for this installation.- See Also:
- Constant Field Values
-
myIdentity
protected String myIdentity
-
myApplianceInfo
protected ApplianceInfo myApplianceInfo
-
appliances
protected Map<String,ApplianceInfo> appliances
-
typeInfos
protected Map<String,PVTypeInfo> typeInfos
-
archivePVRequests
protected Map<String,UserSpecifiedSamplingParams> archivePVRequests
-
pv2appliancemapping
protected Map<String,ApplianceInfo> pv2appliancemapping
-
pv2ChannelArchiverDataServer
protected Map<String,List<ChannelArchiverDataServerPVInfo>> pv2ChannelArchiverDataServer
-
pubSub
protected com.hazelcast.core.ITopic<PubSubEvent> pubSub
-
shutdownHooks
protected LinkedList<Runnable> shutdownHooks
-
etlPVLookup
protected PBThreeTierETLPVLookup etlPVLookup
-
retrievalState
protected RetrievalState retrievalState
-
mgmtRuntime
protected MgmtRuntimeState mgmtRuntime
-
engineContext
protected EngineContext engineContext
-
appliancesInCluster
protected ConcurrentSkipListSet<String> appliancesInCluster
-
pvsForThisAppliance
protected ConcurrentSkipListSet<String> pvsForThisAppliance
-
parts2PVNamesForThisAppliance
protected ConcurrentHashMap<String,ConcurrentSkipListSet<String>> parts2PVNamesForThisAppliance
-
pausedPVsForThisAppliance
protected ConcurrentSkipListSet<String> pausedPVsForThisAppliance
-
applianceAggregateInfo
protected ApplianceAggregateInfo applianceAggregateInfo
-
eventBus
protected com.google.common.eventbus.EventBus eventBus
-
archapplproperties
protected Properties archapplproperties
-
pvName2KeyConverter
protected PVNameToKeyMapping pvName2KeyConverter
-
persistanceLayer
protected ConfigPersistence persistanceLayer
-
failoverPVs
protected ConcurrentHashMap<String,com.google.common.cache.LoadingCache<String,Boolean>> failoverPVs
-
warFile
protected ConfigService.WAR_FILE warFile
-
startupState
protected ConfigService.STARTUP_SEQUENCE startupState
-
startupExecutor
protected ScheduledExecutorService startupExecutor
-
processMetrics
protected ProcessMetrics processMetrics
-
-
Method Detail
-
initialize
public void initialize(javax.servlet.ServletContext sce) throws ConfigException
Description copied from interface:ConfigService
If you have a null constructor and need a ServletContext, implement this method.- Specified by:
initialize
in interfaceConfigService
- Parameters:
sce
- ServletContext- Throws:
ConfigException
-
-
postStartup
public void postStartup() throws ConfigException
Description copied from interface:ConfigService
This method is called after the mgmt WAR file has started up and set up the cluster and recovered data from persistence. Each appliance's mgmt war is responsible for calling this method on the other components (engine, etl and retrieval) using BPL. Until this method is called on all the web apps, the cluster is not considered to have started up.- Specified by:
postStartup
in interfaceConfigService
- Throws:
ConfigException
-
-
getStartupState
public ConfigService.STARTUP_SEQUENCE getStartupState()
Description copied from interface:ConfigService
Used for inter-appliance startup checks.- Specified by:
getStartupState
in interfaceConfigService
- Returns:
- STARTUP_SEQUENCE
-
updatePVSForThisAppliance
public void updatePVSForThisAppliance(PVTypeInfoEvent event)
-
publishEventIntoCluster
public void publishEventIntoCluster(PubSubEvent pubSubEvent)
-
isStartupComplete
public boolean isStartupComplete()
Description copied from interface:ConfigService
Have we completed all the startup steps?- Specified by:
isStartupComplete
in interfaceConfigService
- Returns:
- boolean True or False
-
getInstallationProperties
public Properties getInstallationProperties()
Description copied from interface:ConfigService
An arbitrary list of name/value pairs can be specified in a file called archappl.properties that is loaded from the classpath.- Specified by:
getInstallationProperties
in interfaceConfigService
- Returns:
- Properties
-
getAppliancesInCluster
public Collection<ApplianceInfo> getAppliancesInCluster()
Description copied from interface:ConfigService
Get all the appliances in this cluster. Much goodness is facilitated if the objects are returned in the same order (perhaps order of creation) all the time.- Specified by:
getAppliancesInCluster
in interfaceConfigService
- Returns:
- ApplianceInfo
-
getMyApplianceInfo
public ApplianceInfo getMyApplianceInfo()
Description copied from interface:ConfigService
Get the appliance information for this appliance.- Specified by:
getMyApplianceInfo
in interfaceConfigService
- Returns:
- ApplianceInfo
-
getAppliance
public ApplianceInfo getAppliance(String identity)
Description copied from interface:ConfigService
Given an identity of an appliance, return the appliance info for that appliance- Specified by:
getAppliance
in interfaceConfigService
- Parameters:
identity
- The appliance identify- Returns:
- ApplianceInfo
-
getAllPVs
public Collection<String> getAllPVs()
Description copied from interface:ConfigService
Get an exhaustive list of all the PVs this cluster of appliances knows about Much goodness is facilitated if the objects are returned in the same order (perhaps order of creation) all the time.- Specified by:
getAllPVs
in interfaceConfigService
- Returns:
- String AllPVs
-
getApplianceForPV
public ApplianceInfo getApplianceForPV(String pvName)
Description copied from interface:ConfigService
Given a PV, get us the appliance that is responsible for archiving it. Note that this may be null as the assignment of PV's to appliances can take some time.- Specified by:
getApplianceForPV
in interfaceConfigService
- Parameters:
pvName
- The name of PV.- Returns:
- ApplianceInfo
-
getPVsForAppliance
public Iterable<String> getPVsForAppliance(ApplianceInfo info)
Description copied from interface:ConfigService
Get all PVs being archived by this appliance. Much goodness is facilitated if the objects are returned in the same order (perhaps order of creation) all the time.- Specified by:
getPVsForAppliance
in interfaceConfigService
- Parameters:
info
- ApplianceInfo- Returns:
- string All PVs being archiveed by this appliance
-
getPVsForThisAppliance
public Iterable<String> getPVsForThisAppliance()
Description copied from interface:ConfigService
Get all the PVs for this appliance. Much goodness is facilitated if the objects are returned in the same order (perhaps order of creation) all the time.- Specified by:
getPVsForThisAppliance
in interfaceConfigService
- Returns:
- String All PVs being archiveed for this appliance
-
isBeingArchivedOnThisAppliance
public boolean isBeingArchivedOnThisAppliance(String pvName)
Description copied from interface:ConfigService
Is this PV archived on this appliance. This method also checks aliases and fields.- Specified by:
isBeingArchivedOnThisAppliance
in interfaceConfigService
- Parameters:
pvName
- The name of PV.- Returns:
- boolean True or False
-
getPVsForApplianceMatchingRegex
public Set<String> getPVsForApplianceMatchingRegex(String nameToMatch)
Description copied from interface:ConfigService
Get the pvNames for this appliance matching the given regex.- Specified by:
getPVsForApplianceMatchingRegex
in interfaceConfigService
- Parameters:
nameToMatch
-- Returns:
- string PVsForApplianceMatchingRegex
-
getAggregatedApplianceInfo
public ApplianceAggregateInfo getAggregatedApplianceInfo(ApplianceInfo applianceInfo) throws IOException
Description copied from interface:ConfigService
Facilitates various optimizations for BPL that uses appliance wide information by caching and maintaining this information on a per appliance basis- Specified by:
getAggregatedApplianceInfo
in interfaceConfigService
- Parameters:
applianceInfo
- ApplianceInfo- Returns:
- ApplianceAggregateInfo
- Throws:
IOException
-
-
registerPVToAppliance
public void registerPVToAppliance(String pvName, ApplianceInfo applianceInfo) throws AlreadyRegisteredException
Description copied from interface:ConfigService
Make changes in the config service to register this PV to an appliance- Specified by:
registerPVToAppliance
in interfaceConfigService
- Parameters:
pvName
- The name of PV.applianceInfo
- ApplianceInfo- Throws:
AlreadyRegisteredException
-
-
getTypeInfoForPV
public PVTypeInfo getTypeInfoForPV(String pvName)
Description copied from interface:ConfigService
Gets information about a PV's type, i.e its DBR type, graphic limits etc. This information is assumed to be somewhat static and is expected to come from a cache if possible as it is used in data retrieval.- Specified by:
getTypeInfoForPV
in interfaceConfigService
- Parameters:
pvName
- The name of PV.- Returns:
- PVTypeInfo
-
updateTypeInfoForPV
public void updateTypeInfoForPV(String pvName, PVTypeInfo typeInfo)
Description copied from interface:ConfigService
Update the type information about a PV; updating both ther persistent and cached versions of the information. Clients are not expected to call this method a million times a second. In general, this is expected to be called when archiving a PV for the first time, or perhaps when an appserver startups etc...- Specified by:
updateTypeInfoForPV
in interfaceConfigService
- Parameters:
pvName
- The name of PV.typeInfo
- PVTypeInfo
-
removePVFromCluster
public void removePVFromCluster(String pvName)
Description copied from interface:ConfigService
Remove the pv from all cached and persisted configuration.- Specified by:
removePVFromCluster
in interfaceConfigService
- Parameters:
pvName
- The name of PV.
-
addToArchiveRequests
public void addToArchiveRequests(String pvName, UserSpecifiedSamplingParams userSpecifiedSamplingParams)
Description copied from interface:ConfigService
The workflow for requesting a PV to be archived consists of multiple steps This method adds a PV to the persisted list of PVs that are currently engaged in this workflow in addition to any user specified overrides- Specified by:
addToArchiveRequests
in interfaceConfigService
- Parameters:
pvName
- The name of PV.userSpecifiedSamplingParams
- - Use a null contructor for userSpecifiedSamplingParams if no override specified.
-
updateArchiveRequest
public void updateArchiveRequest(String pvName, UserSpecifiedSamplingParams userSpecifiedSamplingParams)
Description copied from interface:ConfigService
Update the archive request (mostly with aliases) if and only if we have this in our persistence.- Specified by:
updateArchiveRequest
in interfaceConfigService
- Parameters:
pvName
- The name of PV.userSpecifiedSamplingParams
-
-
getArchiveRequestsCurrentlyInWorkflow
public Set<String> getArchiveRequestsCurrentlyInWorkflow()
Description copied from interface:ConfigService
Gets a list of PVs that are currently engaged in the archive PV workflow- Specified by:
getArchiveRequestsCurrentlyInWorkflow
in interfaceConfigService
- Returns:
- String ArchiveRequestsCurrentlyInWorkflow
-
doesPVHaveArchiveRequestInWorkflow
public boolean doesPVHaveArchiveRequestInWorkflow(String pvname)
Description copied from interface:ConfigService
Is this pv in the archive request workflow.- Specified by:
doesPVHaveArchiveRequestInWorkflow
in interfaceConfigService
- Parameters:
pvname
- The name of PV.- Returns:
- boolean True or False
-
getUserSpecifiedSamplingParams
public UserSpecifiedSamplingParams getUserSpecifiedSamplingParams(String pvName)
Description copied from interface:ConfigService
Returns any user specified parameters for the archive request.- Specified by:
getUserSpecifiedSamplingParams
in interfaceConfigService
- Parameters:
pvName
- The name of PV.- Returns:
- UserSpecifiedSamplingParams
-
archiveRequestWorkflowCompleted
public void archiveRequestWorkflowCompleted(String pvName)
Description copied from interface:ConfigService
Mark this pv as having it archive pv request completed and pull this request out of persistent store Can be used in the case of aborting a PV archive request as well- Specified by:
archiveRequestWorkflowCompleted
in interfaceConfigService
- Parameters:
pvName
- The name of PV.
-
getInitialDelayBeforeStartingArchiveRequestWorkflow
public int getInitialDelayBeforeStartingArchiveRequestWorkflow()
Description copied from interface:ConfigService
In clustered environments, to give capacity planning a chance to work correctly, we want to kick off the archive PV workflow only after all the machines have started. This is an approximation for that metric; though not a very satisfactory approximation. TODO -- Think thru implications of making the appliances.xml strict...- Specified by:
getInitialDelayBeforeStartingArchiveRequestWorkflow
in interfaceConfigService
- Returns:
- - Initial delay in seconds.
-
addAlias
public void addAlias(String aliasName, String realName)
Description copied from interface:ConfigService
Register an alias- Specified by:
addAlias
in interfaceConfigService
- Parameters:
aliasName
-realName
- This is the name under which the PV will be archived under
-
removeAlias
public void removeAlias(String aliasName, String realName)
Description copied from interface:ConfigService
Remove an alias for the specified realname- Specified by:
removeAlias
in interfaceConfigService
- Parameters:
aliasName
-realName
- This is the name under which the PV will be archived under
-
getRealNameForAlias
public String getRealNameForAlias(String aliasName)
Description copied from interface:ConfigService
Gets the .NAME field for a PV if it exists. Otherwise, this returns null- Specified by:
getRealNameForAlias
in interfaceConfigService
- Parameters:
aliasName
-- Returns:
- String RealNameForAlias
-
getAllAliases
public List<String> getAllAliases()
Description copied from interface:ConfigService
Get all the aliases in the system. This is used for matching during glob requests in the UI.- Specified by:
getAllAliases
in interfaceConfigService
- Returns:
- String AllAliases
-
getExtraFields
public String[] getExtraFields()
Description copied from interface:ConfigService
Get a list of extra fields that are obtained when we initially make a request for archiving. These are used in the policies to make decisions on how to archive the PV.- Specified by:
getExtraFields
in interfaceConfigService
- Returns:
- String ExtraFields
-
getRuntimeFields
public Set<String> getRuntimeFields()
Description copied from interface:ConfigService
Get a list of fields for PVs that are monitored and maintained in the engine. These are used when displaying the PV in visualization tools like the ArchiveViewer as additional information for the PV. Some of these could be archived along with the PV but need not be. In this case, the engine simply maintains the latest copy in memory and this is served up when data from the engine in included in the stream.- Specified by:
getRuntimeFields
in interfaceConfigService
- Returns:
- String RuntimeFields
-
getETLLookup
public PBThreeTierETLPVLookup getETLLookup()
Description copied from interface:ConfigService
Return the runtime state for ETL. This may eventually be moved to a RunTime class but that would still start from the configservice.- Specified by:
getETLLookup
in interfaceConfigService
- Returns:
- PBThreeTierETLPVLookup
-
getRetrievalRuntimeState
public RetrievalState getRetrievalRuntimeState()
Description copied from interface:ConfigService
Returns the runtime state for the retrieval app- Specified by:
getRetrievalRuntimeState
in interfaceConfigService
- Returns:
- RetrievalState
-
isShuttingDown
public boolean isShuttingDown()
Description copied from interface:ConfigService
Is this appliance component shutting down?- Specified by:
isShuttingDown
in interfaceConfigService
- Returns:
- boolean True or False
-
addShutdownHook
public void addShutdownHook(Runnable runnable)
Description copied from interface:ConfigService
Add an appserver agnostic shutdown hook; for example, to close the CA channels on shutdown- Specified by:
addShutdownHook
in interfaceConfigService
- Parameters:
runnable
- Runnable
-
shutdownNow
public void shutdownNow()
Description copied from interface:ConfigService
Call the registered shutdown hooks and shut the archive appliance down.- Specified by:
shutdownNow
in interfaceConfigService
-
getExternalArchiverDataServers
public Map<String,String> getExternalArchiverDataServers()
Description copied from interface:ConfigService
This product has the ability to proxy data from other archiver data servers. We currently integrate with Channel Archiver XMLRPC data servers and other EPICS Archiver Appliance clusters. Get a list of external Archiver Data Servers that we know about.- Specified by:
getExternalArchiverDataServers
in interfaceConfigService
- Returns:
- Map ExternalArchiverDataServers
-
addExternalArchiverDataServer
public void addExternalArchiverDataServer(String serverURL, String archivesCSV) throws IOException
Description copied from interface:ConfigService
Add a external Archiver Data Server into the system.- Specified by:
addExternalArchiverDataServer
in interfaceConfigService
- Parameters:
serverURL
- - For Channel Archivers, this is the URL to the XML-RPC server. For other EPICS Archiver Appliance clusters, this is thedata_retrieval_url
of the cluster as defined in theappliances.xml
.archivesCSV
- - For Channel Archivers, this is a comma separated list of indexes. For other EPICS Archiver Appliance clusters, this is the string pbraw.- Throws:
IOException
-
-
removeExternalArchiverDataServer
public void removeExternalArchiverDataServer(String serverURL, String archivesCSV) throws IOException
Description copied from interface:ConfigService
Removes an entry for an external Archiver Data Server from the system Note; we may need to restart the entire cluster for this change to take effect.- Specified by:
removeExternalArchiverDataServer
in interfaceConfigService
- Parameters:
serverURL
- - For Channel Archivers, this is the URL to the XML-RPC server. For other EPICS Archiver Appliance clusters, this is thedata_retrieval_url
of the cluster as defined in theappliances.xml
.archivesCSV
- - For Channel Archivers, this is a comma separated list of indexes. For other EPICS Archiver Appliance clusters, this is the string pbraw.- Throws:
IOException
-
-
getChannelArchiverDataServers
public List<ChannelArchiverDataServerPVInfo> getChannelArchiverDataServers(String pvName)
Description copied from interface:ConfigService
Return a list of ChannelArchiverDataServerPVInfos for a PV if one exists; otherwise return null. The servers are sorted in order of the start seconds. Note: this only applies to Channel Archiver XML RPC servers. For proxying external EPICS Archiver Appliance clusters, we do not cache the PV's that are being archived on the external system.- Specified by:
getChannelArchiverDataServers
in interfaceConfigService
- Parameters:
pvName
- The name of PV.- Returns:
- ChannelArchiverDataServerPVInfo
-
computePolicyForPV
public PolicyConfig computePolicyForPV(String pvName, MetaInfo metaInfo, UserSpecifiedSamplingParams userSpecParams) throws IOException
Description copied from interface:ConfigService
Given a pvName (for now, we should have a pv details object of some kind soon), determine the policy applicable for archiving this PV.- Specified by:
computePolicyForPV
in interfaceConfigService
- Parameters:
pvName
- The name of PV.metaInfo
- The MetaInfo of PVuserSpecParams
- UserSpecifiedSamplingParams- Returns:
- PolicyConfig
- Throws:
IOException
-
-
getPoliciesInInstallation
public HashMap<String,String> getPoliciesInInstallation() throws IOException
Description copied from interface:ConfigService
Return a map of name to description of all the policies in the system This is used to drive a dropdown in the UI.- Specified by:
getPoliciesInInstallation
in interfaceConfigService
- Returns:
- HashMap
- Throws:
IOException
-
-
getFieldsArchivedAsPartOfStream
public List<String> getFieldsArchivedAsPartOfStream() throws IOException
Description copied from interface:ConfigService
This product offers the ability to archive certain fields (like HIHI, LOLO etc) as part of every PV. The data for these fields is embedded into the stream as extra fields using the FieldValues interface of events. This method lists all these fields. Requests for archiving these fields are deferred to and combined with the request for archiving the .VAL. We also assume that the data type (double/float) for these fields is the same as the .VAL.- Specified by:
getFieldsArchivedAsPartOfStream
in interfaceConfigService
- Returns:
- String
- Throws:
IOException
-
-
getArchiverTypeSystem
public TypeSystem getArchiverTypeSystem()
Description copied from interface:ConfigService
Returns a TypeSystem object that is used to convert from JCA DBR's to Event's (actually, DBRTimeEvents)- Specified by:
getArchiverTypeSystem
in interfaceConfigService
- Returns:
- TypeSystem
-
getPolicyText
public InputStream getPolicyText() throws IOException
Description copied from interface:ConfigService
Return the text of the policy for this installation. Gets you an InputStream; remember to close it.- Specified by:
getPolicyText
in interfaceConfigService
- Returns:
- InputStream
- Throws:
IOException
-
-
getEngineContext
public EngineContext getEngineContext()
Description copied from interface:ConfigService
Return the runtime state for the engine.- Specified by:
getEngineContext
in interfaceConfigService
- Returns:
- EngineContext
-
getMgmtRuntimeState
public MgmtRuntimeState getMgmtRuntimeState()
Description copied from interface:ConfigService
Return the runtime state for the mgmt webapp.- Specified by:
getMgmtRuntimeState
in interfaceConfigService
- Returns:
- MgmtRuntimeStat
-
getWarFile
public ConfigService.WAR_FILE getWarFile()
Description copied from interface:ConfigService
Which component is this configservice instance.- Specified by:
getWarFile
in interfaceConfigService
- Returns:
- WAR_FILE
-
getEventBus
public com.google.common.eventbus.EventBus getEventBus()
Description copied from interface:ConfigService
Get the event bus used for events within this appliance.- Specified by:
getEventBus
in interfaceConfigService
- Returns:
- EventBus
-
getPVNameToKeyConverter
public PVNameToKeyMapping getPVNameToKeyConverter()
Description copied from interface:ConfigService
Implementation for converting a PV name to something that forms the prefix of a chunk's key. See @see{PVNameToKeyMapping} for more details.- Specified by:
getPVNameToKeyConverter
in interfaceConfigService
- Returns:
- PVNameToKeyMapping
-
getProcessMetrics
public ProcessMetrics getProcessMetrics()
-
getWebInfFolder
public String getWebInfFolder()
Description copied from interface:ConfigService
We expect to live within a servlet container. This call returns the full path to the WEB-INF folder of the webapp as it is deployed in the container. Is typically a call to theservletContext.getRealPath("WEB-INF/")
- Specified by:
getWebInfFolder
in interfaceConfigService
- Returns:
- String WebInfFolder
-
getPausedPVsInThisAppliance
public Set<String> getPausedPVsInThisAppliance()
Description copied from interface:ConfigService
Get a set of PVs that have been paused in this appliance.- Specified by:
getPausedPVsInThisAppliance
in interfaceConfigService
- Returns:
- String
-
refreshPVDataFromChannelArchiverDataServers
public void refreshPVDataFromChannelArchiverDataServers()
Description copied from interface:ConfigService
For all the Channel Archiver XMLRPC data servers in the mix, update the PV info. This should help improve performance a little in proxying data from ChannelArchiver data servers that are still active. For proxying external EPICS Archiver Appliance clusters, since we do not cache the PV's that are being archived on the external system, this is a no-op.- Specified by:
refreshPVDataFromChannelArchiverDataServers
in interfaceConfigService
-
getFailoverApplianceURL
public String getFailoverApplianceURL(String pvName)
Description copied from interface:ConfigService
Get the first external archiver appliance that also archives this PV and is configured with a mergeDuringRetrieval query parameter.- Specified by:
getFailoverApplianceURL
in interfaceConfigService
- Returns:
- - Returns null if no failover appliance.
-
getFailoverServerURLs
public Set<String> getFailoverServerURLs()
Description copied from interface:ConfigService
Get a list of external archiver appliances configured for failover. Failover appliances are not used as proxies to minimize imposing the retrieval load of the this installation on a potentially less powerful appliance used principally for failover.- Specified by:
getFailoverServerURLs
in interfaceConfigService
- Returns:
-
resetFailoverCaches
public void resetFailoverCaches()
Description copied from interface:ConfigService
Each retrieval component in a cluster caches the PV's from remote failover appliances. These caches contain one entry for each PV in this appliance indicating if the PV is being archived in the remote appliance. This information is cached using a TTL to minimize the impact on the remote failover appliance. This method manually unloads this cache.- Specified by:
resetFailoverCaches
in interfaceConfigService
-
getNamedFlag
public boolean getNamedFlag(String name)
Description copied from interface:ConfigService
Named flags are used to control various process in the appliance; for example, the ETL process in a PlainPBStoragePlugin Named flags are not persistent; each time the server starts up, all the named flags are set to false You can optionally load values for named flags from a file by specifying the ARCHAPPL_NAMEDFLAGS_PROPERTIES_FILE_PROPERTY property in archappl.properties. This method gets the value of the specified named flag. If the flag has not been defined before in the cluster, this method will return false.- Specified by:
getNamedFlag
in interfaceConfigService
- Parameters:
name
-- Returns:
- boolean True or False
-
setNamedFlag
public void setNamedFlag(String name, boolean value)
Description copied from interface:ConfigService
Sets the value of the named flag specified by name to the specified value- Specified by:
setNamedFlag
in interfaceConfigService
- Parameters:
name
-value
-
-
getNamedFlagNames
public Set<String> getNamedFlagNames()
Description copied from interface:ConfigService
Return the names of all the named flags that we know about- Specified by:
getNamedFlagNames
in interfaceConfigService
- Returns:
- String
-
getTimeOfAppserverStartup
public long getTimeOfAppserverStartup()
Description copied from interface:ConfigService
Get an approximate time in epoch seconds when the appserver started up.- Specified by:
getTimeOfAppserverStartup
in interfaceConfigService
- Returns:
- The time this app server started up.
-
getAllExpandedNames
public void getAllExpandedNames(Consumer<String> func)
Description copied from interface:ConfigService
For automated PV submission, IOC engineers could add .VAL, fields, aliases etc. This method attempts to return all possible PV's that the archiver could know about. This is a lot of names; so we take in a consumer that potentially streams a name out as quickly as possible.- Specified by:
getAllExpandedNames
in interfaceConfigService
- Parameters:
func
- A consumer of pvNames
-
-