cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jastrac...@mac.com
Subject Re: GroovyMarkup syntax works!
Date Thu, 15 Apr 2004 16:01:39 GMT
Apologies Bertrand, this mail will bounce off the cocoon list I suspect 
as I'm not a subscriber...

On 15 Apr 2004, at 16:52, Bertrand Delacretaz wrote:
> I've just commited a GroovyMarkup [1] generator sample in the BSF 
> block, allowing the ScriptGenerator to use syntax like this:
>
> xml.page() {
>     content() {
>         section() {
>             title("GroovyMarkup test")
>
>             p("Look ma, no angle brackets!")
>
> 	ul() {
>                 for(i in 1..5) {
>                     li("This is item " + i)
>                 }
>             }
>        }
>     }
> }
>
> Thanks to James Strachan who very quickly fixed a problem in Groovy's 
> SAXBuilder. I've committed a snapshot of the Groovy jar with the fix, 
> this will have to be replaced with the next release when it's 
> available.
>
> Next step would be to allow the (way cool) Groovy Sql syntax [2] to be 
> used for database queries. It should be easy to implement, by making a 
> ConnectionProvider available to the scripts so that a groovy.sql.Sql 
> object can be created to use Connections from the Cocoon pool (I'm 
> thinking of having the ScriptGenerator release them to keep scripts 
> simple).

BTW you could just create the Sql object with a DataSource which is-a 
JDBC connection pool, then the Sql object takes care of all the pooling 
for you. Is there support for DataSource in Cocoon or some kinda 
adapter between DataSource and ConnectionProvider?

An alternative is to create a new Sql object per request with a 
specific Connection, then return the connection back to the pool after 
the request has finished. Though the DataSource approach is cleaner I 
think.

James
-------
http://radio.weblogs.com/0112098/


Mime
View raw message