com.bea.p13n.advisor
Class AdvisletRegistry

java.lang.Object
  extended by com.bea.p13n.advisor.AdvisletRegistry
All Implemented Interfaces
AdvisletRegistryConstants

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.


Field Summary
 
Fields inherited from interface com.bea.p13n.advisor.AdvisletRegistryConstants
AD_IMPL_CLASS_TAG, AD_METADATA_TAG, AD_PARAMETERS_TAG, AD_URI_TAG, CA_SEQUENCE_TAG, MD_AUTHOR_TAG, MD_DESC_TAG, MD_NAME_TAG, MD_VERSION_TAG, PM_CUSTOM_TAG, RT_ADVICE_TRANSFORM_TAG, RT_ADVISLET_TAG, RT_COMPOUND_ADVISLET_TAG, VN_BUILD_NUM_TAG, VN_DESC_TAG, VN_MAJOR_TAG, VN_MINOR_TAG
 
Constructor Summary
AdvisletRegistry()
           
 
Method Summary
static AdvisletChainElement get(String key)
          Retrieves the AdvisletChainElement associated with a given key.
static AdviceTransform getAdviceTransform(String key)
          Retrieves the AdviceTransform associated with a key.
static Advislet getAdvislet(String uriPrefix)
          Retrieves the Advislet associated with a URI prefix.
static String getUriPrefix(String uri)
          Trims a URI of the form: protocol://arguments and returns the protocol component.
static void initialize()
          Initializes the registry by reading the default xml configuration file, loading the advislets defined and registering them against the URI prefixes supplied.
static 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.
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.
static void unregister(String key, AdvisletChainElement advisletElement)
          Unregisters an AdvisletChainElement and disassociates from with a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdvisletRegistry

public AdvisletRegistry()
Method Detail

register

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

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.

get

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.
Throws
AdvisletNotFoundException - thrown when no element is registered against the supplied key
ElementNotFoundException

getAdvislet

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.
Throws
AdvisletNotFoundException - thrown when no advislet is registered against the supplied prefix
ElementNotFoundException

getAdviceTransform

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. }@throws AdvisletNotFoundException thrown when no AdvisletTransform is registered against the supplied prefix
Throws
ElementNotFoundException

getUriPrefix

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.
Throws
IllegalArgumentException - thrown when URI parsing fails

initialize

public static 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

public static void initialize()
Initializes the registry by reading the default xml configuration file, loading the advislets defined and registering them against the URI prefixes supplied.



Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.