org.infinispan.interceptors.base
Class PrePostProcessingCommandInterceptor

java.lang.Object
  extended by org.infinispan.commands.AbstractVisitor
      extended by org.infinispan.interceptors.base.CommandInterceptor
          extended by org.infinispan.interceptors.base.PrePostProcessingCommandInterceptor
All Implemented Interfaces:
Visitor

public abstract class PrePostProcessingCommandInterceptor
extends CommandInterceptor

This interceptor adds pre and post processing to each visitXXX() method.

For each visitXXX() method invoked, it will first call doBeforeCall(InvocationContext, VisitableCommand) and if this method returns true, it will proceed to invoking a handleXXX() method and lastly, doAfterCall(InvocationContext, VisitableCommand) in a finally block. Note that the doAfterCall() method is still invoked even if doBeforeCall() returns false.

Instead of overriding visitXXX() methods, implementations should override their handleXXX() counterparts defined in this class instead, as well as the doAfterCall(InvocationContext ,VisitableCommand) method and optionally doBeforeCall(InvocationContext, VisitableCommand).

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

Field Summary
 
Fields inherited from class org.infinispan.interceptors.base.CommandInterceptor
configuration, log, trace
 
Constructor Summary
PrePostProcessingCommandInterceptor()
           
 
Method Summary
protected abstract  void doAfterCall(InvocationContext ctx, VisitableCommand command)
          Callback that is invoked after every handleXXX() method defined above.
protected  boolean doBeforeCall(InvocationContext ctx, VisitableCommand command)
           
protected  Object handleClearCommand(InvocationContext ctx, ClearCommand command)
           
protected  Object handleCommitCommand(InvocationContext ctx, CommitCommand command)
           
protected  Object handleEvictCommand(InvocationContext ctx, EvictCommand command)
           
protected  Object handleGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command)
           
protected  Object handlePrepareCommand(InvocationContext ctx, PrepareCommand command)
           
protected  Object handlePutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command)
           
protected  Object handlePutMapCommand(InvocationContext ctx, PutMapCommand command)
           
protected  Object handleRemoveCommand(InvocationContext ctx, RemoveCommand command)
           
protected  Object handleReplaceCommand(InvocationContext ctx, ReplaceCommand command)
           
protected  Object handleRollbackCommand(InvocationContext ctx, RollbackCommand command)
           
protected  Object handleSizeCommand(InvocationContext ctx, SizeCommand command)
           
 Object visitClearCommand(InvocationContext ctx, ClearCommand command)
           
 Object visitCommitCommand(TxInvocationContext ctx, CommitCommand command)
           
 Object visitEvictCommand(InvocationContext ctx, EvictCommand command)
           
 Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command)
           
 Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand command)
           
 Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command)
           
 Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command)
           
 Object visitRemoveCommand(InvocationContext ctx, RemoveCommand command)
           
 Object visitReplaceCommand(InvocationContext ctx, ReplaceCommand command)
           
 Object visitRollbackCommand(TxInvocationContext ctx, RollbackCommand command)
           
 Object visitSizeCommand(InvocationContext ctx, SizeCommand command)
           
 
Methods inherited from class org.infinispan.interceptors.base.CommandInterceptor
getNext, handleDefault, hasNext, invokeNextInterceptor, setNext
 
Methods inherited from class org.infinispan.commands.AbstractVisitor
visitCollection, visitEntrySetCommand, visitInvalidateCommand, visitKeySetCommand, visitLockControlCommand, visitValuesCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrePostProcessingCommandInterceptor

public PrePostProcessingCommandInterceptor()
Method Detail

visitPutKeyValueCommand

public Object visitPutKeyValueCommand(InvocationContext ctx,
                                      PutKeyValueCommand command)
                               throws Throwable
Specified by:
visitPutKeyValueCommand in interface Visitor
Overrides:
visitPutKeyValueCommand in class AbstractVisitor
Throws:
Throwable

handlePutKeyValueCommand

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

visitRemoveCommand

