org.objectledge.web.mvc.builders
Class BuilderExecutorValve

java.lang.Object
  extended by org.objectledge.web.mvc.builders.BuilderExecutorValve
All Implemented Interfaces:
Valve

public class BuilderExecutorValve
extends Object
implements Valve

Pipeline component for executing MVC view building.

The BuilderExecutorValve starts with a view name selected by the configured view request parameter (WebConfigurator.getViewToken()). This parameter has to be defined and if not an UndefinedViewParameterException is thrown. At the same time the view name must point to either an existing Builder class or an existing template. If none of these exists a MissingViewException is thrown. If either the template or a builder has been found, the view building starts.

For a given view name either a builder class or a template may be found using the defaulting strategy. This is useful for instance for applications having a set of different templates for presenting the same data. But be warned - defaulting may cause a lot of trouble and You should be aware of it.

If the builder is found it is given the possiblity to route the processing to another builder. This is a rarely used functionality and has been introduced for similarity with older web application frameworks. Routing changes the currently selected view name and forces a new builder and template lookup.

Having the either a builder or a template or both at the same time the build method of the builder is executed (missing builders and templates are replaced with DefaultBuilder and DefaultTemplate objects). Building creates a String represenation of view contents. The only exception is in case of a Builder which creates a direct response and writes it's content directly to the response (via HttpContext), in such case view processing is stopped.

Having the build results for a view, an enclosing view is looked up. The choice of the enclosing view is made upon:

A detailed diagram of the enclosing view choice algorithm follows:

Enclosing view choice algorithm

Version:
$Id: BuilderExecutorValve.java,v 1.36 2006/04/04 12:34:14 pablo Exp $
Author:
Damian Gajda

Field Summary
protected  MVCClassFinder classFinder
          Finder for builder objects.
protected  Builder defaultBuilder
          the default builder.
protected  Template defaultTemplate
          the default template.
protected  int maxEnclosures
          maximum number of builder enclosures.
protected  int maxRouteCalls
          maximum number of route calls per builder.
protected  SecurityHelper securityHelper
          SecurityHelper for access checking.
protected  MVCTemplateFinder templateFinder
          Finder for template objects.
protected  ViewEnclosureManager viewEnclosureManager
          ViewEnclosureManager for access template based view enclosures.
 
Constructor Summary
BuilderExecutorValve(Context context, MVCClassFinder classFinder, MVCTemplateFinder templateFinder, SecurityHelper securityHelper, ViewEnclosureManager viewEnclosureManager, int maxRouteCalls, int maxEnclosures)
          Component constructor.
 
Method Summary
 void process(Context context)
          Run view building starting from a view builder chosen in request parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classFinder

protected MVCClassFinder classFinder
Finder for builder objects.


templateFinder

protected MVCTemplateFinder templateFinder
Finder for template objects.


securityHelper

protected SecurityHelper securityHelper
SecurityHelper for access checking.


viewEnclosureManager

protected ViewEnclosureManager viewEnclosureManager
ViewEnclosureManager for access template based view enclosures.


maxRouteCalls

protected int maxRouteCalls
maximum number of route calls per builder.


maxEnclosures

protected int maxEnclosures
maximum number of builder enclosures.


defaultBuilder

protected Builder defaultBuilder
the default builder.


defaultTemplate

protected Template defaultTemplate
the default template.

Constructor Detail

BuilderExecutorValve

public BuilderExecutorValve(Context context,
                            MVCClassFinder classFinder,
                            MVCTemplateFinder templateFinder,
                            SecurityHelper securityHelper,
                            ViewEnclosureManager viewEnclosureManager,
                            int maxRouteCalls,
                            int maxEnclosures)
Component constructor.

Parameters:
context - used application context
classFinder - finder for builder objects
templateFinder - finder for template objects
securityHelper - security helper for access checking
viewEnclosureManager - the template based enclosure manager
maxRouteCalls - maxmimal number of Builder.route(String) calls per Builder
maxEnclosures - maxmimal number of Builder enclosures (also Builder.getEnclosingView(String) calls)
Method Detail

process

public void process(Context context)
             throws ProcessingException
Run view building starting from a view builder chosen in request parameters.

Specified by:
process in interface Valve
Parameters:
context - the thread's processing context.
Throws:
ProcessingException - if the processing fails.


Copyright © 2003-2006 objectledge.org. All Rights Reserved.