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(java.lang.String buddyGroupName)
           
Fqn2BuddyFqnVisitor(java.lang.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)
           
 java.util.List<WriteCommand> transformBatch(java.util.List<WriteCommand> toTransform)
           
 java.lang.Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command)
          Visits a RemoveDataCommand.
 java.lang.Object visitCommitCommand(InvocationContext ctx, CommitCommand commitCommand)
          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 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(java.lang.String buddyGroupName)

Fqn2BuddyFqnVisitor

public Fqn2BuddyFqnVisitor(java.lang.String buddyGroupName,
                           CommandsFactory cf)
Method Detail

visitCommitCommand

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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
Overrides:
visitCreateNodeCommand 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.

transformBatch

public java.util.List<WriteCommand> transformBatch(java.util.List<WriteCommand> toTransform)
                                            throws java.lang.Throwable
Throws:
java.lang.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.