You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Nicola Ken Barozzi <ni...@apache.org> on 2004/08/31 12:00:08 UTC
Actual implementation of passthrough
If the @passthrough attribute is to be put in the <pipelines> section of
the mounted sitemap, it seems easy: make the PipelinesNodeBuilder set a
passthrough variable in the PipelinesNode, and have the PipelinesNode
tell or not the last PipelineNode if it has to stop:
public void setChildren(ProcessingNode[] nodes) {
// Mark the last pipeline so that it can throw a
// ResourceNotFoundException
//-> put an if() here
((PipelineNode)nodes[nodes.length - 1]).setLast(true);
//
super.setChildren(nodes);
}
The point is that it makes sense for the mount node to set it, but I'm
not sure which is the preferred way in the TreeProcessor to pass that
info from the MountNodeBuilder to the PipelinesNode.
Suggestions?
--
Nicola Ken Barozzi nicolaken@apache.org
- verba volant, scripta manent -
(discussions get forgotten, just code remains)
---------------------------------------------------------------------
RE: Actual implementation of passthrough
Posted by Carsten Ziegeler <cz...@apache.org>.
Sylvain Wallez wrote:
>
> The passthrough information cannot be set on the processing
> node, as it depends on the runtime environment (a single
> sitemap can be mounted from different locations with
> different values for passthrough).
>
> IMO, the easiest way is for the mount node to set an
> attribute in the Environment (which is private to the
> pipeline machinery) that gets checked by the Pipelines node
> of the mounted sitemap. That attribute should of course be
> reset to its previous value upon return in the mount node.
>
Hmm, I don't like adding tree processing information to the
environment :)
What about adding this info to the InvokeContext?
Carsten
Re: Actual implementation of passthrough
Posted by Sylvain Wallez <sy...@apache.org>.
Nicola Ken Barozzi wrote:
>
> If the @passthrough attribute is to be put in the <pipelines> section
> of the mounted sitemap, it seems easy: make the PipelinesNodeBuilder
> set a passthrough variable in the PipelinesNode, and have the
> PipelinesNode tell or not the last PipelineNode if it has to stop:
>
> public void setChildren(ProcessingNode[] nodes) {
> // Mark the last pipeline so that it can throw a
> // ResourceNotFoundException
> //-> put an if() here
> ((PipelineNode)nodes[nodes.length - 1]).setLast(true);
> //
> super.setChildren(nodes);
> }
>
> The point is that it makes sense for the mount node to set it, but I'm
> not sure which is the preferred way in the TreeProcessor to pass that
> info from the MountNodeBuilder to the PipelinesNode.
The passthrough information cannot be set on the processing node, as it
depends on the runtime environment (a single sitemap can be mounted from
different locations with different values for passthrough).
IMO, the easiest way is for the mount node to set an attribute in the
Environment (which is private to the pipeline machinery) that gets
checked by the Pipelines node of the mounted sitemap. That attribute
should of course be reset to its previous value upon return in the mount
node.
WDYT?
Sylvain
--
Sylvain Wallez Anyware Technologies
http://www.apache.org/~sylvain http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Re: Actual implementation of passthrough
Posted by Nicola Ken Barozzi <ni...@apache.org>.
Unico Hommes wrote:
...
> What about letting MountNode catch the "No pipeline matched request"
> exception that is thrown during processor.buildPipeline() and
> processor.process() and decide whether or not to rethrow it there. Would
> that work?
It could, but I'd have to check somehow that it's the right exception,
as the end of the processing is not the only condition that triggers it.
Besides, Exception throwing is not necessarily fast and is not meant in
itself to be used for flow management.
--
Nicola Ken Barozzi nicolaken@apache.org
- verba volant, scripta manent -
(discussions get forgotten, just code remains)
---------------------------------------------------------------------
Re: Actual implementation of passthrough
Posted by Unico Hommes <un...@hippo.nl>.
Nicola Ken Barozzi wrote:
>
> If the @passthrough attribute is to be put in the <pipelines> section
> of the mounted sitemap, it seems easy: make the PipelinesNodeBuilder
> set a passthrough variable in the PipelinesNode, and have the
> PipelinesNode tell or not the last PipelineNode if it has to stop:
>
> public void setChildren(ProcessingNode[] nodes) {
> // Mark the last pipeline so that it can throw a
> // ResourceNotFoundException
> //-> put an if() here
> ((PipelineNode)nodes[nodes.length - 1]).setLast(true);
> //
> super.setChildren(nodes);
> }
>
> The point is that it makes sense for the mount node to set it, but I'm
> not sure which is the preferred way in the TreeProcessor to pass that
> info from the MountNodeBuilder to the PipelinesNode.
>
> Suggestions?
>
What about letting MountNode catch the "No pipeline matched request"
exception that is thrown during processor.buildPipeline() and
processor.process() and decide whether or not to rethrow it there. Would
that work?
--
Unico