Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SimpleSessionHandler |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: SimpleSessionHandler.java 19191 2010-08-25 21:05:23Z tcarlson $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.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.session; | |
12 | ||
13 | import org.mule.api.MuleException; | |
14 | import org.mule.api.MuleMessage; | |
15 | import org.mule.api.MuleSession; | |
16 | import org.mule.api.config.MuleProperties; | |
17 | import org.mule.api.transport.SessionHandler; | |
18 | ||
19 | import org.apache.commons.logging.Log; | |
20 | import org.apache.commons.logging.LogFactory; | |
21 | ||
22 | /** | |
23 | * A session handler used to store and retrieve session information on an | |
24 | * event. The MuleSession information is stored as a header on the message (does not | |
25 | * support Tcp, Udp, etc. unless the MuleMessage object is serialised across the | |
26 | * wire). The session is stored in the "MULE_SESSION" property. | |
27 | */ | |
28 | 0 | public class SimpleSessionHandler implements SessionHandler |
29 | { | |
30 | 0 | protected transient Log logger = LogFactory.getLog(getClass()); |
31 | ||
32 | public MuleSession retrieveSessionInfoFromMessage(MuleMessage message) throws MuleException | |
33 | { | |
34 | 0 | return message.getInboundProperty(MuleProperties.MULE_SESSION_PROPERTY); |
35 | } | |
36 | ||
37 | /** | |
38 | * @deprecated Use retrieveSessionInfoFromMessage(MuleMessage message) instead | |
39 | */ | |
40 | public void retrieveSessionInfoFromMessage(MuleMessage message, MuleSession session) throws MuleException | |
41 | { | |
42 | 0 | session = retrieveSessionInfoFromMessage(message); |
43 | 0 | } |
44 | ||
45 | public void storeSessionInfoToMessage(MuleSession session, MuleMessage message) throws MuleException | |
46 | { | |
47 | 0 | message.setOutboundProperty(MuleProperties.MULE_SESSION_PROPERTY, session); |
48 | 0 | } |
49 | ||
50 | /** | |
51 | * @deprecated This method is no longer needed and will be removed in the next major release | |
52 | */ | |
53 | public String getSessionIDKey() | |
54 | { | |
55 | 0 | return "ID"; |
56 | } | |
57 | } |