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.MuleManager; 16 import org.mule.umo.provider.UMOConnector; 17 18 21 public class ConnectorConverter implements Converter 22 { 23 24 26 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 UMOConnector) 41 { 42 return (value); 43 } 44 try 45 { 46 UMOConnector c = MuleManager.getInstance().lookupConnector(value.toString()); 47 if (c == null) 48 { 49 throw new ConversionException("UMOConnector: " + value.toString() 50 + " has not been registered with Mule"); 51 } 52 return c; 53 } 54 catch (Exception e) 55 { 56 throw new ConversionException(e); 57 } 58 } 59 } 60 | Popular Tags |