Coverage Report - org.mule.config.spring.factories.FlowRefFactoryBean
 
Classes in this File Line Coverage Branch Coverage Complexity
FlowRefFactoryBean
0%
0/8
N/A
0
FlowRefFactoryBean$1
0%
0/2
N/A
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 org.mule.api.MuleEvent;
 14  
 import org.mule.api.MuleException;
 15  
 import org.mule.api.processor.MessageProcessor;
 16  
 
 17  
 import org.springframework.beans.BeansException;
 18  
 import org.springframework.beans.factory.FactoryBean;
 19  
 import org.springframework.context.ApplicationContext;
 20  
 import org.springframework.context.ApplicationContextAware;
 21  
 
 22  0
 public class FlowRefFactoryBean implements FactoryBean<MessageProcessor>, ApplicationContextAware
 23  
 {
 24  
 
 25  
     private String refName;;
 26  
     private ApplicationContext applicationContext;
 27  
 
 28  
     public void setName(String name)
 29  
     {
 30  0
         this.refName = name;
 31  0
     }
 32  
 
 33  
     public MessageProcessor getObject() throws Exception
 34  
     {
 35  
         // Create new message processor to decouple lifecycle
 36  0
         return new MessageProcessor()
 37  0
         {
 38  
             public MuleEvent process(MuleEvent event) throws MuleException
 39  
             {
 40  0
                 return ((MessageProcessor) applicationContext.getBean(refName)).process(event);
 41  
             }
 42  
         };
 43  
     }
 44  
 
 45  
     public boolean isSingleton()
 46  
     {
 47  0
         return false;
 48  
     }
 49  
 
 50  
     public Class<?> getObjectType()
 51  
     {
 52  0
         return MessageProcessor.class;
 53  
     }
 54  
 
 55  
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
 56  
     {
 57  0
         this.applicationContext = applicationContext;
 58  0
     }
 59  
 }