Class DefaultAttributeTypeRegistry
- java.lang.Object
-
- org.apache.directory.api.ldap.model.schema.registries.DefaultSchemaObjectRegistry<AttributeType>
-
- org.apache.directory.api.ldap.model.schema.registries.DefaultAttributeTypeRegistry
-
- All Implemented Interfaces:
Iterable<AttributeType>
,AttributeTypeRegistry
,SchemaObjectRegistry<AttributeType>
public class DefaultAttributeTypeRegistry extends DefaultSchemaObjectRegistry<AttributeType> implements AttributeTypeRegistry
An AttributeType registry service default implementation.- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description DefaultAttributeTypeRegistry()
Creates a new default AttributeTypeRegistry instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMappingFor(AttributeType attributeType)
Add a new Oid/Normalizer couple in the OidNormalizer mapvoid
clear()
Clear the registry from all its contentDefaultAttributeTypeRegistry
copy()
Copy the AttributeTypeRegistryIterator<AttributeType>
descendants(String ancestorId)
Get's an iterator over the set of descendant attributeTypes for some ancestor's name alias or their OID.Iterator<AttributeType>
descendants(AttributeType ancestor)
Get's an iterator over the set of descendant attributeTypes for some ancestor's name alias or their OID.Map<String,OidNormalizer>
getNormalizerMapping()
Gets an oid/name to normalizer mapping used to normalize distinguished names.boolean
hasDescendants(String ancestorId)
Quick lookup to see if an attribute has descendants.boolean
hasDescendants(AttributeType ancestor)
Quick lookup to see if an attribute has descendants.AttributeType
lookup(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 mapAttributeType
unregister(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.api.ldap.model.schema.registries.DefaultSchemaObjectRegistry
contains, copy, get, getErrorHandler, getOidByName, getSchemaName, getType, isRelaxed, isStrict, iterator, oidsIterator, register, renameSchema, setErrorHandler, setRelaxed, setStrict, size, toString, unregister, unregisterSchemaElements
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.apache.directory.api.ldap.model.schema.registries.SchemaObjectRegistry
contains, get, getOidByName, getSchemaName, getType, iterator, oidsIterator, register, renameSchema, size, unregister, unregisterSchemaElements
-
-
-
-
Constructor Detail
-
DefaultAttributeTypeRegistry
public DefaultAttributeTypeRegistry()
Creates a new default AttributeTypeRegistry instance.
-
-
Method Detail
-
getNormalizerMapping
public Map<String,OidNormalizer> getNormalizerMapping()
Gets an oid/name to normalizer mapping used to normalize distinguished names.- Specified by:
getNormalizerMapping
in interfaceAttributeTypeRegistry
- Returns:
- a map of OID Strings to OidNormalizer instances
-
hasDescendants
public boolean hasDescendants(String ancestorId) throws LdapException
Quick lookup to see if an attribute has descendants.- Specified by:
hasDescendants
in interfaceAttributeTypeRegistry
- 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
-
hasDescendants
public boolean hasDescendants(AttributeType ancestor) throws LdapException
Quick lookup to see if an attribute has descendants.- Specified by:
hasDescendants
in interfaceAttributeTypeRegistry
- Parameters:
ancestor
- the attributeType we are looking for- 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 Iterator<AttributeType> descendants(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 interfaceAttributeTypeRegistry
- 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 Iterator<AttributeType> descendants(AttributeType ancestor) 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 interfaceAttributeTypeRegistry
- Parameters:
ancestor
- the AttributeType we are looking for- 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 interfaceAttributeTypeRegistry
- Parameters:
attributeType
- The attributeType to registerancestor
- The attributeType's parent- 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 interfaceAttributeTypeRegistry
- Parameters:
attributeType
- The attributeType to unregisterancestor
- its ancestor- Throws:
LdapException
- If something went wrong
-
unregister
public AttributeType unregister(String numericOid) throws LdapException
Removes the SchemaObject registered with this registry, using its numeric OID.- Specified by:
unregister
in interfaceSchemaObjectRegistry<AttributeType>
- Overrides:
unregister
in classDefaultSchemaObjectRegistry<AttributeType>
- Parameters:
numericOid
- the numeric identifier- Returns:
- The unregistred schema object
- 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 interfaceAttributeTypeRegistry
- Parameters:
attributeType
- The AttributeType to add- Throws:
LdapException
- If something went wrong
-
removeMappingFor
public void removeMappingFor(AttributeType attributeType) throws LdapException
Remove the AttributeType normalizer from the OidNormalizer map- Specified by:
removeMappingFor
in interfaceAttributeTypeRegistry
- Parameters:
attributeType
- The AttributeType to remove- Throws:
LdapException
- If something went wrong
-
lookup
public AttributeType lookup(String oid) throws LdapException
Looks up a SchemaObject by its unique Object Identifier or by name.- Specified by:
lookup
in interfaceSchemaObjectRegistry<AttributeType>
- Overrides:
lookup
in classDefaultSchemaObjectRegistry<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 DefaultAttributeTypeRegistry copy()
Copy the AttributeTypeRegistry- Specified by:
copy
in interfaceAttributeTypeRegistry
- Specified by:
copy
in interfaceSchemaObjectRegistry<AttributeType>
- Returns:
- The copied AttributeTypeRegistry
-
clear
public void clear()
Clear the registry from all its content- Specified by:
clear
in interfaceSchemaObjectRegistry<AttributeType>
- Overrides:
clear
in classDefaultSchemaObjectRegistry<AttributeType>
-
-