org.apache.cocoon.sitemap
Class DefaultContentAggregator

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLConsumer
          extended byorg.apache.cocoon.xml.ContentHandlerWrapper
              extended byorg.apache.cocoon.sitemap.DefaultContentAggregator
All Implemented Interfaces:
org.apache.cocoon.caching.CacheableProcessingComponent, org.apache.cocoon.sitemap.ContentAggregator, ContentHandler, org.apache.cocoon.generation.Generator, LexicalHandler, Poolable, Recyclable, Serviceable, org.apache.cocoon.sitemap.SitemapModelComponent, XMLConsumer, org.apache.cocoon.xml.XMLConsumer, org.apache.cocoon.xml.XMLProducer

public class DefaultContentAggregator
extends org.apache.cocoon.xml.ContentHandlerWrapper
implements org.apache.cocoon.generation.Generator, org.apache.cocoon.caching.CacheableProcessingComponent, Serviceable, org.apache.cocoon.sitemap.ContentAggregator

This generator implements the sitemap content aggregation. It combines several parts into one big XML document which is streamed into the pipeline.

Version:
$Id: DefaultContentAggregator.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Nested Class Summary
protected  class DefaultContentAggregator.Element
          This object holds an element definition
protected  class DefaultContentAggregator.Part
          This object holds the part parts :)
 
Field Summary
protected  DefaultContentAggregator.Element currentElement
          The element used for the current part
protected  ServiceManager manager
          The service manager
protected  ArrayList parts
          The aggregated parts
protected  org.apache.cocoon.environment.SourceResolver resolver
          The SourceResolver
protected  DefaultContentAggregator.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
DefaultContentAggregator()
           
 
Method Summary
 void addPart(String uri, String element, String namespace, String stripRootElement, String prefix)
          Add a part.
 void endDocument()
          Ignore start and end document events
 void endElement(String namespaceURI, String localName, String raw)
          Override startElement() event to add namespace and prefix
 void generate()
          Generates the content
 Serializable getKey()
          Generate the unique key.
 SourceValidity getValidity()
          Generate the validity object.
 void recycle()
          Recycle the producer by removing references
 void service(ServiceManager manager)
           
 void setConsumer(org.apache.cocoon.xml.XMLConsumer consumer)
          Set the XMLConsumer that will receive XML data.
 void setRootElement(String element, String namespace, String prefix)
          Set the root element.
 void setup(org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String src, 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(String namespaceURI, String localName, String raw, 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.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootElement

protected DefaultContentAggregator.Element rootElement
The root element of the aggregated content


parts

protected ArrayList parts
The aggregated parts


currentElement

protected DefaultContentAggregator.Element currentElement
The element used for the current part


resolver

protected org.apache.cocoon.environment.SourceResolver resolver
The SourceResolver


manager

protected ServiceManager manager
The service manager

Constructor Detail

DefaultContentAggregator

public DefaultContentAggregator()
Method Detail

generate

public void generate()
              throws IOException,
                     SAXException,
                     org.apache.cocoon.ProcessingException
Generates the content

Specified by:
generate in interface org.apache.cocoon.generation.Generator
Throws:
IOException
SAXException
org.apache.cocoon.ProcessingException

getKey

public Serializable getKey()
Generate the unique key. This key must be unique inside the space of this component.

Specified by:
getKey in interface org.apache.cocoon.caching.CacheableProcessingComponent
Returns:
The generated key hashes the src

getValidity

public SourceValidity getValidity()
Generate the validity object.

Specified by:
getValidity in interface org.apache.cocoon.caching.CacheableProcessingComponent
Returns:
The generated validity object or null if the component is currently not cacheable.

setRootElement

public void setRootElement(String element,
                           String namespace,
                           String prefix)
Set the root element. Please make sure that the parameters are not null!

Specified by:
setRootElement in interface org.apache.cocoon.sitemap.ContentAggregator

addPart

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

Specified by:
addPart in interface org.apache.cocoon.sitemap.ContentAggregator

setConsumer

public void setConsumer(org.apache.cocoon.xml.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 org.apache.cocoon.xml.XMLProducer

recycle

public void recycle()
Recycle the producer by removing references

Specified by:
recycle in interface Recyclable

setup

public void setup(org.apache.cocoon.environment.SourceResolver resolver,
                  Map objectModel,
                  String src,
                  Parameters par)
           throws org.apache.cocoon.ProcessingException,
                  SAXException,
                  IOException
Set the SourceResolver, object model Map, the source and sitemap Parameters used to process the request.

Specified by:
setup in interface org.apache.cocoon.sitemap.SitemapModelComponent
Throws:
org.apache.cocoon.ProcessingException
SAXException
IOException

startDocument

public void startDocument()
                   throws SAXException
Ignore start and end document events

Specified by:
startDocument in interface ContentHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Ignore start and end document events

Specified by:
endDocument in interface ContentHandler
Throws:
SAXException

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String raw,
                         Attributes atts)
                  throws SAXException
Override startElement() event to add namespace and prefix

Specified by:
startElement in interface ContentHandler
Throws:
SAXException

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String raw)
                throws SAXException
Override startElement() event to add namespace and prefix

Specified by:
endElement in interface ContentHandler
Throws:
SAXException

service

public void service(ServiceManager manager)
             throws ServiceException
Specified by:
service in interface Serviceable
Throws:
ServiceException


Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.