01: /*
02: * Copyright 2006 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
07: * BI Platform. The Initial Developer is Pentaho Corporation.
08: *
09: * 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;
21: import java.util.Iterator;
22: import java.util.Locale;
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
35: .getLog(StandaloneSession.class);
36:
37: public Log getLogger() {
38: return logger;
39: }
40:
41: private HashMap attributes;
42:
43: public StandaloneSession(String name) {
44: this (name, name);
45: }
46:
47: public StandaloneSession(String name, String id) {
48: this (name, id, Locale.getDefault());
49: }
50:
51: public StandaloneSession(String name, String id, Locale locale) {
52: super (name, id, locale);
53: attributes = new HashMap();
54: }
55:
56: public Iterator getAttributeNames() {
57: // TODO need to turn the set iterator into an enumeration...
58: return attributes.keySet().iterator();
59: }
60:
61: public Object getAttribute(String attributeName) {
62: return attributes.get(attributeName);
63: }
64:
65: public void setAttribute(String attributeName, Object value) {
66: attributes.put(attributeName, value);
67: }
68:
69: public Object removeAttribute(String attributeName) {
70: Object result = getAttribute(attributeName);
71: attributes.remove(attributeName);
72: return result;
73: }
74:
75: }
|