Class ImmutableAttributeTypeRegistry
java.lang.Object
org.apache.directory.api.ldap.model.schema.registries.ImmutableAttributeTypeRegistry
- All Implemented Interfaces:
Iterable<AttributeType>, AttributeTypeRegistry, SchemaObjectRegistry<AttributeType>
An immutable wrapper of the AttributeType registry.
- Author:
- Apache Directory Project
-
Constructor Summary
ConstructorsConstructorDescriptionImmutableAttributeTypeRegistry(AttributeTypeRegistry attributeTypeRegistry) Creates a new instance of ImmutableAttributeTypeRegistry. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMappingFor(AttributeType attributeType) Add a new Oid/Normalizer couple in the OidNormalizer mapvoidclear()Clear the registry from all its contentbooleanChecks to see if an SchemaObject exists in the registry, by its OID or name.copy()Copy the AttributeTypeRegistrydescendants(String ancestorId) Get's an iterator over the set of descendant attributeTypes for some ancestor's name alias or their OID.descendants(AttributeType ancestor) Get's an iterator over the set of descendant attributeTypes for some ancestor's name alias or their OID.Gets the SchemaObject associated with a given OID.Gets an oid/name to normalizer mapping used to normalize distinguished names.getOidByName(String name) Gets the numericOid for a name/alias if one is associated.getSchemaName(String oid) Gets the name of the schema this schema object is associated with.getType()booleanhasDescendants(String ancestorId) Quick lookup to see if an attribute has descendants.booleanhasDescendants(AttributeType ancestor) Quick lookup to see if an attribute has descendants.iterator()Gets an iterator over the registered schema objects in the registry.Looks up a SchemaObject by its unique Object Identifier or by name.Gets an iterator over the registered schema objects'OID in the registry.voidregister(AttributeType attributeType) Registers a new SchemaObject with this registry.voidregisterDescendants(AttributeType attributeType, AttributeType ancestor) Store the AttributeType into a map associating an AttributeType to its descendants.voidremoveMappingFor(AttributeType attributeType) Remove a new Oid/Normalizer couple in the OidNormalizer mapvoidrenameSchema(String originalSchemaName, String newSchemaName) Modify all the SchemaObject using a schemaName when this name changes.intsize()toString()unregister(String numericOid) Removes the SchemaObject registered with this registry, using its numeric OID.unregister(AttributeType schemaObject) Removes the SchemaObject registered with this registry.voidunregisterDescendants(AttributeType attributeType, AttributeType ancestor) Remove the AttributeType from the map associating an AttributeType to its descendants.voidunregisterSchemaElements(String schemaName) Unregisters all SchemaObjects defined for a specific schema from this registry.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
ImmutableAttributeTypeRegistry
Creates a new instance of ImmutableAttributeTypeRegistry.- Parameters:
attributeTypeRegistry- The wrapped AttributeType registry
-
-
Method Details
-
getNormalizerMapping
Gets an oid/name to normalizer mapping used to normalize distinguished names.- Specified by:
getNormalizerMappingin interfaceAttributeTypeRegistry- Returns:
- a map of OID Strings to OidNormalizer instances
-
hasDescendants
Quick lookup to see if an attribute has descendants.- Specified by:
hasDescendantsin 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
Quick lookup to see if an attribute has descendants.- Specified by:
hasDescendantsin 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
Get's an iterator over the set of descendant attributeTypes for some ancestor's name alias or their OID.- Specified by:
descendantsin 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
Get's an iterator over the set of descendant attributeTypes for some ancestor's name alias or their OID.- Specified by:
descendantsin 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
-
register
Registers a new SchemaObject with this registry.- Specified by:
registerin interfaceSchemaObjectRegistry<AttributeType>- Parameters:
attributeType- the SchemaObject to register- Throws:
LdapException- if the SchemaObject is already registered or the registration operation is not supported
-
registerDescendants
public void registerDescendants(AttributeType attributeType, AttributeType ancestor) throws LdapException Store the AttributeType into a map associating an AttributeType to its descendants.- Specified by:
registerDescendantsin 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:
unregisterDescendantsin interfaceAttributeTypeRegistry- Parameters:
attributeType- The attributeType to unregisterancestor- its ancestor- Throws:
LdapException- If something went wrong
-
unregister
Removes the SchemaObject registered with this registry, using its numeric OID.- Specified by:
unregisterin interfaceSchemaObjectRegistry<AttributeType>- Parameters:
numericOid- the numeric identifier- Returns:
- The unregistred schema object
- Throws:
LdapException- if the numeric identifier is invalid
-
addMappingFor
Add a new Oid/Normalizer couple in the OidNormalizer map- Specified by:
addMappingForin interfaceAttributeTypeRegistry- Parameters:
attributeType- The AttributeType to add- Throws:
LdapException- If something went wrong
-
removeMappingFor
Remove a new Oid/Normalizer couple in the OidNormalizer map- Specified by:
removeMappingForin interfaceAttributeTypeRegistry- Parameters:
attributeType- The AttributeType to remove- Throws:
LdapException- If something went wrong
-
lookup
Looks up a SchemaObject by its unique Object Identifier or by name.- Specified by:
lookupin interfaceSchemaObjectRegistry<AttributeType>- Parameters:
oid- the object identifier or name- Returns:
- the SchemaObject instance for the id
- Throws:
LdapException- if the SchemaObject does not exist
-
toString
-
copy
Copy the AttributeTypeRegistry- Specified by:
copyin interfaceAttributeTypeRegistry- Specified by:
copyin interfaceSchemaObjectRegistry<AttributeType>- Returns:
- The copied AttributeTypeRegistry
-
size
public int size()- Specified by:
sizein interfaceSchemaObjectRegistry<AttributeType>- Returns:
- The number of AttributeType stored
-
iterator
Gets an iterator over the registered schema objects in the registry.- Specified by:
iteratorin interfaceIterable<AttributeType>- Specified by:
iteratorin interfaceSchemaObjectRegistry<AttributeType>- Returns:
- an Iterator of homogeneous schema objects
-
oidsIterator
Gets an iterator over the registered schema objects'OID in the registry.- Specified by:
oidsIteratorin interfaceSchemaObjectRegistry<AttributeType>- Returns:
- an Iterator of OIDs
-
contains
Checks to see if an SchemaObject exists in the registry, by its OID or name.- Specified by:
containsin interfaceSchemaObjectRegistry<AttributeType>- Parameters:
oid- the object identifier or name of the SchemaObject- Returns:
- true if a SchemaObject definition exists for the oid, false otherwise
-
getOidByName
Gets the numericOid for a name/alias if one is associated. To prevent lookup failures due to case variance in the name, a failure to lookup the OID, will trigger a lookup using a lower cased version of the name and the name that failed to match will automatically be associated with the OID.- Specified by:
getOidByNamein interfaceSchemaObjectRegistry<AttributeType>- Parameters:
name- The name we are looking the oid for- Returns:
- The numericOID associated with this name
- Throws:
LdapException- If the OID can't be found
-
getSchemaName
Gets the name of the schema this schema object is associated with.- Specified by:
getSchemaNamein interfaceSchemaObjectRegistry<AttributeType>- Parameters:
oid- the object identifier or the name- Returns:
- the schema name
- Throws:
LdapException- if the schema object does not exist
-
getType
- Specified by:
getTypein interfaceSchemaObjectRegistry<AttributeType>- Returns:
- the type
-
renameSchema
Modify all the SchemaObject using a schemaName when this name changes.- Specified by:
renameSchemain interfaceSchemaObjectRegistry<AttributeType>- Parameters:
originalSchemaName- The original Schema namenewSchemaName- The new Schema name
-
unregisterSchemaElements
Unregisters all SchemaObjects defined for a specific schema from this registry.- Specified by:
unregisterSchemaElementsin interfaceSchemaObjectRegistry<AttributeType>- Parameters:
schemaName- the name of the schema whose SchemaObjects will be removed from- Throws:
LdapException- If we had a problem while unregistering the schema
-
get
Gets the SchemaObject associated with a given OID.- Specified by:
getin interfaceSchemaObjectRegistry<AttributeType>- Parameters:
oid- The SchemaObject's OID we are looking for- Returns:
- The SchemaObject, if any. Null otherwise
-
clear
Clear the registry from all its content- Specified by:
clearin interfaceSchemaObjectRegistry<AttributeType>- Throws:
LdapException- If we had a failure while clearing the registry
-
unregister
Removes the SchemaObject registered with this registry.- Specified by:
unregisterin interfaceSchemaObjectRegistry<AttributeType>- Parameters:
schemaObject- the schemaObject to unregister- Returns:
- The unregistred schema object
- Throws:
LdapException- if the schemaObject can't be unregistered is invalid
-