View Javadoc
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  import java.util.Map;
25  
26  import org.apache.directory.api.ldap.model.exception.LdapException;
27  import org.apache.directory.api.ldap.model.schema.AttributeType;
28  import org.apache.directory.api.ldap.model.schema.normalizers.OidNormalizer;
29  
30  
31  /**
32   * An AttributeType registry service interface.
33   *
34   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
35   */
36  public interface AttributeTypeRegistry extends SchemaObjectRegistry<AttributeType>, Iterable<AttributeType>
37  {
38      /**
39       * Gets an oid/name to normalizer mapping used to normalize distinguished 
40       * names.
41       *
42       * @return a map of OID Strings to OidNormalizer instances
43       */
44      Map<String, OidNormalizer> getNormalizerMapping();
45  
46  
47      /**
48       * Quick lookup to see if an attribute has descendants.
49       * 
50       * @param ancestorId the name alias or OID for an attributeType
51       * @return an Iterator over the AttributeTypes which have the ancestor
52       * within their superior chain to the top
53       * @throws LdapException if the ancestor attributeType cannot be 
54       * discerned from the ancestorId supplied
55       */
56      boolean hasDescendants( String ancestorId ) throws LdapException;
57  
58  
59      /**
60       * Quick lookup to see if an attribute has descendants.
61       * 
62       * @param ancestor the attributeType we are looking for
63       * @return an Iterator over the AttributeTypes which have the ancestor
64       * within their superior chain to the top
65       * @throws LdapException if the ancestor attributeType cannot be 
66       * discerned from the ancestorId supplied
67       */
68      boolean hasDescendants( AttributeType ancestor ) throws LdapException;
69  
70  
71      /**
72       * Get's an iterator over the set of descendant attributeTypes for
73       * some ancestor's name alias or their OID.
74       * 
75       * @param ancestorId the name alias or OID for an attributeType
76       * @return an Iterator over the AttributeTypes which have the ancestor
77       * within their superior chain to the top
78       * @throws LdapException if the ancestor attributeType cannot be 
79       * discerned from the ancestorId supplied
80       */
81      Iterator<AttributeType> descendants( String ancestorId ) throws LdapException;
82  
83  
84      /**
85       * Get's an iterator over the set of descendant attributeTypes for
86       * some ancestor's name alias or their OID.
87       * 
88       * @param ancestor the AttributeType we are looking for
89       * @return an Iterator over the AttributeTypes which have the ancestor
90       * within their superior chain to the top
91       * @throws LdapException if the ancestor attributeType cannot be 
92       * discerned from the ancestorId supplied
93       */
94      Iterator<AttributeType> descendants( AttributeType ancestor ) throws LdapException;
95  
96  
97      /**
98       * Store the AttributeType into a map associating an AttributeType to its
99       * descendants.
100      * 
101      * @param attributeType The attributeType to register
102      * @throws org.apache.directory.api.ldap.model.exception.LdapException If something went wrong
103      */
104     void registerDescendants( AttributeType attributeType, AttributeType ancestor ) throws LdapException;
105 
106 
107     /**
108      * Remove the AttributeType from the map associating an AttributeType to its
109      * descendants.
110      * 
111      * @param attributeType The attributeType to unregister
112      * @param ancestor its ancestor 
113      * @throws LdapException If something went wrong
114      */
115     void unregisterDescendants( AttributeType attributeType, AttributeType ancestor ) throws LdapException;
116 
117 
118     /**
119      * Add a new Oid/Normalizer couple in the OidNormalizer map
120      */
121     void addMappingFor( AttributeType attributeType ) throws LdapException;
122 
123 
124     /**
125      * Remove a new Oid/Normalizer couple in the OidNormalizer map
126      */
127     void removeMappingFor( AttributeType attributeType ) throws LdapException;
128 
129 
130     /**
131      * Copy the AttributeTypeRegistry
132      */
133     AttributeTypeRegistry copy();
134 }