1 10 11 package org.mule.config.converters; 12 13 import org.apache.commons.beanutils.ConversionException; 14 import org.apache.commons.beanutils.Converter; 15 import org.mule.umo.UMOTransactionFactory; 16 import org.mule.util.ClassUtils; 17 18 21 public class TransactionFactoryConverter implements Converter 22 { 23 25 34 public Object convert(Class type, Object value) 35 { 36 if (value == null) 37 { 38 throw new ConversionException("No value specified"); 39 } 40 if (value instanceof UMOTransactionFactory) 41 { 42 return (value); 43 } 44 try 45 { 46 Object factory = ClassUtils.loadClass(value.toString(), getClass()).newInstance(); 47 return factory; 48 } 49 catch (Exception e) 50 { 51 throw new ConversionException(e); 52 } 53 } 54 } 55 | Popular Tags |