cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: [cocoon 2.2] Spring configuration of transformers
Date Fri, 28 Sep 2007 01:55:51 GMT
On 24.09.2007 6:07 Uhr, thuertas wrote:

> I tried to store beans in a database using Generator, Tansformer and 
> Serializer.
> That's ok for Generator and Serializer but there's nothing in database 
> when I use a Transformer!

> So why doesn't it work with a transformer? Is the spring transaction 
> initialized in the transformer?

This does not work this way at all from what I get since a Cocoon 
pipeline is streaming. I'll give a short introduction of both the 
concepts of this streaming and how Spring transaction interception works.

A Spring transaction spans a method call. The call to the method is 
intercepted, the transaction started, the actual method invocation is 
executed and when it returns from that it stops the transaction.

Now the streaming part. Whenever you call Generator.generate() it 
results in bunch of SAX ContentHandler method calls to the transformer 
and from there to the serializer. So usually (if it's not buffered) such 
a SAX event goes from the generator right through to the serializer. And 
when Generator.generate() is finished all the streaming a finished as 
well. That's why there is no Transformer.transform() method and no 
Serializer.serialize() method.

To put the picture together you only have to make the 
Generator.generate() method transactional and everything works fine. Of 
course you have to use your transformer and your serializer in a 
pipeline that's started with a transactional Generator.generate(). I'm 
sure your serializer does not work as expected for the same reason your 
transformer does not work.

Anyway, this whole approach seems to smell. I'd not execute any business 
logic in a pipeline. Actually the business processing should already be 
finished before you start to stream anything (have a look at flow 
script). The pipeline should only generate the outcome of the business 
transaction to show it to the user.

Hope this helps,

Joerg

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


Mime
View raw message