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 @Override 54 Iterator<DitStructureRule> iterator(); 55 56 57 /** 58 * Gets an iterator over the registered ruleId in the registry. 59 * 60 * @return an Iterator of ruleId 61 */ 62 Iterator<Integer> ruleIdIterator(); 63 64 65 /** 66 * Gets the name of the schema this schema object is associated with. 67 * 68 * @param ruleId the object identifier 69 * @return the schema name 70 * @throws LdapException if the schema object does not exist 71 */ 72 String getSchemaName( int ruleId ) throws LdapException; 73 74 75 /** 76 * Registers a new DitStructureRule with this registry. 77 * 78 * @param ditStructureRule the DitStructureRule to register 79 * @throws LdapException if the DitStructureRule is already registered or 80 * the registration operation is not supported 81 */ 82 @Override 83 void register( DitStructureRule ditStructureRule ) throws LdapException; 84 85 86 /** 87 * Looks up an dITStructureRule by its unique Object IDentifier or by its 88 * name. 89 * 90 * @param ruleId the rule identifier for the DitStructureRule 91 * @return the DitStructureRule instance for rule identifier 92 * @throws LdapException if the DitStructureRule does not exist 93 */ 94 DitStructureRule lookup( int ruleId ) throws LdapException; 95 96 97 /** 98 * Unregisters a DitStructureRule using it's rule identifier. 99 * 100 * @param ruleId the rule identifier for the DitStructureRule to unregister 101 * @throws LdapException if no such DitStructureRule exists 102 */ 103 void unregister( int ruleId ) throws LdapException; 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 LdapException if no such SchemaElement exists 112 */ 113 @Override 114 void unregisterSchemaElements( String schemaName ) throws LdapException; 115 116 117 /** 118 * Modify all the DitStructureRule using a schemaName when this name changes. 119 * 120 * @param originalSchemaName The original Schema name 121 * @param newSchemaName The new Schema name 122 * @throws org.apache.directory.api.ldap.model.exception.LdapException if the schema can't be renamed 123 */ 124 @Override 125 void renameSchema( String originalSchemaName, String newSchemaName ) throws LdapException; 126 127 128 /** 129 * Copy the DitStructureRuleRegistry 130 */ 131 @Override 132 DitStructureRuleRegistry copy(); 133 }