Coverage Report - org.mule.config.spring.factories.MessageProcessorChainFactoryBean
 
Classes in this File Line Coverage Branch Coverage Complexity
MessageProcessorChainFactoryBean
0%
0/16
0%
0/6
0
 
 1  
 /*
 2  
  * $Id: OutboundEndpointFactoryBean.java 11079 2008-02-27 15:52:01Z tcarlson $
 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.config.spring.factories;
 12  
 
 13  
 import org.mule.api.processor.MessageProcessor;
 14  
 import org.mule.api.processor.MessageProcessorBuilder;
 15  
 import org.mule.processor.builder.InterceptingChainMessageProcessorBuilder;
 16  
 
 17  
 import java.util.List;
 18  
 
 19  
 import org.springframework.beans.factory.FactoryBean;
 20  
 
 21  0
 public class MessageProcessorChainFactoryBean implements FactoryBean
 22  
 {
 23  
 
 24  
     protected List processors;
 25  
     protected String name;
 26  
 
 27  
     public Class getObjectType()
 28  
     {
 29  0
         return MessageProcessor.class;
 30  
     }
 31  
 
 32  
     public void setMessageProcessors(List processors)
 33  
     {
 34  0
         this.processors = processors;
 35  0
     }
 36  
 
 37  
     public Object getObject() throws Exception
 38  
     {
 39  0
         InterceptingChainMessageProcessorBuilder builder = new InterceptingChainMessageProcessorBuilder();
 40  0
         builder.setName(name);
 41  0
         for (Object processor : processors)
 42  
         {
 43  0
             if (processor instanceof MessageProcessor)
 44  
             {
 45  0
                 builder.chain((MessageProcessor) processor);
 46  
             }
 47  0
             else if (processor instanceof MessageProcessorBuilder)
 48  
             {
 49  0
                 builder.chain((MessageProcessorBuilder) processor);
 50  
             }
 51  
             else
 52  
             {
 53  0
                 throw new IllegalArgumentException(
 54  
                     "MessageProcessorBuilder should only have MessageProcessor's or MessageProcessorBuilder's configured");
 55  
             }
 56  
         }
 57  0
         return builder.build();
 58  
     }
 59  
 
 60  
     public boolean isSingleton()
 61  
     {
 62  0
         return false;
 63  
     }
 64  
 
 65  
     public void setName(String name)
 66  
     {
 67  0
         this.name = name;
 68  0
     }
 69  
 
 70  
 }