org.jboss.cache.interceptors.base
Class PostProcessingCommandInterceptor

java.lang.Object
  extended by org.jboss.cache.commands.AbstractVisitor
      extended by org.jboss.cache.interceptors.base.CommandInterceptor
          extended by org.jboss.cache.interceptors.base.PostProcessingCommandInterceptor
All Implemented Interfaces:
Visitor, InterceptorMBean
Direct Known Subclasses:
PessimisticLockInterceptor

public abstract class PostProcessingCommandInterceptor
extends CommandInterceptor

This interceptor will call doAfterCall(org.jboss.cache.InvocationContext,org.jboss.cache.commands.VisitableCommand) after invoking each visit method (and the CommandInterceptor.handleDefault(org.jboss.cache.InvocationContext, org.jboss.cache.commands.VisitableCommand) method) in a finally block.

It is useful if common cleanup code is required at the end of each call.

Instead of overriding visitXXX() methods, implementations should override their handleXXX() counterparts defined in this class instead, as well as the doAfterCall(org.jboss.cache.InvocationContext,org.jboss.cache.commands.VisitableCommand) method.

Since:
2.2
Author:
Mircea.Markus@jboss.com

Field Summary
 
Fields inherited from class org.jboss.cache.interceptors.base.CommandInterceptor
configuration, log, trace
 
Constructor Summary
PostProcessingCommandInterceptor()
           
 
Method Summary
protected abstract  void doAfterCall(InvocationContext ctx, VisitableCommand command)
          Callback that is invoked after every handleXXX() method defined above.
protected  Object handleClearDataCommand(InvocationContext ctx, ClearDataCommand command)
           
protected  Object handleCommitCommand(InvocationContext ctx, CommitCommand command)
           
protected  Object handleCreateNodeCommand(InvocationContext ctx, CreateNodeCommand command)
           
protected  Object handleEvictFqnCommand(InvocationContext ctx, EvictCommand command)
           
protected  Object handleExistsNodeCommand(InvocationContext ctx, ExistsCommand command)
           
protected  Object handleGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command)
           
protected  Object handleGetDataMapCommand(InvocationContext ctx, GetDataMapCommand command)
           
protected  Object handleGetKeysCommand(InvocationContext ctx, GetKeysCommand command)
           
protected  Object handleGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command)
           
protected  Object handleGetNodeCommand(InvocationContext ctx, GetNodeCommand command)
           
protected  Object handleGravitateDataCommand(InvocationContext ctx, GravitateDataCommand command)
           
protected  Object handleInvalidateCommand(InvocationContext ctx, InvalidateCommand command)
           
protected  Object handleMoveCommand(InvocationContext ctx, MoveCommand command)
           
protected  Object handleOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command)
           
protected  Object handlePrepareCommand(InvocationContext ctx, PrepareCommand command)
           
protected  Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command)
           
protected  Object handlePutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command)
           
protected  Object handlePutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command)
           
protected  Object handleRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command)
           
protected  Object handleRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command)
           
protected  Object handleRollbackCommand(InvocationContext ctx, RollbackCommand command)
           
 Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command)
          Visits a RemoveDataCommand.
 Object visitCommitCommand(InvocationContext ctx, CommitCommand command)
          Visits a CommitCommand.
 Object visitCreateNodeCommand(InvocationContext ctx, CreateNodeCommand command)
          Visits a CreateNodeCommand.
 Object visitEvictFqnCommand(InvocationContext ctx, EvictCommand command)
          Visits a EvictCommand.
 Object visitExistsNodeCommand(InvocationContext ctx, ExistsCommand command)
          Visits a RemoteExistsCommand.
 Object visitGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command)
          Visits a GetChildrenNamesCommand.
 Object visitGetDataMapCommand(InvocationContext ctx, GetDataMapCommand command)
          Visits a GetDataMapCommand.
 Object visitGetKeysCommand(InvocationContext ctx, GetKeysCommand command)
          Visits a GetKeysCommand.
 Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command)
          Visits a GetKeyValueCommand.
 Object visitGetNodeCommand(InvocationContext ctx, GetNodeCommand command)
          Visits a GetNodeCommand.
 Object visitGravitateDataCommand(InvocationContext ctx, GravitateDataCommand command)
          Visits a GravitateDataCommand.
 Object visitInvalidateCommand(InvocationContext ctx, InvalidateCommand command)
          Visits a InvalidateCommand.
 Object visitMoveCommand(InvocationContext ctx, MoveCommand command)
          Visits a MoveCommand.
 Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command)
          Visits a OptimisticPrepareCommand.
 Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command)
          Visits a PrepareCommand.
 Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command)
          Visits a PutDataMapCommand.
 Object visitPutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command)
          Visits a PutForExternalReadCommand.
 Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command)
          Visits a PutKeyValueCommand.
 Object visitRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command)
          Visits a RemoveKeyCommand.
 Object visitRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command)
          Visits a RemoveNodeCommand.
 Object visitRollbackCommand(InvocationContext ctx, RollbackCommand command)
          Visits a RollbackCommand.
 
