Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.registry
Class MuleRegistryHelper

    java.lang.Object
      org.mule.registry.MuleRegistryHelper

All Implemented Interfaces:
  Disposable, Initialisable, MuleRegistry, Registry

    public class MuleRegistryHelper

extends Object
implements MuleRegistry, Initialisable, Disposable

Adds lookup/register/unregister methods for Mule-specific entities to the standard Registry interface.

Field Summary
`protected Log` | `logger`
`protected Map<String,List<Transformer>>` | `transformerListCache`

Fields inherited from interface org.mule.api.registry.MuleRegistry
`LIFECYCLE_BYPASS_FLAG`

Fields inherited from interface org.mule.api.lifecycle.Initialisable
`PHASE_NAME`

Fields inherited from interface org.mule.api.lifecycle.Disposable
`PHASE_NAME`

Constructor Summary
`MuleRegistryHelper(DefaultRegistryBroker registry)`

Method Summary
`Object` | `applyLifecycle(Object object)` Will execute any lifecycle phases on an object without actually registering the object in the registry.
`Object` | `applyProcessors(Object object)` Will execute any processors on an object without actually registering the object in the registry.
`Object` | `applyProcessorsAndLifecycle(Object object)` Will execute any processors on an object and fire any lifecycle methods according to the current lifecycle without actually registering the object in the registry.
`protected ServiceDescriptor` | `createServiceDescriptor(String type, String name, Properties overrides)` Deprecated. ServiceDescriptors will be created upon bundle startup for OSGi.
`void` | `dispose()` A lifecycle method where implementor should free up any resources.
`Collection` | `getAgents()`
`Collection` | `getConnectors()`
`Collection` | `getEndpoints()`
`Collection` | `getModels()`
`protected String` | `getName(Object obj)`
`String` | `getRegistryId()`
`Collection` | `getTransformers()`
`void` | `initialise()` Method used to perform any initialisation work.
`boolean` | `isReadOnly()`
`boolean` | `isRemote()`
`Agent` | `lookupAgent(String name)`
`Connector` | `lookupConnector(String name)`
`ImmutableEndpoint` | `lookupEndpoint(String name)` Removed this method from `Registry` API as it should only be used internally and may confuse users.
`EndpointBuilder` | `lookupEndpointBuilder(String name)` Looks-up endpoint builders which can be used to repeatably create endpoints with the same configuration.
`EndpointFactory` | `lookupEndpointFactory()`
`Model` | `lookupModel(String name)`
`Object` | `lookupObject(Class type)` Look up a single object by type.
`Object` | `lookupObject(String key)` Look up a single object by name.
`Collection` | `lookupObjects(Class type)` Look up all objects of a given type.
`Service` | `lookupService(String name)`
`ServiceDescriptor` | `lookupServiceDescriptor(String type, String name, Properties overrides)` Looks up the service descriptor from a singleton cache and creates a new one if not found.
`Collection<Service>` | `lookupServices()`
`Collection<Service>` | `lookupServices(String model)`
`Model` | `lookupSystemModel()`
`Transformer` | `lookupTransformer(Class inputType, Class outputType)` Will find a transformer that is the closest match to the desired input and output.
`Transformer` | `lookupTransformer(String name)`
`List` | `lookupTransformers(Class input, Class output)` This method will return a list of `Transformer` objects that accept the given input and return the given output type of object
`protected void` | `notifyTransformerResolvers(Transformer t, TransformerResolver.RegistryAction action)`
`void` | `registerAgent(Agent agent)`
`void` | `registerConnector(Connector connector)`
`void` | `registerEndpoint(ImmutableEndpoint endpoint)`
`void` | `registerEndpointBuilder(String name, EndpointBuilder builder)`
`void` | `registerModel(Model model)`
`void` | `registerObject(String key, Object value)`
`void` | `registerObject(String key, Object value, Object metadata)`
`void` | `registerObjects(Map objects)`
`void` | `registerService(Service service)`
`void` | `registerTransformer(Transformer transformer)`
`void` | `unregisterAgent(String agentName)`
`void` | `unregisterConnector(String connectorName)`
`void` | `unregisterEndpoint(String endpointName)`
`void` | `unregisterModel(String modelName)`
`void` | `unregisterObject(String key)`
`void` | `unregisterObject(String key, Object metadata)`
`void` | `unregisterService(String serviceName)`
`void` | `unregisterTransformer(String transformerName)`

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

