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 import java.util.Map;
025
026 import org.apache.directory.shared.ldap.exception.LdapException;
027 import org.apache.directory.shared.ldap.schema.AttributeType;
028 import org.apache.directory.shared.ldap.schema.normalizers.OidNormalizer;
029
030
031 /**
032 * An AttributeType registry service interface.
033 *
034 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
035 * @version $Rev: 923524 $
036 */
037 public interface AttributeTypeRegistry extends SchemaObjectRegistry<AttributeType>, Iterable<AttributeType>
038 {
039 /**
040 * Gets an oid/name to normalizer mapping used to normalize distinguished
041 * names.
042 *
043 * @return a map of OID Strings to OidNormalizer instances
044 */
045 Map<String, OidNormalizer> getNormalizerMapping();
046
047
048 /**
049 * Quick lookup to see if an attribute has descendants.
050 *
051 * @param ancestorId the name alias or OID for an attributeType
052 * @return an Iterator over the AttributeTypes which have the ancestor
053 * within their superior chain to the top
054 * @throws LdapException if the ancestor attributeType cannot be
055 * discerned from the ancestorId supplied
056 */
057 boolean hasDescendants( String ancestorId ) throws LdapException;
058
059
060 /**
061 * Get's an iterator over the set of descendant attributeTypes for
062 * some ancestor's name alias or their OID.
063 *
064 * @param ancestorId the name alias or OID for an attributeType
065 * @return an Iterator over the AttributeTypes which have the ancestor
066 * within their superior chain to the top
067 * @throws LdapException if the ancestor attributeType cannot be
068 * discerned from the ancestorId supplied
069 */
070 Iterator<AttributeType> descendants( String ancestorId ) throws LdapException;
071
072
073 /**
074 * Store the AttributeType into a map associating an AttributeType to its
075 * descendants.
076 *
077 * @param attributeType The attributeType to register
078 * @throws LdapException If something went wrong
079 */
080 void registerDescendants( AttributeType attributeType, AttributeType ancestor ) throws LdapException;
081
082
083 /**
084 * Remove the AttributeType from the map associating an AttributeType to its
085 * descendants.
086 *
087 * @param attributeType The attributeType to unregister
088 * @param ancestor its ancestor
089 * @throws LdapException If something went wrong
090 */
091 void unregisterDescendants( AttributeType attributeType, AttributeType ancestor ) throws LdapException;
092
093
094 /**
095 * Add a new Oid/Normalizer couple in the OidNormalizer map
096 */
097 void addMappingFor( AttributeType attributeType ) throws LdapException;
098
099
100 /**
101 * Remove a new Oid/Normalizer couple in the OidNormalizer map
102 */
103 void removeMappingFor( AttributeType attributeType ) throws LdapException;
104
105
106 /**
107 * Copy the AttributeTypeRegistry
108 */
109 AttributeTypeRegistry copy();
110 }