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 */ 020package org.apache.directory.shared.ldap.model.schema.registries; 021 022 023import java.util.Iterator; 024 025import org.apache.directory.shared.ldap.model.exception.LdapException; 026import org.apache.directory.shared.ldap.model.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 */ 034public interface DITStructureRuleRegistry extends SchemaObjectRegistry<DITStructureRule>, 035 Iterable<DITStructureRule> 036{ 037 /** 038 * Checks to see if an DITStructureRule exists in the registry, by its 039 * ruleId. 040 * 041 * @param ruleId the rule identifier of the DITStructureRule 042 * @return true if a DITStructureRule definition exists for the ruleId, false 043 * otherwise 044 */ 045 boolean contains( int ruleId ); 046 047 048 /** 049 * Gets an iterator over the registered descriptions in the registry. 050 * 051 * @return an Iterator of descriptions 052 */ 053 Iterator<DITStructureRule> iterator(); 054 055 056 /** 057 * Gets an iterator over the registered ruleId in the registry. 058 * 059 * @return an Iterator of ruleId 060 */ 061 Iterator<Integer> ruleIdIterator(); 062 063 064 /** 065 * Gets the name of the schema this schema object is associated with. 066 * 067 * @param ruleId the object identifier 068 * @return the schema name 069 * @throws LdapException if the schema object does not exist 070 */ 071 String getSchemaName( int ruleId ) throws LdapException; 072 073 074 /** 075 * Registers a new DITStructureRule with this registry. 076 * 077 * @param ditStructureRule the DITStructureRule to register 078 * @throws LdapException if the DITStructureRule is already registered or 079 * the registration operation is not supported 080 */ 081 void register( DITStructureRule ditStructureRule ) throws LdapException; 082 083 084 /** 085 * Looks up an dITStructureRule by its unique Object IDentifier or by its 086 * name. 087 * 088 * @param ruleId the rule identifier for the DITStructureRule 089 * @return the DITStructureRule instance for rule identifier 090 * @throws LdapException if the DITStructureRule does not exist 091 */ 092 DITStructureRule lookup( int ruleId ) throws LdapException; 093 094 095 /** 096 * Unregisters a DITStructureRule using it's rule identifier. 097 * 098 * @param ruleId the rule identifier for the DITStructureRule to unregister 099 * @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.shared.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}