Field Detail

### transformerListCache

    protected Map<String,List<Transformer>> transformerListCache

### logger

    protected transient Log logger

Constructor Detail

### MuleRegistryHelper

    public MuleRegistryHelper(DefaultRegistryBroker registry)

Method Detail

### initialise

    public void initialise()
                    throws InitialisationException

  Description copied from interface: `Initialisable`
  Method used to perform any initialisation work. If a fatal error occurs during initialisation an `InitialisationException` should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a `RecoverableException` should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

  Specified by:
    `initialise` in interface `Initialisable`
  Throws:
    `InitialisationException` - if a fatal error occurs causing the Mule instance to shutdown
    `RecoverableException` - if an error occurs that can be recovered from

### dispose

    public void dispose()

  Description copied from interface: `Disposable`
  A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

  Specified by:
    `dispose` in interface `Disposable`

### lookupConnector

    public Connector lookupConnector(String name)

  Specified by:
    `lookupConnector` in interface `MuleRegistry`

### lookupEndpoint

    public ImmutableEndpoint lookupEndpoint(String name)

  Removed this method from `Registry` API as it should only be used internally and may confuse users. The `EndpointFactory` should be used for creating endpoints.
  Looks up an returns endpoints registered in the registry by their idendifier (currently endpoint name)
  NOTE: This method does not create new endpoint instances, but rather returns existing endpoint instances that have been registered. This lookup method should be avoided and the intelligent, role specific endpoint lookup methods should be used instead.

  Parameters:
    `name` - the idendtifer/name used to register endpoint in registry

### lookupEndpointBuilder

    public EndpointBuilder lookupEndpointBuilder(String name)

  Description copied from interface: `MuleRegistry`
  Looks-up endpoint builders which can be used to repeatably create endpoints with the same configuration. These endpoint builder are either global endpoints or they are builders used to create named endpoints configured on routers and exception strategies.

  Specified by:
    `lookupEndpointBuilder` in interface `MuleRegistry`

### lookupEndpointFactory

    public EndpointFactory lookupEndpointFactory()

  Specified by:
    `lookupEndpointFactory` in interface `MuleRegistry`

### lookupTransformer

    public Transformer lookupTransformer(String name)

  Specified by:
    `lookupTransformer` in interface `MuleRegistry`

### lookupTransformer

    public Transformer lookupTransformer(Class inputType,
                                         Class outputType)
                                  throws TransformerException

  Will find a transformer that is the closest match to the desired input and output.

  Specified by:
    `lookupTransformer` in interface `MuleRegistry`
  Parameters:
    `inputType` - The desiered input type for the transformer
    `outputType` - the desired output type for the transformer
  Returns:
    A transformer that exactly matches or the will accept the input and output parameters
  Throws:
    `TransformerException` - will be thrown if there is more than one match

### lookupTransformers

    public List lookupTransformers(Class input,
                                   Class output)

  Description copied from interface: `MuleRegistry`
  This method will return a list of `Transformer` objects that accept the given input and return the given output type of object

  Specified by:
    `lookupTransformers` in interface `MuleRegistry`
  Parameters:
    `input` - The desiered input type for the transformer
    `output` - the desired output type for the transformer
  Returns:
    a list of matching transformers. If there were no matchers an empty list is returned.

### lookupModel

    public Model lookupModel(String name)

  Specified by:
    `lookupModel` in interface `MuleRegistry`

### lookupSystemModel

    public Model lookupSystemModel()

  Specified by:
    `lookupSystemModel` in interface `MuleRegistry`

### getModels

    public Collection getModels()

  Specified by:
    `getModels` in interface `MuleRegistry`

### getConnectors

    public Collection getConnectors()

  Specified by:
    `getConnectors` in interface `MuleRegistry`

### getAgents

    public Collection getAgents()

  Specified by:
    `getAgents` in interface `MuleRegistry`

