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.Iterator;
24
25 import javax.naming.NamingException;
26
27 import org.apache.directory.shared.ldap.schema.Normalizer;
28 import org.apache.directory.shared.ldap.schema.syntax.NormalizerDescription;
29
30
31 /**
32 * Normalizer registry service interface.
33 *
34 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
35 * @version $Rev: 510365 $
36 */
37 public interface NormalizerRegistry
38 {
39 /**
40 * Registers a Normalizer with this registry.
41 *
42 * @param normalizer the Normalizer to register
43 * @throws NamingException if the Normalizer is already registered or the
44 * registration operation is not supported
45 */
46 void register( NormalizerDescription description, Normalizer normalizer ) throws NamingException;
47
48
49 /**
50 * Looks up a Normalizer by its unique Object Identifier.
51 *
52 * @param oid the object identifier
53 * @return the Normalizer for the oid
54 * @throws NamingException if there is a backing store failure or the
55 * Normalizer does not exist.
56 */
57 Normalizer lookup( String oid ) throws NamingException;
58
59
60 /**
61 * Gets the name of the schema this schema object is associated with.
62 *
63 * @param oid the object identifier
64 * @return the schema name
65 * @throws NamingException if the schema object does not exist
66 */
67 String getSchemaName( String oid ) throws NamingException;
68
69
70 /**
71 * Checks to see if a Normalizer exists. Backing store failures simply
72 * return false.
73 *
74 * @param oid the object identifier
75 * @return true if a Normalizer definition exists for the oid, false
76 * otherwise
77 */
78 boolean hasNormalizer( String oid );
79
80
81 /**
82 * Used to iterate through all normalizers. We have to iterate over the
83 * OID String keys because these objects do not associate a matchingRule OID
84 * with them as a class member.
85 *
86 * @return an Iterator over the set of OID Strings in this registry
87 */
88 Iterator<String> oidIterator();
89
90
91 /**
92 * Used to iterate through all normalizerDescriptions.
93 *
94 * @return an Iterator over the set of NormalizerDescriptions in this registry
95 */
96 Iterator<NormalizerDescription> normalizerDescriptionIterator();
97
98
99 /**
100 * Unregisters a normalizer from this registry by OID.
101 *
102 * @param oid the numeric OID of the matchingRule the normalizer is for
103 * @throws NamingException if the provided argument is not a numeric OID
104 */
105 void unregister( String oid ) throws NamingException;
106
107
108 /**
109 * Unregisters normalizers from this registry associated with a schema.
110 *
111 * @param schemaName the name of the schema whose normalizers are
112 * removed from this registry
113 */
114 void unregisterSchemaElements( String schemaName );
115
116
117 /**
118 * Renames the schemaName associated with entities within this
119 * registry to a new schema name.
120 *
121 * @param originalSchemaName the original schema name
122 * @param newSchemaName the new name to give to the schema
123 */
124 void renameSchema( String originalSchemaName, String newSchemaName );
125 }