public interface LogManager extends ADEPT2Service
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.
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
formatCondition(SessionToken session,
Log log,
java.lang.String conditionFormat,
java.io.Serializable... values)
Formats the given condition format string and values to an SQL condition
that can e.g. be used in the WHERE clause of
query(SessionToken, String, int) or
Log.read(SessionToken, String, String, int, String...). |
ExecutionHistory |
getExecutionHistory()
Returns the execution history managed by this log manager.
|
java.sql.ResultSet |
query(SessionToken session,
java.lang.String sqlQuery,
int maxEntries)
Executes a user-defined SQL query on the data source of this log manager.
|
getLocalUris, getRelease, getRuntimeRequiredServices, getServiceInstanceName, getStartupRequiredServices, getURIs, init, ping, preShutdown, shutdown, startExecutionHistory getExecutionHistory()
java.sql.ResultSet query(SessionToken session, java.lang.String sqlQuery, int maxEntries) throws java.sql.SQLException
ResultSet. 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.)
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; 0 disables this limitjava.sql.SQLException - if a database access error occursjava.lang.String formatCondition(SessionToken session, Log log, java.lang.String conditionFormat, java.io.Serializable... values) throws DataSourceException
query(SessionToken, String, int) or
Log.read(SessionToken, String, String, int, String...).
{{c:[prefix.]<column name> <comparison operator>}} AND
{c:[prefix.]<column name> <comparison operator>}}
TODO describe format
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 stringDataSourceException - if an unrecoverable error occurs while
accessing the data source