org.mule.config.bootstrap
Class SimpleRegistryBootstrap

java.lang.Object
  extended by org.mule.config.bootstrap.SimpleRegistryBootstrap
All Implemented Interfaces:
MuleContextAware, Initialisable

public class SimpleRegistryBootstrap
extends Object
implements Initialisable, MuleContextAware

This object will load objects defined in a file called registry-bootstrap.properties into the local registry. This allows modules and transports to make certain objects available by default. The most common use case is for a module or transport to load stateless transformers into the registry. For this file to be located it must be present in the modules META-INF directory under

META-INF/services/org/mule/config/

The format of this file is a simple key / value pair. i.e.

 myobject=org.foo.MyObject
 
Will register an instance of MyObject with a key of 'myobject'. If you don't care about the object name and want to ensure that the ojbect gets a unique name you can use -
 object.1=org.foo.MyObject
 object.2=org.bar.MyObject
 
or
 myFoo=org.foo.MyObject
 myBar=org.bar.MyObject
 
Loading transformers has a slightly different notation since you can define the 'returnClass' with optional mime type, and 'name'of the transformer as parameters i.e.
 transformer.1=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=byte[]
 transformer.2=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=java.lang.String:text/xml, name=JMSMessageToString
 transformer.3=org.mule.transport.jms.transformers.JMSMessageToObject,returnClass=java.util.Hashtable)
 
Note that the key used for transformers must be 'transformer.x' where 'x' is a sequential number. The transformer name will be automatically generated as JMSMessageToXXX where XXX is the return class name i.e. JMSMessageToString unless a 'name' parameter is specified. If no 'returnClass' is specified the default in the transformer will be used.

Note that all objects defined have to have a default constructor. They can implement injection interfaces such as MuleContextAware and lifecycle interfaces such as Initialisable.


Field Summary
protected  MuleContext context
           
protected  Log logger
           
 String OBJECT_KEY
           
static String REGISTRY_PROPERTIES
           
static String SERVICE_PATH
           
 String SINGLE_TX
           
 String TRANSFORMER_KEY
           
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Constructor Summary
SimpleRegistryBootstrap()
           
 
Method Summary
 void initialise()
          Method used to perform any initialisation work.
 void setMuleContext(MuleContext context)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_PATH

public static final String SERVICE_PATH
See Also:
Constant Field Values

REGISTRY_PROPERTIES

public static final String REGISTRY_PROPERTIES
See Also:
Constant Field Values

TRANSFORMER_KEY

public String TRANSFORMER_KEY

OBJECT_KEY

public String OBJECT_KEY

SINGLE_TX

public String SINGLE_TX

logger

protected final transient Log logger

context

protected MuleContext context
Constructor Detail

SimpleRegistryBootstrap

public SimpleRegistryBootstrap()
Method Detail

setMuleContext

public void setMuleContext(MuleContext context)

Specified by:
setMuleContext in interface MuleContextAware

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


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.