KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > ldap > server > ApplicationPartition


1 /*
2  * Copyright 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
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 JavaDoc;
25 import javax.naming.NamingException JavaDoc;
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: 169198 $
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 JavaDoc 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 JavaDoc normalizedSuffix = null ;
47
48
49     // ------------------------------------------------------------------------
50
// C O N S T R U C T O R S
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 JavaDoc upSuffix, Name JavaDoc normalizedSuffix, Database db,
64                            SearchEngine searchEngine,
65                            AttributeType[] indexAttributes )
66         throws NamingException JavaDoc
67     {
68         super( db, searchEngine, indexAttributes );
69
70         this.normalizedSuffix = normalizedSuffix;
71         this.upSuffix = upSuffix;
72     }
73
74
75
76     // ------------------------------------------------------------------------
77
// Backend Interface Method Implementations
78
// ------------------------------------------------------------------------
79

80
81     /**
82      * @see ContextPartition#getSuffix( boolean )
83      */

84     public Name JavaDoc 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 JavaDoc dn ) throws NamingException JavaDoc
99     {
100         return normalizedSuffix.equals( dn ) ;
101     }
102 }
103
Popular Tags