KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mule > umo > UMOSession


1 /*
2  * $Id: UMOSession.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;
12
13 import org.mule.umo.endpoint.UMOImmutableEndpoint;
14 import org.mule.umo.security.UMOSecurityContext;
15
16 import java.io.Serializable JavaDoc;
17 import java.util.Iterator JavaDoc;
18
19 /**
20  * <code>UMOSession</code> is the context in which a request is executed. The
21  * session manages the marshalling of events to and from components This object is
22  * not usually referenced by client code directly. If needed Components should manage
23  * events via the <code>UMOEventContext</code> which is obtainable via the
24  * <code>UMOManager</code> or by implementing
25  * <code>org.mule.umo.lifecycle.Callable</code>.
26  *
27  * @author <a HREF="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
28  * @version $Revision: 3798 $
29  */

30
31 public interface UMOSession extends Serializable JavaDoc
32 {
33     /**
34      * Returns the UMOComponent associated with the session in its current execution
35      *
36      * @return the UMOComponent associated with the session in its current execution
37      * @see org.mule.umo.UMOComponent
38      */

39     UMOComponent getComponent();
40
41     /**
42      * This will send an event via the configured outbound endpoint on the component
43      * for this session
44      *
45      * @param message the message to send
46      * @return the result of the send if any
47      * @throws org.mule.umo.UMOException if there is no outbound endpoint configured
48      * on the component or the events fails during dispatch
49      */

50     UMOMessage sendEvent(UMOMessage message) throws UMOException;
51
52     /**
53      * Depending on the session state this methods either Passes an event
54      * synchronously to the next available Mule UMO in the pool or via the endpoint
55      * configured for the event
56      *
57      * @param event the event to process
58      * @return the return Message from the call or null if there was no result
59      * @throws UMOException if the event fails to be processed by the component or
60      * the transport for the endpoint
61      */

62     UMOMessage sendEvent(UMOEvent event) throws UMOException;
63
64     /**
65      * Depending on the session state this methods either Passes an event
66      * synchronously to the next available Mule UMO in the pool or via the endpoint
67      * configured for the event
68      *
69      * @param message the event message payload to send
70      * @param endpoint The endpoint to disptch the event through
71      * @return the return Message from the call or null if there was no result
72      * @throws UMOException if the event fails to be processed by the component or
73      * the transport for the endpoint
74      */

75     UMOMessage sendEvent(UMOMessage message, UMOImmutableEndpoint endpoint) throws UMOException;
76
77     /**
78      * Depending on the session state this methods either Passes an event
79      * synchronously to the next available Mule UMO in the pool or via the endpoint
80      * configured for the event
81      *
82      * @param message the event message payload to send
83      * @param endpointName The endpoint name to disptch the event through. This will
84      * be looked up first on the component configuration and then on the
85      * mule manager configuration
86      * @return the return Message from the call or null if there was no result
87      * @throws UMOException if the event fails to be processed by the component or
88      * the transport for the endpoint
89      */

90     UMOMessage sendEvent(UMOMessage message, String JavaDoc endpointName) throws UMOException;
91
92     /**
93      * This will dispatch an event asynchronously via the configured outbound
94      * endpoint on the component for this session
95      *
96      * @param message the message to send
97      * @throws UMOException if there is no outbound endpoint configured on the
98      * component or the events fails during dispatch
99      */

100     void dispatchEvent(UMOMessage message) throws UMOException;
101
102     /**
103      * Depending on the session state this methods either Passes an event
104      * asynchronously to the next available Mule UMO in the pool or via the endpoint
105      * configured for the event
106      *
107      * @param event the event message payload to send first on the component
108      * configuration and then on the mule manager configuration
109      * @throws UMOException if the event fails to be processed by the component or
110      * the transport for the endpoint
111      */

112     void dispatchEvent(UMOEvent event) throws UMOException;
113
114     /**
115      * Depending on the session state this methods either Passes an event
116      * asynchronously to the next available Mule UMO in the pool or via the endpoint
117      * configured for the event
118      *
119      * @param message the event message payload to send
120      * @param endpoint The endpoint name to disptch the event through
121      * @throws UMOException if the event fails to be processed by the component or
122      * the transport for the endpoint
123      */

124     void dispatchEvent(UMOMessage message, UMOImmutableEndpoint endpoint) throws UMOException;
125
126     /**
127      * Depending on the session state this methods either Passes an event
128      * asynchronously to the next available Mule UMO in the pool or via the endpoint
129      * configured for the event
130      *
131      * @param message the event message payload to send
132      * @param endpointName The endpoint name to disptch the event through. This will
133      * be looked up first on the component configuration and then on the
134      * mule manager configuration
135      * @throws UMOException if the event fails to be processed by the component or
136      * the transport for the endpoint
137      */

138     void dispatchEvent(UMOMessage message, String JavaDoc endpointName) throws UMOException;
139
140     /**
141      * Requests a synchronous receive of an event on the component
142      *
143      * @param endpoint the endpoint identifing the endpointUri on ewhich the event
144      * will be received
145      * @param timeout time in milliseconds before the request timesout
146      * @return The requested event or null if the request times out
147      * @throws UMOException if the request operation fails
148      */

149     UMOMessage receiveEvent(UMOImmutableEndpoint endpoint, long timeout) throws UMOException;
150
151     /**
152      * Requests a synchronous receive of an event on the component
153      *
154      * @param endpointName the endpoint name identifing the endpointUri on ewhich the
155      * event will be received
156      * @param timeout time in milliseconds before the request timesout
157      * @return The requested event or null if the request times out
158      * @throws UMOException if the request operation fails
159      */

160     UMOMessage receiveEvent(String JavaDoc endpointName, long timeout) throws UMOException;
161
162     /**
163      * Determines if this session is valid. A session becomes invalid if an exception
164      * occurs while processing
165      *
166      * @return true if the component is functioning properly, false otherwise
167      */

168     boolean isValid();
169
170     /**
171      * Determines if this session is valid. A session becomes invalid if an exception
172      * occurs while processing
173      *
174      * @param value true if the component is functioning properly, false otherwise
175      */

176     void setValid(boolean value);
177
178     /**
179      * Creates an outbound event for this session
180      *
181      * @param message the event messgae payload
182      * @param endpoint the endpoint to send/dispatch through
183      * @param previousEvent the previous event (if any) on this session
184      * @return the event to send/dispatch
185      * @throws UMOException if the evnet cannot be created
186      */

187     UMOEvent createOutboundEvent(UMOMessage message, UMOImmutableEndpoint endpoint, UMOEvent previousEvent)
188         throws UMOException;
189
190     /**
191      * Returns the unique id for this session
192      *
193      * @return the unique id for this session
194      */

195     String JavaDoc getId();
196
197     /**
198      * The security context for this session. If not null outbound, inbound and/or
199      * method invocations will be authenticated using this context
200      *
201      * @param context the context for this session or null if the request is not
202      * secure.
203      */

204     void setSecurityContext(UMOSecurityContext context);
205
206     /**
207      * The security context for this session. If not null outbound, inbound and/or
208      * method invocations will be authenticated using this context
209      *
210      * @return the context for this session or null if the request is not secure.
211      */

212     UMOSecurityContext getSecurityContext();
213
214     /**
215      * Will set a session level property. These will either be stored and retrieved
216      * using the underlying transport mechanism of stored using a default mechanism
217      *
218      * @param key the key for the object data being stored on the session
219      * @param value the value of the session data
220      */

221     void setProperty(Object JavaDoc key, Object JavaDoc value);
222
223     /**
224      * Will retrieve a session level property.
225      *
226      * @param key the key for the object data being stored on the session
227      * @return the value of the session data or null if the property does not exist
228      */

229     Object JavaDoc getProperty(Object JavaDoc key);
230
231     /**
232      * Will retrieve a session level property and remove it from the session
233      *
234      * @param key the key for the object data being stored on the session
235      * @return the value of the session data or null if the property does not exist
236      */

237     Object JavaDoc removeProperty(Object JavaDoc key);
238
239     /**
240      * Returns an iterater of property keys for the session properties on this
241      * session
242      *
243      * @return an iterater of property keys for the session properties on this
244      * session
245      */

246     Iterator JavaDoc getPropertyNames();
247
248 }
249
Popular Tags