org.mule.component
Class DefaultLifecycleAdapter

java.lang.Object
  extended by org.mule.component.DefaultLifecycleAdapter
All Implemented Interfaces:
LifecycleAdapter, Disposable, Initialisable, Lifecycle, Startable, Stoppable
Direct Known Subclasses:
NullLifecycleAdapter

public class DefaultLifecycleAdapter
extends Object
implements LifecycleAdapter

DefaultLifecycleAdapter provides lifecycle methods for all Mule managed components. It's possible to plugin custom lifecycle adapters, this can provide additional lifecycle methods triggered by an external source.


Field Summary
protected  JavaComponent component
           
protected  SoftReference<?> componentObject
           
protected  EntryPointResolverSet entryPointResolver
           
protected static Log logger
          logger used by this class
protected  MuleContext muleContext
           
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Startable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Stoppable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
DefaultLifecycleAdapter(Object componentObject, JavaComponent component, EntryPointResolverSet entryPointResolver, MuleContext muleContext)
           
DefaultLifecycleAdapter(Object componentObject, JavaComponent component, MuleContext muleContext)
           
 
Method Summary
protected  void configureBinding()
           
protected  String createRegistryHardRefName(Object object)
          Generate a registry key name for this component.
 void dispose()
          Propagates dispose() life-cycle to component object implementations if they implement the mule Disposable interface.
 void initialise()
          Propagates initialise() life-cycle to component object implementations if they implement the mule Initialisable interface.
 Object invoke(MuleEvent event)
           
 boolean isDisposed()
           
 boolean isStarted()
           
 void start()
          Propagates start() life-cycle to component object implementations if they implement the mule Startable interface.
 void stop()
          Propagates stop() life-cycle to component object implementations if they implement the mule Stoppable interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Log logger
logger used by this class


componentObject

protected SoftReference<?> componentObject

component

protected JavaComponent component

entryPointResolver

protected EntryPointResolverSet entryPointResolver

muleContext

protected MuleContext muleContext
Constructor Detail

DefaultLifecycleAdapter

public DefaultLifecycleAdapter(Object componentObject,
                               JavaComponent component,
                               MuleContext muleContext)
                        throws MuleException
Throws:
MuleException

DefaultLifecycleAdapter

public DefaultLifecycleAdapter(Object componentObject,
                               JavaComponent component,
                               EntryPointResolverSet entryPointResolver,
                               MuleContext muleContext)
                        throws MuleException
Throws:
MuleException
Method Detail

start

public void start()
           throws MuleException
Propagates start() life-cycle to component object implementations if they implement the mule Startable interface. NOT: It is up to component implementations to ensure their implementation of start() is thread-safe.

Specified by:
start in interface Startable
Throws:
MuleException

stop

public void stop()
          throws MuleException
Propagates stop() life-cycle to component object implementations if they implement the mule Stoppable interface. NOT: It is up to component implementations to ensure their implementation of stop() is thread-safe.

Specified by:
stop in interface Stoppable
Throws:
MuleException

dispose

public void dispose()
Propagates dispose() life-cycle to component object implementations if they implement the mule Disposable interface. NOT: It is up to component implementations to ensure their implementation of dispose() is thread-safe.

Specified by:
dispose in interface Disposable

isStarted

public boolean isStarted()
Specified by:
isStarted in interface LifecycleAdapter
Returns:
true if the service has been started

isDisposed

public boolean isDisposed()
Specified by:
isDisposed in interface LifecycleAdapter
Returns:
whether the service managed by this lifecycle has been disposed

invoke

public Object invoke(MuleEvent event)
              throws MuleException
Specified by:
invoke in interface LifecycleAdapter
Throws:
MuleException

initialise

public void initialise()
                throws InitialisationException
Propagates initialise() life-cycle to component object implementations if they implement the mule Initialisable interface.

NOTE: It is up to component implementations to ensure their implementation of initialise() is thread-safe.

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

configureBinding

protected void configureBinding()
                         throws MuleException
Throws:
MuleException

createRegistryHardRefName

protected String createRegistryHardRefName(Object object)
Generate a registry key name for this component. Used to bind component's hard reference to the Mule's lifecycle and prevent the garbage collector from kicking in too early.



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