KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > bus > bindings > xml > XMLBindingFactory


1 package org.objectweb.celtix.bus.bindings.xml;
2
3 import java.io.IOException JavaDoc;
4 import javax.wsdl.BindingInput;
5 import javax.wsdl.BindingOutput;
6 import javax.wsdl.WSDLException;
7 import javax.xml.bind.JAXBException;
8
9 import org.objectweb.celtix.Bus;
10 import org.objectweb.celtix.bindings.BindingFactory;
11 import org.objectweb.celtix.bindings.ClientBinding;
12 import org.objectweb.celtix.bindings.ServerBinding;
13 import org.objectweb.celtix.bindings.ServerBindingEndpointCallback;
14 import org.objectweb.celtix.bindings.xmlformat.TBody;
15 import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
16 import org.objectweb.celtix.wsdl.JAXBExtensionHelper;
17
18 public class XMLBindingFactory implements BindingFactory {
19     
20     private Bus bus;
21     
22     public XMLBindingFactory() {
23         //Complete
24
}
25     
26     public void init(Bus b) {
27         bus = b;
28         try {
29             JAXBExtensionHelper.addExtensions(bus.getWSDLManager().getExtenstionRegistry(),
30                                               BindingInput.class,
31                                               TBody.class);
32             JAXBExtensionHelper.addExtensions(bus.getWSDLManager().getExtenstionRegistry(),
33                                               BindingOutput.class,
34                                               TBody.class);
35         } catch (JAXBException e) {
36             //ignore, we can continue without the extension registered
37
}
38     }
39     
40     public ClientBinding createClientBinding(EndpointReferenceType reference)
41         throws WSDLException, IOException JavaDoc {
42         return new XMLClientBinding(bus, reference);
43     }
44
45     public ServerBinding createServerBinding(EndpointReferenceType reference,
46                                              ServerBindingEndpointCallback cbFactory)
47         throws WSDLException, IOException JavaDoc {
48         return new XMLServerBinding(bus, reference, cbFactory);
49     }
50 }
51
Popular Tags