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

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

public class UnversionedNode<K,V>
extends AbstractNode<K,V>
implements NodeSPI<K,V>

Basic data node class. Throws UnsupportedOperationException for version-specific methods like getVersion() and setVersion(org.jboss.cache.optimistic.DataVersion), defined in NodeSPI.

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

Field Summary
 
Fields inherited from class org.jboss.cache.AbstractNode
children, deleted, fqn
 
Constructor Summary
  UnversionedNode()
          Constructs a new node with an FQN of Root.
protected UnversionedNode(java.lang.Object child_name, Fqn fqn, java.util.Map<K,V> data, boolean mapSafe, CacheSPI<K,V> cache)
          Constructs a new node with a name, etc.
 
Method Summary
 Node<K,V> addChild(Fqn f)
          Adds a child node with the given Fqn under the current node.
 void addChild(java.lang.Object child_name, Node<K,V> n)
          Adds or replaces a child by name.
 NodeSPI<K,V> addChildDirect(Fqn f)
          Adds a child directly to a Node.
 void addChildDirect(NodeSPI<K,V> child)
          Directly adds the node passed in to the children map of the current node.
 void clearData()
          Removes all mappings from the node's data map.
 void clearDataDirect()
          Functionally the same as Node.clearData() except that it operates directly on the node and bypasses the interceptor chain.
 int dataSize()
           
 V get(K key)
          Returns the value to which this node maps the specified key.
 CacheSPI<K,V> getCache()
          Retrieves a reference to the cache in which this Node resides.
 Node<K,V> getChild(Fqn fqn)
          Returns the child node
 Node<K,V> getChild(java.lang.Object childName)
           
 NodeSPI<K,V> getChildDirect(Fqn fqn)
          Retrives a child directly by fully qualified name.
 NodeSPI<K,V> getChildDirect(java.lang.Object childName)
          Retrives a child directly by name.
 java.util.Set<Node<K,V>> getChildren()
          Returns an immutable set of children nodes.
 java.util.Set<NodeSPI<K,V>> getChildrenDirect()
          Functionally the same as Node.getChildren() except that it operates directly on the node and bypasses the interceptor chain.
 java.util.Set<NodeSPI<K,V>> getChildrenDirect(boolean includeMarkedForRemoval)
          Retrieves children (directly), optionally including any marked as deleted nodes.
 java.util.Map<java.lang.Object,Node<K,V>> getChildrenMapDirect()
          Returns a map to access the raw children.
 java.util.Set<java.lang.Object> getChildrenNames()
          Returns an immutable set of children node names.
 java.util.Set<java.lang.Object> getChildrenNamesDirect()
          Functionally the same as Node.getChildrenNames() except that it operates directly on the node and bypasses the interceptor chain.
 java.util.Map<K,V> getData()
          Returns a map containing the data in this Node.
 java.util.Map<K,V> getDataDirect()
          Functionally the same as Node.getData() except that it operates directly on the node and bypasses the interceptor chain.
 V getDirect(K key)
          Functionally the same as Node.get(Object) except that it operates directly on the node and bypasses the interceptor chain.
 Fqn getFqn()
          Returns the name of this node.
 java.util.Set<K> getKeys()
          Returns a Set containing the data in this Node.
 java.util.Set<K> getKeysDirect()
          Functionally the same as Node.getKeys() except that it operates directly on the node and bypasses the interceptor chain.
 IdentityLock getLock()
          Returns a lock for this node.
 NodeSPI getOrCreateChild(java.lang.Object child_name, GlobalTransaction gtx)
          Returns an existing child or creates a new one using a global transaction.
 NodeSPI<K,V> getParent()
          Returns a parent by checking the TreeMap by name.
 DataVersion getVersion()
          Returns the data version of this node if versioning is supported.
 boolean hasChild(Fqn f)
          Returns true if the child node denoted by the relative Fqn passed in exists.
 boolean hasChild(java.lang.Object o)
          Returns true if the child node denoted by the Object name passed in exists.
 boolean hasChildrenDirect()
           
 boolean isChildrenLoaded()
          Returns true if the children of this node were loaded from a cache loader.
 boolean isDataLoaded()
          Returns true if the data was loaded from the cache loader.
 boolean isValid()
          Tests if a node reference is still valid.
 void print(java.lang.StringBuffer sb, int indent)
          Prints basic information of this node to the StringBuffer passed in.
 void printDetails(java.lang.StringBuffer sb, int indent)
          Prints details of this node to the StringBuffer passed in.
 V put(K key, V value)
          Associates the specified value with the specified key for this node.
 void putAll(java.util.Map data)
          Copies all of the mappings from the specified map to this node's map.
 void putAllDirect(java.util.Map<K,V> data)
          Functionally the same as Node.putAll(Map) except that it operates directly on the node and bypasses the interceptor chain.
 V putDirect(K key, V value)
          Functionally the same as Node.put(Object,Object) except that it operates directly on the node and bypasses the interceptor chain.
 V putIfAbsent(K k, V v)
          If the specified key is not already associated with a value, associate it with the given value, and returns the Object (if any) that occupied the space, or null.
 V remove(K key)
          Removes the mapping for this key from this node if it is present.
 boolean removeChild(Fqn fqn)
          Removes a child node specified by the given relative Fqn.
 boolean removeChild(java.lang.Object childName)
          Removes a child node specified by the given name.
 boolean removeChildDirect(Fqn f)
          Removes a child directly from a node.
 boolean removeChildDirect(java.lang.Object childName)
          Removes a child directly from a node.
 void removeChildrenDirect()
          Directly removes all children for this node.
 V removeDirect(K key)
          Removes a data key directly from a node.
 V replace(K key, V value)
          Replace entry for key only if currently mapped to some value.
 boolean replace(K key, V oldValue, V newValue)
          Replace entry for key only if currently mapped to given value.
 void replaceAll(java.util.Map data)
          Similar to Node.putAll(java.util.Map) except that it removes any entries that exists in the data map first.
 void setChildrenLoaded(boolean flag)
          Sets if the children of this node were loaded from a cache loader.
 void setChildrenMapDirect(java.util.Map<java.lang.Object,Node<K,V>> children)
          Sets the node's children explictly.
 void setDataLoaded(boolean dataLoaded)
          Sets if the data was loaded from the cache loader.
 void setFqn(Fqn fqn)
          Sets the FQN of this node and resets the names of all children as well.
 void setVersion(DataVersion version)
          Sets the data version of this node if versioning is supported.
 java.lang.String toString()
          Returns a debug string.
 
