org.apache.directory.server.schema.registries
Class DefaultAttributeTypeRegistry

java.lang.Object
  extended by org.apache.directory.server.schema.registries.DefaultAttributeTypeRegistry
All Implemented Interfaces:
AttributeTypeRegistry, SchemaObjectRegistry

public class DefaultAttributeTypeRegistry
extends java.lang.Object
implements AttributeTypeRegistry

A plain old java object implementation of an AttributeTypeRegistry.

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

Constructor Summary
DefaultAttributeTypeRegistry(OidRegistry oidRegistry)
          Creates an empty DefaultAttributeTypeRegistry.
 
Method Summary
 java.util.Iterator<org.apache.directory.shared.ldap.schema.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.Set<java.lang.String> getBinaryAttributes()
          Gets a set of Strings representing the aliases, and numeric identifiers of all binary attributes.
 java.util.Map<java.lang.String,org.apache.directory.shared.ldap.schema.OidNormalizer> getNormalizerMapping()
          Gets an oid/name to normalizer mapping used to normalize distinguished names.
 java.lang.String getSchemaName(java.lang.String id)
          Gets the name of the schema this schema object is associated with.
 boolean hasAttributeType(java.lang.String id)
          Checks to see if an AttributeType exists.
 boolean hasDescendants(java.lang.String ancestorId)
          Quick lookup to see if an attribute has descendants.
 java.util.Iterator<org.apache.directory.shared.ldap.schema.AttributeType> iterator()
          Gets an Iterator over the AttributeTypes within this registry.
 java.util.Iterator list()
           
 org.apache.directory.shared.ldap.schema.AttributeType lookup(java.lang.String id)
          Looks up an AttributeType by its unique Object Identifier or by its unique name.
protected  void onRegisterAddToAncestorDescendants(org.apache.directory.shared.ldap.schema.AttributeType newType, org.apache.directory.shared.ldap.schema.AttributeType ancestor)
          Recursively adds a new attributeType to the descendant's list of all ancestors until top is reached.
 void register(org.apache.directory.shared.ldap.schema.AttributeType attributeType)
          Registers a new AttributeType with this registry.
 void registerDescendants(org.apache.directory.shared.ldap.schema.AttributeType attributeType)
           
 void unregister(java.lang.String numericOid)
          Removes the SchemaObject registered with this registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultAttributeTypeRegistry

public DefaultAttributeTypeRegistry(OidRegistry oidRegistry)
Creates an empty DefaultAttributeTypeRegistry.

Parameters:
oidRegistry - used by this registry for OID to name resolution of dependencies and to automatically register and unregister it's aliases and OIDs
Method Detail

register

public void register(org.apache.directory.shared.ldap.schema.AttributeType attributeType)
              throws javax.naming.NamingException
Description copied from interface: AttributeTypeRegistry
Registers a new AttributeType with this registry.

Specified by:
register in interface AttributeTypeRegistry
Parameters:
attributeType - the AttributeType to register
Throws:
javax.naming.NamingException - if the AttributeType is already registered or the registration operation is not supported

getBinaryAttributes

public java.util.Set<java.lang.String> getBinaryAttributes()
                                                    throws javax.naming.NamingException
Description copied from interface: AttributeTypeRegistry
Gets a set of Strings representing the aliases, and numeric identifiers of all binary attributes. The set will contain all the aliases for a binary attributeType (one whose syntax is not human readible) along with its numeric identifier.

Specified by:
getBinaryAttributes in interface AttributeTypeRegistry
Returns:
set of aliases and numeric ids for binary attributeTypes
Throws:
javax.naming.NamingException - if there are issues resolving type information

registerDescendants

public void registerDescendants(org.apache.directory.shared.ldap.schema.AttributeType attributeType)
                         throws javax.naming.NamingException
Throws:
javax.naming.NamingException

onRegisterAddToAncestorDescendants

protected void onRegisterAddToAncestorDescendants(org.apache.directory.shared.ldap.schema.AttributeType newType,
                                                  org.apache.directory.shared.ldap.schema.AttributeType ancestor)
                                           throws javax.naming.NamingException
Recursively adds a new attributeType to the descendant's list of all ancestors until top is reached. Top will not have the new type added.

Parameters:
newType - the new attributeType being added
ancestor - some anscestor from superior up to and including top
Throws:
javax.naming.NamingException - if there are resolution failures

lookup

public org.apache.directory.shared.ldap.schema.AttributeType lookup(java.lang.String id)
                                                             throws javax.naming.NamingException
Description copied from interface: AttributeTypeRegistry
Looks up an AttributeType by its unique Object Identifier or by its unique name.

Specified by:
lookup in interface AttributeTypeRegistry
Parameters:
id - the object identifier or name of the AttributeType
Returns:
the AttributeType instance for the oid
Throws:
javax.naming.NamingException - if the AttributeType does not exist

hasAttributeType

public boolean hasAttributeType(java.lang.String id)
Description copied from interface: AttributeTypeRegistry
Checks to see if an AttributeType exists.

Specified by:
hasAttributeType in interface AttributeTypeRegistry
Parameters:
id - the object identifier or name of the AttributeType
Returns:
true if an AttributeType definition exists for the oid, false otherwise

getSchemaName

public java.lang.String getSchemaName(java.lang.String id)
                               throws javax.naming.NamingException
Description copied from interface: SchemaObjectRegistry
Gets the name of the schema this schema object is associated with.

Specified by:
getSchemaName in interface SchemaObjectRegistry
Parameters:
id - the object identifier or the name
Returns:
the schema name
Throws:
javax.naming.NamingException - if the schema object does not exist

list

public java.util.Iterator list()

getNormalizerMapping

public java.util.Map<java.lang.String,org.apache.directory.shared.ldap.schema.OidNormalizer> getNormalizerMapping()
                                                                                                           throws javax.naming.NamingException
Description copied from interface: AttributeTypeRegistry
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
Throws:
javax.naming.NamingException - if for some reason this information cannot be returned

descendants

public java.util.Iterator<org.apache.directory.shared.ldap.schema.AttributeType> descendants(java.lang.String ancestorId)
                                                                                      throws javax.naming.NamingException
Description copied from interface: AttributeTypeRegistry
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:
javax.naming.NamingException - if the ancestor attributeType cannot be discerned from the ancestorId supplied

hasDescendants

public boolean hasDescendants(java.lang.String ancestorId)
                       throws javax.naming.NamingException
Description copied from interface: AttributeTypeRegistry
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:
javax.naming.NamingException - if the ancestor attributeType cannot be discerned from the ancestorId supplied

iterator

public java.util.Iterator<org.apache.directory.shared.ldap.schema.AttributeType> iterator()
Description copied from interface: AttributeTypeRegistry
Gets an Iterator over the AttributeTypes within this registry.

Specified by:
iterator in interface AttributeTypeRegistry
Specified by:
iterator in interface SchemaObjectRegistry
Returns:
an iterator over all AttributeTypes in registry

unregister

public void unregister(java.lang.String numericOid)
                throws javax.naming.NamingException
Description copied from interface: SchemaObjectRegistry
Removes the SchemaObject registered with this registry.

Specified by:
unregister in interface SchemaObjectRegistry
Parameters:
numericOid - the numeric identifier
Throws:
javax.naming.NamingException - if the numeric identifier is invalid


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