org.jboss.cache.commands
Class AbstractVisitor

java.lang.Object
  extended by org.jboss.cache.commands.AbstractVisitor
All Implemented Interfaces:
Visitor
Direct Known Subclasses:
CacheStoreInterceptor.StoreModificationsBuilder, CommandInterceptor, Fqn2BuddyFqnVisitor, InvalidationInterceptor.InvalidationFilterVisitor, OptimisticReplicationInterceptor.DataVersionPopulator

public abstract class AbstractVisitor
extends java.lang.Object
implements Visitor

An abstract implementation of a Visitor that delegates all visit calls to a default handler which can be overridden.

Since:
2.2.0
Author:
Mircea.Markus@jboss.com, Manik Surtani

Constructor Summary
AbstractVisitor()
           
 
Method Summary
protected  java.lang.Object handleDefault(InvocationContext ctx, VisitableCommand command)
          A default handler for all commands visited.
 java.lang.Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command)
          Visits a RemoveDataCommand.
 void visitCollection(InvocationContext ctx, java.util.Collection<? extends VisitableCommand> toVisit)
          Helper method to visit a collection of VisitableCommands.
 java.lang.Object visitCommitCommand(InvocationContext ctx, CommitCommand command)
          Visits a CommitCommand.
 java.lang.Object visitCreateNodeCommand(InvocationContext ctx, CreateNodeCommand command)
          Visits a CreateNodeCommand.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractVisitor

public AbstractVisitor()
Method Detail

visitPutDataMapCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitPutKeyValueCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitPutForExternalReadCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitRemoveNodeCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitClearDataCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitEvictFqnCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitInvalidateCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitRemoveKeyCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitGetDataMapCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitExistsNodeCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitGetKeyValueCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitGetNodeCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitGetKeysCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitGetChildrenNamesCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitMoveCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitGravitateDataCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitPrepareCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitRollbackCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitCommitCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitOptimisticPrepareCommand

public 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
Parameters:
ctx - invocation context
command - command to visit
Returns:
response from the visit
Throws:
java.lang.Throwable - in the event of problems.

visitCreateNodeCommand

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

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

handleDefault

protected java.lang.Object handleDefault(InvocationContext ctx,
                                         VisitableCommand command)
                                  throws java.lang.Throwable
A default handler for all commands visited. This is called for any visit method called, unless a visit command is appropriately overridden.

Parameters:
ctx - invocation context
command - command to handle
Returns:
return value
Throws:
java.lang.Throwable - in the case of a problem

visitCollection

public void visitCollection(InvocationContext ctx,
                            java.util.Collection<? extends VisitableCommand> toVisit)
                     throws java.lang.Throwable
Helper method to visit a collection of VisitableCommands.

Parameters:
ctx - Invocation context
toVisit - collection of commands to visit
Throws:
java.lang.Throwable - in the event of problems


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