org.apache.cocoon.transformation
Class CachingCIncludeTransformer

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by org.apache.cocoon.transformation.AbstractTransformer
                  extended by org.apache.cocoon.transformation.CachingCIncludeTransformer
All Implemented Interfaces:
Poolable, Recyclable, Component, Composable, LogEnabled, Cacheable, SitemapModelComponent, Transformer, XMLPipe, XMLProducer, XMLConsumer, ContentHandler, LexicalHandler

Deprecated. This transformer violates the avalon/cocoon design principles. Use IncludeTransformer.

public class CachingCIncludeTransformer
extends AbstractTransformer
implements Composable, Cacheable

This transformer triggers for the element include in the namespace "http://apache.org/cocoon/include/1.0". The src attribute contains the url which points to an xml resource which is include instead of the element. With the attributes element, ns and prefix it is possible to specify an element which surrounds the included content.

Validity of cached pipelines is calculated not by comparing old and new IncludeCacheValidity objects (as in AggregatedCacheValidity) but by comparing timestamps. Validity object of cached pipeline contain two lists: source urls and timestamps. When it comes to checking validity of cached pipeline we know that generation/transformation steps before CIncludeTransformer are valid (otherwise we would have had discarded cached pipeline already) so source url list of new validity will be the same as of old one. Only timestamps have to be recalculated and compared.

Version:
$Id: CachingCIncludeTransformer.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Maciek Kaminski
See Also:
(scratchpad)

Field Summary
static String CINCLUDE_INCLUDE_ELEMENT
          Deprecated.  
static String CINCLUDE_INCLUDE_ELEMENT_ELEMENT_ATTRIBUTE
          Deprecated.  
static String CINCLUDE_INCLUDE_ELEMENT_NS_ATTRIBUTE
          Deprecated.  
static String CINCLUDE_INCLUDE_ELEMENT_PREFIX_ATTRIBUTE
          Deprecated.  
static String CINCLUDE_INCLUDE_ELEMENT_SRC_ATTRIBUTE
          Deprecated.  
static String CINCLUDE_NAMESPACE_URI
          Deprecated.  
protected  IncludeXMLConsumer consumer
          Deprecated. The current IncludeXMLConsumer that ommits start and endDocument events.
protected  IncludeCacheValidity currentCacheValidity
          Deprecated. The current IncludeCacheValidity.
protected  ComponentManager manager
          Deprecated. The current ComponentManager.
protected  SourceResolver sourceResolver
          Deprecated. The SourceResolver
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
CachingCIncludeTransformer()
          Deprecated.  
 
Method Summary
 void compose(ComponentManager manager)
          Deprecated. Composable Interface
 void endDocument()
          Deprecated. Receive notification of the end of a document.
 void endElement(String uri, String name, String raw)
          Deprecated. Receive notification of the end of an element.
 long generateKey()
          Deprecated. Generate the unique key.
 CacheValidity generateValidity()
          Deprecated. Generate the validity object.
protected  IncludeXMLConsumer getConsumer()
          Deprecated.  
protected  void processCIncludeElement(String src, String element, String ns, String prefix)
          Deprecated.  
 void recycle()
          Deprecated. Recycle the component
 void setup(SourceResolver resolver, Map objectModel, String source, Parameters parameters)
          Deprecated. Setup the component.
 void startElement(String uri, String name, String raw, Attributes attr)
          Deprecated. Receive notification of the beginning of an element.
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
characters, comment, endCDATA, endDTD, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, 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, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, 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
 

Field Detail

CINCLUDE_NAMESPACE_URI

public static final String CINCLUDE_NAMESPACE_URI
Deprecated. 
See Also:
Constant Field Values

CINCLUDE_INCLUDE_ELEMENT

public static final String CINCLUDE_INCLUDE_ELEMENT
Deprecated. 
See Also:
Constant Field Values

CINCLUDE_INCLUDE_ELEMENT_SRC_ATTRIBUTE

public static final String CINCLUDE_INCLUDE_ELEMENT_SRC_ATTRIBUTE
Deprecated. 
See Also:
Constant Field Values

CINCLUDE_INCLUDE_ELEMENT_ELEMENT_ATTRIBUTE

public static final String CINCLUDE_INCLUDE_ELEMENT_ELEMENT_ATTRIBUTE
Deprecated. 
See Also:
Constant Field Values

CINCLUDE_INCLUDE_ELEMENT_NS_ATTRIBUTE

public static final String CINCLUDE_INCLUDE_ELEMENT_NS_ATTRIBUTE
Deprecated. 
See Also:
Constant Field Values

CINCLUDE_INCLUDE_ELEMENT_PREFIX_ATTRIBUTE

public static final String CINCLUDE_INCLUDE_ELEMENT_PREFIX_ATTRIBUTE
Deprecated. 
See Also:
Constant Field Values

sourceResolver

protected SourceResolver sourceResolver
Deprecated. 
The SourceResolver


manager

protected ComponentManager manager
Deprecated. 
The current ComponentManager.


currentCacheValidity

protected IncludeCacheValidity currentCacheValidity
Deprecated. 
The current IncludeCacheValidity.


consumer

protected IncludeXMLConsumer consumer
Deprecated. 
The current IncludeXMLConsumer that ommits start and endDocument events.

Constructor Detail

CachingCIncludeTransformer

public CachingCIncludeTransformer()
Deprecated. 
Method Detail

setup

public void setup(SourceResolver resolver,
                  Map objectModel,
                  String source,
                  Parameters parameters)
           throws ProcessingException,
                  SAXException,
                  IOException
Deprecated. 
Setup the component.

Specified by:
setup in interface SitemapModelComponent
Throws:
ProcessingException
SAXException
IOException

compose

public final void compose(ComponentManager manager)
                   throws ComponentException
Deprecated. 
Composable Interface

Specified by:
compose in interface Composable
Throws:
ComponentException

recycle

public void recycle()
Deprecated. 
Recycle the component

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class AbstractXMLProducer

startElement

public void startElement(String uri,
                         String name,
                         String raw,
                         Attributes attr)
                  throws SAXException
Deprecated. 
Description copied from class: AbstractXMLPipe
Receive notification of the beginning of an element.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class AbstractXMLPipe
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
name - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
attr - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
SAXException

endElement

public void endElement(String uri,
                       String name,
                       String raw)
                throws SAXException
Deprecated. 
Description copied from class: AbstractXMLPipe
Receive notification of the end of an element.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class AbstractXMLPipe
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
name - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Deprecated. 
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

processCIncludeElement

protected void processCIncludeElement(String src,
                                      String element,
                                      String ns,
                                      String prefix)
                               throws SAXException
Deprecated. 
Throws:
SAXException

generateKey

public long generateKey()
Deprecated. 
Generate the unique key. This key must be unique inside the space of this component. CachingCIncludeTransformer always generates the same key since which documents are included depends only on former generation/transformation stages.

Specified by:
generateKey in interface Cacheable
Returns:
The generated key hashes the src

generateValidity

public CacheValidity generateValidity()
Deprecated. 
Generate the validity object. CachingCIncludeTransformer generates "empty" IncludeCacheValidity and completes it with validity data during transformation. See processCIncludeElement method.

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

getConsumer

protected IncludeXMLConsumer getConsumer()
Deprecated. 


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