org.mule.construct
Class AbstractFlowConstruct

java.lang.Object
  extended by org.mule.construct.AbstractFlowConstruct
All Implemented Interfaces:
AnnotatedObject, FlowConstruct, Disposable, Initialisable, Lifecycle, LifecycleStateEnabled, Startable, Stoppable, NamedObject
Direct Known Subclasses:
AbstractPipeline

public abstract class AbstractFlowConstruct
extends Object
implements FlowConstruct, Lifecycle, AnnotatedObject

Abstract implementation of FlowConstruct that:

Implementations of AbstractFlowConstuct should implement validateConstruct() validate the resulting construct. Validation may include validation of the type of attributes of the MessageSource.

Implementations may also implement doInitialise(), doStart(), doStop() and doDispose() if they need to perform any action on lifecycle transitions.


Field Summary
protected  MessagingExceptionHandler exceptionListener
           
static String INITIAL_STATE_STARTED
           
static String INITIAL_STATE_STOPPED
          The initial states that the flow can be started in
protected  String initialState
          Determines the initial state of this flow when the mule starts.
protected  FlowConstructLifecycleManager lifecycleManager
           
protected  Log logger
           
protected  MessageInfoMapping messageInfoMapping
           
protected  MuleContext muleContext
           
protected  String name
           
protected  FlowConstructStatistics statistics
           
 
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
 
Fields inherited from interface org.mule.api.AnnotatedObject
PROPERTY_NAME
 
Constructor Summary
AbstractFlowConstruct(String name, MuleContext muleContext)
           
 
Method Summary
protected  void configureStatistics()
           
 void dispose()
          A lifecycle method where implementor should free up any resources.
protected  void disposeIfDisposable(Object candidate)
           
protected  void doDispose()
           
protected  void doInitialise()
           
protected  void doStart()
           
protected  void doStop()
           
 Object getAnnotation(QName name)
          Gets the value of specified annotation.
 Map<QName,Object> getAnnotations()
          Gets all annotations.
abstract  String getConstructType()
           
 MessagingExceptionHandler getExceptionListener()
           
 String getInitialState()
           
 LifecycleState getLifecycleState()
           
 MessageInfoMapping getMessageInfoMapping()
           
 MuleContext getMuleContext()
           
 String getName()
          Gets the name of the object
 FlowConstructStatistics getStatistics()
           
 void initialise()
          Method used to perform any initialisation work.
protected  void initialiseIfInitialisable(Object candidate)
           
protected  void injectFlowConstructMuleContext(Object candidate)
           
 boolean isStarted()
           
 boolean isStopped()
           
 boolean isStopping()
           
 void setAnnotations(Map<QName,Object> newAnnotations)
          Sets annotations to the object.
 void setExceptionListener(MessagingExceptionHandler exceptionListener)
           
 void setInitialState(String initialState)
           
 void setMessageInfoMapping(MessageInfoMapping messageInfoMapping)
           
 void start()
           
protected  void startIfStartable(Object candidate)
           
 void stop()
           
protected  void stopIfStoppable(Object candidate)
           
 String toString()
           
protected  void validateConstruct()
          Validates configured flow construct
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected transient Log logger

name

protected String name

exceptionListener

protected MessagingExceptionHandler exceptionListener

lifecycleManager

protected final FlowConstructLifecycleManager lifecycleManager

muleContext

protected final MuleContext muleContext

statistics

protected FlowConstructStatistics statistics

messageInfoMapping

protected MessageInfoMapping messageInfoMapping

INITIAL_STATE_STOPPED

public static final String INITIAL_STATE_STOPPED
The initial states that the flow can be started in

See Also:
Constant Field Values

INITIAL_STATE_STARTED

public static final String INITIAL_STATE_STARTED
See Also:
Constant Field Values

initialState

protected String initialState
Determines the initial state of this flow when the mule starts. Can be 'stopped' or 'started' (default)

Constructor Detail

AbstractFlowConstruct

public AbstractFlowConstruct(String name,
                             MuleContext muleContext)
Method Detail

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

start

public final void start()
                 throws MuleException
Specified by:
start in interface Startable
Throws:
MuleException

stop

public final void stop()
                throws MuleException
Specified by:
stop in interface Stoppable
Throws:
MuleException

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

isStarted

public boolean isStarted()

isStopped

public boolean isStopped()

isStopping

public boolean isStopping()

getName

public String getName()
Description copied from interface: NamedObject
Gets the name of the object

Specified by:
getName in interface NamedObject
Returns:
the name of the object

getExceptionListener

public MessagingExceptionHandler getExceptionListener()
Specified by:
getExceptionListener in interface FlowConstruct
Returns:
The exception listener that will be used to handle exceptions that may be thrown at different points during the message flow defined by this construct.

setExceptionListener

public void setExceptionListener(MessagingExceptionHandler exceptionListener)

getInitialState

public String getInitialState()

setInitialState

public void setInitialState(String initialState)

getLifecycleState

public LifecycleState getLifecycleState()
Specified by:
getLifecycleState in interface LifecycleStateEnabled

getMuleContext

public MuleContext getMuleContext()
Specified by:
getMuleContext in interface FlowConstruct
Returns:
This muleContext that this flow construct belongs to and runs in the context of.

getStatistics

public FlowConstructStatistics getStatistics()
Specified by:
getStatistics in interface FlowConstruct
Returns:
The statistics holder used by this flow construct to keep track of its activity.

getMessageInfoMapping

public MessageInfoMapping getMessageInfoMapping()
Specified by:
getMessageInfoMapping in interface FlowConstruct
Returns:
This implementation of MessageInfoMapping used to control how Important message information is pulled from the current message.

setMessageInfoMapping

public void setMessageInfoMapping(MessageInfoMapping messageInfoMapping)

doInitialise

protected void doInitialise()
                     throws MuleException
Throws:
MuleException

configureStatistics

protected void configureStatistics()

doStart

protected void doStart()
                throws MuleException
Throws:
MuleException

doStop

protected void doStop()
               throws MuleException
Throws:
MuleException

doDispose

protected void doDispose()

validateConstruct

protected void validateConstruct()
                          throws FlowConstructInvalidException
Validates configured flow construct

Throws:
FlowConstructInvalidException - if the flow construct does not pass validation

injectFlowConstructMuleContext

protected void injectFlowConstructMuleContext(Object candidate)

toString

public String toString()
Overrides:
toString in class Object

initialiseIfInitialisable

protected void initialiseIfInitialisable(Object candidate)
                                  throws InitialisationException
Throws:
InitialisationException

startIfStartable

protected void startIfStartable(Object candidate)
                         throws MuleException
Throws:
MuleException

stopIfStoppable

protected void stopIfStoppable(Object candidate)
                        throws MuleException
Throws:
MuleException

disposeIfDisposable

protected void disposeIfDisposable(Object candidate)

getAnnotation

public final Object getAnnotation(QName name)
Description copied from interface: AnnotatedObject
Gets the value of specified annotation.

Specified by:
getAnnotation in interface AnnotatedObject
Returns:
the value of specified annotation

getAnnotations

public final Map<QName,Object> getAnnotations()
Description copied from interface: AnnotatedObject
Gets all annotations.

Specified by:
getAnnotations in interface AnnotatedObject
Returns:
all annotation

setAnnotations

public final void setAnnotations(Map<QName,Object> newAnnotations)
Description copied from interface: AnnotatedObject
Sets annotations to the object.

Specified by:
setAnnotations in interface AnnotatedObject

getConstructType

public abstract String getConstructType()
Returns:
the type of construct being created, e.g. "Flow"


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