|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.cache.AbstractNode<K,V>
org.jboss.cache.UnversionedNode<K,V>
public class UnversionedNode<K,V>
Basic data node class. Throws UnsupportedOperationException for version-specific methods like getVersion() and
setVersion(org.jboss.cache.optimistic.DataVersion), defined in NodeSPI.
| 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. |
boolean |
getChildrenLoaded()
Returns true if the children of this node were loaded from a cache loader. |
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. |
boolean |
getDataLoaded()
Returns true if the data was loaded from the cache loader. |
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 |
hasChildrenDirect()
|
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 |
|---|
public UnversionedNode()
protected UnversionedNode(java.lang.Object child_name,
Fqn fqn,
java.util.Map<K,V> data,
boolean mapSafe,
CacheSPI<K,V> cache)
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 |
|---|
public NodeSPI<K,V> getParent()
getParent in interface Node<K,V>getParent in interface NodeSPI<K,V>Node.getParent()public CacheSPI<K,V> getCache()
NodeSPI
getCache in interface NodeSPI<K,V>public boolean getChildrenLoaded()
NodeSPI
getChildrenLoaded in interface NodeSPI<K,V>public void setChildrenLoaded(boolean flag)
NodeSPI
setChildrenLoaded in interface NodeSPI<K,V>flag - true if loaded, false otherwisepublic V get(K key)
Nodenull if the node contains no mapping for this key.
get in interface Node<K,V>key - key of the data to return
null if the map contains no mapping for this keypublic V getDirect(K key)
NodeSPINode.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.
getDirect in interface NodeSPI<K,V>key - data to get
Node.get(Object)public IdentityLock getLock()
NodeSPI
getLock in interface NodeSPI<K,V>public java.util.Map<K,V> getData()
NodeNode.
getData in interface Node<K,V>Map containing the data in this Node. If there is no data, an empty Map is returned. The Map returned is always immutable.public java.util.Map<K,V> getDataDirect()
NodeSPINode.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.
The caller needs to ensure a proper lock has been obtained prior to calling this method, otherwise a
LockingException will be thrown.
getDataDirect in interface NodeSPI<K,V>Node.getData()
public V put(K key,
V value)
Node
put in interface Node<K,V>key - key with which the specified value is to be associated.value - value to be associated with the specified key.
public V putDirect(K key,
V value)
NodeSPINode.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.
putDirect in interface NodeSPI<K,V>key - of datavalue - of data
Node.put(Object,Object)
public NodeSPI getOrCreateChild(java.lang.Object child_name,
GlobalTransaction gtx)
NodeSPI
getOrCreateChild in interface NodeSPI<K,V>child_name - name of child to creategtx - transaction under which to create child
public V remove(K key)
Nodenull if the node contained no mapping for this key
remove in interface Node<K,V>key - key whose mapping is to be removed
null
if there was no mapping for keypublic V removeDirect(K key)
NodeSPINode.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.
removeDirect in interface NodeSPI<K,V>key - to remove
Node.remove(Object)
public void printDetails(java.lang.StringBuffer sb,
int indent)
NodeSPI
printDetails in interface NodeSPI<K,V>sb - StringBuffer to print toindent - depth of this node in the tree. Used to indent details by prepending spaces.public java.lang.String toString()
toString in class java.lang.Objectpublic Node<K,V> addChild(Fqn f)
NodeFqn 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.
addChild in interface Node<K,V>f - Fqn of the child node, relative to the current node.
public void addChildDirect(NodeSPI<K,V> child)
NodeSPI
addChildDirect in interface NodeSPI<K,V>child - child to addpublic NodeSPI<K,V> addChildDirect(Fqn f)
NodeSPINode.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.
addChildDirect in interface NodeSPI<K,V>f - name of child
Node.addChild(Fqn)public void clearData()
Node
clearData in interface Node<K,V>public void clearDataDirect()
NodeSPINode.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.
clearDataDirect in interface NodeSPI<K,V>Node.clearData()public Node<K,V> getChild(Fqn fqn)
Node
getChild in interface Node<K,V>fqn - Fqn of the child node
public NodeSPI<K,V> getChildDirect(Fqn fqn)
NodeSPINode.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.
getChildDirect in interface NodeSPI<K,V>fqn - name of child
Node.getChild(Fqn)public java.util.Set<java.lang.Object> getChildrenNames()
Node
getChildrenNames in interface Node<K,V>Set of child node names. Empty Set if there aren't any children.public java.util.Set<java.lang.Object> getChildrenNamesDirect()
NodeSPINode.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.
getChildrenNamesDirect in interface NodeSPI<K,V>Node.getChildrenNames()public java.util.Set<K> getKeys()
NodeSet containing the data in this Node.
getKeys in interface Node<K,V>Set containing the data in this Node. If there is no data, an empty Set is returned. The Set returned is always immutable.public java.util.Set<K> getKeysDirect()
NodeSPINode.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.
getKeysDirect in interface NodeSPI<K,V>Node.getKeys()public boolean hasChild(Fqn f)
NodeFqn passed in exists.
hasChild in interface Node<K,V>f - Fqn relative to the current node of the child you are testing the existence of.
Fqn passed in exists.
public V putIfAbsent(K k,
V v)
Node
if (!node.getKeys().contains(key))
return node.put(key, value);
else
return node.get(key);
except that this is atomic.
putIfAbsent in interface Node<K,V>k - key with which the specified value is to be associated.v - value to be associated with the specified key.
public V replace(K key,
V value)
Node
if ((node.getKeys().contains(key))
{
return node.put(key, value);
}
else
return null;
except that this is atomic.
replace in interface Node<K,V>key - key with which the specified value is associated.value - value to be associated with the specified key.
public boolean replace(K key,
V oldValue,
V newValue)
Node
if (node.get(key).equals(oldValue))
{
node.putAll(key, newValue);
return true;
}
else
return false;
except that this is atomic.
replace in interface Node<K,V>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.
public boolean removeChild(Fqn fqn)
NodeFqn.
If you wish to remove children based on absolute Fqns, use the Cache interface instead.
removeChild in interface Node<K,V>fqn - Fqn of the child node, relative to the current node.
public int dataSize()
dataSize in interface Node<K,V>public boolean removeChild(java.lang.Object childName)
Node
removeChild in interface Node<K,V>childName - name of the child node, directly under the current node.
public boolean removeChildDirect(java.lang.Object childName)
NodeSPINode.removeChild(Object) except that bypasses the
interceptor chain.
The caller needs to ensure a proper lock has been obtained prior to calling this method.
removeChildDirect in interface NodeSPI<K,V>childName - of child.
Node.removeChild(Object)public boolean removeChildDirect(Fqn f)
NodeSPINode.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
removeChildDirect in interface NodeSPI<K,V>f - of child.
Node.removeChild(Fqn)public java.util.Map<java.lang.Object,Node<K,V>> getChildrenMapDirect()
NodeSPI
getChildrenMapDirect in interface NodeSPI<K,V>public void setChildrenMapDirect(java.util.Map<java.lang.Object,Node<K,V>> children)
NodeSPI
setChildrenMapDirect in interface NodeSPI<K,V>children - cannot be nullpublic void putAll(java.util.Map data)
NodeNode node; for (Map.Entry me : map.entrySet()) node.put(me.getKey(), me.getValue());
putAll in interface Node<K,V>data - map to copy frompublic void replaceAll(java.util.Map data)
NodeNode.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.
replaceAll in interface Node<K,V>data - map to copy frompublic void putAllDirect(java.util.Map<K,V> data)
NodeSPINode.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.
putAllDirect in interface NodeSPI<K,V>data - to putNode.putAll(Map)public void removeChildrenDirect()
NodeSPI
removeChildrenDirect in interface NodeSPI<K,V>
public void print(java.lang.StringBuffer sb,
int indent)
NodeSPI
print in interface NodeSPI<K,V>sb - StringBuffer to print toindent - depth of this node in the tree. Used to indent details by prepending spaces.public void setVersion(DataVersion version)
NodeSPI
setVersion in interface NodeSPI<K,V>version - data version to applypublic DataVersion getVersion()
NodeSPI
getVersion in interface NodeSPI<K,V>
public void addChild(java.lang.Object child_name,
Node<K,V> n)
NodeSPI
addChild in interface NodeSPI<K,V>child_name - child node name (not an FQN)n - child nodepublic Fqn getFqn()
getFqn in interface Node<K,V>Fqn which represents the location of this Node in the cache structure. The Fqn returned is absolute.public void setFqn(Fqn fqn)
NodeSPI
setFqn in interface NodeSPI<K,V>fqn - fqn to setpublic Node<K,V> getChild(java.lang.Object childName)
getChild in interface Node<K,V>childName - name of the child
public NodeSPI<K,V> getChildDirect(java.lang.Object childName)
NodeSPINode.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.
getChildDirect in interface NodeSPI<K,V>childName - name of child
Node.getChild(Object)public java.util.Set<Node<K,V>> getChildren()
Node
getChildren in interface Node<K,V>Set of child nodes. Empty Set if there aren't any children.public java.util.Set<NodeSPI<K,V>> getChildrenDirect()
NodeSPINode.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.
getChildrenDirect in interface NodeSPI<K,V>Node.getChildren()public boolean hasChildrenDirect()
hasChildrenDirect in interface NodeSPI<K,V>public java.util.Set<NodeSPI<K,V>> getChildrenDirect(boolean includeMarkedForRemoval)
NodeSPI
getChildrenDirect in interface NodeSPI<K,V>includeMarkedForRemoval - if true, the returned set will include nodes marked as deleted
public boolean getDataLoaded()
getDataLoaded in interface NodeSPI<K,V>public void setDataLoaded(boolean dataLoaded)
setDataLoaded in interface NodeSPI<K,V>dataLoaded - true if loaded, false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||