KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > impl > ImmutableMuleEndpoint


1 /*
2  * $Id: ImmutableMuleEndpoint.java 4259 2006-12-14 03:12:07Z 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 MuleSource MPL
7  * license, a copy of which has been included with this distribution in the
8  * LICENSE.txt file.
9  */

10
11 package org.mule.impl;
12
13 import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
14 import edu.emory.mathcs.backport.java.util.concurrent.atomic.AtomicBoolean;
15 import org.apache.commons.logging.Log;
16 import org.apache.commons.logging.LogFactory;
17 import org.mule.MuleException;
18 import org.mule.MuleManager;
19 import org.mule.config.i18n.Message;
20 import org.mule.config.i18n.Messages;
21 import org.mule.impl.endpoint.MuleEndpoint;
22 import org.mule.impl.endpoint.MuleEndpointURI;
23 import org.mule.providers.AbstractConnector;
24 import org.mule.providers.service.ConnectorFactory;
25 import org.mule.providers.service.ConnectorFactoryException;
26 import org.mule.umo.UMOException;
27 import org.mule.umo.UMOFilter;
28 import org.mule.umo.UMOTransactionConfig;
29 import org.mule.umo.endpoint.UMOEndpoint;
30 import org.mule.umo.endpoint.UMOEndpointURI;
31 import org.mule.umo.endpoint.UMOImmutableEndpoint;
32 import org.mule.umo.lifecycle.InitialisationException;
33 import org.mule.umo.provider.UMOConnector;
34 import org.mule.umo.security.UMOEndpointSecurityFilter;
35 import org.mule.umo.transformer.UMOTransformer;
36 import org.mule.util.ClassUtils;
37 import org.mule.util.MuleObjectHelper;
38 import org.mule.util.ObjectNameHelper;
39 import org.mule.util.StringUtils;
40
41 import java.util.Collections JavaDoc;
42 import java.util.Map JavaDoc;
43
44 /**
45  * <code>ImmutableMuleEndpoint</code> describes a Provider in the Mule Server. A
46  * endpoint is a grouping of an endpoint, an endpointUri and a transformer.
47  */

