com.tirsen.angkor
Class Application

java.lang.Object
  |
  +--com.tirsen.angkor.Application
All Implemented Interfaces:
java.util.EventListener, javax.servlet.http.HttpSessionBindingListener, java.io.Serializable

public class Application
extends java.lang.Object
implements java.io.Serializable, javax.servlet.http.HttpSessionBindingListener

The main controller of an application, typically first class extended when implementing an application in Angkor. There is one instance of this for each session. Responsibilities include:

  • maintaining conversational state.
  • implementing core functionality shared by the entire application.
  • maintaining the flow of application.
  • maintaing a register of named components and their respective ViewFactory. which is to be used if using JSP in Angkor. Includes window-title.

    Version:
    $Revision: 1.7 $
    Author:
    $Author: tirsen $
    See Also:
    Serialized Form

    Constructor Summary
    Application()
               
     
    Method Summary
     void afterRequest(RenderContext context)
               
     void allocateUniqueID(java.lang.String id, View view)
               
     void beforeRequest(RenderContext context)
               
     Pipeline createBasicPipeline()
              Creates the basic pipeline with the exception of a render valve.
    protected  Pipeline createDefaultPipeline()
               
     Pipeline createPrerenderPipeline()
              Creates a pipeline that prerenders all currently registered components.
     Pipeline createRenderPipeline(ViewFactory factory)
              Creates the default processing pipeline.
     void destroy()
               
    static Application getApplication()
              Returns the application of the currently executing pipeline.
     ViewFactory getComponent(java.lang.String name)
               
     java.util.Map getComponentsToPrerender()
              This is used by the PrerenderValve and is not part of the public API.
     java.lang.Throwable getError()
               
     Page getPage(java.lang.String pageName)
               
     java.util.Collection getParsingComponents()
              Public for unit tests only, maybe it's time to move to JUnitX soon.
     java.lang.String getWindowTitle()
              Override to provide a title rendered by the angkor:header-tag.
     void handleError(java.lang.Throwable e)
               
     void init()
              Overriding method needs to call this method.
    protected  void initDefaultPropertyEditors()
               
    protected  void initPrerenderedComponents()
               
     java.util.Iterator iterateParsingComponents()
              Returns a tread-safe iterator of the parsing components.
     java.lang.String nextUniqueID()
               
     void process(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
               
     void registerComponent(java.lang.String name, ViewFactory factory)
              Registers a new component.
     void registerLink(java.lang.String name, ViewFactory originalBinding)
               
     void registerPage(java.lang.String name, Page page)
               
     void registerParsingComponent(View view)
               
     void registerPrerenderComponent(java.lang.String name, View component)
              Registers a new component.
     void relink(java.lang.String name, java.lang.String target)
              Relinks a link to a named view.
     void relink(java.lang.String name, ViewFactory target)
              Relinks a link.
     void resetParsingComponents()
               
     void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
               
     void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    Application

    public Application()
    Method Detail

    getError

    public java.lang.Throwable getError()

    handleError

    public void handleError(java.lang.Throwable e)

    getComponent

    public ViewFactory getComponent(java.lang.String name)

    registerComponent

    public void registerComponent(java.lang.String name,
                                  ViewFactory factory)
    Registers a new component.

    Throws:
    java.lang.IllegalStateException - if that component has already been registered.

    registerPrerenderComponent

    public void registerPrerenderComponent(java.lang.String name,
                                           View component)
    Registers a new component.

    Throws:
    java.lang.IllegalStateException - if that component has already been registered.

    registerLink

    public void registerLink(java.lang.String name,
                             ViewFactory originalBinding)

    relink

    public void relink(java.lang.String name,
                       ViewFactory target)
    Relinks a link.


    relink

    public void relink(java.lang.String name,
                       java.lang.String target)
    Relinks a link to a named view.


    init

    public void init()
    Overriding method needs to call this method.


    destroy

    public void destroy()

    valueBound

    public void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
    Specified by:
    valueBound in interface javax.servlet.http.HttpSessionBindingListener

    valueUnbound

    public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
    Specified by:
    valueUnbound in interface javax.servlet.http.HttpSessionBindingListener

    initPrerenderedComponents

    protected void initPrerenderedComponents()

    initDefaultPropertyEditors

    protected void initDefaultPropertyEditors()

    beforeRequest

    public void beforeRequest(RenderContext context)
                       throws java.io.IOException
    java.io.IOException

    afterRequest

    public void afterRequest(RenderContext context)
                      throws java.io.IOException
    java.io.IOException

    createRenderPipeline

    public Pipeline createRenderPipeline(ViewFactory factory)
    Creates the default processing pipeline. This will probably be refactored a lot. Which factory to use to produce the view to render needs to be determined beforehand.


    createPrerenderPipeline

    public Pipeline createPrerenderPipeline()
    Creates a pipeline that prerenders all currently registered components. These prerendered components can be used in for example JSP.


    createBasicPipeline

    public Pipeline createBasicPipeline()
    Creates the basic pipeline with the exception of a render valve.


    createDefaultPipeline

    protected Pipeline createDefaultPipeline()

    resetParsingComponents

    public void resetParsingComponents()

    iterateParsingComponents

    public java.util.Iterator iterateParsingComponents()
    Returns a tread-safe iterator of the parsing components. Parsing components can be registered while using the returned iterator, the components registered after this iterator has been created will not be iterated by this iterator.


    getParsingComponents

    public java.util.Collection getParsingComponents()
    Public for unit tests only, maybe it's time to move to JUnitX soon. TODO move this to the ExecuteContext.


    registerParsingComponent

    public void registerParsingComponent(View view)

    nextUniqueID

    public java.lang.String nextUniqueID()

    allocateUniqueID

    public void allocateUniqueID(java.lang.String id,
                                 View view)

    getComponentsToPrerender

    public java.util.Map getComponentsToPrerender()
                                           throws java.lang.Exception
    This is used by the PrerenderValve and is not part of the public API.

    Returns:
    a String -> ViewFactory map containing the components to prerender.
    java.lang.Exception

    getApplication

    public static Application getApplication()
    Returns the application of the currently executing pipeline.


    getWindowTitle

    public java.lang.String getWindowTitle()
    Override to provide a title rendered by the angkor:header-tag.


    registerPage

    public void registerPage(java.lang.String name,
                             Page page)

    process

    public void process(javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response)
                 throws java.lang.Exception
    java.lang.Exception

    getPage

    public Page getPage(java.lang.String pageName)


    Copyright © 2002-2002 . All Rights Reserved.