You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Geert Josten <Ge...@daidalos.nl> on 2005/03/07 21:03:41 UTC

Re: Copying files with a transformer?

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 same 
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,
Geert

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
>>
> 
> 
> 

-- 
Geert.Josten@Daidalos.nl
IT-consultant at Daidalos BV, Zoetermeer (NL)

http://www.daidalos.nl/
tel:+31-(0)79-3316961
fax:+31-(0)79-3316464

GPG: 1024D/12DEBB50

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