Methods inherited from class org.jboss.cache.interceptors.base.CommandInterceptor
dumpStatistics, getNext, getStatisticsEnabled, handleDefault, hasNext, invokeNextInterceptor, resetStatistics, setNext, setStatisticsEnabled
 
Methods inherited from class org.jboss.cache.commands.AbstractVisitor
visitCollection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostProcessingCommandInterceptor

public PostProcessingCommandInterceptor()
Method Detail

visitPutDataMapCommand

public final Object visitPutDataMapCommand(InvocationContext ctx,
                                           PutDataMapCommand command)
                                    throws Throwable
Description copied from interface: Visitor
Visits a PutDataMapCommand.

Specified by:
visitPutDataMapCommand in interface Visitor
Overrides:
visitPutDataMapCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handlePutDataMapCommand

protected Object handlePutDataMapCommand(InvocationContext ctx,
                                         PutDataMapCommand command)
                                  throws Throwable
Throws:
Throwable

visitPutKeyValueCommand

public final Object visitPutKeyValueCommand(InvocationContext ctx,
                                            PutKeyValueCommand command)
                                     throws Throwable
Description copied from interface: Visitor
Visits a PutKeyValueCommand.

Specified by:
visitPutKeyValueCommand in interface Visitor
Overrides:
visitPutKeyValueCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

visitPutForExternalReadCommand

public final Object visitPutForExternalReadCommand(InvocationContext ctx,
                                                   PutForExternalReadCommand command)
                                            throws Throwable
Description copied from interface: Visitor
Visits a PutForExternalReadCommand.

Specified by:
visitPutForExternalReadCommand in interface Visitor
Overrides:
visitPutForExternalReadCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handlePutKeyValueCommand

protected Object handlePutKeyValueCommand(InvocationContext ctx,
                                          PutKeyValueCommand command)
                                   throws Throwable
Throws:
Throwable

handlePutForExternalReadCommand

protected Object handlePutForExternalReadCommand(InvocationContext ctx,
                                                 PutForExternalReadCommand command)
                                          throws Throwable
Throws:
Throwable

visitRemoveNodeCommand

public final Object visitRemoveNodeCommand(InvocationContext ctx,
                                           RemoveNodeCommand command)
                                    throws Throwable
Description copied from interface: Visitor
Visits a RemoveNodeCommand.

Specified by:
visitRemoveNodeCommand in interface Visitor
Overrides:
visitRemoveNodeCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleRemoveNodeCommand

protected Object handleRemoveNodeCommand(InvocationContext ctx,
                                         RemoveNodeCommand command)
                                  throws Throwable
Throws:
Throwable

visitCreateNodeCommand

public final Object visitCreateNodeCommand(InvocationContext ctx,
                                           CreateNodeCommand command)
                                    throws Throwable
Description copied from interface: Visitor
Visits a CreateNodeCommand.

Specified by:
visitCreateNodeCommand in interface Visitor
Overrides:
visitCreateNodeCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleCreateNodeCommand

protected Object handleCreateNodeCommand(InvocationContext ctx,
                                         CreateNodeCommand command)
                                  throws Throwable
Throws:
Throwable

visitClearDataCommand

public final Object visitClearDataCommand(InvocationContext ctx,
                                          ClearDataCommand command)
                                   throws Throwable