Methods inherited from class org.jboss.cache.AbstractNode
equals, hashCode, isDeleted, markAsDeleted, markAsDeleted
 
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
 

Constructor Detail

UnversionedNode

public UnversionedNode()
Constructs a new node with an FQN of Root.


UnversionedNode

protected UnversionedNode(java.lang.Object child_name,
                          Fqn fqn,
                          java.util.Map<K,V> data,
                          boolean mapSafe,
                          CacheSPI<K,V> cache)
Constructs a new node with a name, etc.

Parameters:
mapSafe - true if param data can safely be directly assigned to this object's data field; false if param data's contents should be copied into this object's data field.
Method Detail

getParent

public NodeSPI<K,V> getParent()
Returns a parent by checking the TreeMap by name.

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

getCache

public CacheSPI<K,V> getCache()
Description copied from interface: NodeSPI
Retrieves a reference to the cache in which this Node resides.

Specified by:
getCache in interface NodeSPI<K,V>
Returns:
a cache

isChildrenLoaded

public boolean isChildrenLoaded()
Description copied from interface: NodeSPI
Returns true if the children of this node were loaded from a cache loader.

Specified by:
isChildrenLoaded in interface NodeSPI<K,V>
Returns:
true if the children of this node were loaded from a cache loader.

setChildrenLoaded

public void setChildrenLoaded(boolean flag)
Description copied from interface: NodeSPI
Sets if the children of this node were loaded from a cache loader.

Specified by:
setChildrenLoaded in interface NodeSPI<K,V>
Parameters:
flag - true if loaded, false otherwise

get

public V get(K key)
Description copied from interface: Node
Returns the value to which this node maps the specified key. Returns null if the node contains no mapping for this key.

Specified by:
get in interface Node<K,V>
Parameters:
key - key of the data to return
Returns:
the value to which this node maps the specified key, or null if the map contains no mapping for this key

getDirect

public V getDirect(K key)
Description copied from interface: NodeSPI
Functionally the same as Node.get(Object) except that it operates directly on the node and bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method, otherwise a LockingException will be thrown.

Specified by:
getDirect in interface NodeSPI<K,V>
Parameters:
key - data to get
Returns:
value under key
See Also:
Node.get(Object)

