Coverage Report - org.mule.transport.soap.axis.extensions.MuleTransport
 
Classes in this File Line Coverage Branch Coverage Complexity
MuleTransport
0%
0/31
0%
0/8
0
MuleTransport$HTTP
0%
0/2
N/A
0
MuleTransport$HTTPS
0%
0/2
N/A
0
MuleTransport$IMAP
0%
0/2
N/A
0
MuleTransport$IMAPS
0%
0/2
N/A
0
MuleTransport$JMS
0%
0/2
N/A
0
MuleTransport$POP3
0%
0/2
N/A
0
MuleTransport$POP3S
0%
0/2
N/A
0
MuleTransport$SERVLET
0%
0/2
N/A
0
MuleTransport$SMTP
0%
0/2
N/A
0
MuleTransport$SMTPS
0%
0/2
N/A
0
MuleTransport$SSL
0%
0/2
N/A
0
MuleTransport$TCP
0%
0/2
N/A
0
MuleTransport$VM
0%
0/2
N/A
0
MuleTransport$XMPP
0%
0/2
N/A
0
 
 1  
 /*
 2  
  * $Id: MuleTransport.java 19191 2010-08-25 21:05:23Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 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  
  * A container for all Mule supported transports for Axis.
 24  
  */
 25  
 public class MuleTransport extends Transport
 26  
 {
 27  
 
 28  0
     private static Map<String, Class> transports = null;
 29  
 
 30  
     public MuleTransport()
 31  0
     {
 32  0
         transportName = "MuleTransport";
 33  0
     }
 34  
 
 35  
     public MuleTransport(String protocol)
 36  0
     {
 37  0
         transportName = protocol;
 38  0
     }
 39  
 
 40  
     private static void initTransports()
 41  
     {
 42  0
         transports = new HashMap<String, Class>();
 43  0
         transports.put("http", HTTP.class);
 44  0
         transports.put("https", HTTPS.class);
 45  0
         transports.put("servlet", SERVLET.class);
 46  0
         transports.put("tcp", TCP.class);
 47  0
         transports.put("ssl", SSL.class);
 48  0
         transports.put("jms", JMS.class);
 49  0
         transports.put("vm", VM.class);
 50  0
         transports.put("xmpp", XMPP.class);
 51  0
         transports.put("smtp", SMTP.class);
 52  0
         transports.put("smtps", SMTPS.class);
 53  0
         transports.put("pop3", POP3.class);
 54  0
         transports.put("pop3s", POP3S.class);
 55  0
         transports.put("imap", IMAP.class);
 56  0
         transports.put("imaps", IMAPS.class);
 57  0
     }
 58  
 
 59  
     /**
 60  
      * @param protocol the Axis soap transport to use
 61  
      * @return The corresponding transport class
 62  
      * @throws DefaultMuleException if the transport is not supported by Axis
 63  
      * @throws NullPointerException if the transport protocol is null
 64  
      */
 65  
     public static Class getTransportClass(String protocol) throws DefaultMuleException
 66  
     {
 67  0
         if (protocol == null)
 68  
         {
 69  0
             throw new IllegalArgumentException(CoreMessages.objectIsNull("protocol").toString());
 70  
         }
 71  0
         if (!isTransportSupported(protocol))
 72  
         {
 73  0
             throw new DefaultMuleException(
 74  
                 CoreMessages.schemeNotCompatibleWithConnector(protocol, AxisConnector.class));
 75  
         }
 76  0
         return transports.get(protocol);
 77  
     }
 78  
 
 79  
     public static boolean isTransportSupported(String protocol)
 80  
     {
 81  0
         if (transports == null)
 82  
         {
 83  0
             initTransports();
 84  
         }
 85  0
         return transports.get(protocol) != null;
 86  
     }
 87  
 
 88  
     public static class HTTP extends MuleTransport
 89  
     {
 90  
         public HTTP()
 91  
         {
 92  0
             super("http");
 93  0
         }
 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  0
             super("jms");
 125  0
         }
 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  0
             super("vm");
 189  0
         }
 190  
     }
 191  
 
 192  
     public static class SERVLET extends MuleTransport
 193  
     {
 194  
         public SERVLET()
 195  
         {
 196  0
             super("servlet");
 197  0
         }
 198  
     }
 199  
 }