You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Antonio Gallardo <ag...@agssa.net> on 2004/04/04 08:06:53 UTC

Re: Groovy support in Cocoon (the future)

Tim Larson dijo:
> On Sat, Apr 03, 2004 at 10:45:49PM -0600, Antonio Gallardo wrote:
>> Some of us wanted to see Groovy support in Cocoon. Now we can "play" a
>> little with Groovy using the recently added support for Groovy script
>> generator under the BSF block. More info about how to use it is here:
> <snip/>
>> I hope this will have a good welcome in the Cocoon Community.
>
> As promised, here is your virtual tall glass of crystal-clear distilled
> mountain water.  I only filled it one third full, since we still need
> to figure out how to use this as an experiment flowscript engine and as
> an experimental way of writing Cocoon block code such as for CForms ;^)

Hi Tim:

Thanks, I think it is too much reward for almost nothing work! :-D

In fact I just added some libs, changed a little the BSF code (there was a
bug) and a dumb sample. That is almost nothing.

Groovy Actions
==============

This would be easy, in fact the support is already there. We just need to
make sure the BSF script action can work with Groovy. I am 99% sure this
will be as a picnic.

Groovy XSP support?
===================

Given the fact there exist Java and Javascript support for XSP, maybe we
can also add support for Groovy. I an not sure if this is good idea, since
XSP is no more interesting to us. Need we extended the life of XSP? ;-)

Groovy script tranformers?
==========================

Given the fact that Groovy can parse and emit SAX2 events. I wonder if
this will be a great "+" for Cocoon.

Another related concern is if we need to use the current BSF. Groovy is
able to generate directly SAX2 events. Currently, we are returning a XML
content inside a StringBuffer (see the output variable in
o.a.c.generation.ScriptGenerator.generate()). Maybe we can refactor the
current generator and "detect" if the script can send SAX2 events or not.
No sure, but we must look at it too.

Also I tought about a using Groovy script generator for dynamic list for
CForms. Just call the generator that retrieve data from a SQL connection,
format it and send the SAX2 events. How this sound?

Groovy Flow Engine
==================

The final dream! The idea is to create yet another Flow Engine using
Groovy. This will be a killer since we can got the best of both worlds:
The simplicity of Javascript with a better integration with Java.

Other Improvement
=================

Another fact is Groovy RI is currently using asm.jar and we can reach the
same using Apache BCEL project. The reason behind the asm.jar usage is
that it is far more smaller than bcel.jar. But giving the fact we are
actually using bcel inside the code, will be fine to refactor the current
Groovy RI to use bcel.jar.

Also, seems I think we can improve the performance of the BSF block.

Integration with Cocoon
=======================

In a future, i will be glad to be able write some parts of Cocoon using
Groovy. Since Groovy can be compiled to Java bytecode. I think this can be
done just integrating in the Cocoon build system support for Groovy. In
this area there is already Ant support for compiling Groovy code:
http://groovy.codehaus.org/compiling.html

WDYT?

Best Regards,

Antonio Gallardo