org.apache.cocoon.serialization
Class iTextSerializer

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byorg.apache.cocoon.serialization.AbstractSerializer
                  extended byorg.apache.cocoon.serialization.iTextSerializer
All Implemented Interfaces:
CacheableProcessingComponent, Configurable, ContentHandler, LexicalHandler, LogEnabled, Poolable, Recyclable, Serializer, SitemapOutputComponent, XMLConsumer, XMLConsumer, XMLPipe, XMLProducer

public final class iTextSerializer
extends AbstractSerializer
implements Configurable, CacheableProcessingComponent

Version:
CVS $Id: iTextSerializer.java 30941 2004-07-29 19:56:58Z vgritsenko $
Author:
Torsten Curdt

Field Summary
 
Fields inherited from class org.apache.cocoon.serialization.AbstractSerializer
output
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.serialization.Serializer
ROLE
 
Constructor Summary
iTextSerializer()
           
 
Method Summary
 void configure(Configuration conf)
           
 void endDocument()
          Receive notification of the end of a document.
 Serializable getKey()
          Generate the unique key for the resource being rendered.
 String getMimeType()
          Get the mime-type of the output of this Serializer This default implementation returns null to indicate that the mime-type specified in the sitemap is to be used
 SourceValidity getValidity()
          Generate the validity object.
 void setOutputStream(OutputStream out)
          Set the OutputStream where the requested resource should be serialized.
 boolean shouldSetContentLength()
          Test if the component wants to set the content length
 void startDocument()
          Receive notification of the beginning of a document.
 
Methods inherited from class org.apache.cocoon.serialization.AbstractSerializer
recycle
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
characters, comment, endCDATA, endDTD, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDTD, startElement, startEntity, startPrefixMapping
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, 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.xml.sax.ContentHandler
characters, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startElement, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Constructor Detail

iTextSerializer

public iTextSerializer()
Method Detail

configure

public void configure(Configuration conf)
               throws ConfigurationException
Specified by:
configure in interface Configurable
Throws:
ConfigurationException

getMimeType

public String getMimeType()
Description copied from class: AbstractSerializer
Get the mime-type of the output of this Serializer This default implementation returns null to indicate that the mime-type specified in the sitemap is to be used

Specified by:
getMimeType in interface SitemapOutputComponent
Overrides:
getMimeType in class AbstractSerializer

startDocument

public void startDocument()
                   throws SAXException
Description copied from class: AbstractXMLPipe
Receive notification of the beginning of a document.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class AbstractXMLPipe
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Description copied from class: AbstractXMLPipe
Receive notification of the end of a document.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class AbstractXMLPipe
Throws:
SAXException

setOutputStream

public void setOutputStream(OutputStream out)
Description copied from class: AbstractSerializer
Set the OutputStream where the requested resource should be serialized.

Specified by:
setOutputStream in interface SitemapOutputComponent
Overrides:
setOutputStream in class AbstractSerializer

getKey

public Serializable getKey()
Description copied from interface: CacheableProcessingComponent
Generate the unique key for the resource being rendered.

The cache key is the single most important part of the caching implementation. If you don't get it right, you can introduce more load on the caching engine than is necessary. It is important that the cache key has the following attributes:

Thankfully there is a perfectly suitable object that satisfies these obligations from Java's core: java.lang.String. You can also use your own specific key objects provided they respect the above contracts.

Important:If the cache key is null then your component will not be cached at all. You can use this to your advantage to cache some things but not others.

Specified by:
getKey in interface CacheableProcessingComponent
Returns:
The generated key or null if the component is currently not cacheable.

getValidity

public SourceValidity getValidity()
Description copied from interface: CacheableProcessingComponent
Generate the validity object. This method is invoked after the getKey() method.

The caching contracts use the Excalibur SourceValidity interface to determine whether a resource is valid or not. The validity can be a compound check that incorporates time since creation, parameter values, etc. As long as the sitemap can determine whether the cached resource is valid or not. More information is available on the Apache Excalibur site. Alternatively you can use the built in CacheValidity objects in the org.apache.cocoon.caching package and then use the CacheValidityToSourceValidity adaptor object.

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

shouldSetContentLength

public boolean shouldSetContentLength()
Description copied from class: AbstractSerializer
Test if the component wants to set the content length

Specified by:
shouldSetContentLength in interface SitemapOutputComponent
Overrides:
shouldSetContentLength in class AbstractSerializer


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.