org.apache.cocoon.generation
Class AbstractServerPage

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.generation.AbstractGenerator
              extended by org.apache.cocoon.generation.ComposerGenerator
                  extended by org.apache.cocoon.generation.ServletGenerator
                      extended by org.apache.cocoon.generation.AbstractServerPage
All Implemented Interfaces:
Poolable, Recyclable, Disposable, Component, Composable, Recomposable, LogEnabled, Cacheable, CacheableProcessingComponent, CompiledComponent, Generator, Modifiable, SitemapModelComponent, XMLProducer
Direct Known Subclasses:
XSPGenerator

public abstract class AbstractServerPage
extends ServletGenerator
implements CompiledComponent, CacheableProcessingComponent, Cacheable, Recomposable

Base implementation of ServerPagesGenerator. This class declares variables that must be explicitly initialized by code generators.

Version:
CVS $Id: AbstractServerPage.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Ricardo Rocha

Field Summary
protected  long dateCreated
          The creation date
protected  File[] dependencies
          The dependency file list
 
Fields inherited from class org.apache.cocoon.generation.ServletGenerator
context, request, response
 
Fields inherited from class org.apache.cocoon.generation.ComposerGenerator
manager
 
Fields inherited from class org.apache.cocoon.generation.AbstractGenerator
objectModel, parameters, resolver, source
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.generation.Generator
ROLE
 
Constructor Summary
AbstractServerPage()
           
 
Method Summary
protected  void attribute(AttributesImpl attr, String name, String value)
          Add an attribute
protected  void characters(String data)
          Add character data
protected  void comment(String data)
          Add a comment
protected  void end(String name)
          End an element
 long generateKey()
          Generates the unique key.
 CacheValidity generateValidity()
          Generate the validity object.
 Serializable getKey()
          Generate the unique key.
 SourceValidity getValidity()
          Generate the validity object.
 boolean hasContentChanged(Request request)
          Determines whether generated content has changed since last invocation.
 boolean modifiedSince(long date)
          Determines whether this generator's source files have changed
 void recompose(ComponentManager manager)
          Recompose with the actual ComponentManager that should be used.
protected  void start(String name, AttributesImpl attr)
          Start an element
 
Methods inherited from class org.apache.cocoon.generation.ServletGenerator
recycle, setup
 
Methods inherited from class org.apache.cocoon.generation.ComposerGenerator
compose, dispose
 
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.apache.avalon.framework.component.Composable
compose
 
Methods inherited from interface org.apache.cocoon.generation.Generator
generate
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

dateCreated

protected long dateCreated
The creation date


dependencies

protected File[] dependencies
The dependency file list

Constructor Detail

AbstractServerPage

public AbstractServerPage()
Method Detail

recompose

public void recompose(ComponentManager manager)
               throws ComponentException
Recompose with the actual ComponentManager that should be used.

Specified by:
recompose in interface Recomposable
Throws:
ComponentException

modifiedSince

public boolean modifiedSince(long date)
Determines whether this generator's source files have changed

Specified by:
modifiedSince in interface Modifiable
Returns:
Whether any of the files this generator depends on has changed since it was created

hasContentChanged

public boolean hasContentChanged(Request request)
Determines whether generated content has changed since last invocation. Users may override this method to take advantage of SAX event cacheing

Parameters:
request - The request whose data must be inspected to assert whether dynamically generated content has changed
Returns:
Whether content has changes for this request's data

getKey

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

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

getValidity

public SourceValidity getValidity()
Generate the validity object. Before this method can be invoked the generateKey() method must be invoked.

Specified by:
getValidity in interface CacheableProcessingComponent
Returns:
The generated validity object, NOPCacheValidity is the default if hasContentChange() gives false otherwise null will be returned.

attribute

protected void attribute(AttributesImpl attr,
                         String name,
                         String value)
Add an attribute

Parameters:
attr - The attribute list to add to
name - The attribute name
value - The attribute value

start

protected void start(String name,
                     AttributesImpl attr)
              throws SAXException
Start an element

Parameters:
name - The element name
attr - The element attributes
Throws:
SAXException

end

protected void end(String name)
            throws SAXException
End an element

Parameters:
name - The element name
Throws:
SAXException

characters

protected void characters(String data)
                   throws SAXException
Add character data

Parameters:
data - The character data
Throws:
SAXException

comment

protected void comment(String data)
                throws SAXException
Add a comment

Parameters:
data - The comment data
Throws:
SAXException

generateKey

public long generateKey()
Generates the unique key. This key must be unique inside the space of this component. Users may override this method to take advantage of SAX event cacheing

Specified by:
generateKey in interface Cacheable
Returns:
A long representing the cache key (defaults to not cachable)

generateValidity

public CacheValidity generateValidity()
Generate the validity object.

Specified by:
generateValidity in interface Cacheable
Returns:
The generated validity object, NOPCacheValidity is the default if hasContentChange() gives false otherwise null will be returned.


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