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  java.lang.Object handleAll(InvocationContext ctx, VisitableCommand command)
          Default implementation, which just passes the call up the interceptor chain
protected  java.lang.Object handleCommitCommand(InvocationContext ctx, CommitCommand command)
           
 java.lang.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  java.lang.Object handleEvictFqnCommand(InvocationContext ctx, EvictCommand command)
           
protected  java.lang.Object handleExistsNodeCommand(InvocationContext ctx, ExistsCommand command)
           
protected  java.lang.Object handleGetDataMapCommand(InvocationContext ctx, GetDataMapCommand command)
           
protected  java.lang.Object handleGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command)
           
protected  java.lang.Object handleGetKeysCommand(InvocationContext ctx, GetKeysCommand command)
           
protected  java.lang.Object handleGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command)
           
protected  java.lang.Object handleGetNodeCommand(InvocationContext ctx, GetNodeCommand command)
           
protected  java.lang.Object handleGravitateDataCommand(InvocationContext ctx, GravitateDataCommand command)
           
protected  java.lang.Object handleInvalidateCommand(InvocationContext ctx, InvalidateCommand command)
           
protected  java.lang.Object handleMoveCommand(InvocationContext ctx, MoveCommand command)
           
protected  java.lang.Object handleOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command)
           
protected  java.lang.Object handlePrepareCommand(InvocationContext ctx, PrepareCommand command)
           
protected  java.lang.Object handlePutDataMapCommand(InvocationContext ctx, PutDataMapCommand command)
           
protected  java.lang.Object handlePutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command)
           
protected  java.lang.Object handlePutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command)
           
protected  java.lang.Object handleRemoveDataCommand(InvocationContext ctx, ClearDataCommand command)
           
protected  java.lang.Object handleRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command)
           
protected  java.lang.Object handleRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command)
           
protected  java.lang.Object handleRollbackCommand(InvocationContext ctx, RollbackCommand command)
           
protected abstract  boolean skipInterception(InvocationContext ctx, VisitableCommand command)
          Tests whether the command should be intercepted or not.
 java.lang.Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command)
          Visits a RemoveDataCommand.
 java.lang.Object visitCommitCommand(InvocationContext ctx, CommitCommand command)
          Visits a CommitCommand.
 java.lang.Object visitEvictFqnCommand(InvocationContext ctx, EvictCommand command)
          Visits a EvictCommand.
 java.lang.Object visitExistsNodeCommand(InvocationContext ctx, ExistsCommand command)
          Visits a RemoteExistsCommand.
 java.lang.Object visitGetDataMapCommand(InvocationContext ctx, GetDataMapCommand command)
          Visits a GetDataMapCommand.
 java.lang.Object visitGetChildrenNamesCommand(InvocationContext ctx, GetChildrenNamesCommand command)
          Visits a GetChildrenNamesCommand.
 java.lang.Object visitGetKeysCommand(InvocationContext ctx, GetKeysCommand command)
          Visits a GetKeysCommand.
 java.lang.Object visitGetKeyValueCommand(InvocationContext ctx, GetKeyValueCommand command)
          Visits a GetKeyValueCommand.
 java.lang.Object visitGetNodeCommand(InvocationContext ctx, GetNodeCommand command)
          Visits a GetNodeCommand.
 java.lang.Object visitGravitateDataCommand(InvocationContext ctx, GravitateDataCommand command)
          Visits a GravitateDataCommand.
 java.lang.Object visitInvalidateCommand(InvocationContext ctx, InvalidateCommand command)
          Visits a InvalidateCommand.
 java.lang.Object visitMoveCommand(InvocationContext ctx, MoveCommand command)
          Visits a MoveCommand.
 java.lang.Object visitOptimisticPrepareCommand(InvocationContext ctx, OptimisticPrepareCommand command)
          Visits a OptimisticPrepareCommand.
 java.lang.Object visitPrepareCommand(InvocationContext ctx, PrepareCommand command)
          Visits a PrepareCommand.
 java.lang.Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command)
          Visits a PutDataMapCommand.
 java.lang.Object visitPutForExternalReadCommand(InvocationContext ctx, PutForExternalReadCommand command)
          Visits a PutForExternalReadCommand.
 java.lang.Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command)
          Visits a PutKeyValueCommand.
 java.lang.Object visitRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command)
          Visits a RemoveKeyCommand.
 java.lang.Object visitRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command)
          Visits a RemoveNodeCommand.
 java.lang.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 java.lang.Object visitPutDataMapCommand(InvocationContext ctx,
                                                     PutDataMapCommand command)
                                              throws java.lang.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:
