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

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` We cache transformer searches so that we only search once

Fields inherited from interface org.mule.api.registry.MuleRegistry
`INJECT_PROCESSORS_BYPASS_FLAG, LIFECYCLE_BYPASS_FLAG, PRE_INIT_PROCESSORS_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, MuleContext muleContext)`

Method Summary
`Object` | `applyLifecycle(Object object)` Will execute any lifecycle phases on an object without actually registering the object in the registry.
`Object` | `applyLifecycle(Object object, String phase)`
`Object` | `applyProcessors(Object object)` Will execute any processors on an object without actually registering the object in the registry.
`Object` | `applyProcessors(Object object, int flags)` 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(ServiceType type, String name, Properties overrides)`
`void` | `dispose()` A lifecycle method where implementor should free up any resources.
`void` | `fireLifecycle(String phase)`
`
`<T> T`
` | `get(String key)` Alias method performing the lookup, here to simplify syntax when called from dynamic languages.
`Collection<Agent>` | `getAgents()`
`Collection<Connector>` | `getConnectors()`
`Collection<ImmutableEndpoint>` | `getEndpoints()`
`Collection<Model>` | `getModels()`
`protected String` | `getName(Object obj)` Returns the name for the object passed in.
`String` | `getRegistryId()`
`Collection<Transformer>` | `getTransformers()`
`void` | `initialise()` Method used to perform any initialisation work.
`boolean` | `isReadOnly()`
`boolean` | `isRemote()`
`Agent` | `lookupAgent(String name)`
`
`<T> Map<String,T>`
` | `lookupByType(Class<T> type)`
`Connector` | `lookupConnector(String name)`
`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)`
`
`<T> T`
` | `lookupObject(Class<T> type)` Look up a single object by type.
`
`<T> T`
` | `lookupObject(String key)` Look up a single object by name.
`
`<T> Collection<T>`
` | `lookupObjects(Class<T> type)` Look up all objects of a given type.
`Service` | `lookupService(String name)`
`ServiceDescriptor` | `lookupServiceDescriptor(ServiceType 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)` Deprecated. use `lookupTransformer(org.mule.api.transformer.DataType, org.mule.api.transformer.DataType)` instead. This method should only be used internally to discover transformers, typically a user does not need ot do this directly
`Transformer` | `lookupTransformer(DataType source, DataType result)` Will find a transformer that is the closest match to the desired input and output.
`Transformer` | `lookupTransformer(String name)`
`List<Transformer>` | `lookupTransformers(Class input, Class output)` Deprecated. use `lookupTransformer(org.mule.api.transformer.DataType, org.mule.api.transformer.DataType)` instead. This method should only be used internally to discover transformers, typically a user does not need ot do this directly
`List<Transformer>` | `lookupTransformers(DataType source, DataType result)` 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)` Registers an object in the registry with a key.
`void` | `registerObject(String key, Object value, Object metadata)` Registers an object in the registry with a key.
`void` | `registerObjects(Map objects)` Registers a Map of objects into the registry
`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)` Will remove an object by name from the registry.
`void` | `unregisterObject(String key, Object metadata)` Will remove an object by name from the registry.
`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

### logger

    protected transient Log logger

### transformerListCache

    protected Map<String,List<Transformer>> transformerListCache

  We cache transformer searches so that we only search once

Constructor Detail

### MuleRegistryHelper

    public MuleRegistryHelper(DefaultRegistryBroker registry,
                              MuleContext muleContext)

Method Detail

### initialise

    public void initialise()
                    throws InitialisationException

  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()

  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`

### fireLifecycle

    public void fireLifecycle(String phase)
                       throws LifecycleException

  Specified by:
    `fireLifecycle` in interface `Registry`
  Throws:
    `LifecycleException`

### lookupConnector

    public Connector lookupConnector(String name)

  Specified by:
    `lookupConnector` in interface `MuleRegistry`

### lookupEndpointBuilder

    public EndpointBuilder lookupEndpointBuilder(String name)

  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`
  Parameters:
    `name` - the name of the endpointBuilder to find
  Returns:
    An endpointBuilder with the name specified or null if there is no endpoint builder with that name

### lookupEndpointFactory

    public EndpointFactory lookupEndpointFactory()

  Specified by:
    `lookupEndpointFactory` in interface `MuleRegistry`

### lookupTransformer

    public Transformer lookupTransformer(String name)

  Specified by:
    `lookupTransformer` in interface `MuleRegistry`

