org.apache.directory.shared.ldap.schema.registries
Class DefaultAttributeTypeRegistry

java.lang.Object
  extended by org.apache.directory.shared.ldap.schema.registries.DefaultSchemaObjectRegistry<AttributeType>
      extended by org.apache.directory.shared.ldap.schema.registries.DefaultAttributeTypeRegistry
All Implemented Interfaces:
java.lang.Iterable<AttributeType>, AttributeTypeRegistry, SchemaObjectRegistry<AttributeType>

public class DefaultAttributeTypeRegistry
extends DefaultSchemaObjectRegistry<AttributeType>
implements AttributeTypeRegistry

An AttributeType registry service default implementation.

Version:
$Rev: 828111 $
Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.ldap.schema.registries.DefaultSchemaObjectRegistry
byName, oidRegistry, schemaObjectType
 
Constructor Summary
DefaultAttributeTypeRegistry()
          Creates a new default AttributeTypeRegistry instance.
 
Method Summary
 void addMappingFor(AttributeType attributeType)
          Add a new Oid/Normalizer couple in the OidNormalizer map
 void clear()
          Clear the registry from all its content
 AttributeTypeRegistry copy()
          Copy the AttributeTypeRegistry
 java.util.Iterator<AttributeType> descendants(java.lang.String ancestorId)
          Get's an iterator over the set of descendant attributeTypes for some ancestor's name alias or their OID.
 java.util.Map<java.lang.String,OidNormalizer> getNormalizerMapping()
          Gets an oid/name to normalizer mapping used to normalize distinguished names.
 boolean hasDescendants(java.lang.String ancestorId)
          Quick lookup to see if an attribute has descendants.
 AttributeType lookup(java.lang.String oid)
          Looks up a SchemaObject by its unique Object Identifier or by name.
 void registerDescendants(AttributeType attributeType, AttributeType ancestor)
          Store the AttributeType into a map associating an AttributeType to its descendants.
 void removeMappingFor(AttributeType attributeType)
          Remove the AttributeType normalizer from the OidNormalizer map
 AttributeType unregister(java.lang.String numericOid)
          Removes the SchemaObject registered with this registry, using its numeric OID.
 void unregisterDescendants(AttributeType attributeType, AttributeType ancestor)
          Remove the AttributeType from the map associating an AttributeType to its descendants.
 
Methods inherited from class org.apache.directory.shared.ldap.schema.registries.DefaultSchemaObjectRegistry
contains, copy, get, getOidByName, getSchemaName, getType, iterator, oidsIterator, register, renameSchema, size, toString, unregister, unregisterSchemaElements
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.directory.shared.ldap.schema.registries.SchemaObjectRegistry
contains, get, getOidByName, getSchemaName, getType, iterator, oidsIterator, register, renameSchema, size, unregister, unregisterSchemaElements
 
Methods inherited from interface java.lang.Iterable
iterator
 

Constructor Detail

DefaultAttributeTypeRegistry

public DefaultAttributeTypeRegistry()
Creates a new default AttributeTypeRegistry instance.

Method Detail

getNormalizerMapping

public java.util.Map<java.lang.String,OidNormalizer> getNormalizerMapping()
Gets an oid/name to normalizer mapping used to normalize distinguished names.

Specified by:
getNormalizerMapping in interface AttributeTypeRegistry
Returns:
a map of OID Strings to OidNormalizer instances

hasDescendants

public boolean hasDescendants(java.lang.String ancestorId)
                       throws LdapException
Quick lookup to see if an attribute has descendants.

Specified by:
hasDescendants in interface AttributeTypeRegistry
Parameters:
ancestorId - the name alias or OID for an attributeType
Returns:
an Iterator over the AttributeTypes which have the ancestor within their superior chain to the top
Throws:
LdapException - if the ancestor attributeType cannot be discerned from the ancestorId supplied

descendants

public java.util.Iterator<AttributeType> descendants(java.lang.String ancestorId)
                                              throws LdapException
Get's an iterator over the set of descendant attributeTypes for some ancestor's name alias or their OID.

Specified by:
descendants in interface AttributeTypeRegistry
Parameters:
ancestorId - the name alias or OID for an attributeType
Returns:
an Iterator over the AttributeTypes which have the ancestor within their superior chain to the top
Throws:
LdapException - if the ancestor attributeType cannot be discerned from the ancestorId supplied

registerDescendants

public void registerDescendants(AttributeType attributeType,
                                AttributeType ancestor)
                         throws LdapException
Store the AttributeType into a map associating an AttributeType to its descendants.

Specified by:
registerDescendants in interface AttributeTypeRegistry
Parameters:
attributeType - The attributeType to register
Throws:
LdapException - If something went wrong

unregisterDescendants

public void unregisterDescendants(AttributeType attributeType,
                                  AttributeType ancestor)
                           throws LdapException
Remove the AttributeType from the map associating an AttributeType to its descendants.

Specified by:
unregisterDescendants in interface AttributeTypeRegistry
Parameters:
attributeType - The attributeType to unregister
ancestor - its ancestor
Throws:
LdapException - If something went wrong

unregister

public AttributeType unregister(java.lang.String numericOid)
                         throws LdapException
Removes the SchemaObject registered with this registry, using its numeric OID.

Specified by:
unregister in interface SchemaObjectRegistry<AttributeType>
Overrides:
unregister in class DefaultSchemaObjectRegistry<AttributeType>
Parameters:
numericOid - the numeric identifier
Throws:
LdapException - if the numeric identifier is invalid

addMappingFor

public void addMappingFor(AttributeType attributeType)
                   throws LdapException
Add a new Oid/Normalizer couple in the OidNormalizer map

Specified by:
addMappingFor in interface AttributeTypeRegistry
Throws:
LdapException

removeMappingFor

public void removeMappingFor(AttributeType attributeType)
                      throws LdapException
Remove the AttributeType normalizer from the OidNormalizer map

Specified by:
removeMappingFor in interface AttributeTypeRegistry
Throws:
LdapException

lookup

public AttributeType lookup(java.lang.String oid)
                     throws LdapException
Looks up a SchemaObject by its unique Object Identifier or by name.

Specified by:
lookup in interface SchemaObjectRegistry<AttributeType>
Overrides:
lookup in class DefaultSchemaObjectRegistry<AttributeType>
Parameters:
oid - the object identifier or name
Returns:
the SchemaObject instance for the id
Throws:
LdapException - if the SchemaObject does not exist

copy

public AttributeTypeRegistry copy()
Copy the AttributeTypeRegistry

Specified by:
copy in interface AttributeTypeRegistry
Specified by:
copy in interface SchemaObjectRegistry<AttributeType>
Returns:
SchemaObjectRegistry The copied registry

clear

public void clear()
Clear the registry from all its content

Specified by:
clear in interface SchemaObjectRegistry<AttributeType>
Overrides:
clear in class DefaultSchemaObjectRegistry<AttributeType>


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.