# com.bea.p13n.advisor
AdvisletRegistry Class

public abstract class AdvisletRegistry
extends `Object`
implements `AdvisletRegistryConstants`

The AdvisletRegistry allows an `Advislet``` to be associated with a given URI prefix. This is achieved by use of the `advisor-registry.xml` file which specifies what advislets should be registered and against which URI prefixes.

Hierarchy
  `Object`
  `AdvisletRegistry`

All Implemented Interfaces
  `AdvisletRegistryConstants`

## Constructor Summary

AdvisletRegistry()

## Method Summary

`public static `AdvisletChainElement`` | `get`(`String` key) Retrieves the `AdvisletChainElement``` associated with a given key.
`public static `AdviceTransform`` | `getAdviceTransform`(`String` key) Retrieves the `AdviceTransform``` associated with a key.
`public static `Advislet`` | `getAdvislet`(`String` uriPrefix) Retrieves the `Advislet``` associated with a URI prefix.
`public static `String`` | `getUriPrefix`(`String` uri) Trims a URI of the form: protocol://arguments and returns the protocol component.
`public static synchronized void` | `initialize`(`InputStream` inputStream) Initializes the registry by the xml configuration from an InputStream, loading the advislets defined and registering them against the URI prefixes supplied.
`public static synchronized void` | `initialize`() Initializes the registry by reading the default xml configuration file, loading the advislets defined and registering them against the URI prefixes supplied.
`public static void` | `register`(`String` key, `AdvisletChainElement` advisletElement) Registers an `AdvisletChainElement``` and associates it with a key, which in the case of an Advislet is expected to be the URI prefix which will be used to refer to it.
`public static void` | `unregister`(`String` key, `AdvisletChainElement` advisletElement) Unregisters an `AdvisletChainElement``` and disassociates from with a key.

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Detail

### AdvisletRegistry

    public AdvisletRegistry()

## Method Detail

### get(String) Method

    public static AdvisletChainElement get(String key)
         throws ElementNotFoundException

Retrieves the `AdvisletChainElement``` associated with a given key.

#### Parameters

key
  The key to use to lookup the AdvisletChainElement.

#### Returns

The advislet registered against the key supplied.

#### Exceptions

``ElementNotFoundException``

### getAdviceTransform(String) Method

    public static AdviceTransform getAdviceTransform(String key)
         throws ElementNotFoundException

Retrieves the `AdviceTransform``` associated with a key.

#### Parameters

key
  The key to use to lookup the AdviceTransform.

#### Returns

The advisletTransform registered against the key supplied.

#### Exceptions

``ElementNotFoundException``

### getAdvislet(String) Method

    public static Advislet getAdvislet(String uriPrefix)
         throws ElementNotFoundException

Retrieves the `Advislet``` associated with a URI prefix.

#### Parameters

uriPrefix
  The prefix to use to lookup the Advislet.

#### Returns

The advislet registered against the prefix supplied.

#### Exceptions

``ElementNotFoundException``

### getUriPrefix(String) Method

    public static String getUriPrefix(String uri)

Trims a URI of the form: protocol://arguments and returns the protocol component.

#### Parameters

uri
  The URI to be trimmed.

#### Returns

The URI prefix of the supplied URI.

### initialize(InputStream) Method

    public static synchronized void initialize(InputStream inputStream)

Initializes the registry by the xml configuration from an InputStream, loading the advislets defined and registering them against the URI prefixes supplied. Any existing advislets are not unregistered, and new registrations are appended.

### initialize() Method

    public static synchronized void initialize()

Initializes the registry by reading the default xml configuration file, loading the advislets defined and registering them against the URI prefixes supplied.

### register(String, AdvisletChainElement) Method

    public static void register(String key,
                                AdvisletChainElement advisletElement)

Registers an `AdvisletChainElement``` and associates it with a key, which in the case of an Advislet is expected to be the URI prefix which will be used to refer to it.

#### Parameters

key
  The key to associate with the given element.

advisletElement
  The element to register.

### unregister(String, AdvisletChainElement) Method

    public static void unregister(String key,
                                  AdvisletChainElement advisletElement)

Unregisters an `AdvisletChainElement``` and disassociates from with a key.

#### Parameters

key
  The key of the associated element.

advisletElement
  The element to unregister.