org.apache.cocoon.pipeline
Class CachingPipeline<T extends PipelineComponent>

java.lang.Object
  extended by org.apache.cocoon.pipeline.AbstractPipeline<T>
      extended by org.apache.cocoon.pipeline.CachingPipeline<T>
All Implemented Interfaces:
Pipeline<T>
Direct Known Subclasses:
AsyncCachePipeline

public class CachingPipeline<T extends PipelineComponent>
extends AbstractPipeline<T>

A Pipeline implementation that returns a cached result if, and only if all its components support caching. A PipelineComponent is cacheable if it implements the interface CachingPipelineComponent.


Field Summary
protected  Cache cache
           
protected  CacheKey cacheKey
           
protected  CachingOutputStream cachingOutputStream
           
 
Constructor Summary
CachingPipeline()
           
 
Method Summary
 CacheKey constructCacheKey()
           
 void execute()
          After the pipeline has been setup (Pipeline.setup(OutputStream, Map), this method can be invoked in order to produce the result.
protected  CacheValue getCachedValue(CacheKey cacheKey)
           
 CacheKey getCacheKey()
           
 String getExpires()
           
 long getLastModified()
          Get the time of the last modification.
protected  boolean isCacheKeyValid(CacheValue cachedValue)
           
 void setCache(Cache cache)
           
protected  void setCachedValue(CacheKey cacheKey, CacheValue cacheValue)
           
 void setConfiguration(Map<String,? extends Object> parameters)
          Pass pipeline specific configuration parameters to the pipeline component in a generic way.
 void setExpires(String expires)
           
 void setExpiresCacheKey(Serializable expiresCacheKey)
           
 void setup(OutputStream outputStream, Map<String,Object> parameters)
          The same as Pipeline.setup(OutputStream) but also allows passing parameters to the pipeline components.
 
Methods inherited from class org.apache.cocoon.pipeline.AbstractPipeline
addComponent, getComponents, getContentType, getFinisher, invokeStarter, setup, setupComponents, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cache

protected Cache cache

cacheKey

protected CacheKey cacheKey

cachingOutputStream

protected CachingOutputStream cachingOutputStream
Constructor Detail

CachingPipeline

public CachingPipeline()
Method Detail

constructCacheKey

public CacheKey constructCacheKey()

execute

public void execute()
             throws Exception
Description copied from class: AbstractPipeline
After the pipeline has been setup (Pipeline.setup(OutputStream, Map), this method can be invoked in order to produce the result.

Specified by:
execute in interface Pipeline<T extends PipelineComponent>
Overrides:
execute in class AbstractPipeline<T extends PipelineComponent>
Throws:
Exception - Any problem that might occur while processing the pipeline.
See Also:
Pipeline.execute()

getCacheKey

public CacheKey getCacheKey()

getExpires

public String getExpires()

getLastModified

public long getLastModified()
Description copied from interface: Pipeline
Get the time of the last modification.

Specified by:
getLastModified in interface Pipeline<T extends PipelineComponent>
Overrides:
getLastModified in class AbstractPipeline<T extends PipelineComponent>
Returns:
The last modification date

setCache

public void setCache(Cache cache)

setConfiguration

public void setConfiguration(Map<String,? extends Object> parameters)
Pass pipeline specific configuration parameters to the pipeline component in a generic way. This is useful in environments that automatically assemble pipelines with their components and can't use the pipeline's constructors or setters.

Specified by:
setConfiguration in interface Pipeline<T extends PipelineComponent>
Overrides:
setConfiguration in class AbstractPipeline<T extends PipelineComponent>
See Also:
AbstractPipeline.setConfiguration(java.util.Map)

setExpires

public void setExpires(String expires)

setExpiresCacheKey

public void setExpiresCacheKey(Serializable expiresCacheKey)

setup

public void setup(OutputStream outputStream,
                  Map<String,Object> parameters)
Description copied from class: AbstractPipeline
The same as Pipeline.setup(OutputStream) but also allows passing parameters to the pipeline components.

Specified by:
setup in interface Pipeline<T extends PipelineComponent>
Overrides:
setup in class AbstractPipeline<T extends PipelineComponent>
Parameters:
outputStream - An OutputStream where the pipeline execution result is written.
parameters - A Map of parameters that are available to all PipelineComponents.
See Also:
Pipeline.setup(java.io.OutputStream, java.util.Map)

getCachedValue

protected CacheValue getCachedValue(CacheKey cacheKey)

isCacheKeyValid

protected boolean isCacheKeyValid(CacheValue cachedValue)

setCachedValue

protected void setCachedValue(CacheKey cacheKey,
                              CacheValue cacheValue)


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.