org.jboss.cache.optimistic
Class WorkspaceNodeImpl

java.lang.Object
  extended by org.jboss.cache.optimistic.WorkspaceNodeImpl
All Implemented Interfaces:
WorkspaceNode, TreeNode

public class WorkspaceNodeImpl
extends java.lang.Object
implements WorkspaceNode

Wraps a DataNode and adds versioning and other meta data to it.

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

Constructor Summary
WorkspaceNodeImpl()
           
WorkspaceNodeImpl(DataNode node, TransactionWorkspace workspace)
          Constructs with a node and workspace.
WorkspaceNodeImpl(TreeNode node, TransactionWorkspace workspace)
          Deprecated.  
 
Method Summary
 java.util.Set acquireAll(java.lang.Object caller, long timeout, int lock_type)
          Deprecated. Will be removed in JBossCache 1.3.
 void addChild(java.lang.Object child_name, TreeNode n)
          Deprecated. Will be removed in JBossCache 1.3.
 boolean childExists(java.lang.Object child_name)
          Deprecated. Will be removed in JBossCache 1.3.
 void clear()
          Clears the data of this node.
 boolean containsKey(java.lang.Object key)
          Deprecated. Will be removed in JBossCache 1.3.
 TreeNode createChild(java.lang.Object child_name, Fqn fqn, TreeNode parent)
          Creates a child node with a name, FQN, and parent.
 TreeNode createChild(java.lang.Object child_name, Fqn fqn, TreeNode parent, java.lang.Object key, java.lang.Object value)
          Deprecated. Will be removed in JBossCache 1.3.
 TreeNode createChild(java.lang.Object child_name, Fqn fqn, TreeNode parent, TreeCache cache, DataVersion version)
           
 java.lang.Object get(java.lang.Object key)
          Returns the value of a key or null if it does not exist.
 TreeNode getChild(java.lang.Object childName)
          Returns the named child of this node.
 java.util.Map getChildren()
          Always returns null; dummy method for TreeNode compatibility.
 boolean getChildrenLoaded()
          Deprecated. Will be removed in JBossCache 1.3.
 java.util.Set getChildrenNames()
           
 java.util.Map getData()
          Always returns null; dummy method for TreeNode compatibility.
 java.util.Set getDataKeys()
          Deprecated. Will be removed in JBossCache 1.3.
 Fqn getFqn()
          Returns the fully qualified name of the node.
 IdentityLock getImmutableLock()
          Deprecated. Will be removed in JBossCache 1.3.
 java.util.Set getKeys()
           
 IdentityLock getLock()
          Deprecated. Will be removed in JBossCache 1.3.
 java.util.Map getMergedChildren()
           
 java.util.Map getMergedData()
           
 java.lang.Object getName()
          Returns the name of this node.
 DataNode getNode()
           
 TreeNode getOrCreateChild(java.lang.Object child_name, GlobalTransaction gtx, boolean createIfNotExists)
          Deprecated. Will be removed in JBossCache 1.3.
 TreeNode getParent()
          Returns the parent of this node.
 TransactionWorkspace getTransactionWorkspace()
           
 DataVersion getVersion()
           
 TreeNode getWrappedChild(java.lang.Object fqn)
           
 TreeNode getWrappedParent()
           
 boolean hasChildren()
          Deprecated. Will be removed in JBossCache 1.3.
 boolean isCreated()
           
 boolean isDeleted()
           
 boolean isDirty()
          Returns true if this node is dirty.
 boolean isLocked()
          Deprecated. Will be removed in JBossCache 1.3.
 void markAsCreated()
           
 void markAsDeleted()
           
 int numAttributes()
          Deprecated. Will be removed in JBossCache 1.3.
 void print(java.lang.StringBuffer sb, int indent)
          Deprecated. Will be removed in JBossCache 1.3.
 void printDetails(java.lang.StringBuffer sb, int indent)
          Deprecated. Will be removed in JBossCache 1.3.
 void printIndent(java.lang.StringBuffer sb, int indent)
          Deprecated. Will be removed in JBossCache 1.3.
 void printLockInfo(java.lang.StringBuffer sb, int indent)
          Deprecated. Will be removed in JBossCache 1.3.
 void put(java.util.Map data)
          Adds (merges) the contents of the map with the existing data.
 void put(java.util.Map data, boolean eraseData)
          Puts the contents of a map into this node.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          Puts the key and value into the node.
 void release(java.lang.Object caller)
          Deprecated. Will be removed in JBossCache 1.3.
 void releaseAll(java.lang.Object owner)
          Deprecated. Will be removed in JBossCache 1.3.
 void releaseAllForce()
          Deprecated. Will be removed in JBossCache 1.3.
 void releaseForce()
          Deprecated. Will be removed in JBossCache 1.3.
 java.lang.Object remove(java.lang.Object key)
          Removes the old value of the key.
 void removeAllChildren()
          Deprecated. Will be removed in JBossCache 1.3.
 void removeChild(java.lang.Object childName)
          Removes the named child of this node.
 void setChildren(java.util.Map children)
          Deprecated. Will be removed in JBossCache 1.3.
 void setChildrenLoaded(boolean b)
          Deprecated. Will be removed in JBossCache 1.3.
 void setRecursiveTreeCacheInstance(TreeCache cache)
          Deprecated. Will be removed in JBossCache 1.3.
 void setVersion(DataVersion version)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WorkspaceNodeImpl

