01: package org.objectweb.celtix.jbi.transport;
02:
03: import java.io.IOException;
04: import java.util.logging.Logger;
05:
06: import javax.jbi.messaging.DeliveryChannel;
07: import javax.wsdl.WSDLException;
08:
09: import org.objectweb.celtix.Bus;
10: import org.objectweb.celtix.bindings.ClientBinding;
11: import org.objectweb.celtix.bindings.ResponseCallback;
12: import org.objectweb.celtix.jbi.se.CeltixServiceUnitManager;
13: import org.objectweb.celtix.transports.ClientTransport;
14: import org.objectweb.celtix.transports.ServerTransport;
15: import org.objectweb.celtix.transports.TransportFactory;
16: import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
17:
18: /**
19: * Celtix Transport Factory for JBI Transport.
20: */
21: public class JBITransportFactory implements TransportFactory {
22:
23: private static final Logger LOG = Logger
24: .getLogger(JBITransportFactory.class.getName());
25:
26: private CeltixServiceUnitManager suManager;
27: private DeliveryChannel deliveryChannel;
28:
29: public void init(Bus b) {
30: }
31:
32: public DeliveryChannel getDeliveryChannel() {
33: return deliveryChannel;
34: }
35:
36: public void setDeliveryChannel(DeliveryChannel newDeliverychannel) {
37: LOG.fine("configuring DeliveryChannel: " + newDeliverychannel);
38: deliveryChannel = newDeliverychannel;
39: }
40:
41: public CeltixServiceUnitManager getServiceUnitManager() {
42: return suManager;
43: }
44:
45: public void setServiceUnitManager(CeltixServiceUnitManager sum) {
46: if (sum == null) {
47: Thread.dumpStack();
48: }
49: LOG.fine("configuring ServiceUnitManager: " + sum);
50: suManager = sum;
51: }
52:
53: public ServerTransport createServerTransport(
54: EndpointReferenceType address) throws WSDLException,
55: IOException {
56: LOG.info("creating JBI server transport");
57:
58: if (suManager == null || deliveryChannel == null) {
59: LOG
60: .severe("JBITransportFactory is not properly initialised");
61: LOG.severe("CeltixServiceUnitManager: " + suManager);
62: LOG.severe("DeliveryChannel: " + deliveryChannel);
63: throw new IllegalStateException(
64: "JBITransport factory not fully initalised");
65: }
66:
67: return new JBIServerTransport(suManager, deliveryChannel);
68: }
69:
70: public ServerTransport createTransientServerTransport(
71: EndpointReferenceType address) throws WSDLException,
72: IOException {
73:
74: throw new RuntimeException("not yet implemented");
75: }
76:
77: public ClientTransport createClientTransport(
78: EndpointReferenceType address, ClientBinding binding)
79: throws WSDLException, IOException {
80:
81: LOG.info("creating JBI client transport");
82:
83: if (deliveryChannel == null) {
84: LOG
85: .severe("JBITransportFactory is not properly initialised");
86: LOG.severe("DeliveryChannel: " + deliveryChannel);
87: throw new IllegalStateException(
88: "JBITransport factory not fully initalised");
89: }
90:
91: return new JBIClientTransport(deliveryChannel, address, binding);
92: }
93:
94: public void setResponseCallback(ResponseCallback callback) {
95: throw new RuntimeException("not yet implemented");
96: }
97: }
|