getLock

public IdentityLock getLock()
Description copied from interface: NodeSPI
Returns a lock for this node.

Specified by:
getLock in interface NodeSPI<K,V>
Returns:
node lock

getData

public java.util.Map<K,V> getData()
Description copied from interface: Node
Returns a map containing the data in this Node.

Specified by:
getData in interface Node<K,V>
Returns:
a Map containing the data in this Node. If there is no data, an empty Map is returned. The Map returned is always immutable.

getDataDirect

public java.util.Map<K,V> getDataDirect()
Description copied from interface: NodeSPI
Functionally the same as Node.getData() except that it operates directly on the node and bypasses the interceptor chain.

Note that this returns a reference to access the node's data. This data should only be modified by the cache itself. This method should never return null.

Also note that this method returns an unmodifiable reference to the underlying data map.

The caller needs to ensure a proper lock has been obtained prior to calling this method, otherwise a LockingException will be thrown.

Specified by:
getDataDirect in interface NodeSPI<K,V>
Returns:
map containing data
See Also:
Node.getData()

put

public V put(K key,
             V value)
Description copied from interface: Node
Associates the specified value with the specified key for this node. If this node previously contained a mapping for this key, the old value is replaced by the specified value.

Specified by:
put in interface Node<K,V>
Parameters:
key - key with which the specified value is to be associated.
value - value to be associated with the specified key.
Returns:
Returns the old value contained under this key. Null if key doesn't exist.

putDirect

public V putDirect(K key,
                   V value)
Description copied from interface: NodeSPI
Functionally the same as Node.put(Object,Object) except that it operates directly on the node and bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method, otherwise a LockingException will be thrown.

Specified by:
putDirect in interface NodeSPI<K,V>
Parameters:
key - of data
value - of data
Returns:
the previous value under the key passed in, or null
See Also:
Node.put(Object,Object)

getOrCreateChild

public NodeSPI getOrCreateChild(java.lang.Object child_name,
                                GlobalTransaction gtx)
Description copied from interface: NodeSPI
Returns an existing child or creates a new one using a global transaction.

Specified by:
getOrCreateChild in interface NodeSPI<K,V>
Parameters:
child_name - name of child to create
gtx - transaction under which to create child
Returns:
newly created node

remove

public V remove(K key)
Description copied from interface: Node
Removes the mapping for this key from this node if it is present. Returns the value to which the node previously associated the key, or null if the node contained no mapping for this key

Specified by:
remove in interface Node<K,V>
Parameters:
key - key whose mapping is to be removed
Returns:
previous value associated with specified key, or null if there was no mapping for key

removeDirect

public V removeDirect(K key)
Description copied from interface: NodeSPI
Removes a data key directly from a node. Functionally the same as Node.remove(Object) except that it bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method.

Specified by:
removeDirect in interface NodeSPI<K,V>
Parameters:
key - to remove
Returns:
the old data contained under the key
See Also:
Node.remove(Object)

printDetails

public void printDetails(java.lang.StringBuffer sb,
                         int indent)
Description copied from interface: NodeSPI
Prints details of this node to the StringBuffer passed in.

Specified by:
printDetails in interface NodeSPI<K,V>
Parameters:
sb - StringBuffer to print to
indent - depth of this node in the tree. Used to indent details by prepending spaces.

toString

public java.lang.String toString()
Returns a debug string.

Overrides:
toString in class java.lang.Object

addChild

public Node<K,V> addChild(Fqn f)
Description copied from interface: Node
Adds a child node with the given Fqn under the current node. Returns the newly created node.

If the child exists returns the child node anyway. Guaranteed to return a non-null node.

The Fqn passed in is relative to the current node. The new child node will have an absolute fqn calculated as follows:

new Fqn(getFqn(), f)
. See Fqn for the operation of this constructor.

Specified by:
addChild in interface Node<K,V>
Parameters:
f - Fqn of the child node, relative to the current node.
Returns:
the newly created node, or the existing node if one already exists.

addChildDirect

public void addChildDirect(NodeSPI<K,V> child)
Description copied from interface: NodeSPI
Directly adds the node passed in to the children map of the current node. Will throw a CacheException if child.getFqn().getParent().equals(getFqn()) returns false.

Specified by:
addChildDirect in interface NodeSPI<K,V>
Parameters:
child - child to add

addChildDirect

