org.apache.directory.server.schema.registries
Class DefaultOidRegistry

java.lang.Object
  extended by org.apache.directory.server.schema.registries.DefaultOidRegistry
All Implemented Interfaces:
OidRegistry

public class DefaultOidRegistry
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: 664295 $
Author:
Apache Directory Project

Constructor Summary
DefaultOidRegistry()
           
 
Method Summary
 java.util.Map<java.lang.String,java.util.List<java.lang.String>> getNameByOid()
          Get the map of all the oids by their name
 java.util.List<java.lang.String> 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<java.lang.String,java.lang.String> 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.
 void unregister(java.lang.String numericOid)
          Removes an oid from this registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultOidRegistry

public DefaultOidRegistry()
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(java.lang.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(java.lang.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(java.lang.String)

getNameSet

public java.util.List<java.lang.String> 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(java.lang.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()

getOidByName

public java.util.Map<java.lang.String,java.lang.String> 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<java.lang.String,java.util.List<java.lang.String>> 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

register

public void register(java.lang.String name,
                     java.lang.String oid)
              throws javax.naming.NamingException
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
Throws:
javax.naming.NamingException
See Also:
OidRegistry.register(String, String)

unregister

public void unregister(java.lang.String numericOid)
                throws javax.naming.NamingException
Description copied from interface: OidRegistry
Removes an oid from this registry.

Specified by:
unregister in interface OidRegistry
Parameters:
numericOid - the numeric identifier for the object
Throws:
javax.naming.NamingException - if the identifier is not numeric


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