produces the response for a given request.
It is assembled according to the commands in the sitemap and can either
- Collect a
Reader
and let it produce a byte stream,
- Or connect a
Generator
with zero or more
Transformer
s and a Serializer
, and let them
produce the byte stream. This pipeline uses SAX events for
communication.
A ProcessingPipeline
is Recomposable
since the
ComponentManager
used to get the generator, transformers, etc.
depends on the pipeline assembly engine where they are defined (i.e. a given
sitemap file).
- Version:
- $Id: ProcessingPipeline.html 1304258 2012-03-23 10:09:27Z ilgrosso $
- Author:
- Carsten Ziegeler, Giacomo Pati
Method Summary |
void |
addTransformer(String role,
String source,
Parameters param,
Parameters hintParam)
Add a transformer at the end of the pipeline. |
Generator |
getGenerator()
Get the generator - used for content aggregation |
String |
getKeyForEventPipeline()
Return the key for the event pipeline
If the "event pipeline" (= the complete pipeline without the
serializer) is cacheable and valid, return a key. |
SourceValidity |
getValidityForEventPipeline()
Return valid validity objects for the event pipeline
If the "event pipeline" (= the complete pipeline without the
serializer) is cacheable and valid, return all validity objects. |
void |
informBranchPoint()
Informs pipeline we have come across a branch point |
void |
prepareInternal(Environment environment)
Prepare an internal processing |
boolean |
process(Environment environment)
Process the given Environment , producing the output. |
boolean |
process(Environment environment,
XMLConsumer consumer)
Process the given Environment , but do not use the
serializer. |
void |
release()
Release this component. |
void |
setErrorHandler(SitemapErrorHandler errorHandler)
Sets error handler for this pipeline. |
void |
setGenerator(String role,
String source,
Parameters param,
Parameters hintParam)
Set the generator that will be used as the initial step in the pipeline. |
void |
setReader(String role,
String source,
Parameters param,
String mimeType)
Set the reader for this pipeline |
void |
setSerializer(String role,
String source,
Parameters param,
Parameters hintParam,
String mimeType)
Set the serializer for this pipeline |
void |
setup(Parameters params)
Setup this component. |
Methods inherited from interface org.apache.avalon.framework.component.Composable |
compose |
ROLE
static final String ROLE
setup
void setup(Parameters params)
- Setup this component.
release
void release()
- Release this component.
If you get an instance not by a component manager but for example
by a processor, you have to release this component by calling
this method and NOT by using a component manager!
setGenerator
void setGenerator(String role,
String source,
Parameters param,
Parameters hintParam)
throws ProcessingException
- Set the generator that will be used as the initial step in the pipeline.
The generator role is given : the actual
Generator
is fetched
from the latest ComponentManager
given by compose()
or recompose()
.
- 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.
getGenerator
Generator getGenerator()
- Get the generator - used for content aggregation
informBranchPoint
void informBranchPoint()
- Informs pipeline we have come across a branch point
addTransformer
void addTransformer(String role,
String source,
Parameters param,
Parameters hintParam)
throws ProcessingException
- Add a transformer at the end of the pipeline.
The transformer role is given : the actual
Transformer
is fetched
from the latest ComponentManager
given by compose()
or recompose()
.
- 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.
setSerializer
void setSerializer(String role,
String source,
Parameters param,
Parameters hintParam,
String mimeType)
throws ProcessingException
- Set the serializer for this pipeline
- Parameters:
mimeType
- Can be null
- Throws:
ProcessingException
setReader
void setReader(String role,
String source,
Parameters param,
String mimeType)
throws ProcessingException
- Set the reader for this pipeline
- Parameters:
mimeType
- Can be null
- Throws:
ProcessingException
setErrorHandler
void setErrorHandler(SitemapErrorHandler errorHandler)
throws ProcessingException
- Sets error handler for this pipeline.
Used for handling errors in the internal pipelines.
- Throws:
ProcessingException
process
boolean process(Environment environment)
throws ProcessingException
- Process the given
Environment
, producing the output.
- Throws:
ProcessingException
prepareInternal
void prepareInternal(Environment environment)
throws ProcessingException
- Prepare an internal processing
- Parameters:
environment
- The current environment.
- Throws:
ProcessingException
process
boolean process(Environment environment,
XMLConsumer consumer)
throws ProcessingException
- Process the given
Environment
, but do not use the
serializer. Instead the sax events are streamed to the XMLConsumer.
Make sure to call prepareInternal(Environment)
beforehand.
- Throws:
ProcessingException
getValidityForEventPipeline
SourceValidity getValidityForEventPipeline()
- Return valid validity objects for the event pipeline
If the "event pipeline" (= the complete pipeline without the
serializer) is cacheable and valid, return all validity objects.
Otherwise return
null
getKeyForEventPipeline
String getKeyForEventPipeline()
- Return the key for the event pipeline
If the "event pipeline" (= the complete pipeline without the
serializer) is cacheable and valid, return a key.
Otherwise return
null
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.