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.impl.endpoint.MuleEndpointURI; 17 import org.mule.umo.endpoint.UMOEndpointURI; 18 import org.mule.umo.manager.UMOManager; 19 import org.mule.util.XMLEntityCodec; 20 21 24 public class EndpointURIConverter implements Converter 25 { 26 27 36 public Object convert(Class type, Object value) 37 { 38 if (value == null) 39 { 40 throw new ConversionException("No value specified"); 41 } 42 43 if (value instanceof UMOEndpointURI) 44 { 45 return value; 46 } 47 48 try 49 { 50 UMOManager manager = MuleManager.getInstance(); 51 String endpoint = manager.lookupEndpointIdentifier(value.toString(), value.toString()); 52 endpoint = XMLEntityCodec.decodeString(endpoint); 53 return new MuleEndpointURI(endpoint); 54 } 55 catch (Exception e) 56 { 57 throw new ConversionException(e); 58 } 59 } 60 61 } 62 | Popular Tags |