org.jboss.cache
Interface TreeNode

All Known Subinterfaces:
DataNode, WorkspaceNode
All Known Implementing Classes:
AbstractNode, Node, OptimisticTreeNode, WorkspaceNodeImpl

public interface TreeNode

Represents a node in the tree. Has a relative name and a Fqn. Maintains a hashmap of general data. If the node is created in a replicated cache, the relative and fully qualified name, and the keys and values of the hashmap must be serializable.

The current version supports different levels of transaction locking such as simple locking (IsolationLevel.SERIALIZABLE, or Read/Write lock with upgrade ( IsolationLevel.REPEATABLE_READ) --that is the read lock will be automatically upgraded to write lock when the same owner intends to modify the data after read.

Implementations may not necessarily be not synchronized, so access to instances of TreeNode need to be run under an isolation level above NONE.

Version:
$Revision: 1.26 $
Author:
Bela Ban March 25 2003, Ben Wang, Manik Surtani (manik@jboss.org)

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)
          Adds the already created child node.
 boolean childExists(java.lang.Object child_name)
          Returns true if the child exists.
 void clear()
          Clears the data of this node.
 boolean containsKey(java.lang.Object key)
          Returns true if the key is in the data set.
 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)
          Creates a child node.
 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()
          Returns an unmodifiable map, mapping keys to child nodes.
 boolean getChildrenLoaded()
          Deprecated. Will be removed in JBossCache 1.3.
 java.util.Map getData()
          Deprecated. Will be removed in JBossCache 1.3.
 java.util.Set getDataKeys()
          Returns the data keys, or an empty set if there are no keys.
 Fqn getFqn()
          Returns the fully qualified name of the node.
 IdentityLock getImmutableLock()
          Deprecated. Will be removed in JBossCache 1.3.
 IdentityLock getLock()
          Deprecated. Will be removed in JBossCache 1.3.
 java.lang.Object getName()
          Returns the name of this node.
 TreeNode getOrCreateChild(java.lang.Object child_name, GlobalTransaction gtx, boolean createIfNotExists)
          Creates a new child of this node if it doesn't exist.
 TreeNode getParent()
          Returns the parent of this node.
 boolean hasChildren()
          Returns true if this node has children.
 boolean isLocked()
          Deprecated. Will be removed in JBossCache 1.3.
 int numAttributes()
          Returns the number of attributes.
 void print(java.lang.StringBuffer sb, int indent)
          Prints the node and children.
 void printDetails(java.lang.StringBuffer sb, int indent)
          Prints the node with details and indent.
 void printIndent(java.lang.StringBuffer sb, int indent)
          Prints the node with indent.
 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()
          Removes all children.
 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.
 

Method Detail

createChild

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


getFqn

Fqn getFqn()
Returns the fully qualified name of the node.


getChild

TreeNode getChild(java.lang.Object childName)
Returns the named child of this node.


removeChild

void removeChild(java.lang.Object childName)
Removes the named child of this node.


getParent

TreeNode getParent()
Returns the parent of this node.


put

void put(java.util.Map data,
         boolean eraseData)
Puts the contents of a map into this node. Optionally erases the existing contents.

Parameters:
eraseData - true to erase the existing contents

put

java.lang.Object put(java.lang.Object key,
                     java.lang.Object value)
Puts the key and value into the node. Returns the old value of the key, if it existed.


remove

java.lang.Object remove(java.lang.Object key)
Removes the old value of the key.


get

java.lang.Object get(java.lang.Object key)
Returns the value of a key or null if it does not exist.


clear

void clear()
Clears the data of this node.


put

void put(java.util.Map data)
Adds (merges) the contents of the map with the existing data.


getName

java.lang.Object getName()
Returns the name of this node.


print

void print(java.lang.StringBuffer sb,
           int indent)
Prints the node and children.


printDetails

void printDetails(java.lang.StringBuffer sb,
                  int indent)
Prints the node with details and indent.


printIndent

void printIndent(java.lang.StringBuffer sb,
                 int indent)
Prints the node with indent.


containsKey

boolean containsKey(java.lang.Object key)
Returns true if the key is in the data set.


getChildren

java.util.Map getChildren()
Returns an unmodifiable map, mapping keys to child nodes. Implementations need to make sure the map cannot be changed.

Returns:
Map

getDataKeys

java.util.Set getDataKeys()
Returns the data keys, or an empty set if there are no keys.


childExists

boolean childExists(java.lang.Object child_name)
Returns true if the child exists.


numAttributes

int numAttributes()
Returns the number of attributes.


hasChildren

boolean hasChildren()
Returns true if this node has children.


createChild

TreeNode createChild(java.lang.Object child_name,
                     Fqn fqn,
                     TreeNode parent,
                     java.lang.Object key,
                     java.lang.Object value)
Creates a child node.


removeAllChildren

void removeAllChildren()
Removes all children.


addChild

void addChild(java.lang.Object child_name,
              TreeNode n)
Adds the already created child node. Replaces the existing child node if present.


getData

java.util.Map getData()
Deprecated. Will be removed in JBossCache 1.3.

Returns a copy of the attributes. Use get(Object key) instead.

See Also:
DataNode

getImmutableLock

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

Not to be exposed. Internal calls should use impl classes.

See Also:
DataNode

getLock

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

Not to be exposed. Internal calls should use impl classes.

See Also:
DataNode

getOrCreateChild

TreeNode getOrCreateChild(java.lang.Object child_name,
                          GlobalTransaction gtx,
                          boolean createIfNotExists)
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() Not to be exposed. Internal calls should use impl classes.

See Also:
DataNode

printLockInfo

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

Not to be exposed. Internal calls should use impl classes.

See Also:
DataNode

isLocked

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

Not to be exposed. Internal calls should use impl classes.

See Also:
DataNode

releaseAll

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

Not to be exposed. Internal calls should use impl classes.

See Also:
DataNode

releaseAllForce

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

Not to be exposed. Internal calls should use impl classes.

See Also:
DataNode

acquireAll

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.

Not to be exposed. Internal calls should use impl classes.

Throws:
LockingException
TimeoutException
java.lang.InterruptedException
See Also:
DataNode

setRecursiveTreeCacheInstance

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

Not to be exposed. Internal calls should use impl classes.

See Also:
DataNode

getChildrenLoaded

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

Not to be exposed. Internal calls should use impl classes.

See Also:
DataNode

setChildrenLoaded

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

Not to be exposed. Internal calls should use impl classes.

See Also:
DataNode

setChildren

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

Not to be exposed. Internal calls should use impl classes. Sets Map

See Also:
DataNode

release

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

Not to be exposed. Internal calls should use impl classes.

See Also:
DataNode

releaseForce

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

Not to be exposed. Internal calls should use impl classes.

See Also:
DataNode


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