cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Fagerstrom <dani...@nada.kth.se>
Subject Re: [RFC] JXTG Refactoring
Date Thu, 09 Dec 2004 14:11:28 GMT
Leszek Gawron wrote:
<snip/>

> I have commited an initial JXTemplateGenerator to 
> o.a.c.template.jxtg.JXTemplateGenerator and moved Jonas' templating 
> proposal to o.a.c.template.v2 package.
>
> Please review. 

Nice!

Don't have time to review in any detail right now. I added some basic 
test cases. Two of them that tries to test that the cocoon object is 
accesible from expressions are faulty, I didn't get them to work even 
with the original JXTG, any idea about what goes wrong?

                                   ---  o0o ---

For further refactoring I think that we should try to factor out the 
execute method as you certainly have seen it is quite intermingled with 
other stuff. IMO it should be static (or better moved to an own class), 
and depend of three arguments:

execute(XMLConsumer consumer, ExecutionContext context, ...)

where ExecutionContext is a new class containing the jexl and jxpath 
contexts, ServiceManager (and SourceResolver but that is accesible from 
ServiceManager), Variables, cache and definitions. There was some 
discussion about context in 
http://marc.theaimsgroup.com/?t=110173410800002&r=1&w=2.

In a next step the cache object should be factored out from the 
ExecutionContext and replaced by some kind of script manager, so that we 
can have the code that compiles and caches the scripts at one place.

Then execute takes a number of events as arguments, I would like to 
abstact the coupling between execution and event implementation, but how 
it should be done requires more thinking.

Each tag has code in three places: its start tag that contains data, in 
the parser for setting it up and inexecute for executing it. That is 
rather confusing, so we shoud put all the three parts in one class. How 
this can be done has been discussed in the above thread among other places.

Hiding the jxpath and jexl specifc code beyond one interface would also 
be nice.

WDYT?

/Daniel



Mime
View raw message