org.apache.tapestry.engine
Class BaseEngine

java.lang.Object
  extended by org.apache.tapestry.engine.AbstractEngine
      extended by org.apache.tapestry.engine.BaseEngine
All Implemented Interfaces:
Externalizable, Serializable, EventListener, HttpSessionBindingListener, IEngineServiceView, IEngine
Direct Known Subclasses:
WMLEngine

public class BaseEngine
extends AbstractEngine

Concrete implementation of IEngine used for ordinary applications. All page state information is maintained in the HttpSession using instances of SessionPageRecorder.

Version:
$Id: BaseEngine.java 243791 2004-02-19 17:38:13Z hlship $
Author:
Howard Lewis Ship
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.tapestry.engine.AbstractEngine
_specification, _specificationSource, _templateSource, DATA_SQUEEZER_NAME, DEFAULT_OUTPUT_ENCODING, ENHANCER_NAME, GLOBAL_NAME, OUTPUT_ENCODING_PROPERTY_NAME, PAGE_SOURCE_NAME, POOL_NAME, PROPERTY_SOURCE_NAME, RESOURCE_CHECKSUM_SOURCE_NAME, SCRIPT_SOURCE_NAME, SERVICE_MAP_NAME, SPECIFICATION_SOURCE_NAME, STRINGS_SOURCE_NAME, TEMPLATE_SOURCE_NAME, VISIT_CLASS_PROPERTY_NAME
 
Constructor Summary
BaseEngine()
           
 
Method Summary
protected  void cleanupAfterRequest(IRequestCycle cycle)
          Removes all page recorders that contain no changes, or are marked for discard.
 IPageRecorder createPageRecorder(String pageName, IRequestCycle cycle)
          Creates a new page recorder for the named page.
 void extendDescription(org.apache.commons.lang.builder.ToStringBuilder builder)
          Extends the description of the class generated by AbstractEngine.toString().
 void forgetPage(String name)
          Forgets changes to the named page by discarding the page recorder for the page.
 Collection getActivePageNames()
          Returns an unmodifiable Collection of the page names for which IPageRecorder instances exist.
 IPageRecorder getPageRecorder(String pageName, IRequestCycle cycle)
          Returns a recorder for a page.
 void readExternal(ObjectInput in)
          Reconstructs the list of active page names written by writeExternal(ObjectOutput).
 void writeExternal(ObjectOutput out)
          Writes the engine's persistent state; this is simply the list of active page names.
 
Methods inherited from class org.apache.tapestry.engine.AbstractEngine
activateExceptionPage, clearCachedData, createComponentClassEnhancer, createComponentStringsSource, createDataSqueezer, createGlobal, createPageSource, createPool, createPropertySource, createRequestCycle, createResourceChecksumSource, createScriptSource, createSpecificationSource, createTemplateSource, createVisit, extractServiceName, getComponentClassEnhancer, getComponentMessagesSource, getContextPath, getDataSqueezer, getDefaultOutputEncoding, getExceptionPageName, getGlobal, getHasVisit, getListeners, getLocale, getMonitor, getOutputEncoding, getPageSource, getPool, getPropertySource, getResourceChecksumSource, getResourceResolver, getScriptSource, getService, getServletPath, getSpecification, getSpecificationSource, getStaleLinkPageName, getStaleSessionPageName, getTemplateSource, getVisit, getVisit, handlePageRedirectException, handleRedirectException, handleStaleLinkException, handleStaleSessionException, isDirty, isResetServiceEnabled, isStateful, markDirty, redirect, renderResponse, reportException, restart, service, setLocale, setStateful, setupForRequest, setVisit, toString, valueBound, valueUnbound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseEngine

public BaseEngine()
Method Detail

cleanupAfterRequest

protected void cleanupAfterRequest(IRequestCycle cycle)
Removes all page recorders that contain no changes, or are marked for discard. Subclasses should invoke this implementation in addition to providing thier own.

Specified by:
cleanupAfterRequest in class AbstractEngine

forgetPage

public void forgetPage(String name)
Description copied from interface: IEngine
Forgets changes to the named page by discarding the page recorder for the page. This is used when transitioning from one part of an application to another. All property changes for the page are lost.

This should be done if the page is no longer needed or relevant, otherwise the properties for the page will continue to be recorded by the engine, which is wasteful (especially if clustering or failover is employed on the application).

Throws an ApplicationRuntimeException if there are uncommitted changes for the recorder (in the current request cycle).


getActivePageNames

public Collection getActivePageNames()
Returns an unmodifiable Collection of the page names for which IPageRecorder instances exist.

Specified by:
getActivePageNames in class AbstractEngine

getPageRecorder

public IPageRecorder getPageRecorder(String pageName,
                                     IRequestCycle cycle)
Description copied from interface: IEngine
Returns a recorder for a page. Returns null if the page recorder has not been created yet.

See Also:
IEngine.createPageRecorder(String, IRequestCycle)

createPageRecorder

public IPageRecorder createPageRecorder(String pageName,
                                        IRequestCycle cycle)
Description copied from interface: IEngine
Creates a new page recorder for the named page.


readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Reconstructs the list of active page names written by writeExternal(ObjectOutput).

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class AbstractEngine
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Writes the engine's persistent state; this is simply the list of active page names. For efficiency, this is written as a count followed by each name as a UTF String.

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class AbstractEngine
Throws:
IOException

extendDescription

public void extendDescription(org.apache.commons.lang.builder.ToStringBuilder builder)
Description copied from class: AbstractEngine
Extends the description of the class generated by AbstractEngine.toString(). If a subclass adds additional instance variables that should be described in the instance description, it may overide this method. This implementation does nothing.

Overrides:
extendDescription in class AbstractEngine
See Also:
AbstractEngine.toString()