org.jboss.cache
Class Modification

java.lang.Object
  extended by org.jboss.cache.Modification
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class Modification
extends java.lang.Object
implements java.io.Externalizable

Represents a modification in the cache. Contains the nature of the modification (e.g. PUT, REMOVE), the fqn of the node, the new value and the previous value. A list of modifications will be sent to all nodes in a cluster when a transaction has been committed (PREPARE phase). A Modification is also used to roll back changes, e.g. since we know the previous value, we can reconstruct the previous state by applying the changes in a modification listin reverse order.

Version:
$Revision: 1.4 $
Author:
Bela Ban Apr 12, 2003
See Also:
Serialized Form

Field Summary
static byte PUT_DATA
          Put data (Map) modification.
static byte PUT_DATA_ERASE
          Erase existing data, put data (Map) modification.
static byte PUT_KEY_VALUE
          Put key/value modification.
static byte REMOVE_DATA
          Clear node's Map modification.
static byte REMOVE_KEY_VALUE
          Remove a key/value modification.
static byte REMOVE_NODE
          Remove a node modification.
static byte STORE_STATE
          Stores data in a Fqn using a byte array.
 
Constructor Summary
Modification()
          Constructs a new modification.
Modification(byte type, Fqn fqn)
          Constructs a new modification with fqn only.
Modification(byte type, Fqn fqn, java.util.Map data)
          Constructs a new modification with data map.
Modification(byte type, Fqn fqn, java.lang.Object key)
          Constructs a new modification with key.
Modification(byte type, Fqn fqn, java.lang.Object key, java.lang.Object value)
          Constructs a new modification with details.
 
Method Summary
 java.util.Map getData()
          Returns the modification Map set.
 Fqn getFqn()
          Returns the modification fqn.
 java.lang.Object getKey()
          Returns the modification key.
 java.lang.Object getOldValue()
          Returns the post modification old value.
 byte getType()
          Returns the type of modification.
 java.lang.Object getValue()
          Returns the modification value.
 void readExternal(java.io.ObjectInput in)
          Reads data from an external stream.
 void setData(java.util.Map data)
          Sets the modification Map set.
 void setFqn(Fqn fqn)
          Sets the modification fqn.
 void setKey(java.lang.Object key)
          Sets the modification key.
 void setOldValue(java.lang.Object old_value)
          Sets the post modification old value.
 void setType(byte type)
          Sets the type of modification.
 void setValue(java.lang.Object value)
          Sets the modification value.
 java.lang.String toString()
          Returns debug information about this modification.
 void writeExternal(java.io.ObjectOutput out)
          Writes data to an external stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PUT_KEY_VALUE

public static final byte PUT_KEY_VALUE
Put key/value modification.

See Also:
Constant Field Values

PUT_DATA

public static final byte PUT_DATA
Put data (Map) modification.

See Also:
Constant Field Values

PUT_DATA_ERASE

public static final byte PUT_DATA_ERASE
Erase existing data, put data (Map) modification.

See Also:
Constant Field Values

REMOVE_NODE

public static final byte REMOVE_NODE
Remove a node modification.

See Also:
Constant Field Values

REMOVE_KEY_VALUE

public static final byte REMOVE_KEY_VALUE
Remove a key/value modification.

See Also:
Constant Field Values

REMOVE_DATA

public static final byte REMOVE_DATA
Clear node's Map modification.

See Also:
Constant Field Values

STORE_STATE

public static final byte STORE_STATE
Stores data in a Fqn using a byte array.

See Also:
Constant Field Values
Constructor Detail

Modification

public Modification()
Constructs a new modification.


Modification

public Modification(byte type,
                    Fqn fqn,
                    java.lang.Object key,
                    java.lang.Object value)
Constructs a new modification with details.


Modification

public Modification(byte type,
                    Fqn fqn,
                    java.lang.Object key)
Constructs a new modification with key.


Modification

public Modification(byte type,
                    Fqn fqn,
                    java.util.Map data)
Constructs a new modification with data map.


Modification

public Modification(byte type,
                    Fqn fqn)
Constructs a new modification with fqn only.

Method Detail

getType

public byte getType()
Returns the type of modification.


setType

public void setType(byte type)
Sets the type of modification.


getFqn

public Fqn getFqn()
Returns the modification fqn.


setFqn

public void setFqn(Fqn fqn)
Sets the modification fqn.


getKey

public java.lang.Object getKey()
Returns the modification key.


setKey

public void setKey(java.lang.Object key)
Sets the modification key.


getValue

public java.lang.Object getValue()
Returns the modification value.


setValue

public void setValue(java.lang.Object value)
Sets the modification value.


getOldValue

public java.lang.Object getOldValue()
Returns the post modification old value.


setOldValue

public void setOldValue(java.lang.Object old_value)
Sets the post modification old value.


getData

public java.util.Map getData()
Returns the modification Map set.


setData

public void setData(java.util.Map data)
Sets the modification Map set.


writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Writes data to an external stream.

Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Reads data from an external stream.

Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException

toString

public java.lang.String toString()
Returns debug information about this modification.

Overrides:
toString in class java.lang.Object


Copyright © 1998-2005 JBoss Inc . All Rights Reserved.