### getEndpoints

    public Collection getEndpoints()

  Specified by:
    `getEndpoints` in interface `MuleRegistry`

### getTransformers

    public Collection getTransformers()

  Specified by:
    `getTransformers` in interface `MuleRegistry`

### lookupAgent

    public Agent lookupAgent(String name)

  Specified by:
    `lookupAgent` in interface `MuleRegistry`

### lookupService

    public Service lookupService(String name)

  Specified by:
    `lookupService` in interface `MuleRegistry`

### lookupServices

    public Collection<Service> lookupServices()

  Specified by:
    `lookupServices` in interface `MuleRegistry`

### lookupServices

    public Collection<Service> lookupServices(String model)

  Specified by:
    `lookupServices` in interface `MuleRegistry`

### registerTransformer

    public final void registerTransformer(Transformer transformer)
                                   throws MuleException

  Specified by:
    `registerTransformer` in interface `MuleRegistry`
  Throws:
    `MuleException`

### notifyTransformerResolvers

    protected void notifyTransformerResolvers(Transformer t,
                                              TransformerResolver.RegistryAction action)

### lookupServiceDescriptor

    public ServiceDescriptor lookupServiceDescriptor(String type,
                                                     String name,
                                                     Properties overrides)
                                              throws ServiceException

  Looks up the service descriptor from a singleton cache and creates a new one if not found.

  Specified by:
    `lookupServiceDescriptor` in interface `MuleRegistry`
  Throws:
    `ServiceException`

### createServiceDescriptor

    protected ServiceDescriptor createServiceDescriptor(String type,
                                                        String name,
                                                        Properties overrides)
                                                 throws ServiceException

  Deprecated. ServiceDescriptors will be created upon bundle startup for OSGi.

  Throws:
    `ServiceException`

### registerAgent

    public void registerAgent(Agent agent)
                       throws MuleException

  Specified by:
    `registerAgent` in interface `MuleRegistry`
  Throws:
    `MuleException`

### registerConnector

    public void registerConnector(Connector connector)
                           throws MuleException

  Specified by:
    `registerConnector` in interface `MuleRegistry`
  Throws:
    `MuleException`

### registerEndpoint

    public void registerEndpoint(ImmutableEndpoint endpoint)
                          throws MuleException

  Specified by:
    `registerEndpoint` in interface `MuleRegistry`
  Throws:
    `MuleException`

### registerEndpointBuilder

    public void registerEndpointBuilder(String name,
                                        EndpointBuilder builder)
                                 throws MuleException

  Specified by:
    `registerEndpointBuilder` in interface `MuleRegistry`
  Throws:
    `MuleException`

### registerModel

    public void registerModel(Model model)
                       throws MuleException

  Specified by:
    `registerModel` in interface `MuleRegistry`
  Throws:
    `MuleException`

### registerService

    public void registerService(Service service)
                         throws MuleException

  Specified by:
    `registerService` in interface `MuleRegistry`
  Throws:
    `MuleException`

### unregisterService

    public void unregisterService(String serviceName)
                           throws MuleException

  Specified by:
    `unregisterService` in interface `MuleRegistry`
  Throws:
    `MuleException`

### unregisterAgent

    public void unregisterAgent(String agentName)
                         throws MuleException

  Specified by:
    `unregisterAgent` in interface `MuleRegistry`
  Throws:
    `MuleException`

### unregisterConnector

    public void unregisterConnector(String connectorName)
                             throws MuleException

  Specified by:
    `unregisterConnector` in interface `MuleRegistry`
  Throws:
    `MuleException`

### unregisterEndpoint

    public void unregisterEndpoint(String endpointName)
                            throws MuleException

  Specified by:
    `unregisterEndpoint` in interface `MuleRegistry`
  Throws:
    `MuleException`

### unregisterModel

    public void unregisterModel(String modelName)
                         throws MuleException

  Specified by:
    `unregisterModel` in interface `MuleRegistry`
  Throws:
    `MuleException`

### unregisterTransformer

    public void unregisterTransformer(String transformerName)
                               throws MuleException

  Specified by:
    `unregisterTransformer` in interface `MuleRegistry`
  Throws:
    `MuleException`

