cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Flow result storage : let's fix it before its too late !
Date Mon, 03 Mar 2003 22:23:34 GMT
Hi all,

A rather provocative subject, so let me first say that I like the flow, 
even if unfortunately I didn't have the occasion to use it up to know. 
Ovidiu did a wonderful job and Adrew is now adding features that make it 
more usable.

But I think we reached a point where we have to be careful at how the 
flow is slowly spreading inside other components and do some design 
before it's too late. This is mainly about the way the flow gives its 
output to other components : it adds two attributes to the *Environment* 
object, which is an object used internally by the pipeline machinery, 
and *should not be used* by other components (nor shoud it 
theroretically be accessible).

The way this Enviromnent object is fetched says it by itself :
  public void setup(SourceResolver resolver, Map objectModel, String 
src, Parameters params) {
    Object bean = ((Environment)resolver).getAttribute("bean-dict");
    WebContinuation kont = 

This is a hack that relies on the fact that the SourceResolver also 
implements Environment, which is absolutely not guaranteed by its 
contract ! Furthermore, this "resolver" parameter in C2.1 should be 
considered deprecated and is replaced by the Excalibur SourceResolver 
which is a regular component looked up on the ComponentManager and 
doesn't implement Environment !

So why don't we use the ObjectModel to pass the flow information ? It 
already contains the request and the response, and this seems the 
natural place for flow values. And more : if we consider components such 
as FlowVelocityGenerator, why would we want to publish only flow data 
and not elements of the object model ? If everything was in the object 
model, we could have some generic publication code that would publish 
all that is in the object model, regardless of what it actually is, and 
thus no need for a second VelocityGenerator.

Thoughts ? What's the reason for using the Environment ?

Also, I prefer longer but more explicit names than "$this" to access the 
flow bean : "$flowDict" is not much longer but way more explicit in the 
huge name base that is Cocoon. Oversimplifying names leads to too much 
magic that kills the understandability of the whole thing.


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }

View raw message