1 10 11 package org.mule.providers.soap.xfire.transport; 12 13 import org.apache.commons.logging.Log; 14 import org.apache.commons.logging.LogFactory; 15 import org.codehaus.xfire.service.Service; 16 import org.codehaus.xfire.soap.SoapTransport; 17 import org.codehaus.xfire.soap.SoapTransportHelper; 18 import org.codehaus.xfire.transport.AbstractTransport; 19 import org.codehaus.xfire.transport.Channel; 20 import org.codehaus.xfire.transport.DefaultEndpoint; 21 import org.codehaus.xfire.transport.MapSession; 22 import org.codehaus.xfire.transport.Session; 23 import org.codehaus.xfire.wsdl11.WSDL11Transport; 24 import org.mule.providers.soap.xfire.MuleInvoker; 25 import org.mule.umo.manager.UMOWorkManager; 26 27 30 public class MuleLocalTransport extends AbstractTransport implements SoapTransport, WSDL11Transport 31 { 32 public static final String BINDING_ID = "urn:xfire:transport:local"; 33 public static final String URI_PREFIX = "xfire.local://"; 34 35 38 protected transient Log logger = LogFactory.getLog(getClass()); 39 40 private Session session; 41 private boolean maintainSession; 42 protected final UMOWorkManager workManager; 43 44 public MuleLocalTransport(UMOWorkManager workManager) 45 { 46 super(); 47 SoapTransportHelper.createSoapTransport(this); 48 this.workManager = workManager; 49 } 50 51 public String getServiceURL(Service service) 52 { 53 String ep = ((MuleInvoker)service.getInvoker()).getEndpoint().getEndpointURI().getAddress(); 54 return ep + "/" + service.getSimpleName(); 55 } 56 57 protected Channel createNewChannel(String uri) 58 { 59 logger.debug("Creating new channel for uri: " + uri); 60 61 MuleLocalChannel c = new MuleLocalChannel(uri, this, session); 62 c.setWorkManager(workManager); 63 c.setEndpoint(new DefaultEndpoint()); 64 65 return c; 66 } 67 68 public void setMaintainSession(boolean maintainSession) 69 { 70 this.maintainSession = maintainSession; 71 resetSession(); 72 } 73 74 public void resetSession() 75 { 76 if (maintainSession) 77 { 78 session = new MapSession(); 79 } 80 else 81 { 82 session = null; 83 } 84 } 85 86 protected String getUriPrefix() 87 { 88 return URI_PREFIX; 89 } 90 91 public String [] getSupportedBindings() 92 { 93 return new String []{BINDING_ID}; 94 } 95 96 public String [] getKnownUriSchemes() 97 { 98 return new String []{URI_PREFIX}; 99 } 100 101 public String getName() 102 { 103 return "Local"; 104 } 105 106 public String [] getSoapTransportIds() 107 { 108 return new String []{BINDING_ID}; 109 } 110 } 111 | Popular Tags |