org.jboss.cache.commands.read
Class GravitateDataCommand

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

public class GravitateDataCommand
extends AbstractDataCommand

Used with buddy replication's DataGravitatorInterceptor.

This is the equivalent of the old MethodCallDefinitions.dataGravitationMethod method call from 2.1.x.

Since:
2.2.0
Author:
Manik Surtani

Field Summary
static int METHOD_ID
           
 
Fields inherited from class org.jboss.cache.commands.read.AbstractDataCommand
dataContainer, fqn
 
Constructor Summary
GravitateDataCommand(org.jgroups.Address localAddress)
           
GravitateDataCommand(Fqn fqn, boolean searchSubtrees, org.jgroups.Address localAddress)
           
 
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.
 Object[] getParameters()
          Basic versions of these methods
 int hashCode()
           
 void initialize(DataContainer dataContainer, CacheSPI spi, BuddyFqnTransformer transformer)
           
 boolean isSearchSubtrees()
           
 Object perform(InvocationContext ctx)
          Searches for data to gravitate given an Fqn and whether buddy backup subtrees are to be searched as well.
 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
 

Field Detail

METHOD_ID

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

GravitateDataCommand

public GravitateDataCommand(Fqn fqn,
                            boolean searchSubtrees,
                            org.jgroups.Address localAddress)

GravitateDataCommand

public GravitateDataCommand(org.jgroups.Address localAddress)
Method Detail

initialize

public void initialize(DataContainer dataContainer,
                       CacheSPI spi,
                       BuddyFqnTransformer transformer)

perform

public Object perform(InvocationContext ctx)
Searches for data to gravitate given an Fqn and whether buddy backup subtrees are to be searched as well. Note that data stored under the Fqn, along with all children, are retrieved.

Parameters:
ctx - invocation context
Returns:
a GravitateResult containing node data, as well as information on whether this was found in a primary or backup tree.

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.

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

getCommandId

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

Returns:
the method id of this command. This is compatible with pre-2.2.0 MethodCall ids.

isSearchSubtrees

public boolean isSearchSubtrees()

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.