Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.mule.construct
Class AbstractFlowConstruct

    java.lang.Object
      org.mule.construct.AbstractFlowConstruct

All Implemented Interfaces:
  FlowConstruct, Disposable, Initialisable, Lifecycle, LifecycleStateEnabled, Startable, Stoppable, MessageProcessor

Direct Known Subclasses:
  Bridge, SimpleFlowConstruct, SimpleService, Validator, WSProxy

    public abstract class AbstractFlowConstruct

extends Object
implements FlowConstruct, Lifecycle, MessageProcessor

Abstract implementation of `FlowConstruct` that:

- Is constructed with unique name and `MuleContext`.
- Uses a `MessageSource` as the source of messages.
- Uses a chain of `MessageProcessor`s to process messages.
- Has lifecycle and propagates this lifecycle to both `MessageSource` and `MessageProcessor`s in the correct order depending on the lifecycle phase.
- Allows an `ExceptionListener` to be set.
  Implementations of `AbstractFlowConstuct` should implement and `validateConstruct()` to construct the processing chain required and 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`
  `protected FlowConstructLifecycleManager` | `lifecycleManager`
  `protected Log` | `logger`
  `protected MessageInfoMapping` | `messageInfoMapping`
  `protected MessageProcessor` | `messageProcessorChain`
  `protected MessageSource` | `messageSource`
  `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`

  Constructor Summary
  `AbstractFlowConstruct(String name, MuleContext muleContext)`

  Method Summary
  `protected abstract void` | `configureMessageProcessors(InterceptingChainMessageProcessorBuilder builder)` Used to configure the processing chain for this `FlowConstuct` `MessageProcessor`s to the chain using the builder provided.
  `protected void` | `createMessageProcessor()` Creates a `MessageProcessor` that will process messages from the configured `MessageSource`.
  `void` | `dispose()` A lifecycle method where implementor should free up any resources.
  `protected void` | `doDispose()`
  `protected void` | `doInitialise()`
  `protected void` | `doStart()`
  `protected void` | `doStop()`
  `MessagingExceptionHandler` | `getExceptionListener()`
  `LifecycleState` | `getLifecycleState()`
  `MessageInfoMapping` | `getMessageInfoMapping()`
  `MessageSource` | `getMessageSource()`
  `MuleContext` | `getMuleContext()`
  `String` | `getName()`
  `FlowConstructStatistics` | `getStatistics()`
  `void` | `initialise()` Method used to perform any initialisation work.
  `boolean` | `isStarted()`
  `boolean` | `isStopped()`
  `boolean` | `isStopping()`
  `MuleEvent` | `process(MuleEvent event)` Invokes the MessageProcessor.
  `void` | `setExceptionListener(MessagingExceptionHandler exceptionListener)`
  `void` | `setMessageInfoMapping(MessageInfoMapping messageInfoMapping)`
  `void` | `setMessageSource(MessageSource messageSource)`
  `void` | `start()`
  `void` | `stop()`
  `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

  ### messageSource

      protected MessageSource messageSource

  ### messageProcessorChain

      protected MessageProcessor messageProcessorChain

  ### exceptionListener

      protected MessagingExceptionHandler exceptionListener

  ### lifecycleManager

      protected final FlowConstructLifecycleManager lifecycleManager

  ### muleContext

      protected final MuleContext muleContext

  ### statistics

      protected final FlowConstructStatistics statistics

  ### messageInfoMapping

      protected MessageInfoMapping messageInfoMapping

  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()

  ### createMessageProcessor

      protected void createMessageProcessor()
                                     throws MuleException

    Creates a `MessageProcessor` that will process messages from the configured `MessageSource`.

    The default implementation of this methods uses a `InterceptingChainMessageProcessorBuilder` and allows a chain of `MessageProcessor`s to be configured using the `configureMessageProcessors(InterceptingChainMessageProcessorBuilder)` method but if you wish to use another `MessageProcessorBuilder` or just a single `MessageProcessor` then this method can be overridden and return a single `MessageProcessor` instead.

    Throws:
      `MuleException`

  ### configureMessageProcessors

      protected abstract void configureMessageProcessors(InterceptingChainMessageProcessorBuilder builder)
                                                  throws MuleException

    Used to configure the processing chain for this `FlowConstuct` `MessageProcessor`s to the chain using the builder provided.

    To use a different builder of to construct a composite `MessageProcessor` manually override `createMessageProcessor()` instead.

    Parameters:
      `builder` - instance of `InterceptingChainMessageProcessorBuilder`
    Throws:
      `MuleException`

  ### getName

      public String getName()

    Specified by:
      `getName` in interface `FlowConstruct`
    Returns:
      The name which identifies this flow construct which is unique in MuleConext registry

  ### 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)

  ### getLifecycleState

      public LifecycleState getLifecycleState()

    Specified by:
      `getLifecycleState` in interface `LifecycleStateEnabled`

  ### getMuleContext

      public MuleContext getMuleContext()

    Specified by:
      `getMuleContext` in interface `FlowConstruct`

  ### getMessageSource

      public MessageSource getMessageSource()

  ### setMessageSource

      public void setMessageSource(MessageSource messageSource)

  ### 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 InitialisationException

    Throws:
      `InitialisationException`

  ### 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

  ### toString

      public String toString()

    Overrides:
      `toString` in class `Object`

  ### process

      public MuleEvent process(MuleEvent event)
                        throws MuleException

    Description copied from interface: `MessageProcessor`
    Invokes the MessageProcessor.

    Specified by:
      `process` in interface `MessageProcessor`
    Parameters:
      `event` - MuleEvent to be processed
    Returns:
      optional response MuleEvent
    Throws:
      `MuleException`

  Overview | Package | Class | Use | Tree | Deprecated | Index | Help
  PREV CLASS NEXT CLASS | FRAMES NO FRAMES
  SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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