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.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: 504284 $
035 */
036 public interface DITStructureRuleRegistry extends SchemaObjectRegistry
037 {
038 /**
039 * Registers a DITStructureRule with this registry.
040 *
041 * @param dITStructureRule the dITStructureRule to register
042 * @throws NamingException if the DITStructureRule is already registered
043 * or the registration operation is not supported
044 */
045 void register( DITStructureRule dITStructureRule ) throws NamingException;
046
047
048 /**
049 * Looks up an dITStructureRule using a composite key composed of the
050 * nameForm object identifier with a DOT and the rule id of the
051 * DITStructureRule appended to it. If the name form object identifier
052 * is 1.2.3.4 and the rule identifier is 5 then the OID used for the
053 * lookup is 1.2.3.4.5.
054 *
055 * @param id the nameForm object identifier with rule identifier appended
056 * @return the DITStructureRule instance for the id
057 * @throws NamingException if the DITStructureRule does not exist
058 */
059 DITStructureRule lookup( String id ) throws NamingException;
060
061
062 /**
063 * Looks up an dITStructureRule by its unique Object IDentifier or by its
064 * name.
065 *
066 * @param ruleId the rule identifier for the DITStructureRule
067 * @return the DITStructureRule instance for rule identifier
068 * @throws NamingException if the DITStructureRule does not exist
069 */
070 DITStructureRule lookup( Integer ruleId ) throws NamingException;
071
072
073 /**
074 * Checks to see if an dITStructureRule exists using the object identifier
075 * of the nameForm appended with the rule identifier of the DITStructureRule.
076 *
077 * @param id the object identifier of the nameForm with the rule Id appended
078 * @return true if an dITStructureRule definition exists for the id, false
079 * otherwise
080 */
081 boolean hasDITStructureRule( String id );
082
083
084 /**
085 * Checks to see if an dITStructureRule exists using the rule identifier.
086 *
087 * @param ruleId the rule identifier for the DITStructureRule.
088 * @return true if an dITStructureRule definition exists for the id, false
089 * otherwise
090 */
091 boolean hasDITStructureRule( Integer ruleId );
092
093
094 /**
095 * Unregisters a DITStructureRule using it's rule identifier.
096 *
097 * @param ruleId the rule identifier for the DITStructureRule to unregister
098 * @throws NamingException if no such DITStructureRule exists
099 */
100 void unregister( Integer ruleId ) throws NamingException;
101
102
103 /**
104 * Gets the schema name for a DITStructureRule using the rule identifier.
105 *
106 * @param ruleId the rule identifier for the DITStructureRule
107 * @return the schema name for the DITStructureRule
108 * @throws NamingException if no such rule could be found
109 */
110 String getSchemaName( Integer ruleId ) throws NamingException;
111
112
113 /**
114 * Lists all the DITStructureRules within this registry.
115 *
116 * @return an Iterator over all the DITStructureRules within this registry
117 */
118 Iterator<DITStructureRule> iterator();
119 }