com.primix.tapestry.engine
Class SimpleEngine

java.lang.Object
  |
  +--com.primix.tapestry.engine.AbstractEngine
        |
        +--com.primix.tapestry.engine.SimpleEngine
All Implemented Interfaces:
java.util.EventListener, java.io.Externalizable, HttpSessionBindingListener, IEngine, java.io.Serializable
Direct Known Subclasses:
BorderEngine, SurveyEngine, VirtualLibraryEngine

public class SimpleEngine
extends AbstractEngine

Concrete implementation of IEngine used for relatively small applications. All page state information is maintained in memory. Since the instance is stored within the HttpSession, all page state information will be carried along to other servers in the cluster.

Version:
$Id: SimpleEngine.java,v 1.7 2001/06/21 21:11:03 hship Exp $
Author:
Howard Ship
See Also:
Serialized Form

Fields inherited from class com.primix.tapestry.engine.AbstractEngine
HELPER_BEAN_POOL_NAME, PAGE_SOURCE_NAME, pageSource, SCRIPT_SOURCE_NAME, specification, SPECIFICATION_SOURCE_NAME, specificationSource, TEMPLATE_SOURCE_NAME, templateSource, VISIT_CLASS_PROPERTY_NAME
 
Fields inherited from interface com.primix.tapestry.IEngine
EXCEPTION_PAGE, HOME_PAGE, STALE_LINK_PAGE, STALE_SESSION_PAGE
 
Constructor Summary
SimpleEngine()
           
 
Method Summary
protected  void cleanupAfterRequest(IRequestCycle cycle)
          Removes all page recorders that contain no changes.
 IPageRecorder createPageRecorder(java.lang.String pageName, IRequestCycle cycle)
          Creates a new page recorder for the named page.
 void forgetPage(java.lang.String name)
          Forgets changes to the named page by discarding the page recorder for the page.
 java.util.Collection getActivePageNames()
          Returns an unmodifiable Collection of the page names for which IPageRecorder instances exist.
 IPageRecorder getPageRecorder(java.lang.String pageName)
          Returns a recorder for a page.
 void readExternal(java.io.ObjectInput in)
          Restores the object state as written by writeExternal(ObjectOutput).
 void writeExternal(java.io.ObjectOutput out)
          Invokes the superclass implementation, then writes the number of recorders as an int (may be zero).
 
Methods inherited from class com.primix.tapestry.engine.AbstractEngine
activateExceptionPage, cleanupEngine, clearCachedData, constructService, createVisit, extendDescription, getContextPath, getHasVisit, getHelperBeanPool, getListeners, getLocale, getMonitor, getPageSource, getResourceResolver, getScriptSource, getService, getServletPath, getSpecification, getSpecificationSource, getTemplateSource, getVisit, getVisit, handleStaleLinkException, handleStaleSessionException, isResetServiceEnabled, isStateful, redirect, redirectOut, render, reportException, restart, service, serviceAction, serviceDirect, servicePage, serviceReset, 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

SimpleEngine

public SimpleEngine()
Method Detail

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Restores the object state as written by writeExternal(ObjectOutput).
Overrides:
readExternal in class AbstractEngine

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Invokes the superclass implementation, then writes the number of recorders as an int (may be zero).

For each recorder, writes

Overrides:
writeExternal in class AbstractEngine

cleanupAfterRequest

protected void cleanupAfterRequest(IRequestCycle cycle)
Removes all page recorders that contain no changes. Subclasses should invoke this implementation in addition to providing thier own.
Overrides:
cleanupAfterRequest in class AbstractEngine

forgetPage

public void forgetPage(java.lang.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 java.util.Collection getActivePageNames()
Returns an unmodifiable Collection of the page names for which IPageRecorder instances exist.
Overrides:
getActivePageNames in class AbstractEngine

getPageRecorder

public IPageRecorder getPageRecorder(java.lang.String pageName)
Description copied from interface: IEngine
Returns a recorder for a page. Returns null if the page record has not been created yet.
Following copied from interface: com.primix.tapestry.IEngine
See Also:
IEngine.createPageRecorder(String, IRequestCycle)

createPageRecorder

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