cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ivelin Ivanov" <>
Subject Re: [SUMMARY] Viva la Multiplexer! (was: [Contribution] Pipe-aware selection)
Date Sat, 06 Apr 2002 02:31:26 GMT

Without taking any side in this argument, simply because I don't have enough
real world experience with pipe-aware selectors, I would like to share an

If xpath selector is chosen to make it in Cocoon,  it can be implemented
very efficiently.
Those who have followed the discussion remember Konstantin and I proposing
an XPath subset which
can cover majority of the use cases.

Indeed there is a readily available library of good quality which can be
It is the Digester tool from Apache Jakarta Commons.

If I am not mistaken, for a sitemap like the following, Digester can be
initialized with all the selector when tests.
Then it can cash the sax stream until any of the tests is satisfied, at
which point, the cached sax stream can be unleashed to the next SAX

<map:match pattern="userDataInsert.xml">
  <map:generate type="stream"/>
  <map:transform src="userData.xsd" type="validator"/>
  <map:select type="xpath">
    <map:when test="/*/@fatal-error">
      <map:transform src="structureErrors.xsl"/>
    <map:when test="/*/@field-error">
      <map:transform src="userDataForm.xsl"/>
      <map:transform type="file-writer" dest="userData.xml"/>
      <map:select type="xpath">
        <map:when test="/result/file-writen='true'">
          <map:transform src="reportInsertResult.xsl"/>
          <map:transform src="reportInsertError.xsl"/>

Here is a snipped of code from Struts' ActionServlet which demonstrates how
Digester is initialized:

     * Construct and return a digester that uses the new configuration
     * file format.
    protected Digester initDigester(int detail) {

// Initialize a new Digester instance
Digester digester = new Digester();

// Register our local copy of the DTDs that we can find
        for (int i = 0; i < registrations.length; i += 2) {
            URL url = this.getClass().getResource(registrations[i+1]);
            if (url != null)
                digester.register(registrations[i], url.toString());

// Configure the processing rules

                         new AddDataSourceRule(digester));
             "property", "value");

                                 mappingClass, "className");

             "property", "value");

             forwardClass, "className");

             "property", "value");

                                 formBeanClass, "className");

             "property", "value");

                                 forwardClass, "className");

             "property", "value");

return (digester);


----- Original Message -----
From: "Daniel Fagerström" <>
To: <>
Sent: Friday, April 05, 2002 9:11 AM
Subject: Re: [SUMMARY] Viva la Multiplexer! (was: [Contribution] Pipe-aware

Stefano Mazzocchi wrote:

> Daniel Fagerström wrote:


> We all want this. But I *DO*NOT* want to start tweaking the sitemap
> elegance before the flowmaps are implemented.
> My personal perception is that we are using the 'hammer antipattern'
> here: the sitemap is the hammer, and everything looks like a nail.

Or maybe Occam's razor: "one should not increase, beyond what is
necessary, the number of entities required to explain anything" ;)


> For sure we need more symmetry and more functionality in the pipelines.
> If multiplexing and pipe-aware selection are the way to implement them
> is yet to be understood.

Agreed, it is definitly my, (and all the other raving "pipe-aware
selection" fans out there ;) ) resposibility to provide examples on how
elegantly you can construct webapps with the help of just a few extra
sitemap components. I hope to be able to provide some example code and
an RT quite soon. Until then some sceptisism seem like a sound strategy.

>>I know that there have been a lot of concern about that a DOM-based
>>pipe-aware selection mechanism would be a performance bottleneck, but:
> Agreed. My concerns are *not* implementation-wise, I'm *never* concerned
> by implementations because a community can always make it better.

Good, I know that you have said so before, but it is anyway a relief to
hear you saying that in this particular context.

> I'm concerned by architecture design because I don't think that it's
> equivally easy to progressively refine an architecture, expecially when
> you need to provide back compatibility from each incremental step.

> It's easy to add stuff, much easier than *not* to add stuff.
Yes, these are _very_ important concerns, there might be a quite thin line

between entropy death from due to added features and stagnation death due

to fear of adding anything at all.

I can asure you that architectural and conceptual elegance is extremely
important for me. I have struggled with how to handle webapps with a
minimal number, efficient, and easy to understand concepts for months.
That of course doesn't necesarily means that the results of my thinking
is the best possible way of solving this issues, but at least I take
these things seriously.

Anyway I'l try to finish some examples and I'l also repackage the pipe-aware

selector code to a scratchpad contribution and put my hope on that some

kind commiter will add it :) In that case I need a small, small addition

to one of the support classes in the interpreted sitemap - please, please

consider adding it ;)

/Daniel Fagerstrom

To unsubscribe, e-mail:
For additional commands, email:

To unsubscribe, e-mail:
For additional commands, email:

View raw message