Package org.apache.openjpa.kernel
Class AuditManager
- java.lang.Object
 - 
- org.apache.openjpa.kernel.InMemorySavepointManager
 - 
- org.apache.openjpa.kernel.AuditManager
 
 
 
- 
- All Implemented Interfaces:
 PCRegistry.RegisterClassListener,BeginTransactionListener,EndTransactionListener,FlushTransactionListener,TransactionListener,SavepointManager
public class AuditManager extends InMemorySavepointManager implements TransactionListener, PCRegistry.RegisterClassListener
Controller for audit facility. This controller performs the following basic duties:- Records auditable types at class loading time
 - Listens to instance life cycle changes and transaction.
 - Collects auditable instances on instance life cycle changes.
 - Delegates real auditing to the
 Auditorat transaction boundary.- Author:
 - Pinaki Poddar
 
 
- 
- 
Constructor Summary
Constructors Constructor Description AuditManager(Auditor auditor) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterBegin(TransactionEvent event)----------------------------------------------------------------------- Transaction callbacksvoidafterCommit(TransactionEvent event)Notification that a transaction has successfully committed.voidafterCommitComplete(TransactionEvent event)Notification that a transaction has successfully committed and the transaction is no longer active.voidafterFlush(TransactionEvent event)Notification that a transaction has flushed all object changes.voidafterRollback(TransactionEvent event)Notification that a transaction has been rolled back.voidafterRollbackComplete(TransactionEvent event)Notification that a transaction has been rolled back and the transaction is no longer active.voidafterStateTransitions(TransactionEvent event)Notification that state transitions are complete.voidbeforeCommit(TransactionEvent event)Notification that the next flush is for the transaction commit.voidbeforeFlush(TransactionEvent event)Notification that a transaction is about to flush all object changes.Set<Class<?>>getAuditedTypes()AuditorgetAuditor()protected BrokergetBroker(PersistenceCapable pc)Extracts the broker from the given persistence capable instance.protected PersistenceCapablegetPersistenceCapable(LifecycleEvent evt)Extracts the persistence capable instance from the source of the given event.protected booleanisAuditable(AuditableOperation op, StateManagerImpl sm)Affirms if the given state manager is auditable for the given operation.voidregister(Class<?> cls)Records all auditable classes in operation-specific sets.- 
Methods inherited from class org.apache.openjpa.kernel.InMemorySavepointManager
getPreFlush, newSavepoint, setPreFlush, supportsIncrementalFlush 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
AuditManager
public AuditManager(Auditor auditor)
 
 - 
 
- 
Method Detail
- 
register
public void register(Class<?> cls)
Records all auditable classes in operation-specific sets.- Specified by:
 registerin interfacePCRegistry.RegisterClassListener
 
- 
getAuditor
public Auditor getAuditor()
 
- 
afterBegin
public void afterBegin(TransactionEvent event)
----------------------------------------------------------------------- Transaction callbacks. ------------------------------------------------------------------------ Specified by:
 afterBeginin interfaceBeginTransactionListener- See Also:
 TransactionEvent.AFTER_BEGIN
 
- 
beforeCommit
public void beforeCommit(TransactionEvent event)
Description copied from interface:EndTransactionListenerNotification that the next flush is for the transaction commit.- Specified by:
 beforeCommitin interfaceEndTransactionListener- See Also:
 TransactionEvent.BEFORE_COMMIT
 
- 
afterCommit
public void afterCommit(TransactionEvent event)
Description copied from interface:EndTransactionListenerNotification that a transaction has successfully committed.- Specified by:
 afterCommitin interfaceEndTransactionListener- See Also:
 TransactionEvent.AFTER_COMMIT
 
- 
afterRollback
public void afterRollback(TransactionEvent event)
Description copied from interface:EndTransactionListenerNotification that a transaction has been rolled back.- Specified by:
 afterRollbackin interfaceEndTransactionListener- See Also:
 TransactionEvent.AFTER_ROLLBACK
 
- 
afterCommitComplete
public void afterCommitComplete(TransactionEvent event)
Description copied from interface:EndTransactionListenerNotification that a transaction has successfully committed and the transaction is no longer active.- Specified by:
 afterCommitCompletein interfaceEndTransactionListener- See Also:
 TransactionEvent.AFTER_COMMIT_COMPLETE
 
- 
afterRollbackComplete
public void afterRollbackComplete(TransactionEvent event)
Description copied from interface:EndTransactionListenerNotification that a transaction has been rolled back and the transaction is no longer active.- Specified by:
 afterRollbackCompletein interfaceEndTransactionListener- See Also:
 TransactionEvent.AFTER_ROLLBACK_COMPLETE
 
- 
beforeFlush
public void beforeFlush(TransactionEvent event)
Description copied from interface:FlushTransactionListenerNotification that a transaction is about to flush all object changes.- Specified by:
 beforeFlushin interfaceFlushTransactionListener- See Also:
 TransactionEvent.BEFORE_FLUSH
 
- 
afterFlush
public void afterFlush(TransactionEvent event)
Description copied from interface:FlushTransactionListenerNotification that a transaction has flushed all object changes.- Specified by:
 afterFlushin interfaceFlushTransactionListener- See Also:
 TransactionEvent.AFTER_FLUSH
 
- 
afterStateTransitions
public void afterStateTransitions(TransactionEvent event)
Description copied from interface:EndTransactionListenerNotification that state transitions are complete.- Specified by:
 afterStateTransitionsin interfaceEndTransactionListener- See Also:
 TransactionEvent.AFTER_STATE_TRANSITIONS
 
- 
getPersistenceCapable
protected PersistenceCapable getPersistenceCapable(LifecycleEvent evt)
Extracts the persistence capable instance from the source of the given event.- Returns:
 - null if an instance can not be extracted.
 
 
- 
getBroker
protected Broker getBroker(PersistenceCapable pc)
Extracts the broker from the given persistence capable instance.- Parameters:
 pc- a persistence capable instance- Returns:
 - null if a Broker can notbe extracted
 
 
- 
isAuditable
protected boolean isAuditable(AuditableOperation op, StateManagerImpl sm)
Affirms if the given state manager is auditable for the given operation.- Parameters:
 op- an auditable operation
 
 - 
 
 -