org.apache.cocoon.samples
Class EventAwareGenerator
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.xml.AbstractXMLProducer
org.apache.cocoon.generation.AbstractGenerator
org.apache.cocoon.generation.ServiceableGenerator
org.apache.cocoon.template.JXTemplateGenerator
org.apache.cocoon.samples.EventAwareGenerator
- All Implemented Interfaces:
- Poolable, Recyclable, Disposable, Component, LogEnabled, Serviceable, CacheableProcessingComponent, Generator, SitemapModelComponent, XMLProducer
public class EventAwareGenerator
- extends JXTemplateGenerator
This is a sample generator to demonstrate the event aware caching.
We simply extend the JXTG.
- Version:
- $Id: EventAwareGenerator.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Fields inherited from interface org.apache.cocoon.generation.Generator |
ROLE |
Method Summary |
void |
generate()
Generate the XML and stream it into the pipeline |
Serializable |
getKey()
Generate the unique key for the cache. |
SourceValidity |
getValidity()
Generate the validity object, tells the cache how long to
keep contents having this key around. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EventAwareGenerator
public EventAwareGenerator()
getKey
public Serializable getKey()
- Generate the unique key for the cache.
This key must be unique inside the space of this XSP page, it is used
to find the page contents in the cache (if getValidity says that the
contents are still valid).
This method will be invoked before the getValidity() method.
- Specified by:
getKey
in interface CacheableProcessingComponent
- Overrides:
getKey
in class JXTemplateGenerator
- Returns:
- The generated key or null if the component
is currently not cacheable.
- See Also:
CacheableProcessingComponent.getKey()
getValidity
public SourceValidity getValidity()
- Generate the validity object, tells the cache how long to
keep contents having this key around. In this case, it will
be until an Event is retrieved matching the NamedEvent created below.
Before this method can be invoked the getKey() method
will be invoked.
- Specified by:
getValidity
in interface CacheableProcessingComponent
- Overrides:
getValidity
in class JXTemplateGenerator
- Returns:
- The generated validity object or null if the
component is currently not cacheable.
- See Also:
CacheableProcessingComponent.getValidity()
generate
public void generate()
throws IOException,
SAXException,
ProcessingException
- Description copied from interface:
Generator
- Generate the XML and stream it into the pipeline
- Specified by:
generate
in interface Generator
- Overrides:
generate
in class JXTemplateGenerator
- Throws:
IOException
SAXException
ProcessingException
- See Also:
Generator.generate()
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.