java.lang.Throwable - in the event of problems.

handlePutDataMapCommand

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

visitPutKeyValueCommand

public final java.lang.Object visitPutKeyValueCommand(InvocationContext ctx,
                                                      PutKeyValueCommand command)
                                               throws java.lang.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:
java.lang.Throwable - in the event of problems.

visitPutForExternalReadCommand

public final java.lang.Object visitPutForExternalReadCommand(InvocationContext ctx,
                                                             PutForExternalReadCommand command)
                                                      throws java.lang.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:
java.lang.Throwable - in the event of problems.

handlePutKeyValueCommand

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

handlePutForExternalReadCommand

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

visitRemoveNodeCommand

public final java.lang.Object visitRemoveNodeCommand(InvocationContext ctx,
                                                     RemoveNodeCommand command)
                                              throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleRemoveNodeCommand

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

visitClearDataCommand

public final java.lang.Object visitClearDataCommand(InvocationContext ctx,
                                                    ClearDataCommand command)
                                             throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleRemoveDataCommand

protected java.lang.Object handleRemoveDataCommand(InvocationContext ctx,
                                                   ClearDataCommand command)
                                            throws java.lang.Throwable
Throws:
java.lang.Throwable

visitEvictFqnCommand

public final java.lang.Object visitEvictFqnCommand(InvocationContext ctx,
                                                   EvictCommand command)
                                            throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleEvictFqnCommand

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

visitInvalidateCommand

public final java.lang.Object visitInvalidateCommand(InvocationContext ctx,
                                                     InvalidateCommand command)
                                              throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleInvalidateCommand

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

visitRemoveKeyCommand

public final java.lang.Object visitRemoveKeyCommand(InvocationContext ctx,
                                                    RemoveKeyCommand command)
                                             throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleRemoveKeyCommand

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

visitGetDataMapCommand

public final java.lang.Object visitGetDataMapCommand(InvocationContext ctx,
                                                     GetDataMapCommand command)
                                              throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleGetDataMapCommand

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

visitExistsNodeCommand

public final java.lang.Object visitExistsNodeCommand(InvocationContext ctx,
                                                     ExistsCommand command)
                                              throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleExistsNodeCommand

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

visitGetKeyValueCommand

public final java.lang.Object visitGetKeyValueCommand(InvocationContext ctx,
                                                      GetKeyValueCommand command)
                                               throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleGetKeyValueCommand

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

visitGetNodeCommand

public final java.lang.Object visitGetNodeCommand(InvocationContext ctx,
                                                  GetNodeCommand command)
                                           throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleGetNodeCommand

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

visitGetKeysCommand

public final java.lang.Object visitGetKeysCommand(InvocationContext ctx,
                                                  GetKeysCommand command)
                                           throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleGetKeysCommand

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

visitGetChildrenNamesCommand

public final java.lang.Object visitGetChildrenNamesCommand(InvocationContext ctx,
                                                           GetChildrenNamesCommand command)
                                                    throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleGetChildrenNamesCommand

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

visitMoveCommand

public final java.lang.Object visitMoveCommand(InvocationContext ctx,
                                               MoveCommand command)
                                        throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleMoveCommand

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

visitGravitateDataCommand

public final java.lang.Object visitGravitateDataCommand(InvocationContext ctx,
                                                        GravitateDataCommand command)
                                                 throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleGravitateDataCommand

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

visitPrepareCommand

public final java.lang.Object visitPrepareCommand(InvocationContext ctx,
                                                  PrepareCommand command)
                                           throws java.lang.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:
java.lang.Throwable - in the event of problems.

handlePrepareCommand

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

visitRollbackCommand

public final java.lang.Object visitRollbackCommand(InvocationContext ctx,
                                                   RollbackCommand command)
                                            throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleRollbackCommand

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

visitCommitCommand

public final java.lang.Object visitCommitCommand(InvocationContext ctx,
                                                 CommitCommand command)
                                          throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleCommitCommand

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

visitOptimisticPrepareCommand

public final java.lang.Object visitOptimisticPrepareCommand(InvocationContext ctx,
                                                            OptimisticPrepareCommand command)
                                                     throws java.lang.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:
java.lang.Throwable - in the event of problems.

handleOptimisticPrepareCommand

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

handleDefault

public final java.lang.Object handleDefault(InvocationContext ctx,
                                            VisitableCommand command)
                                     throws java.lang.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:
java.lang.Throwable - in the event of problems

handleAll

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

Parameters:
ctx - invocation context
command - command
Returns:
return value
Throws:
java.lang.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.