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