Modifier and Type | Class and Description |
---|---|
protected class |
SQLiteHistorian.DBLockClosable |
protected class |
SQLiteHistorian.Query |
protected class |
SQLiteHistorian.SQLiteStorageSession |
protected static class |
SQLiteHistorian.Tables |
protected static class |
SQLiteHistorian.Tag |
QUALITY_NOT_FOUND
Constructor and Description |
---|
SQLiteHistorian() |
SQLiteHistorian(java.lang.String filePath) |
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.String> |
browse(java.util.Optional<java.lang.String> filter)
Returns a list of paths with data stored, optionally matching a filter.
|
StorageSession |
createStorageSession()
Used to store values to the historian.
|
protected SQLiteHistorian.Tag |
createTag(java.lang.String tagPath) |
void |
delete(java.util.List<java.lang.String> paths)
Deletes the tags and all data for the specified paths.
|
void |
executeMaintenance() |
protected java.sql.Connection |
getConnection() |
<T> T |
getProperty(Property<T> prop)
Returns the configured or status property requested,
or the default value if no further info is available.
|
Status |
getQueryStatus()
Returns the status of the storage system.
|
Status |
getStorageStatus()
Returns the status of the storage system.
|
protected int |
getStorageSyncId(java.lang.String tagPath,
long timestamp) |
int |
getSyncableData(long syncId)
Returns the number of data points that could be synchronized from the given point.
|
long |
getSyncIdTimestamp(long syncId)
Returns the timestamp of the start of the sync group.
|
protected long |
getTotalDataCount() |
boolean |
hasSyncableData(long syncId)
Returns whether there is data available to sync based on the provided id.
|
void |
initDriver() |
void |
initialize(PropertySet properties) |
protected void |
initializeSync() |
protected SQLiteHistorian.DBLockClosable |
lockDB() |
protected void |
newSyncId() |
protected boolean |
propertiesDiffer(PropertySet a,
PropertySet b) |
QueryResult |
query(java.util.List<java.lang.String> tags,
long startTime,
long endTime,
boolean includeBounding)
Queries the values for the given paths over the specified span of time.
|
void |
register(java.lang.String tagPath,
PropertySet properties)
Provides information about a path.
|
protected static java.lang.Object |
runPrepScalarQuery(java.sql.Connection c,
java.lang.String query,
java.lang.Object... args) |
protected static int |
runPrepUpdateQuery(java.sql.Connection c,
java.lang.String query,
java.lang.Object... args) |
protected static java.lang.Object |
runScalarQuery(java.sql.Connection c,
java.lang.String query) |
protected static int |
runUpdateQuery(java.sql.Connection c,
java.lang.String query) |
void |
shutdown() |
SyncQueryResults |
sync(long syncId)
This returns a set of data- it's up to the implementation to decide what makes sense.
|
public SQLiteHistorian()
public SQLiteHistorian(java.lang.String filePath)
public <T> T getProperty(Property<T> prop)
Historian
getProperty
in interface Historian
protected SQLiteHistorian.DBLockClosable lockDB()
protected long getTotalDataCount()
public Status getQueryStatus()
Historian
getQueryStatus
in interface Historian
public Status getStorageStatus()
Historian
getStorageStatus
in interface Historian
protected java.sql.Connection getConnection() throws java.sql.SQLException
java.sql.SQLException
public void initDriver() throws java.lang.Exception
java.lang.Exception
public void initialize(PropertySet properties) throws java.lang.Exception
initialize
in interface Historian
java.lang.Exception
protected boolean propertiesDiffer(PropertySet a, PropertySet b)
public void register(java.lang.String tagPath, PropertySet properties) throws java.lang.Exception
Historian
protected SQLiteHistorian.Tag createTag(java.lang.String tagPath) throws java.lang.Exception
java.lang.Exception
public StorageSession createStorageSession() throws java.lang.Exception
Historian
It implements AutoClosable, and should often be used in a try-with-resources block, such as:
try(StorageSession s = historian.createStorageSession()){
s.store...
}
Important: Not every historian will support storage, some are read-only. This can be checked by calling getStorageStatus() and checking the return for "NotSupported".
createStorageSession
in interface Historian
java.lang.Exception
public java.util.List<java.lang.String> browse(java.util.Optional<java.lang.String> filter)
Historian
public void delete(java.util.List<java.lang.String> paths)
Historian
public QueryResult query(java.util.List<java.lang.String> tags, long startTime, long endTime, boolean includeBounding)
Historian
public void executeMaintenance()
protected static int runUpdateQuery(java.sql.Connection c, java.lang.String query) throws java.sql.SQLException
java.sql.SQLException
protected static int runPrepUpdateQuery(java.sql.Connection c, java.lang.String query, java.lang.Object... args) throws java.sql.SQLException
java.sql.SQLException
protected static java.lang.Object runScalarQuery(java.sql.Connection c, java.lang.String query) throws java.sql.SQLException
java.sql.SQLException
protected static java.lang.Object runPrepScalarQuery(java.sql.Connection c, java.lang.String query, java.lang.Object... args) throws java.sql.SQLException
java.sql.SQLException
protected void initializeSync() throws java.lang.Exception
java.lang.Exception
public boolean hasSyncableData(long syncId)
Syncable
hasSyncableData
in interface Syncable
public SyncQueryResults sync(long syncId)
Syncable
protected void newSyncId()
protected int getStorageSyncId(java.lang.String tagPath, long timestamp)
public int getSyncableData(long syncId)
Syncable
getSyncableData
in interface Syncable
public long getSyncIdTimestamp(long syncId)
Syncable
getSyncIdTimestamp
in interface Syncable