org.jboss.cache.optimistic
Class WorkspaceNodeImpl<K,V>

java.lang.Object
  extended by org.jboss.cache.AbstractNode<K,V>
      extended by org.jboss.cache.optimistic.WorkspaceNodeImpl<K,V>
All Implemented Interfaces:
WorkspaceNode<K,V>

Deprecated. will be removed along with optimistic and pessimistic locking.

@Deprecated
public class WorkspaceNodeImpl<K,V>
extends AbstractNode<K,V>
implements WorkspaceNode<K,V>

Wraps an ordinary Node and adds versioning and other meta data to it.

Author:
Manik Surtani (manik AT jboss DOT org), Steve Woodcock (stevew@jofti.com)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.jboss.cache.AbstractNode
AbstractNode.NodeFlags
 
Field Summary
 
Fields inherited from class org.jboss.cache.AbstractNode
children, flags, fqn
 
Constructor Summary
WorkspaceNodeImpl(NodeSPI<K,V> node, TransactionWorkspace workspace, NodeFactory<K,V> nodeFactory)
          Deprecated. Constructs with a node and workspace.
 
Method Summary
 void addChild(WorkspaceNode<K,V> child)
          Deprecated. Adds a given WorkspaceNode to the current node's child map
 NodeSPI<K,V> addChildDirect(Fqn f)
          Deprecated.  
 void clearData()
          Deprecated.  
 NodeSPI<K,V> createChild(Object childName, NodeSPI<K,V> parent, CacheSPI<K,V> cache, DataVersion version)
          Deprecated. Creates a child node.
 int dataSize()
          Deprecated.  
 V get(K key)
          Deprecated.  
protected  CacheSPI<K,V> getCache()
          Deprecated.  
 NodeSPI<K,V> getChildDirect(Fqn f)
          Deprecated. Overrides Node.getChild(Fqn) to return a NodeSPI rather than a Node
 Set getChildren()
          Deprecated.  
protected  Set<Fqn> getChildrenAddedSet()
          Deprecated.  
 Set<Object> getChildrenNames()
          Deprecated.  
protected  Set<Fqn> getChildrenRemovedSet()
          Deprecated.  
 Map<K,V> getData()
          Deprecated.  
 Fqn getFqn()
          Deprecated.  
 Set<K> getKeys()
          Deprecated.  
 List<Set<Fqn>> getMergedChildren()
          Deprecated. Returns 2 Sets - a set of children added (first set) and a set of children removed.
 Map<K,V> getMergedData()
          Deprecated. Attempts to merge data changed during the current transaction with the data in the underlying tree.
 NodeSPI<K,V> getNode()
          Deprecated. Retrieves a reference to the underlying NodeSPI instance.
 NodeSPI<K,V> getNodeSPI()
          Deprecated.  
 Node<K,V> getParent()
          Deprecated.  
 TransactionWorkspace getTransactionWorkspace()
          Deprecated. Retrieves a TransactionWorkspace instance associated with the current transaction, which the current WorkspaceNode instance lives in.
 DataVersion getVersion()
          Deprecated. Retrieves the data version of the in-memory node.
 boolean hasChild(Fqn f)
          Deprecated.  
 boolean hasChild(Object o)
          Deprecated.  
