org.apache.tapestry.record
Class SessionPageRecorder

java.lang.Object
  extended by org.apache.tapestry.record.PageRecorder
      extended by org.apache.tapestry.record.SessionPageRecorder
All Implemented Interfaces:
IPageRecorder, ChangeObserver

public class SessionPageRecorder
extends PageRecorder

Simple implementation of IPageRecorderthat stores page changes as HttpSessionattributes.

Version:
$Id: SessionPageRecorder.java 244059 2005-01-25 00:10:51Z hlship $
Author:
Howard Ship

Constructor Summary
SessionPageRecorder()
           
 
Method Summary
 void commit()
          Simply clears the dirty flag, because there is no external place to store changed page properties.
 void discard()
          Invoked at the end of a request cycle in which the page recorder is discarded (either implicitly, because the page recorder has no changes, or explicitly because of IEngine.forgetPage(String) or IPageRecorder.markForDiscard().
 Collection getChanges()
          Returns a Collection of IPageChange objects identifying changes to the page and its components.
 boolean getHasChanges()
          Returns true if the recorder has any changes recorded.
 void initialize(String pageName, IRequestCycle cycle)
          Invoked after the recorder is instantiated to initialize it for the current request cycle.
protected  void recordChange(String componentPath, String propertyName, Object newValue)
          Records a change to a particular component.
 
Methods inherited from class org.apache.tapestry.record.PageRecorder
getDirty, isDirty, isLocked, isMarkedForDiscard, markForDiscard, observeChange, rollback, setDirty, setLocked
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionPageRecorder

public SessionPageRecorder()
Method Detail

initialize

public void initialize(String pageName,
                       IRequestCycle cycle)
Description copied from interface: IPageRecorder
Invoked after the recorder is instantiated to initialize it for the current request cycle.

Parameters:
pageName - the fully qualified page name
cycle - the current request cycle

discard

public void discard()
Description copied from interface: IPageRecorder
Invoked at the end of a request cycle in which the page recorder is discarded (either implicitly, because the page recorder has no changes, or explicitly because of IEngine.forgetPage(String) or IPageRecorder.markForDiscard().


commit

public void commit()
Simply clears the dirty flag, because there is no external place to store changed page properties. Sets the locked flag to prevent subsequent changes from occuring now.

Specified by:
commit in interface IPageRecorder
Specified by:
commit in class PageRecorder

getHasChanges

public boolean getHasChanges()
Returns true if the recorder has any changes recorded.


getChanges

public Collection getChanges()
Description copied from class: PageRecorder
Returns a Collection of IPageChange objects identifying changes to the page and its components.

Specified by:
getChanges in interface IPageRecorder
Specified by:
getChanges in class PageRecorder

recordChange

protected void recordChange(String componentPath,
                            String propertyName,
                            Object newValue)
Description copied from class: PageRecorder
Records a change to a particular component. Subclasses may cache these in memory, or record them externally at this time.

This method is responsible for setting the dirty flag if the described change is real.

Specified by:
recordChange in class PageRecorder
Parameters:
componentPath - the name of the component relative to the page which contains it. May be null if the change was to a property of the page itself.
propertyName - the name of the property which changed.
newValue - the new value for the property, which may also be null.
See Also:
IComponent.getIdPath()