KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > bus > bindings > TestClientBinding


1 package org.objectweb.celtix.bus.bindings;
2
3 import java.io.IOException JavaDoc;
4 import java.lang.reflect.Method JavaDoc;
5 import java.util.List JavaDoc;
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 JavaDoc {
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 JavaDoc e) {
37                 // leave at null
38
}
39         }
40         return (TestClientTransport)transport;
41     }
42     
43     protected ClientTransport createTransport(EndpointReferenceType ref) throws WSDLException, IOException JavaDoc {
44         TransportFactoryManager tfm = bus.getTransportFactoryManager();
45         String JavaDoc name = "http://celtix.objectweb.org/transports/test";
46         TransportFactory tf = null;
47         try {
48             tf = tfm.getTransportFactory(name);
49         } catch (BusException ex) {
50             // ignore
51
}
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 JavaDoc getSEIMethod(List JavaDoc<Class JavaDoc<?>> classList, MessageContext ctx) {
65         // TODO Auto-generated method stub
66
return null;
67     }
68
69     public boolean isBindingCompatible(String JavaDoc address) {
70         // TODO Auto-generated method stub
71
return true;
72     }
73 }
74     
75     
76
Popular Tags