protected  void initFlags()
          Deprecated.  
 boolean isChildrenLoaded()
          Deprecated.  
 boolean isChildrenModified()
          Deprecated.  
 boolean isCreated()
          Deprecated.  
 boolean isDirty()
          Deprecated. A convenience method that returns whether a node is dirty, i.e., it has been created, deleted or modified.
 boolean isLockForChildInsertRemove()
          Deprecated.  
 boolean isModified()
          Deprecated. Returns true if this node is modified.
 boolean isResurrected()
          Deprecated.  
 boolean isValid()
          Deprecated.  
 boolean isVersioningImplicit()
          Deprecated. Tests whether versioning for the WorkspaceNode instance in the current transaction is implicit (i.e., using DefaultDataVersion rather than a custom DataVersion passed in using Option.setDataVersion(DataVersion))
 void markAsCreated()
          Deprecated. Marks the instance as having been created in the current transaction.
 void markAsRemoved(boolean marker, boolean recursive)
          Deprecated.  
 void markAsResurrected(boolean resurrected)
          Deprecated. Marks a node as resurrected, i.e., deleted and created again within the same transaction
 V put(K key, V value)
          Deprecated.  
 void putAll(Map<K,V> data)
          Deprecated.  
 V putIfAbsent(K k, V v)
          Deprecated.  
 void releaseObjectReferences(boolean recursive)
          Deprecated.  
 V remove(K key)
          Deprecated.  
 boolean removeChild(Fqn f)
          Deprecated.  
 boolean removeChild(Object childName)
          Deprecated.  
 V replace(K key, V value)
          Deprecated.  
 boolean replace(K key, V oldValue, V newValue)
          Deprecated.  
 void replaceAll(Map<K,V> data)
          Deprecated.  
 void setLockForChildInsertRemove(boolean lockForChildInsertRemove)
          Deprecated.  
 void setVersion(DataVersion version)
          Deprecated. Sets the data version of this workspace node.
 void setVersioningImplicit(boolean versioningImplicit)
          Deprecated. Sets whether versioning for the WorkspaceNode instance in the current transaction is implicit (i.e., using DefaultDataVersion rather than a custom DataVersion passed in using Option.setDataVersion(DataVersion))
 String toString()
          Deprecated.  
 
Methods inherited from class org.jboss.cache.AbstractNode
addChild, addChild, addChild, addChildDirect, addChildDirect, addChildDirect, addChildDirect, equals, getChild, getChild, getChildDirect, getChildren, getChildrenDirect, getChildrenDirect, getChildrenMap, getChildrenMapDirect, getLock, getOrCreateChild, hashCode, isFlagSet, isRemoved, isResident, setChildrenMap, setChildrenMapDirect, setFlag, setFlag, setRemoved, setResident, unsetFlag
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.cache.optimistic.WorkspaceNode
getChildDirect, isRemoved, setRemoved
 

Constructor Detail

WorkspaceNodeImpl

public WorkspaceNodeImpl(NodeSPI<K,V> node,
                         TransactionWorkspace workspace,
                         NodeFactory<K,V> nodeFactory)
Deprecated. 
Constructs with a node and workspace.

Method Detail

initFlags

protected void initFlags()
Deprecated. 

getChildrenAddedSet

protected Set<Fqn> getChildrenAddedSet()
Deprecated. 

getChildrenRemovedSet

protected Set<Fqn> getChildrenRemovedSet()
Deprecated. 

isChildrenModified

public boolean isChildrenModified()
Deprecated. 
Specified by:
isChildrenModified in interface WorkspaceNode<K,V>
Returns:
true if children have been added to or removed from this node. Not the same as 'dirty'.

isChildrenLoaded

public boolean isChildrenLoaded()
Deprecated. 
Specified by:
isChildrenLoaded in interface WorkspaceNode<K,V>
Returns:
true if the child map has been loaded from the underlying data structure into the workspace.

isResurrected

public boolean isResurrected()
Deprecated. 
Specified by:
isResurrected in interface WorkspaceNode<K,V>
Returns:
teur if this node has been resurrected, i.e., it was deleted and re-added within the same transaction

markAsResurrected

public void markAsResurrected(boolean resurrected)
Deprecated. 
Description copied from interface: WorkspaceNode
Marks a node as resurrected, i.e., deleted and created again within the same transaction

Specified by:
markAsResurrected in interface WorkspaceNode<K,V>

markAsRemoved

public void markAsRemoved(boolean marker,
                          boolean recursive)
Deprecated. 
Specified by:
markAsRemoved in interface WorkspaceNode<K,V>
Specified by:
markAsRemoved in class AbstractNode<K,V>