### applyProcessorsAndLifecycle

    public Object applyProcessorsAndLifecycle(Object object)
                                       throws MuleException

  Will execute any processors on an object and fire any lifecycle methods according to the current lifecycle without actually registering the object in the registry. This is useful for prototype objects that are created per request and would clutter the registry with single use objects.

  Specified by:
    `applyProcessorsAndLifecycle` in interface `MuleRegistry`
  Parameters:
    `object` - the object to process
  Returns:
    the same object with any processors and lifecycle methods called
  Throws:
    `MuleException` - if the registry fails to perform the lifecycle change or process object processors for the object.

### applyProcessors

    public Object applyProcessors(Object object)
                           throws MuleException

  Description copied from interface: `MuleRegistry`
  Will execute any processors on an object without actually registering the object in the registry. This is useful for prototype objects that are created per request and would clutter the registry with single use objects. Not that this will only be applied to Mule registies. Thrid party registries such as Guice support wiring, but you need to get a reference to the container/context to call the method. This is so that wiring mechanisms dont trip over each other.

  Specified by:
    `applyProcessors` in interface `MuleRegistry`
  Parameters:
    `object` - the object to process
  Returns:
    the same object with any processors called
  Throws:
    `MuleException` - if the registry fails to process object processors for the object.

### applyLifecycle

    public Object applyLifecycle(Object object)
                          throws MuleException

  Description copied from interface: `MuleRegistry`
  Will execute any lifecycle phases on an object without actually registering the object in the registry. This is useful for prototype objects that are created per request and would clutter the registry with single use objects. The lifecycle applied is the lifecycle of the MuleContext. If multiple phases have been completed i.e. init and start, each phase will be executed on the object in order.

  Specified by:
    `applyLifecycle` in interface `MuleRegistry`
  Parameters:
    `object` - the object to apply the current lifecycle state to
  Returns:
    the same object with any lifecycle methods called
  Throws:
    `MuleException` - if the registry fails to execute a lifecycle method.

### lookupObject

    public Object lookupObject(Class type)
                        throws RegistrationException

  Description copied from interface: `Registry`
  Look up a single object by type.

  Specified by:
    `lookupObject` in interface `Registry`
  Returns:
    object or null if not found
  Throws:
    `RegistrationException` - if more than one object is found.

### lookupObject

    public Object lookupObject(String key)

  Description copied from interface: `Registry`
  Look up a single object by name.

  Specified by:
    `lookupObject` in interface `Registry`
  Returns:
    object or null if not found

### lookupObjects

    public Collection lookupObjects(Class type)

  Description copied from interface: `Registry`
  Look up all objects of a given type.

  Specified by:
    `lookupObjects` in interface `Registry`
  Returns:
    collection of objects or empty collection if none found

### registerObject

    public void registerObject(String key,
                               Object value,
                               Object metadata)
                        throws RegistrationException

  Specified by:
    `registerObject` in interface `Registry`
  Throws:
    `RegistrationException`

### registerObject

    public void registerObject(String key,
                               Object value)
                        throws RegistrationException

  Specified by:
    `registerObject` in interface `Registry`
  Throws:
    `RegistrationException`

### registerObjects

    public void registerObjects(Map objects)
                         throws RegistrationException

  Specified by:
    `registerObjects` in interface `Registry`
  Throws:
    `RegistrationException`

### unregisterObject

    public void unregisterObject(String key,
                                 Object metadata)
                          throws RegistrationException

  Specified by:
    `unregisterObject` in interface `Registry`
  Throws:
    `RegistrationException`

### unregisterObject

    public void unregisterObject(String key)
                          throws RegistrationException

  Specified by:
    `unregisterObject` in interface `Registry`
  Throws:
    `RegistrationException`

### getName

    protected String getName(Object obj)

### getRegistryId

    public String getRegistryId()

  Specified by:
    `getRegistryId` in interface `Registry`

### isReadOnly

    public boolean isReadOnly()

  Specified by:
    `isReadOnly` in interface `Registry`

### isRemote

    public boolean isRemote()

  Specified by:
    `isRemote` in interface `Registry`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.