Coverage Report - org.mule.processor.chain.AbstractMessageProcessorChainBuilder
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractMessageProcessorChainBuilder
0%
0/11
0%
0/2
1.5
 
 1  
 /*
 2  
  * $Id: AbstractMessageProcessorChainBuilder.java 20320 2010-11-24 15:03:31Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.processor.chain;
 12  
 
 13  
 import org.mule.api.MuleException;
 14  
 import org.mule.api.construct.FlowConstruct;
 15  
 import org.mule.api.processor.MessageProcessor;
 16  
 import org.mule.api.processor.MessageProcessorBuilder;
 17  
 import org.mule.api.processor.MessageProcessorChainBuilder;
 18  
 
 19  
 import java.util.ArrayList;
 20  
 import java.util.List;
 21  
 
 22  
 /**
 23  
  * <p>
 24  
  * Constructs a chain of {@link MessageProcessor}s and wraps the invocation of the chain in a composite
 25  
  * MessageProcessor. Both MessageProcessors and InterceptingMessageProcessor's can be chained together
 26  
  * arbitrarily in a single chain. InterceptingMessageProcessors simply intercept the next MessageProcessor in
 27  
  * the chain. When other non-intercepting MessageProcessors are used an adapter is used internally to chain
 28  
  * the MessageProcessor with the next in the chain.
 29  
  * </p>
 30  
  * <p>
 31  
  * The MessageProcessor instance that this builder builds can be nested in other chains as required.
 32  
  * </p>
 33  
  */
 34  
 public abstract class AbstractMessageProcessorChainBuilder implements MessageProcessorChainBuilder
 35  
 {
 36  
 
 37  0
     protected List processors = new ArrayList();
 38  
     protected String name;
 39  
     protected FlowConstruct flowConstruct;
 40  
 
 41  
     public AbstractMessageProcessorChainBuilder()
 42  0
     {
 43  
         // empty
 44  0
     }
 45  
 
 46  
     public AbstractMessageProcessorChainBuilder(FlowConstruct flowConstruct)
 47  0
     {
 48  0
         this.flowConstruct = flowConstruct;
 49  0
     }
 50  
 
 51  
     // Argument is of type Object because it could be a MessageProcessor or a MessageProcessorBuilder
 52  
     protected MessageProcessor initializeMessageProcessor(Object processor) throws MuleException
 53  
     {
 54  
         // TODO DF: FlowConstuct should be injected here but there is an issue with spring not have reference
 55  
         // to it. For now we inject it once the MessageProcessor is built and this works, but
 56  
         // MessageProcessorBuilders should have FlowConstuct available when building really.
 57  
 
 58  0
         if (processor instanceof MessageProcessorBuilder)
 59  
         {
 60  0
             return ((MessageProcessorBuilder) processor).build();
 61  
         }
 62  
         else
 63  
         {
 64  0
             return (MessageProcessor) processor;
 65  
         }
 66  
     }
 67  
 
 68  
     public void setName(String name)
 69  
     {
 70  0
         this.name = name;
 71  0
     }
 72  
 
 73  
 }