public class TreeCacheImpl<K,V> extends TreeStructureSupport implements TreeCache<K,V>
cache
batchContainer
Constructor and Description |
---|
TreeCacheImpl(AdvancedCache<?,?> cache) |
TreeCacheImpl(Cache<?,?> cache) |
Modifier and Type | Method and Description |
---|---|
void |
clearData(AdvancedCache<NodeKey,AtomicMap<?,?>> cache,
Fqn fqn) |
void |
clearData(Fqn fqn)
Removes the keys and properties from a named node.
|
void |
clearData(Fqn fqn,
Flag... flags) |
void |
clearData(String fqn)
Convenience method that takes in a String represenation of the Fqn.
|
void |
clearData(String fqn,
Flag... flags) |
boolean |
exists(Fqn fqn,
Flag... flags) |
boolean |
exists(String f)
Tests if an Fqn exists.
|
boolean |
exists(String fqn,
Flag... flags) |
V |
get(Fqn fqn,
K key)
Convenience method that allows for direct access to the data in a
Node . |
V |
get(Fqn fqn,
K key,
Flag... flags) |
V |
get(String fqn,
K key)
Convenience method that takes a string representation of an Fqn.
|
V |
get(String fqn,
K key,
Flag... flags) |
Cache<?,?> |
getCache() |
Map<K,V> |
getData(Fqn fqn)
Retrieves a defensively copied data map of the underlying node.
|
Map<K,V> |
getData(Fqn fqn,
Flag... flags) |
Set<K> |
getKeys(Fqn fqn)
Returns a set of attribute keys for the Fqn.
|
Set<K> |
getKeys(Fqn fqn,
Flag... flags) |
Set<K> |
getKeys(String fqn)
Convenience method that takes in a String represenation of the Fqn.
|
Set<K> |
getKeys(String fqn,
Flag... flags) |
Node<K,V> |
getNode(Fqn fqn)
A convenience method to retrieve a node directly from the cache.
|
Node<K,V> |
getNode(Fqn fqn,
Flag... flags) |
Node<K,V> |
getNode(String fqn)
Convenience method that takes a string representation of an Fqn.
|
Node<K,V> |
getNode(String fqn,
Flag... flags) |
Node<K,V> |
getRoot()
Returns the root node of this cache.
|
Node<K,V> |
getRoot(Flag... flags) |
void |
move(Fqn nodeToMoveFqn,
Fqn newParentFqn)
Moves a part of the cache to a different subtree.
|
void |
move(Fqn nodeToMoveFqn,
Fqn newParentFqn,
Flag... flags) |
void |
move(String nodeToMove,
String newParent)
Convenience method that takes in string representations of Fqns.
|
void |
move(String nodeToMove,
String newParent,
Flag... flags) |
V |
put(Fqn fqn,
K key,
V value)
Associates the specified value with the specified key for a
Node in this cache. |
V |
put(Fqn fqn,
K key,
V value,
Flag... flags) |
void |
put(Fqn fqn,
Map<? extends K,? extends V> data)
Copies all of the mappings from the specified map to a
Node . |
void |
put(Fqn fqn,
Map<? extends K,? extends V> data,
Flag... flags) |
V |
put(String fqn,
K key,
V value)
Convenience method that takes a string representation of an Fqn.
|
V |
put(String fqn,
K key,
V value,
Flag... flags) |
void |
put(String fqn,
Map<? extends K,? extends V> data)
Convenience method that takes a string representation of an Fqn.
|
void |
put(String fqn,
Map<? extends K,? extends V> data,
Flag... flags) |
V |
remove(Fqn fqn,
K key)
Removes the mapping for this key from a Node.
|
V |
remove(Fqn fqn,
K key,
Flag... flags) |
V |
remove(String fqn,
K key)
Convenience method that takes a string representation of an Fqn.
|
V |
remove(String fqn,
K key,
Flag... flags) |
boolean |
removeNode(Fqn fqn)
|
boolean |
removeNode(Fqn fqn,
Flag... flags) |
boolean |
removeNode(String fqn)
Convenience method that takes a string representation of an Fqn.
|
boolean |
removeNode(String fqn,
Flag... flags) |
void |
start() |
void |
stop() |
String |
toString() |
createNodeInCache, exists, exists, getAtomicMap, getAtomicMap, isLocked, printTree
assertBatchingSupported, endAtomic, failAtomic, startAtomic
public TreeCacheImpl(Cache<?,?> cache)
public TreeCacheImpl(AdvancedCache<?,?> cache)
public Node<K,V> getRoot()
TreeCache
public V put(String fqn, K key, V value)
TreeCache
TreeCache.put(Fqn, Object,
Object)
put
in interface TreeCache<K,V>
fqn
- String representation of the Fqnkey
- key with which the specified value is to be associated.value
- value to be associated with the specified key.null
if there was no mapping for key. A
null
return can also indicate that the Node previously associated null
with the
specified key, if the implementation supports null values.public void put(Fqn fqn, Map<? extends K,? extends V> data)
TreeCache
Node
.public void put(String fqn, Map<? extends K,? extends V> data)
TreeCache
TreeCache.put(Fqn,
java.util.Map)
public V remove(Fqn fqn, K key)
TreeCache
null
if the Node contained no mapping for this key.public V remove(String fqn, K key)
TreeCache
TreeCache.remove(Fqn,
Object)
public boolean removeNode(Fqn fqn)
TreeCache
removeNode
in interface TreeCache<K,V>
fqn
- Node
to removepublic boolean removeNode(Fqn fqn, Flag... flags)
removeNode
in interface TreeCache<K,V>
public boolean removeNode(String fqn)
TreeCache
TreeCache.removeNode(Fqn)
removeNode
in interface TreeCache<K,V>
fqn
- string representation of the Fqn to retrievepublic boolean removeNode(String fqn, Flag... flags)
removeNode
in interface TreeCache<K,V>
public Node<K,V> getNode(Fqn fqn)
TreeCache
public Node<K,V> getNode(String fqn)
TreeCache
TreeCache.getNode(Fqn)
public V get(Fqn fqn, K key)
TreeCache
Node
.public boolean exists(String f)
TreeCache
TreeCache.exists(Fqn)
public V get(String fqn, K key)
TreeCache
TreeCache.get(Fqn,
Object)
public void move(Fqn nodeToMoveFqn, Fqn newParentFqn) throws NodeNotExistsException
TreeCache
/a/b/c /a/b/d /a/b/e Fqn f1 = Fqn.fromString("/a/b/c"); Fqn f2 = Fqn.fromString("/a/b/d"); cache.move(f1, f2);Will result in:
/a/b/d/c /a/b/eand now
Fqn f3 = Fqn.fromString("/a/b/e"); Fqn f4 = Fqn.fromString("/a"); cache.move(f3, f4);will result in:
/a/b/d/c /a/eNo-op if the node to be moved is the root node. Note: As of 3.0.0 and when using MVCC locking, more specific behaviour is defined as follows:
move
in interface TreeCache<K,V>
nodeToMoveFqn
- the Fqn of the node to move.newParentFqn
- new location under which to attach the node being moved.NodeNotExistsException
- may throw one of these if the target node does not exist or if a different thread
has moved this node elsewhere already.public void move(Fqn nodeToMoveFqn, Fqn newParentFqn, Flag... flags) throws NodeNotExistsException
move
in interface TreeCache<K,V>
NodeNotExistsException
public void move(String nodeToMove, String newParent) throws NodeNotExistsException
TreeCache
TreeCache.move(Fqn, Fqn)
move
in interface TreeCache<K,V>
NodeNotExistsException
public void move(String nodeToMove, String newParent, Flag... flags) throws NodeNotExistsException
move
in interface TreeCache<K,V>
NodeNotExistsException
public Map<K,V> getData(Fqn fqn)
TreeCache
public Set<K> getKeys(String fqn)
TreeCache
TreeCache.getKeys(Fqn)
.public Set<K> getKeys(Fqn fqn)
TreeCache
public void clearData(String fqn)
TreeCache
TreeCache.clearData(Fqn)
.public void clearData(Fqn fqn)
TreeCache
public void clearData(AdvancedCache<NodeKey,AtomicMap<?,?>> cache, Fqn fqn)
public V put(Fqn fqn, K key, V value)
TreeCache
Node
in this cache. If the Node
previously contained a mapping for this key, the old value is replaced by the specified value.put
in interface TreeCache<K,V>
fqn
- absolute Fqn
to the Node
to be accessed.key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.null
if there was no mapping for key. A
null
return can also indicate that the Node previously associated null
with the
specified key, if the implementation supports null values.public Cache<?,?> getCache()
public void start() throws CacheException
start
in interface Lifecycle
CacheException
Copyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.