Class ImmutableDitStructureRuleRegistry
- java.lang.Object
-
- org.apache.directory.api.ldap.model.schema.registries.ImmutableDitStructureRuleRegistry
-
- All Implemented Interfaces:
Iterable<DitStructureRule>,DitStructureRuleRegistry,SchemaObjectRegistry<DitStructureRule>
public class ImmutableDitStructureRuleRegistry extends Object implements DitStructureRuleRegistry
An immutable wrapper of the DitStructureRule registry.- Author:
- Apache Directory Project
-
-
Field Summary
Fields Modifier and Type Field Description (package private) DitStructureRuleRegistryimmutableDITStructureRuleRegistryThe wrapped DitStructureRule registry
-
Constructor Summary
Constructors Constructor Description ImmutableDitStructureRuleRegistry(DitStructureRuleRegistry ditStructureRuleRegistry)Creates a new instance of ImmutableDitStructureRuleRegistry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the registry from all its contentbooleancontains(int ruleId)Checks to see if an DitStructureRule exists in the registry, by its ruleId.booleancontains(String oid)Checks to see if an SchemaObject exists in the registry, by its OID or name.ImmutableDitStructureRuleRegistrycopy()Copy the DitStructureRuleRegistryDitStructureRuleget(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(int ruleId)Gets the name of the schema this schema object is associated with.StringgetSchemaName(String oid)Gets the name of the schema this schema object is associated with.SchemaObjectTypegetType()Iterator<DitStructureRule>iterator()Gets an iterator over the registered descriptions in the registry.DitStructureRulelookup(int ruleId)Looks up an dITStructureRule by its unique Object IDentifier or by its name.DitStructureRulelookup(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(DitStructureRule ditStructureRule)Registers a new DitStructureRule with this registry.voidrenameSchema(String originalSchemaName, String newSchemaName)Modify all the DitStructureRule using a schemaName when this name changes.Iterator<Integer>ruleIdIterator()Gets an iterator over the registered ruleId in the registry.intsize()voidunregister(int ruleId)Unregisters a DitStructureRule using it's rule identifier.DitStructureRuleunregister(String numericOid)Removes the SchemaObject registered with this registry, using its numeric OID.DitStructureRuleunregister(DitStructureRule schemaObject)Removes the SchemaObject registered with this registry.voidunregisterSchemaElements(String schemaName)Unregisters all DITStructureRules 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
-
immutableDITStructureRuleRegistry
DitStructureRuleRegistry immutableDITStructureRuleRegistry
The wrapped DitStructureRule registry
-
-
Constructor Detail
-
ImmutableDitStructureRuleRegistry
public ImmutableDitStructureRuleRegistry(DitStructureRuleRegistry ditStructureRuleRegistry)
Creates a new instance of ImmutableDitStructureRuleRegistry.- Parameters:
ditStructureRuleRegistry- The wrapped DitStructureRule registry
-
-
Method Detail
-
contains
public boolean contains(int ruleId)
Checks to see if an DitStructureRule exists in the registry, by its ruleId.- Specified by:
containsin interfaceDitStructureRuleRegistry- Parameters:
ruleId- the rule identifier of the DitStructureRule- Returns:
- true if a DitStructureRule definition exists for the ruleId, false otherwise
-
iterator
public Iterator<DitStructureRule> iterator()
Gets an iterator over the registered descriptions in the registry.- Specified by:
iteratorin interfaceDitStructureRuleRegistry- Specified by:
iteratorin interfaceIterable<DitStructureRule>- Specified by:
iteratorin interfaceSchemaObjectRegistry<DitStructureRule>- Returns:
- an Iterator of descriptions
-
ruleIdIterator
public Iterator<Integer> ruleIdIterator()
Gets an iterator over the registered ruleId in the registry.- Specified by:
ruleIdIteratorin interfaceDitStructureRuleRegistry- Returns:
- an Iterator of ruleId
-
getSchemaName
public String getSchemaName(int ruleId) throws LdapException
Gets the name of the schema this schema object is associated with.- Specified by:
getSchemaNamein interfaceDitStructureRuleRegistry- Parameters:
ruleId- the object identifier- Returns:
- the schema name
- Throws:
LdapException- if the schema object does not exist
-
register
public void register(DitStructureRule ditStructureRule) throws LdapException
Registers a new DitStructureRule with this registry.- Specified by:
registerin interfaceDitStructureRuleRegistry- Specified by:
registerin interfaceSchemaObjectRegistry<DitStructureRule>- Parameters:
ditStructureRule- the DitStructureRule to register- Throws:
LdapException- if the DitStructureRule is already registered or the registration operation is not supported
-
lookup
public DitStructureRule lookup(int ruleId) throws LdapException
Looks up an dITStructureRule by its unique Object IDentifier or by its name.- Specified by:
lookupin interfaceDitStructureRuleRegistry- Parameters:
ruleId- the rule identifier for the DitStructureRule- Returns:
- the DitStructureRule instance for rule identifier
- Throws:
LdapException- if the DitStructureRule does not exist
-
unregister
public void unregister(int ruleId) throws LdapExceptionUnregisters a DitStructureRule using it's rule identifier.- Specified by:
unregisterin interfaceDitStructureRuleRegistry- Parameters:
ruleId- the rule identifier for the DitStructureRule to unregister- Throws:
LdapException- if no such DitStructureRule exists
-
unregisterSchemaElements
public void unregisterSchemaElements(String schemaName) throws LdapException
Unregisters all DITStructureRules defined for a specific schema from this registry.- Specified by:
unregisterSchemaElementsin interfaceDitStructureRuleRegistry- Specified by:
unregisterSchemaElementsin interfaceSchemaObjectRegistry<DitStructureRule>- Parameters:
schemaName- the name of the schema whose syntaxCheckers will be removed from- Throws:
LdapException- if no such SchemaElement exists
-
renameSchema
public void renameSchema(String originalSchemaName, String newSchemaName) throws LdapException
Modify all the DitStructureRule using a schemaName when this name changes.- Specified by:
renameSchemain interfaceDitStructureRuleRegistry- Specified by:
renameSchemain interfaceSchemaObjectRegistry<DitStructureRule>- Parameters:
originalSchemaName- The original Schema namenewSchemaName- The new Schema name- Throws:
LdapException- if the schema can't be renamed
-
copy
public ImmutableDitStructureRuleRegistry copy()
Copy the DitStructureRuleRegistry- Specified by:
copyin interfaceDitStructureRuleRegistry- Specified by:
copyin interfaceSchemaObjectRegistry<DitStructureRule>- Returns:
- The copied registry
-
size
public int size()
- Specified by:
sizein interfaceSchemaObjectRegistry<DitStructureRule>- 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<DitStructureRule>- 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<DitStructureRule>- 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<DitStructureRule>- 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<DitStructureRule>- Returns:
- the type
-
lookup
public DitStructureRule lookup(String oid) throws LdapException
Looks up a SchemaObject by its unique Object Identifier or by name.- Specified by:
lookupin interfaceSchemaObjectRegistry<DitStructureRule>- 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<DitStructureRule>- Returns:
- an Iterator of OIDs
-
unregister
public DitStructureRule unregister(String numericOid) throws LdapException
Removes the SchemaObject registered with this registry, using its numeric OID.- Specified by:
unregisterin interfaceSchemaObjectRegistry<DitStructureRule>- Parameters:
numericOid- the numeric identifier- Returns:
- The unregistred schema object
- Throws:
LdapException- if the numeric identifier is invalid
-
get
public DitStructureRule get(String oid)
Gets the SchemaObject associated with a given OID.- Specified by:
getin interfaceSchemaObjectRegistry<DitStructureRule>- 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<DitStructureRule>- Throws:
LdapException- If we had a failure while clearing the registry
-
unregister
public DitStructureRule unregister(DitStructureRule schemaObject) throws LdapException
Removes the SchemaObject registered with this registry.- Specified by:
unregisterin interfaceSchemaObjectRegistry<DitStructureRule>- Parameters:
schemaObject- the schemaObject to unregister- Returns:
- The unregistred schema object
- Throws:
LdapException- if the schemaObject can't be unregistered is invalid
-
-