camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen" ...@silverbullet.dk>
Subject FileComponent - Confusing with filenames - Proposed changes for Camel 1.4
Date Sun, 25 May 2008 13:28:06 GMT
Hi

The Camel File Component has a weak spot in my mind
- it uses random direcotries and filenames out-of-the-box

What does that mean?
Well if you do not configure the endpoint carefully you end up with Camel auto creating some
strange folder names and output names when producing files. This leads to confusion.
The problem is that if you have not configured a header property on the message then Camel
will default to use message id that defaults as a UUID generated id.

So you end up with filenames stored as: ID-MACHINENAME\2443-1211718892437\1-0 for a route
you have configured as:
from("direct:report").to( "file:target/reports/report.txt");

When you would expect the file to be saved in report.txt but you end up having:
\target\reports\report.txt\ ID-MACHINENAME\2443-1211718892437\1-0

But you wanted Camel to store it in report.txt.

The problem is that the option autoCreated is default to true.
So Camel will auto create the directory path: target/reports/report.txt as a directory. So
you have: /target/reports/report.txt/ as a directory.
The human eye would identify report.txt as a filename and not a directory but Camel does not.
And since the end-user did not set this HEADER_FILENAME message property we get those dreadful
unique folder and filename.


So I would like to discuss if we could change some of this in Camel 1.4?`

I propose to
============
1) remove the unique message ID for filenames, instead end users want out-of-the-box pattern
styles unique names such as DDDDMMYYHHMMSS, NNNNNN for either folder and/or fileanames. NNNN
= number incrementer, etc. etc.
2) and easy way to configure or set your own strategy class for computing the filename (instead
of only the HEADER_FILENAME)
3) autoCreate should be changed to false as default option
4) FileProducer should thrown an exception if the filename has not been configured instead
of using a UUID filename
5) new option to set the filename, and let the uri path be the folder, then its much easier
for autocreate to only create the folder and not also the filename as a folder.


What are your thoughts?


Med venlig hilsen

Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk


Mime
View raw message