org.jboss.cache
Class VersionedNode<K,V>

java.lang.Object
  extended by org.jboss.cache.AbstractNode<K,V>
      extended by org.jboss.cache.UnversionedNode<K,V>
          extended by org.jboss.cache.VersionedNode<K,V>
All Implemented Interfaces:
Node<K,V>, NodeSPI<K,V>

public class VersionedNode<K,V>
extends UnversionedNode<K,V>

VersionedNode extends the UnversionedNode by adding a DataVersion property.

Unlike UnversionedNode, this node supports getVersion() and setVersion(org.jboss.cache.optimistic.DataVersion) defined in NodeSPI

Typically used when the cache mode configured is Configuration.NodeLockingScheme.OPTIMISTIC

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

Field Summary
 
Fields inherited from class org.jboss.cache.AbstractNode
deleted, fqn, children, resident
 
Constructor Summary
protected VersionedNode(Fqn fqn, NodeSPI<K,V> parent, Map<K,V> data, CacheSPI<K,V> cache)
           
 
Method Summary
 Map getInternalState(boolean onlyInternalState)
          Very similar to NodeSPI.getDataDirect(), except that this method may also encode some internal data as attributes in the map, using special _JBOSS_INTERNAL_XXX Strings as keys.
 NodeSPI<K,V> getParent()
          Returns the parent.
 DataVersion getVersion()
          Returns the version id of this node.
 void setInternalState(Map state)
          Very similar to NodeSPI.putAllDirect(java.util.Map) except that this method first scans the map for any internal attributes using special _JBOSS_INTERNAL_XXX Strings as keys, and uses these to set internal attributes before passing the remaining attributes to NodeSPI.putAllDirect(java.util.Map).
 void setVersion(DataVersion version)
          Sets the version id of this node.
 
Methods inherited from class org.jboss.cache.UnversionedNode
addChild, addChild, addChildDirect, addChildDirect, clearData, clearDataDirect, dataSize, get, getCache, getData, getDataDirect, getDirect, getFqn, getChild, getChild, getChildDirect, getChildDirect, getChildren, getChildrenDirect, getChildrenDirect, getChildrenMapDirect, getChildrenNames, getChildrenNamesDirect, getKeys, getKeysDirect, getLock, getOrCreateChild, hasChild, hasChild, hasChildrenDirect, isDataLoaded, isChildrenLoaded, isLockForChildInsertRemove, isValid, print, printDetails, put, putAll, putAllDirect, putDirect, putIfAbsent, remove, removeDirect, removeChild, removeChild, removeChildDirect, removeChildDirect, removeChildrenDirect, replace, replace, replaceAll, setDataLoaded, setFqn, setChildrenLoaded, setChildrenMapDirect, setLockForChildInsertRemove, setValid, toString
 
Methods inherited from class org.jboss.cache.AbstractNode
equals, hashCode, isDeleted, isResident, markAsDeleted, markAsDeleted, setResident
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.cache.NodeSPI
isDeleted, markAsDeleted, markAsDeleted
 
Methods inherited from interface org.jboss.cache.Node
isResident, setResident
 

Constructor Detail

VersionedNode

protected VersionedNode(Fqn fqn,
                        NodeSPI<K,V> parent,
                        Map<K,V> data,
                        CacheSPI<K,V> cache)
Method Detail

getVersion

public DataVersion getVersion()
Returns the version id of this node.

Specified by:
getVersion in interface NodeSPI<K,V>
Overrides:
getVersion in class UnversionedNode<K,V>
Returns:
the version

getParent

public NodeSPI<K,V> getParent()
Returns the parent.

Specified by:
getParent in interface Node<K,V>
Specified by:
getParent in interface NodeSPI<K,V>
Overrides:
getParent in class UnversionedNode<K,V>
Returns:
the parent node, or null if this is the root node
See Also:
Node.getParent()

setVersion

public void setVersion(DataVersion version)
Sets the version id of this node.

Specified by:
setVersion in interface NodeSPI<K,V>
Overrides:
setVersion in class UnversionedNode<K,V>
Parameters:
version -

getInternalState

public Map getInternalState(boolean onlyInternalState)
Description copied from interface: NodeSPI
Very similar to NodeSPI.getDataDirect(), except that this method may also encode some internal data as attributes in the map, using special _JBOSS_INTERNAL_XXX Strings as keys. Designed to be used by StateTransferGenerator and CacheStoreInterceptor which attempt to serialize nodes into a stream for storage or transfer.

Specified by:
getInternalState in interface NodeSPI<K,V>
Overrides:
getInternalState in class UnversionedNode<K,V>
Parameters:
onlyInternalState - if true, the map will only contain internal state and no other data.
Returns:
a map containing data as well as additional information about this node.

setInternalState

public void setInternalState(Map state)
Description copied from interface: NodeSPI
Very similar to NodeSPI.putAllDirect(java.util.Map) except that this method first scans the map for any internal attributes using special _JBOSS_INTERNAL_XXX Strings as keys, and uses these to set internal attributes before passing the remaining attributes to NodeSPI.putAllDirect(java.util.Map). Designed to be used by StateTransferIntegrator and CacheLoaderInterceptor classes which attempt to create nodes based on a data stream.

Specified by:
setInternalState in interface NodeSPI<K,V>
Overrides:
setInternalState in class UnversionedNode<K,V>
Parameters:
state - state to be applied


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