Class DITCacheMap<T>
- java.lang.Object
-
- java.util.AbstractMap<DN,T>
-
- org.opends.server.api.DITCacheMap<T>
-
- Type Parameters:
T- arbitrary object type.
public final class DITCacheMap<T> extends AbstractMap<DN,T>
The DITCacheMap class implements custom Map for structural storage of arbitrary objects in Directory Information Tree (DIT) like structure.This Map intended usage is for caching various server objects which can be subject to subtree operations like retrieval or removal of all objects under a specific DN. While using a regular Map it would require the entire Map iteration to achieve, this Map implementation maintains such internal structure that subtree operations are more efficient and do not require iterations over the entire map, instead additional subtree operations methods are provided by this Map to do just that.
API wise it behaves exactly like a regular Map implementation except for providing additional subtree methods. All required linkage and structuring is performed within this Map implementation itself and not exposed via the API in any way. For example, putting these key/value pairs:
cn=Object1,ou=Objects,dc=example,dc=com : object1 cn=Object2,ou=Objects,dc=example,dc=com : object2 cn=Object3,ou=Objects,dc=example,dc=com : object3
then invoking a subtree method on this Map with any of these keys:ou=Objects,dc=example,dc=com dc=example,dc=com dc=com
would bring all three objects previously stored in this map into subtree operation scope. Standard Map API methods can only work with the objects previously stored in this map explicitly.Note that this Map implementation is not synchronized.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Constructor Description DITCacheMap()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()booleancontainsKey(Object key)booleancontainsSubtree(DN key)Returnstrueif there are stored objects subordinate to subtree DN.booleancontainsValue(Object value)Set<Map.Entry<DN,T>>entrySet()Tget(Object key)Collection<T>getSubtree(DN key)Returns a set of stored objects subordinate to subtree DN.booleanisEmpty()Tput(DN key, T value)voidputAll(Map<? extends DN,? extends T> m)Tremove(Object key)booleanremoveSubtree(DN key, Collection<? super T> values)Removes a set of stored objects subordinate to subtree DN.intsize()-
Methods inherited from class java.util.AbstractMap
clone, equals, hashCode, keySet, toString, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
-
-
Method Detail
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
containsKey
public boolean containsKey(Object key)
- Specified by:
containsKeyin interfaceMap<DN,T>- Overrides:
containsKeyin classAbstractMap<DN,T>
-
containsValue
public boolean containsValue(Object value)
- Specified by:
containsValuein interfaceMap<DN,T>- Overrides:
containsValuein classAbstractMap<DN,T>
-
getSubtree
public Collection<T> getSubtree(DN key)
Returns a set of stored objects subordinate to subtree DN.- Parameters:
key- subtree DN.- Returns:
- collection of stored objects subordinate to subtree DN.
-
containsSubtree
public boolean containsSubtree(DN key)
Returnstrueif there are stored objects subordinate to subtree DN.- Parameters:
key- subtree DN.- Returns:
trueif there are stored objects subordinate to subtree DN.
-
removeSubtree
public boolean removeSubtree(DN key, Collection<? super T> values)
Removes a set of stored objects subordinate to subtree DN.- Parameters:
key- subtree DN.values- collection for removed objects subordinate to subtree DN ornull.- Returns:
trueon success orfalseotherwise.
-
clear
public void clear()
-
-