org.jboss.cache.commands.write
Class AbstractVersionedDataCommand

java.lang.Object
  extended by org.jboss.cache.commands.read.AbstractDataCommand
      extended by org.jboss.cache.commands.write.AbstractVersionedDataCommand
All Implemented Interfaces:
Cloneable, DataCommand, ReplicableCommand, ReversibleCommand, VersionedDataCommand, VisitableCommand
Direct Known Subclasses:
ClearDataCommand, PutDataMapCommand, PutKeyValueCommand, RemoveKeyCommand, RemoveNodeCommand

public abstract class AbstractVersionedDataCommand
extends AbstractDataCommand
implements VersionedDataCommand

Base version of DataCommand which handles common behaviour

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

Field Summary
protected  DataVersion dataVersion
           
protected  GlobalTransaction globalTransaction
           
protected  Notifier notifier
           
 
Fields inherited from class org.jboss.cache.commands.read.AbstractDataCommand
dataContainer, fqn
 
Constructor Summary
AbstractVersionedDataCommand()
           
 
Method Summary
 boolean equals(Object o)
           
 DataVersion getDataVersion()
           
 GlobalTransaction getGlobalTransaction()
           
 Object[] getParameters()
          Basic versions of these methods
 int hashCode()
           
 void initialize(Notifier notifier, DataContainer dataContainer)
           
 boolean isVersioned()
          Has data version set? (i.e.
protected abstract  boolean isVersionedId(int id)
           
 void setDataVersion(DataVersion dataVersion)
          Sets the DataVersion pertaining to this command.
 void setGlobalTransaction(GlobalTransaction globalTransaction)
          Sets a GlobalTransaction on this command.
 void setParameters(int commandId, Object[] args)
          Basic versions of these methods
 
Methods inherited from class org.jboss.cache.commands.read.AbstractDataCommand
getFqn, initialize, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.cache.commands.ReversibleCommand
rollback
 
Methods inherited from interface org.jboss.cache.commands.DataCommand
getFqn
 
Methods inherited from interface org.jboss.cache.commands.VisitableCommand
acceptVisitor
 
Methods inherited from interface org.jboss.cache.commands.ReplicableCommand
getCommandId, perform
 

Field Detail

notifier

protected Notifier notifier

dataVersion

protected DataVersion dataVersion

globalTransaction

protected GlobalTransaction globalTransaction
Constructor Detail

AbstractVersionedDataCommand

public AbstractVersionedDataCommand()
Method Detail

initialize

public void initialize(Notifier notifier,
                       DataContainer dataContainer)

getDataVersion

public DataVersion getDataVersion()
Specified by:
getDataVersion in interface VersionedDataCommand
Returns:
the DataVersion pertaining to this command.

setDataVersion

public void setDataVersion(DataVersion dataVersion)
Description copied from interface: VersionedDataCommand
Sets the DataVersion pertaining to this command.

Specified by:
setDataVersion in interface VersionedDataCommand
Parameters:
dataVersion - to set

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

isVersioned

public boolean isVersioned()
Description copied from interface: VersionedDataCommand
Has data version set? (i.e. not null)

Specified by:
isVersioned in interface VersionedDataCommand
Returns:
true if getDataVersion() would not return null; false otherwise.

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

isVersionedId

protected abstract boolean isVersionedId(int id)

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractDataCommand


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