org.mule.registry
Class AbstractRegistry

java.lang.Object
  extended by org.mule.registry.AbstractRegistry
All Implemented Interfaces:
Disposable, Initialisable, Registry
Direct Known Subclasses:
GuiceRegistry, SpringRegistry, TransientRegistry

public abstract class AbstractRegistry
extends Object
implements Registry


Field Summary
protected  RegistryLifecycleManager lifecycleManager
           
protected  Log logger
           
protected  MuleContext 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
protected AbstractRegistry(String id, MuleContext muleContext)
           
 
Method Summary
protected  RegistryLifecycleManager createLifecycleManager()
           
 void dispose()
          A lifecycle method where implementor should free up any resources.
protected abstract  void doDispose()
           
protected abstract  void doInitialise()
           
 void fireLifecycle(String phase)
           
<T> T
get(String key)
          Alias method performing the lookup, here to simplify syntax when called from dynamic languages.
 RegistryLifecycleManager getLifecycleManager()
           
 String getRegistryId()
           
 void initialise()
          Method used to perform any initialisation work.
<T> T
lookupObject(Class<T> type)
          Look up a single object by type.
<T> Collection<T>
lookupObjectsForLifecycle(Class<T> type)
          Look up all objects of a given type that lifecycle should be applied to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mule.api.registry.Registry
isReadOnly, isRemote, lookupByType, lookupObject, lookupObjects, registerObject, registerObject, registerObjects, unregisterObject, unregisterObject
 

Field Detail

logger

protected transient Log logger

muleContext

protected MuleContext muleContext

lifecycleManager

protected RegistryLifecycleManager lifecycleManager
Constructor Detail

AbstractRegistry

protected AbstractRegistry(String id,
                           MuleContext muleContext)
Method Detail

dispose

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

createLifecycleManager

protected RegistryLifecycleManager createLifecycleManager()

doInitialise

protected abstract void doInitialise()
                              throws InitialisationException
Throws:
InitialisationException

doDispose

protected abstract void doDispose()

initialise

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

getLifecycleManager

public RegistryLifecycleManager getLifecycleManager()

fireLifecycle

public void fireLifecycle(String phase)
                   throws LifecycleException
Specified by:
fireLifecycle in interface Registry
Throws:
LifecycleException

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

lookupObject

public <T> T lookupObject(Class<T> 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.

lookupObjectsForLifecycle

public <T> Collection<T> lookupObjectsForLifecycle(Class<T> type)
Description copied from interface: Registry
Look up all objects of a given type that lifecycle should be applied to. This method differs from Registry.lookupObjects(Class) in that it allows implementations to provide an alternative implementation of lookup for lifecycle. For example only returning pre-existing objects and not creating new ones on the fly.

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

getRegistryId

public final String getRegistryId()
Specified by:
getRegistryId in interface Registry


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