Interface LogManager
- All Superinterfaces:
ADEPT2Service,ConfigurableService
Logs which are used to store different kinds of
information. The structure of a log (which information is stored? which data
type is used?) is determined by a schema. The log
provides dedicated methods to write entries to and read entries from the log.
The log manager is not necessarily a singular entity. Each log manager is
assigned a single data source, i.e. if different logs should be kept in
different data sources there's a log manager - containing the respective logs -
for each one.
What must be considered here is that the
query(SessionToken, String, int) method allows direct access to the
logged data, so even efficient SQL joins between different log tables are
possible. However, this is only true if the involved logs are stored in the
same data source!
Each log entry (or the entry of a complex column) is uniquely identified by
an ID. These IDs are created from a sequence in ascending order. I.e. they
allow a more fine-grained temporal ordering, since timestamps may sometimes
be inadequate. Some DBMSs may not support sub-second precision, and while
System.currentTimeMillis() may support millisecond precision it does
often not support millisecond accuracy. I.e. logged entries with only a few
milliseconds between them may receive the same timestamp.
-
Field Summary
Fields inherited from interface de.aristaflow.adept2.base.service.ConfigurableService
CONF_RUNTIME_CONF_PREFIX -
Method Summary
Modifier and TypeMethodDescriptionformatCondition(SessionToken session, Log log, String conditionFormat, Serializable... values) Formats the given condition format string and values to an SQL condition that can e.g.Returns the execution history managed by this log manager.query(SessionToken session, String sqlQuery, int maxEntries) Executes a user-defined SQL query on the data source of this log manager.Methods inherited from interface de.aristaflow.adept2.base.service.ADEPT2Service
getLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, init, ping, preShutdown, shutdown, startMethods inherited from interface de.aristaflow.adept2.base.service.ConfigurableService
getChangeableConfigurationKeys, getConfiguration, getConfigurationValue, setConfigurationValue
-
Method Details
-
getExecutionHistory
ExecutionHistory getExecutionHistory()Returns the execution history managed by this log manager.- Returns:
- the execution history managed by this log manager
-
query
Executes a user-defined SQL query on the data source of this log manager. This allows e.g. efficient SQL joins between different log tables. The results are returned in aResultSet. This method only returns the specified number of entries; all excess entries are silently dropped.The returned result set is disconnected, i.e. all its data is cached in memory and therefore doesn't require an open connection to the database. This is required because connections are not serialisable and this method is potentially called remotely.
TODO: explain how data is stored (table names, uuids stored as strings, etc.)
- Parameters:
session- The session which is used to check for access rights on this method.sqlQuery- the SQL query to be executedmaxEntries- the maximum number of entries to return; the excess entries are silently dropped;0disables this limit- Returns:
- a disconnected result set (i.e. all data is cached in memory)
- Throws:
SQLException- if a database access error occurs
-
formatCondition
String formatCondition(SessionToken session, Log log, String conditionFormat, Serializable... values) throws DataSourceException Formats the given condition format string and values to an SQL condition that can e.g. be used in the WHERE clause ofquery(SessionToken, String, int)orLog.read(SessionToken, String, String, int, String...).{{c:[prefix.]<column name> <comparison operator>}} AND {c:[prefix.]<column name> <comparison operator>}}
TODO describe format- Parameters:
session- The session which is used to check for access rights on this method.log- The log for which to create the WHERE clause.conditionFormat- the condition format stringvalues- the values to be filled in the condition format string; the number of values must match the condition format string- Returns:
- an SQL condition formatted from the given column, comparison operator and value
- Throws:
DataSourceException- if an unrecoverable error occurs while accessing the data source
-