48 public class ImmutableMuleEndpoint implements UMOImmutableEndpoint
49 {
50     /**
51      * Serial version
52      */

53     private static final long serialVersionUID = -2431378111247771909L;
54
55     /**
56      * logger used by this class
57      */

58     protected static final Log logger = LogFactory.getLog(ImmutableMuleEndpoint.class);
59
60     /**
61      * The endpoint used to communicate with the external system
62      */

63     protected UMOConnector connector = null;
64
65     /**
66      * The endpointUri on which to send or receive information
67      */

68     protected UMOEndpointURI endpointUri = null;
69
70     /**
71      * The transformer used to transform the incoming or outgoing data
72      */

73     protected UMOTransformer transformer = null;
74
75     /**
76      * The transformer used to transform the incoming or outgoing data
77      */

78     protected UMOTransformer responseTransformer = null;
79
80     /**
81      * The name for the endpoint
82      */

83     protected String JavaDoc name = null;
84
85     /**
86      * Determines whether the endpoint is a receiver or sender or both
87      */

88     protected String JavaDoc type = ENDPOINT_TYPE_SENDER_AND_RECEIVER;
89
90     /**
91      * Any additional properties for the endpoint
92      */

93     protected Map properties = null;
94
95     /**
96      * The transaction configuration for this endpoint
97      */

98     protected UMOTransactionConfig transactionConfig = null;
99
100     /**
101      * event filter for this endpoint
102      */

103     protected UMOFilter filter = null;
104
105     /**
106      * determines whether unaccepted filtered events should be removed from the
107      * source. If they are not removed its up to the Message receiver to handle
108      * recieving the same message again
109      */

110     protected boolean deleteUnacceptedMessages = false;
111
112     /**
113      * has this endpoint been initialised
114      */

115     protected AtomicBoolean initialised = new AtomicBoolean(false);
116
117     /**
118      * The security filter to apply to this endpoint
119      */

120     protected UMOEndpointSecurityFilter securityFilter = null;
121
122     /**
123      * whether events received by this endpoint should execute in a single thread
124      */

125     protected Boolean JavaDoc synchronous = null;
126
127     /**
128      * Determines whether a synchronous call should block to obtain a response from a
129      * remote server (if the transport supports it). For example for Jms endpoints,
130      * setting remote sync will cause a temporary destination to be set up as a
131      * replyTo destination and will send the message a wait for a response on the
132      * replyTo destination. If the JMSReplyTo is already set on the message that
133      * destination will be used instead.
134      */

135     protected Boolean JavaDoc remoteSync = null;
136
137     /**
138      * How long to block when performing a remote synchronisation to a remote host.
139      * This property is optional and will be set to the default Synchonous Event time
140      * out value if not set
141      */

142     protected Integer JavaDoc remoteSyncTimeout = null;
143
144     /**
145      * Determines whether the endpoint should deal with requests as streams
146      */

147     protected boolean streaming = false;
148
149     /**
150      * The state that the endpoint is initialised in such as started or stopped
151      */

152     protected String JavaDoc initialState = INITIAL_STATE_STARTED;
153
154     protected String JavaDoc endpointEncoding = null;
155
156     /**
157      * determines if a new connector should be created for this endpoint
158      */

159     protected int createConnector = ConnectorFactory.GET_OR_CREATE_CONNECTOR;
160
161     /**
162      * Default ctor
163      */

164     private ImmutableMuleEndpoint()
165     {
166         super();
167     }
168
169     /**
170      * Default constructor
171      */

172     public ImmutableMuleEndpoint(String JavaDoc name,
173                                  UMOEndpointURI endpointUri,
174                                  UMOConnector connector,
175                                  UMOTransformer transformer,
176                                  String JavaDoc type,
177                                  int createConnector,
178                                  String JavaDoc endpointEncoding,
179                                  Map props)
180     {
181         this.name = name;
182         this.connector = connector;
183         this.createConnector = createConnector;
184         this.endpointEncoding = endpointEncoding;
185         this.type = type;
186
187         if (endpointUri != null)
188         {
189             this.endpointUri = new MuleEndpointURI(endpointUri);
190         }
191
192         if (transformer != null)
193         {
194             transformer.setEndpoint(this);
195             this.transformer = transformer;
196         }
197
198         this.properties = new ConcurrentHashMap();
199
200         if (props != null)
201         {
202             this.properties.putAll(props);
203         }
204
205         if (endpointUri != null)
206         {
207             properties.putAll(endpointUri.getParams());
208         }
209
210         // seal the properties if we are immutable to avoid
211
// write-through aliasing problems with the exposed Map
212
if (!(this instanceof MuleEndpoint))
213         {
214             this.properties = Collections.unmodifiableMap(this.properties);
215         }
216
217         // Create a default transaction config
218
transactionConfig = new MuleTransactionConfig();
219     }
220
221     public ImmutableMuleEndpoint(UMOImmutableEndpoint source)
222     {
223         this();
224         this.initFromDescriptor(source);
225     }
226
227     public ImmutableMuleEndpoint(String JavaDoc endpointName, boolean receiver) throws UMOException
228     {
229         this();
230         String JavaDoc type = (receiver ? UMOEndpoint.ENDPOINT_TYPE_RECEIVER : UMOEndpoint.ENDPOINT_TYPE_SENDER);
231         UMOEndpoint p = getOrCreateEndpointForUri(new MuleEndpointURI(endpointName), type);
232         this.initFromDescriptor(p);
233     }
234
235     protected void initFromDescriptor(UMOImmutableEndpoint source)
236     {
237         if (this.name == null)
238         {
239             this.name = source.getName();
240         }
241
242         if (this.endpointUri == null && source.getEndpointURI() != null)
243         {
244             this.endpointUri = new MuleEndpointURI(source.getEndpointURI());
245         }
246
247         if (this.endpointEncoding == null)
248         {
249             this.endpointEncoding = source.getEncoding();
250         }
251
252         if (this.connector == null)
253         {
254             this.connector = source.getConnector();
255         }
256
257         if (this.transformer == null)
258         {
259             this.transformer = source.getTransformer();
260         }
261
262         if (this.transformer != null)
263         {
264             this.transformer.setEndpoint(this);
265         }
266
267         if (this.responseTransformer == null)
268         {
269             this.responseTransformer = source.getResponseTransformer();
270         }
271
272         if (responseTransformer != null)
273         {
274             this.responseTransformer.setEndpoint(this);
275         }
276
277         this.properties = new ConcurrentHashMap();
278
279         if (source.getProperties() != null)
280         {
281             this.properties.putAll(source.getProperties());
282         }
283
284         if (endpointUri != null && endpointUri.getParams() != null)
285         {
286             this.properties.putAll(endpointUri.getParams());
287         }
288
289         // seal the properties if we are immutable to avoid
290
// write-through aliasing problems with the exposed Map
291
if (!(this instanceof MuleEndpoint))
292         {
293             this.properties = Collections.unmodifiableMap(this.properties);
294         }
295
296         this.type = source.getType();
297         this.transactionConfig = source.getTransactionConfig();
298         this.deleteUnacceptedMessages = source.isDeleteUnacceptedMessages();
299         this.initialState = source.getInitialState();
300
301         remoteSyncTimeout = new Integer JavaDoc(source.getRemoteSyncTimeout());
302         remoteSync = Boolean.valueOf(source.isRemoteSync());
303
304         filter = source.getFilter();
305         securityFilter = source.getSecurityFilter();
306     }
307
308     /*
309      * (non-Javadoc)
310      *
311      * @see org.mule.umo.endpoint.UMOEndpoint#getEndpointURI()
312      */

313     public UMOEndpointURI getEndpointURI()
314     {
315         return endpointUri;
316     }
317
318     public String JavaDoc getEncoding()
319     {
320         return endpointEncoding;
321     }
322
323     /*
324      * (non-Javadoc)
325      *
326      * @see org.mule.umo.endpoint.UMOImmutableEndpoint#getType()
327      */

328     public String JavaDoc getType()
329     {
330         return type;
331     }
332
333     /*
334      * (non-Javadoc)
335      *
336      * @see org.mule.umo.endpoint.UMOImmutableEndpoint#getConnectorName()
337      */

338     public UMOConnector getConnector()
339     {
340         return connector;
341     }
342
343     /*
344      * (non-Javadoc)
345      *
346      * @see org.mule.umo.endpoint.UMOImmutableEndpoint#getName()
347      */

348     public String JavaDoc getName()
349     {
350         return name;
351     }
352
353     /*
354      * (non-Javadoc)
355      *
356      * @see org.mule.umo.endpoint.UMOEndpoint#getTransformer()
357      */

358     public UMOTransformer getTransformer()
359     {
360         return transformer;
361     }
362
363     /*
364      * (non-Javadoc)
365      *
366      * @see org.mule.umo.endpoint.UMOImmutableEndpoint#getParams()
367      */

368     public Map getProperties()
369     {
370         return properties;
371     }
372
373     /*
374      * (non-Javadoc)
375      *
376      * @see java.lang.Object#clone()
377      */

378     // TODO this is the 'old' implementation of the clone() method which returns
379
// a MUTABLE endpoint! We need to clarify what endpoint mutability and
380
// cloning actually means
381
public Object JavaDoc clone()
382     {
383         UMOEndpoint clone = new MuleEndpoint(name, endpointUri, connector, transformer, type,
384             createConnector, endpointEncoding, properties);
385
386         clone.setTransactionConfig(transactionConfig);
387         clone.setFilter(filter);
388         clone.setSecurityFilter(securityFilter);
389
390         if (remoteSync != null)
391         {
392             clone.setRemoteSync(isRemoteSync());
393         }
394         if (remoteSyncTimeout != null)
395         {
396             clone.setRemoteSyncTimeout(getRemoteSyncTimeout());
397         }
398
399         if (synchronous != null)
400         {
401             clone.setSynchronous(synchronous.booleanValue());
402         }
403
404         clone.setDeleteUnacceptedMessages(deleteUnacceptedMessages);
405
406         clone.setInitialState(initialState);
407         if (initialised.get())
408         {
409             try
410             {
411                 clone.initialise();
412             }
413             catch (InitialisationException e)
414             {
415                 // this really should never happen as the endpoint is already
416
// initialised
417
logger.error(e.getMessage(), e);
418             }
419         }
420
421         return clone;
422     }
423
424     /*
425      * (non-Javadoc)
426      *
427      * @see org.mule.umo.endpoint.UMOImmutableEndpoint#isReadOnly()
428      */

429     public boolean isReadOnly()
430     {
431         return true;
432     }
433
434     public String JavaDoc toString()
435     {
436         return ClassUtils.getClassName(this.getClass()) + "{connector=" + connector + ", endpointUri="
437                + endpointUri + ", transformer=" + transformer + ", name='" + name + "'" + ", type='" + type
438                + "'" + ", properties=" + properties + ", transactionConfig=" + transactionConfig
439                + ", filter=" + filter + ", deleteUnacceptedMessages=" + deleteUnacceptedMessages
440                + ", initialised=" + initialised + ", securityFilter=" + securityFilter + ", synchronous="
441                + synchronous + ", initialState=" + initialState + ", createConnector=" + createConnector
442                + ", remoteSync=" + remoteSync + ", remoteSyncTimeout=" + remoteSyncTimeout
443                + ", endpointEncoding=" + endpointEncoding + "}";
444     }
445
446     /*
447      * (non-Javadoc)
448      *
449      * @see org.mule.umo.endpoint.UMOImmutableEndpoint#getProtocol()
450      */

451     public String JavaDoc getProtocol()
452     {
453         return connector.getProtocol();
454     }
455
456     /*
457      * (non-Javadoc)
458      *
459      * @see org.mule.umo.endpoint.UMOImmutableEndpoint#canReceive()
460      */

461     public boolean canReceive()
462     {
463         return (getType().equals(ENDPOINT_TYPE_RECEIVER) || getType().equals(
464             ENDPOINT_TYPE_SENDER_AND_RECEIVER));
465     }
466
467     /*
468      * (non-Javadoc)
469      *
470      * @see org.mule.umo.endpoint.UMOImmutableEndpoint#canSend()
471      */

472     public boolean canSend()
473     {
474         return (getType().equals(ENDPOINT_TYPE_SENDER) || getType().equals(ENDPOINT_TYPE_SENDER_AND_RECEIVER));
475     }
476
477     /*
478      * (non-Javadoc)
479      *
480      * @see org.mule.umo.endpoint.UMOEndpoint#getTransactionConfig()
481      */

482     public UMOTransactionConfig getTransactionConfig()
483     {
484         return transactionConfig;
485     }
486
487     public boolean equals(Object JavaDoc o)
488     {
489         if (this == o)
490         {
491             return true;
492         }
493         if (!(o instanceof ImmutableMuleEndpoint))
494         {
495             return false;
496         }
497
498         final ImmutableMuleEndpoint immutableMuleProviderDescriptor = (ImmutableMuleEndpoint)o;
499
500         if (!connector.getName().equals(immutableMuleProviderDescriptor.connector.getName()))
501         {
502             return false;
503         }
504         if (endpointUri != null && immutableMuleProviderDescriptor.endpointUri != null
505                         ? !endpointUri.getAddress().equals(
506                             immutableMuleProviderDescriptor.endpointUri.getAddress())
507                         : immutableMuleProviderDescriptor.endpointUri != null)
508         {
509             return false;
510         }
511         if (!name.equals(immutableMuleProviderDescriptor.name))
512         {
513             return false;
514         }
515         if (transformer != null
516                         ? !transformer.equals(immutableMuleProviderDescriptor.transformer)
517                         : immutableMuleProviderDescriptor.transformer != null)
518         {
519             return false;
520         }
521         if (!type.equals(immutableMuleProviderDescriptor.type))
522         {
523             return false;
524         }
525
526         return true;
527     }
528
529     public int hashCode()
530     {
531         int result = (connector != null ? connector.hashCode() : 0);
532         result = 29 * result + (endpointUri != null ? endpointUri.hashCode() : 0);
533         result = 29 * result + (transformer != null ? transformer.hashCode() : 0);
534         result = 29 * result + (name != null ? name.hashCode() : 0);
535         return 29 * result + (type != null ? type.hashCode() : 0);
536     }
537
538     public UMOFilter getFilter()
539     {
540         return filter;
541     }
542
543     public static UMOEndpoint createEndpointFromUri(UMOEndpointURI uri, String JavaDoc type) throws UMOException
544     {
545         return ConnectorFactory.createEndpoint(uri, type);
546     }
547
548     public static UMOEndpoint getEndpointFromUri(String JavaDoc uri)
549     {
550         UMOEndpoint endpoint = null;
551         if (uri != null)
552         {
553             String JavaDoc endpointString = MuleManager.getInstance().lookupEndpointIdentifier(uri, uri);
554             endpoint = MuleManager.getInstance().lookupEndpoint(endpointString);
555         }
556         return endpoint;
557     }
558
559     public static UMOEndpoint getEndpointFromUri(UMOEndpointURI uri) throws UMOException
560     {
561         String JavaDoc endpointName = uri.getEndpointName();
562         if (endpointName != null)
563         {
564             String JavaDoc endpointString = MuleManager.getInstance().lookupEndpointIdentifier(endpointName,
565                 endpointName);
566             UMOEndpoint endpoint = MuleManager.getInstance().lookupEndpoint(endpointString);
567             if (endpoint != null)
568             {
569                 if (StringUtils.isNotEmpty(uri.getAddress()))
570                 {
571                     endpoint.setEndpointURI(uri);
572                 }
573             }
574             return endpoint;
575         }
576
577         return null;
578     }
579
580     public static UMOEndpoint getOrCreateEndpointForUri(String JavaDoc uriIdentifier, String JavaDoc type)
581         throws UMOException
582     {
583         UMOEndpoint endpoint = getEndpointFromUri(uriIdentifier);
584         if (endpoint == null)
585         {
586             endpoint = createEndpointFromUri(new MuleEndpointURI(uriIdentifier), type);
587         }
588         else
589         {
590             if (endpoint.getType().equals(UMOEndpoint.ENDPOINT_TYPE_SENDER_AND_RECEIVER))
591             {
592                 endpoint.setType(type);
593             }
594             else if (!endpoint.getType().equals(type))
595             {
596                 throw new IllegalArgumentException JavaDoc("Endpoint matching: " + uriIdentifier
597                                                    + " is not of type: " + type + ". It is of type: "
598                                                    + endpoint.getType());
599
600             }
601         }
602         return endpoint;
603     }
604
605     public static UMOEndpoint getOrCreateEndpointForUri(UMOEndpointURI uri, String JavaDoc type) throws UMOException
606     {
607         UMOEndpoint endpoint = getEndpointFromUri(uri);
608         if (endpoint == null)
609         {
610             endpoint = createEndpointFromUri(uri, type);
611         }
612         return endpoint;
613     }
614
615     public boolean isDeleteUnacceptedMessages()
616     {
617         return deleteUnacceptedMessages;
618     }
619
620     public void initialise() throws InitialisationException
621     {
622         if (initialised.get())
623         {
624             logger.debug("Already initialised: " + toString());
625             return;
626         }
627         if (connector == null)
628         {
629             if (endpointUri.getConnectorName() != null)
630             {
631                 connector = MuleManager.getInstance().lookupConnector(endpointUri.getConnectorName());
632                 if (connector == null)
633                 {
634                     throw new IllegalArgumentException JavaDoc("Connector not found: "
635                                                        + endpointUri.getConnectorName());
636                 }
637             }
638             else
639             {
640                 try
641                 {
642                     connector = ConnectorFactory.getOrCreateConnectorByProtocol(this);
643                     if (connector == null)
644                     {
645                         throw new InitialisationException(new Message(
646                             Messages.CONNECTOR_WITH_PROTOCOL_X_NOT_REGISTERED, endpointUri.getScheme()), this);
647                     }
648                 }
649                 catch (ConnectorFactoryException e)
650                 {
651                     throw new InitialisationException(new Message(
652                         Messages.FAILED_TO_CREATE_CONNECTOR_FROM_URI_X, endpointUri), e, this);
653                 }
654             }
655
656             if (endpointUri.getEndpointName() != null && name == null)
657             {
658                 name = endpointUri.getEndpointName();
659             }
660         }
661         name = ObjectNameHelper.getEndpointName(this);
662
663         String JavaDoc sync = endpointUri.getParams().getProperty("synchronous", null);
664         if (sync != null)
665         {
666             synchronous = Boolean.valueOf(sync);
667         }
668         if (properties != null && endpointUri.getParams() != null)
669         {
670             properties.putAll(endpointUri.getParams());
671         }
672
673         if (endpointUri.getTransformers() != null)
674         {
675             try
676             {
677                 transformer = MuleObjectHelper.getTransformer(endpointUri.getTransformers(), ",");
678             }
679             catch (MuleException e)
680             {
681                 throw new InitialisationException(e, this);
682             }
683         }
684
685         if (transformer == null)
686         {
687             if (connector instanceof AbstractConnector)
688             {
689                 if (UMOEndpoint.ENDPOINT_TYPE_SENDER.equals(type))
690                 {
691                     transformer = ((AbstractConnector)connector).getDefaultOutboundTransformer();
692                 }
693                 else
694                 {
695                     transformer = ((AbstractConnector)connector).getDefaultInboundTransformer();
696                 }
697             }
698         }
699         if (transformer != null)
700         {
701             transformer.setEndpoint(this);
702         }
703
704         if (endpointUri.getResponseTransformers() != null)
705         {
706             try
707             {
708                 responseTransformer = MuleObjectHelper.getTransformer(endpointUri.getResponseTransformers(),
709                     ",");
710             }
711             catch (MuleException e)
712             {
713                 throw new InitialisationException(e, this);
714             }
715         }
716         if (responseTransformer == null)
717         {
718             if (connector instanceof AbstractConnector)
719             {
720                 responseTransformer = ((AbstractConnector)connector).getDefaultResponseTransformer();
721             }
722         }
723         if (responseTransformer != null)
724         {
725             responseTransformer.setEndpoint(this);
726         }
727
728         if (securityFilter != null)
729         {
730             securityFilter.setEndpoint(this);
731             securityFilter.initialise();
732         }
733
734         // Allow remote sync values to be set as params on the endpoint URI
735
String JavaDoc rs = (String JavaDoc)endpointUri.getParams().remove("remoteSync");
736         if (rs != null)
737         {
738             remoteSync = Boolean.valueOf(rs);
739         }
740
741         String JavaDoc rsTimeout = (String JavaDoc)endpointUri.getParams().remove("remoteSyncTimeout");
742         if (rsTimeout != null)
743         {
744             remoteSyncTimeout = Integer.valueOf(rsTimeout);
745         }
746
747         initialised.set(true);
748     }
749
750     /**
751      * Returns an UMOEndpointSecurityFilter for this endpoint. If one is not set,
752      * there will be no authentication on events sent via this endpoint
753      *
754      * @return UMOEndpointSecurityFilter responsible for authenticating message flow
755      * via this endpoint.
756      * @see org.mule.umo.security.UMOEndpointSecurityFilter
757      */

758     public UMOEndpointSecurityFilter getSecurityFilter()
759     {
760         return securityFilter;
761     }
762
763     /**
764      * Determines if requests originating from this endpoint should be synchronous
765      * i.e. execute in a single thread and possibly return an result. This property
766      * is only used when the endpoint is of type 'receiver'
767      *
768      * @return whether requests on this endpoint should execute in a single thread.
769      * This property is only used when the endpoint is of type 'receiver'
770      */

771     public boolean isSynchronous()
772     {
773         if (synchronous == null)
774         {
775             return MuleManager.getConfiguration().isSynchronous();
776         }
777         return synchronous.booleanValue();
778     }
779
780     public boolean isSynchronousSet()
781     {
782         return (synchronous != null);
783     }
784
785     public int getCreateConnector()
786     {
787         return createConnector;
788     }
789
790     /**
791      * For certain providers that support the notion of a backchannel such as sockets
792      * (outputStream) or Jms (ReplyTo) Mule can automatically wait for a response
793      * from a backchannel when dispatching over these protocols. This is different
794      * for synchronous as synchronous behavior only applies to in
795      *
796      * @return
797      */

798     public boolean isRemoteSync()
799     {
800         if (remoteSync == null)
801         {
802             if (connector == null || connector.isRemoteSyncEnabled())
803             {
804                 remoteSync = Boolean.valueOf(MuleManager.getConfiguration().isRemoteSync());
805             }
806             else
807             {
808                 remoteSync = Boolean.FALSE;
809             }
810         }
811         return remoteSync.booleanValue();
812     }
813
814     /**
815      * The timeout value for remoteSync invocations
816      *
817      * @return the timeout in milliseconds
818      */

819     public int getRemoteSyncTimeout()
820     {
821         if (remoteSyncTimeout == null)
822         {
823             remoteSyncTimeout = new Integer JavaDoc(MuleManager.getConfiguration().getSynchronousEventTimeout());
824         }
825         return remoteSyncTimeout.intValue();
826     }
827
828     /**
829      * Sets the state the endpoint will be loaded in. The States are 'stopped' and
830      * 'started' (default)
831      *
832      * @return the endpoint starting state
833      */

834     public String JavaDoc getInitialState()
835     {
836         return initialState;
837     }
838
839     public UMOTransformer getResponseTransformer()
840     {
841         return responseTransformer;
842     }
843
844     /**
845      * Determines whether the endpoint should deal with requests as streams
846      *
847      * @return true if the request should be streamed
848      */

849     public boolean isStreaming()
850     {
851         return streaming;
852     }
853
854     public Object JavaDoc getProperty(Object JavaDoc key)
855     {
856         Object JavaDoc value = properties.get(key);
857         if (value == null)
858         {
859             value = endpointUri.getParams().get(key);
860         }
861         return value;
862     }
863 }
864
Popular Tags