org.apache.cocoon.components.pipeline
Class CachingEventPipeline

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.xml.AbstractXMLProducer
              |
              +--org.apache.cocoon.components.pipeline.AbstractEventPipeline
                    |
                    +--org.apache.cocoon.components.pipeline.CachingEventPipeline
All Implemented Interfaces:
CacheableEventPipeline, org.apache.avalon.framework.component.Component, org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.activity.Disposable, EventPipeline, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.framework.component.Recomposable, org.apache.avalon.excalibur.pool.Recyclable, XMLProducer
Direct Known Subclasses:
ProfilingCachingEventPipeline

public class CachingEventPipeline
extends AbstractEventPipeline
implements org.apache.avalon.framework.activity.Disposable, CacheableEventPipeline, org.apache.avalon.excalibur.pool.Recyclable

The CachingEventPipeline If all components of this event pipeline are cacheable then the whole pipeline is also cacheable. If in this case the CacheableEventPipeline interface is invoked (e.g. by the CachingStreamPipeline) the CachingEventPipeline does not cache! (If it would cache, the response would be cached twice!)

Version:
CVS $Id: CachingEventPipeline.java,v 1.9 2002/04/06 17:57:54 vgritsenko Exp $
Author:
Carsten Ziegeler

Fields inherited from class org.apache.cocoon.components.pipeline.AbstractEventPipeline
configuredSAXConnector, connectors, generator, generatorParam, generatorSelector, generatorSource, manager, newManager, transformerParams, transformers, transformerSelectors, transformerSources
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.components.pipeline.EventPipeline
ROLE
 
Constructor Summary
CachingEventPipeline()
           
 
Method Summary
 void addTransformer(java.lang.String role, java.lang.String source, org.apache.avalon.framework.parameters.Parameters param)
          Add a transformer.
 void compose(org.apache.avalon.framework.component.ComponentManager manager)
           
 void dispose()
           
 PipelineCacheKey generateKey(Environment environment)
          Generate the unique key.
 java.util.Map generateValidity(Environment environment)
          Generate the validity object.
 boolean process(Environment environment)
          Process the given Environment, producing the output.
 void recycle()
          Recycle the producer by removing references
 void setGenerator(java.lang.String role, java.lang.String source, org.apache.avalon.framework.parameters.Parameters param)
          Set the generator.
 void setStreamPipelineCaches(boolean flag)
          The stream pipeline (or the content aggregator) calls this method to tell the event pipeline if it must not cache the result
 
Methods inherited from class org.apache.cocoon.components.pipeline.AbstractEventPipeline
checkPipeline, connectPipeline, getGenerator, recompose, setGenerator, setupPipeline
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, 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.cocoon.xml.XMLProducer
setConsumer
 

Constructor Detail

CachingEventPipeline

public CachingEventPipeline()
Method Detail

compose

public void compose(org.apache.avalon.framework.component.ComponentManager manager)
             throws org.apache.avalon.framework.component.ComponentException
Overrides:
compose in class AbstractEventPipeline

setGenerator

public void setGenerator(java.lang.String role,
                         java.lang.String source,
                         org.apache.avalon.framework.parameters.Parameters param)
                  throws java.lang.Exception
Set the generator.
Overrides:
setGenerator in class AbstractEventPipeline
Following copied from interface: org.apache.cocoon.components.pipeline.EventPipeline
Parameters:
role - the generator role in the component manager.
source - the source where to produce XML from, or null if no source is given.
param - the parameters for the generator.
Throws:
java.lang.Exception - if the generator couldn't be obtained.

addTransformer

public void addTransformer(java.lang.String role,
                           java.lang.String source,
                           org.apache.avalon.framework.parameters.Parameters param)
                    throws java.lang.Exception
Add a transformer.
Overrides:
addTransformer in class AbstractEventPipeline
Following copied from interface: org.apache.cocoon.components.pipeline.EventPipeline
Parameters:
role - the transformer role in the component manager.
source - the source used to setup the transformer (e.g. XSL file), or null if no source is given.
param - the parameters for the transfomer.
Throws:
java.lang.Exception - if the generator couldn't be obtained.

generateKey

public PipelineCacheKey generateKey(Environment environment)
                             throws java.lang.Exception
Generate the unique key. This key is the PipelineCacheKey for the whole EventPipeline.
Specified by:
generateKey in interface CacheableEventPipeline
Parameters:
environment - The current environment of the request.
Returns:
The generated key or null if the pipeline is currently not cacheable as a whole.

generateValidity

public java.util.Map generateValidity(Environment environment)
                               throws java.lang.Exception
Generate the validity object. Before this method can be invoked the generateKey() method must be invoked.
Specified by:
generateValidity in interface CacheableEventPipeline
Parameters:
environment - The current environment of the request.
Returns:
The generated validity objects for the whole pipeline or null if the pipeline is currently not cacheable.

setStreamPipelineCaches

public void setStreamPipelineCaches(boolean flag)
The stream pipeline (or the content aggregator) calls this method to tell the event pipeline if it must not cache the result
Specified by:
setStreamPipelineCaches in interface CacheableEventPipeline

process

public boolean process(Environment environment)
                throws java.lang.Exception
Description copied from interface: EventPipeline
Process the given Environment, producing the output.
Overrides:
process in class AbstractEventPipeline

recycle

public void recycle()
Description copied from class: AbstractXMLProducer
Recycle the producer by removing references
Specified by:
recycle in interface org.apache.avalon.excalibur.pool.Recyclable
Overrides:
recycle in class AbstractEventPipeline

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable
Overrides:
dispose in class AbstractEventPipeline


Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.