public NodeSPI<K,V> addChildDirect(Fqn f)
Description copied from interface: NodeSPI
Adds a child directly to a Node. Functionally the same as Node.addChild(Fqn) except that it bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method.

Specified by:
addChildDirect in interface NodeSPI<K,V>
Parameters:
f - name of child
Returns:
child node
See Also:
Node.addChild(Fqn)

clearData

public void clearData()
Description copied from interface: Node
Removes all mappings from the node's data map.

Specified by:
clearData in interface Node<K,V>

clearDataDirect

public void clearDataDirect()
Description copied from interface: NodeSPI
Functionally the same as Node.clearData() except that it operates directly on the node and bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method, otherwise a LockingException will be thrown.

Specified by:
clearDataDirect in interface NodeSPI<K,V>
See Also:
Node.clearData()

getChild

public Node<K,V> getChild(Fqn fqn)
Description copied from interface: Node
Returns the child node

Specified by:
getChild in interface Node<K,V>
Parameters:
fqn - Fqn of the child node
Returns:
null if the child does not exist.

getChildDirect

public NodeSPI<K,V> getChildDirect(Fqn fqn)
Description copied from interface: NodeSPI
Retrives a child directly by fully qualified name. Functionally the same as Node.getChild(Fqn) except that it bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method.

Specified by:
getChildDirect in interface NodeSPI<K,V>
Parameters:
fqn - name of child
Returns:
child node
See Also:
Node.getChild(Fqn)

getChildrenNames

public java.util.Set<java.lang.Object> getChildrenNames()
Description copied from interface: Node
Returns an immutable set of children node names.

Specified by:
getChildrenNames in interface Node<K,V>
Returns:
an immutable Set of child node names. Empty Set if there aren't any children.

getChildrenNamesDirect

public java.util.Set<java.lang.Object> getChildrenNamesDirect()
Description copied from interface: NodeSPI
Functionally the same as Node.getChildrenNames() except that it operates directly on the node and bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method, otherwise a LockingException will be thrown.

Specified by:
getChildrenNamesDirect in interface NodeSPI<K,V>
Returns:
set of children names
See Also:
Node.getChildrenNames()

getKeys

public java.util.Set<K> getKeys()
Description copied from interface: Node
Returns a Set containing the data in this Node.

Specified by:
getKeys in interface Node<K,V>
Returns:
a Set containing the data in this Node. If there is no data, an empty Set is returned. The Set returned is always immutable.

getKeysDirect

public java.util.Set<K> getKeysDirect()
Description copied from interface: NodeSPI
Functionally the same as Node.getKeys() except that it operates directly on the node and bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method, otherwise a LockingException will be thrown.

Specified by:
getKeysDirect in interface NodeSPI<K,V>
Returns:
set of keys
See Also:
Node.getKeys()

hasChild

public boolean hasChild(Fqn f)
Description copied from interface: Node
Returns true if the child node denoted by the relative Fqn passed in exists.

Specified by:
hasChild in interface Node<K,V>
Parameters:
f - Fqn relative to the current node of the child you are testing the existence of.
Returns:
true if the child node denoted by the relative Fqn passed in exists.

hasChild

public boolean hasChild(java.lang.Object o)
Description copied from interface: Node
Returns true if the child node denoted by the Object name passed in exists.

Specified by:
hasChild in interface Node<K,V>
Parameters:
o - name of the child, relative to the current node
Returns:
true if the child node denoted by the name passed in exists.

putIfAbsent

public V putIfAbsent(K k,
                     V v)
Description copied from interface: Node
If the specified key is not already associated with a value, associate it with the given value, and returns the Object (if any) that occupied the space, or null.

Equivalent to calling

   if (!node.getKeys().contains(key))
     return node.put(key, value);
   else
     return node.get(key);
 

except that this is atomic.

Specified by:
putIfAbsent in interface Node<K,V>
Parameters:
k - key with which the specified value is to be associated.
v - value to be associated with the specified key.
Returns:
previous value associated with specified key, or null if there was no mapping for key.

replace

public V replace(K key,
                 V value)
