1 16 package org.mortbay.j2ee.session; 17 18 20 import java.rmi.RemoteException ; 21 import java.util.Enumeration ; 22 import java.util.Map ; 23 24 import javax.servlet.http.HttpSession ; 25 26 35 public class 36 StateInterceptor 37 implements State, Cloneable 38 { 39 private final static ThreadLocal _manager=new ThreadLocal (); 44 protected Manager getManager () {return (Manager)_manager.get();} 45 protected void setManager(Manager manager) {_manager.set(manager);} 46 47 private final static ThreadLocal _session=new ThreadLocal (); 48 protected HttpSession getSession () {return (HttpSession )_session.get();} 49 protected void setSession(HttpSession session) {_session.set(session);} 50 51 private State _state; 53 protected State getState () {return _state;} 54 protected void setState(State state) {_state=state;} 55 56 60 64 public void start() {} 66 public void stop() {} 67 68 public String toString() {return "<"+getClass()+"->"+getState()+">";} 70 71 public String getId() throws RemoteException {return getState().getId();} 76 public int getActualMaxInactiveInterval() throws RemoteException {return getState().getActualMaxInactiveInterval();} 77 public long getCreationTime() throws RemoteException {return getState().getCreationTime();} 78 79 public Map getAttributes() throws RemoteException {return getState().getAttributes();} 81 public void setAttributes(Map attributes) throws RemoteException {getState().setAttributes(attributes);} 82 public long getLastAccessedTime() throws RemoteException {return getState().getLastAccessedTime();} 83 public void setLastAccessedTime(long time) throws RemoteException {getState().setLastAccessedTime(time);} 84 public int getMaxInactiveInterval() throws RemoteException {return getState().getMaxInactiveInterval();} 85 public void setMaxInactiveInterval(int interval) throws RemoteException {getState().setMaxInactiveInterval(interval);} 86 87 public Object getAttribute(String name) throws RemoteException {return getState().getAttribute(name);} 89 public Object setAttribute(String name, Object value, boolean returnValue) throws RemoteException {return getState().setAttribute(name, value, returnValue);} 90 public Object removeAttribute(String name, boolean returnValue) throws RemoteException {return getState().removeAttribute(name, returnValue);} 91 public Enumeration getAttributeNameEnumeration() throws RemoteException {return getState().getAttributeNameEnumeration();} 92 public String [] getAttributeNameStringArray() throws RemoteException {return getState().getAttributeNameStringArray();} 93 public boolean isValid() throws RemoteException {return getState().isValid();} 94 95 public Object 96 clone() 97 { 98 Object tmp=null; 99 try 100 { 101 tmp=getClass().newInstance(); 102 } 103 catch (Exception e) 104 { 105 } 107 108 return tmp; 109 } 110 } 111 112 | Popular Tags |