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.4 2002/02/22 07:03:55 cziegeler Exp $
Author:
Giacomo Pati, Carsten Ziegeler

Inner Class Summary
protected  class ContentAggregator.Element
          This object holds an element definition
protected  class ContentAggregator.Part
          This object holds the part parts :)
 
Field Summary
protected  ContentAggregator.Element currentElement
          The element used for the current part
protected  java.util.ArrayList parts
          the parts
protected  ContentAggregator.Element rootElement
          the root element of the aggregated content
 
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)
          Add a part.
 void endDocument()
          Ignore start and end document events
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String raw)
          Override startElement() event to add namespace and prefix
 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)
          Set the root element.
 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 raw, org.xml.sax.Attributes atts)
          Override startElement() event to add namespace and prefix
 
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 ContentAggregator.Element rootElement
the root element of the aggregated content

parts

protected java.util.ArrayList parts
the parts

currentElement

protected ContentAggregator.Element currentElement
The element used for the current part
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)
Set the root element. Please make sure that the parameters are not null!

addPart

public void addPart(java.lang.String uri,
                    java.lang.String element,
                    java.lang.String namespace,
                    java.lang.String stripRootElement,
                    java.lang.String prefix)
Add a part. Please make sure that the parameters are not null!

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
Ignore start and end document events
Overrides:
endDocument in class ContentHandlerWrapper

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String raw,
                         org.xml.sax.Attributes atts)
                  throws org.xml.sax.SAXException
Override startElement() event to add namespace and prefix
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 raw)
                throws org.xml.sax.SAXException
Override startElement() event to add namespace and prefix
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-2002 Apache Software Foundation. All Rights Reserved.