KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > umo > endpoint > UMOImmutableEndpoint


1 /*
2  * $Id: UMOImmutableEndpoint.java 3798 2006-11-04 04:07:14Z 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.umo.endpoint;
12
13 import org.mule.umo.UMOFilter;
14 import org.mule.umo.UMOTransactionConfig;
15 import org.mule.umo.lifecycle.Initialisable;
16 import org.mule.umo.provider.UMOConnector;
17 import org.mule.umo.security.UMOEndpointSecurityFilter;
18 import org.mule.umo.transformer.UMOTransformer;
19
20 import java.io.Serializable JavaDoc;
21 import java.util.Map JavaDoc;
22
23 /**
24  * <code>UMOImmutableEndpoint</code> describes a Message endpoint where data is
25  * sent or received. An Enpoint is an Resource address (EndpointUri), with associated
26  * transformation, transaction and filtering rules.
27  *
28  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
29  * @version $Revision: 3798 $
30  */

31 public interface UMOImmutableEndpoint extends Serializable JavaDoc, Cloneable JavaDoc, Initialisable
32 {
33     public static final String JavaDoc INITIAL_STATE_STARTED = "started";
34     public static final String JavaDoc INITIAL_STATE_STOPPED = "stopped";
35
36     /** The endpoint is outbound */
37     public static final String JavaDoc ENDPOINT_TYPE_SENDER = "sender";
38
39     /** The endpoint is indound */
40     public static final String JavaDoc ENDPOINT_TYPE_RECEIVER = "receiver";
41
42     /** The endpoint is either and will be set depending on how it is used */
43     public static final String JavaDoc ENDPOINT_TYPE_SENDER_AND_RECEIVER = "senderAndReceiver";
44
45     /** The endpoint is a receive endpoint set on a response router */
46     public static final String JavaDoc ENDPOINT_TYPE_RESPONSE = "response";
47
48     /**
49      * This specifes the communication endpointUri. This will have a different format
50      * depending on the transport protocol being used i.e.
51      * <ul>
52      * <li>smtp -&gt; admin&#64;mycompany.com</li>
53      * <li>jms -&gt; shipping.orders.topic</li>
54      * <li>sms -&gt; +447910010010</li>
55      * </ul>
56      * <p/> if an endpointUri is not specifed it will be assumed that it will be
57      * determined at run-time by the calling application. The endpointUri can be
58      * aliteral endpointUri such as an email address or it can be a logical name for
59      * an endpointUri as long as it is declared in a <i>message-endpointUri</i>
60      * block. When the message-provider is created the endpointUri is first lookup in
61      * the endpointUri registry and if nothing is returned the endpointUri value
62      * itself is used.
63      *
64      * @return the endpointUri on which the endpoint sends or receives data
65      */

66     UMOEndpointURI getEndpointURI();
67
68     /**
69      * Decides the encoding to be used for events received by this endpoint
70      *
71      * @return the encoding set on the endpoint or null if no codin has been
72      * specified
73      */

74     String JavaDoc getEncoding();
75
76     /**
77      * Determines whether the message endpoint is a sender or receiver or both. The
78      * possible values are-
79      * <ul>
80      * <li>sender - PROVIDER_TYPE_SENDER</li>
81      * <li>receiver - PROVIDER_TYPE_RECEIVER</li>
82      * <li>senderAndReceiver - PROVIDER_TYPE_SENDER_AND_RECEIVER</li>
83      * </ul>
84      * The default is 'senderAndReceiver'.
85      *
86      * @return the endpoint type
87      */

88     String JavaDoc getType();
89
90     /**
91      * The endpoint that will be used to send the message on. It is important that
92      * the endpointUri and the connection correlate i.e. if your endpointUri is a jms
93      * queue your connection must be a JMS endpoint.
94      *
95      * @return the endpoint associated with the endpoint
96      */

97     UMOConnector getConnector();
98
99     /**
100      * The name is the identifier for the endpoint
101      *
102      * @return the endpoint name
103      */

104     String JavaDoc getName();
105
106     /**
107      * The transformer is responsible for transforming data when it is received or
108      * sent by the UMO (depending on whether this endpoint is a receiver or not). A
109      * tranformation for an inbound event can be forced by the user by calling the
110      * inbound event.getTransformedMessage(). A tranformation for an outbound event
111      * is called or when the UMO dispatchEvent() or sendEvent() methods are called.
112      * <p/> This attribute represents the name of the transformer to use as declared
113      * in the transformers section of the configuration file. IF a name for the
114      * transformer is not set on the configuration element, it will default to the
115      * name of the className attribute minus the package name.
116      *
117      * @return the transformer to use when receiving or sending data
118      */

119     UMOTransformer getTransformer();
120
121     /**
122      * The transformer used when a response is returned from invoking this endpoint
123      *
124      * @return the transformer to use when receiving the response data
125      */

126     UMOTransformer getResponseTransformer();
127
128     /**
129      * Returns any properties set on this endpoint
130      *
131      * @return a map of properties for this endpoint
132      */

133     Map JavaDoc getProperties();
134
135     /**
136      * Retrieves a property set on the endpoint
137      *
138      * @param key the name of the property
139      * @return the property value or null if it does not exist
140      */

141     Object JavaDoc getProperty(Object JavaDoc key);
142
143     /**
144      * The transport protocol name that the message endpoint communicates over. i.e.
145      * jms, sms, smtp etc. The protocol must match that of the associated endpoint
146      *
147      * @return the protocol name
148      */

149     String JavaDoc getProtocol();
150
151     /**
152      * @return true if this endpoint is read-only and none of it's properties can
153      * change. Global endpoints should be read-only so that unexpected
154      * behaviour is avoided.
155      */

156     boolean isReadOnly();
157
158     /**
159      * Determines whether this endpoint can be used to send events
160      *
161      * @return true if it has been configured to send events, false otherwise
162      */

163     boolean canSend();
164
165     /**
166      * Determines whether this endpoint can be used to receive events
167      *
168      * @return true if it has been configured to receive events, false otherwise
169      */

170     boolean canReceive();
171
172     /**
173      * Returns the transaction configuration for this endpoint
174      *
175      * @return the transaction configuration for this endpoint or null if the
176      * endpoint is not transactional
177      */

178     UMOTransactionConfig getTransactionConfig();
179
180     /**
181      * Make a deep copy of this endpoint
182      *
183      * @return a copy of the endpoint
184      */

185     Object JavaDoc clone();
186
187     /**
188      * The filter to apply to incoming messages. Only applies when the endpoint
189      * endpointUri is a receiver
190      *
191      * @return the UMOFilter to use or null if one is not set
192      */

193     UMOFilter getFilter();
194
195     /**
196      * If a filter is configured on this endpoint, this property will determine if
197      * message that are not excepted by the filter are deleted
198      *
199      * @return true if message should be deleted, false otherwise
200      */

201     boolean isDeleteUnacceptedMessages();
202
203     /**
204      * Returns an UMOEndpointSecurityFilter for this endpoint. If one is not set,
205      * there will be no authentication on events sent via this endpoint
206      *
207      * @return UMOEndpointSecurityFilter responsible for authenticating message flow
208      * via this endpoint.
209      * @see UMOEndpointSecurityFilter
210      */

211     UMOEndpointSecurityFilter getSecurityFilter();
212
213     /**
214      * Determines if requests originating from this endpoint should be synchronous
215      * i.e. execute in a single thread and possibly return an result. This property
216      * is only used when the endpoint is of type 'receiver'
217      *
218      * @return whether requests on this endpoint should execute in a single thread.
219      * This property is only used when the endpoint is of type 'receiver'
220      */

221     boolean isSynchronous();
222
223     /**
224      * Determines if the synchronous porperty has been set on the endpoint
225      *
226      * @return
227      */

228     boolean isSynchronousSet();
229
230     /**
231      * For certain providers that support the notion of a backchannel such as sockets
232      * (outputStream) or Jms (ReplyTo) Mule can automatically wait for a response
233      * from a backchannel when dispatching over these protocols. This is different
234      * for synchronous as synchronous behavior only applies to in
235      *
236      * @return
237      */

238     boolean isRemoteSync();
239
240     /**
241      * The timeout value for remoteSync invocations
242      *
243      * @return the timeout in milliseconds
244      */

245     int getRemoteSyncTimeout();
246
247     /**
248      * Determines if a new connector is created for this endpoint or an exising one
249      * must already be present
250      *
251      * @return
252      */

253     int getCreateConnector();
254
255     /**
256      * Sets the state the endpoint will be loaded in. The States are 'stopped' and
257      * 'started' (default)
258      *
259      * @return the endpoint starting state
260      */

261     String JavaDoc getInitialState();
262
263     /**
264      * Determines whether the endpoint should deal with requests as streams
265      *
266      * @return true if the request should be streamed
267      */

268     boolean isStreaming();
269 }
270
Popular Tags