org.apache.directory.shared.ldap.schema.registries
Class OidRegistry

java.lang.Object
  extended by org.apache.directory.shared.ldap.schema.registries.OidRegistry
All Implemented Interfaces:
java.lang.Iterable<SchemaObject>

public class OidRegistry
extends java.lang.Object
implements java.lang.Iterable<SchemaObject>

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.

Version:
$Rev: 923524 $
Author:
Apache Directory Project

Constructor Summary
OidRegistry()
           
 
Method Summary
 void clear()
           
 boolean contains(java.lang.String oid)
          Tells if the given OID is present on this registry
 OidRegistry copy()
          Copy the OidRegistry, without the contained values
 java.util.List<java.lang.String> getNameSet(java.lang.String oid)
          Gets the names associated with an OID.
 java.lang.String getPrimaryName(java.lang.String oid)
          Gets the primary name associated with an OID.
 SchemaObject getSchemaObject(java.lang.String oid)
          Gets the SchemaObject associated with an OID.
 java.util.Iterator<SchemaObject> iterator()
          Lists all the SchemaObjects within the registry.
 java.util.Iterator<java.lang.String> iteratorOids()
          Lists all the OIDs within the registry.
 void register(SchemaObject schemaObject)
          Adds an OID name pair to the registry.
 int size()
           
 java.lang.String toString()
           
 void unregister(java.lang.String oid)
          Removes an oid from this registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OidRegistry

public OidRegistry()
Method Detail

contains

public boolean contains(java.lang.String oid)
Tells if the given OID is present on this registry

Parameters:
oid - The OID to lookup
Returns:
true if the OID alreadyexists

getPrimaryName

public java.lang.String getPrimaryName(java.lang.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 SchemaObject getSchemaObject(java.lang.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 java.util.List<java.lang.String> getNameSet(java.lang.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 java.util.Iterator<java.lang.String> iteratorOids()
Lists all the OIDs within the registry. This may be a really big list.

Returns:
all the OIDs registered

iterator

public java.util.Iterator<SchemaObject> iterator()
Lists all the SchemaObjects within the registry. This may be a really big list.

Specified by:
iterator in interface java.lang.Iterable<SchemaObject>
Returns:
all the SchemaObject registered

register

public void register(SchemaObject schemaObject)
              throws LdapException
Adds an OID name pair to the registry.

Parameters:
type - The SchemaObjectType the oid belongs to
oid - the OID to add or associate a new name with
Throws:
LdapException

unregister

public void unregister(java.lang.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 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()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.