codec.asn1
Class OIDRegistry

java.lang.Object
  |
  +--codec.asn1.OIDRegistry
Direct Known Subclasses:
AbstractOIDRegistry

public class OIDRegistry
extends Object

This class maps ASN.1 object identifiers onto ASN.1 types suitable for decoding the structure defined by the given OID. It is modelled along the lines of the ClassLoader and provides a hierarchy and top-level OID registries.

Version:
"$Id: OIDRegistry.java,v 1.4 2004/08/09 08:32:22 flautens Exp $"
Author:
Volker Roth

Constructor Summary
OIDRegistry(OIDRegistry parent)
          Creates an OID registry with the given parent.
 
Method Summary
static void addOIDRegistry(OIDRegistry r)
          Adds a registry to the set of globally known ones unless it is already in the global set.
 boolean equals(Object o)
          An OIDRegistry equals another iff both are of the same class.
 ASN1Type getASN1Type(ASN1ObjectIdentifier oid)
          Retrieves an ASN.1 type based on the given OID.
static OIDRegistry getDefaultRegistry()
          This method returns the default OID registry.
static OIDRegistry getGlobalOIDRegistry()
          This method returns the global OIDRegistry instance that may be used for querying
protected  ASN1Type getLocalASN1Type(ASN1ObjectIdentifier oid)
          Retrieves an ASN.1 type for the given OID or null if no such type was found.
protected  ASN1Type getLocalASN1Type(ASN1ObjectIdentifier oid, Map map)
          Retrieves an ASN.1 type for the given OID or null if no such type was found.
 int hashCode()
          The hash code of an instance is the hash code of its class.
static void removeOIDRegistry(OIDRegistry r)
          Removes the given OID registry from the set of globally known ones.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OIDRegistry

public OIDRegistry(OIDRegistry parent)
Creates an OID registry with the given parent. If an OID is not found by this registry then the search is delegated to the parent registry.
Parameters:
parent - The parent OID registry.
Method Detail

getGlobalOIDRegistry

public static final OIDRegistry getGlobalOIDRegistry()
This method returns the global OIDRegistry instance that may be used for querying
Returns:
The global OID registry.

addOIDRegistry

public static final void addOIDRegistry(OIDRegistry r)
Adds a registry to the set of globally known ones unless it is already in the global set. This method checks the permission

ASN1Permission, " OIDRegistry.add"

The reference to the parent registry of the given registry is cleared before it is added.

Parameters:
r - The registry to add.
Throws:
SecurityException - iff the caller has no right to add registries to the global ones.

removeOIDRegistry

public static final void removeOIDRegistry(OIDRegistry r)
Removes the given OID registry from the set of globally known ones. This method checks the permission

ASN1Permission, " OIDRegistry.remove"

Parameters:
r - The registry to remove.
Throws:
SecurityException - iff the caller has no right to remove OID registries.

getASN1Type

public final ASN1Type getASN1Type(ASN1ObjectIdentifier oid)
Retrieves an ASN.1 type based on the given OID. If no type is found then null is returned. This method first calls getLocalASN1Type. If no ASN.1 type is found for the given OID then getASN1Type is called for the parent OIDRegistry.
Parameters:
oid - The registered OID of the desired type.
Returns:
The type or null if no type with the given OID is known.

getLocalASN1Type

protected ASN1Type getLocalASN1Type(ASN1ObjectIdentifier oid)
Retrieves an ASN.1 type for the given OID or null if no such type was found.

This method should be overridden by subclasses. Subclasses should retrieve a pointer to their private synchronized Map with OID to String (or Class) mappings, and call the method with the same name but which takes an additional Map.

This implementation searches the global registries for a matching entry.


getLocalASN1Type

protected ASN1Type getLocalASN1Type(ASN1ObjectIdentifier oid,
                                    Map map)
Retrieves an ASN.1 type for the given OID or null if no such type was found. Strings in the given Map are replaced by the resolved classes.

This is a convenience method that can be called by subclasses with a Map that is specific to the subclass.

Parameters:
oid - The OID that is resolved.
map - The Map that holds the OID to class (name) mapping. The Map values consist either of strings (class names) or of the resolved class objects.

getDefaultRegistry

public static OIDRegistry getDefaultRegistry()
This method returns the default OID registry. Subclasses should override this method and provide a static instance of an OID registry that delegates to the global OID registry if a requested OID could not be found locally. This implementation returns the global OID registry by default.
Returns:
The default OID registry.

equals

public boolean equals(Object o)
An OIDRegistry equals another iff both are of the same class.
Overrides:
equals in class Object
Returns:
true if both registries are of the same class.

hashCode

public int hashCode()
The hash code of an instance is the hash code of its class. This is required to be consistent with the equals() method.
Overrides:
hashCode in class Object


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.