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