isModified

public boolean isModified()
Deprecated. 
Returns true if this node is modified.

Specified by:
isModified in interface WorkspaceNode<K,V>
Returns:
true if the data map has been modified

isDirty

public boolean isDirty()
Deprecated. 
A convenience method that returns whether a node is dirty, i.e., it has been created, deleted or modified.

Specified by:
isDirty in interface WorkspaceNode<K,V>
Returns:
true if the node has been either created, deleted or modified.

getFqn

public Fqn getFqn()
Deprecated. 
Specified by:
getFqn in interface WorkspaceNode<K,V>

putAll

public void putAll(Map<K,V> data)
Deprecated. 
Specified by:
putAll in interface WorkspaceNode<K,V>

replaceAll

public void replaceAll(Map<K,V> data)
Deprecated. 

put

public V put(K key,
             V value)
Deprecated. 
Specified by:
put in interface WorkspaceNode<K,V>

remove

public V remove(K key)
Deprecated. 
Specified by:
remove in interface WorkspaceNode<K,V>

get

public V get(K key)
Deprecated. 
Specified by:
get in interface WorkspaceNode<K,V>

getKeys

public Set<K> getKeys()
Deprecated. 
Specified by:
getKeys in interface WorkspaceNode<K,V>

getChildrenNames

public Set<Object> getChildrenNames()
Deprecated. 
Specified by:
getChildrenNames in interface WorkspaceNode<K,V>

getParent

public Node<K,V> getParent()
Deprecated. 

createChild

public NodeSPI<K,V> createChild(Object childName,
                                NodeSPI<K,V> parent,
                                CacheSPI<K,V> cache,
                                DataVersion version)
Deprecated. 
Description copied from interface: WorkspaceNode
Creates a child node.

Specified by:
createChild in interface WorkspaceNode<K,V>
Parameters:
childName - Object name of the child to create
parent - A reference to the parent node
cache - CacheSPI instance to create this node in
version - DataVersion to apply to the child. If null, DefaultDataVersion.ZERO will be used.
Returns:
a NodeSPI pointing to the newly created child.

isVersioningImplicit

public boolean isVersioningImplicit()
Deprecated. 
Description copied from interface: WorkspaceNode
Tests whether versioning for the WorkspaceNode instance in the current transaction is implicit (i.e., using DefaultDataVersion rather than a custom DataVersion passed in using Option.setDataVersion(DataVersion))

Specified by:
isVersioningImplicit in interface WorkspaceNode<K,V>
Returns:
true if versioning is implicit.

setVersioningImplicit

public void setVersioningImplicit(boolean versioningImplicit)
Deprecated. 
Description copied from interface: WorkspaceNode
Sets whether versioning for the WorkspaceNode instance in the current transaction is implicit (i.e., using DefaultDataVersion rather than a custom DataVersion passed in using Option.setDataVersion(DataVersion))

Specified by:
setVersioningImplicit in interface WorkspaceNode<K,V>
Parameters:
versioningImplicit - set to true if versioning is implicit, false otherwise.

getNode

public NodeSPI<K,V> getNode()
Deprecated. 
Description copied from interface: WorkspaceNode
Retrieves a reference to the underlying NodeSPI instance.

Specified by:
getNode in interface WorkspaceNode<K,V>
Returns:
a node

getVersion

public DataVersion getVersion()
Deprecated. 
Description copied from interface: WorkspaceNode
Retrieves the data version of the in-memory node.

Specified by:
getVersion in interface WorkspaceNode<K,V>
Overrides:
getVersion in class AbstractNode<K,V>
Returns:
A data version

setVersion

public void setVersion(DataVersion version)
Deprecated. 
Description copied from interface: WorkspaceNode
Sets the data version of this workspace node.

Specified by:
setVersion in interface WorkspaceNode<K,V>
Overrides:
setVersion in class AbstractNode<K,V>
Parameters:
version - a DataVersion implementation.

