org.apache.tapestry5
Class BaseOptimizedSessionPersistedObject

java.lang.Object
  extended by org.apache.tapestry5.BaseOptimizedSessionPersistedObject
All Implemented Interfaces:
java.util.EventListener, javax.servlet.http.HttpSessionBindingListener, OptimizedSessionPersistedObject
Direct Known Subclasses:
BaseOptimizedApplicationStateObject, ValidationTrackerImpl

public abstract class BaseOptimizedSessionPersistedObject
extends java.lang.Object
implements OptimizedSessionPersistedObject, javax.servlet.http.HttpSessionBindingListener

Base implementation of OptimizedSessionPersistedObject. Subclasses should invoke markDirty() when internal state of the object changes.

Note that (due to TAP5-834), the object will receive a spurious valueUnbound() notification when dirty. Tapestry sets dirty session attributes to null, then to the persisted object, to force a valueBound() notification, and that unfortunately also sends the valueUnbound().

Since:
5.1.1.0

Constructor Summary
BaseOptimizedSessionPersistedObject()
           
 
Method Summary
 boolean isSessionPersistedObjectDirty()
          Returns true if the object has in-memory changes.
protected  void markDirty()
          Invoked by the subclass whenever the internal state of the object changes.
 void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
          Invoked by the servlet container when the value is stored (or re-stored) as an attribute of the session.
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
          Does nothing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseOptimizedSessionPersistedObject

public BaseOptimizedSessionPersistedObject()
Method Detail

isSessionPersistedObjectDirty

public final boolean isSessionPersistedObjectDirty()
Description copied from interface: OptimizedSessionPersistedObject
Returns true if the object has in-memory changes. It is the object's responsibility to set its internal flag to false, typically by implementing HttpSessionBindingListener.

Specified by:
isSessionPersistedObjectDirty in interface OptimizedSessionPersistedObject
Returns:

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
Invoked by the servlet container when the value is stored (or re-stored) as an attribute of the session. This clears the dirty flag. Subclasses may override this method, but should invoke this implementation.

Specified by:
valueBound in interface javax.servlet.http.HttpSessionBindingListener

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
Does nothing.

Specified by:
valueUnbound in interface javax.servlet.http.HttpSessionBindingListener

markDirty

protected final void markDirty()
Invoked by the subclass whenever the internal state of the object changes. Typically, this is invoked from mutator methods.



Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.