Save This Page
Home » apache-tomcat-6.0.16-src » org.apache » catalina » cluster » session » [javadoc | source]
    1   /*
    2    * Copyright 1999,2004 The Apache Software Foundation.
    3    * 
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    * 
    8    *      http://www.apache.org/licenses/LICENSE-2.0
    9    * 
   10    * Unless required by applicable law or agreed to in writing, software
   11    * distributed under the License is distributed on an "AS IS" BASIS,
   12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13    * See the License for the specific language governing permissions and
   14    * limitations under the License.
   15    */
   16   
   17   
   18   package org.apache.catalina.cluster.session;
   19   
   20   
   21   import java.util.Enumeration;
   22   
   23   import javax.servlet.ServletContext;
   24   import javax.servlet.http.HttpSession;
   25   import javax.servlet.http.HttpSessionContext;
   26   
   27   
   28   /**
   29    * Facade for the DeltaSession object.
   30    *
   31    * @author Remy Maucherat
   32    * @author Filip Hanik
   33    * @version $Revision: 302726 $ $Date: 2004-02-27 09:59:07 -0500 (Fri, 27 Feb 2004) $
   34    */
   35   
   36   public class DeltaSessionFacade
   37       implements HttpSession {
   38   
   39   
   40       // ----------------------------------------------------------- Constructors
   41   
   42   
   43       /**
   44        * Construct a new session facade.
   45        */
   46       public DeltaSessionFacade(DeltaSession session) {
   47           super();
   48           this.session = (HttpSession) session;
   49       }
   50   
   51   
   52       /**
   53        * Construct a new session facade.
   54        */
   55       public DeltaSessionFacade(HttpSession session) {
   56           super();
   57           this.session = session;
   58       }
   59   
   60   
   61       // ----------------------------------------------------- Instance Variables
   62   
   63   
   64       /**
   65        * Wrapped session object.
   66        */
   67       private HttpSession session = null;
   68   
   69   
   70       // ---------------------------------------------------- HttpSession Methods
   71   
   72   
   73       public long getCreationTime() {
   74           return session.getCreationTime();
   75       }
   76   
   77   
   78       public String getId() {
   79           return session.getId();
   80       }
   81   
   82   
   83       public long getLastAccessedTime() {
   84           return session.getLastAccessedTime();
   85       }
   86   
   87   
   88       public ServletContext getServletContext() {
   89           // FIXME : Facade this object ?
   90           return session.getServletContext();
   91       }
   92   
   93   
   94       public void setMaxInactiveInterval(int interval) {
   95           session.setMaxInactiveInterval(interval);
   96       }
   97   
   98   
   99       public int getMaxInactiveInterval() {
  100           return session.getMaxInactiveInterval();
  101       }
  102   
  103   
  104       public HttpSessionContext getSessionContext() {
  105           return session.getSessionContext();
  106       }
  107   
  108   
  109       public Object getAttribute(String name) {
  110           return session.getAttribute(name);
  111       }
  112   
  113   
  114       public Object getValue(String name) {
  115           return session.getAttribute(name);
  116       }
  117   
  118   
  119       public Enumeration getAttributeNames() {
  120           return session.getAttributeNames();
  121       }
  122   
  123   
  124       public String[] getValueNames() {
  125           return session.getValueNames();
  126       }
  127   
  128   
  129       public void setAttribute(String name, Object value) {
  130           session.setAttribute(name, value);
  131       }
  132   
  133   
  134       public void putValue(String name, Object value) {
  135           session.setAttribute(name, value);
  136       }
  137   
  138   
  139       public void removeAttribute(String name) {
  140           session.removeAttribute(name);
  141       }
  142   
  143   
  144       public void removeValue(String name) {
  145           session.removeAttribute(name);
  146       }
  147   
  148   
  149       public void invalidate() {
  150           session.invalidate();
  151       }
  152   
  153   
  154       public boolean isNew() {
  155           return session.isNew();
  156       }
  157   
  158   
  159   }

Save This Page
Home » apache-tomcat-6.0.16-src » org.apache » catalina » cluster » session » [javadoc | source]