KickJava   Java API By Example, From Geeks To Geeks.

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


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 Jun 23, 2005
14  * @author James Dixon
15  *
16  */

17
18 package org.pentaho.core.session;
19
20 import java.util.HashMap JavaDoc;
21 import java.util.Iterator JavaDoc;
22 import java.util.Locale JavaDoc;
23
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26
27 public class StandaloneSession extends BaseSession {
28
29     /**
30      *
31      */

32     private static final long serialVersionUID = -1614831602086304014L;
33
34     private static final Log logger = LogFactory.getLog(StandaloneSession.class);
35
36     public Log getLogger() {
37         return logger;
38     }
39
40     private HashMap JavaDoc attributes;
41
42     public StandaloneSession(String JavaDoc name) {
43         this(name, name);
44     }
45
46     public StandaloneSession(String JavaDoc name, String JavaDoc id) {
47       this(name, id, Locale.getDefault());
48     }
49     
50     public StandaloneSession(String JavaDoc name, String JavaDoc id, Locale JavaDoc locale) {
51         super(name, id, locale);
52         attributes = new HashMap JavaDoc();
53     }
54
55     public Iterator JavaDoc getAttributeNames() {
56         // TODO need to turn the set iterator into an enumeration...
57
return attributes.keySet().iterator();
58     }
59
60     public Object JavaDoc getAttribute(String JavaDoc attributeName) {
61         return attributes.get(attributeName);
62     }
63
64     public void setAttribute(String JavaDoc attributeName, Object JavaDoc value) {
65         attributes.put(attributeName, value);
66     }
67
68     public Object JavaDoc removeAttribute(String JavaDoc attributeName) {
69         Object JavaDoc result = getAttribute(attributeName);
70         attributes.remove(attributeName);
71         return result;
72     }
73
74 }
75
Free Books   Free Magazines  
Popular Tags