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 (JIRA)" <ji...@apache.org> on 2009/05/28 05:02:50 UTC

[jira] Created: (CAMEL-1653) clobber option for FileComponent

clobber option for FileComponent
--------------------------------

                 Key: CAMEL-1653
                 URL: https://issues.apache.org/activemq/browse/CAMEL-1653
             Project: Apache Camel
          Issue Type: New Feature
          Components: camel-core
    Affects Versions: 2.0.0
            Reporter: Joe Gottman
            Priority: Minor


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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (CAMEL-1653) clobber option for FileComponent

Posted by Joe Gottman <jo...@comcast.net>.


JIRA jira@apache.org wrote:
> 
> 
>     [
> https://issues.apache.org/activemq/browse/CAMEL-1653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=51975#action_51975
> ] 
> 
> Claus Ibsen commented on CAMEL-1653:
> ------------------------------------
> 
> What would a good default be for this option?
> 
> Before we had append as the default.
> But would it make more sense to change to a new default such as:
> 
> - Fail
> or
> - Override
> 
> Any thoughts?
> 
> 

   We should probably keep the current default policy of appending in order
to avoid silently changing routes that previously worked and did not chose
any option. 


-- 
View this message in context: http://www.nabble.com/-jira--Created%3A-%28CAMEL-1653%29-clobber-option-for-FileComponent-tp23754402p23777922.html
Sent from the Camel Development mailing list archive at Nabble.com.


Re: [jira] Commented: (CAMEL-1653) clobber option for FileComponent

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Please comment in the JIRA as mails in the dev forum gets kinda lost over time.


On Fri, May 29, 2009 at 1:03 PM, Joe Gottman <jo...@comcast.net> wrote:
>
>
>
> JIRA jira@apache.org wrote:
>>
>>
>>     [
>> https://issues.apache.org/activemq/browse/CAMEL-1653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=51973#action_51973
>> ]
>>
>> Claus Ibsen commented on CAMEL-1653:
>> ------------------------------------
>>
>> Good idea. I think I will give this option an overhaul and introduce an
>> enum to choose what you want
>>
>> What we have now:
>> - override
>> - append
>>
>> And these additional options (if existing file exists):
>> - fail
>> - ignore
>> - rename original file
>> - write with a new filename (postfixed with _camel or something, leaving
>> original file)
>>
>
>   The rename original and write with a new filename options should be
> repeatable, in case they result in a name collision as well.  So maybe when
> we write to new filename, if foo.txt fails we try foo2.txt, then foo3.txt,
> etc.  Similarly, if we need to move an original foo.txt, we move it to
> foo2.txt, and if there is already a foo2.txt we move that to foo3.txt.  In
> either case we would probably want to have a plugable strategy so users can
> decide on there own renaming policy.
>
> --
> View this message in context: http://www.nabble.com/-jira--Created%3A-%28CAMEL-1653%29-clobber-option-for-FileComponent-tp23754402p23778035.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: [jira] Commented: (CAMEL-1653) clobber option for FileComponent

Posted by Joe Gottman <jo...@comcast.net>.


JIRA jira@apache.org wrote:
> 
> 
>     [
> https://issues.apache.org/activemq/browse/CAMEL-1653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=51973#action_51973
> ] 
> 
> Claus Ibsen commented on CAMEL-1653:
> ------------------------------------
> 
> Good idea. I think I will give this option an overhaul and introduce an
> enum to choose what you want
> 
> What we have now:
> - override
> - append
> 
> And these additional options (if existing file exists):
> - fail
> - ignore
> - rename original file
> - write with a new filename (postfixed with _camel or something, leaving
> original file)
> 

   The rename original and write with a new filename options should be
repeatable, in case they result in a name collision as well.  So maybe when
we write to new filename, if foo.txt fails we try foo2.txt, then foo3.txt,
etc.  Similarly, if we need to move an original foo.txt, we move it to
foo2.txt, and if there is already a foo2.txt we move that to foo3.txt.  In
either case we would probably want to have a plugable strategy so users can
decide on there own renaming policy.

-- 
View this message in context: http://www.nabble.com/-jira--Created%3A-%28CAMEL-1653%29-clobber-option-for-FileComponent-tp23754402p23778035.html
Sent from the Camel Development mailing list archive at Nabble.com.


[jira] Assigned: (CAMEL-1653) clobber option for FileComponent

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-1653:
----------------------------------

    Assignee: Claus Ibsen

> clobber option for FileComponent
> --------------------------------
>
>                 Key: CAMEL-1653
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1653
>             Project: Apache Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.0.0
>            Reporter: Joe Gottman
>            Assignee: Claus Ibsen
>            Priority: Minor
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-1653) clobber option for FileComponent

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1653?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-1653.
--------------------------------

    Resolution: Fixed

Lets keep it to the 4 types for now, as we should focus on getting Camel 2.0 out of the door before mid summer.

In the future we can add strategy interface for easier plugin of custom code to determine what to do.

> clobber option for FileComponent
> --------------------------------
>
>                 Key: CAMEL-1653
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1653
>             Project: Apache Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.0.0
>            Reporter: Joe Gottman
>            Assignee: Claus Ibsen
>            Priority: Minor
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1653) clobber option for FileComponent

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=51975#action_51975 ] 

Claus Ibsen commented on CAMEL-1653:
------------------------------------

What would a good default be for this option?

Before we had append as the default.
But would it make more sense to change to a new default such as:

- Fail
or
- Override

Any thoughts?

> clobber option for FileComponent
> --------------------------------
>
>                 Key: CAMEL-1653
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1653
>             Project: Apache Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.0.0
>            Reporter: Joe Gottman
>            Assignee: Claus Ibsen
>            Priority: Minor
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1653) clobber option for FileComponent

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=51977#action_51977 ] 

Claus Ibsen commented on CAMEL-1653:
------------------------------------

trunk: 779924.

Added a new {{fileExist}} option with 4 options
- Override
- Append
- Fail
- Ignore

Override is now default.

Also added the Append feature to the FTP component as it only supported Override before.


> clobber option for FileComponent
> --------------------------------
>
>                 Key: CAMEL-1653
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1653
>             Project: Apache Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.0.0
>            Reporter: Joe Gottman
>            Assignee: Claus Ibsen
>            Priority: Minor
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1653) clobber option for FileComponent

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=51973#action_51973 ] 

Claus Ibsen commented on CAMEL-1653:
------------------------------------

Good idea. I think I will give this option an overhaul and introduce an enum to choose what you want

What we have now:
- override
- append

And these additional options (if existing file exists):
- fail
- ignore
- rename original file
- write with a new filename (postfixed with _camel or something, leaving original file)

> clobber option for FileComponent
> --------------------------------
>
>                 Key: CAMEL-1653
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1653
>             Project: Apache Camel
>          Issue Type: New Feature
>          Components: camel-core
>    Affects Versions: 2.0.0
>            Reporter: Joe Gottman
>            Assignee: Claus Ibsen
>            Priority: Minor
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.