1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.providers.soap.axis.extensions; |
12 | |
|
13 | |
import org.mule.MuleException; |
14 | |
import org.mule.config.i18n.CoreMessages; |
15 | |
import org.mule.providers.soap.axis.AxisConnector; |
16 | |
|
17 | |
import java.util.HashMap; |
18 | |
import java.util.Map; |
19 | |
|
20 | |
import org.apache.axis.client.Transport; |
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
public class MuleTransport extends Transport |
26 | |
{ |
27 | |
|
28 | 2 | private static Map transports = null; |
29 | |
|
30 | |
public MuleTransport() |
31 | 0 | { |
32 | 0 | transportName = "MuleTransport"; |
33 | 0 | } |
34 | |
|
35 | |
public MuleTransport(String protocol) |
36 | 108 | { |
37 | 108 | transportName = protocol; |
38 | 108 | } |
39 | |
|
40 | |
private static void initTransports() |
41 | |
{ |
42 | 2 | transports = new HashMap(); |
43 | 30 | transports.put("http", HTTP.class); |
44 | 2 | transports.put("https", HTTPS.class); |
45 | 2 | transports.put("servlet", SERVLET.class); |
46 | 2 | transports.put("tcp", TCP.class); |
47 | 2 | transports.put("ssl", SSL.class); |
48 | 2 | transports.put("jms", JMS.class); |
49 | 2 | transports.put("vm", VM.class); |
50 | 2 | transports.put("xmpp", XMPP.class); |
51 | 2 | transports.put("smtp", SMTP.class); |
52 | 2 | transports.put("smtps", SMTPS.class); |
53 | 2 | transports.put("pop3", POP3.class); |
54 | 2 | transports.put("pop3s", POP3S.class); |
55 | 2 | transports.put("imap", IMAP.class); |
56 | 2 | transports.put("imaps", IMAPS.class); |
57 | 2 | } |
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
public static Class getTransportClass(String protocol) throws MuleException |
66 | |
{ |
67 | 700 | if (protocol == null) |
68 | |
{ |
69 | 0 | throw new IllegalArgumentException(CoreMessages.objectIsNull("protocol").toString()); |
70 | |
} |
71 | 700 | if (!isTransportSupported(protocol)) |
72 | |
{ |
73 | 0 | throw new MuleException( |
74 | |
CoreMessages.schemeNotCompatibleWithConnector(protocol, AxisConnector.class)); |
75 | |
} |
76 | 700 | return (Class)transports.get(protocol); |
77 | |
} |
78 | |
|
79 | |
public static boolean isTransportSupported(String protocol) |
80 | |
{ |
81 | 700 | if (transports == null) |
82 | |
{ |
83 | 2 | initTransports(); |
84 | |
} |
85 | 700 | return transports.get(protocol) != null; |
86 | |
} |
87 | |
|
88 | |
public static class HTTP extends MuleTransport |
89 | |
{ |
90 | |
public HTTP() |
91 | |
{ |
92 | 60 | super("http"); |
93 | 60 | } |
94 | |
} |
95 | |
|
96 | |
public static class HTTPS extends MuleTransport |
97 | |
{ |
98 | |
public HTTPS() |
99 | |
{ |
100 | 0 | super("https"); |
101 | 0 | } |
102 | |
} |
103 | |
|
104 | |
public static class TCP extends MuleTransport |
105 | |
{ |
106 | |
public TCP() |
107 | |
{ |
108 | 0 | super("tcp"); |
109 | 0 | } |
110 | |
} |
111 | |
|
112 | |
public static class SSL extends MuleTransport |
113 | |
{ |
114 | |
public SSL() |
115 | |
{ |
116 | 0 | super("ssl"); |
117 | 0 | } |
118 | |
} |
119 | |
|
120 | |
public static class JMS extends MuleTransport |
121 | |
{ |
122 | |
public JMS() |
123 | |
{ |
124 | 34 | super("jms"); |
125 | 34 | } |
126 | |
} |
127 | |
|
128 | |
public static class POP3 extends MuleTransport |
129 | |
{ |
130 | |
public POP3() |
131 | |
{ |
132 | 0 | super("pop3"); |
133 | 0 | } |
134 | |
} |
135 | |
|
136 | |
public static class SMTP extends MuleTransport |
137 | |
{ |
138 | |
public SMTP() |
139 | |
{ |
140 | 0 | super("smtp"); |
141 | 0 | } |
142 | |
} |
143 | |
|
144 | |
public static class POP3S extends MuleTransport |
145 | |
{ |
146 | |
public POP3S() |
147 | |
{ |
148 | 0 | super("pop3s"); |
149 | 0 | } |
150 | |
} |
151 | |
|
152 | |
public static class SMTPS extends MuleTransport |
153 | |
{ |
154 | |
public SMTPS() |
155 | |
{ |
156 | 0 | super("smtps"); |
157 | 0 | } |
158 | |
} |
159 | |
|
160 | |
public static class IMAP extends MuleTransport |
161 | |
{ |
162 | |
public IMAP() |
163 | |
{ |
164 | 0 | super("imap"); |
165 | 0 | } |
166 | |
} |
167 | |
|
168 | |
public static class IMAPS extends MuleTransport |
169 | |
{ |
170 | |
public IMAPS() |
171 | |
{ |
172 | 0 | super("imaps"); |
173 | 0 | } |
174 | |
} |
175 | |
|
176 | |
public static class XMPP extends MuleTransport |
177 | |
{ |
178 | |
public XMPP() |
179 | |
{ |
180 | 0 | super("xmpp"); |
181 | 0 | } |
182 | |
} |
183 | |
|
184 | |
public static class VM extends MuleTransport |
185 | |
{ |
186 | |
public VM() |
187 | |
{ |
188 | 14 | super("vm"); |
189 | 14 | } |
190 | |
} |
191 | |
|
192 | |
public static class SERVLET extends MuleTransport |
193 | |
{ |
194 | |
public SERVLET() |
195 | |
{ |
196 | 0 | super("servlet"); |
197 | 0 | } |
198 | |
} |
199 | |
} |