org.apache.cocoon.serialization
Class iTextSerializer
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.xml.AbstractXMLProducer
org.apache.cocoon.xml.AbstractXMLPipe
org.apache.cocoon.serialization.AbstractSerializer
org.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
Fields inherited from interface org.apache.cocoon.serialization.Serializer |
ROLE |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
iTextSerializer
public iTextSerializer()
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:
- It must be Serializable (part of the contract of this method).
- It must be Immutable--the key is used as a lookup value.
- It must be Unique within the space of the component (i.e. the key
"1" for MyCacheableComponent must be for the same resource every
time, but we don't have to worry about the key "1" for
YourCacheableComponent).
- The equals() and hashCode() methods must be consistent (i.e. if two
keys are equal, the hashCode must also be equal).
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.