View Javadoc

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