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.api.ldap.model.schema.registries; 021 022 023import java.util.Iterator; 024import java.util.List; 025 026import org.apache.directory.api.ldap.model.exception.LdapException; 027import org.apache.directory.api.ldap.model.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 */ 035public interface ObjectClassRegistry extends SchemaObjectRegistry<ObjectClass>, 036 Iterable<ObjectClass> 037{ 038 /** 039 * Quick lookup to see if an objectClass has descendants. 040 * 041 * @param ancestorId the name alias or OID for an ObjectClass 042 * @return an Iterator over the ObjectClasses which have the ancestor 043 * within their superior chain to the top 044 * @throws LdapException if the ancestor ObjectClass cannot be 045 * discerned from the ancestorId supplied 046 */ 047 boolean hasDescendants( String ancestorId ) throws LdapException; 048 049 050 /** 051 * Get's an iterator over the set of descendant ObjectClasses for 052 * some ancestor's name alias or their OID. 053 * 054 * @param ancestorId the name alias or OID for an ObjectClass 055 * @return an Iterator over the ObjectClasses which have the ancestor 056 * within their superior chain to the top 057 * @throws LdapException if the ancestor ObjectClass cannot be 058 * discerned from the ancestorId supplied 059 */ 060 Iterator<ObjectClass> descendants( String ancestorId ) throws LdapException; 061 062 063 /** 064 * Store the ObjectClass into a map associating an ObjectClass to its 065 * descendants. 066 * 067 * @param objectClass The ObjectClass to register 068 * @param ancestors Its ancestors 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 ancestors its ancestors 081 * @throws org.apache.directory.api.ldap.model.exception.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}