Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mortbay.j2ee.session
Class StateInterceptor  view StateInterceptor download StateInterceptor.java

java.lang.Object
  extended byorg.mortbay.j2ee.session.StateInterceptor
All Implemented Interfaces:
java.lang.Cloneable, State
Direct Known Subclasses:
ActivationInterceptor, AroundInterceptor, BindingInterceptor, DebugInterceptor, MarshallingInterceptor, MigrationInterceptor, PublishingInterceptor, SubscribingInterceptor, SynchronizationInterceptor, SynchronizingInterceptor, ThrottleInterceptor, TypeCheckingInterceptor

public class StateInterceptor
extends java.lang.Object
implements State, java.lang.Cloneable

Superlass for StateInterceptors - objects which wrap-n-delegate/decorate a State instance. A stack of StateInterceptors form a StateContainer.

Version:
1.0

Field Summary
private static java.lang.ThreadLocal _manager
           
private static java.lang.ThreadLocal _session
           
private  State _state
           
 
Constructor Summary
StateInterceptor()
           
 
Method Summary
 java.lang.Object clone()
          This method may be called to create a new copy of the Object.
 int getActualMaxInactiveInterval()
           
 java.lang.Object getAttribute(java.lang.String name)
           
 java.util.Enumeration getAttributeNameEnumeration()
           
 java.lang.String[] getAttributeNameStringArray()
           
 java.util.Map getAttributes()
           
 long getCreationTime()
           
 java.lang.String getId()
           
 long getLastAccessedTime()
           
protected  Manager getManager()
           
 int getMaxInactiveInterval()
           
protected  javax.servlet.http.HttpSession getSession()
           
protected  State getState()
           
 boolean isValid()
           
 java.lang.Object removeAttribute(java.lang.String name, boolean returnValue)
           
 java.lang.Object setAttribute(java.lang.String name, java.lang.Object value, boolean returnValue)
           
 void setAttributes(java.util.Map attributes)
           
 void setLastAccessedTime(long time)
           
protected  void setManager(Manager manager)
           
 void setMaxInactiveInterval(int interval)
           
protected  void setSession(javax.servlet.http.HttpSession session)
           
protected  void setState(State state)
           
 void start()
           
 void stop()
           
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_manager

private static final java.lang.ThreadLocal _manager

_session

private static final java.lang.ThreadLocal _session

_state

private State _state
Constructor Detail

StateInterceptor

public StateInterceptor()
Method Detail

getManager

protected Manager getManager()

setManager

protected void setManager(Manager manager)

getSession

protected javax.servlet.http.HttpSession getSession()

setSession

protected void setSession(javax.servlet.http.HttpSession session)

getState

protected State getState()

setState

protected void setState(State state)

start

public void start()

stop

public void stop()

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


getId

public java.lang.String getId()
                       throws java.rmi.RemoteException
Specified by:
getId in interface State

getActualMaxInactiveInterval

public int getActualMaxInactiveInterval()
                                 throws java.rmi.RemoteException
Specified by:
getActualMaxInactiveInterval in interface State

getCreationTime

public long getCreationTime()
                     throws java.rmi.RemoteException
Specified by:
getCreationTime in interface State

getAttributes

public java.util.Map getAttributes()
                            throws java.rmi.RemoteException
Specified by:
getAttributes in interface State

setAttributes

public void setAttributes(java.util.Map attributes)
                   throws java.rmi.RemoteException
Specified by:
setAttributes in interface State

getLastAccessedTime

public long getLastAccessedTime()
                         throws java.rmi.RemoteException
Specified by:
getLastAccessedTime in interface State

setLastAccessedTime

public void setLastAccessedTime(long time)
                         throws java.rmi.RemoteException
Specified by:
setLastAccessedTime in interface State

getMaxInactiveInterval

public int getMaxInactiveInterval()
                           throws java.rmi.RemoteException
Specified by:
getMaxInactiveInterval in interface State

setMaxInactiveInterval

public void setMaxInactiveInterval(int interval)
                            throws java.rmi.RemoteException
Specified by:
setMaxInactiveInterval in interface State

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
                              throws java.rmi.RemoteException
Specified by:
getAttribute in interface State

setAttribute

public java.lang.Object setAttribute(java.lang.String name,
                                     java.lang.Object value,
                                     boolean returnValue)
                              throws java.rmi.RemoteException
Specified by:
setAttribute in interface State

removeAttribute

public java.lang.Object removeAttribute(java.lang.String name,
                                        boolean returnValue)
                                 throws java.rmi.RemoteException
Specified by:
removeAttribute in interface State

getAttributeNameEnumeration

public java.util.Enumeration getAttributeNameEnumeration()
                                                  throws java.rmi.RemoteException
Specified by:
getAttributeNameEnumeration in interface State

getAttributeNameStringArray

public java.lang.String[] getAttributeNameStringArray()
                                               throws java.rmi.RemoteException
Specified by:
getAttributeNameStringArray in interface State

isValid

public boolean isValid()
                throws java.rmi.RemoteException
Specified by:
isValid in interface State

clone

public java.lang.Object clone()
Description copied from class: java.lang.Object
This method may be called to create a new copy of the Object. The typical behavior is as follows:
  • o == o.clone() is false
  • o.getClass() == o.clone().getClass() is true
  • o.equals(o) is true

However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object)>Object.equals(Object) 55 .

If the Object you call clone() on does not implement java.lang.Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.

Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.

All array types implement Cloneable, and override this method as follows (it should never fail):

 public Object clone()
 {
   try
     {
       super.clone();
     }
   catch (CloneNotSupportedException e)
     {
       throw new InternalError(e.getMessage());
     }
 }