public WorkspaceNodeImpl()

WorkspaceNodeImpl

public WorkspaceNodeImpl(TreeNode node,
                         TransactionWorkspace workspace)
Deprecated. 

Constructs with a node and workspace.


WorkspaceNodeImpl

public WorkspaceNodeImpl(DataNode node,
                         TransactionWorkspace workspace)
Constructs with a node and workspace.

Method Detail

isDirty

public boolean isDirty()
Returns true if this node is dirty.

Specified by:
isDirty in interface WorkspaceNode

getFqn

public Fqn getFqn()
Description copied from interface: TreeNode
Returns the fully qualified name of the node.

Specified by:
getFqn in interface TreeNode

put

public void put(java.util.Map data,
                boolean eraseData)
Description copied from interface: TreeNode
Puts the contents of a map into this node. Optionally erases the existing contents.

Specified by:
put in interface TreeNode
eraseData - true to erase the existing contents

put

public void put(java.util.Map data)
Description copied from interface: TreeNode
Adds (merges) the contents of the map with the existing data.

Specified by:
put in interface TreeNode

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Description copied from interface: TreeNode
Puts the key and value into the node. Returns the old value of the key, if it existed.

Specified by:
put in interface TreeNode

remove

public java.lang.Object remove(java.lang.Object key)
Description copied from interface: TreeNode
Removes the old value of the key.

Specified by:
remove in interface TreeNode

clear

public void clear()
Description copied from interface: TreeNode
Clears the data of this node.

Specified by:
clear in interface TreeNode

get

public java.lang.Object get(java.lang.Object key)
Description copied from interface: TreeNode
Returns the value of a key or null if it does not exist.

Specified by:
get in interface TreeNode

getKeys

public java.util.Set getKeys()
Specified by:
getKeys in interface WorkspaceNode

getChildrenNames

public java.util.Set getChildrenNames()
Specified by:
getChildrenNames in interface WorkspaceNode

removeChild

public void removeChild(java.lang.Object childName)
Description copied from interface: TreeNode
Removes the named child of this node.

Specified by:
removeChild in interface TreeNode

getParent

public TreeNode getParent()
Description copied from interface: TreeNode
Returns the parent of this node.

Specified by:
getParent in interface TreeNode

getWrappedParent

public TreeNode getWrappedParent()

createChild

public TreeNode createChild(java.lang.Object child_name,
                            Fqn fqn,
                            TreeNode parent)
Description copied from interface: TreeNode
Creates a child node with a name, FQN, and parent. Returns the created node.

Specified by:
createChild in interface TreeNode

createChild

public TreeNode createChild(java.lang.Object child_name,
                            Fqn fqn,
                            TreeNode parent,
                            TreeCache cache,
                            DataVersion version)
Specified by:
createChild in interface WorkspaceNode

getChild

public TreeNode getChild(java.lang.Object childName)
Description copied from interface: TreeNode
Returns the named child of this node.

Specified by:
getChild in interface TreeNode

getWrappedChild

public TreeNode getWrappedChild(java.lang.Object fqn)

getNode

public DataNode getNode()
Specified by:
getNode in interface WorkspaceNode

getVersion

public DataVersion getVersion()
Specified by:
getVersion in interface WorkspaceNode

setVersion

public void setVersion(DataVersion version)
Specified by:
setVersion in interface WorkspaceNode

getMergedChildren

public java.util.Map getMergedChildren()
Specified by:
getMergedChildren in interface WorkspaceNode

getMergedData

public java.util.Map getMergedData()
Specified by:
getMergedData in interface WorkspaceNode

markAsDeleted

public void markAsDeleted()
Specified by:
markAsDeleted in interface WorkspaceNode

isDeleted

public boolean isDeleted()
Specified by:
isDeleted in interface WorkspaceNode

getName

public java.lang.Object getName()
Description copied from interface: TreeNode
Returns the name of this node.

Specified by:
getName in interface TreeNode

getTransactionWorkspace

public TransactionWorkspace getTransactionWorkspace()
Specified by:
getTransactionWorkspace in interface WorkspaceNode

isCreated

public boolean isCreated()
Specified by:
isCreated in interface WorkspaceNode

markAsCreated

public void markAsCreated()
Specified by:
markAsCreated in interface WorkspaceNode

getData

public java.util.Map getData()
Always returns null; dummy method for TreeNode compatibility.

