org.apache.cocoon.components.pipeline.impl
Class CachingPointProcessingPipeline

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.components.pipeline.AbstractProcessingPipeline
          extended by org.apache.cocoon.components.pipeline.impl.BaseCachingProcessingPipeline
              extended by org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline
                  extended by org.apache.cocoon.components.pipeline.impl.CachingPointProcessingPipeline
All Implemented Interfaces:
Poolable, Recyclable, Disposable, Component, Composable, Recomposable, LogEnabled, Parameterizable, ProcessingPipeline

public class CachingPointProcessingPipeline
extends AbstractCachingProcessingPipeline

The caching-point pipeline implements an extended caching algorithm which is of particular benefit for use with those pipelines that utilise cocoon-views and/or provide drill-down functionality.

Since:
2.1
Version:
CVS $Id: CachingPointProcessingPipeline.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Michael Melhem

Field Summary
protected  boolean autoCachingPoint
           
protected  String autoCachingPointSwitch
           
protected  ArrayList isCachePoint
           
protected  boolean nextIsCachePoint
           
protected  ArrayList xmlSerializerArray
           
 
Fields inherited from class org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline
cacheCompleteResponse, cachedResponse, completeResponseIsCached, firstNotCacheableTransformerIndex, firstProcessedTransformerIndex, fromCacheKey, generatorIsCacheableProcessingComponent, generatorRole, lockTimeout, PIPELOCK_PREFIX, readerRole, serializerIsCacheableProcessingComponent, serializerRole, toCacheKey, toCacheSourceValidities, transformerIsCacheableProcessingComponent, transformerRoles, transientStore
 
Fields inherited from class org.apache.cocoon.components.pipeline.impl.BaseCachingProcessingPipeline
cache, xmlDeserializer, xmlSerializer
 
Fields inherited from class org.apache.cocoon.components.pipeline.AbstractProcessingPipeline
configuration, configuredExpires, configuredOutputBufferSize, expires, generator, generatorParam, generatorSelector, generatorSource, lastConsumer, manager, newManager, outputBufferSize, parameters, reader, readerMimeType, readerParam, readerSelector, readerSource, serializer, serializerMimeType, serializerParam, serializerSelector, serializerSource, sitemapReaderMimeType, sitemapSerializerMimeType, transformerParams, transformers, transformerSelectors, transformerSources
 
Fields inherited from interface org.apache.cocoon.components.pipeline.ProcessingPipeline
ROLE
 
Constructor Summary
CachingPointProcessingPipeline()
           
 
Method Summary
 void addTransformer(String role, String source, Parameters param, Parameters hintParam)
          Add a transformer.
protected  void cacheResults(Environment environment, OutputStream os)
          Cache longest cacheable path plus cache points.
protected  void connectCachingPipeline(Environment environment)
          Connect the caching point pipeline.
 void informBranchPoint()
          Determine if the given branch-point is a caching-point.
protected  ComponentCacheKey newComponentCacheKey(int type, String role, Serializable key)
          Create a new ComponentCachekey ComponentCacheKeys can be flagged as cachepoints
 void parameterize(Parameters config)
          The CachingPointProcessingPipeline is configurable.
 void recycle()
          Recyclable Interface
 void setGenerator(String role, String source, Parameters param, Parameters hintParam)
          Set the generator.
 
Methods inherited from class org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline
connectPipeline, generateCachingKey, generateLock, getKeyForEventPipeline, getValidityForEventPipeline, processReader, processXMLPipeline, releaseLock, setReader, setSerializer, setupPipeline, setupValidities, validatePipeline, waitForLock
 
Methods inherited from class org.apache.cocoon.components.pipeline.impl.BaseCachingProcessingPipeline
dispose
 
Methods inherited from class org.apache.cocoon.components.pipeline.AbstractProcessingPipeline
checkIfModified, checkPipeline, compose, connect, getGenerator, getLocation, handleException, isInternalError, prepareInternal, prepareInternalErrorHandler, preparePipeline, process, process, processErrorHandler, recompose, release, setErrorHandler, setMimeTypeForReader, setMimeTypeForSerializer, setup, setupReader
 
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
 

Field Detail

isCachePoint

protected ArrayList isCachePoint

xmlSerializerArray

protected ArrayList xmlSerializerArray

nextIsCachePoint

protected boolean nextIsCachePoint

autoCachingPointSwitch

protected String autoCachingPointSwitch

autoCachingPoint

protected boolean autoCachingPoint
Constructor Detail

CachingPointProcessingPipeline

public CachingPointProcessingPipeline()
Method Detail

parameterize

public void parameterize(Parameters config)
                  throws ParameterException
The CachingPointProcessingPipeline is configurable.

The autoCachingPoint algorithm (if enabled) will automatically cache common elements of the pipeline currently being processed - as well as the entire cacheable pipeline according to the "longest cacheable key" algorithm. This feature is especially useful for pipelines that branch at some point (this is the case with <map:select> or <map:act>).

The option autoCachingPoint can be switched on/off in the sitemap.xmap (on by default). For linear pipelines, one can switch "Off" autoCachingPoint and use attribute pipeline-hints="caching-point" to manually indicate that certain pipeline components (eg on <map:generator>) should be considered as cache points. Both options (automatic at branch points and manual with pipeline hints) can coexist in the same pipeline.

Works by requesting the pipeline processor to try shorter keys when looking for a cached content for the pipeline.

Specified by:
parameterize in interface Parameterizable
Overrides:
parameterize in class AbstractCachingProcessingPipeline
Throws:
ParameterException

setGenerator

public void setGenerator(String role,
                         String source,
                         Parameters param,
                         Parameters hintParam)
                  throws ProcessingException
Set the generator.

Specified by:
setGenerator in interface ProcessingPipeline
Overrides:
setGenerator in class AbstractCachingProcessingPipeline
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:
ProcessingException - if the generator couldn't be obtained.

addTransformer

public void addTransformer(String role,
                           String source,
                           Parameters param,
                           Parameters hintParam)
                    throws ProcessingException
Add a transformer.

Specified by:
addTransformer in interface ProcessingPipeline
Overrides:
addTransformer in class AbstractCachingProcessingPipeline
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:
ProcessingException - if the generator couldn't be obtained.

informBranchPoint

public void informBranchPoint()
Determine if the given branch-point is a caching-point. This is called by sitemap components when using cocoon views; it is also called by parent nodes (mainly selectors and actions). Please Note: this method is used by auto caching-point and is of no consequence when auto caching-point is switched off

Specified by:
informBranchPoint in interface ProcessingPipeline
Overrides:
informBranchPoint in class AbstractProcessingPipeline
See Also:
SimpleParentProcessingNode

cacheResults

protected void cacheResults(Environment environment,
                            OutputStream os)
                     throws Exception
Cache longest cacheable path plus cache points.

Specified by:
cacheResults in class AbstractCachingProcessingPipeline
Throws:
Exception

newComponentCacheKey

protected ComponentCacheKey newComponentCacheKey(int type,
                                                 String role,
                                                 Serializable key)
Create a new ComponentCachekey ComponentCacheKeys can be flagged as cachepoints

Specified by:
newComponentCacheKey in class AbstractCachingProcessingPipeline

connectCachingPipeline

protected void connectCachingPipeline(Environment environment)
                               throws ProcessingException
Connect the caching point pipeline.

Specified by:
connectCachingPipeline in class AbstractCachingProcessingPipeline
Throws:
ProcessingException

recycle

public void recycle()
Recyclable Interface

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


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