Class AuditLogger

  • All Implemented Interfaces:
    Auditor, Configurable, Closeable

    public class AuditLogger
    extends java.lang.Object
    implements Auditor
    A default auditor that simply prints the audited instances. The output could be directed to a file, defaults to System.out.
    Author:
    Pinaki Poddar
    • Constructor Summary

      Constructors 
      Constructor Description
      AuditLogger()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void audit​(Broker broker, java.util.Collection<Audited> newObjects, java.util.Collection<Audited> updates, java.util.Collection<Audited> deletes)
      OpenJPA runtime will invoke this method with the given parameters within a transaction.
      void close()  
      void endConfiguration()
      Invoked upon completion of bean property configuration for this object.
      java.lang.String getFile()  
      boolean isRollbackOnError()
      Affirm if the transaction be rolled back if audit operation fails with an exception.
      void setConfiguration​(Configuration conf)
      Invoked prior to setting bean properties.
      void setFile​(java.lang.String file)  
      void startConfiguration()
      Invoked before bean property configuration is begun on this object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AuditLogger

        public AuditLogger()
    • Method Detail

      • audit

        public void audit​(Broker broker,
                          java.util.Collection<Audited> newObjects,
                          java.util.Collection<Audited> updates,
                          java.util.Collection<Audited> deletes)
        Description copied from interface: Auditor
        OpenJPA runtime will invoke this method with the given parameters within a transaction.
        Specified by:
        audit in interface Auditor
        Parameters:
        broker - the active persistence context.
        newObjects - the set of auditable objects being created. Can be empty, but never null.
        updates - the set of auditable objects being updated. Can be empty, but never null.
        deletes - the set of auditable objects being deleted. Can be empty, but never null.
      • setFile

        public void setFile​(java.lang.String file)
                     throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
      • getFile

        public java.lang.String getFile()
      • isRollbackOnError

        public boolean isRollbackOnError()
        Description copied from interface: Auditor
        Affirm if the transaction be rolled back if audit operation fails with an exception.
        Specified by:
        isRollbackOnError in interface Auditor
      • startConfiguration

        public void startConfiguration()
        Description copied from interface: Configurable
        Invoked before bean property configuration is begun on this object.
        Specified by:
        startConfiguration in interface Configurable
      • endConfiguration

        public void endConfiguration()
        Description copied from interface: Configurable
        Invoked upon completion of bean property configuration for this object.
        Specified by:
        endConfiguration in interface Configurable
      • close

        public void close()
                   throws java.lang.Exception
        Specified by:
        close in interface Closeable
        Throws:
        java.lang.Exception