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.shared.ldap.schema.registries;
021
022
023 import java.util.Iterator;
024
025 import javax.naming.NamingException;
026
027 import org.apache.directory.shared.ldap.schema.DITStructureRule;
028
029
030 /**
031 * An DITStructureRule registry service interface.
032 *
033 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
034 * @version $Rev: 896579 $
035 */
036 public interface DITStructureRuleRegistry extends SchemaObjectRegistry<DITStructureRule>,
037 Iterable<DITStructureRule>
038 {
039 /**
040 * Checks to see if an DITStructureRule exists in the registry, by its
041 * ruleId.
042 *
043 * @param oid the object identifier or name of the DITStructureRule
044 * @return true if a DITStructureRule definition exists for the ruleId, false
045 * otherwise
046 */
047 boolean contains( int ruleId );
048
049
050 /**
051 * Gets an iterator over the registered descriptions in the registry.
052 *
053 * @return an Iterator of descriptions
054 */
055 Iterator<DITStructureRule> iterator();
056
057
058 /**
059 * Gets an iterator over the registered ruleId in the registry.
060 *
061 * @return an Iterator of ruleId
062 */
063 Iterator<Integer> ruleIdIterator();
064
065
066 /**
067 * Gets the name of the schema this schema object is associated with.
068 *
069 * @param id the object identifier or the name
070 * @return the schema name
071 * @throws NamingException if the schema object does not exist
072 */
073 String getSchemaName( int ruleId ) throws NamingException;
074
075
076 /**
077 * Registers a new DITStructureRule with this registry.
078 *
079 * @param ditStructureRule the DITStructureRule to register
080 * @throws NamingException if the DITStructureRule is already registered or
081 * the registration operation is not supported
082 */
083 void register( DITStructureRule ditStructureRule ) throws NamingException;
084
085
086 /**
087 * Looks up an dITStructureRule by its unique Object IDentifier or by its
088 * name.
089 *
090 * @param ruleId the rule identifier for the DITStructureRule
091 * @return the DITStructureRule instance for rule identifier
092 * @throws NamingException if the DITStructureRule does not exist
093 */
094 DITStructureRule lookup( int ruleId ) throws NamingException;
095
096
097 /**
098 * Unregisters a DITStructureRule using it's rule identifier.
099 *
100 * @param ruleId the rule identifier for the DITStructureRule to unregister
101 * @throws NamingException if no such DITStructureRule exists
102 */
103 void unregister( int ruleId ) throws NamingException;
104
105
106 /**
107 * Unregisters all DITStructureRules defined for a specific schema from
108 * this registry.
109 *
110 * @param schemaName the name of the schema whose syntaxCheckers will be removed from
111 * @throws NamingException if no such SchemaElement exists
112 */
113 void unregisterSchemaElements( String schemaName ) throws NamingException;
114
115
116 /**
117 * Modify all the DITStructureRule using a schemaName when this name changes.
118 *
119 * @param originalSchemaName The original Schema name
120 * @param newSchemaName The new Schema name
121 * @throws NamingException if the schema can't be renamed
122 */
123 void renameSchema( String originalSchemaName, String newSchemaName ) throws NamingException;
124
125
126 /**
127 * Copy the DITStructureRuleRegistry
128 */
129 DITStructureRuleRegistry copy();
130 }