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.xml.sax.ContentHandler, org.apache.avalon.framework.activity.Disposable, Generator, org.xml.sax.ext.LexicalHandler, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, SitemapModelComponent, XMLConsumer, XMLProducer

public class ServerPagesGenerator
extends ServletGenerator
implements org.apache.avalon.excalibur.pool.Recyclable, org.apache.avalon.framework.activity.Disposable, Cacheable, XMLConsumer

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

Version:
CVS $Revision: 1.7.2.10 $ $Date: 2001/10/10 09:25:14 $
Author:
Ricardo Rocha

Inner Class Summary
protected  class ServerPagesGenerator.EventData
           
 
Field Summary
protected static int CDATA
           
static java.lang.String DEFAULT_MARKUP_LANGUAGE
          The default MarkupLanguage
static java.lang.String DEFAULT_PROGRAMMING_LANGUAGE
          The default ProgrammingLanguage
protected static int DOCUMENT
           
protected static int DTD
           
protected static int ELEMENT
           
protected static int ENTITY
           
protected  java.util.LinkedList eventStack
          The SAX event stack.
protected  XSPGenerator generator
           
protected  java.lang.String markupLanguage
          The loaded generator's MarkupLanguage
protected static int PREFIX_MAPPING
           
protected static 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 characters(char[] ch, int start, int length)
          Receive notification of character data.
 void comment(char[] ch, int start, int length)
           
 void compose(org.apache.avalon.framework.component.ComponentManager manager)
          Set the global component manager.
 void dispose()
          dispose
 void endCDATA()
           
 void endDocument()
          Receive notification of the end of a document.
 void endDTD()
           
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String rawName)
          Receive notification of the end of an element.
 void endEntity(java.lang.String name)
           
 void endPrefixMapping(java.lang.String prefix)
          End the scope of a prefix-URI mapping.
 void generate()
          Generate XML data.
 long generateKey()
          Generates the unique key.
 CacheValidity generateValidity()
          Generate the validity object.
 void ignorableWhitespace(char[] ch, int start, int length)
          Receive notification of ignorable whitespace in element content.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Receive notification of a processing instruction.
 void recycle()
          Recycle the generator by removing references
 void setDocumentLocator(org.xml.sax.Locator locator)
          Receive an object for locating the origin of SAX document events.
 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.
 void skippedEntity(java.lang.String name)
          Receive notification of a skipped entity.
 void startCDATA()
           
 void startDocument()
          Receive notification of the beginning of a document.
 void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
           
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String rawName, org.xml.sax.Attributes atts)
          Receive notification of the beginning of an element.
 void startEntity(java.lang.String name)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
          Begin the scope of a prefix-URI Namespace mapping.
 
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 static ProgramGenerator programGenerator
The sitemap-defined server pages program generator

generator

protected XSPGenerator 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

eventStack

protected java.util.LinkedList eventStack
The SAX event stack. Used for "completing" pendind SAX events left "open" by prematurely returning server pages generators

DOCUMENT

protected static final int DOCUMENT

ELEMENT

protected static final int ELEMENT

PREFIX_MAPPING

protected static final int PREFIX_MAPPING

CDATA

protected static final int CDATA

DTD

protected static final int DTD

ENTITY

protected static final int ENTITY
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

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

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Receive notification of character data.
Specified by:
characters in interface org.xml.sax.ContentHandler

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Receive notification of the end of a document.
Specified by:
endDocument in interface org.xml.sax.ContentHandler

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String rawName)
                throws org.xml.sax.SAXException
Receive notification of the end of an element.
Specified by:
endElement in interface org.xml.sax.ContentHandler

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
End the scope of a prefix-URI mapping.
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws org.xml.sax.SAXException
Receive notification of ignorable whitespace in element content.
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Receive notification of a processing instruction.
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Receive an object for locating the origin of SAX document events.
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws org.xml.sax.SAXException
Receive notification of a skipped entity.
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Receive notification of the beginning of a document.
Specified by:
startDocument in interface org.xml.sax.ContentHandler

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String rawName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Receive notification of the beginning of an element.
Specified by:
startElement in interface org.xml.sax.ContentHandler

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Begin the scope of a prefix-URI Namespace mapping.
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws org.xml.sax.SAXException
Specified by:
comment in interface org.xml.sax.ext.LexicalHandler

endCDATA

public void endCDATA()
              throws org.xml.sax.SAXException
Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler

endDTD

public void endDTD()
            throws org.xml.sax.SAXException
Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler

endEntity

public void endEntity(java.lang.String name)
               throws org.xml.sax.SAXException
Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler

startCDATA

public void startCDATA()
                throws org.xml.sax.SAXException
Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler

startDTD

public void startDTD(java.lang.String name,
                     java.lang.String publicId,
                     java.lang.String systemId)
              throws org.xml.sax.SAXException
Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler

startEntity

public void startEntity(java.lang.String name)
                 throws org.xml.sax.SAXException
Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler

recycle

public void recycle()
Recycle the generator by removing references
Specified by:
recycle in interface org.apache.avalon.excalibur.pool.Recyclable
Overrides:
recycle in class ServletGenerator

dispose

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


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.