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