Hi team,

Considering the discussions about the FileWritingTransformer, Cocoon
symetry and Stefano's source/drain RT, I added in
org.apache.cocoon.environment a new interface I already talked about :
WriteableSource. It adds writing methods to Source's reading abilities.

Writing can occur in two ways :
- to write SAX events, call getContentHandler() to have a consumer for
these events,
- to write bytes, call getOutputStream() to write them.

It comes with a first implementation : FileSource, which handles (guess
what) files. An additionnal entry in <source-handler> makes this
implementation prevail over the default URLSource. Writing occurs with a
simple lock mechanism that prevents simultaneous writes.

The door is now open to other implementations that will allow us to
write anything anywhere just as Source already allows to read anything
anywhere. Some possible implementations include xmldb (Gianugo ?), SQL
blobs, http/ftp upload, etc.

As the first implementation supports atomic updates, and some other are
likely do support it also, I was thinking of adding a rollback() method
on WriteableSource. But rollback is more related to the OutputStream or
ContentHandler than to the source itself. So what do you think ?

                               --o--

Jeremy, I also quickly updated the FileWritingTransformer so that it
uses any WriteableSource instead of just files. Could you please look at
it ? Another update would be also to the 'serializer' parameter fully
optional so that SAX events are sent directly to the result of
WriteableSource.getContentHandler(). This would for avoid parsing the
output of the serializer for native XML sources such as xmldb.

BTW, your new slash-edit demo is really nice. By crossing this with the 
Chaperon text parser and the "crushing userland" thread, we should 
quickly have a Cocoon-powered weblog !

                                --o--

Note : I had some problems with XConfTool to declare this new Source
factory. I had to add it in xmldb.xconf because XConfTool handles only
components items (i.e. first-level elements) and not sub-items. Is there
another way ?


Sylvain






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to