org.jboss.cache.interceptors.base
Class SkipCheckChainedInterceptor

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.SkipCheckChainedInterceptor
All Implemented Interfaces:
Visitor
Direct Known Subclasses:
CacheStoreInterceptor

public abstract class SkipCheckChainedInterceptor
extends CommandInterceptor

This interceptor will call skipInterception(org.jboss.cache.InvocationContext ,org.jboss.cache.commands.VisitableCommand) before invoking each visit method (and the handleDefault(org.jboss.cache.InvocationContext , org.jboss.cache.commands.VisitableCommand) method). If skipInterception(org.jboss.cache.InvocationContext ,org.jboss.cache.commands.VisitableCommand) returns false, the invocation will be skipped and passed up the interceptor chain instead.

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

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
SkipCheckChainedInterceptor()
           
 
Method Summary
protected  Object handleAll(InvocationContext ctx, VisitableCommand command)
          Default implementation, which just passes the call up the interceptor chain
protected  Object handleCommitCommand(InvocationContext ctx, CommitCommand command)
           
 Object handleDefault(InvocationContext ctx, VisitableCommand command)
          The default behaviour of the visitXXX methods, which is to ignore the call and pass the call up to the next interceptor in the chain.
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 handleRemoveDataCommand(InvocationContext ctx, ClearDataCommand command)
           
protected  Object handleRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command)
           
protected  Object handleRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command)
           
protected  Object handleRollbackCommand(InvocationContext ctx, RollbackCommand command)
           
protected abstract  boolean skipInterception(InvocationContext ctx, VisitableCommand command)
          Tests whether the command should be intercepted or not.
 Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command)
          Visits a RemoveDataCommand.
 Object visitCommitCommand(InvocationContext ctx, CommitCommand command)
          Visits a CommitCommand.
 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
getNext, hasNext, invokeNextInterceptor, setNext
 
Methods inherited from class org.jboss.cache.commands.AbstractVisitor
visitCollection, visitCreateNodeCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SkipCheckChainedInterceptor

public SkipCheckChainedInterceptor()
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

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.

handleRemoveDataCommand

protected Object handleRemoveDataCommand(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

handleDefault

public final Object handleDefault(InvocationContext ctx,
                                  VisitableCommand command)
                           throws Throwable
Description copied from class: CommandInterceptor
The default behaviour of the visitXXX methods, which is to ignore the call and pass the call up to the next interceptor in the chain.

Overrides:
handleDefault in class CommandInterceptor
Parameters:
ctx - invocation context
command - command to invoke
Returns:
return value
Throws:
Throwable - in the event of problems

handleAll

protected Object handleAll(InvocationContext ctx,
                           VisitableCommand command)
                    throws Throwable
Default implementation, which just passes the call up the interceptor chain

Parameters:
ctx - invocation context
command - command
Returns:
return value
Throws:
Throwable - in the event of problems

skipInterception

protected abstract boolean skipInterception(InvocationContext ctx,
                                            VisitableCommand command)
Tests whether the command should be intercepted or not. This is invoked before any of the handleXXX() methods.

Parameters:
ctx - invocation context
command - command
Returns:
true if the invocation should skip the current interceptor and move on to the next in the chain, false otherwise.


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