Class OidRegistry<T extends SchemaObject>
- java.lang.Object
-
- org.apache.directory.api.ldap.model.schema.registries.OidRegistry<T>
-
- Type Parameters:
T
- The type of SchemaObject
- All Implemented Interfaces:
Iterable<T>
public class OidRegistry<T extends SchemaObject> extends Object implements Iterable<T>
Object identifier registry. It stores the OIDs for AT, OC, MR, LS, MRU, DSR, DCR and NF. An OID is unique, and associated with a SO.- Author:
- Apache Directory Project
-
-
Constructor Summary
Constructors Constructor Description OidRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Empty the byOid mapboolean
contains(String oid)
Tells if the given OID is present on this registryOidRegistry<T>
copy()
Copy the OidRegistry, without the contained valuesSchemaErrorHandler
getErrorHandler()
List<String>
getNameSet(String oid)
Gets the names associated with an OID.String
getPrimaryName(String oid)
Gets the primary name associated with an OID.T
getSchemaObject(String oid)
Gets the SchemaObject associated with an OID.boolean
isRelaxed()
Tells if the Registry is permissive or if it must be checked against inconsistencies.boolean
isStrict()
Tells if the Registry is strict.Iterator<T>
iterator()
Lists all the SchemaObjects within the registry.Iterator<String>
iteratorOids()
Lists all the OIDs within the registry.void
register(T schemaObject)
Adds an OID name pair to the registry.void
setErrorHandler(SchemaErrorHandler errorHandler)
void
setRelaxed()
Change the Registry to a relaxed mode, where invalid SchemaObjects can be registered.void
setStrict()
Change the Registry to a strict mode, where invalid SchemaObjects cannot be registered.int
size()
String
toString()
void
unregister(String oid)
Removes an oid from this registry.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
OidRegistry
public OidRegistry()
-
-
Method Detail
-
contains
public boolean contains(String oid)
Tells if the given OID is present on this registry- Parameters:
oid
- The OID to lookup- Returns:
- true if the OID already exists
-
getPrimaryName
public String getPrimaryName(String oid) throws LdapException
Gets the primary name associated with an OID. The primary name is the first name specified for the OID.- Parameters:
oid
- the object identifier- Returns:
- the primary name
- Throws:
LdapException
- if oid does not exist
-
getSchemaObject
public T getSchemaObject(String oid) throws LdapException
Gets the SchemaObject associated with an OID.- Parameters:
oid
- the object identifier- Returns:
- the associated SchemaObject
- Throws:
LdapException
- if oid does not exist
-
getNameSet
public List<String> getNameSet(String oid) throws LdapException
Gets the names associated with an OID. An OID is unique however it may have many names used to refer to it. A good example is the cn and commonName attribute names for OID 2.5.4.3. Within a server one name within the set must be chosen as the primary name. This is used to name certain things within the server internally. If there is more than one name then the first name is taken to be the primary.- Parameters:
oid
- the OID for which we return the set of common names- Returns:
- a sorted set of names
- Throws:
LdapException
- if oid does not exist
-
iteratorOids
public Iterator<String> iteratorOids()
Lists all the OIDs within the registry. This may be a really big list.- Returns:
- all the OIDs registered
-
iterator
public Iterator<T> iterator()
Lists all the SchemaObjects within the registry. This may be a really big list.- Specified by:
iterator
in interfaceIterable<T extends SchemaObject>
- Returns:
- all the SchemaObject registered
-
isRelaxed
public boolean isRelaxed()
Tells if the Registry is permissive or if it must be checked against inconsistencies.- Returns:
- True if SchemaObjects can be added even if they break the consistency
-
isStrict
public boolean isStrict()
Tells if the Registry is strict.- Returns:
- True if SchemaObjects cannot be added if they break the consistency
-
setRelaxed
public void setRelaxed()
Change the Registry to a relaxed mode, where invalid SchemaObjects can be registered.
-
setStrict
public void setStrict()
Change the Registry to a strict mode, where invalid SchemaObjects cannot be registered.
-
getErrorHandler
public SchemaErrorHandler getErrorHandler()
-
setErrorHandler
public void setErrorHandler(SchemaErrorHandler errorHandler)
-
register
public void register(T schemaObject) throws LdapException
Adds an OID name pair to the registry.- Parameters:
schemaObject
- The SchemaObject the oid belongs to- Throws:
LdapException
- If something went wrong
-
unregister
public void unregister(String oid) throws LdapException
Removes an oid from this registry.- Parameters:
oid
- the numeric identifier for the object- Throws:
LdapException
- if the identifier is not numeric
-
copy
public OidRegistry<T> copy()
Copy the OidRegistry, without the contained values- Returns:
- A new OidRegistry instance
-
size
public int size()
- Returns:
- The number of stored OIDs
-
clear
public void clear()
Empty the byOid map
-
toString
public String toString()
- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
-