1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ldap.server;
18
19
20 import org.apache.ldap.common.schema.AttributeType;
21 import org.apache.ldap.server.db.Database;
22 import org.apache.ldap.server.db.SearchEngine;
23
24 import javax.naming.Name;
25 import javax.naming.NamingException;
26
27
28 /***
29 * Creates a ContextPartition to be use for application specific contexts.
30 *
31 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
32 * @version $Rev: 159259 $
33 */
34 public class ApplicationPartition extends AbstractContextPartition
35 {
36 /***
37 * user provided suffix distinguished name for this backend set during
38 * the Avalon configuration life-cycle phase.
39 */
40 private Name upSuffix = null ;
41
42 /***
43 * normalized suffix distinguished name for this backend set during
44 * the Avalon configuration life-cycle phase.
45 */
46 private Name normalizedSuffix = null ;
47
48
49
50
51
52
53
54 /***
55 *
56 * @param upSuffix the user provided suffix without normalization
57 * @param normalizedSuffix the normalized suffix
58 * @param db the database to use for this partition
59 * @param searchEngine the search engine to use for this partition
60 * @param indexAttributes the index attrivutes including system attributes
61 * @throws NamingException on failures while creating this partition
62 */
63 public ApplicationPartition( Name upSuffix, Name normalizedSuffix, Database db,
64 SearchEngine searchEngine,
65 AttributeType[] indexAttributes )
66 throws NamingException
67 {
68 super( db, searchEngine, indexAttributes );
69
70 this.normalizedSuffix = normalizedSuffix;
71 this.upSuffix = upSuffix;
72 }
73
74
75
76
77
78
79
80
81 /***
82 * @see ContextPartition#getSuffix( boolean )
83 */
84 public Name getSuffix( boolean normalized )
85 {
86 if ( normalized )
87 {
88 return normalizedSuffix ;
89 }
90
91 return upSuffix ;
92 }
93
94
95 /***
96 * @see BackingStore#isSuffix( Name )
97 */
98 public boolean isSuffix( Name dn ) throws NamingException
99 {
100 return normalizedSuffix.equals( dn ) ;
101 }
102 }