public Object visitRemoveCommand(InvocationContext ctx,
                                 RemoveCommand command)
                          throws Throwable
Specified by:
visitRemoveCommand in interface Visitor
Overrides:
visitRemoveCommand in class AbstractVisitor
Throws:
Throwable

handleRemoveCommand

protected Object handleRemoveCommand(InvocationContext ctx,
                                     RemoveCommand command)
                              throws Throwable
Throws:
Throwable

visitReplaceCommand

public Object visitReplaceCommand(InvocationContext ctx,
                                  ReplaceCommand command)
                           throws Throwable
Specified by:
visitReplaceCommand in interface Visitor
Overrides:
visitReplaceCommand in class AbstractVisitor
Throws:
Throwable

handleReplaceCommand

protected Object handleReplaceCommand(InvocationContext ctx,
                                      ReplaceCommand command)
                               throws Throwable
Throws:
Throwable

visitClearCommand

public Object visitClearCommand(InvocationContext ctx,
                                ClearCommand command)
                         throws Throwable
Specified by:
visitClearCommand in interface Visitor
Overrides:
visitClearCommand in class AbstractVisitor
Throws:
Throwable

handleClearCommand

protected Object handleClearCommand(InvocationContext ctx,
                                    ClearCommand command)
                             throws Throwable
Throws:
Throwable

visitPutMapCommand

public Object visitPutMapCommand(InvocationContext ctx,
                                 PutMapCommand command)
                          throws Throwable
Specified by:
visitPutMapCommand in interface Visitor
Overrides:
visitPutMapCommand in class AbstractVisitor
Throws:
Throwable

handlePutMapCommand

protected Object handlePutMapCommand(InvocationContext ctx,
                                     PutMapCommand command)
                              throws Throwable
Throws:
Throwable

visitEvictCommand

public Object visitEvictCommand(InvocationContext ctx,
                                EvictCommand command)
                         throws Throwable
Specified by:
visitEvictCommand in interface Visitor
Overrides:
visitEvictCommand in class AbstractVisitor
Throws:
Throwable

handleEvictCommand

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

visitSizeCommand

public Object visitSizeCommand(InvocationContext ctx,
                               SizeCommand command)
                        throws Throwable
Specified by:
visitSizeCommand in interface Visitor
Overrides:
visitSizeCommand in class AbstractVisitor
Throws:
Throwable

handleSizeCommand

protected Object handleSizeCommand(InvocationContext ctx,
                                   SizeCommand command)
                            throws Throwable
Throws:
Throwable

visitGetKeyValueCommand

public Object visitGetKeyValueCommand(InvocationContext ctx,
                                      GetKeyValueCommand command)
                               throws Throwable
Specified by:
visitGetKeyValueCommand in interface Visitor
Overrides:
visitGetKeyValueCommand in class AbstractVisitor
Throws:
Throwable

handleGetKeyValueCommand

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

visitPrepareCommand

public Object visitPrepareCommand(TxInvocationContext ctx,
                                  PrepareCommand command)
                           throws Throwable
Specified by:
visitPrepareCommand in interface Visitor
Overrides:
visitPrepareCommand in class AbstractVisitor
Throws:
Throwable

handlePrepareCommand

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

visitRollbackCommand

public Object visitRollbackCommand(TxInvocationContext ctx,
                                   RollbackCommand command)
                            throws Throwable
Specified by:
visitRollbackCommand in interface Visitor
Overrides:
visitRollbackCommand in class AbstractVisitor
Throws:
Throwable

handleRollbackCommand

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

visitCommitCommand

public Object visitCommitCommand(TxInvocationContext ctx,
                                 CommitCommand command)
                          throws Throwable
Specified by:
visitCommitCommand in interface Visitor
Overrides:
visitCommitCommand in class AbstractVisitor
Throws:
Throwable

handleCommitCommand

protected Object handleCommitCommand(InvocationContext ctx,
                                     CommitCommand 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

doBeforeCall

protected boolean doBeforeCall(InvocationContext ctx,
                               VisitableCommand command)

Google Analytics

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