cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geert Josten <>
Subject Re: Copying files with a transformer?
Date Mon, 07 Mar 2005 20:03:41 GMT
Hi Rogier,

Thanks for answering my question.

To what extend do you consider it an anti-pattern? There are a lot transformers that do the
kind of thing. SQL transformer, SOAP transformer, LDAP transformer and even SourceWritingTransformer

can be considered to be having side effects. So I don't think this is an anti-pattern.

On the other hand, I like the Ant classes thing. Can you give a bit more insight in how to
do this, 
and share it on the users mailing list?

Thanks again,

Rogier Peters wrote:
> Hoi Geert,
> Copying as a side effect of a transformation is somewhat of an 
> antipattern - iirc.
> OK, now that i'm reading more closely I see what you want - use the xml 
> in the pipeline as a kind of script that does the copying. I don't think 
> there's a transformer like that yet. Maybe you could even make an 
> AntTransformer, so you can reuse Ant's copy/move/zip/etc. functionality.
> Of course you're still in the side effect transformation trap.
> Another way would be calling helper classes from flowscript. Again you 
> can use Ant classes: I did something similar with an array of files 
> returned by the Ant DirectoryScanner, which gives you a lot of filtering 
> and wildcards-operations for free.
> Groet
> Rogier
> Geert Josten wrote:
>> Hi all,
>> I'm new to this list, so forgive me if I'm blunt or off-topic..
>> On the Cocoon users mailing list, there were some questions about 
>> copying files. We came up with solutions like using the copy-source 
>> actor, flowscript or perform an include and write it again using 
>> sourcewritingtransformer.
>> I personally like the transformer alternative, sounds more dynamic to 
>> me than the others. But including and serializing requires generating 
>> SAX out of the source and streaming it again. One might be able to do 
>> this even with binary files, but wouldn't it be nicer to for instance 
>> allow the sourcewritingtransformer take a 'src' feature? (as an 
>> alternative to the 'fragment' feature, or as an attribute of the 
>> fragment element?)
>> Or have I simply overlooked a transformer that already provide this 
>> kind of functionality?
>> Cheers,
>> Geert

IT-consultant at Daidalos BV, Zoetermeer (NL)

GPG: 1024D/12DEBB50

View raw message