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.server.schema.registries; 21 22 23 import org.apache.directory.shared.ldap.schema.AttributeType; 24 import org.apache.directory.shared.ldap.schema.OidNormalizer; 25 26 import javax.naming.NamingException; 27 import java.util.Iterator; 28 import java.util.Map; 29 import java.util.Set; 30 31 32 /** 33 * An AttributeType registry service interface. 34 * 35 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 36 * @version $Rev: 582700 $ 37 */ 38 public interface AttributeTypeRegistry extends SchemaObjectRegistry 39 { 40 /** 41 * Registers a new AttributeType with this registry. 42 * 43 * @param attributeType the AttributeType to register 44 * @throws NamingException if the AttributeType is already registered or 45 * the registration operation is not supported 46 */ 47 void register( AttributeType attributeType ) throws NamingException; 48 49 50 /** 51 * Gets a set of Strings representing the aliases, and numeric identifiers of 52 * all binary attributes. The set will contain all the aliases for a binary 53 * attributeType (one whose syntax is not human readible) along with its numeric 54 * identifier. 55 * 56 * @return set of aliases and numeric ids for binary attributeTypes 57 * @throws NamingException if there are issues resolving type information 58 */ 59 Set<String> getBinaryAttributes() throws NamingException; 60 61 /** 62 * Looks up an AttributeType by its unique Object Identifier or by its 63 * unique name. 64 * 65 * @param id the object identifier or name of the AttributeType 66 * @return the AttributeType instance for the oid 67 * @throws NamingException if the AttributeType does not exist 68 */ 69 AttributeType lookup( String id ) throws NamingException; 70 71 72 /** 73 * Checks to see if an AttributeType exists. 74 * 75 * @param id the object identifier or name of the AttributeType 76 * @return true if an AttributeType definition exists for the oid, false 77 * otherwise 78 */ 79 boolean hasAttributeType( String id ); 80 81 82 /** 83 * Gets an Iterator over the AttributeTypes within this registry. 84 * 85 * @return an iterator over all AttributeTypes in registry 86 */ 87 Iterator<AttributeType> iterator(); 88 89 90 /** 91 * Gets an oid/name to normalizer mapping used to normalize distinguished 92 * names. 93 * 94 * @return a map of OID Strings to OidNormalizer instances 95 * @throws NamingException if for some reason this information cannot be returned 96 */ 97 Map<String, OidNormalizer> getNormalizerMapping() throws NamingException; 98 99 /** 100 * Quick lookup to see if an attribute has descendants. 101 * 102 * @param ancestorId the name alias or OID for an attributeType 103 * @return an Iterator over the AttributeTypes which have the ancestor 104 * within their superior chain to the top 105 * @throws NamingException if the ancestor attributeType cannot be 106 * discerned from the ancestorId supplied 107 */ 108 boolean hasDescendants( String ancestorId ) throws NamingException; 109 110 /** 111 * Get's an iterator over the set of descendant attributeTypes for 112 * some ancestor's name alias or their OID. 113 * 114 * @param ancestorId the name alias or OID for an attributeType 115 * @return an Iterator over the AttributeTypes which have the ancestor 116 * within their superior chain to the top 117 * @throws NamingException if the ancestor attributeType cannot be 118 * discerned from the ancestorId supplied 119 */ 120 Iterator<AttributeType> descendants( String ancestorId ) throws NamingException; 121 }