### lookupTransformer

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

  Deprecated. use `lookupTransformer(org.mule.api.transformer.DataType, org.mule.api.transformer.DataType)` instead. This method should only be used internally to discover transformers, typically a user does not need ot do this directly

  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

    @Deprecated
    public List<Transformer> lookupTransformers(Class input,
                                                           Class output)

  Deprecated. use `lookupTransformer(org.mule.api.transformer.DataType, org.mule.api.transformer.DataType)` instead. This method should only be used internally to discover transformers, typically a user does not need ot do this directly

  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.

### lookupTransformer

    public Transformer lookupTransformer(DataType source,
                                         DataType result)
                                  throws TransformerException

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

  Specified by:
    `lookupTransformer` in interface `MuleRegistry`
  Parameters:
    `source` - The desiered input type for the transformer
    `result` - 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<Transformer> lookupTransformers(DataType source,
                                                DataType result)

  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:
    `source` - The desired input type for the transformer
    `result` - 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<Model> getModels()

  Specified by:
    `getModels` in interface `MuleRegistry`

### getConnectors

    public Collection<Connector> getConnectors()

  Specified by:
    `getConnectors` in interface `MuleRegistry`

### getAgents

    public Collection<Agent> getAgents()

  Specified by:
    `getAgents` in interface `MuleRegistry`

### getEndpoints

    public Collection<ImmutableEndpoint> getEndpoints()

  Specified by:
    `getEndpoints` in interface `MuleRegistry`

### getTransformers

    public Collection<Transformer> 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(ServiceType 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(ServiceType type,
                                                        String name,
                                                        Properties overrides)
                                                 throws ServiceException

  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. 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:
    `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

  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.

### applyProcessors

    public Object applyProcessors(Object object,
                                  int flags)
                           throws MuleException

  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
    `flags` - `MuleRegistry` flags which control which injectors will be applied
  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

  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. b

### applyLifecycle

    public Object applyLifecycle(Object object,
                                 String phase)
                          throws MuleException

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

### lookupObject

    public <T> T lookupObject(Class<T> type)
                   throws RegistrationException

  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 <T> T 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 <T> Collection<T> lookupObjects(Class<T> type)

  Look up all objects of a given type.

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

### get

    public <T> T get(String key)

  Description copied from interface: `Registry`
  Alias method performing the lookup, here to simplify syntax when called from dynamic languages.

  Specified by:
    `get` in interface `Registry`

### lookupByType

    public <T> Map<String,T> lookupByType(Class<T> type)

  Specified by:
    `lookupByType` in interface `Registry`
  Returns:
    key/object pairs

### registerObject

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

  Registers an object in the registry with a key.

  Specified by:
    `registerObject` in interface `Registry`
  Parameters:
    `key` - the key to store the value against. This is a non-null value
    `value` - the object to store in the registry. This is a non-null value
    `metadata` - an implementation specific argument that can be passed into the method
  Throws:
    `RegistrationException` - if an object with the same key already exists

### registerObject

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

  Registers an object in the registry with a key.

  Specified by:
    `registerObject` in interface `Registry`
  Parameters:
    `key` - the key to store the value against. This is a non-null value
    `value` - the object to store in the registry. This is a non-null value
  Throws:
    `RegistrationException` - if an object with the same key already exists

### registerObjects

    public void registerObjects(Map objects)
                         throws RegistrationException

  Registers a Map of objects into the registry

  Specified by:
    `registerObjects` in interface `Registry`
  Parameters:
    `objects` - a map of key value pairs, each will individually be registered in the registry
  Throws:
    `RegistrationException` - if an object with the same key already exists

### unregisterObject

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

  Will remove an object by name from the registry. By default the registry must apply all remaining lifecycle phases to the object when it is removed.

  Specified by:
    `unregisterObject` in interface `Registry`
  Parameters:
    `key` - the name or key of the object to remove from the registry
    `metadata` - an implementation specific argument that can be passed into the method
  Throws:
    `RegistrationException` - if there is a problem unregistering the object. Typically this will be because the object's lifecycle threw an exception

### unregisterObject

    public void unregisterObject(String key)
                          throws RegistrationException

  Will remove an object by name from the registry. By default the registry must apply all remaining lifecycle phases to the object when it is removed.

  Specified by:
    `unregisterObject` in interface `Registry`
  Parameters:
    `key` - the name or key of the object to remove from the registry
  Throws:
    `RegistrationException` - if there is a problem unregistering the object. Typically this will be because the object's lifecycle threw an exception

### getName

    protected String getName(Object obj)

  Returns the name for the object passed in. If the object implements `NamedObject`, then `NamedObject.getName()` will be returned, otherwise a name is generated using the class name and a generated UUID.

  Parameters:
    `obj` - the object to inspect
  Returns:
    the name for this object

### 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-2010 MuleSoft, Inc.. All Rights Reserved.