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.List; 025 026 import org.apache.directory.shared.ldap.exception.LdapException; 027 import org.apache.directory.shared.ldap.schema.ObjectClass; 028 029 030 /** 031 * ObjectClass registry service interface. 032 * 033 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 034 * @version $Rev: 923524 $ 035 */ 036 public interface ObjectClassRegistry extends SchemaObjectRegistry<ObjectClass>, 037 Iterable<ObjectClass> 038 { 039 /** 040 * Quick lookup to see if an objectClass has descendants. 041 * 042 * @param ancestorId the name alias or OID for an ObjectClass 043 * @return an Iterator over the ObjectClasses which have the ancestor 044 * within their superior chain to the top 045 * @throws LdapException if the ancestor ObjectClass cannot be 046 * discerned from the ancestorId supplied 047 */ 048 boolean hasDescendants( String ancestorId ) throws LdapException; 049 050 051 /** 052 * Get's an iterator over the set of descendant ObjectClasses for 053 * some ancestor's name alias or their OID. 054 * 055 * @param ancestorId the name alias or OID for an ObjectClass 056 * @return an Iterator over the ObjectClasses which have the ancestor 057 * within their superior chain to the top 058 * @throws LdapException if the ancestor ObjectClass cannot be 059 * discerned from the ancestorId supplied 060 */ 061 Iterator<ObjectClass> descendants( String ancestorId ) throws LdapException; 062 063 064 /** 065 * Store the ObjectClass into a map associating an ObjectClass to its 066 * descendants. 067 * 068 * @param attributeType The ObjectClass to register 069 * @throws LdapException If something went wrong 070 */ 071 void registerDescendants( ObjectClass objectClass, List<ObjectClass> ancestors ) 072 throws LdapException; 073 074 075 /** 076 * Remove the ObjectClass from the map associating an ObjectClass to its 077 * descendants. 078 * 079 * @param attributeType The ObjectClass to unregister 080 * @param ancestor its ancestor 081 * @throws LdapException If something went wrong 082 */ 083 void unregisterDescendants( ObjectClass attributeType, List<ObjectClass> ancestors ) 084 throws LdapException; 085 086 087 /** 088 * Registers a new ObjectClass with this registry. 089 * 090 * @param objectClass the ObjectClass to register 091 * @throws LdapException if the ObjectClass is already registered or 092 * the registration operation is not supported 093 */ 094 void register( ObjectClass objectClass ) throws LdapException; 095 096 097 /** 098 * Removes the ObjectClass registered with this registry. 099 * 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 }