Coverage Report - org.mule.config.spring.factories.MuleTransactionManagerFactoryBean
 
Classes in this File Line Coverage Branch Coverage Complexity
MuleTransactionManagerFactoryBean
0%
0/7
0%
0/2
1.667
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.config.spring.factories;
 8  
 
 9  
 import org.mule.api.MuleContext;
 10  
 import org.mule.api.context.MuleContextAware;
 11  
 
 12  
 import javax.transaction.TransactionManager;
 13  
 
 14  
 import org.springframework.beans.factory.BeanCreationException;
 15  
 import org.springframework.beans.factory.config.AbstractFactoryBean;
 16  
 
 17  
 /**
 18  
  * Creates a reference to the TransactionManager configured on the MuleContext.  This is useful when you need to inject
 19  
  * the TransactionManager into other objects such as XA data Sources.
 20  
  *
 21  
  * In order to use this factory bean you must have a transaction manager configured in the context i.e.
 22  
  * <code><jbossts:transaction-manager/></code>
 23  
  */
 24  0
 public class MuleTransactionManagerFactoryBean extends AbstractFactoryBean implements MuleContextAware
 25  
 {
 26  
     private MuleContext muleContext;
 27  
 
 28  
     public void setMuleContext(MuleContext context)
 29  
     {
 30  0
         muleContext = context;
 31  0
     }
 32  
 
 33  
     public Class getObjectType()
 34  
     {
 35  0
         return TransactionManager.class;
 36  
     }
 37  
 
 38  
     protected Object createInstance() throws Exception
 39  
     {
 40  0
         if(muleContext.getTransactionManager()==null)
 41  
         {
 42  0
             throw new BeanCreationException("you must have a transaction manager configured inside the context when using " + getClass().getName());
 43  
         }
 44  0
         return muleContext.getTransactionManager();
 45  
     }
 46  
 }