Package net.sf.basedb.core.log
Interface LogManagerFactory
- All Superinterfaces:
Action
- All Known Implementing Classes:
DbLogManagerFactory
A log manager factory handles the creation of log managers and
entity loggers. There is usually only one factory instance created
for the entire BASE application. Implementations must be thread safe since
the factory is used by multiple treads at the same time.
Each transaction that results in updates to the database are
intercepted by the LoggingInterceptor
which calls
getLogManager(LogControl)
to create a new log
manager for the transaction.
For each created, modified or deleted item in the transaction,
getEntityLogger(LogManager, Object)
is called. If this method
returns an object, EntityLogger.logChanges(LogManager, EntityDetails)
is called and the rest is up to the actual implementation.
- Version:
- 2.13
- Author:
- Nicklas
- Last modified
- $Date: 2012-08-06 15:20:43 +0200 (må, 06 aug 2012) $
-
Method Summary
Modifier and TypeMethodDescriptiongetEntityLogger
(LogManager logManager, Object entity) Get/create an entity logger for logging changes to the given entity.getLogManager
(LogControl logControl) Get/create a log manager to log events in a given transaction.boolean
isLoggable
(Object entity) Checks if changes to the given entity should be logged or not.
-
Method Details
-
getLogManager
Get/create a log manager to log events in a given transaction. The log manager is used for this transaction only and is only used by a single thread in the core. The factory may re-use the same log manager in other (concurrent) transactions if the log manager implementation is thread safe.- Parameters:
logControl
- A log controller with information about the current transaction- Returns:
- A log manager object
-
isLoggable
Checks if changes to the given entity should be logged or not. If this method returns true, thengetEntityLogger(LogManager, Object)
mustn't return null if called with the same entity parameter.- Parameters:
entity
- The entity to check- Returns:
- TRUE if the changes to the entity should be logged, FALSE if not
-
getEntityLogger
Get/create an entity logger for logging changes to the given entity. This method is called for each modified entity and is used within a single transaction only. The factory may re-use the same entity loggers in other transactions if the implementation is thread safe.- Parameters:
logManager
- The log manager used in the current transactionentity
- The entity to get a logger for- Returns:
- An entity logger, or null if changes to the entity shouldn't be logged
-