001: /*
002: * $Id: XINSHttpSession.java,v 1.11 2007/09/18 08:45:08 agoubard Exp $
003: *
004: * Copyright 2003-2007 Orange Nederland Breedband B.V.
005: * See the COPYRIGHT file for redistribution and use restrictions.
006: */
007: package org.xins.common.servlet.container;
008:
009: import java.util.Enumeration;
010: import java.util.Hashtable;
011: import java.util.Random;
012:
013: import javax.servlet.ServletContext;
014: import javax.servlet.http.HttpSession;
015: import javax.servlet.http.HttpSessionContext;
016:
017: /**
018: * A user session.
019: *
020: * @version $Revision: 1.11 $ $Date: 2007/09/18 08:45:08 $
021: * @author <a href="mailto:anthony.goubard@japplis.com">Anthony Goubard</a>
022: *
023: * @since XINS 1.4.0
024: */
025: public class XINSHttpSession implements HttpSession {
026:
027: /**
028: * The random generator.
029: */
030: private final static Random RANDOM = new Random();
031:
032: /**
033: * The session attributes.
034: */
035: private Hashtable _attributes = new Hashtable();
036:
037: /**
038: * The creation time of the session.
039: */
040: private long _creationTime = System.currentTimeMillis();
041:
042: /**
043: * The ID of the session.
044: */
045: private int _sessionID = RANDOM.nextInt();
046:
047: /**
048: * Creates a new instance of XINSHttpSession.
049: */
050: XINSHttpSession() {
051: }
052:
053: public void removeValue(String value) {
054: throw new UnsupportedOperationException();
055: }
056:
057: public void removeAttribute(String name) {
058: _attributes.remove(name);
059: }
060:
061: public Object getAttribute(String name) {
062: return _attributes.get(name);
063: }
064:
065: public Object getValue(String name) {
066: return getAttribute(name);
067: }
068:
069: public void setMaxInactiveInterval(int i) {
070: }
071:
072: public void setAttribute(String name, Object value) {
073: _attributes.put(name, value);
074: }
075:
076: public void putValue(String name, Object value) {
077: setAttribute(name, value);
078: }
079:
080: public Enumeration getAttributeNames() {
081: return _attributes.keys();
082: }
083:
084: public long getCreationTime() {
085: return _creationTime;
086: }
087:
088: public String getId() {
089: return "" + _sessionID;
090: }
091:
092: public long getLastAccessedTime() {
093: throw new UnsupportedOperationException();
094: }
095:
096: public int getMaxInactiveInterval() {
097: throw new UnsupportedOperationException();
098: }
099:
100: public ServletContext getServletContext() {
101: throw new UnsupportedOperationException();
102: }
103:
104: public HttpSessionContext getSessionContext() {
105: throw new UnsupportedOperationException();
106: }
107:
108: public String[] getValueNames() {
109: throw new UnsupportedOperationException();
110: }
111:
112: public void invalidate() {
113: throw new UnsupportedOperationException();
114: }
115:
116: public boolean isNew() {
117: throw new UnsupportedOperationException();
118: }
119: }
|