Package cz.metacentrum.perun.core.impl
Class Auditer
java.lang.Object
cz.metacentrum.perun.core.impl.Auditer
This class is responsible for runtime logging of audit events. It gets messages and assocaites them with current
transaction. If there's no transaction currently running, message is immediately flushed out. When transaction ends,
transaction manager must call method flush in this class for the ending transaction.
- Author:
- Slavek Licehammer glory@ics.muni.cz, Jiri Mauritz, Michal Šťava, Pavel Zlámal, Martin Kuba, Vojtech Sassmann, Metodej Klang
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clean()
All prepared auditer messages in the last top-level transaction are erased without storing into db.void
Erases the auditer messages for the last transaction.void
flush()
Imidiately flushes stored message for last top-level transaction into the logvoid
Flush auditer messages of the last messages to the store of the outer transaction.Get stored (not flushed) messages for current transaction.void
void
log
(PerunSession sess, AuditEvent event) Log message.void
logWithoutTransaction
(PerunSession sess, AuditEvent event) Log message without checking current transactions.void
Creates new list for saving auditer messages of a new nested transactions.void
Initialize new lists for sotring Audit messages.static void
registerAttributeModule
(AttributesModuleImplApi attributesModuleImplApi) void
setPerunPool
(DataSource perunPool) void
storeMessagesToDb
(List<AuditerMessage> auditerMessages) Stores the list of AuditerMessages to the DB in batch.void
storeMessageToDb
(PerunSession sess, AuditEvent event) Stores the message to the DB.static void
unregisterAttributeModule
(AttributesModuleImplApi attributesModuleImplApi)
-
Constructor Details
-
Auditer
public Auditer()
-
-
Method Details
-
registerAttributeModule
-
unregisterAttributeModule
-
clean
public void clean()All prepared auditer messages in the last top-level transaction are erased without storing into db. Mostly wanted while rollbacking. -
cleanNestedTransation
public void cleanNestedTransation()Erases the auditer messages for the last transaction. -
flush
public void flush()Imidiately flushes stored message for last top-level transaction into the log -
flushNestedTransaction
public void flushNestedTransaction()Flush auditer messages of the last messages to the store of the outer transaction. There should be at least one nested transaction. -
getMessages
Get stored (not flushed) messages for current transaction. Messages remain stored.- Returns:
- list of messages
-
initialize
public void initialize() -
log
Log message. Takes AuditEvent object and logs it to db.- Parameters:
sess
- Perun sessionevent
- Audit event to be logged.
-
logWithoutTransaction
Log message without checking current transactions.IMPORTANT: This method stores the message aside from DB transaction.
-
newNestedTransaction
public void newNestedTransaction()Creates new list for saving auditer messages of a new nested transactions. -
newTopLevelTransaction
public void newTopLevelTransaction()Initialize new lists for sotring Audit messages. -
setPerunPool
-
storeMessageToDb
Stores the message to the DB.It also checks if there are any messages which can be resolved by registered attribute modules. Store these resolved messages too.
- Parameters:
sess
-event
-
-
storeMessagesToDb
Stores the list of AuditerMessages to the DB in batch.It also checks if there are any messages which can be resolved by registered attribute modules. Store these resolved messages too.
- Parameters:
auditerMessages
- list of AuditerMessages
-