cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Foster <jafos...@uwaterloo.ca>
Subject RT - Tree Traversal Implementation of Sitemaps and XSP
Date Fri, 05 Oct 2001 02:32:59 GMT
It may be a little pretentious to use the "RT" prefix, but this is a random
thought, so here goes...

During some of my (admittedly small amounts of) work with Cocoon I have
found myself having to deal with the generated source code for the sitemap
and some XSP pages.  Needless to say this was not a terribly pleasant
experience.  

It occurred to me that the path a request takes through the sitemap, or the
generation of content from an XSP page, can be seen as a slightly involved
tree traversal.  In combination with the Strategy pattern from the GOF, I
got the following crazy idea:

Why not parse the sitemap and create an in-memory representation
(DOM,JDOM,???) where each node references both a component (Reader,
Transformer, etc.) and a traversal strategy.  When a request comes in:

1. Create the appropriate object encapsulating the parameters, etc.
2. Request a thread from a request handling thread pool
3. Pass the thread the request object and the root of the sitemap tree

Traversal of the tree basically consists of:

1. Request the strategy for the current node
2. Ask the strategy to do its thing
  2a. Which in most cases is likely to be a pre-order traversal, I think

For some reason the conceptual model of a bunch of request objects
traversing the sitemap tree seems a lot clearer than the current approach.

Is this a good idea?  I really don't know.  It does everything the current
approach does (I think), feels cleaner (to me) , and might make debugging
easier (ask the request to report on the path through the tree that it
took).  Without trying I can't tell if it would be faster or slower, or what
the RAM consumption would be.

I am really curious as to why Cocoon has adopted the XSLT code generation
approach?  It really seems to make debugging a pain, as well as placing a
dependency on having a java compiler on the runtime system.  I haven't been
trying too hard to figure out what the advantages to this approach are, but
I haven't come up with any.  I have no doubt that any interested readers
will enlighten me :)

Anyways, I don my asbestos underwear in preparation for your replies...

Jason Foster


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message