KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > bus > transports > jms > JMSTransportFactory


1 package org.objectweb.celtix.bus.transports.jms;
2
3 import java.io.IOException JavaDoc;
4
5 import javax.wsdl.Port;
6 import javax.wsdl.WSDLException;
7 import javax.xml.bind.JAXBException;
8
9 import org.objectweb.celtix.Bus;
10 import org.objectweb.celtix.bindings.ClientBinding;
11 import org.objectweb.celtix.transports.ClientTransport;
12 import org.objectweb.celtix.transports.ServerTransport;
13 import org.objectweb.celtix.transports.TransportFactory;
14 import org.objectweb.celtix.transports.jms.JMSAddressPolicyType;
15 import org.objectweb.celtix.transports.jms.JMSClientBehaviorPolicyType;
16 import org.objectweb.celtix.transports.jms.JMSServerBehaviorPolicyType;
17 import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
18 import org.objectweb.celtix.wsdl.JAXBExtensionHelper;
19
20 public class JMSTransportFactory implements TransportFactory {
21
22     protected Bus theBus;
23
24     public void init(Bus bus) {
25         theBus = bus;
26         
27         registerExtenstion();
28     }
29         
30     private void registerExtenstion() {
31         
32         try {
33             JAXBExtensionHelper.addExtensions(theBus.getWSDLManager().getExtenstionRegistry(),
34                                               Port.class,
35                                               JMSAddressPolicyType.class);
36             JAXBExtensionHelper.addExtensions(theBus.getWSDLManager().getExtenstionRegistry(),
37                                               Port.class,
38                                               JMSServerBehaviorPolicyType.class);
39             JAXBExtensionHelper.addExtensions(theBus.getWSDLManager().getExtenstionRegistry(),
40                                               Port.class,
41                                               JMSClientBehaviorPolicyType.class);
42         } catch (JAXBException e) {
43             e.printStackTrace();
44         }
45         
46     }
47
48     public ServerTransport createServerTransport(EndpointReferenceType address)
49         throws WSDLException, IOException JavaDoc {
50         return new JMSServerTransport(theBus, address);
51     }
52      
53     public ServerTransport createTransientServerTransport(EndpointReferenceType address)
54         throws WSDLException {
55         return null;
56     }
57      
58     public ClientTransport createClientTransport(EndpointReferenceType address,
59                                                  ClientBinding binding)
60         throws WSDLException, IOException JavaDoc {
61         return new JMSClientTransport(theBus, address, binding);
62     }
63 }
64
Popular Tags