org.jboss.cache.commands.write
Class AbstractVersionedDataCommand
java.lang.Object
org.jboss.cache.commands.read.AbstractDataCommand
org.jboss.cache.commands.write.AbstractVersionedDataCommand
- All Implemented Interfaces:
- DataCommand, ReplicableCommand, VersionedDataCommand, VisitableCommand, WriteCommand
- 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 AT jboss DOT org)
notifier
protected Notifier notifier
dataVersion
protected DataVersion dataVersion
globalTransaction
protected GlobalTransaction globalTransaction
AbstractVersionedDataCommand
public AbstractVersionedDataCommand()
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 WriteCommand
- Returns:
- a GlobalTransaction associated with this command.
setGlobalTransaction
public void setGlobalTransaction(GlobalTransaction globalTransaction)
- Description copied from interface:
WriteCommand
- Sets a GlobalTransaction on this command.
- Specified by:
setGlobalTransaction
in interface WriteCommand
- 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
peekVersioned
protected NodeSPI peekVersioned(InvocationContext ctx)
- Utility method to peek a node and throw an exception if the version isn't what is expected.
- Parameters:
ctx
- context to use
- Returns:
- node peeked, null if nonexistent
- Throws:
DataVersioningException
- if there is a version mismatch
Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.