Specified by:
getData in interface TreeNode
Returns:
null
See Also:
DataNode

getChildren

public java.util.Map getChildren()
Always returns null; dummy method for TreeNode compatibility.

Specified by:
getChildren in interface TreeNode
Returns:
null

containsKey

public boolean containsKey(java.lang.Object key)
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Returns true if the key is in the data set.

Specified by:
containsKey in interface TreeNode
See Also:
DataNode

getDataKeys

public java.util.Set getDataKeys()
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Returns the data keys, or an empty set if there are no keys.

Specified by:
getDataKeys in interface TreeNode
See Also:
DataNode

childExists

public boolean childExists(java.lang.Object child_name)
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Returns true if the child exists.

Specified by:
childExists in interface TreeNode
See Also:
DataNode

getImmutableLock

public IdentityLock getImmutableLock()
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
getImmutableLock in interface TreeNode
See Also:
DataNode

getLock

public IdentityLock getLock()
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
getLock in interface TreeNode
See Also:
DataNode

numAttributes

public int numAttributes()
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Returns the number of attributes.

Specified by:
numAttributes in interface TreeNode
See Also:
DataNode

hasChildren

public boolean hasChildren()
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Returns true if this node has children.

Specified by:
hasChildren in interface TreeNode
See Also:
DataNode

getOrCreateChild

public TreeNode getOrCreateChild(java.lang.Object child_name,
                                 GlobalTransaction gtx,
                                 boolean createIfNotExists)
Deprecated. Will be removed in JBossCache 1.3.

Creates a new child of this node if it doesn't exist. Also notifies the cache that the new child has been created. dded this new getOrCreateChild() method to avoid thread contention on create_lock in PessimisticLockInterceptor.lock()

Specified by:
getOrCreateChild in interface TreeNode
See Also:
DataNode

createChild

public TreeNode createChild(java.lang.Object child_name,
                            Fqn fqn,
                            TreeNode parent,
                            java.lang.Object key,
                            java.lang.Object value)
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Creates a child node.

Specified by:
createChild in interface TreeNode
See Also:
DataNode

removeAllChildren

public void removeAllChildren()
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Removes all children.

Specified by:
removeAllChildren in interface TreeNode
See Also:
DataNode

print

public void print(java.lang.StringBuffer sb,
                  int indent)
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Prints the node and children.

Specified by:
print in interface TreeNode
See Also:
DataNode

printDetails

public void printDetails(java.lang.StringBuffer sb,
                         int indent)
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Prints the node with details and indent.

Specified by:
printDetails in interface TreeNode
See Also:
DataNode

printIndent

public void printIndent(java.lang.StringBuffer sb,
                        int indent)
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Prints the node with indent.

Specified by:
printIndent in interface TreeNode
See Also:
DataNode

addChild

public void addChild(java.lang.Object child_name,
                     TreeNode n)
Deprecated. Will be removed in JBossCache 1.3.

Adds the (already created) child node. Replaces existing node if present.

Specified by:
addChild in interface TreeNode
See Also:
DataNode

printLockInfo

public void printLockInfo(java.lang.StringBuffer sb,
                          int indent)
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
printLockInfo in interface TreeNode
See Also:
DataNode

isLocked

public boolean isLocked()
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
isLocked in interface TreeNode
See Also:
DataNode

releaseAll

public void releaseAll(java.lang.Object owner)
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
releaseAll in interface TreeNode
See Also:
DataNode

releaseAllForce

public void releaseAllForce()
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
releaseAllForce in interface TreeNode
See Also:
DataNode

acquireAll

public java.util.Set acquireAll(java.lang.Object caller,
                                long timeout,
                                int lock_type)
                         throws LockingException,
                                TimeoutException,
                                java.lang.InterruptedException
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
acquireAll in interface TreeNode
Throws:
LockingException
TimeoutException
java.lang.InterruptedException
See Also:
DataNode

setRecursiveTreeCacheInstance

public void setRecursiveTreeCacheInstance(TreeCache cache)
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
setRecursiveTreeCacheInstance in interface TreeNode
See Also:
DataNode

getChildrenLoaded

public boolean getChildrenLoaded()
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
getChildrenLoaded in interface TreeNode
See Also:
DataNode

setChildrenLoaded

public void setChildrenLoaded(boolean b)
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
setChildrenLoaded in interface TreeNode
See Also:
DataNode

setChildren

public void setChildren(java.util.Map children)
Deprecated. Will be removed in JBossCache 1.3.

Sets Map

Specified by:
setChildren in interface TreeNode
See Also:
DataNode

release

public void release(java.lang.Object caller)
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
release in interface TreeNode
See Also:
DataNode

releaseForce

public void releaseForce()
Deprecated. Will be removed in JBossCache 1.3.

Description copied from interface: TreeNode
Not to be exposed. Internal calls should use impl classes.

Specified by:
releaseForce in interface TreeNode
See Also:
DataNode

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


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