View Javadoc

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