org.apache.cocoon.sitemap
Class ContentAggregator

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.xml.AbstractXMLConsumer
              |
              +--org.apache.cocoon.xml.ContentHandlerWrapper
                    |
                    +--org.apache.cocoon.sitemap.ContentAggregator
All Implemented Interfaces:
Cacheable, org.apache.avalon.framework.component.Component, org.xml.sax.ContentHandler, 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 ContentAggregator
extends ContentHandlerWrapper
implements Generator, Cacheable, org.apache.avalon.excalibur.pool.Recyclable

Version:
CVS $Id: ContentAggregator.java,v 1.5.2.16 2001/11/09 12:20:45 cziegeler Exp $
Author:
Giacomo Pati, Carsten Ziegeler

Field Summary
protected  java.util.Map objectModel
          The current Map objectModel.
protected  org.apache.avalon.framework.parameters.Parameters parameters
          The current Parameters.
protected  java.util.ArrayList parts
          the parts
protected  SourceResolver resolver
          The current SourceResolver.
protected  java.lang.String rootElement
          the root element of the aggregated content
protected  java.lang.String rootElementNS
          the namespace of the root element
protected  java.lang.String rootElementNSPrefix
          the namespace prefix of the root element
protected  java.lang.String source
          The source URI associated with the request or null.
 
Fields inherited from class org.apache.cocoon.xml.ContentHandlerWrapper
contentHandler, lexicalHandler
 
Fields inherited from interface org.apache.cocoon.generation.Generator
ROLE
 
Constructor Summary
ContentAggregator()
           
 
Method Summary
 void addPart(java.lang.String uri, java.lang.String element, java.lang.String namespace, java.lang.String stripRootElement, java.lang.String prefix)
           
 void endDocument()
          Receive notification of the end of a document.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Receive notification of the end of an element.
 void generate()
          generates the content
 long generateKey()
          Generate the unique key.
 CacheValidity generateValidity()
          Generate the validity object.
 void recycle()
          Recycle the producer by removing references
 void setConsumer(XMLConsumer consumer)
          Set the XMLConsumer that will receive XML data.
 void setRootElement(java.lang.String element, java.lang.String namespace, java.lang.String prefix)
           
 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 startDocument()
          Ignore start and end document events
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          Receive notification of the beginning of an element.
 
Methods inherited from class org.apache.cocoon.xml.ContentHandlerWrapper
characters, comment, endCDATA, endDTD, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setContentHandler, setDocumentLocator, setLexicalHandler, skippedEntity, startCDATA, startDTD, startEntity, startPrefixMapping
 
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
 

Field Detail

rootElement

protected java.lang.String rootElement
the root element of the aggregated content

rootElementNS

protected java.lang.String rootElementNS
the namespace of the root element

rootElementNSPrefix

protected java.lang.String rootElementNSPrefix
the namespace prefix of the root element

parts

protected java.util.ArrayList parts
the parts

resolver

protected SourceResolver resolver
The current SourceResolver.

objectModel

protected java.util.Map objectModel
The current Map objectModel.

parameters

protected org.apache.avalon.framework.parameters.Parameters parameters
The current Parameters.

source

protected java.lang.String source
The source URI associated with the request or null.
Constructor Detail

ContentAggregator

public ContentAggregator()
Method Detail

generate

public void generate()
              throws java.io.IOException,
                     org.xml.sax.SAXException,
                     ProcessingException
generates the content
Specified by:
generate in interface Generator

generateKey

public long generateKey()
Generate the unique key. This key must be unique inside the space of this component.
Specified by:
generateKey in interface Cacheable
Returns:
The generated key hashes the src

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 cacheable.

setRootElement

public void setRootElement(java.lang.String element,
                           java.lang.String namespace,
                           java.lang.String prefix)

addPart

public void addPart(java.lang.String uri,
                    java.lang.String element,
                    java.lang.String namespace,
                    java.lang.String stripRootElement,
                    java.lang.String prefix)

setConsumer

public void setConsumer(XMLConsumer consumer)
Set the XMLConsumer that will receive XML data.
This method will simply call setContentHandler(consumer) and setLexicalHandler(consumer).
Specified by:
setConsumer in interface XMLProducer

recycle

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

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
Set the SourceResolver, object model Map, the source and sitemap Parameters used to process the request.
Specified by:
setup in interface SitemapModelComponent

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Ignore start and end document events
Overrides:
startDocument in class ContentHandlerWrapper

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Description copied from class: ContentHandlerWrapper
Receive notification of the end of a document.
Overrides:
endDocument in class ContentHandlerWrapper

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Description copied from class: ContentHandlerWrapper
Receive notification of the beginning of an element.
Overrides:
startElement in class ContentHandlerWrapper
Following copied from class: org.apache.cocoon.xml.AbstractXMLConsumer
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
loc - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
a - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Description copied from class: ContentHandlerWrapper
Receive notification of the end of an element.
Overrides:
endElement in class ContentHandlerWrapper
Following copied from class: org.apache.cocoon.xml.AbstractXMLConsumer
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
loc - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.


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