org.jboss.cache.commands.write
Class CreateNodeCommand

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

public class CreateNodeCommand
extends AbstractDataCommand
implements ReversibleCommand

Command that creates a node. Primarily to be used as an undo command for removing nodes.

Since:
2.2.0
Author:
Manik Surtani (manik@jboss.org)

Field Summary
static int METHOD_ID
           
 
Fields inherited from class org.jboss.cache.commands.read.AbstractDataCommand
dataContainer, fqn
 
Constructor Summary
CreateNodeCommand()
           
CreateNodeCommand(Fqn fqn)
           
 
Method Summary
 Object acceptVisitor(InvocationContext ctx, Visitor visitor)
          Accept a visitor, and return the result of accepting this visitor.
 int getCommandId()
          Used by marshallers to convert this command into an id for streaming.
 GlobalTransaction getGlobalTransaction()
           
 Object perform(InvocationContext ctx)
          Creates a node in the cache, specified by the given Fqn.
 void rollback()
          Reverses a command that has already been invoked.
 void setGlobalTransaction(GlobalTransaction gtx)
          Sets a GlobalTransaction on this command.
 String toString()
           
 
Methods inherited from class org.jboss.cache.commands.read.AbstractDataCommand
equals, getFqn, getParameters, hashCode, initialize, setParameters
 
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
 
Methods inherited from interface org.jboss.cache.commands.ReplicableCommand
getParameters, setParameters
 

Field Detail

METHOD_ID

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

CreateNodeCommand

public CreateNodeCommand(Fqn fqn)

CreateNodeCommand

public CreateNodeCommand()
Method Detail

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.

setGlobalTransaction

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

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

getGlobalTransaction

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

perform

public Object perform(InvocationContext ctx)
Creates a node in the cache, specified by the given Fqn.

Specified by:
perform in interface ReplicableCommand
Parameters:
ctx - invocation context
Returns:
arbitrary return value generated by performing this command

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

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

toString

public String toString()
Overrides:
toString in class AbstractDataCommand


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