Description copied from interface: Node
Replace entry for key only if currently mapped to some value. Acts as
 if ((node.getKeys().contains(key))
 {
     return node.put(key, value);
 }
 else
     return null;
 

except that this is atomic.

Specified by:
replace in interface Node<K,V>
Parameters:
key - key with which the specified value is associated.
value - value to be associated with the specified key.
Returns:
previous value associated with specified key, or null if there was no mapping for key.

replace

public boolean replace(K key,
                       V oldValue,
                       V newValue)
Description copied from interface: Node
Replace entry for key only if currently mapped to given value. Acts as
 if (node.get(key).equals(oldValue))
 {
     node.putAll(key, newValue);
     return true;
 }
 else
     return false;
 

except that this is atomic.

Specified by:
replace in interface Node<K,V>
Parameters:
key - key with which the specified value is associated.
oldValue - value expected to be associated with the specified key.
newValue - value to be associated with the specified key.
Returns:
true if the value was replaced

removeChild

public boolean removeChild(Fqn fqn)
Description copied from interface: Node
Removes a child node specified by the given relative Fqn.

If you wish to remove children based on absolute Fqns, use the Cache interface instead.

Specified by:
removeChild in interface Node<K,V>
Parameters:
fqn - Fqn of the child node, relative to the current node.
Returns:
true if the node was found and removed, false otherwise

dataSize

public int dataSize()
Specified by:
dataSize in interface Node<K,V>
Returns:
the number of elements (key/value pairs) in the node's data map.

removeChild

public boolean removeChild(java.lang.Object childName)
Description copied from interface: Node
Removes a child node specified by the given name.

Specified by:
removeChild in interface Node<K,V>
Parameters:
childName - name of the child node, directly under the current node.
Returns:
true if the node was found and removed, false otherwise

removeChildDirect

public boolean removeChildDirect(java.lang.Object childName)
Description copied from interface: NodeSPI
Removes a child directly from a node. Functionally the same as Node.removeChild(Object) except that bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method.

Specified by:
removeChildDirect in interface NodeSPI<K,V>
Parameters:
childName - of child.
Returns:
true if the node was found, false otherwise
See Also:
Node.removeChild(Object)

removeChildDirect

public boolean removeChildDirect(Fqn f)
Description copied from interface: NodeSPI
Removes a child directly from a node. Functionally the same as Node.removeChild(Fqn) except that it bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method, otherwise a

Specified by:
removeChildDirect in interface NodeSPI<K,V>
Parameters:
f - of child.
Returns:
true if the node was found, false otherwise
See Also:
Node.removeChild(Fqn)

getChildrenMapDirect

public java.util.Map<java.lang.Object,Node<K,V>> getChildrenMapDirect()
Description copied from interface: NodeSPI
Returns a map to access the raw children. This method may return a null if the node does not have any children. It is important to note that this method returns a direct reference to the underlying child map and is intended for internal use only. Incorrect use may result in very inconsistent state of the cache.

Specified by:
getChildrenMapDirect in interface NodeSPI<K,V>
Returns:
Map, keyed by child name, values Nodes.

setChildrenMapDirect

public void setChildrenMapDirect(java.util.Map<java.lang.Object,Node<K,V>> children)
Description copied from interface: NodeSPI
Sets the node's children explictly. This method will remove all children currently associated with this node and add all the children passed in.

Specified by:
setChildrenMapDirect in interface NodeSPI<K,V>
Parameters:
children - cannot be null

putAll

public void putAll(java.util.Map data)
Description copied from interface: Node
Copies all of the mappings from the specified map to this node's map. If any data exists, existing keys are overwritten with the keys in the new map. The behavior is equivalent to:
 Node node;
 for (Map.Entry me : map.entrySet())
   node.put(me.getKey(), me.getValue());
 

Specified by:
putAll in interface Node<K,V>
Parameters:
data - map to copy from

replaceAll

public void replaceAll(java.util.Map data)
Description copied from interface: Node
Similar to Node.putAll(java.util.Map) except that it removes any entries that exists in the data map first. Note that this happens atomically, under a single lock. This is the analogous to doing a Node.clearData() followed by a Node.putAll(java.util.Map) in the same transaction.

Specified by:
replaceAll in interface Node<K,V>
Parameters:
data - map to copy from

putAllDirect

public void putAllDirect(java.util.Map<K,V> data)
Description copied from interface: NodeSPI
Functionally the same as Node.putAll(Map) except that it operates directly on the node and bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method, otherwise a LockingException will be thrown.

Specified by:
putAllDirect in interface NodeSPI<K,V>
Parameters:
data - to put
See Also:
Node.putAll(Map)

removeChildrenDirect

public void removeChildrenDirect()
Description copied from interface: NodeSPI
Directly removes all children for this node. The only direct method that does not have a non-direct counterpart.

Specified by:
removeChildrenDirect in interface NodeSPI<K,V>

print

public void print(java.lang.StringBuffer sb,
                  int indent)
Description copied from interface: NodeSPI
Prints basic information of this node to the StringBuffer passed in.

Specified by:
print in interface NodeSPI<K,V>
Parameters:
sb - StringBuffer to print to
indent - depth of this node in the tree. Used to indent details by prepending spaces.

setVersion

public void setVersion(DataVersion version)
Description copied from interface: NodeSPI
Sets the data version of this node if versioning is supported.

Specified by:
setVersion in interface NodeSPI<K,V>
Parameters:
version - data version to apply

getVersion

public DataVersion getVersion()
Description copied from interface: NodeSPI
Returns the data version of this node if versioning is supported.

Specified by:
getVersion in interface NodeSPI<K,V>
Returns:
data version

addChild

public void addChild(java.lang.Object child_name,
                     Node<K,V> n)
Description copied from interface: NodeSPI
Adds or replaces a child by name.

Specified by:
addChild in interface NodeSPI<K,V>
Parameters:
child_name - child node name (not an FQN)
n - child node

getFqn

public Fqn getFqn()
Returns the name of this node.

Specified by:
getFqn in interface Node<K,V>
Returns:
The Fqn which represents the location of this Node in the cache structure. The Fqn returned is absolute.

setFqn

public void setFqn(Fqn fqn)
Description copied from interface: NodeSPI
Sets the FQN of this node and resets the names of all children as well.

Specified by:
setFqn in interface NodeSPI<K,V>
Parameters:
fqn - fqn to set

getChild

public Node<K,V> getChild(java.lang.Object childName)
Specified by:
getChild in interface Node<K,V>
Parameters:
childName - name of the child
Returns:
a direct child of the current node.

getChildDirect

public NodeSPI<K,V> getChildDirect(java.lang.Object childName)
Description copied from interface: NodeSPI
Retrives a child directly by name. Functionally the same as Node.getChild(Object) except that it bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method.

Specified by:
getChildDirect in interface NodeSPI<K,V>
Parameters:
childName - name of child
Returns:
child node
See Also:
Node.getChild(Object)

getChildren

public java.util.Set<Node<K,V>> getChildren()
Description copied from interface: Node
Returns an immutable set of children nodes.

Specified by:
getChildren in interface Node<K,V>
Returns:
an immutable Set of child nodes. Empty Set if there aren't any children.

getChildrenDirect

public java.util.Set<NodeSPI<K,V>> getChildrenDirect()
Description copied from interface: NodeSPI
Functionally the same as Node.getChildren() except that it operates directly on the node and bypasses the interceptor chain.

The caller needs to ensure a proper lock has been obtained prior to calling this method, otherwise a LockingException will be thrown.

Specified by:
getChildrenDirect in interface NodeSPI<K,V>
Returns:
set of child nodes.
See Also:
Node.getChildren()

hasChildrenDirect

public boolean hasChildrenDirect()
Specified by:
hasChildrenDirect in interface NodeSPI<K,V>
Returns:
true if the node has one or more child nodes; false otherwise.

getChildrenDirect

public java.util.Set<NodeSPI<K,V>> getChildrenDirect(boolean includeMarkedForRemoval)
Description copied from interface: NodeSPI
Retrieves children (directly), optionally including any marked as deleted nodes.

The caller needs to ensure a proper lock has been obtained prior to calling this method.

Specified by:
getChildrenDirect in interface NodeSPI<K,V>
Parameters:
includeMarkedForRemoval - if true, the returned set will include nodes marked as deleted
Returns:
a set of nodes

isDataLoaded

public boolean isDataLoaded()
Returns true if the data was loaded from the cache loader.

Specified by:
isDataLoaded in interface NodeSPI<K,V>
Returns:
true if the data was loaded from the cache loader.

setDataLoaded

public void setDataLoaded(boolean dataLoaded)
Sets if the data was loaded from the cache loader.

Specified by:
setDataLoaded in interface NodeSPI<K,V>
Parameters:
dataLoaded - true if loaded, false otherwise

isValid

public boolean isValid()
Description copied from interface: Node
Tests if a node reference is still valid. A node reference may become invalid if it has been evicted, for example, in which case it should be looked up again from the cache.

Specified by:
isValid in interface Node<K,V>
Returns:
true if the node is valid.