org.mule.component
Class DefaultComponentLifecycleAdapter

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

public class DefaultComponentLifecycleAdapter
extends Object
implements LifecycleAdapter

DefaultComponentLifecycleAdapter is a default implementation of LifecycleAdapter for use with JavaComponent that expects component instances to implement Mule lifecycle interfaces in order to receive lifecycle. Lifecycle interfaces supported are -

This implementation also supports JSR-250 lifecycle annotations PostConstruct (for initialisation) and/or PreDestroy (for disposal of the object). Only one of each annotation can be used per component object.

See Also:
for details about the rules for using JSR-250 lifecycle annotations

Field Summary
protected  JavaComponent component
           
protected  Object componentObject
           
protected  Method disposeMethod
           
protected  EntryPointResolverSet entryPointResolver
           
protected  FlowConstruct flowConstruct
           
protected  Method initMethod
           
protected  boolean isDisposable
           
protected  boolean isInitialisable
           
protected  boolean isStartable
           
protected  boolean isStoppable
           
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
DefaultComponentLifecycleAdapter(Object componentObject, JavaComponent component, FlowConstruct flowConstruct, EntryPointResolverSet entryPointResolver, MuleContext muleContext)
           
DefaultComponentLifecycleAdapter(Object componentObject, JavaComponent component, FlowConstruct flowConstruct, MuleContext muleContext)
           
 
Method Summary
 void dispose()
          Propagates dispose() life-cycle to component object implementations if they implement the mule Disposable interface.
protected  Method findDisposeMethod(Object object)
           
protected  Method findInitMethod(Object object)
           
 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()
           
protected  void setLifecycleFlags()
           
 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 Object componentObject

component

protected JavaComponent component

entryPointResolver

protected EntryPointResolverSet entryPointResolver

flowConstruct

protected FlowConstruct flowConstruct

isInitialisable

protected boolean isInitialisable

isStartable

protected boolean isStartable

isStoppable

protected boolean isStoppable

isDisposable

protected boolean isDisposable

initMethod

protected Method initMethod

disposeMethod

protected Method disposeMethod

muleContext

protected MuleContext muleContext
Constructor Detail

DefaultComponentLifecycleAdapter

public DefaultComponentLifecycleAdapter(Object componentObject,
                                        JavaComponent component,
                                        FlowConstruct flowConstruct,
                                        MuleContext muleContext)
                                 throws MuleException
Throws:
MuleException

DefaultComponentLifecycleAdapter

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

setLifecycleFlags

protected void setLifecycleFlags()

findInitMethod

protected Method findInitMethod(Object object)

findDisposeMethod

protected Method findDisposeMethod(Object object)

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

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


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