Description copied from interface: Visitor
Visits a RemoveDataCommand.

Specified by:
visitClearDataCommand in interface Visitor
Overrides:
visitClearDataCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleClearDataCommand

protected Object handleClearDataCommand(InvocationContext ctx,
                                        ClearDataCommand command)
                                 throws Throwable
Throws:
Throwable

visitEvictFqnCommand

public final Object visitEvictFqnCommand(InvocationContext ctx,
                                         EvictCommand command)
                                  throws Throwable
Description copied from interface: Visitor
Visits a EvictCommand.

Specified by:
visitEvictFqnCommand in interface Visitor
Overrides:
visitEvictFqnCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleEvictFqnCommand

protected Object handleEvictFqnCommand(InvocationContext ctx,
                                       EvictCommand command)
                                throws Throwable
Throws:
Throwable

visitInvalidateCommand

public final Object visitInvalidateCommand(InvocationContext ctx,
                                           InvalidateCommand command)
                                    throws Throwable
Description copied from interface: Visitor
Visits a InvalidateCommand.

Specified by:
visitInvalidateCommand in interface Visitor
Overrides:
visitInvalidateCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleInvalidateCommand

protected Object handleInvalidateCommand(InvocationContext ctx,
                                         InvalidateCommand command)
                                  throws Throwable
Throws:
Throwable

visitRemoveKeyCommand

public final Object visitRemoveKeyCommand(InvocationContext ctx,
                                          RemoveKeyCommand command)
                                   throws Throwable
Description copied from interface: Visitor
Visits a RemoveKeyCommand.

Specified by:
visitRemoveKeyCommand in interface Visitor
Overrides:
visitRemoveKeyCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleRemoveKeyCommand

protected Object handleRemoveKeyCommand(InvocationContext ctx,
                                        RemoveKeyCommand command)
                                 throws Throwable
Throws:
Throwable

visitGetDataMapCommand

public final Object visitGetDataMapCommand(InvocationContext ctx,
                                           GetDataMapCommand command)
                                    throws Throwable
Description copied from interface: Visitor
Visits a GetDataMapCommand.

Specified by:
visitGetDataMapCommand in interface Visitor
Overrides:
visitGetDataMapCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleGetDataMapCommand

protected Object handleGetDataMapCommand(InvocationContext ctx,
                                         GetDataMapCommand command)
                                  throws Throwable
Throws:
Throwable

visitExistsNodeCommand

public final Object visitExistsNodeCommand(InvocationContext ctx,
                                           ExistsCommand command)
                                    throws Throwable
Description copied from interface: Visitor
Visits a RemoteExistsCommand.

Specified by:
visitExistsNodeCommand in interface Visitor
Overrides:
visitExistsNodeCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleExistsNodeCommand

protected Object handleExistsNodeCommand(InvocationContext ctx,
                                         ExistsCommand command)
                                  throws Throwable
Throws:
Throwable

visitGetKeyValueCommand

public final Object visitGetKeyValueCommand(InvocationContext ctx,
                                            GetKeyValueCommand command)
                                     throws Throwable
Description copied from interface: Visitor
Visits a GetKeyValueCommand.

Specified by:
visitGetKeyValueCommand in interface Visitor
Overrides:
visitGetKeyValueCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleGetKeyValueCommand

protected Object handleGetKeyValueCommand(InvocationContext ctx,
                                          GetKeyValueCommand command)
                                   throws Throwable
Throws:
Throwable

visitGetNodeCommand

public final Object visitGetNodeCommand(InvocationContext ctx,
                                        GetNodeCommand command)
                                 throws Throwable
Description copied from interface: Visitor
Visits a GetNodeCommand.

Specified by:
visitGetNodeCommand in interface Visitor
Overrides:
visitGetNodeCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleGetNodeCommand

protected Object handleGetNodeCommand(InvocationContext ctx,
                                      GetNodeCommand command)
                               throws Throwable
Throws:
Throwable

visitGetKeysCommand

public final Object visitGetKeysCommand(InvocationContext ctx,
                                        GetKeysCommand command)
                                 throws Throwable
