Coverage Report - org.mule.providers.service.TransportServiceDescriptor
 
Classes in this File Line Coverage Branch Coverage Complexity
TransportServiceDescriptor
20%
55/269
7%
16/242
4.238
 
 1  
 /*
 2  
  * $Id: TransportServiceDescriptor.java 9916 2007-11-28 00:01:55Z aperepel $
 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.service;
 12  
 
 13  
 import org.mule.config.MuleProperties;
 14  
 import org.mule.config.i18n.CoreMessages;
 15  
 import org.mule.config.i18n.MessageFactory;
 16  
 import org.mule.impl.MuleSessionHandler;
 17  
 import org.mule.impl.endpoint.EndpointBuilder;
 18  
 import org.mule.impl.endpoint.UrlEndpointBuilder;
 19  
 import org.mule.providers.NullPayload;
 20  
 import org.mule.transaction.XaTransactionFactory;
 21  
 import org.mule.umo.UMOComponent;
 22  
 import org.mule.umo.UMOException;
 23  
 import org.mule.umo.UMOTransactionConfig;
 24  
 import org.mule.umo.UMOTransactionFactory;
 25  
 import org.mule.umo.endpoint.UMOEndpoint;
 26  
 import org.mule.umo.provider.UMOConnector;
 27  
 import org.mule.umo.provider.UMOMessageAdapter;
 28  
 import org.mule.umo.provider.UMOMessageDispatcherFactory;
 29  
 import org.mule.umo.provider.UMOMessageReceiver;
 30  
 import org.mule.umo.provider.UMOSessionHandler;
 31  
 import org.mule.umo.provider.UMOStreamMessageAdapter;
 32  
 import org.mule.umo.transformer.UMOTransformer;
 33  
 import org.mule.util.ClassUtils;
 34  
 import org.mule.util.ObjectFactory;
 35  
 import org.mule.util.StringUtils;
 36  
 
 37  
 import java.io.InputStream;
 38  
 import java.io.OutputStream;
 39  
 import java.util.Properties;
 40  
 
 41  
 import org.apache.commons.logging.Log;
 42  
 import org.apache.commons.logging.LogFactory;
 43  
 
 44  
 /**
 45  
  * <code>TransportServiceDescriptor</code> describes the necessary information for
 46  
  * creating a connector from a service descriptor. A service descriptor should be
 47  
  * located at META-INF/services/org/mule/providers/<protocol> where protocol is the
 48  
  * protocol of the connector to be created The service descriptor is in the form of
 49  
  * string key value pairs and supports a number of properties, descriptions of which
 50  
  * can be found here: http://www.muledocs.org/Transport+Service+Descriptors.
 51  
  *
 52  
  */
 53  
 public class TransportServiceDescriptor
 54  
 {
 55  
     /**
 56  
      * logger used by this class
 57  
      */
 58  6
     protected static final Log logger = LogFactory.getLog(TransportServiceDescriptor.class);
 59  
 
 60  
     private String protocol;
 61  
     private String serviceLocation;
 62  
     private String serviceError;
 63  
     private String serviceFinder;
 64  
     private String connector;
 65  
     private String connectorFactory;
 66  
     private String dispatcherFactory;
 67  
     private String transactionFactory;
 68  
     private String messageAdapter;
 69  
     private String streamMessageAdapter;
 70  
     private String messageReceiver;
 71  
     private String transactedMessageReceiver;
 72  
     private String xaTransactedMessageReceiver;
 73  
     private String endpointBuilder;
 74  
     private String sessionHandler;
 75  
     private String defaultInboundTransformer;
 76  
     private String defaultOutboundTransformer;
 77  
     private String defaultResponseTransformer;
 78  
     private Properties properties;
 79  
 
 80  
     private UMOTransformer inboundTransformer;
 81  
     private UMOTransformer outboundTransformer;
 82  
     private UMOTransformer responseTransformer;
 83  
     // private EndpointBuilder endpointBuilderImpl;
 84  
     private TransportServiceFinder transportServiceFinder;
 85  
 
 86  
     public TransportServiceDescriptor(String protocol, String serviceLocation, Properties props)
 87  4
     {
 88  4
         this.protocol = protocol;
 89  4
         this.serviceLocation = serviceLocation;
 90  4
         this.properties = props;
 91  
 
 92  4
         serviceError = removeProperty(MuleProperties.CONNECTOR_SERVICE_ERROR);
 93  4
         connector = removeProperty(MuleProperties.CONNECTOR_CLASS);
 94  4
         connectorFactory = removeProperty(MuleProperties.CONNECTOR_FACTORY);
 95  4
         dispatcherFactory = removeProperty(MuleProperties.CONNECTOR_DISPATCHER_FACTORY);
 96  4
         transactionFactory = removeProperty(MuleProperties.CONNECTOR_TRANSACTION_FACTORY);
 97  4
         messageReceiver = removeProperty(MuleProperties.CONNECTOR_MESSAGE_RECEIVER_CLASS);
 98  4
         transactedMessageReceiver = removeProperty(MuleProperties.CONNECTOR_TRANSACTED_MESSAGE_RECEIVER_CLASS);
 99  4
         xaTransactedMessageReceiver = removeProperty(MuleProperties.CONNECTOR_XA_TRANSACTED_MESSAGE_RECEIVER_CLASS);
 100  4
         messageAdapter = removeProperty(MuleProperties.CONNECTOR_MESSAGE_ADAPTER);
 101  4
         streamMessageAdapter = removeProperty(MuleProperties.CONNECTOR_STREAM_MESSAGE_ADAPTER);
 102  4
         defaultInboundTransformer = removeProperty(MuleProperties.CONNECTOR_INBOUND_TRANSFORMER);
 103  4
         defaultOutboundTransformer = removeProperty(MuleProperties.CONNECTOR_OUTBOUND_TRANSFORMER);
 104  4
         defaultResponseTransformer = removeProperty(MuleProperties.CONNECTOR_RESPONSE_TRANSFORMER);
 105  4
         endpointBuilder = removeProperty(MuleProperties.CONNECTOR_ENDPOINT_BUILDER);
 106  4
         serviceFinder = removeProperty(MuleProperties.CONNECTOR_SERVICE_FINDER);
 107  4
         sessionHandler = removeProperty(MuleProperties.CONNECTOR_SESSION_HANDLER);
 108  4
     }
 109  
 
 110  
     protected void setOverrides(Properties props)
 111  
     {
 112  4
         if (props == null || props.size() == 0)
 113  
         {
 114  4
             return;
 115  
         }
 116  0
         serviceError = props.getProperty(MuleProperties.CONNECTOR_SERVICE_ERROR, serviceError);
 117  0
         connector = props.getProperty(MuleProperties.CONNECTOR_CLASS, connector);
 118  0
         connectorFactory = props.getProperty(MuleProperties.CONNECTOR_FACTORY, connectorFactory);
 119  0
         dispatcherFactory = props.getProperty(MuleProperties.CONNECTOR_DISPATCHER_FACTORY, dispatcherFactory);
 120  0
         messageReceiver = props.getProperty(MuleProperties.CONNECTOR_MESSAGE_RECEIVER_CLASS, messageReceiver);
 121  0
         transactedMessageReceiver = props.getProperty(
 122  
             MuleProperties.CONNECTOR_TRANSACTED_MESSAGE_RECEIVER_CLASS, transactedMessageReceiver);
 123  0
         xaTransactedMessageReceiver = props.getProperty(
 124  
             MuleProperties.CONNECTOR_XA_TRANSACTED_MESSAGE_RECEIVER_CLASS, xaTransactedMessageReceiver);
 125  0
         messageAdapter = props.getProperty(MuleProperties.CONNECTOR_MESSAGE_ADAPTER, messageAdapter);
 126  
 
 127  0
         String temp = props.getProperty(MuleProperties.CONNECTOR_INBOUND_TRANSFORMER);
 128  0
         if (temp != null)
 129  
         {
 130  0
             defaultInboundTransformer = temp;
 131  0
             inboundTransformer = null;
 132  
         }
 133  
 
 134  0
         temp = props.getProperty(MuleProperties.CONNECTOR_OUTBOUND_TRANSFORMER);
 135  0
         if (temp != null)
 136  
         {
 137  0
             defaultOutboundTransformer = temp;
 138  0
             outboundTransformer = null;
 139  
         }
 140  
 
 141  0
         temp = props.getProperty(MuleProperties.CONNECTOR_RESPONSE_TRANSFORMER);
 142  0
         if (temp != null)
 143  
         {
 144  0
             defaultResponseTransformer = temp;
 145  0
             responseTransformer = null;
 146  
         }
 147  
 
 148  0
         temp = props.getProperty(MuleProperties.CONNECTOR_ENDPOINT_BUILDER);
 149  0
         if (temp != null)
 150  
         {
 151  0
             endpointBuilder = temp;
 152  
         }
 153  
 
 154  0
         temp = props.getProperty(MuleProperties.CONNECTOR_SERVICE_FINDER);
 155  0
         if (temp != null)
 156  
         {
 157  0
             serviceFinder = temp;
 158  0
             transportServiceFinder = null;
 159  
         }
 160  0
     }
 161  
 
 162  
     private String removeProperty(String name)
 163  
     {
 164  64
         String temp = (String) properties.remove(name);
 165  64
         if (StringUtils.isEmpty(StringUtils.trim(temp)))
 166  
         {
 167  56
             return null;
 168  
         }
 169  
         else
 170  
         {
 171  8
             return temp;
 172  
         }
 173  
     }
 174  
 
 175  
     public String getProtocol()
 176  
     {
 177  4
         return protocol;
 178  
     }
 179  
 
 180  
     public String getServiceLocation()
 181  
     {
 182  0
         return serviceLocation;
 183  
     }
 184  
 
 185  
     public String getServiceError()
 186  
     {
 187  42
         return serviceError;
 188  
     }
 189  
 
 190  
     public String getConnector()
 191  
     {
 192  84
         return connector;
 193  
     }
 194  
 
 195  
     public String getConnectorFactory()
 196  
     {
 197  42
         return connectorFactory;
 198  
     }
 199  
 
 200  
     public String getDispatcherFactory()
 201  
     {
 202  22
         return dispatcherFactory;
 203  
     }
 204  
 
 205  
     public String getMessageReceiver()
 206  
     {
 207  0
         return messageReceiver;
 208  
     }
 209  
 
 210  
     public String getTransactedMessageReceiver()
 211  
     {
 212  0
         return transactedMessageReceiver;
 213  
     }
 214  
 
 215  
     public String getXaTransactedMessageReceiver()
 216  
     {
 217  0
         return xaTransactedMessageReceiver;
 218  
     }
 219  
 
 220  
     public String getDefaultInboundTransformer()
 221  
     {
 222  72
         return defaultInboundTransformer;
 223  
     }
 224  
 
 225  
     public String getDefaultOutboundTransformer()
 226  
     {
 227  46
         return defaultOutboundTransformer;
 228  
     }
 229  
 
 230  
     public String getMessageAdapter()
 231  
     {
 232  0
         return messageAdapter;
 233  
     }
 234  
 
 235  
     public Properties getProperties()
 236  
     {
 237  0
         return properties;
 238  
     }
 239  
 
 240  
     public String getEndpointBuilder()
 241  
     {
 242  1720
         return endpointBuilder;
 243  
     }
 244  
 
 245  
     public String getServiceFinder()
 246  
     {
 247  46
         return serviceFinder;
 248  
     }
 249  
 
 250  
     public String getStreamMessageAdapter()
 251  
     {
 252  0
         return streamMessageAdapter;
 253  
     }
 254  
 
 255  
     public String getTransactionFactory()
 256  
     {
 257  0
         return transactionFactory;
 258  
     }
 259  
 
 260  
     public TransportServiceFinder getConnectorServiceFinder()
 261  
     {
 262  0
         return transportServiceFinder;
 263  
     }
 264  
 
 265  
     public String getSessionHandler()
 266  
     {
 267  44
         return sessionHandler;
 268  
     }
 269  
 
 270  
     public TransportServiceFinder createServiceFinder() throws TransportServiceException
 271  
     {
 272  0
         if (serviceFinder == null)
 273  
         {
 274  0
             return null;
 275  
         }
 276  0
         if (transportServiceFinder == null)
 277  
         {
 278  
             try
 279  
             {
 280  0
                 transportServiceFinder = (TransportServiceFinder) ClassUtils.instanciateClass(serviceFinder,
 281  
                     ClassUtils.NO_ARGS);
 282  
             }
 283  0
             catch (Exception e)
 284  
             {
 285  0
                 throw new TransportServiceException(
 286  
                     CoreMessages.cannotInstanciateFinder(serviceFinder), e);
 287  0
             }
 288  
         }
 289  0
         return transportServiceFinder;
 290  
     }
 291  
 
 292  
     public String getDefaultResponseTransformer()
 293  
     {
 294  72
         return defaultResponseTransformer;
 295  
     }
 296  
 
 297  
     public UMOMessageAdapter createMessageAdapter(Object message) throws TransportServiceException
 298  
     {
 299  0
         return createMessageAdapter(message, messageAdapter);
 300  
     }
 301  
 
 302  
     public UMOStreamMessageAdapter createStreamMessageAdapter(InputStream in, OutputStream out)
 303  
         throws TransportServiceException
 304  
     {
 305  0
         if (getStreamMessageAdapter() == null)
 306  
         {
 307  
 
 308  
             // If the stream.message.adapter is not set streaming should not be used
 309  0
             throw new TransportServiceException(
 310  
                 CoreMessages.objectNotSetInService("stream.message.adapter",
 311  
                     this.getProtocol() + " service descriptor"));
 312  
         }
 313  
         try
 314  
         {
 315  0
             if (out == null)
 316  
             {
 317  0
                 return (UMOStreamMessageAdapter) ClassUtils.instanciateClass(streamMessageAdapter,
 318  
                     new Object[]{in});
 319  
             }
 320  
             else
 321  
             {
 322  0
                 return (UMOStreamMessageAdapter) ClassUtils.instanciateClass(streamMessageAdapter,
 323  
                     new Object[]{in, out});
 324  
             }
 325  
         }
 326  0
         catch (Exception e)
 327  
         {
 328  0
             throw new TransportServiceException(
 329  
                 CoreMessages.failedToCreateObjectWith("Message Adapter", streamMessageAdapter), e);
 330  
         }
 331  
     }
 332  
 
 333  
     protected UMOMessageAdapter createMessageAdapter(Object message, String clazz)
 334  
         throws TransportServiceException
 335  
     {
 336  0
         if (message == null)
 337  
         {
 338  0
             message = NullPayload.getInstance();
 339  
         }
 340  0
         if (messageAdapter != null)
 341  
         {
 342  
             try
 343  
             {
 344  0
                 return (UMOMessageAdapter) ClassUtils.instanciateClass(clazz, new Object[]{message});
 345  
             }
 346  0
             catch (Exception e)
 347  
             {
 348  0
                 throw new TransportServiceException(
 349  
                     CoreMessages.failedToCreateObjectWith("Message Adapter", clazz), e);
 350  
             }
 351  
         }
 352  
         else
 353  
         {
 354  0
             throw new TransportServiceException(
 355  
                 CoreMessages.objectNotSetInService("Message Adapter", this.getProtocol()));
 356  
         }
 357  
     }
 358  
 
 359  
     public UMOSessionHandler createSessionHandler() throws TransportServiceException
 360  
     {
 361  22
         if (getSessionHandler() == null)
 362  
         {
 363  2
             sessionHandler = MuleSessionHandler.class.getName();
 364  2
             if (logger.isDebugEnabled())
 365  
             {
 366  0
                 logger.debug("No session.handler set in service description, defaulting to: "
 367  
                              + sessionHandler);
 368  
             }
 369  
         }
 370  
         try
 371  
         {
 372  22
             return (UMOSessionHandler) ClassUtils.instanciateClass(getSessionHandler(), ClassUtils.NO_ARGS,
 373  
                 getClass());
 374  
         }
 375  0
         catch (Throwable e)
 376  
         {
 377  0
             throw new TransportServiceException(
 378  
                 CoreMessages.failedToCreateObjectWith("SessionHandler", sessionHandler), e);
 379  
         }
 380  
     }
 381  
 
 382  
     public UMOMessageReceiver createMessageReceiver(UMOConnector connector,
 383  
                                                     UMOComponent component,
 384  
                                                     UMOEndpoint endpoint) throws UMOException
 385  
     {
 386  
 
 387  0
         return createMessageReceiver(connector, component, endpoint, null);
 388  
     }
 389  
 
 390  
     public UMOMessageReceiver createMessageReceiver(UMOConnector connector,
 391  
                                                     UMOComponent component,
 392  
                                                     UMOEndpoint endpoint,
 393  
                                                     Object[] args) throws UMOException
 394  
     {
 395  0
         String receiverClass = messageReceiver;
 396  
 
 397  0
         if (endpoint.getTransactionConfig() != null
 398  
             && endpoint.getTransactionConfig().getAction() != UMOTransactionConfig.ACTION_NONE)
 399  
         {
 400  0
             boolean xaTx = endpoint.getTransactionConfig().getFactory() instanceof XaTransactionFactory;
 401  0
             if (transactedMessageReceiver != null && !xaTx)
 402  
             {
 403  0
                 receiverClass = transactedMessageReceiver;
 404  
             }
 405  0
             else if (xaTransactedMessageReceiver != null && xaTx)
 406  
             {
 407  0
                 receiverClass = xaTransactedMessageReceiver;
 408  
             }
 409  
 
 410  
         }
 411  
 
 412  0
         if (receiverClass != null)
 413  
         {
 414  
             Object[] newArgs;
 415  
 
 416  0
             if (args != null && args.length != 0)
 417  
             {
 418  0
                 newArgs = new Object[3 + args.length];
 419  
             }
 420  
             else
 421  
             {
 422  0
                 newArgs = new Object[3];
 423  
             }
 424  
 
 425  0
             newArgs[0] = connector;
 426  0
             newArgs[1] = component;
 427  0
             newArgs[2] = endpoint;
 428  
 
 429  0
             if (args != null && args.length != 0)
 430  
             {
 431  0
                 System.arraycopy(args, 0, newArgs, 3, newArgs.length - 3);
 432  
             }
 433  
 
 434  
             try
 435  
             {
 436  0
                 return (UMOMessageReceiver) ClassUtils.instanciateClass(receiverClass, newArgs);
 437  
             }
 438  0
             catch (Exception e)
 439  
             {
 440  0
                 throw new TransportServiceException(
 441  
                     CoreMessages.failedToCreateObjectWith("Message Receiver", this.getProtocol()), e);
 442  
             }
 443  
 
 444  
         }
 445  
         else
 446  
         {
 447  0
             throw new TransportServiceException(
 448  
                 CoreMessages.objectNotSetInService("Message Receiver", this.getProtocol()));
 449  
         }
 450  
     }
 451  
 
 452  
     public UMOMessageDispatcherFactory createDispatcherFactory() throws TransportServiceException
 453  
     {
 454  0
         if (dispatcherFactory != null)
 455  
         {
 456  
             try
 457  
             {
 458  0
                 return (UMOMessageDispatcherFactory) ClassUtils.instanciateClass(dispatcherFactory,
 459  
                     ClassUtils.NO_ARGS);
 460  
             }
 461  0
             catch (Exception e)
 462  
             {
 463  0
                 throw new TransportServiceException(
 464  
                     CoreMessages.failedToCreateObjectWith("Message Dispatcher Factory", dispatcherFactory),
 465  
                     e);
 466  
             }
 467  
         }
 468  
         else
 469  
         {
 470  0
             throw new TransportServiceException(
 471  
                 CoreMessages.objectNotSetInService("Message Dispatcher Factory", this.getProtocol()));
 472  
         }
 473  
     }
 474  
 
 475  
     public UMOTransactionFactory createTransactionFactory() throws TransportServiceException
 476  
     {
 477  0
         if (transactionFactory != null)
 478  
         {
 479  
             try
 480  
             {
 481  0
                 return (UMOTransactionFactory) ClassUtils.instanciateClass(transactionFactory,
 482  
                     ClassUtils.NO_ARGS);
 483  
             }
 484  0
             catch (Exception e)
 485  
             {
 486  0
                 throw new TransportServiceException(
 487  
                     CoreMessages.failedToCreateObjectWith("Transaction Factory", transactionFactory),
 488  
                     e);
 489  
             }
 490  
         }
 491  
         else
 492  
         {
 493  0
             return null;
 494  
         }
 495  
     }
 496  
 
 497  
     public UMOConnector createConnector(String protocol) throws TransportServiceException
 498  
     {
 499  
 
 500  
         UMOConnector connector;
 501  
         // Make sure we can create the endpoint/connector using this service
 502  
         // method
 503  0
         if (getServiceError() != null)
 504  
         {
 505  0
             throw new TransportServiceException(MessageFactory.createStaticMessage(getServiceError()));
 506  
         }
 507  
         // if there is a factory, use it
 508  
         try
 509  
         {
 510  0
             if (getConnectorFactory() != null)
 511  
             {
 512  0
                 ObjectFactory factory = (ObjectFactory) ClassUtils.loadClass(getConnectorFactory(),
 513  
                     TransportFactory.class).newInstance();
 514  0
                 connector = (UMOConnector) factory.create();
 515  0
             }
 516  
             else
 517  
             {
 518  0
                 if (getConnector() != null)
 519  
                 {
 520  0
                     connector = (UMOConnector) ClassUtils.loadClass(getConnector(), TransportFactory.class)
 521  
                         .newInstance();
 522  
                 }
 523  
                 else
 524  
                 {
 525  0
                     throw new TransportServiceException(
 526  
                         CoreMessages.objectNotSetInService("Connector", this.getProtocol()));
 527  
                 }
 528  
             }
 529  
         }
 530  0
         catch (TransportServiceException e)
 531  
         {
 532  0
             throw e;
 533  
         }
 534  0
         catch (Exception e)
 535  
         {
 536  0
             throw new TransportServiceException(
 537  
                 CoreMessages.failedToCreateObjectWith("Connector", this.getConnector()), e);
 538  0
         }
 539  
 
 540  0
         if (connector.getName() == null)
 541  
         {
 542  0
             connector.setName("_" + protocol + "Connector#" + connector.hashCode());
 543  
         }
 544  0
         return connector;
 545  
     }
 546  
 
 547  
     public UMOTransformer createInboundTransformer() throws TransportFactoryException
 548  
     {
 549  72
         if (inboundTransformer != null)
 550  
         {
 551  0
             return inboundTransformer;
 552  
         }
 553  72
         if (getDefaultInboundTransformer() != null)
 554  
         {
 555  
             // TODO MULE-863: Correct level?
 556  0
             logger.info("Loading default inbound transformer: " + getDefaultInboundTransformer());
 557  
             try
 558  
             {
 559  0
                 inboundTransformer = (UMOTransformer) ClassUtils.instanciateClass(
 560  
                     getDefaultInboundTransformer(), ClassUtils.NO_ARGS);
 561  0
                 return inboundTransformer;
 562  
             }
 563  0
             catch (Exception e)
 564  
             {
 565  0
                 throw new TransportFactoryException(
 566  
                     CoreMessages.failedToLoadTransformer("inbound", this.getDefaultInboundTransformer()),
 567  
                     e);
 568  
             }
 569  
         }
 570  72
         return null;
 571  
     }
 572  
     
 573  
     public UMOTransformer createNewInboundTransformer() throws TransportFactoryException
 574  
     {
 575  0
         if (getDefaultInboundTransformer() != null)
 576  
         {
 577  0
             logger.info("Loading default inbound transformer: " + getDefaultInboundTransformer());
 578  
             try
 579  
             {
 580  0
                 inboundTransformer = (UMOTransformer) ClassUtils.instanciateClass(
 581  
                     getDefaultInboundTransformer(), ClassUtils.NO_ARGS);
 582  0
                 return inboundTransformer;
 583  
             }
 584  0
             catch (Exception e)
 585  
             {
 586  0
                 throw new TransportFactoryException(
 587  
                     CoreMessages.failedToLoadTransformer("inbound", this.getDefaultInboundTransformer()),
 588  
                     e);
 589  
             }
 590  
         }
 591  0
         return null;
 592  
     }
 593  
 
 594  
     public UMOTransformer createOutboundTransformer() throws TransportFactoryException
 595  
     {
 596  46
         if (outboundTransformer != null)
 597  
         {
 598  0
             return outboundTransformer;
 599  
         }
 600  46
         if (getDefaultOutboundTransformer() != null)
 601  
         {
 602  0
             logger.info("Loading default outbound transformer: " + getDefaultOutboundTransformer());
 603  
             try
 604  
             {
 605  0
                 outboundTransformer = (UMOTransformer) ClassUtils.instanciateClass(
 606  
                     getDefaultOutboundTransformer(), ClassUtils.NO_ARGS);
 607  0
                 return outboundTransformer;
 608  
             }
 609  0
             catch (Exception e)
 610  
             {
 611  0
                 throw new TransportFactoryException(
 612  
                     CoreMessages.failedToLoadTransformer("outbound", this.getDefaultOutboundTransformer()),
 613  
                     e);
 614  
             }
 615  
         }
 616  46
         return null;
 617  
     }
 618  
     
 619  
     public UMOTransformer createNewOutboundTransformer() throws TransportFactoryException
 620  
     {
 621  0
         if (getDefaultOutboundTransformer() != null)
 622  
         {
 623  0
             logger.info("Loading default outbound transformer: " + getDefaultOutboundTransformer());
 624  
             try
 625  
             {
 626  0
                 outboundTransformer = (UMOTransformer) ClassUtils.instanciateClass(
 627  
                     getDefaultOutboundTransformer(), ClassUtils.NO_ARGS);
 628  0
                 return outboundTransformer;
 629  
             }
 630  0
             catch (Exception e)
 631  
             {
 632  0
                 throw new TransportFactoryException(
 633  
                     CoreMessages.failedToLoadTransformer("outbound", this.getDefaultOutboundTransformer()),
 634  
                     e);
 635  
             }
 636  
         }
 637  0
         return null;
 638  
     }
 639  
 
 640  
     public UMOTransformer createResponseTransformer() throws TransportFactoryException
 641  
     {
 642  72
         if (responseTransformer != null)
 643  
         {
 644  0
             return responseTransformer;
 645  
         }
 646  72
         if (getDefaultResponseTransformer() != null)
 647  
         {
 648  0
             logger.info("Loading default response transformer: " + getDefaultResponseTransformer());
 649  
             try
 650  
             {
 651  0
                 responseTransformer = (UMOTransformer) ClassUtils.instanciateClass(
 652  
                     getDefaultResponseTransformer(), ClassUtils.NO_ARGS);
 653  0
                 return responseTransformer;
 654  
             }
 655  0
             catch (Exception e)
 656  
             {
 657  0
                 throw new TransportFactoryException(
 658  
                     CoreMessages.failedToLoadTransformer("response", this.getDefaultResponseTransformer()), 
 659  
                     e);
 660  
             }
 661  
         }
 662  72
         return null;
 663  
     }
 664  
     
 665  
     public UMOTransformer createNewResponseTransformer() throws TransportFactoryException
 666  
     {
 667  0
         if (getDefaultResponseTransformer() != null)
 668  
         {
 669  0
             logger.info("Loading default response transformer: " + getDefaultResponseTransformer());
 670  
             try
 671  
             {
 672  0
                 responseTransformer = (UMOTransformer) ClassUtils.instanciateClass(
 673  
                     getDefaultResponseTransformer(), ClassUtils.NO_ARGS);
 674  0
                 return responseTransformer;
 675  
             }
 676  0
             catch (Exception e)
 677  
             {
 678  0
                 throw new TransportFactoryException(
 679  
                     CoreMessages.failedToLoadTransformer("response", this.getDefaultResponseTransformer()), 
 680  
                     e);
 681  
             }
 682  
         }
 683  0
         return null;
 684  
     }
 685  
 
 686  
     public EndpointBuilder createEndpointBuilder() throws TransportFactoryException
 687  
     {
 688  860
         if (endpointBuilder == null)
 689  
         {
 690  0
             logger.debug("Endpoint resolver not set, Loading default resolver: "
 691  
                          + UrlEndpointBuilder.class.getName());
 692  0
             return new UrlEndpointBuilder();
 693  
         }
 694  
         else
 695  
         {
 696  860
             logger.debug("Loading endpointUri resolver: " + getEndpointBuilder());
 697  
             try
 698  
             {
 699  860
                 return (EndpointBuilder) ClassUtils.instanciateClass(getEndpointBuilder(), ClassUtils.NO_ARGS);
 700  
             }
 701  0
             catch (Exception e)
 702  
             {
 703  0
                 throw new TransportFactoryException(
 704  
                     CoreMessages.failedToLoad("Endpoint Builder: " + getEndpointBuilder()), e);
 705  
             }
 706  
         }
 707  
     }
 708  
 
 709  
     public boolean equals(Object o)
 710  
     {
 711  0
         if (this == o)
 712  
         {
 713  0
             return true;
 714  
         }
 715  0
         if (!(o instanceof TransportServiceDescriptor))
 716  
         {
 717  0
             return false;
 718  
         }
 719  
 
 720  0
         final TransportServiceDescriptor transportServiceDescriptor = (TransportServiceDescriptor) o;
 721  
 
 722  0
         if (connector != null
 723  
                         ? !connector.equals(transportServiceDescriptor.connector)
 724  
                         : transportServiceDescriptor.connector != null)
 725  
         {
 726  0
             return false;
 727  
         }
 728  0
         if (connectorFactory != null
 729  
                         ? !connectorFactory.equals(transportServiceDescriptor.connectorFactory)
 730  
                         : transportServiceDescriptor.connectorFactory != null)
 731  
         {
 732  0
             return false;
 733  
         }
 734  0
         if (defaultInboundTransformer != null
 735  
                         ? !defaultInboundTransformer.equals(transportServiceDescriptor.defaultInboundTransformer)
 736  
                         : transportServiceDescriptor.defaultInboundTransformer != null)
 737  
         {
 738  0
             return false;
 739  
         }
 740  0
         if (defaultOutboundTransformer != null
 741  
                         ? !defaultOutboundTransformer.equals(transportServiceDescriptor.defaultOutboundTransformer)
 742  
                         : transportServiceDescriptor.defaultOutboundTransformer != null)
 743  
         {
 744  0
             return false;
 745  
         }
 746  0
         if (defaultResponseTransformer != null
 747  
                         ? !defaultResponseTransformer.equals(transportServiceDescriptor.defaultResponseTransformer)
 748  
                         : transportServiceDescriptor.defaultResponseTransformer != null)
 749  
         {
 750  0
             return false;
 751  
         }
 752  0
         if (dispatcherFactory != null
 753  
                         ? !dispatcherFactory.equals(transportServiceDescriptor.dispatcherFactory)
 754  
                         : transportServiceDescriptor.dispatcherFactory != null)
 755  
         {
 756  0
             return false;
 757  
         }
 758  0
         if (endpointBuilder != null
 759  
                         ? !endpointBuilder.equals(transportServiceDescriptor.endpointBuilder)
 760  
                         : transportServiceDescriptor.endpointBuilder != null)
 761  
         {
 762  0
             return false;
 763  
         }
 764  0
         if (messageAdapter != null
 765  
                         ? !messageAdapter.equals(transportServiceDescriptor.messageAdapter)
 766  
                         : transportServiceDescriptor.messageAdapter != null)
 767  
         {
 768  0
             return false;
 769  
         }
 770  0
         if (messageReceiver != null
 771  
                         ? !messageReceiver.equals(transportServiceDescriptor.messageReceiver)
 772  
                         : transportServiceDescriptor.messageReceiver != null)
 773  
         {
 774  0
             return false;
 775  
         }
 776  0
         if (properties != null
 777  
                         ? !properties.equals(transportServiceDescriptor.properties)
 778  
                         : transportServiceDescriptor.properties != null)
 779  
         {
 780  0
             return false;
 781  
         }
 782  0
         if (protocol != null
 783  
                         ? !protocol.equals(transportServiceDescriptor.protocol)
 784  
                         : transportServiceDescriptor.protocol != null)
 785  
         {
 786  0
             return false;
 787  
         }
 788  0
         if (serviceError != null
 789  
                         ? !serviceError.equals(transportServiceDescriptor.serviceError)
 790  
                         : transportServiceDescriptor.serviceError != null)
 791  
         {
 792  0
             return false;
 793  
         }
 794  0
         if (serviceFinder != null
 795  
                         ? !serviceFinder.equals(transportServiceDescriptor.serviceFinder)
 796  
                         : transportServiceDescriptor.serviceFinder != null)
 797  
         {
 798  0
             return false;
 799  
         }
 800  0
         if (serviceLocation != null
 801  
                         ? !serviceLocation.equals(transportServiceDescriptor.serviceLocation)
 802  
                         : transportServiceDescriptor.serviceLocation != null)
 803  
         {
 804  0
             return false;
 805  
         }
 806  0
         if (sessionHandler != null
 807  
                         ? !sessionHandler.equals(transportServiceDescriptor.sessionHandler)
 808  
                         : transportServiceDescriptor.sessionHandler != null)
 809  
         {
 810  0
             return false;
 811  
         }
 812  0
         if (streamMessageAdapter != null
 813  
                         ? !streamMessageAdapter.equals(transportServiceDescriptor.streamMessageAdapter)
 814  
                         : transportServiceDescriptor.streamMessageAdapter != null)
 815  
         {
 816  0
             return false;
 817  
         }
 818  0
         if (transactedMessageReceiver != null
 819  
                         ? !transactedMessageReceiver.equals(transportServiceDescriptor.transactedMessageReceiver)
 820  
                         : transportServiceDescriptor.transactedMessageReceiver != null)
 821  
         {
 822  0
             return false;
 823  
         }
 824  0
         if (transactionFactory != null
 825  
                         ? !transactionFactory.equals(transportServiceDescriptor.transactionFactory)
 826  
                         : transportServiceDescriptor.transactionFactory != null)
 827  
         {
 828  0
             return false;
 829  
         }
 830  
 
 831  0
         return true;
 832  
     }
 833  
 
 834  
     public int hashCode()
 835  
     {
 836  0
         int result = (protocol != null ? protocol.hashCode() : 0);
 837  0
         result = 29 * result + (serviceLocation != null ? serviceLocation.hashCode() : 0);
 838  0
         result = 29 * result + (serviceError != null ? serviceError.hashCode() : 0);
 839  0
         result = 29 * result + (serviceFinder != null ? serviceFinder.hashCode() : 0);
 840  0
         result = 29 * result + (connector != null ? connector.hashCode() : 0);
 841  0
         result = 29 * result + (connectorFactory != null ? connectorFactory.hashCode() : 0);
 842  0
         result = 29 * result + (dispatcherFactory != null ? dispatcherFactory.hashCode() : 0);
 843  0
         result = 29 * result + (transactionFactory != null ? transactionFactory.hashCode() : 0);
 844  0
         result = 29 * result + (messageAdapter != null ? messageAdapter.hashCode() : 0);
 845  0
         result = 29 * result + (streamMessageAdapter != null ? streamMessageAdapter.hashCode() : 0);
 846  0
         result = 29 * result + (messageReceiver != null ? messageReceiver.hashCode() : 0);
 847  0
         result = 29 * result + (transactedMessageReceiver != null ? transactedMessageReceiver.hashCode() : 0);
 848  0
         result = 29 * result + (endpointBuilder != null ? endpointBuilder.hashCode() : 0);
 849  0
         result = 29 * result + (sessionHandler != null ? sessionHandler.hashCode() : 0);
 850  0
         result = 29 * result + (defaultInboundTransformer != null ? defaultInboundTransformer.hashCode() : 0);
 851  0
         result = 29 * result
 852  
                  + (defaultOutboundTransformer != null ? defaultOutboundTransformer.hashCode() : 0);
 853  0
         result = 29 * result
 854  
                  + (defaultResponseTransformer != null ? defaultResponseTransformer.hashCode() : 0);
 855  0
         return 29 * result + (properties != null ? properties.hashCode() : 0);
 856  
     }
 857  
 
 858  
 }