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.List;
25  
26  import org.apache.directory.api.ldap.model.exception.LdapException;
27  import org.apache.directory.api.ldap.model.schema.ObjectClass;
28  
29  
30  /**
31   * ObjectClass registry service interface.
32   *
33   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
34   */
35  public interface ObjectClassRegistry extends SchemaObjectRegistry<ObjectClass>,
36      Iterable<ObjectClass>
37  {
38      /**
39       * Quick lookup to see if an objectClass has descendants.
40       * 
41       * @param ancestorId the name alias or OID for an ObjectClass
42       * @return an Iterator over the ObjectClasses which have the ancestor
43       * within their superior chain to the top
44       * @throws LdapException if the ancestor ObjectClass cannot be 
45       * discerned from the ancestorId supplied
46       */
47      boolean hasDescendants( String ancestorId ) throws LdapException;
48  
49  
50      /**
51       * Get's an iterator over the set of descendant ObjectClasses for
52       * some ancestor's name alias or their OID.
53       * 
54       * @param ancestorId the name alias or OID for an ObjectClass
55       * @return an Iterator over the ObjectClasses which have the ancestor
56       * within their superior chain to the top
57       * @throws LdapException if the ancestor ObjectClass cannot be 
58       * discerned from the ancestorId supplied
59       */
60      Iterator<ObjectClass> descendants( String ancestorId ) throws LdapException;
61  
62  
63      /**
64       * Store the ObjectClass into a map associating an ObjectClass to its
65       * descendants.
66       * 
67       * @param objectClass The ObjectClass to register
68       * @param ancestors Its ancestors
69       * @throws LdapException If something went wrong
70       */
71      void registerDescendants( ObjectClass objectClass, List<ObjectClass> ancestors )
72          throws LdapException;
73  
74  
75      /**
76       * Remove the ObjectClass from the map associating an ObjectClass to its
77       * descendants.
78       * 
79       * @param attributeType The ObjectClass to unregister
80       * @param ancestors its ancestors 
81       * @throws org.apache.directory.api.ldap.model.exception.LdapException If something went wrong
82       */
83      void unregisterDescendants( ObjectClass attributeType, List<ObjectClass> ancestors )
84          throws LdapException;
85  
86  
87      /**
88       * Registers a new ObjectClass with this registry.
89       *
90       * @param objectClass the ObjectClass to register
91       * @throws LdapException if the ObjectClass is already registered or
92       * the registration operation is not supported
93       */
94      void register( ObjectClass objectClass ) throws LdapException;
95  
96  
97      /**
98       * Removes the ObjectClass registered with this registry.
99       * 
100      * @param numericOid the numeric identifier
101      * @throws LdapException if the numeric identifier is invalid
102      */
103     ObjectClass unregister( String numericOid ) throws LdapException;
104 
105 
106     /**
107      * Copy the ObjectClassRegistry
108      */
109     ObjectClassRegistry copy();
110 }