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.DITStructureRule; 28 29 30 /** 31 * An DITStructureRule registry service interface. 32 * 33 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 34 * @version $Rev: 504284 $ 35 */ 36 public interface DITStructureRuleRegistry extends SchemaObjectRegistry 37 { 38 /** 39 * Registers a DITStructureRule with this registry. 40 * 41 * @param dITStructureRule the dITStructureRule to register 42 * @throws NamingException if the DITStructureRule is already registered 43 * or the registration operation is not supported 44 */ 45 void register( DITStructureRule dITStructureRule ) throws NamingException; 46 47 48 /** 49 * Looks up an dITStructureRule using a composite key composed of the 50 * nameForm object identifier with a DOT and the rule id of the 51 * DITStructureRule appended to it. If the name form object identifier 52 * is 1.2.3.4 and the rule identifier is 5 then the OID used for the 53 * lookup is 1.2.3.4.5. 54 * 55 * @param id the nameForm object identifier with rule identifier appended 56 * @return the DITStructureRule instance for the id 57 * @throws NamingException if the DITStructureRule does not exist 58 */ 59 DITStructureRule lookup( String id ) throws NamingException; 60 61 62 /** 63 * Looks up an dITStructureRule by its unique Object IDentifier or by its 64 * name. 65 * 66 * @param ruleId the rule identifier for the DITStructureRule 67 * @return the DITStructureRule instance for rule identifier 68 * @throws NamingException if the DITStructureRule does not exist 69 */ 70 DITStructureRule lookup( Integer ruleId ) throws NamingException; 71 72 73 /** 74 * Checks to see if an dITStructureRule exists using the object identifier 75 * of the nameForm appended with the rule identifier of the DITStructureRule. 76 * 77 * @param id the object identifier of the nameForm with the rule Id appended 78 * @return true if an dITStructureRule definition exists for the id, false 79 * otherwise 80 */ 81 boolean hasDITStructureRule( String id ); 82 83 84 /** 85 * Checks to see if an dITStructureRule exists using the rule identifier. 86 * 87 * @param ruleId the rule identifier for the DITStructureRule. 88 * @return true if an dITStructureRule definition exists for the id, false 89 * otherwise 90 */ 91 boolean hasDITStructureRule( Integer ruleId ); 92 93 94 /** 95 * Unregisters a DITStructureRule using it's rule identifier. 96 * 97 * @param ruleId the rule identifier for the DITStructureRule to unregister 98 * @throws NamingException if no such DITStructureRule exists 99 */ 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 }