Class Auditer

java.lang.Object
cz.metacentrum.perun.core.impl.Auditer

public class Auditer extends Object
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 Details

    • Auditer

      public Auditer()
  • Method Details

    • registerAttributeModule

      public static void registerAttributeModule(AttributesModuleImplApi attributesModuleImplApi)
    • unregisterAttributeModule

      public static void unregisterAttributeModule(AttributesModuleImplApi attributesModuleImplApi)
    • 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

      public List<AuditerMessage> getMessages()
      Get stored (not flushed) messages for current transaction. Messages remain stored.
      Returns:
      list of messages
    • initialize

      public void initialize()
    • log

      public void log(PerunSession sess, AuditEvent event)
      Log message. Takes AuditEvent object and logs it to db.
      Parameters:
      sess - Perun session
      event - Audit event to be logged.
    • logWithoutTransaction

      public void logWithoutTransaction(PerunSession sess, AuditEvent event)
      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

      public void setPerunPool(DataSource perunPool)
    • storeMessageToDb

      public void storeMessageToDb(PerunSession sess, AuditEvent event)
      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

      public void storeMessagesToDb(List<AuditerMessage> auditerMessages)
      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