Class ImmutableObjectClassRegistry
java.lang.Object
org.apache.directory.api.ldap.model.schema.registries.ImmutableObjectClassRegistry
- All Implemented Interfaces:
Cloneable, Iterable<ObjectClass>, ObjectClassRegistry, SchemaObjectRegistry<ObjectClass>
An immutable wrapper of the ObjectClass registry.
- Author:
- Apache Directory Project
-
Constructor Summary
ConstructorsConstructorDescriptionImmutableObjectClassRegistry(ObjectClassRegistry ocRegistry) Creates a new instance of ImmutableAttributeTypeRegistry. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the registry from all its contentbooleanChecks to see if an SchemaObject exists in the registry, by its OID or name.copy()Clone the ObjectClassRegistrydescendants(String ancestorId) Get's an iterator over the set of descendant ObjectClasses for some ancestor's name alias or their OID.Gets the SchemaObject associated with a given OID.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 objectClass 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(ObjectClass objectClass) Registers a new ObjectClass with this registry.voidregisterDescendants(ObjectClass objectClass, List<ObjectClass> ancestors) Store the ObjectClass into a map associating an ObjectClass to its descendants.voidrenameSchema(String originalSchemaName, String newSchemaName) Modify all the SchemaObject using a schemaName when this name changes.intsize()unregister(String numericOid) Removes the ObjectClass registered with this registry.unregister(ObjectClass schemaObject) Removes the SchemaObject registered with this registry.voidunregisterDescendants(ObjectClass attributeType, List<ObjectClass> ancestors) Remove the ObjectClass from the map associating an ObjectClass 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, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Constructor Details
-
ImmutableObjectClassRegistry
Creates a new instance of ImmutableAttributeTypeRegistry.- Parameters:
ocRegistry- The wrapped Attrib uteType registry
-
-
Method Details
-
hasDescendants
Quick lookup to see if an objectClass has descendants.- Specified by:
hasDescendantsin interfaceObjectClassRegistry- Parameters:
ancestorId- the name alias or OID for an ObjectClass- Returns:
- an Iterator over the ObjectClasses which have the ancestor within their superior chain to the top
- Throws:
LdapException- if the ancestor ObjectClass cannot be discerned from the ancestorId supplied
-
descendants
Get's an iterator over the set of descendant ObjectClasses for some ancestor's name alias or their OID.- Specified by:
descendantsin interfaceObjectClassRegistry- Parameters:
ancestorId- the name alias or OID for an ObjectClass- Returns:
- an Iterator over the ObjectClasses which have the ancestor within their superior chain to the top
- Throws:
LdapException- if the ancestor ObjectClass cannot be discerned from the ancestorId supplied
-
registerDescendants
public void registerDescendants(ObjectClass objectClass, List<ObjectClass> ancestors) throws LdapException Store the ObjectClass into a map associating an ObjectClass to its descendants.- Specified by:
registerDescendantsin interfaceObjectClassRegistry- Parameters:
objectClass- The ObjectClass to registerancestors- Its ancestors- Throws:
LdapException- If something went wrong
-
unregisterDescendants
public void unregisterDescendants(ObjectClass attributeType, List<ObjectClass> ancestors) throws LdapException Remove the ObjectClass from the map associating an ObjectClass to its descendants.- Specified by:
unregisterDescendantsin interfaceObjectClassRegistry- Parameters:
attributeType- The ObjectClass to unregisterancestors- its ancestors- Throws:
LdapException- If something went wrong
-
register
Registers a new ObjectClass with this registry.- Specified by:
registerin interfaceObjectClassRegistry- Specified by:
registerin interfaceSchemaObjectRegistry<ObjectClass>- Parameters:
objectClass- the ObjectClass to register- Throws:
LdapException- if the ObjectClass is already registered or the registration operation is not supported
-
unregister
Removes the ObjectClass registered with this registry.- Specified by:
unregisterin interfaceObjectClassRegistry- Specified by:
unregisterin interfaceSchemaObjectRegistry<ObjectClass>- Parameters:
numericOid- the numeric identifier- Returns:
- The unregistred schema object
- Throws:
LdapException- if the numeric identifier is invalid
-
copy
Clone the ObjectClassRegistry- Specified by:
copyin interfaceObjectClassRegistry- Specified by:
copyin interfaceSchemaObjectRegistry<ObjectClass>- Returns:
- The copied registry
-
size
public int size()- Specified by:
sizein interfaceSchemaObjectRegistry<ObjectClass>- Returns:
- The number of AttributeType stored
-
contains
Checks to see if an SchemaObject exists in the registry, by its OID or name.- Specified by:
containsin interfaceSchemaObjectRegistry<ObjectClass>- 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<ObjectClass>- 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<ObjectClass>- 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<ObjectClass>- Returns:
- the type
-
iterator
Gets an iterator over the registered schema objects in the registry.- Specified by:
iteratorin interfaceIterable<ObjectClass>- Specified by:
iteratorin interfaceSchemaObjectRegistry<ObjectClass>- Returns:
- an Iterator of homogeneous schema objects
-
lookup
Looks up a SchemaObject by its unique Object Identifier or by name.- Specified by:
lookupin interfaceSchemaObjectRegistry<ObjectClass>- Parameters:
oid- the object identifier or name- Returns:
- the SchemaObject instance for the id
- Throws:
LdapException- if the SchemaObject does not exist
-
oidsIterator
Gets an iterator over the registered schema objects'OID in the registry.- Specified by:
oidsIteratorin interfaceSchemaObjectRegistry<ObjectClass>- Returns:
- an Iterator of OIDs
-
renameSchema
Modify all the SchemaObject using a schemaName when this name changes.- Specified by:
renameSchemain interfaceSchemaObjectRegistry<ObjectClass>- Parameters:
originalSchemaName- The original Schema namenewSchemaName- The new Schema name- Throws:
LdapException- if the schema object does not exist
-
unregisterSchemaElements
Unregisters all SchemaObjects defined for a specific schema from this registry.- Specified by:
unregisterSchemaElementsin interfaceSchemaObjectRegistry<ObjectClass>- 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<ObjectClass>- 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<ObjectClass>- Throws:
LdapException- If we had a failure while clearing the registry
-
unregister
Removes the SchemaObject registered with this registry.- Specified by:
unregisterin interfaceSchemaObjectRegistry<ObjectClass>- Parameters:
schemaObject- the schemaObject to unregister- Returns:
- The unregistred schema object
- Throws:
LdapException- if the schemaObject can't be unregistered is invalid
-