001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements. See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership. The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License. You may obtain a copy of the License at
009 *
010 * http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing,
013 * software distributed under the License is distributed on an
014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 * KIND, either express or implied. See the License for the
016 * specific language governing permissions and limitations
017 * under the License.
018 *
019 */
020 package org.apache.directory.server.schema.registries;
021
022
023 import java.util.Iterator;
024
025 import javax.naming.NamingException;
026
027 import org.apache.directory.shared.ldap.schema.SyntaxChecker;
028 import org.apache.directory.shared.ldap.schema.parsers.SyntaxCheckerDescription;
029
030
031 /**
032 * SyntaxChecker registry component's service interface.
033 *
034 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
035 * @version $Rev: 780471 $
036 */
037 public interface SyntaxCheckerRegistry extends Iterable<SyntaxChecker>
038 {
039 /**
040 * Registers a SyntaxChecker with this registry.
041 *
042 * @param description the syntaxCheckerDescription for this syntaxChecker
043 * @param syntaxChecker the SyntaxChecker to register
044 * @throws NamingException if the SyntaxChecker is already registered or the
045 * registration operation is not supported
046 */
047 void register( SyntaxCheckerDescription description, SyntaxChecker syntaxChecker ) throws NamingException;
048
049
050 /**
051 * Looks up a SyntaxChecker by its unique Object Identifier.
052 *
053 * @param oid the object identifier
054 * @return the SyntaxChecker for the oid
055 * @throws NamingException if there is a backing store failure or the
056 * SyntaxChecker does not exist.
057 */
058 SyntaxChecker lookup( String oid ) throws NamingException;
059
060
061 /**
062 * Gets the name of the schema this schema object is associated with.
063 *
064 * @param oid the object identifier
065 * @return the schema name
066 * @throws NamingException if the schema object does not exist
067 */
068 String getSchemaName( String oid ) throws NamingException;
069
070
071 /**
072 * Checks to see if a SyntaxChecker exists. Backing store failures simply
073 * return false.
074 *
075 * @param oid the object identifier
076 * @return true if a SyntaxChecker definition exists for the oid, false
077 * otherwise
078 */
079 boolean hasSyntaxChecker( String oid );
080
081
082 /**
083 * Get's an iterator over all the syntaxCheckers associated with this registry.
084 *
085 * @return an Iterator over all the syntaxCheckers
086 */
087 Iterator<SyntaxChecker> iterator();
088
089
090 /**
091 * Get's an iterator over all the syntaxCheckerDescriptions associated with this registry.
092 *
093 * @return an Iterator over all the syntaxCheckerDescriptions
094 */
095 Iterator<SyntaxCheckerDescription> syntaxCheckerDescriptionIterator();
096
097
098 /**
099 * Unregisters a registered syntaxChecker from this registry.
100 *
101 * @param numericOid the numeric oid of the syntax this checker is associated with
102 * @throws NamingException if the numericOid is not valid
103 */
104 void unregister( String numericOid ) throws NamingException;
105
106
107 /**
108 * Unregisters all syntaxCheckers defined for a specific schema from
109 * this registry.
110 *
111 * @param schemaName the name of the schema whose syntaxCheckers will be removed
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 }