1 package org.objectweb.celtix.bus.bindings; 2 3 import java.io.IOException ; 4 import java.lang.reflect.Method ; 5 import java.util.List ; 6 7 import javax.wsdl.WSDLException; 8 import javax.xml.ws.handler.MessageContext; 9 10 import org.objectweb.celtix.Bus; 11 import org.objectweb.celtix.BusException; 12 import org.objectweb.celtix.bindings.AbstractBindingImpl; 13 import org.objectweb.celtix.bindings.AbstractClientBinding; 14 import org.objectweb.celtix.transports.ClientTransport; 15 import org.objectweb.celtix.transports.TransportFactory; 16 import org.objectweb.celtix.transports.TransportFactoryManager; 17 import org.objectweb.celtix.ws.addressing.EndpointReferenceType; 18 19 public class TestClientBinding extends AbstractClientBinding { 20 21 protected final AbstractBindingImpl binding; 22 23 public TestClientBinding(Bus b, EndpointReferenceType ref) throws WSDLException, IOException { 24 super(b, ref); 25 binding = new TestBinding(this); 26 } 27 28 public AbstractBindingImpl getBindingImpl() { 29 return binding; 30 } 31 32 public TestClientTransport getClientTransport() { 33 if (null == transport) { 34 try { 35 transport = createTransport(reference); 36 } catch (Exception e) { 37 } 39 } 40 return (TestClientTransport)transport; 41 } 42 43 protected ClientTransport createTransport(EndpointReferenceType ref) throws WSDLException, IOException { 44 TransportFactoryManager tfm = bus.getTransportFactoryManager(); 45 String name = "http://celtix.objectweb.org/transports/test"; 46 TransportFactory tf = null; 47 try { 48 tf = tfm.getTransportFactory(name); 49 } catch (BusException ex) { 50 } 52 if (tf == null) { 53 tf = new TestTransportFactory(); 54 try { 55 tfm.registerTransportFactory(name, tf); 56 } catch (BusException ex) { 57 System.out.println(ex.getMessage()); 58 return null; 59 } 60 } 61 return tf.createClientTransport(ref, this); 62 } 63 64 protected Method getSEIMethod(List <Class <?>> classList, MessageContext ctx) { 65 return null; 67 } 68 69 public boolean isBindingCompatible(String address) { 70 return true; 72 } 73 } 74 75 76 | Popular Tags |