Class AbstractHistorian<S extends HistorianSettings>
- All Implemented Interfaces:
Historian<S>
- Direct Known Subclasses:
CsvHistorian
,QuestDBHistorian
,SQLiteHistorian
The AbstractHistorian class manages core components such as logging, gateway context, and path adaptation, and provides mechanisms to start and stop historian operations. It also includes utility methods for path normalization and transformation, which subclasses can leverage for processing historical data paths.
Responsibilities include: - Managing the lifecycle of the historian (startup and shutdown). - Logging related to the historian's operations. - Providing access to a QualifiedPathAdapter for path normalization. - Utility methods for working with paths, including transformation and reversal.
Subclasses are expected to provide additional capability and implementations specific to their needs, possibly overriding some of the base behaviors.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final GatewayContext
protected String
protected S
protected final LoggerEx
protected final QualifiedPathAdapter
protected boolean
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractHistorian
(GatewayContext context, String historianName) protected
AbstractHistorian
(GatewayContext context, String historianName, @Nullable LoggerEx logger) -
Method Summary
Modifier and TypeMethodDescriptionprotected QualifiedPathAdapter
getName()
Retrieves the name of the historian.Retrieves theQualifiedPathAdapter
instance used for normalizingQualifiedPath
objects.Retrieves the settings associated with the historian.protected QualifiedPath
reversePath
(QualifiedPath path) void
shutdown()
Shuts down the historian and any associated resources.void
startup()
Starts the historian and initializes any necessary resources required for its operation.protected QualifiedPath
transformPath
(QualifiedPath path) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.inductiveautomation.historian.gateway.api.Historian
getQueryEngine, getStatus, getStorageEngine, handleNameChange, handleSettingsChange
-
Field Details
-
logger
-
context
-
pathAdapter
-
historianName
-
historianSettings
-
started
protected boolean started
-
-
Constructor Details
-
AbstractHistorian
-
AbstractHistorian
protected AbstractHistorian(GatewayContext context, String historianName, @Nullable @Nullable LoggerEx logger)
-
-
Method Details
-
getPathAdapter
Description copied from interface:Historian
Retrieves theQualifiedPathAdapter
instance used for normalizingQualifiedPath
objects. By default, this method returns theQualifiedPathAdapter.DEFAULT
.- Specified by:
getPathAdapter
in interfaceHistorian<S extends HistorianSettings>
- Returns:
- the
QualifiedPathAdapter
instance used for path normalization
-
getName
Description copied from interface:Historian
Retrieves the name of the historian.- Specified by:
getName
in interfaceHistorian<S extends HistorianSettings>
- Returns:
- the name of the historian as a
String
-
getSettings
Description copied from interface:Historian
Retrieves the settings associated with the historian. The returned settings provide configuration details specific to the historian's operation.- Specified by:
getSettings
in interfaceHistorian<S extends HistorianSettings>
- Returns:
- an instance of
S
representing the settings of the historian
-
startup
Description copied from interface:Historian
Starts the historian and initializes any necessary resources required for its operation. This method is responsible for setting up the internal state of the historian and preparing it to handle incoming requests or data processing.Implementations may include the following operations: - Allocating and initializing required resources. - Establishing connections to external systems or storage backends. - Setting up any internal scheduling or maintenance tasks.
If this method is invoked when the historian is already started, an
IllegalStateException
may be thrown to prevent duplicate initialization.- Specified by:
startup
in interfaceHistorian<S extends HistorianSettings>
- Throws:
Exception
- if an error occurs during the startup process.
-
shutdown
public void shutdown()Description copied from interface:Historian
Shuts down the historian and any associated resources. This method is responsible for ensuring that the historian ceases operations cleanly and releases any allocated resources. Once invoked, the historian should no longer accept or process new requests.Implementations may include tasks such as: - Stopping active data processing tasks. - Freeing up connections to external systems or storage. - Logging a shutdown message for diagnostic or auditing purposes.
If this method is overridden in a subclass, it is recommended to call the superclass implementation to ensure proper cleanup behavior.
- Specified by:
shutdown
in interfaceHistorian<S extends HistorianSettings>
-
createPathAdapter
-
transformPath
-
reversePath
-