Class ImmutableNormalizerRegistry
- java.lang.Object
-
- org.apache.directory.api.ldap.model.schema.registries.ImmutableNormalizerRegistry
-
- All Implemented Interfaces:
Iterable<Normalizer>,NormalizerRegistry,SchemaObjectRegistry<Normalizer>
public class ImmutableNormalizerRegistry extends Object implements NormalizerRegistry
An immutable wrapper of the Normalizer registry.- Author:
- Apache Directory Project
-
-
Field Summary
Fields Modifier and Type Field Description (package private) NormalizerRegistryimmutableNormalizerRegistryThe wrapped Normalizer registry
-
Constructor Summary
Constructors Constructor Description ImmutableNormalizerRegistry(NormalizerRegistry normalizerRegistry)Creates a new immutable NormalizerRegistry instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the registry from all its contentbooleancontains(String oid)Checks to see if an SchemaObject exists in the registry, by its OID or name.ImmutableNormalizerRegistrycopy()Copy the NormalizerRegistryNormalizerget(String oid)Gets the SchemaObject associated with a given OID.StringgetOidByName(String name)Gets the numericOid for a name/alias if one is associated.StringgetSchemaName(String oid)Gets the name of the schema this schema object is associated with.SchemaObjectTypegetType()Iterator<Normalizer>iterator()Gets an iterator over the registered schema objects in the registry.Normalizerlookup(String oid)Looks up a SchemaObject by its unique Object Identifier or by name.Iterator<String>oidsIterator()Gets an iterator over the registered schema objects'OID in the registry.voidregister(Normalizer normalizer)Registers a new Normalizer with this registry.voidrenameSchema(String originalSchemaName, String newSchemaName)Modify all the SchemaObject using a schemaName when this name changes.intsize()Normalizerunregister(String numericOid)Removes the Normalizer registered with this registry, using its numeric OID.Normalizerunregister(Normalizer schemaObject)Removes the SchemaObject registered with this registry.voidunregisterSchemaElements(String schemaName)Unregisters all Normalizers defined for a specific schema from this registry.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
immutableNormalizerRegistry
NormalizerRegistry immutableNormalizerRegistry
The wrapped Normalizer registry
-
-
Constructor Detail
-
ImmutableNormalizerRegistry
public ImmutableNormalizerRegistry(NormalizerRegistry normalizerRegistry)
Creates a new immutable NormalizerRegistry instance.- Parameters:
normalizerRegistry- The wrapped Normalizer registry
-
-
Method Detail
-
register
public void register(Normalizer normalizer) throws LdapException
Registers a new Normalizer with this registry.- Specified by:
registerin interfaceNormalizerRegistry- Specified by:
registerin interfaceSchemaObjectRegistry<Normalizer>- Parameters:
normalizer- the Normalizer to register- Throws:
LdapException- if the Normalizer is already registered or the registration operation is not supported
-
unregister
public Normalizer unregister(String numericOid) throws LdapException
Removes the Normalizer registered with this registry, using its numeric OID.- Specified by:
unregisterin interfaceNormalizerRegistry- Specified by:
unregisterin interfaceSchemaObjectRegistry<Normalizer>- Parameters:
numericOid- the numeric identifier- Returns:
- The unregistred schema object
- Throws:
LdapException- if the numeric identifier is invalid
-
unregisterSchemaElements
public void unregisterSchemaElements(String schemaName) throws LdapException
Unregisters all Normalizers defined for a specific schema from this registry.- Specified by:
unregisterSchemaElementsin interfaceNormalizerRegistry- Specified by:
unregisterSchemaElementsin interfaceSchemaObjectRegistry<Normalizer>- Parameters:
schemaName- the name of the schema whose Normalizers will be removed from- Throws:
LdapException- If we had a problem while unregistering the schema
-
copy
public ImmutableNormalizerRegistry copy()
Copy the NormalizerRegistry- Specified by:
copyin interfaceNormalizerRegistry- Specified by:
copyin interfaceSchemaObjectRegistry<Normalizer>- Returns:
- The copied registry
-
size
public int size()
- Specified by:
sizein interfaceSchemaObjectRegistry<Normalizer>- Returns:
- The number of AttributeType stored
-
contains
public boolean contains(String oid)
Checks to see if an SchemaObject exists in the registry, by its OID or name.- Specified by:
containsin interfaceSchemaObjectRegistry<Normalizer>- Parameters:
oid- the object identifier or name of the SchemaObject- Returns:
- true if a SchemaObject definition exists for the oid, false otherwise
-
getOidByName
public String getOidByName(String name) throws LdapException
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<Normalizer>- 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
public String getSchemaName(String oid) throws LdapException
Gets the name of the schema this schema object is associated with.- Specified by:
getSchemaNamein interfaceSchemaObjectRegistry<Normalizer>- Parameters:
oid- the object identifier or the name- Returns:
- the schema name
- Throws:
LdapException- if the schema object does not exist
-
getType
public SchemaObjectType getType()
- Specified by:
getTypein interfaceSchemaObjectRegistry<Normalizer>- Returns:
- the type
-
iterator
public Iterator<Normalizer> iterator()
Gets an iterator over the registered schema objects in the registry.- Specified by:
iteratorin interfaceIterable<Normalizer>- Specified by:
iteratorin interfaceSchemaObjectRegistry<Normalizer>- Returns:
- an Iterator of homogeneous schema objects
-
lookup
public Normalizer lookup(String oid) throws LdapException
Looks up a SchemaObject by its unique Object Identifier or by name.- Specified by:
lookupin interfaceSchemaObjectRegistry<Normalizer>- Parameters:
oid- the object identifier or name- Returns:
- the SchemaObject instance for the id
- Throws:
LdapException- if the SchemaObject does not exist
-
oidsIterator
public Iterator<String> oidsIterator()
Gets an iterator over the registered schema objects'OID in the registry.- Specified by:
oidsIteratorin interfaceSchemaObjectRegistry<Normalizer>- Returns:
- an Iterator of OIDs
-
renameSchema
public void renameSchema(String originalSchemaName, String newSchemaName) throws LdapException
Modify all the SchemaObject using a schemaName when this name changes.- Specified by:
renameSchemain interfaceSchemaObjectRegistry<Normalizer>- Parameters:
originalSchemaName- The original Schema namenewSchemaName- The new Schema name- Throws:
LdapException- if the schema object does not exist
-
get
public Normalizer get(String oid)
Gets the SchemaObject associated with a given OID.- Specified by:
getin interfaceSchemaObjectRegistry<Normalizer>- Parameters:
oid- The SchemaObject's OID we are looking for- Returns:
- The SchemaObject, if any. Null otherwise
-
clear
public void clear() throws LdapExceptionClear the registry from all its content- Specified by:
clearin interfaceSchemaObjectRegistry<Normalizer>- Throws:
LdapException- If we had a failure while clearing the registry
-
unregister
public Normalizer unregister(Normalizer schemaObject) throws LdapException
Removes the SchemaObject registered with this registry.- Specified by:
unregisterin interfaceSchemaObjectRegistry<Normalizer>- Parameters:
schemaObject- the schemaObject to unregister- Returns:
- The unregistred schema object
- Throws:
LdapException- if the schemaObject can't be unregistered is invalid
-
-