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.api.ldap.model.schema.registries; 21 22 23 import java.util.Iterator; 24 25 import org.apache.directory.api.ldap.model.exception.LdapException; 26 import org.apache.directory.api.ldap.model.schema.DitStructureRule; 27 28 29 /** 30 * An DitStructureRule registry service interface. 31 * 32 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 33 */ 34 public interface DitStructureRuleRegistry extends SchemaObjectRegistry<DitStructureRule>, 35 Iterable<DitStructureRule> 36 { 37 /** 38 * Checks to see if an DitStructureRule exists in the registry, by its 39 * ruleId. 40 * 41 * @param ruleId the rule identifier of the DitStructureRule 42 * @return true if a DitStructureRule definition exists for the ruleId, false 43 * otherwise 44 */ 45 boolean contains( int ruleId ); 46 47 48 /** 49 * Gets an iterator over the registered descriptions in the registry. 50 * 51 * @return an Iterator of descriptions 52 */ 53 Iterator<DitStructureRule> iterator(); 54 55 56 /** 57 * Gets an iterator over the registered ruleId in the registry. 58 * 59 * @return an Iterator of ruleId 60 */ 61 Iterator<Integer> ruleIdIterator(); 62 63 64 /** 65 * Gets the name of the schema this schema object is associated with. 66 * 67 * @param ruleId the object identifier 68 * @return the schema name 69 * @throws LdapException if the schema object does not exist 70 */ 71 String getSchemaName( int ruleId ) throws LdapException; 72 73 74 /** 75 * Registers a new DitStructureRule with this registry. 76 * 77 * @param ditStructureRule the DitStructureRule to register 78 * @throws LdapException if the DitStructureRule is already registered or 79 * the registration operation is not supported 80 */ 81 void register( DitStructureRule ditStructureRule ) throws LdapException; 82 83 84 /** 85 * Looks up an dITStructureRule by its unique Object IDentifier or by its 86 * name. 87 * 88 * @param ruleId the rule identifier for the DitStructureRule 89 * @return the DitStructureRule instance for rule identifier 90 * @throws LdapException if the DitStructureRule does not exist 91 */ 92 DitStructureRule lookup( int ruleId ) throws LdapException; 93 94 95 /** 96 * Unregisters a DitStructureRule using it's rule identifier. 97 * 98 * @param ruleId the rule identifier for the DitStructureRule to unregister 99 * @throws LdapException if no such DitStructureRule exists 100 */ 101 void unregister( int ruleId ) throws LdapException; 102 103 104 /** 105 * Unregisters all DITStructureRules defined for a specific schema from 106 * this registry. 107 * 108 * @param schemaName the name of the schema whose syntaxCheckers will be removed from 109 * @throws LdapException if no such SchemaElement exists 110 */ 111 void unregisterSchemaElements( String schemaName ) throws LdapException; 112 113 114 /** 115 * Modify all the DitStructureRule using a schemaName when this name changes. 116 * 117 * @param originalSchemaName The original Schema name 118 * @param newSchemaName The new Schema name 119 * @throws org.apache.directory.api.ldap.model.exception.LdapException if the schema can't be renamed 120 */ 121 void renameSchema( String originalSchemaName, String newSchemaName ) throws LdapException; 122 123 124 /** 125 * Copy the DitStructureRuleRegistry 126 */ 127 DitStructureRuleRegistry copy(); 128 }