KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > commons > map > SessionMap


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5
6 package org.exoplatform.commons.map;
7
8 import javax.portlet.PortletSession;
9 import java.util.Enumeration JavaDoc;
10
11 /**
12  * @author Ove Ranheim (oranheim@users.sourceforge.net)
13  * @since Nov 6, 2003 6:32:49 PM
14  *
15  */

16 public class SessionMap extends AbstractMap
17 {
18     private PortletSession p_session;
19
20     public SessionMap( PortletSession session )
21     {
22         p_session = session;
23     }
24
25     protected Object JavaDoc getAttribute( String JavaDoc name )
26     {
27         if (p_session != null) {
28             return p_session.getAttribute( name );
29         } else {
30             return null;
31         }
32     }
33
34     protected void setAttribute( String JavaDoc name, Object JavaDoc value )
35     {
36         if (p_session != null)
37             p_session.setAttribute( name, value );
38     }
39
40     protected void removeAttribute( String JavaDoc name )
41     {
42         if (p_session != null)
43             p_session.removeAttribute( name );
44     }
45
46     protected Enumeration JavaDoc getAttributeNames()
47     {
48         if (p_session != null)
49             return p_session.getAttributeNames();
50         else
51             return null;
52     }
53 }
54
Popular Tags