1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.core.subtree;
21
22
23 import java.util.HashMap;
24 import java.util.Iterator;
25 import java.util.Map;
26
27 import org.apache.directory.shared.ldap.subtree.SubtreeSpecification;
28
29
30
31
32
33
34
35
36 public class SubentryCache
37 {
38 private final Map<String, Subentry> name2subentry = new HashMap<String, Subentry>();
39
40
41 final Subentry getSubentry( String normalizedName )
42 {
43 return name2subentry.get( normalizedName );
44 }
45
46
47 final Subentry removeSubentry( String normalizedName )
48 {
49 return name2subentry.remove( normalizedName );
50 }
51
52
53 final Subentry setSubentry( String normalizedName, SubtreeSpecification ss, int types )
54 {
55 Subentry old = name2subentry.get( normalizedName );
56 Subentry subentry = new Subentry();
57 subentry.setSubtreeSpecification( ss );
58 subentry.setTypes( types );
59 name2subentry.put( normalizedName, subentry );
60 return old;
61 }
62
63
64 final boolean hasSubentry( String normalizedName )
65 {
66 return name2subentry.containsKey( normalizedName );
67 }
68
69
70 final Iterator<String> nameIterator()
71 {
72 return name2subentry.keySet().iterator();
73 }
74 }