getMergedChildren

public List<Set<Fqn>> getMergedChildren()
Deprecated. 
Description copied from interface: WorkspaceNode
Returns 2 Sets - a set of children added (first set) and a set of children removed.

Specified by:
getMergedChildren in interface WorkspaceNode<K,V>
Returns:
a merged map of child names and Nodes

getMergedData

public Map<K,V> getMergedData()
Deprecated. 
Description copied from interface: WorkspaceNode
Attempts to merge data changed during the current transaction with the data in the underlying tree.

Specified by:
getMergedData in interface WorkspaceNode<K,V>
Returns:
a merged map of key/value pairs.

getTransactionWorkspace

public TransactionWorkspace getTransactionWorkspace()
Deprecated. 
Description copied from interface: WorkspaceNode
Retrieves a TransactionWorkspace instance associated with the current transaction, which the current WorkspaceNode instance lives in.

Specified by:
getTransactionWorkspace in interface WorkspaceNode<K,V>
Returns:
a TransactionWorkspace.

isCreated

public boolean isCreated()
Deprecated. 
Specified by:
isCreated in interface WorkspaceNode<K,V>
Returns:
true if the instance was created in the current transaction; i.e., it did not exist in the underlying data tree.

markAsCreated

public void markAsCreated()
Deprecated. 
Description copied from interface: WorkspaceNode
Marks the instance as having been created in the current transaction.

Specified by:
markAsCreated in interface WorkspaceNode<K,V>

getData

public Map<K,V> getData()
Deprecated. 
Specified by:
getData in interface WorkspaceNode<K,V>

toString

public String toString()
Deprecated. 
Overrides:
toString in class Object

addChildDirect

public NodeSPI<K,V> addChildDirect(Fqn f)
Deprecated. 
Overrides:
addChildDirect in class AbstractNode<K,V>

addChild

public void addChild(WorkspaceNode<K,V> child)
Deprecated. 
Description copied from interface: WorkspaceNode
Adds a given WorkspaceNode to the current node's child map

Specified by:
addChild in interface WorkspaceNode<K,V>

clearData

public void clearData()
Deprecated. 
Specified by:
clearData in interface WorkspaceNode<K,V>

dataSize

public int dataSize()
Deprecated. 

hasChild

public boolean hasChild(Object o)
Deprecated. 

isValid

public boolean isValid()
Deprecated. 

isLockForChildInsertRemove

public boolean isLockForChildInsertRemove()
Deprecated. 

setLockForChildInsertRemove

public void setLockForChildInsertRemove(boolean lockForChildInsertRemove)
Deprecated. 

releaseObjectReferences

public void releaseObjectReferences(boolean recursive)
Deprecated. 

getChildDirect

public NodeSPI<K,V> getChildDirect(Fqn f)
Deprecated. 
Description copied from interface: WorkspaceNode
Overrides Node.getChild(Fqn) to return a NodeSPI rather than a Node

Specified by:
getChildDirect in interface WorkspaceNode<K,V>
Overrides:
getChildDirect in class AbstractNode<K,V>
Parameters:
f - node fqn
Returns:
a child node

getChildren

public Set getChildren()
Deprecated. 
Overrides:
getChildren in class AbstractNode<K,V>

hasChild

public boolean hasChild(Fqn f)
Deprecated. 

getNodeSPI

public NodeSPI<K,V> getNodeSPI()
Deprecated. 

putIfAbsent

public V putIfAbsent(K k,
                     V v)
Deprecated. 

replace

public V replace(K key,
                 V value)
Deprecated. 

replace

public boolean replace(K key,
                       V oldValue,
                       V newValue)
Deprecated. 

removeChild

public boolean removeChild(Fqn f)
Deprecated. 

removeChild

public boolean removeChild(Object childName)
Deprecated. 
Specified by:
removeChild in interface WorkspaceNode<K,V>

getCache

protected CacheSPI<K,V> getCache()
Deprecated. 


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