fr.gouv.culture.sdx.pipeline
Class AbstractPipeline

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLoggable
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byfr.gouv.culture.sdx.pipeline.AbstractPipeline
All Implemented Interfaces:
org.apache.avalon.framework.component.Composable, org.apache.avalon.framework.configuration.Configurable, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.logger.Loggable, Pipeline, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, org.apache.cocoon.xml.XMLConsumer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer
Direct Known Subclasses:
GenericPipeline

public abstract class AbstractPipeline
extends org.apache.cocoon.xml.AbstractXMLPipe
implements Pipeline

An abstract implementation of a Pipeline for manipulation of SAX events


Field Summary
protected  org.apache.avalon.framework.configuration.Configuration configuration
          The configruation object
protected  java.lang.String id
          The id for the pipeline.
protected  java.lang.String keepStep
           
protected  org.apache.avalon.framework.logger.Logger logger
          Avalon logger to write information.
protected  org.apache.avalon.framework.component.ComponentManager manager
          The a component manager
protected  java.util.Hashtable props
          The Pipelines properties.
protected  java.util.LinkedList transformations
          A list of the transformations that make up this pipeline.
protected  java.util.Vector transformsList
          A list of the transformations that make up this pipeline.
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, lexicalHandler, xmlConsumer
 
Fields inherited from interface fr.gouv.culture.sdx.pipeline.Pipeline
ATTRIBUTE_ID, ATTRIBUTE_TYPE, CLASS_NAME_SUFFIX, ELEMENT_NAME, ELEMENT_NAME_PIPELINES, PACKAGE_QUALNAME
 
Constructor Summary
AbstractPipeline()
           
 
Method Summary
 void addTransformation(Transformation t)
          Adds a transformation to the pipeline and sets the consumer of the last transformation to be the newly added transformation.
 void compose(org.apache.avalon.framework.component.ComponentManager manager)
          Sets the pipeline's ComponentManager.
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Configures the pipeline.
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
          Sets the logger for the pipeline
 java.lang.String getId()
          Returns the id for the pipeline
 org.apache.avalon.framework.parameters.Parameters getParameters()
          Returns the paramters for this pipeline
 byte[] getTransformedBytes()
          Returns a byte array which contains the data of a transformation step.
 java.io.File getTransformedFile()
          Returns a file which contains the data of a transformation step.
 Pipeline newInstance()
          Returns a new instance of this object
 void setConsumer(org.apache.cocoon.xml.XMLConsumer xmlConsumer)
          Sets the consumer of the pipeline.
 void setParameters(org.apache.avalon.framework.parameters.Parameters params)
          Sets the Parameters for each step in the Pipeline
protected  void setParametersToTransformations(org.apache.avalon.framework.parameters.Parameters parameters)
           
 void setProperties(java.util.Hashtable props)
          Sets Properties.
protected  void verifyConfigurationParameters(org.apache.avalon.framework.parameters.Parameters params)
           
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
characters, comment, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
recycle, 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.xml.sax.ContentHandler
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 

Field Detail

configuration

protected org.apache.avalon.framework.configuration.Configuration configuration
The configruation object


id

protected java.lang.String id
The id for the pipeline.


transformations

protected java.util.LinkedList transformations
A list of the transformations that make up this pipeline.


logger

protected org.apache.avalon.framework.logger.Logger logger
Avalon logger to write information.


transformsList

protected java.util.Vector transformsList
A list of the transformations that make up this pipeline.


manager

protected org.apache.avalon.framework.component.ComponentManager manager
The a component manager


keepStep

protected java.lang.String keepStep

props

protected java.util.Hashtable props
The Pipelines properties.

Constructor Detail

AbstractPipeline

public AbstractPipeline()
Method Detail

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
Sets the logger for the pipeline

Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled
Parameters:
logger - The logger created from Cocoon's logkit.

compose

public void compose(org.apache.avalon.framework.component.ComponentManager manager)
             throws org.apache.avalon.framework.component.ComponentException
Sets the pipeline's ComponentManager.

Specified by:
compose in interface org.apache.avalon.framework.component.Composable
Parameters:
manager - The ComponentManager to use.
Throws:
org.apache.avalon.framework.component.ComponentException

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Configures the pipeline.

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Parameters:
configuration - The configuration object provided from a document base object.

Retrieves the children elements named "transformation" and builds a transformation object for each element. Currently the only supported transformation type is "xslt".

Sample configuration snippet:

<sdx:pipeline sdx:id = "sdxIndexationPipeline">

<sdx:transformation src = "path to stylesheet, can be absolute or relative to the directory containing this file" sdx:id = "step2" sdx:type = "xslt"/>

<sdx:transformation src = "path to stylesheet, can be absolute or relative to the directory containing this file" sdx:id = "step3" sdx:type = "xslt" keep = "true"/>

</sdx:pipeline>

Throws:
org.apache.avalon.framework.configuration.ConfigurationException

verifyConfigurationParameters

protected void verifyConfigurationParameters(org.apache.avalon.framework.parameters.Parameters params)

addTransformation

public void addTransformation(Transformation t)
                       throws SDXException
Adds a transformation to the pipeline and sets the consumer of the last transformation to be the newly added transformation.

Specified by:
addTransformation in interface Pipeline
Parameters:
t - The transformation to be added.
Throws:
SDXException

setConsumer

public void setConsumer(org.apache.cocoon.xml.XMLConsumer xmlConsumer)
Sets the consumer of the pipeline.

Specified by:
setConsumer in interface org.apache.cocoon.xml.XMLProducer
Parameters:
xmlConsumer - The XMLConsumer for the LAST step of the pipeline

setParameters

public void setParameters(org.apache.avalon.framework.parameters.Parameters params)
Sets the Parameters for each step in the Pipeline

Specified by:
setParameters in interface Pipeline
Parameters:
params - The Parameters to use for each transformation step.

Each transformation step in the pipeline can call (getParameters() defined in the Transformation interface) and make use this Parameters object as needed before pipeline processing begins.


setParametersToTransformations

protected void setParametersToTransformations(org.apache.avalon.framework.parameters.Parameters parameters)

getId

public java.lang.String getId()
Description copied from interface: Pipeline
Returns the id for the pipeline

Specified by:
getId in interface Pipeline

newInstance

public Pipeline newInstance()
                     throws SDXException
Returns a new instance of this object

Specified by:
newInstance in interface Pipeline
Returns:
A new instance of this object
Throws:
SDXException

getParameters

public org.apache.avalon.framework.parameters.Parameters getParameters()
Returns the paramters for this pipeline

Specified by:
getParameters in interface Pipeline

getTransformedBytes

public byte[] getTransformedBytes()
Returns a byte array which contains the data of a transformation step. The data will only be present after a pipeline is executed, if no transformation data is retained null will be returned

Specified by:
getTransformedBytes in interface Pipeline
Returns:

getTransformedFile

public java.io.File getTransformedFile()
                                throws SDXException
Returns a file which contains the data of a transformation step. The data will only be present after a pipeline is executed, if no transformation data is retained null will be returned

Specified by:
getTransformedFile in interface Pipeline
Throws:
SDXException

setProperties

public void setProperties(java.util.Hashtable props)
Sets Properties.

Specified by:
setProperties in interface Pipeline
Parameters:
props - A Properties object containing path information for an instance of an application.


Copyright © 2000-2004 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.