Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MuleSession |
|
| 0.0;0 |
1 | /* | |
2 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
3 | * The software in this package is published under the terms of the CPAL v1.0 | |
4 | * license, a copy of which has been included with this distribution in the | |
5 | * LICENSE.txt file. | |
6 | */ | |
7 | package org.mule.api; | |
8 | ||
9 | import org.mule.api.construct.FlowConstruct; | |
10 | import org.mule.api.security.SecurityContext; | |
11 | ||
12 | import java.io.Serializable; | |
13 | import java.util.Iterator; | |
14 | import java.util.Set; | |
15 | ||
16 | /** | |
17 | * <code>MuleSession</code> is the context in which a request is executed. The | |
18 | * session manages the marshalling of events to and from components This object is | |
19 | * not usually referenced by client code directly. If needed Components should manage | |
20 | * events via the <code>MuleEventContext</code> which is obtainable via the | |
21 | * <code>UMOManager</code> or by implementing | |
22 | * <code>org.mule.api.lifecycle.Callable</code>. | |
23 | */ | |
24 | ||
25 | public interface MuleSession extends Serializable | |
26 | { | |
27 | /** | |
28 | * Returns the Service associated with the session in its current execution | |
29 | * | |
30 | * @return the Service associated with the session in its current execution | |
31 | * @see FlowConstruct | |
32 | */ | |
33 | FlowConstruct getFlowConstruct(); | |
34 | ||
35 | /** | |
36 | * Sets the Service associated with the session in its current execution | |
37 | * | |
38 | * @see FlowConstruct | |
39 | */ | |
40 | void setFlowConstruct(FlowConstruct flowConstruct); | |
41 | ||
42 | /** | |
43 | * Determines if this session is valid. A session becomes invalid if an exception | |
44 | * occurs while processing | |
45 | * | |
46 | * @return true if the service is functioning properly, false otherwise | |
47 | */ | |
48 | boolean isValid(); | |
49 | ||
50 | /** | |
51 | * Determines if this session is valid. A session becomes invalid if an exception | |
52 | * occurs while processing | |
53 | * | |
54 | * @param value true if the service is functioning properly, false otherwise | |
55 | */ | |
56 | void setValid(boolean value); | |
57 | ||
58 | /** | |
59 | * Returns the unique id for this session | |
60 | * | |
61 | * @return the unique id for this session | |
62 | */ | |
63 | String getId(); | |
64 | ||
65 | /** | |
66 | * The security context for this session. If not null outbound, inbound and/or | |
67 | * method invocations will be authenticated using this context | |
68 | * | |
69 | * @param context the context for this session or null if the request is not | |
70 | * secure. | |
71 | */ | |
72 | void setSecurityContext(SecurityContext context); | |
73 | ||
74 | /** | |
75 | * The security context for this session. If not null outbound, inbound and/or | |
76 | * method invocations will be authenticated using this context | |
77 | * | |
78 | * @return the context for this session or null if the request is not secure. | |
79 | */ | |
80 | SecurityContext getSecurityContext(); | |
81 | ||
82 | /** | |
83 | * Will set a session level property. These will either be stored and retrieved | |
84 | * using the underlying transport mechanism of stored using a default mechanism | |
85 | * | |
86 | * @param key the key for the object data being stored on the session | |
87 | * @param value the value of the session data | |
88 | */ | |
89 | void setProperty(String key, Object value); | |
90 | ||
91 | /** | |
92 | * Will retrieve a session level property. | |
93 | * | |
94 | * @param key the key for the object data being stored on the session | |
95 | * @return the value of the session data or null if the property does not exist | |
96 | */ | |
97 | <T> T getProperty(Object key); | |
98 | ||
99 | /** | |
100 | * Will retrieve a session level property and remove it from the session | |
101 | * | |
102 | * @param key the key for the object data being stored on the session | |
103 | * @return the value of the session data or null if the property does not exist | |
104 | */ | |
105 | Object removeProperty(Object key); | |
106 | ||
107 | /** | |
108 | * Returns an iterater of property keys for the session properties on this | |
109 | * session | |
110 | * | |
111 | * @return an iterater of property keys for the session properties on this | |
112 | * session | |
113 | * @deprecated Use getPropertyNamesAsSet() instead | |
114 | */ | |
115 | Iterator getPropertyNames(); | |
116 | ||
117 | /** | |
118 | * @return property keys for all session properties | |
119 | */ | |
120 | Set<String> getPropertyNamesAsSet(); | |
121 | ||
122 | /** | |
123 | * Merge current session with an updated version | |
124 | * Result session will contain all the properties from updatedSession | |
125 | * plus those properties in the current session that couldn't be serialized | |
126 | * In case updatedSession is null, then no change will be applied. | |
127 | * | |
128 | * @param updatedSession mule session with updated properties | |
129 | */ | |
130 | void merge(MuleSession updatedSession); | |
131 | } |