You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Joe Gottman <jo...@comcast.net> on 2009/05/28 00:16:25 UTC

Feature Request: clobber option for FileComponent

FileComponent currently has an append option, which is set to true for File
Producers to make the Producer write to the end of an existing file, and
false to make it overwrite an existing file.  However, sometimes it is an
error for it to do anything to change an existing file.  Would it be
possible to add a clobber option to the FileComponent which defaults to true
but when set to false prevents the File Producer from modifying an existing
file?  It should probably throw some kind of Camel Exception when it
attempts to write to a file that already exists. If desired, the Route can
then catch this Exception and handle it, for instance by trying to write the
file to a different location.

   This option might also be useful for some other Producer components for
the same reason.
-- 
View this message in context: http://www.nabble.com/Feature-Request%3A-clobber-option-for-FileComponent-tp23751774p23751774.html
Sent from the Camel Development mailing list archive at Nabble.com.


Re: Feature Request: clobber option for FileComponent

Posted by Willem Jiang <wi...@gmail.com>.
Good suggestion :)

Please feel free to fill a JIRA[1] for it, so we can keep on tracking
it. It will be grate if you submit a patch of this issue :).

[1] https://issues.apache.org/activemq/browse/CAMEL

Willem
Joe Gottman wrote:
> FileComponent currently has an append option, which is set to true for File
> Producers to make the Producer write to the end of an existing file, and
> false to make it overwrite an existing file.  However, sometimes it is an
> error for it to do anything to change an existing file.  Would it be
> possible to add a clobber option to the FileComponent which defaults to true
> but when set to false prevents the File Producer from modifying an existing
> file?  It should probably throw some kind of Camel Exception when it
> attempts to write to a file that already exists. If desired, the Route can
> then catch this Exception and handle it, for instance by trying to write the
> file to a different location.
> 
>    This option might also be useful for some other Producer components for
> the same reason.