Description copied from interface: Visitor
Visits a GetKeysCommand.

Specified by:
visitGetKeysCommand in interface Visitor
Overrides:
visitGetKeysCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleGetKeysCommand

protected Object handleGetKeysCommand(InvocationContext ctx,
                                      GetKeysCommand command)
                               throws Throwable
Throws:
Throwable

visitGetChildrenNamesCommand

public final Object visitGetChildrenNamesCommand(InvocationContext ctx,
                                                 GetChildrenNamesCommand command)
                                          throws Throwable
Description copied from interface: Visitor
Visits a GetChildrenNamesCommand.

Specified by:
visitGetChildrenNamesCommand in interface Visitor
Overrides:
visitGetChildrenNamesCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleGetChildrenNamesCommand

protected Object handleGetChildrenNamesCommand(InvocationContext ctx,
                                               GetChildrenNamesCommand command)
                                        throws Throwable
Throws:
Throwable

visitMoveCommand

public final Object visitMoveCommand(InvocationContext ctx,
                                     MoveCommand command)
                              throws Throwable
Description copied from interface: Visitor
Visits a MoveCommand.

Specified by:
visitMoveCommand in interface Visitor
Overrides:
visitMoveCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleMoveCommand

protected Object handleMoveCommand(InvocationContext ctx,
                                   MoveCommand command)
                            throws Throwable
Throws:
Throwable

visitGravitateDataCommand

public final Object visitGravitateDataCommand(InvocationContext ctx,
                                              GravitateDataCommand command)
                                       throws Throwable
Description copied from interface: Visitor
Visits a GravitateDataCommand.

Specified by:
visitGravitateDataCommand in interface Visitor
Overrides:
visitGravitateDataCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleGravitateDataCommand

protected Object handleGravitateDataCommand(InvocationContext ctx,
                                            GravitateDataCommand command)
                                     throws Throwable
Throws:
Throwable

visitPrepareCommand

public final Object visitPrepareCommand(InvocationContext ctx,
                                        PrepareCommand command)
                                 throws Throwable
Description copied from interface: Visitor
Visits a PrepareCommand.

Specified by:
visitPrepareCommand in interface Visitor
Overrides:
visitPrepareCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handlePrepareCommand

protected Object handlePrepareCommand(InvocationContext ctx,
                                      PrepareCommand command)
                               throws Throwable
Throws:
Throwable

visitRollbackCommand

public final Object visitRollbackCommand(InvocationContext ctx,
                                         RollbackCommand command)
                                  throws Throwable
Description copied from interface: Visitor
Visits a RollbackCommand.

Specified by:
visitRollbackCommand in interface Visitor
Overrides:
visitRollbackCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleRollbackCommand

protected Object handleRollbackCommand(InvocationContext ctx,
                                       RollbackCommand command)
                                throws Throwable
Throws:
Throwable

visitCommitCommand

public final Object visitCommitCommand(InvocationContext ctx,
                                       CommitCommand command)
                                throws Throwable
Description copied from interface: Visitor
Visits a CommitCommand.

Specified by:
visitCommitCommand in interface Visitor
Overrides:
visitCommitCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleCommitCommand

protected Object handleCommitCommand(InvocationContext ctx,
                                     CommitCommand command)
                              throws Throwable
Throws:
Throwable

visitOptimisticPrepareCommand

public final Object visitOptimisticPrepareCommand(InvocationContext ctx,
                                                  OptimisticPrepareCommand command)
                                           throws Throwable
Description copied from interface: Visitor
Visits a OptimisticPrepareCommand.

Specified by:
visitOptimisticPrepareCommand in interface Visitor
Overrides:
visitOptimisticPrepareCommand in class AbstractVisitor
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

handleOptimisticPrepareCommand

protected Object handleOptimisticPrepareCommand(InvocationContext ctx,
                                                OptimisticPrepareCommand command)
                                         throws Throwable
Throws:
Throwable

doAfterCall

protected abstract void doAfterCall(InvocationContext ctx,
                                    VisitableCommand command)
Callback that is invoked after every handleXXX() method defined above.

Parameters:
ctx - invocation context
command - command which was invoked


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.