KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pentaho > core > session > PentahoHttpSession


1 /*
2  * Copyright 2006 Pentaho Corporation. All rights reserved.
3  * This software was developed by Pentaho Corporation and is provided under the terms
4  * of the Mozilla Public License, Version 1.1, or any later version. You may not use
5  * this file except in compliance with the license. If you need a copy of the license,
6  * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
7  * BI Platform. The Initial Developer is Pentaho Corporation.
8  *
9  * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11  * the license for the specific language governing your rights and limitations.
12  *
13  * @created Jul 11, 2005
14  * @author James Dixon
15  *
16  */

17
18 package org.pentaho.core.session;
19
20 import org.apache.commons.collections.iterators.EnumerationIterator;
21 import java.util.Iterator JavaDoc;
22 import java.util.Locale JavaDoc;
23
24 import javax.servlet.http.HttpSession JavaDoc;
25
26 import org.apache.commons.logging.Log;
27 import org.apache.commons.logging.LogFactory;
28 import org.pentaho.core.system.PentahoSystem;
29
30 public class PentahoHttpSession extends BaseSession {
31
32     private static final long serialVersionUID = 1500696455420691764L;
33
34     private HttpSession JavaDoc session;
35
36     private static final Log logger = LogFactory.getLog(PentahoHttpSession.class);
37
38     public Log getLogger() {
39         return logger;
40     }
41
42     public PentahoHttpSession(String JavaDoc userName, HttpSession JavaDoc session, Locale JavaDoc locale) {
43         super(userName, session.getId(), locale);
44
45         this.session = session;
46
47         // run any session initialization actions
48
PentahoSystem.sessionStartup(this);
49     }
50
51     public Iterator getAttributeNames() {
52
53         return new EnumerationIterator(session.getAttributeNames());
54     }
55
56     public Object JavaDoc getAttribute(String JavaDoc attributeName) {
57         return session.getAttribute(attributeName);
58     }
59
60     public void setAttribute(String JavaDoc attributeName, Object JavaDoc value) {
61         session.setAttribute(attributeName, value);
62     }
63
64     public Object JavaDoc removeAttribute(String JavaDoc attributeName) {
65         Object JavaDoc result = getAttribute(attributeName);
66         session.removeAttribute(attributeName);
67         return result;
68     }
69 }
70
Popular Tags