Grzegorz Kossakowski schrieb:
Reinhard Pötz pisze:

My assumption is that the developer that uses the pipeline knows what he
does.

This is rather good assumption. The problem I can see is that developer has to 
check sources of each component in order
to know what he does as components type does not express what kind of output 
particular component produces.

Or am I missing something?

How component can be sure that next component (its consumer) is the one
that accepts right type of events? By checking using instanceof?
My point is that once we agree to have generic pipelines that can take
components accepting/producing any kind of events then we need to invent
some mechanism that check if pipeline is built correctly. It shouldn't
be a concern of a given component.

If we agree on above point, then my suggestion would be to look for a
way that pipeline-correctness is ensured by compiler.
I don't see any way to express this kind of check with Java and AFAICS
your experiments haven't been successful either.

It depends how you define being successful. I've managed to express this rather 
simple idea but the code is horrible
thus I consider it as a failure.
Well cleaning up working code cannot be that hard - you haven't invested years of time, have you ;-)
You probably haven't had a chance to look at my code due to broken GitHub. My 
question is if there is someone more
clever than me that could come up with something more elegant.

The check we are discussing is assured by Pipeline interface (look at modified 
addComponent method):
http://github.com/gkossakowski/cocoonpipelines2/blob/master/src/org/apache/cocoon/pipeline/Pipeline.java

That adding a component actually returns a different pipeline is an interesting approach but I'm not sure I want to declare a new variable for each of the new pipelines.
And method chaining is not really me idea of readable code.

Also I'm wondering what return type a SAXSerializer would have or what event types SAX uses. Are those event types just for the compiler or are they actually used to pass the data around?



Reply via email to