Coverage Report - org.mule.config.spring.factories.AbstractSelectiveRouterFactoryBean
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractSelectiveRouterFactoryBean
0%
0/12
0%
0/2
0
 
 1  
 /*
 2  
  * $Id$
 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 java.util.Collection;
 14  
 
 15  
 import org.mule.api.processor.MessageProcessor;
 16  
 import org.mule.routing.AbstractSelectiveRouter;
 17  
 import org.mule.routing.MessageProcessorFilterPair;
 18  
 import org.springframework.beans.factory.FactoryBean;
 19  
 
 20  
 public abstract class AbstractSelectiveRouterFactoryBean implements FactoryBean
 21  
 {
 22  
     private MessageProcessor defaultProcessor;
 23  
     private Collection<MessageProcessorFilterPair> conditionalMessageProcessors;
 24  
 
 25  
     public AbstractSelectiveRouterFactoryBean()
 26  
     {
 27  0
         super();
 28  0
     }
 29  
 
 30  
     public void setDefaultRoute(MessageProcessorFilterPair conditionalProcessor)
 31  
     {
 32  0
         defaultProcessor = conditionalProcessor.getMessageProcessor();
 33  0
     }
 34  
 
 35  
     public void setRoutes(Collection<MessageProcessorFilterPair> conditionalMessageProcessors)
 36  
     {
 37  0
         this.conditionalMessageProcessors = conditionalMessageProcessors;
 38  0
     }
 39  
 
 40  
     public Object getObject() throws Exception
 41  
     {
 42  0
         final AbstractSelectiveRouter router = newAbstractSelectiveRouter();
 43  0
         router.setDefaultRoute(defaultProcessor);
 44  
 
 45  0
         for (final MessageProcessorFilterPair mpfp : conditionalMessageProcessors)
 46  
         {
 47  0
             router.addRoute(mpfp.getMessageProcessor(), mpfp.getFilter());
 48  
         }
 49  
 
 50  0
         return router;
 51  
     }
 52  
 
 53  
     protected abstract AbstractSelectiveRouter newAbstractSelectiveRouter();
 54  
 
 55  
     public boolean isSingleton()
 56  
     {
 57  0
         return true;
 58  
     }
 59  
 
 60  
 }