org.jboss.cache.buddyreplication
Class Fqn2BuddyFqnVisitor

java.lang.Object
  extended by org.jboss.cache.commands.AbstractVisitor
      extended by org.jboss.cache.buddyreplication.Fqn2BuddyFqnVisitor
All Implemented Interfaces:
Visitor

public class Fqn2BuddyFqnVisitor
extends AbstractVisitor

For each command the fqns are changed such that they are under the current buddy group's backup subtree (e.g., /_buddy_backup_/my_host:7890/) rather than the root (/).

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

Constructor Summary
Fqn2BuddyFqnVisitor(String buddyGroupName)
           
Fqn2BuddyFqnVisitor(String buddyGroupName, CommandsFactory cf)
           
 
Method Summary
 Fqn getBackupFqn(Fqn originalFqn)
          Assumes the backup Fqn if the current instance is the data owner.
 void setBuddyFqnTransformer(BuddyFqnTransformer buddyFqnTransformer)
           
 List<WriteCommand> transformBatch(List<WriteCommand> toTransform)
           
 Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command)
          Visits a RemoveDataCommand.
 Object visitCommitCommand(InvocationContext ctx, CommitCommand commitCommand)
          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.commands.AbstractVisitor
handleDefault, visitCollection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Fqn2BuddyFqnVisitor

public Fqn2BuddyFqnVisitor(String buddyGroupName)

Fqn2BuddyFqnVisitor

public Fqn2BuddyFqnVisitor(String buddyGroupName,
                           CommandsFactory cf)
Method Detail

visitCommitCommand

public Object visitCommitCommand(InvocationContext ctx,
                                 CommitCommand commitCommand)
                          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
commitCommand - command to visit
Returns:
response from the visit
Throws:
Throwable - in the event of problems.

visitPutDataMapCommand

public 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.

visitPutKeyValueCommand

public 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 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.

visitRemoveNodeCommand

public 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.

visitClearDataCommand

public 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.

visitEvictFqnCommand

public 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.

visitInvalidateCommand

public 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.

visitRemoveKeyCommand

public 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.

visitGetDataMapCommand

public 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.

visitExistsNodeCommand

public 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.

visitGetKeyValueCommand

public 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.

visitGetNodeCommand

public 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.

visitGetKeysCommand

public 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.

visitGetChildrenNamesCommand

public 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.

visitMoveCommand

public 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.

visitGravitateDataCommand

public 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.

visitPrepareCommand

public 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.

visitRollbackCommand

public 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.

visitOptimisticPrepareCommand

public 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.

visitCreateNodeCommand

public 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.

transformBatch

public List<WriteCommand> transformBatch(List<WriteCommand> toTransform)
                                  throws Throwable
Throws:
Throwable

getBackupFqn

public Fqn getBackupFqn(Fqn originalFqn)
Assumes the backup Fqn if the current instance is the data owner.


setBuddyFqnTransformer

public void setBuddyFqnTransformer(BuddyFqnTransformer buddyFqnTransformer)


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