org.apache.directory.server.core.schema.bootstrap
Class BootstrapAttributeTypeRegistry

java.lang.Object
  extended byorg.apache.directory.server.core.schema.bootstrap.BootstrapAttributeTypeRegistry
All Implemented Interfaces:
AttributeTypeRegistry

public class BootstrapAttributeTypeRegistry
extends java.lang.Object
implements AttributeTypeRegistry

A plain old java object implementation of an AttributeTypeRegistry.

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

Constructor Summary
BootstrapAttributeTypeRegistry(OidRegistry oidRegistry)
          Creates an empty BootstrapAttributeTypeRegistry.
 
Method Summary
 java.util.Iterator 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 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 list()
          Gets an Iterator over the AttributeTypes within this registry.
 AttributeType lookup(java.lang.String id)
          Looks up an AttributeType by its unique Object Identifier or by its unique name.
protected  void onRegisterAddToAncestorDescendants(AttributeType newType, AttributeType ancestor)
          Recursively adds a new attributeType to the descendant's list of all ancestors until top is reached.
 void register(java.lang.String schema, AttributeType attributeType)
          Registers a new AttributeType with this registry.
 void registerDescendants(AttributeType attributeType)
           
 void setMonitor(AttributeTypeRegistryMonitor monitor)
          Sets the monitor that is to be notified via callback events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BootstrapAttributeTypeRegistry

public BootstrapAttributeTypeRegistry(OidRegistry oidRegistry)
Creates an empty BootstrapAttributeTypeRegistry.

Method Detail

setMonitor

public void setMonitor(AttributeTypeRegistryMonitor monitor)
Sets the monitor that is to be notified via callback events.

Parameters:
monitor - the new monitor to notify of notable events

register

public void register(java.lang.String 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:
schema - the name of the schema the AttributeType is associated with
attributeType - the AttributeType to register
Throws:
javax.naming.NamingException - if the AttributeType is already registered or the registration operation is not supported

registerDescendants

public void registerDescendants(AttributeType attributeType)
                         throws javax.naming.NamingException
Throws:
javax.naming.NamingException

onRegisterAddToAncestorDescendants

protected void onRegisterAddToAncestorDescendants(AttributeType newType,
                                                  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

lookup

public 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: AttributeTypeRegistry
Gets the name of the schema this schema object is associated with.

Specified by:
getSchemaName in interface AttributeTypeRegistry
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()
Description copied from interface: AttributeTypeRegistry
Gets an Iterator over the AttributeTypes within this registry.

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

getNormalizerMapping

public java.util.Map 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
Throws:
javax.naming.NamingException

descendants

public java.util.Iterator 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