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