org.mule.processor.chain
Class DefaultMessageProcessorChainBuilder

java.lang.Object
  extended by org.mule.processor.chain.AbstractMessageProcessorChainBuilder
      extended by org.mule.processor.chain.DefaultMessageProcessorChainBuilder
All Implemented Interfaces:
MessageProcessorBuilder, MessageProcessorChainBuilder
Direct Known Subclasses:
SimpleMessageProcessorChainBuilder

public class DefaultMessageProcessorChainBuilder
extends AbstractMessageProcessorChainBuilder

Constructs a chain of MessageProcessors and wraps the invocation of the chain in a composite MessageProcessor. Both MessageProcessors and InterceptingMessageProcessor's can be chained together arbitrarily in a single chain. InterceptingMessageProcessors simply intercept the next MessageProcessor in the chain. When other non-intercepting MessageProcessors are used an adapter is used internally to chain the MessageProcessor with the next in the chain.

The MessageProcessor instance that this builder builds can be nested in other chains as required.


Field Summary
 
Fields inherited from class org.mule.processor.chain.AbstractMessageProcessorChainBuilder
flowConstruct, name, processors
 
Constructor Summary
DefaultMessageProcessorChainBuilder()
           
DefaultMessageProcessorChainBuilder(FlowConstruct flowConstruct)
           
 
Method Summary
 MessageProcessorChain build()
          This builder supports the chaining together of message processors that intercept and also those that don't.
 DefaultMessageProcessorChainBuilder chain(List<MessageProcessor> processors)
           
 DefaultMessageProcessorChainBuilder chain(MessageProcessor... processors)
           
 DefaultMessageProcessorChainBuilder chain(MessageProcessorBuilder... builders)
           
 DefaultMessageProcessorChainBuilder chainBefore(MessageProcessor processor)
           
 DefaultMessageProcessorChainBuilder chainBefore(MessageProcessorBuilder builder)
           
protected  DefaultMessageProcessorChain createInnerChain(LinkedList<MessageProcessor> tempList)
           
protected  DefaultMessageProcessorChain createOuterChain(LinkedList<MessageProcessor> tempList)
           
 
Methods inherited from class org.mule.processor.chain.AbstractMessageProcessorChainBuilder
initializeMessageProcessor, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultMessageProcessorChainBuilder

public DefaultMessageProcessorChainBuilder()

DefaultMessageProcessorChainBuilder

public DefaultMessageProcessorChainBuilder(FlowConstruct flowConstruct)
Method Detail

build

public MessageProcessorChain build()
                            throws MuleException
This builder supports the chaining together of message processors that intercept and also those that don't. While one can iterate over message processor intercepting message processors need to be chained together. One solution is make all message processors intercepting (via adaption) and chain them all together, this results in huge stack traces and recursive calls with adaptor. The alternative is to build the chain in such a way that we iterate when we can and chain where we need to.
We iterate over the list of message processor to be chained together in reverse order collecting up those that can be iterated over in a temporary list, as soon as we have an intercepting message processor we create a DefaultMessageProcessorChain using the temporary list and set it as a listener of the intercepting message processor and then we continue with the algorithm

Throws:
MuleException

createInnerChain

protected DefaultMessageProcessorChain createInnerChain(LinkedList<MessageProcessor> tempList)

createOuterChain

protected DefaultMessageProcessorChain createOuterChain(LinkedList<MessageProcessor> tempList)

chain

public DefaultMessageProcessorChainBuilder chain(MessageProcessor... processors)

chain

public DefaultMessageProcessorChainBuilder chain(List<MessageProcessor> processors)

chain

public DefaultMessageProcessorChainBuilder chain(MessageProcessorBuilder... builders)

chainBefore

public DefaultMessageProcessorChainBuilder chainBefore(MessageProcessor processor)

chainBefore

public DefaultMessageProcessorChainBuilder chainBefore(MessageProcessorBuilder builder)


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