1
2
3
4
5
6
7
8
9
10 package it.imolinfo.jbi4cics.jbi.xfire;
11
12 import it.imolinfo.jbi4cics.Logger;
13 import it.imolinfo.jbi4cics.LoggerFactory;
14 import javax.jbi.component.ComponentContext;
15 import org.codehaus.xfire.handler.LocateBindingHandler;
16 import org.codehaus.xfire.service.Service;
17 import org.codehaus.xfire.soap.SoapTransport;
18 import org.codehaus.xfire.soap.handler.SoapBodyHandler;
19 import org.codehaus.xfire.transport.AbstractTransport;
20 import org.codehaus.xfire.transport.Channel;
21 import org.codehaus.xfire.transport.DefaultEndpoint;
22 import org.codehaus.xfire.wsdl11.WSDL11Transport;
23
24
25
26
27
28
29 public class JbiTransport extends AbstractTransport
30 implements WSDL11Transport, SoapTransport {
31
32 public static final String JBI_BINDING
33 = "http://java.sun.com/xml/ns/jbi/binding/service+engine";
34
35
36
37
38 private static final Logger LOG
39 = LoggerFactory.getLogger(JbiTransport.class);
40
41 private static final String URI_PREFIX = "urn:xfire:transport:jbi:";
42
43
44
45
46
47
48 private static final int HASH_CODE = 61;
49
50 private ComponentContext context;
51
52 public JbiTransport(ComponentContext context) {
53 addInHandler(new LocateBindingHandler());
54 addInHandler(new SoapBodyHandler());
55 this.context = context;
56 }
57
58 public String getName() {
59 return "JBI";
60 }
61
62 public String getServiceURL(Service service) {
63 return "jbi://" + service.getName();
64 }
65
66 protected Channel createNewChannel(String uri) {
67 JbiChannel c;
68
69 if (LOG.isDebugEnabled()) {
70 LOG.debug("Creating new channel for uri: " + uri);
71 }
72 c = new JbiChannel(uri, this);
73 c.setEndpoint(new DefaultEndpoint());
74 return c;
75 }
76
77 protected String getUriPrefix() {
78 return URI_PREFIX;
79 }
80
81 @Override
82 public String[] getSupportedBindings() {
83 return new String[] { JBI_BINDING };
84 }
85
86 public String[] getKnownUriSchemes() {
87 return new String[] { "jbi://" };
88 }
89
90 public ComponentContext getContext() {
91 return context;
92 }
93
94
95
96
97
98
99
100
101
102
103 @Override
104 public boolean equals(Object obj) {
105 return (obj instanceof JbiTransport);
106 }
107
108
109
110
111
112
113
114 @Override
115 public int hashCode() {
116 return HASH_CODE;
117 }
118 }