|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@NotThreadSafe public interface NodeSPI<K,V>
A more detailed interface to Node
, which is used when writing plugins for or extending JBoss Cache. References are usually
obtained by calling methods on CacheSPI
.
Node
instance to this interface. In future, the implementation may not allow it.
This interface contains overridden method signatures of some methods from Node
, overridden to ensure return
types of Node
are replaced with NodeSPI
.
An important note on the xxxDirect() methods below. These methods are counterparts to similarly named
methods in Node
- e.g., getDirect(Object)
is a direct access counterpart to Node.get(Object)
,
the difference being that:
Node.get(Object)
- Passes the call up the interceptor stack, applies all aspects including node locking, cache loading, passivation, etc etc.getDirect(Object)
- directly works on the underlying data in the node.LockingException
s if appropriate locks haven't been obtained by the caller.
It is important to node that the direct read methods, such as getDataDirect(), return unmodifiable collections.
In addition to being unmodifiable, they are also defensively copied from the underlying data map to ensure view consistency.
Node
,
CacheSPI
Method Summary | |
---|---|
void |
addChild(java.lang.Object nodeName,
Node<K,V> nodeToAdd)
Adds or replaces a child by name. |
NodeSPI<K,V> |
addChildDirect(Fqn childName)
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 |
clearDataDirect()
Functionally the same as Node.clearData() except that it operates directly on the node and bypasses the
interceptor chain. |
CacheSPI<K,V> |
getCache()
Retrieves a reference to the cache in which this Node resides. |
NodeSPI<K,V> |
getChildDirect(Fqn childName)
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<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 includeMarkedAsDeleted)
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> |
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> |
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. |
java.util.Set<K> |
getKeysDirect()
Functionally the same as Node.getKeys() except that it operates directly on the node and bypasses the
interceptor chain. |
NodeLock |
getLock()
Returns a lock for this node. |
NodeSPI<K,V> |
getOrCreateChild(java.lang.Object name,
GlobalTransaction tx)
Returns an existing child or creates a new one using a global transaction. |
NodeSPI<K,V> |
getParent()
Returns the parent node as a NodeSPI , instead
of Node from Node.getParent() , and is otherwise identical. |
DataVersion |
getVersion()
Returns the data version of this node if versioning is supported. |
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 |
isDeleted()
Returns true if the instance has been deleted in the current transaction. |
void |
markAsDeleted(boolean marker)
Marks the node as being deleted (or not) in the current transaction. |
void |
markAsDeleted(boolean marker,
boolean recursive)
Same as markAsDeleted(boolean) except that the option to recurse into children is provided. |
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. |
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. |
boolean |
removeChildDirect(Fqn fqn)
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. |
void |
setChildrenLoaded(boolean loaded)
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<?> f)
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. |
Methods inherited from interface org.jboss.cache.Node |
---|
addChild, clearData, dataSize, get, getChild, getChild, getChildren, getChildrenNames, getData, getFqn, getKeys, hasChild, hasChild, isValid, put, putAll, putIfAbsent, remove, removeChild, removeChild, replace, replace, replaceAll |
Method Detail |
---|
boolean isChildrenLoaded()
void setChildrenLoaded(boolean loaded)
loaded
- true if loaded, false otherwiseboolean isDataLoaded()
void setDataLoaded(boolean dataLoaded)
dataLoaded
- true if loaded, false otherwisejava.util.Map<java.lang.Object,Node<K,V>> getChildrenMapDirect()
void setChildrenMapDirect(java.util.Map<java.lang.Object,Node<K,V>> children)
children
- cannot be nullNodeSPI<K,V> getOrCreateChild(java.lang.Object name, GlobalTransaction tx)
name
- name of child to createtx
- transaction under which to create child
NodeLock getLock()
void setFqn(Fqn<?> f)
f
- fqn to setboolean isDeleted()
void markAsDeleted(boolean marker)
marker
- true if the node has been deleted, false if not.void markAsDeleted(boolean marker, boolean recursive)
markAsDeleted(boolean)
except that the option to recurse into children is provided.
marker
- true if the node has been deleted, false if not.recursive
- if true, child nodes (and their children) are marked as well.void addChild(java.lang.Object nodeName, Node<K,V> nodeToAdd)
nodeName
- child node name (not an FQN)nodeToAdd
- child nodevoid printDetails(java.lang.StringBuffer sb, int indent)
sb
- StringBuffer to print toindent
- depth of this node in the tree. Used to indent details by prepending spaces.void print(java.lang.StringBuffer sb, int indent)
sb
- StringBuffer to print toindent
- depth of this node in the tree. Used to indent details by prepending spaces.void setVersion(DataVersion version)
version
- data version to apply
java.lang.UnsupportedOperationException
- if versioning is not supportedDataVersion getVersion()
java.lang.UnsupportedOperationException
- if versioning is not supportedjava.util.Set<NodeSPI<K,V>> getChildrenDirect()
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.
Node.getChildren()
void removeChildrenDirect()
java.util.Set<NodeSPI<K,V>> getChildrenDirect(boolean includeMarkedAsDeleted)
includeMarkedAsDeleted
- if true, the returned set will include nodes marked as deleted
LockingException
- if locking was not obtainedNodeSPI<K,V> getChildDirect(java.lang.Object childName)
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.
childName
- name of child
LockingException
- if locking was not obtainedNode.getChild(Object)
NodeSPI<K,V> addChildDirect(Fqn childName)
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.
childName
- name of child
LockingException
- if locking was not obtainedNode.addChild(Fqn)
void addChildDirect(NodeSPI<K,V> child)
child
- child to addNodeSPI<K,V> getChildDirect(Fqn childName)
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.
childName
- name of child
LockingException
- if locking was not obtainedNode.getChild(Fqn)
boolean removeChildDirect(Fqn fqn)
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
fqn
- of child.
LockingException
- if locking was not obtainedNode.removeChild(Fqn)
boolean removeChildDirect(java.lang.Object childName)
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.
childName
- of child.
LockingException
- if locking was not obtainedNode.removeChild(Object)
V removeDirect(K key)
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.
key
- to remove
LockingException
- if locking was not obtainedNode.remove(Object)
V putDirect(K key, V value)
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.
key
- of datavalue
- of data
Node.put(Object,Object)
void putAllDirect(java.util.Map<K,V> data)
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.
data
- to putNode.putAll(Map)
java.util.Map<K,V> getDataDirect()
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.
Node.getData()
V getDirect(K key)
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.
key
- data to get
Node.get(Object)
void clearDataDirect()
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.
Node.clearData()
java.util.Set<K> getKeysDirect()
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.
Node.getKeys()
java.util.Set<java.lang.Object> getChildrenNamesDirect()
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.
Node.getChildrenNames()
CacheSPI<K,V> getCache()
NodeSPI<K,V> getParent()
NodeSPI
, instead
of Node
from Node.getParent()
, and is otherwise identical.
getParent
in interface Node<K,V>
Node.getParent()
boolean hasChildrenDirect()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |