View Javadoc

1   /*
2    *  Licensed to the Apache Software Foundation (ASF) under one
3    *  or more contributor license agreements.  See the NOTICE file
4    *  distributed with this work for additional information
5    *  regarding copyright ownership.  The ASF licenses this file
6    *  to you under the Apache License, Version 2.0 (the
7    *  "License"); you may not use this file except in compliance
8    *  with the License.  You may obtain a copy of the License at
9    *  
10   *    http://www.apache.org/licenses/LICENSE-2.0
11   *  
12   *  Unless required by applicable law or agreed to in writing,
13   *  software distributed under the License is distributed on an
14   *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *  KIND, either express or implied.  See the License for the
16   *  specific language governing permissions and limitations
17   *  under the License. 
18   *  
19   */
20  package org.apache.directory.server.schema.registries;
21  
22  
23  import java.util.Comparator;
24  import java.util.Iterator;
25  
26  import javax.naming.NamingException;
27  
28  import org.apache.directory.shared.ldap.schema.syntax.ComparatorDescription;
29  
30  
31  /**
32   * Comparator registry component's service interface.
33   *
34   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
35   * @version $Rev: 504773 $
36   */
37  public interface ComparatorRegistry
38  {
39      /**
40       * Gets the name of the schema this schema object is associated with.
41       *
42       * @param oid the object identifier
43       * @return the schema name
44       * @throws NamingException if the schema object does not exist 
45       */
46      String getSchemaName( String oid ) throws NamingException;
47  
48  
49      /**
50       * Registers a Comparator with this registry.
51       * 
52       * @param description the comparatorDescription for the comparator to register
53       * @param comparator the Comparator to register
54       * @throws NamingException if the Comparator is already registered or the 
55       *      registration operation is not supported
56       */
57      void register( ComparatorDescription description, Comparator comparator ) throws NamingException;
58  
59  
60      /**
61       * Looks up a Comparator by its unique Object Identifier.
62       * 
63       * @param oid the object identifier
64       * @return the Comparator for the oid
65       * @throws NamingException if there is a backing store failure or the 
66       *      Comparator does not exist.
67       */
68      Comparator lookup( String oid ) throws NamingException;
69  
70  
71      /**
72       * Checks to see if a Comparator exists.  Backing store failures simply 
73       * return false.
74       * 
75       * @param oid the object identifier
76       * @return true if a Comparator definition exists for the oid, false 
77       *      otherwise
78       */
79      boolean hasComparator( String oid );
80  
81  
82      /**
83       * Iterates over the numeric OID strings of this registry.
84       * 
85       * @return Iterator of numeric OID strings 
86       */
87      Iterator<String> oidIterator();
88  
89      
90      /**
91       * Iterates over the numeric OID strings of this registry.
92       * 
93       * @return Iterator of numeric OID strings 
94       */
95      Iterator<ComparatorDescription> comparatorDescriptionIterator();
96  
97      
98      /**
99       * Removes a registered comparator from this registry.
100      * 
101      * @param oid the numeric oid of the comparator to remove.
102      * @throws NamingException if the oid is not a numeric id
103      */
104     void unregister( String oid ) throws NamingException;
105     
106     
107     /**
108      * Unregisters comparators from this registry associated with a schema.
109      *
110      * @param schemaName the name of the schema whose comparators are removed 
111      * from this registry
112      */
113     void unregisterSchemaElements( String schemaName );
114     
115     
116     /**
117      * Renames the schemaName associated with entities within this 
118      * registry to a new schema name.
119      * 
120      * @param originalSchemaName the original schema name
121      * @param newSchemaName the new name to give to the schema
122      */
123     void renameSchema( String originalSchemaName, String newSchemaName );
124 }