001: /*
002: * Copyright 1999,2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.catalina.cluster.session;
018:
019: import java.util.Enumeration;
020:
021: import javax.servlet.ServletContext;
022: import javax.servlet.http.HttpSession;
023: import javax.servlet.http.HttpSessionContext;
024:
025: /**
026: * Facade for the DeltaSession object.
027: *
028: * @author Remy Maucherat
029: * @author Filip Hanik
030: * @version $Revision: 1.2 $ $Date: 2004/02/27 14:58:56 $
031: */
032:
033: public class DeltaSessionFacade implements HttpSession {
034:
035: // ----------------------------------------------------------- Constructors
036:
037: /**
038: * Construct a new session facade.
039: */
040: public DeltaSessionFacade(DeltaSession session) {
041: super ();
042: this .session = (HttpSession) session;
043: }
044:
045: /**
046: * Construct a new session facade.
047: */
048: public DeltaSessionFacade(HttpSession session) {
049: super ();
050: this .session = session;
051: }
052:
053: // ----------------------------------------------------- Instance Variables
054:
055: /**
056: * Wrapped session object.
057: */
058: private HttpSession session = null;
059:
060: // ---------------------------------------------------- HttpSession Methods
061:
062: public long getCreationTime() {
063: return session.getCreationTime();
064: }
065:
066: public String getId() {
067: return session.getId();
068: }
069:
070: public long getLastAccessedTime() {
071: return session.getLastAccessedTime();
072: }
073:
074: public ServletContext getServletContext() {
075: // FIXME : Facade this object ?
076: return session.getServletContext();
077: }
078:
079: public void setMaxInactiveInterval(int interval) {
080: session.setMaxInactiveInterval(interval);
081: }
082:
083: public int getMaxInactiveInterval() {
084: return session.getMaxInactiveInterval();
085: }
086:
087: public HttpSessionContext getSessionContext() {
088: return session.getSessionContext();
089: }
090:
091: public Object getAttribute(String name) {
092: return session.getAttribute(name);
093: }
094:
095: public Object getValue(String name) {
096: return session.getAttribute(name);
097: }
098:
099: public Enumeration getAttributeNames() {
100: return session.getAttributeNames();
101: }
102:
103: public String[] getValueNames() {
104: return session.getValueNames();
105: }
106:
107: public void setAttribute(String name, Object value) {
108: session.setAttribute(name, value);
109: }
110:
111: public void putValue(String name, Object value) {
112: session.setAttribute(name, value);
113: }
114:
115: public void removeAttribute(String name) {
116: session.removeAttribute(name);
117: }
118:
119: public void removeValue(String name) {
120: session.removeAttribute(name);
121: }
122:
123: public void invalidate() {
124: session.invalidate();
125: }
126:
127: public boolean isNew() {
128: return session.isNew();
129: }
130:
131: }
|