org.apache.cocoon.generation
Class ServerPagesGenerator

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.xml.AbstractXMLProducer
              |
              +--org.apache.cocoon.generation.AbstractGenerator
                    |
                    +--org.apache.cocoon.generation.ComposerGenerator
                          |
                          +--org.apache.cocoon.generation.ServletGenerator
                                |
                                +--org.apache.cocoon.generation.ServerPagesGenerator
All Implemented Interfaces:
Cacheable, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Disposable, Generator, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, SitemapModelComponent, XMLProducer

public class ServerPagesGenerator
extends ServletGenerator
implements org.apache.avalon.framework.activity.Disposable, Cacheable, org.apache.avalon.framework.configuration.Configurable

This class acts as a proxy to a dynamically loadedGenerator delegating actual SAX event generation.

It has a single configuration item : <autocomplete-documents>true|false<autocomplete-documents> (default is false).

This tells the generator to automatically close all elements that weren't properly closed by the XSP, such as when a return statement is used to prematurely end processing. Activating this feature sensibly increases CPU-usage and should therefore be used only if really needed (it's better to have clean XSP pages that don't break abruptly generation flow).

Version:
CVS $Id: ServerPagesGenerator.java,v 1.13.2.2 2002/09/21 02:26:07 vgritsenko Exp $
Author:
Ricardo Rocha, Sylvain Wallez

Inner Class Summary
 class ServerPagesGenerator.CompletionPipe
           
 
Field Summary
static java.lang.String DEFAULT_MARKUP_LANGUAGE
          The default MarkupLanguage
static java.lang.String DEFAULT_PROGRAMMING_LANGUAGE
          The default ProgrammingLanguage
protected  AbstractServerPage generator
           
protected  java.lang.String markupLanguage
          The loaded generator's MarkupLanguage
protected  ProgramGenerator programGenerator
          The sitemap-defined server pages program generator
protected  java.lang.String programmingLanguage
          The loaded generator's ProgrammingLanguage
 
Fields inherited from class org.apache.cocoon.generation.ServletGenerator
context, request, response
 
Fields inherited from class org.apache.cocoon.generation.ComposerGenerator
manager
 
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.generation.Generator
ROLE
 
Constructor Summary
ServerPagesGenerator()
           
 
Method Summary
 void compose(org.apache.avalon.framework.component.ComponentManager manager)
          Set the global component manager.
 void configure(org.apache.avalon.framework.configuration.Configuration config)
           
 void dispose()
          dispose
 void generate()
          Generate XML data.
 long generateKey()
          Generates the unique key.
 CacheValidity generateValidity()
          Generate the validity object.
 void recycle()
          Recycle the generator by removing references
 void setup(SourceResolver resolver, java.util.Map objectModel, java.lang.String src, org.apache.avalon.framework.parameters.Parameters par)
          Set the SourceResolver, object model Map, the source and sitemap Parameters used to process the request.
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

programGenerator

protected ProgramGenerator programGenerator
The sitemap-defined server pages program generator

generator

protected AbstractServerPage generator

markupLanguage

protected java.lang.String markupLanguage
The loaded generator's MarkupLanguage

programmingLanguage

protected java.lang.String programmingLanguage
The loaded generator's ProgrammingLanguage

DEFAULT_MARKUP_LANGUAGE

public static final java.lang.String DEFAULT_MARKUP_LANGUAGE
The default MarkupLanguage

DEFAULT_PROGRAMMING_LANGUAGE

public static final java.lang.String DEFAULT_PROGRAMMING_LANGUAGE
The default ProgrammingLanguage
Constructor Detail

ServerPagesGenerator

public ServerPagesGenerator()
Method Detail

compose

public void compose(org.apache.avalon.framework.component.ComponentManager manager)
             throws org.apache.avalon.framework.component.ComponentException
Set the global component manager. This method sets the sitemap-defined program generator
Overrides:
compose in class ComposerGenerator
Parameters:
manager - The global component manager

configure

public void configure(org.apache.avalon.framework.configuration.Configuration config)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable

generateKey

public long generateKey()
Generates the unique key. This key must be unique inside the space of this component. Users may override this method to take advantage of SAX event cacheing
Specified by:
generateKey in interface Cacheable
Returns:
A long representing the cache key (defaults to not cachable)

generateValidity

public CacheValidity generateValidity()
Generate the validity object.
Specified by:
generateValidity in interface Cacheable
Returns:
The generated validity object or null if the component is currently not cachable.

setup

public void setup(SourceResolver resolver,
                  java.util.Map objectModel,
                  java.lang.String src,
                  org.apache.avalon.framework.parameters.Parameters par)
           throws ProcessingException,
                  org.xml.sax.SAXException,
                  java.io.IOException
Description copied from class: AbstractGenerator
Set the SourceResolver, object model Map, the source and sitemap Parameters used to process the request.
Overrides:
setup in class ServletGenerator

generate

public void generate()
              throws java.io.IOException,
                     org.xml.sax.SAXException,
                     ProcessingException
Generate XML data. This method loads a server pages generator associated with its (file) input source and delegates SAX event generator to it taking care of "closing" any event left open by the loaded generator as a result of its possible "premature" return (a common situation in server pages)
Throws:
java.io.IOException - IO Error
org.xml.sax.SAXException - SAX event generation error
ProcessingException - Error during load/execution

recycle

public void recycle()
Recycle the generator by removing references
Overrides:
recycle in class ServletGenerator

dispose

public void dispose()
dispose
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
Overrides:
dispose in class ComposerGenerator


Copyright � 1999-2002 Apache Software Foundation. All Rights Reserved.