Coverage Report - org.mule.providers.soap.axis.AxisConnector
 
Classes in this File Line Coverage Branch Coverage Complexity
AxisConnector
76%
164/217
62%
46/74
1.976
 
 1  
 /*
 2  
  * $Id: AxisConnector.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.providers.soap.axis;
 12  
 
 13  
 import org.mule.MuleManager;
 14  
 import org.mule.config.ExceptionHelper;
 15  
 import org.mule.config.i18n.CoreMessages;
 16  
 import org.mule.impl.MuleDescriptor;
 17  
 import org.mule.impl.endpoint.MuleEndpoint;
 18  
 import org.mule.impl.internal.notifications.ManagerNotification;
 19  
 import org.mule.impl.internal.notifications.ManagerNotificationListener;
 20  
 import org.mule.impl.model.ModelHelper;
 21  
 import org.mule.providers.AbstractConnector;
 22  
 import org.mule.providers.http.servlet.ServletConnector;
 23  
 import org.mule.providers.service.TransportFactory;
 24  
 import org.mule.providers.soap.MethodFixInterceptor;
 25  
 import org.mule.providers.soap.axis.extensions.MuleConfigProvider;
 26  
 import org.mule.providers.soap.axis.extensions.MuleTransport;
 27  
 import org.mule.providers.soap.axis.extensions.WSDDFileProvider;
 28  
 import org.mule.providers.soap.axis.extensions.WSDDJavaMuleProvider;
 29  
 import org.mule.umo.UMOComponent;
 30  
 import org.mule.umo.UMOException;
 31  
 import org.mule.umo.endpoint.UMOEndpoint;
 32  
 import org.mule.umo.endpoint.UMOEndpointURI;
 33  
 import org.mule.umo.lifecycle.InitialisationException;
 34  
 import org.mule.umo.manager.UMOServerNotification;
 35  
 import org.mule.umo.model.UMOModel;
 36  
 import org.mule.umo.provider.UMOMessageReceiver;
 37  
 import org.mule.util.ClassUtils;
 38  
 import org.mule.util.MuleUrlStreamHandlerFactory;
 39  
 
 40  
 import java.util.ArrayList;
 41  
 import java.util.HashMap;
 42  
 import java.util.Iterator;
 43  
 import java.util.List;
 44  
 import java.util.Map;
 45  
 
 46  
 import javax.xml.namespace.QName;
 47  
 
 48  
 import org.apache.axis.client.Call;
 49  
 import org.apache.axis.configuration.SimpleProvider;
 50  
 import org.apache.axis.deployment.wsdd.WSDDConstants;
 51  
 import org.apache.axis.deployment.wsdd.WSDDProvider;
 52  
 import org.apache.axis.encoding.TypeMappingRegistryImpl;
 53  
 import org.apache.axis.encoding.ser.BeanDeserializerFactory;
 54  
 import org.apache.axis.encoding.ser.BeanSerializerFactory;
 55  
 import org.apache.axis.handlers.soap.SOAPService;
 56  
 import org.apache.axis.server.AxisServer;
 57  
 import org.apache.axis.wsdl.fromJava.Namespaces;
 58  
 import org.apache.axis.wsdl.fromJava.Types;
 59  
 
 60  
 /**
 61  
  * <code>AxisConnector</code> is used to maintain one or more Services for Axis
 62  
  * server instance.
 63  
  * <p>
 64  
  * Some of the Axis specific service initialisation code was adapted from the Ivory
 65  
  * project (http://ivory.codehaus.org). Thanks guys :)
 66  
  */
 67  
 public class AxisConnector extends AbstractConnector implements ManagerNotificationListener
 68  
 {
 69  
     /* Register the AxisFault Exception reader if this class gets loaded */
 70  
     static
 71  
     {
 72  2
         ExceptionHelper.registerExceptionReader(new AxisFaultExceptionReader());
 73  
     }
 74  
 
 75  2
     public static final QName QNAME_MULE_PROVIDER = new QName(WSDDConstants.URI_WSDD_JAVA, "Mule");
 76  2
     public static final QName QNAME_MULE_TYPE_MAPPINGS = new QName("http://www.muleumo.org/ws/mappings",
 77  
         "Mule");
 78  
     public static final String DEFAULT_MULE_NAMESPACE_URI = "http://www.muleumo.org";
 79  
 
 80  
     public static final String DEFAULT_MULE_AXIS_SERVER_CONFIG = "mule-axis-server-config.wsdd";
 81  
     public static final String DEFAULT_MULE_AXIS_CLIENT_CONFIG = "mule-axis-client-config.wsdd";
 82  
     public static final String AXIS_SERVICE_COMPONENT_NAME = "_axisServiceComponent";
 83  
     public static final String AXIS_SERVICE_PROPERTY = "_axisService";
 84  
     public static final String AXIS_CLIENT_CONFIG_PROPERTY = "clientConfig";
 85  
 
 86  
     public static final String SERVICE_PROPERTY_COMPONENT_NAME = "componentName";
 87  
     public static final String SERVICE_PROPERTY_SERVCE_PATH = "servicePath";
 88  
 
 89  
     public static final String WSDL_URL_PROPERTY = "wsdlUrl";
 90  
 
 91  
     private String serverConfig;
 92  
     private AxisServer axisServer;
 93  
     private SimpleProvider serverProvider;
 94  
     private String clientConfig;
 95  
     private SimpleProvider clientProvider;
 96  
 
 97  
     private List beanTypes;
 98  
     private MuleDescriptor axisDescriptor;
 99  
     
 100  
     //this will store the name of the descriptor of the current connector's AxisServiceComponent
 101  
     private String specificAxisServiceComponentName;
 102  
 
 103  
     /**
 104  
      * These protocols will be set on client invocations. by default Mule uses it's
 105  
      * own transports rather that Axis's. This is only because it gives us more
 106  
      * flexibility inside Mule and simplifies the code
 107  
      */
 108  
     private Map axisTransportProtocols;
 109  
 
 110  
     /**
 111  
      * A store of registered servlet services that need to have their endpoints
 112  
      * re-written with the 'real' http url instead of the servlet:// one. This is
 113  
      * only required to ensure wsdl is generated correctly. I would like a clearer
 114  
      * way of doing this so I can remove this workaround
 115  
      */
 116  56
     private List servletServices = new ArrayList();
 117  
 
 118  
     private List supportedSchemes;
 119  
 
 120  56
     private boolean doAutoTypes = true;
 121  
 
 122  56
     private boolean treatMapAsNamedParams = true;
 123  
 
 124  
     public AxisConnector()
 125  
     {
 126  56
         super();
 127  56
         registerProtocols();
 128  
 
 129  56
     }
 130  
 
 131  
     protected void registerProtocols()
 132  
     {
 133  
         // Default supported schemes, these can be restricted
 134  
         // through configuration
 135  56
         supportedSchemes = new ArrayList();
 136  56
         supportedSchemes.add("http");
 137  56
         supportedSchemes.add("https");
 138  56
         supportedSchemes.add("servlet");
 139  56
         supportedSchemes.add("vm");
 140  56
         supportedSchemes.add("jms");
 141  56
         supportedSchemes.add("xmpp");
 142  56
         supportedSchemes.add("smtp");
 143  56
         supportedSchemes.add("smtps");
 144  56
         supportedSchemes.add("pop3");
 145  56
         supportedSchemes.add("pop3s");
 146  56
         supportedSchemes.add("imap");
 147  56
         supportedSchemes.add("imaps");
 148  56
         supportedSchemes.add("ssl");
 149  56
         supportedSchemes.add("tcp");
 150  
 
 151  56
         for (Iterator iterator = supportedSchemes.iterator(); iterator.hasNext();)
 152  
         {
 153  784
             String s = (String) iterator.next();
 154  784
             registerSupportedProtocol(s);
 155  784
         }
 156  56
     }
 157  
 
 158  
     protected void doInitialise() throws InitialisationException
 159  
     {
 160  50
         axisTransportProtocols = new HashMap();
 161  50
         specificAxisServiceComponentName = AXIS_SERVICE_COMPONENT_NAME + "_" + name;
 162  
         
 163  
         try
 164  
         {
 165  50
             for (Iterator iterator = supportedSchemes.iterator(); iterator.hasNext();)
 166  
             {
 167  700
                 String s = (String)iterator.next();
 168  700
                 axisTransportProtocols.put(s, MuleTransport.getTransportClass(s));
 169  700
                 registerSupportedProtocol(s);
 170  700
             }
 171  50
             MuleManager.getInstance().registerListener(this);
 172  
         }
 173  0
         catch (Exception e)
 174  
         {
 175  0
             throw new InitialisationException(e, this);
 176  50
         }
 177  
 
 178  50
         if (serverConfig == null)
 179  
         {
 180  50
             serverConfig = DEFAULT_MULE_AXIS_SERVER_CONFIG;
 181  
         }
 182  50
         if (clientConfig == null)
 183  
         {
 184  50
             clientConfig = DEFAULT_MULE_AXIS_CLIENT_CONFIG;
 185  
         }
 186  50
         serverProvider = createAxisProvider(serverConfig);
 187  50
         clientProvider = createAxisProvider(clientConfig);
 188  
 
 189  
         // Create the AxisServer
 190  50
         axisServer = new AxisServer(serverProvider);
 191  50
         axisServer.setOption("axis.doAutoTypes", Boolean.valueOf(doAutoTypes));
 192  
 
 193  
         // Register the Mule service serverProvider
 194  50
         WSDDProvider.registerProvider(QNAME_MULE_PROVIDER, new WSDDJavaMuleProvider(this));
 195  
 
 196  
         try
 197  
         {
 198  50
             registerTransportTypes();
 199  
         }
 200  0
         catch (ClassNotFoundException e)
 201  
         {
 202  0
             throw new InitialisationException(
 203  
                 CoreMessages.cannotLoadFromClasspath(e.getMessage()), e, this);
 204  50
         }
 205  
 
 206  
         // Register all our UrlStreamHandlers here so they can be resolved. This is necessary
 207  
         // to make Mule work in situations where modification of system properties at runtime
 208  
         // is not reliable, e.g. when running in maven's surefire test executor.
 209  50
         MuleUrlStreamHandlerFactory.registerHandler("jms", new org.mule.providers.soap.axis.transport.jms.Handler());
 210  50
         MuleUrlStreamHandlerFactory.registerHandler("pop3", new org.mule.providers.soap.axis.transport.pop3.Handler());
 211  50
         MuleUrlStreamHandlerFactory.registerHandler("smtp", new org.mule.providers.soap.axis.transport.smtp.Handler());
 212  50
         MuleUrlStreamHandlerFactory.registerHandler("vm", new org.mule.providers.soap.axis.transport.vm.Handler());
 213  
 
 214  
         try
 215  
         {
 216  50
             registerTypes((TypeMappingRegistryImpl)axisServer.getTypeMappingRegistry(), beanTypes);
 217  
         }
 218  0
         catch (ClassNotFoundException e)
 219  
         {
 220  0
             throw new InitialisationException(e, this);
 221  50
         }
 222  50
     }
 223  
 
 224  
     protected void registerTransportTypes() throws ClassNotFoundException
 225  
     {
 226  
         // Register Transport handlers
 227  
         // By default these will all be handled by Mule, however some companies may
 228  
         // have
 229  
         // their own they wish to use
 230  50
         for (Iterator iterator = getAxisTransportProtocols().keySet().iterator(); iterator.hasNext();)
 231  
         {
 232  700
             String protocol = (String)iterator.next();
 233  700
             Object temp = getAxisTransportProtocols().get(protocol);
 234  
             Class clazz;
 235  700
             if (temp instanceof String)
 236  
             {
 237  0
                 clazz = ClassUtils.loadClass(temp.toString(), getClass());
 238  
             }
 239  
             else
 240  
             {
 241  700
                 clazz = (Class) temp;
 242  
             }
 243  700
             Call.setTransportForProtocol(protocol, clazz);
 244  700
         }
 245  50
     }
 246  
 
 247  
     protected SimpleProvider createAxisProvider(String config) throws InitialisationException
 248  
     {
 249  
         // Use our custom file provider that does not require services to be declared
 250  
         // in the WSDD. This only affects the
 251  
         // client side as the client will fallback to the FileProvider when invoking
 252  
         // a service.
 253  100
         WSDDFileProvider fileProvider = new WSDDFileProvider(config);
 254  100
         fileProvider.setSearchClasspath(true);
 255  
         /*
 256  
          * Wrap the FileProvider with a SimpleProvider so we can programmatically
 257  
          * configure the Axis server (you can only use wsdd descriptors with the
 258  
          * FileProvider)
 259  
          */
 260  100
         return new MuleConfigProvider(fileProvider);
 261  
     }
 262  
 
 263  
     public String getProtocol()
 264  
     {
 265  3352
         return "axis";
 266  
     }
 267  
 
 268  
     /**
 269  
      * The method determines the key used to store the receiver against.
 270  
      * 
 271  
      * @param component the component for which the endpoint is being registered
 272  
      * @param endpoint the endpoint being registered for the component
 273  
      * @return the key to store the newly created receiver against. In this case it
 274  
      *         is the component name, which is equivalent to the Axis service name.
 275  
      */
 276  
     protected Object getReceiverKey(UMOComponent component, UMOEndpoint endpoint)
 277  
     {
 278  366
         if (endpoint.getEndpointURI().getPort() == -1)
 279  
         {
 280  210
             return component.getDescriptor().getName();
 281  
         }
 282  
         else
 283  
         {
 284  156
             return endpoint.getEndpointURI().getAddress() + "/" + component.getDescriptor().getName();
 285  
         }
 286  
     }
 287  
 
 288  
     public UMOMessageReceiver createReceiver(UMOComponent component, UMOEndpoint endpoint) throws Exception
 289  
     {
 290  
         // this is always initialised as synchronous as ws invocations should
 291  
         // always execute in a single thread unless the endpoint has explicitly
 292  
         // been set to run asynchronously
 293  76
         if (!endpoint.isSynchronousSet() && !endpoint.isSynchronous())
 294  
         {
 295  56
             if (logger.isDebugEnabled())
 296  
             {
 297  0
                 logger.debug("overriding endpoint synchronicity and setting it to true. Web service requests are executed in a single thread");
 298  
             }
 299  56
             endpoint.setSynchronous(true);
 300  
         }
 301  
 
 302  76
         return super.createReceiver(component, endpoint);
 303  
     }
 304  
 
 305  
     protected void unregisterReceiverWithMuleService(UMOMessageReceiver receiver, UMOEndpointURI ep)
 306  
         throws UMOException
 307  
     {
 308  72
         String endpointKey = getCounterEndpointKey(receiver.getEndpointURI());
 309  
 
 310  72
         for (Iterator iterator = axisDescriptor.getInboundRouter().getEndpoints().iterator(); iterator.hasNext();)
 311  
         {
 312  72
             UMOEndpoint umoEndpoint = (UMOEndpoint)iterator.next();
 313  72
             if (endpointKey.startsWith(umoEndpoint.getEndpointURI().getAddress()))
 314  
             {
 315  0
                 logger.info("Unregistering Axis endpoint: " + endpointKey + " for service: "
 316  
                             + receiver.getComponent().getDescriptor().getName());
 317  
             }
 318  
             try
 319  
             {
 320  72
                 umoEndpoint.getConnector()
 321  
                     .unregisterListener(receiver.getComponent(), receiver.getEndpoint());
 322  
             }
 323  0
             catch (Exception e)
 324  
             {
 325  0
                 logger.error("Failed to unregister Axis endpoint: " + endpointKey + " for service: "
 326  
                              + receiver.getComponent().getDescriptor().getName() + ". Error is: "
 327  
                              + e.getMessage(), e);
 328  72
             }
 329  
             // TODO why break? For does not loop.
 330  0
             break;
 331  
         }
 332  72
     }
 333  
 
 334  
     protected void registerReceiverWithMuleService(UMOMessageReceiver receiver, UMOEndpointURI ep)
 335  
         throws UMOException
 336  
     {
 337  
         // If this is the first receiver we need to create the Axis service
 338  
         // component
 339  
         // this will be registered with Mule when the Connector starts
 340  72
         if (axisDescriptor == null)
 341  
         {
 342  
             // See if the axis descriptor has already been added. This allows
 343  
             // developers to override the default configuration, say to increase
 344  
             // the threadpool
 345  36
             axisDescriptor = getAxisDescriptorFromSystemModel();
 346  36
             if (axisDescriptor == null)
 347  
             {
 348  36
                 axisDescriptor = createAxisDescriptor();
 349  
             }
 350  
             else
 351  
             {
 352  
                 // Lets unregister the 'template' instance, configure it and
 353  
                 // then register
 354  
                 // again later
 355  0
                 MuleManager.getInstance().lookupModel(ModelHelper.SYSTEM_MODEL).unregisterComponent(axisDescriptor);
 356  
                 
 357  
                 //if the descriptor still contains the original AXIS_SERVICE_COMPONENT_NAME name,
 358  
                 //we need to change it to the specific name which is AXIS_SERVICE_COMPONENT_NAME_<connector_name>
 359  0
                 if (AXIS_SERVICE_COMPONENT_NAME.equals(axisDescriptor.getName()))
 360  
                 {
 361  0
                     axisDescriptor.setName(specificAxisServiceComponentName);
 362  
                 }
 363  
             }
 364  
             // if the axis server hasn't been set, set it now. The Axis server
 365  
             // may be set
 366  
             // externally
 367  36
             if (axisDescriptor.getProperties().get("axisServer") == null)
 368  
             {
 369  36
                 axisDescriptor.getProperties().put("axisServer", axisServer);
 370  
             }
 371  36
             axisDescriptor.setContainerManaged(false);
 372  
         }
 373  72
         String serviceName = receiver.getComponent().getDescriptor().getName();
 374  
         // No determine if the endpointUri requires a new connector to be
 375  
         // registed in the case of http we only need to register the new endpointUri
 376  
         // if
 377  
         // the port is different
 378  
         // If we're using VM or Jms we just use the resource infor directly without
 379  
         // appending a service name
 380  
         String endpoint;
 381  72
         String scheme = ep.getScheme().toLowerCase();
 382  72
         if (scheme.equals("jms") || scheme.equals("vm"))
 383  
         {
 384  40
             endpoint = ep.toString();
 385  
         }
 386  
         else
 387  
         {
 388  32
             endpoint = receiver.getEndpointURI().getAddress() + "/" + serviceName;
 389  
         }
 390  72
         if (logger.isDebugEnabled())
 391  
         {
 392  0
             logger.debug("Modified endpoint with " + scheme + " scheme to " + endpoint);
 393  
         }
 394  
 
 395  
         // Default to using synchronous for socket based protocols unless the
 396  
         // synchronous property has been set explicitly
 397  72
         boolean sync = false;
 398  72
         if (!receiver.getEndpoint().isSynchronousSet())
 399  
         {
 400  4
             if (scheme.equals("http") || scheme.equals("https") || scheme.equals("ssl")
 401  
                 || scheme.equals("tcp"))
 402  
             {
 403  4
                 sync = true;
 404  
             }
 405  
         }
 406  
         else
 407  
         {
 408  68
             sync = receiver.getEndpoint().isSynchronous();
 409  
         }
 410  
 
 411  72
         UMOEndpoint serviceEndpoint = new MuleEndpoint(endpoint, true);
 412  72
         serviceEndpoint.setSynchronous(sync);
 413  72
         serviceEndpoint.setName(ep.getScheme() + ":" + serviceName);
 414  
         // set the filter on the axis endpoint on the real receiver endpoint
 415  72
         serviceEndpoint.setFilter(receiver.getEndpoint().getFilter());
 416  
         // Remove the Axis filter now
 417  72
         receiver.getEndpoint().setFilter(null);
 418  
 
 419  
         // set the Security filter on the axis endpoint on the real receiver endpoint
 420  72
         serviceEndpoint.setSecurityFilter(receiver.getEndpoint().getSecurityFilter());
 421  
         // Remove the Axis Receiver Security filter now
 422  72
         receiver.getEndpoint().setSecurityFilter(null);
 423  
 
 424  72
         if (receiver.getEndpoint().getTransformer() != null)
 425  
         {
 426  0
             serviceEndpoint.setTransformer(receiver.getEndpoint().getTransformer());
 427  0
             receiver.getEndpoint().setTransformer(null);
 428  
         }
 429  
         
 430  
         //set transaction properties
 431  72
         if(receiver.getEndpoint().getTransactionConfig()!= null)
 432  
         {
 433  72
             serviceEndpoint.setTransactionConfig(receiver.getEndpoint().getTransactionConfig());
 434  72
             receiver.getEndpoint().setTransactionConfig(null);
 435  
         }
 436  
         
 437  
         // propagate properties to the service endpoint
 438  72
         serviceEndpoint.getProperties().putAll(receiver.getEndpoint().getProperties());
 439  
 
 440  72
         axisDescriptor.getInboundRouter().addEndpoint(serviceEndpoint);
 441  
 
 442  72
     }
 443  
 
 444  
     private String getCounterEndpointKey(UMOEndpointURI endpointURI)
 445  
     {
 446  72
         StringBuffer endpointKey = new StringBuffer(64);
 447  
 
 448  72
         endpointKey.append(endpointURI.getScheme());
 449  72
         endpointKey.append("://");
 450  72
         endpointKey.append(endpointURI.getHost());
 451  72
         if (endpointURI.getPort() > -1)
 452  
         {
 453  30
             endpointKey.append(":");
 454  30
             endpointKey.append(endpointURI.getPort());
 455  
         }
 456  72
         return endpointKey.toString();
 457  
     }
 458  
     
 459  
     private MuleDescriptor getAxisDescriptorFromSystemModel()
 460  
     {
 461  72
         MuleDescriptor axisDescriptor = (MuleDescriptor) MuleManager.getInstance().lookupModel(ModelHelper.SYSTEM_MODEL).getDescriptor(
 462  
             specificAxisServiceComponentName);
 463  
         
 464  72
         if (axisDescriptor == null)
 465  
         {
 466  72
             axisDescriptor = (MuleDescriptor) MuleManager.getInstance().lookupModel(ModelHelper.SYSTEM_MODEL).getDescriptor(
 467  
                 AXIS_SERVICE_COMPONENT_NAME);
 468  
             
 469  
 //            if (axisDescriptor != null)
 470  
 //            {
 471  
 //                axisDescriptor.setName(specificAxisServiceComponentName);
 472  
 //            }
 473  
         }
 474  
         
 475  72
         return axisDescriptor;
 476  
     }
 477  
 
 478  
     protected MuleDescriptor createAxisDescriptor()
 479  
     {
 480  36
         MuleDescriptor axisDescriptor = getAxisDescriptorFromSystemModel();
 481  
         
 482  36
         if (axisDescriptor == null)
 483  
         {
 484  36
             axisDescriptor = new MuleDescriptor(specificAxisServiceComponentName);
 485  38
             axisDescriptor.setImplementation(AxisServiceComponent.class.getName());
 486  
         }
 487  
         
 488  36
         return axisDescriptor;
 489  
     }
 490  
 
 491  
     /**
 492  
      * Template method to perform any work when starting the connectoe
 493  
      * 
 494  
      * @throws org.mule.umo.UMOException if the method fails
 495  
      */
 496  
     protected void doStart() throws UMOException
 497  
     {
 498  38
         axisServer.start();
 499  38
     }
 500  
 
 501  
     /**
 502  
      * Template method to perform any work when stopping the connectoe
 503  
      * 
 504  
      * @throws org.mule.umo.UMOException if the method fails
 505  
      */
 506  
     protected void doStop() throws UMOException
 507  
     {
 508  38
         axisServer.stop();
 509  
         // UMOModel model = MuleManager.getInstance().lookupModel();
 510  
         // model.unregisterComponent(model.getDescriptor(AXIS_SERVICE_COMPONENT_NAME));
 511  38
     }
 512  
 
 513  
     protected void doConnect() throws Exception
 514  
     {
 515  
         // template method
 516  38
     }
 517  
 
 518  
     protected void doDisconnect() throws Exception
 519  
     {
 520  
         // template method
 521  38
     }
 522  
 
 523  
     protected void doDispose()
 524  
     {
 525  
         // template method
 526  58
     }
 527  
 
 528  
     public String getServerConfig()
 529  
     {
 530  0
         return serverConfig;
 531  
     }
 532  
 
 533  
     public void setServerConfig(String serverConfig)
 534  
     {
 535  0
         this.serverConfig = serverConfig;
 536  0
     }
 537  
 
 538  
     public List getBeanTypes()
 539  
     {
 540  0
         return beanTypes;
 541  
     }
 542  
 
 543  
     public void setBeanTypes(List beanTypes)
 544  
     {
 545  0
         this.beanTypes = beanTypes;
 546  0
     }
 547  
 
 548  
     public String getClientConfig()
 549  
     {
 550  0
         return clientConfig;
 551  
     }
 552  
 
 553  
     public void setClientConfig(String clientConfig)
 554  
     {
 555  0
         this.clientConfig = clientConfig;
 556  0
     }
 557  
 
 558  
     public AxisServer getAxisServer()
 559  
     {
 560  294
         return axisServer;
 561  
     }
 562  
 
 563  
     public void setAxisServer(AxisServer axisServer)
 564  
     {
 565  0
         this.axisServer = axisServer;
 566  0
     }
 567  
 
 568  
     public SimpleProvider getServerProvider()
 569  
     {
 570  72
         return serverProvider;
 571  
     }
 572  
 
 573  
     public void setServerProvider(SimpleProvider serverProvider)
 574  
     {
 575  0
         this.serverProvider = serverProvider;
 576  0
     }
 577  
 
 578  
     public SimpleProvider getClientProvider()
 579  
     {
 580  92
         return clientProvider;
 581  
     }
 582  
 
 583  
     public void setClientProvider(SimpleProvider clientProvider)
 584  
     {
 585  0
         this.clientProvider = clientProvider;
 586  0
     }
 587  
 
 588  
     public Map getAxisTransportProtocols()
 589  
     {
 590  750
         return axisTransportProtocols;
 591  
     }
 592  
 
 593  
     public void setAxisTransportProtocols(Map axisTransportProtocols)
 594  
     {
 595  0
         this.axisTransportProtocols.putAll(axisTransportProtocols);
 596  0
     }
 597  
 
 598  
     void addServletService(SOAPService service)
 599  
     {
 600  2
         servletServices.add(service);
 601  2
     }
 602  
 
 603  
     public List getSupportedSchemes()
 604  
     {
 605  0
         return supportedSchemes;
 606  
     }
 607  
 
 608  
     public void setSupportedSchemes(List supportedSchemes)
 609  
     {
 610  0
         this.supportedSchemes = supportedSchemes;
 611  0
     }
 612  
 
 613  
     public boolean isDoAutoTypes()
 614  
     {
 615  174
         return doAutoTypes;
 616  
     }
 617  
 
 618  
     public void setDoAutoTypes(boolean doAutoTypes)
 619  
     {
 620  0
         this.doAutoTypes = doAutoTypes;
 621  0
     }
 622  
 
 623  
     void registerTypes(TypeMappingRegistryImpl registry, List types) throws ClassNotFoundException
 624  
     {
 625  50
         if (types != null)
 626  
         {
 627  
             Class clazz;
 628  0
             for (Iterator iterator = types.iterator(); iterator.hasNext();)
 629  
             {
 630  0
                 clazz = ClassUtils.loadClass(iterator.next().toString(), getClass());
 631  0
                 String localName = Types.getLocalNameFromFullName(clazz.getName());
 632  0
                 QName xmlType = new QName(Namespaces.makeNamespace(clazz.getName()), localName);
 633  
 
 634  0
                 registry.getDefaultTypeMapping().register(clazz, xmlType,
 635  
                     new BeanSerializerFactory(clazz, xmlType), new BeanDeserializerFactory(clazz, xmlType));
 636  0
             }
 637  
         }
 638  50
     }
 639  
 
 640  
     public boolean isTreatMapAsNamedParams()
 641  
     {
 642  0
         return treatMapAsNamedParams;
 643  
     }
 644  
 
 645  
     public void setTreatMapAsNamedParams(boolean treatMapAsNamedParams)
 646  
     {
 647  0
         this.treatMapAsNamedParams = treatMapAsNamedParams;
 648  0
     }
 649  
 
 650  
     public void onNotification(UMOServerNotification notification)
 651  
     {
 652  530
         if (notification.getAction() == ManagerNotification.MANAGER_STARTED_MODELS)
 653  
         {
 654  
             // We need to register the Axis service component once the model
 655  
             // starts because
 656  
             // when the model starts listeners on components are started, thus
 657  
             // all listener
 658  
             // need to be registered for this connector before the Axis service
 659  
             // component
 660  
             // is registered.
 661  
             // The implication of this is that to add a new service and a
 662  
             // different http port the
 663  
             // model needs to be restarted before the listener is available
 664  36
             UMOModel systemModel = MuleManager.getInstance().lookupModel(ModelHelper.SYSTEM_MODEL);
 665  36
             if (!systemModel.isComponentRegistered(specificAxisServiceComponentName))
 666  
             {
 667  
                 try
 668  
                 {
 669  
                     // Descriptor might be null if no inbound endpoints have been
 670  
                     // register for the Axis connector
 671  36
                     if (axisDescriptor == null)
 672  
                     {
 673  0
                         axisDescriptor = createAxisDescriptor();
 674  
                     }
 675  36
                     axisDescriptor.addInterceptor(new MethodFixInterceptor());
 676  36
                     MuleManager.getInstance().lookupModel(ModelHelper.SYSTEM_MODEL).registerComponent(axisDescriptor);
 677  
                     // We have to perform a small hack here to rewrite servlet://
 678  
                     // endpoints with the
 679  
                     // real http:// address
 680  36
                     for (Iterator iterator = servletServices.iterator(); iterator.hasNext();)
 681  
                     {
 682  2
                         SOAPService service = (SOAPService)iterator.next();
 683  2
                         ServletConnector servletConnector = (ServletConnector) TransportFactory.getConnectorByProtocol("servlet");
 684  2
                         String url = servletConnector.getServletUrl();
 685  2
                         if (url != null)
 686  
                         {
 687  2
                             service.getServiceDescription().setEndpointURL(url + "/" + service.getName());
 688  
                         }
 689  
                         else
 690  
                         {
 691  0
                             logger.error("The servletUrl property on the ServletConntector has not been set this means that wsdl generation for service '"
 692  
                                          + service.getName() + "' may be incorrect");
 693  
                         }
 694  2
                     }
 695  36
                     servletServices.clear();
 696  36
                     servletServices = null;
 697  
 
 698  
                 }
 699  0
                 catch (UMOException e)
 700  
                 {
 701  0
                     handleException(e);
 702  36
                 }
 703  
             }
 704  
         }
 705  530
     }
 706  
 }