01: package org.objectweb.celtix.bus.bindings;
02:
03: import java.io.IOException;
04: import java.lang.reflect.Method;
05: import java.util.List;
06:
07: import javax.wsdl.WSDLException;
08: import javax.xml.ws.handler.MessageContext;
09:
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)
24: throws WSDLException, IOException {
25: super (b, ref);
26: binding = new TestBinding(this );
27: }
28:
29: public AbstractBindingImpl getBindingImpl() {
30: return binding;
31: }
32:
33: public TestClientTransport getClientTransport() {
34: if (null == transport) {
35: try {
36: transport = createTransport(reference);
37: } catch (Exception e) {
38: // leave at null
39: }
40: }
41: return (TestClientTransport) transport;
42: }
43:
44: protected ClientTransport createTransport(EndpointReferenceType ref)
45: throws WSDLException, IOException {
46: TransportFactoryManager tfm = bus.getTransportFactoryManager();
47: String name = "http://celtix.objectweb.org/transports/test";
48: TransportFactory tf = null;
49: try {
50: tf = tfm.getTransportFactory(name);
51: } catch (BusException ex) {
52: // ignore
53: }
54: if (tf == null) {
55: tf = new TestTransportFactory();
56: try {
57: tfm.registerTransportFactory(name, tf);
58: } catch (BusException ex) {
59: System.out.println(ex.getMessage());
60: return null;
61: }
62: }
63: return tf.createClientTransport(ref, this );
64: }
65:
66: protected Method getSEIMethod(List<Class<?>> classList,
67: MessageContext ctx) {
68: // TODO Auto-generated method stub
69: return null;
70: }
71:
72: public boolean isBindingCompatible(String address) {
73: // TODO Auto-generated method stub
74: return true;
75: }
76: }
|