org.jboss.cache.commands.write
Class MoveCommand

java.lang.Object
  extended by org.jboss.cache.commands.read.AbstractDataCommand
      extended by org.jboss.cache.commands.write.MoveCommand
All Implemented Interfaces:
Cloneable, DataCommand, ReplicableCommand, ReversibleCommand, VisitableCommand

public class MoveCommand
extends AbstractDataCommand
implements ReversibleCommand

Implements functionality defined by Cache.move(org.jboss.cache.Fqn, org.jboss.cache.Fqn)

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

Field Summary
static int METHOD_ID
           
 
Fields inherited from class org.jboss.cache.commands.read.AbstractDataCommand
dataContainer, fqn
 
Constructor Summary
MoveCommand()
           
MoveCommand(Fqn from, Fqn to)
           
 
Method Summary
 Object acceptVisitor(InvocationContext ctx, Visitor visitor)
          Accept a visitor, and return the result of accepting this visitor.
 boolean equals(Object o)
           
 int getCommandId()
          Used by marshallers to convert this command into an id for streaming.
 GlobalTransaction getGlobalTransaction()
           
 Object[] getParameters()
          Basic versions of these methods
 Fqn getTo()
           
 int hashCode()
           
 void initialize(Notifier notifier, DataContainer dataContainer)
           
 Object perform(InvocationContext ctx)
          Moves a node, from fqn to to, and returns null.
 void rollback()
          Reverses a command that has already been invoked.
 void setGlobalTransaction(GlobalTransaction globalTransaction)
          Sets a GlobalTransaction on this command.
 void setParameters(int commandId, Object[] args)
          Basic versions of these methods
 String toString()
           
 
Methods inherited from class org.jboss.cache.commands.read.AbstractDataCommand
getFqn, initialize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.cache.commands.DataCommand
getFqn
 

Field Detail

METHOD_ID

public static final int METHOD_ID
See Also:
Constant Field Values
Constructor Detail

MoveCommand

public MoveCommand()

MoveCommand

public MoveCommand(Fqn from,
                   Fqn to)
Method Detail

initialize

public void initialize(Notifier notifier,
                       DataContainer dataContainer)

getGlobalTransaction

public GlobalTransaction getGlobalTransaction()
Specified by:
getGlobalTransaction in interface ReversibleCommand
Returns:
a GlobalTransaction associated with this command.

setGlobalTransaction

public void setGlobalTransaction(GlobalTransaction globalTransaction)
Description copied from interface: ReversibleCommand
Sets a GlobalTransaction on this command.

Specified by:
setGlobalTransaction in interface ReversibleCommand
Parameters:
globalTransaction - global transaction to set

perform

public Object perform(InvocationContext ctx)
Moves a node, from fqn to to, and returns null.

Specified by:
perform in interface ReplicableCommand
Parameters:
ctx - invocation context
Returns:
null

rollback

public void rollback()
Description copied from interface: ReversibleCommand
Reverses a command that has already been invoked. Important: this method will be invoked at the end of interceptors chain. It should never be called directly from a custom interceptor.

Specified by:
rollback in interface ReversibleCommand

acceptVisitor

public Object acceptVisitor(InvocationContext ctx,
                            Visitor visitor)
                     throws Throwable
Description copied from interface: VisitableCommand
Accept a visitor, and return the result of accepting this visitor.

Specified by:
acceptVisitor in interface VisitableCommand
Parameters:
ctx - invocation context
visitor - visitor to accept
Returns:
arbitrary return value
Throws:
Throwable - in the event of problems

getTo

public Fqn getTo()

getCommandId

public int getCommandId()
Description copied from interface: ReplicableCommand
Used by marshallers to convert this command into an id for streaming.

Specified by:
getCommandId in interface ReplicableCommand
Returns:
the method id of this command. This is compatible with pre-2.2.0 MethodCall ids.

getParameters

public Object[] getParameters()
Description copied from class: AbstractDataCommand
Basic versions of these methods

Specified by:
getParameters in interface ReplicableCommand
Overrides:
getParameters in class AbstractDataCommand
Returns:
an object array of arguments, compatible with pre-2.2.0 MethodCall args.

setParameters

public void setParameters(int commandId,
                          Object[] args)
Description copied from class: AbstractDataCommand
Basic versions of these methods

Specified by:
setParameters in interface ReplicableCommand
Overrides:
setParameters in class AbstractDataCommand
Parameters:
commandId - command id to set. This is usually unused but *could* be used in the event of a command having multiple IDs, such as PutKeyValueCommand.
args - object array of args

equals

public boolean equals(Object o)
Overrides:
equals in class AbstractDataCommand

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractDataCommand

toString

public String toString()
Overrides:
toString in class AbstractDataCommand


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