Interface HistoryManager
-
public interface HistoryManager
This is the system that handles the store and forward system, allowing historical data to be stored in a reliable way. Each store and forward pipeline has a set of "sinks". Sinks can handle certain types of data, indicated by the HistoryFlavor. A given store and forward pipeline can only have 1 sink for each history flavor. In other parts of the system, the compatible sinks can be retrieved by calling getStores(...) for the specific data flavor to be stored.
There are two types of pipelines in this system: those managed by the system, and those created programmatically by modules. Modules can register sinks using the registerSink function, which will create a pipeline if it doesn't already exist.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canAccept(java.lang.String dataStore, HistoryFlavor flavor)
Returns true if the data store will accept the type of data.void
deleteQuarantinedData(java.lang.String dataStore, java.util.List<java.lang.Long> quarantinedDataIds)
Deletes the quarantined data associated with theQuarantinedDataInfo
id.void
exportQuarantinedToXML(java.lang.String dataStore, java.util.List<java.lang.Long> quarantinedDataIds, java.io.Writer writer)
java.util.List<QuarantinedDataInfo>
getQuarantinedDataInfo(java.lang.String dataStore)
Returns information describing the data quarantined in the given store.java.util.List<DataSinkInformation>
getStatusInfo(java.lang.String dataStore)
Returns the hierarchy of status information for the given store, flattened into a list.java.util.List<java.lang.String>
getStores(HistoryFlavor historyType)
Returns a list of data stores that can accept the specified type of data.void
importQuarantinedFromXML(java.lang.String dataStore, java.io.InputStream is)
void
registerHistoryFlavor(HistoryFlavor flavor)
Registers a history flavor with the system.void
registerSink(DataSink sink)
Sets up a custom history sink.void
registerSinkInPipline(DataSink sink)
Similar to registerSink, except that it will not create a new store and forward pipeline if the name doesn't exist.void
storeHistory(java.lang.String dataStore, HistoricalData values)
Stores the data to the given history store.void
unquarantineData(java.lang.String dataStore, java.util.List<java.lang.Long> quarantinedDataIds)
Unquaratines the givenQuarantinedDataInfo
ids, which will cause the data to enter the forward cycle again.void
unregisterHistoryFlavor(HistoryFlavor flavor)
void
unregisterSink(DataSink sink, boolean allowDataDeletion)
Removes the given sink from the specified pipeline.
-
-
-
Method Detail
-
registerSink
void registerSink(DataSink sink)
Sets up a custom history sink. A standard store and forward pipeline will be created if it does not already exist, unless the sink registered also implements theStoreAndForwardEngine
interface. The pipeline that this sink belongs to is defined byDataSink.getPipelineName()
-
registerSinkInPipline
void registerSinkInPipline(DataSink sink)
Similar to registerSink, except that it will not create a new store and forward pipeline if the name doesn't exist. Instead, it will hold the sink until the store and forward engine is created or registered. This is often used to add sinks to datasource pipelines, where the pipeline may not be created yet, due to system startup order. Sinks registered in this way will be removed by the normal unregisterSink() function.
-
unregisterSink
void unregisterSink(DataSink sink, boolean allowDataDeletion)
Removes the given sink from the specified pipeline. If allowDataDeletion is true, any cached data for the sink will be deleted.
-
storeHistory
void storeHistory(java.lang.String dataStore, HistoricalData values) throws java.lang.IllegalArgumentException, java.lang.Exception
Stores the data to the given history store. Will throw an exception if the datastore cannot except the type of data passed in.If the gateway is part of a clustered pair, data will only be stored when node is active. Otherwise it will be silently discarded.
If the store doesn't exist, IllegalArgumentException will be thrown.
- Throws:
java.lang.IllegalArgumentException
java.lang.Exception
-
canAccept
boolean canAccept(java.lang.String dataStore, HistoryFlavor flavor)
Returns true if the data store will accept the type of data. This returns false if the store does not understand the data, or is not licensed to accept it. Important: It also returns false if this is a redundant node and redundancy is not currently active.
-
getStores
@Nonnull java.util.List<java.lang.String> getStores(HistoryFlavor historyType)
Returns a list of data stores that can accept the specified type of data. If historyType is NULL, will return all registered data stores.
-
getStatusInfo
java.util.List<DataSinkInformation> getStatusInfo(java.lang.String dataStore)
Returns the hierarchy of status information for the given store, flattened into a list.- Throws:
java.lang.IllegalArgumentException
- if the given dataStore name doesn't exist.
-
getQuarantinedDataInfo
@Nonnull java.util.List<QuarantinedDataInfo> getQuarantinedDataInfo(java.lang.String dataStore)
Returns information describing the data quarantined in the given store.
-
unquarantineData
void unquarantineData(@Nullable java.lang.String dataStore, @Nonnull java.util.List<java.lang.Long> quarantinedDataIds)
Unquaratines the givenQuarantinedDataInfo
ids, which will cause the data to enter the forward cycle again.
-
deleteQuarantinedData
void deleteQuarantinedData(java.lang.String dataStore, java.util.List<java.lang.Long> quarantinedDataIds)
Deletes the quarantined data associated with theQuarantinedDataInfo
id.
-
exportQuarantinedToXML
void exportQuarantinedToXML(java.lang.String dataStore, java.util.List<java.lang.Long> quarantinedDataIds, java.io.Writer writer) throws java.io.IOException
- Throws:
java.io.IOException
-
importQuarantinedFromXML
void importQuarantinedFromXML(java.lang.String dataStore, java.io.InputStream is) throws java.io.IOException
- Throws:
java.io.IOException
-
registerHistoryFlavor
void registerHistoryFlavor(HistoryFlavor flavor)
Registers a history flavor with the system. Only necessary in order to support importing of historical data from the store and forward system.
-
unregisterHistoryFlavor
void unregisterHistoryFlavor(HistoryFlavor flavor)
-
-