org.mule.config.spring
Class SpringRegistry

java.lang.Object
  extended by org.mule.registry.AbstractRegistry
      extended by org.mule.config.spring.SpringRegistry
All Implemented Interfaces:
Disposable, Initialisable, Registry

public class SpringRegistry
extends AbstractRegistry


Field Summary
protected  org.springframework.context.ApplicationContext applicationContext
           
static String REGISTRY_ID
           
static String SPRING_APPLICATION_CONTEXT
          Key used to lookup Spring Application Context from SpringRegistry via Mule's Registry interface.
protected  AtomicBoolean springContextInitialised
           
 
Fields inherited from class org.mule.registry.AbstractRegistry
lifecycleManager, logger, muleContext
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
SpringRegistry(org.springframework.context.ApplicationContext applicationContext, MuleContext muleContext)
           
SpringRegistry(org.springframework.context.ConfigurableApplicationContext applicationContext, org.springframework.context.ApplicationContext parentContext, MuleContext muleContext)
           
SpringRegistry(MuleContext muleContext)
           
SpringRegistry(String id, org.springframework.context.ApplicationContext applicationContext, MuleContext muleContext)
           
SpringRegistry(String id, org.springframework.context.ConfigurableApplicationContext applicationContext, org.springframework.context.ApplicationContext parentContext, MuleContext muleContext)
           
SpringRegistry(String id, MuleContext muleContext)
           
 
Method Summary
protected  RegistryLifecycleManager createLifecycleManager()
           
 void doDispose()
           
protected  void doInitialise()
           
protected
<T> Map<String,T>
internalLookupByType(Class<T> type, boolean nonSingletons, boolean eagerInit)
           
 boolean isReadOnly()
           
 boolean isRemote()
           
<T> Map<String,T>
lookupByType(Class<T> type)
           
 Object 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.
<T> Collection<T>
lookupObjectsForLifecycle(Class<T> type)
          For lifecycle we only want spring to return singleton objects from it's application context
 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<String,Object> objects)
          Registers a Map of objects into the registry
 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.
 
Methods inherited from class org.mule.registry.AbstractRegistry
dispose, fireLifecycle, get, getLifecycleManager, getRegistryId, initialise, lookupObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REGISTRY_ID

public static final String REGISTRY_ID
See Also:
Constant Field Values

SPRING_APPLICATION_CONTEXT

public static final String SPRING_APPLICATION_CONTEXT
Key used to lookup Spring Application Context from SpringRegistry via Mule's Registry interface.

See Also:
Constant Field Values

applicationContext

protected org.springframework.context.ApplicationContext applicationContext

springContextInitialised

protected AtomicBoolean springContextInitialised
Constructor Detail

SpringRegistry

public SpringRegistry(MuleContext muleContext)

SpringRegistry

public SpringRegistry(String id,
                      MuleContext muleContext)

SpringRegistry

public SpringRegistry(org.springframework.context.ApplicationContext applicationContext,
                      MuleContext muleContext)

SpringRegistry

public SpringRegistry(String id,
                      org.springframework.context.ApplicationContext applicationContext,
                      MuleContext muleContext)

SpringRegistry

public SpringRegistry(org.springframework.context.ConfigurableApplicationContext applicationContext,
                      org.springframework.context.ApplicationContext parentContext,
                      MuleContext muleContext)

SpringRegistry

public SpringRegistry(String id,
                      org.springframework.context.ConfigurableApplicationContext applicationContext,
                      org.springframework.context.ApplicationContext parentContext,
                      MuleContext muleContext)
Method Detail

doInitialise

protected void doInitialise()
                     throws InitialisationException
Specified by:
doInitialise in class AbstractRegistry
Throws:
InitialisationException

doDispose

public void doDispose()
Specified by:
doDispose in class AbstractRegistry

createLifecycleManager

protected RegistryLifecycleManager createLifecycleManager()
Overrides:
createLifecycleManager in class AbstractRegistry

lookupObject

public Object lookupObject(String key)
Description copied from interface: Registry
Look up a single object by name.

Returns:
object or null if not found

lookupObjects

public <T> Collection<T> lookupObjects(Class<T> type)
Description copied from interface: Registry
Look up all objects of a given type.

Returns:
collection of objects or empty collection if none found

lookupObjectsForLifecycle

public <T> Collection<T> lookupObjectsForLifecycle(Class<T> type)
For lifecycle we only want spring to return singleton objects from it's application context

Specified by:
lookupObjectsForLifecycle in interface Registry
Overrides:
lookupObjectsForLifecycle in class AbstractRegistry
Returns:
collection of objects or empty collection if none found

lookupByType

public <T> Map<String,T> lookupByType(Class<T> type)
Returns:
key/object pairs

internalLookupByType

protected <T> Map<String,T> internalLookupByType(Class<T> type,
                                                 boolean nonSingletons,
                                                 boolean eagerInit)

registerObject

public void registerObject(String key,
                           Object value)
                    throws RegistrationException
Description copied from interface: Registry
Registers an object in the registry with a key.

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

registerObject

public void registerObject(String key,
                           Object value,
                           Object metadata)
                    throws RegistrationException
Description copied from interface: Registry
Registers an object in the registry with a key.

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

registerObjects

public void registerObjects(Map<String,Object> objects)
                     throws RegistrationException
Description copied from interface: Registry
Registers a Map of objects into the 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)
Description copied from interface: Registry
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.

Parameters:
key - the name or key of the object to remove from the registry

unregisterObject

public void unregisterObject(String key,
                             Object metadata)
                      throws RegistrationException
Description copied from interface: Registry
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.

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

isReadOnly

public boolean isReadOnly()

isRemote

public boolean isRemote()


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