|
||||||||||
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(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. |
NodeSPI<K,V> |
addChildDirect(Fqn f,
boolean notify)
Same as addChildDirect(Fqn) except that it optionally allows you to suppress notification events for
the creation of this node. |
void |
addChildDirect(NodeSPI<K,V> child)
Directly adds the node passed in to the children map of the current node. |
NodeSPI<K,V> |
addChildDirect(Object childName,
boolean notify)
Same as addChildDirect(Fqn, boolean) except that it just takes a child name |
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(Object childName)
Retrives a child directly by name. |
Set<NodeSPI<K,V>> |
getChildrenDirect()
Functionally the same as Node.getChildren() except that it operates directly on the node and bypasses the
interceptor chain. |
Set<NodeSPI<K,V>> |
getChildrenDirect(boolean includeMarkedAsDeleted)
Retrieves children (directly), optionally including any marked as deleted nodes. |
Map<Object,Node<K,V>> |
getChildrenMapDirect()
Returns a map to access the raw children. |
Set<Object> |
getChildrenNamesDirect()
Functionally the same as Node.getChildrenNames() except that it operates directly on the node and bypasses the
interceptor chain. |
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. |
Map |
getInternalState(boolean onlyInternalState)
Very similar to getDataDirect() , except that this method may also encode some internal data as attributes in the map,
using special _JBOSS_INTERNAL_XXX Strings as keys. |
Set<K> |
getKeysDirect()
Functionally the same as Node.getKeys() except that it operates directly on the node and bypasses the
interceptor chain. |
NodeLock |
getLock()
Deprecated. this will be removed in 3.0.0. Please use methods on the LockManager to lock and unlock nodes. |
NodeSPI<K,V> |
getOrCreateChild(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(StringBuilder sb,
int indent)
Deprecated. |
void |
printDetails(StringBuilder sb,
int indent)
Prints details of this node to the StringBuilder passed in. |
void |
putAllDirect(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(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(Map<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 |
setInternalState(Map state)
Very similar to putAllDirect(java.util.Map) except that this method first scans the map for any internal attributes
using special _JBOSS_INTERNAL_XXX Strings as keys, and uses these to set internal attributes before passing
the remaining attributes to putAllDirect(java.util.Map) . |
void |
setValid(boolean valid,
boolean recursive)
Sets the validity of a node. |
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, isLockForChildInsertRemove, isResident, isValid, put, putAll, putIfAbsent, releaseObjectReferences, remove, removeChild, removeChild, replace, replace, replaceAll, setLockForChildInsertRemove, setResident |
Method Detail |
---|
boolean isChildrenLoaded()
void setChildrenLoaded(boolean loaded)
loaded
- true if loaded, false otherwiseboolean isDataLoaded()
void setDataLoaded(boolean dataLoaded)
dataLoaded
- true if loaded, false otherwiseMap<Object,Node<K,V>> getChildrenMapDirect()
void setChildrenMapDirect(Map<Object,Node<K,V>> children)
children
- cannot be nullNodeSPI<K,V> getOrCreateChild(Object name, GlobalTransaction tx)
name
- name of child to createtx
- transaction under which to create child
@Deprecated NodeLock getLock()
LockManager
to lock and unlock nodes.
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(Object nodeName, Node<K,V> nodeToAdd)
nodeName
- child node name (not an FQN)nodeToAdd
- child nodevoid printDetails(StringBuilder sb, int indent)
sb
- StringBuilder to print toindent
- depth of this node in the tree. Used to indent details by prepending spaces.@Deprecated void print(StringBuilder sb, int indent)
sb
- StringBuilder 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
UnsupportedOperationException
- if versioning is not supportedDataVersion getVersion()
UnsupportedOperationException
- if versioning is not supportedSet<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()
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(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)
NodeSPI<K,V> addChildDirect(Fqn f, boolean notify)
addChildDirect(Fqn)
except that it optionally allows you to suppress notification events for
the creation of this node.
f
- name of childnotify
- if true, notification events are sent; if false, they are not
LockingException
- if locking was not obtainedNode.addChild(Fqn)
NodeSPI<K,V> addChildDirect(Object childName, boolean notify)
addChildDirect(Fqn, boolean)
except that it just takes a child name
childName
- name of childnotify
- if true, notification events are sent; if false, they are not
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(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(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)
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.
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()
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()
Set<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()
Map getInternalState(boolean onlyInternalState)
getDataDirect()
, except that this method may also encode some internal data as attributes in the map,
using special _JBOSS_INTERNAL_XXX Strings as keys. Designed to be used by StateTransferGenerator
and CacheStoreInterceptor
which attempt to serialize nodes into a stream for storage or transfer.
onlyInternalState
- if true, the map will only contain internal state and no other data.
void setInternalState(Map state)
putAllDirect(java.util.Map)
except that this method first scans the map for any internal attributes
using special _JBOSS_INTERNAL_XXX Strings as keys, and uses these to set internal attributes before passing
the remaining attributes to putAllDirect(java.util.Map)
. Designed to be used by StateTransferIntegrator
and CacheLoaderInterceptor
classes which attempt to create nodes based on a data stream.
state
- state to be appliedvoid setValid(boolean valid, boolean recursive)
Node.isValid()
.
valid
- if true, the node is marked as valid; if false, the node is invalid.recursive
- if true, the validity flag passed in is applied to all children as well.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |