org.apache.directory.server.core.schema
Class GlobalOidRegistry

java.lang.Object
  extended byorg.apache.directory.server.core.schema.GlobalOidRegistry
All Implemented Interfaces:
OidRegistry

public class GlobalOidRegistry
extends java.lang.Object
implements OidRegistry

Default OID registry implementation used to resolve a schema object OID to a name and vice-versa.

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

Constructor Summary
GlobalOidRegistry(BootstrapOidRegistry bootstrap)
          Creates a default OidRegistry by initializing the map and the montior.
 
Method Summary
 java.util.Map getNameByOid()
          Get the map of all the oids by their name
 java.util.List getNameSet(java.lang.String oid)
          Gets the names associated with an OID.
 java.lang.String getOid(java.lang.String name)
          Gets the object identifier for a common name or returns the argument as-is if it is an object identifier.
 java.util.Map getOidByName()
          Get the map of all the oids by their name
 java.lang.String getPrimaryName(java.lang.String oid)
          Gets the primary name associated with an OID.
 boolean hasOid(java.lang.String name)
          Checks to see if an identifier, oid or name exists within this registry.
 java.util.Iterator list()
          Lists all the OIDs within the registry.
 void register(java.lang.String name, java.lang.String oid)
          Adds an OID name pair to the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlobalOidRegistry

public GlobalOidRegistry(BootstrapOidRegistry bootstrap)
Creates a default OidRegistry by initializing the map and the montior.

Method Detail

getOid

public java.lang.String getOid(java.lang.String name)
                        throws javax.naming.NamingException
Description copied from interface: OidRegistry
Gets the object identifier for a common name or returns the argument as-is if it is an object identifier.

Specified by:
getOid in interface OidRegistry
Parameters:
name - the name to lookup an OID for
Returns:
the OID string associated with a name
Throws:
javax.naming.NamingException - if name does not map to an OID
See Also:
OidRegistry.getOid(String)

hasOid

public boolean hasOid(java.lang.String name)
Description copied from interface: OidRegistry
Checks to see if an identifier, oid or name exists within this registry.

Specified by:
hasOid in interface OidRegistry
Parameters:
name - the oid or name to look for
Returns:
true if the id exists false otherwise
See Also:
OidRegistry.hasOid(String)

getPrimaryName

public java.lang.String getPrimaryName(java.lang.String oid)
                                throws javax.naming.NamingException
Description copied from interface: OidRegistry
Gets the primary name associated with an OID. The primary name is the first name specified for the OID.

Specified by:
getPrimaryName in interface OidRegistry
Parameters:
oid - the object identifier
Returns:
the primary name
Throws:
javax.naming.NamingException - if oid does not exist
See Also:
OidRegistry.getPrimaryName(String)

getNameSet

public java.util.List getNameSet(java.lang.String oid)
                          throws javax.naming.NamingException
Description copied from interface: OidRegistry
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.

Specified by:
getNameSet in interface OidRegistry
Parameters:
oid - the OID for which we return the set of common names
Returns:
a sorted set of names
Throws:
javax.naming.NamingException - if oid does not exist
See Also:
OidRegistry.getNameSet(String)

list

public java.util.Iterator list()
Description copied from interface: OidRegistry
Lists all the OIDs within the registry. This may be a really big list.

Specified by:
list in interface OidRegistry
Returns:
all the OIDs registered
See Also:
OidRegistry.list()

register

public void register(java.lang.String name,
                     java.lang.String oid)
Description copied from interface: OidRegistry
Adds an OID name pair to the registry.

Specified by:
register in interface OidRegistry
Parameters:
name - the name to associate with the OID
oid - the OID to add or associate a new name with
See Also:
OidRegistry.register(String, String)

getOidByName

public java.util.Map getOidByName()
Get the map of all the oids by their name

Specified by:
getOidByName in interface OidRegistry
Returns:
The Map that contains all the oids

getNameByOid

public java.util.Map getNameByOid()
Get the map of all the oids by their name

Specified by:
getNameByOid in interface OidRegistry
Returns:
The Map that contains all the oids