Coverage Report - org.mule.config.converters.TransactionFactoryConverter
 
Classes in this File Line Coverage Branch Coverage Complexity
TransactionFactoryConverter
0%
0/9
0%
0/2
8
 
 1  
 /*
 2  
  * $Id: TransactionFactoryConverter.java 7976 2007-08-21 14:26:13Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.converters;
 12  
 
 13  
 import org.mule.umo.UMOTransactionFactory;
 14  
 import org.mule.util.ClassUtils;
 15  
 
 16  
 import org.apache.commons.beanutils.ConversionException;
 17  
 import org.apache.commons.beanutils.Converter;
 18  
 
 19  
 /**
 20  
  * <code>TransactionFactoryConverter</code> TODO
 21  
  */
 22  0
 public class TransactionFactoryConverter implements Converter
 23  
 {
 24  
     // --------------------------------------------------------- Public Methods
 25  
 
 26  
     /**
 27  
      * Convert the specified input object into an output object of the specified
 28  
      * type.
 29  
      * 
 30  
      * @param type Data type to which this value should be converted
 31  
      * @param value The input value to be converted
 32  
      * @throws org.apache.commons.beanutils.ConversionException if conversion cannot
 33  
      *             be performed successfully
 34  
      */
 35  
     public Object convert(Class type, Object value)
 36  
     {
 37  0
         if (value == null)
 38  
         {
 39  0
             throw new ConversionException("No value specified");
 40  
         }
 41  0
         if (value instanceof UMOTransactionFactory)
 42  
         {
 43  0
             return (value);
 44  
         }
 45  
         try
 46  
         {
 47  0
             Object factory = ClassUtils.loadClass(value.toString(), getClass()).newInstance();
 48  0
             return factory;
 49  
         }
 50  0
         catch (Exception e)
 51  
         {
 52  0
             throw new ConversionException(e);
 53  
         }
 54  
     }
 55  
 }