Modified: websites/production/camel/content/file2.html
==============================================================================
--- websites/production/camel/content/file2.html (original)
+++ websites/production/camel/content/file2.html Wed Jan 30 16:25:24 2013
@@ -131,7 +131,7 @@ Notice from <b>Camel 2.10</b> onwards th
 
 <h4><a shape="rect" name="File2-Producer"></a>Producer</h4>
 <div class="confluenceTableSmall"><div class="table-wrap">
-<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"> Name </th><th colspan="1" rowspan="1" 
class="confluenceTh"> Default Value </th><th colspan="1" rowspan="1" 
class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>fileExist</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>Override</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> What to do if a file already exists with the same name. 
The following values can be specified: <b>Override</b>, <b>Append</b>, 
<b>Fail</b>, <b>Ignore</b>, and <tt><b>Move</b></tt>. <tt>Override</tt>, which 
is the default, replaces the existing file. <tt>Append</tt> adds content to the 
existing file. <tt>Fail</tt> throws a <tt>GenericFileOperationException</tt>, 
indicating that there is already an existing file. <tt>Ignore</tt> silently 
ignores the problem and <b>does not</b> override the existing file, but assumes 
everything is okay. The <
 tt>Move</tt> option requires <b>Camel 2.10.1</b> onwards, and the 
corresponding <tt>moveExisting</tt> option to be configured as well. The option 
<tt>eagerDeleteTargetFile</tt> can be used to control what to do if an moving 
the file, and there exists already an existing file, otherwise causing the move 
operation to fail. The <tt>Move</tt> option will move any existing files, 
before writing the target file. </td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>tempPrefix</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> This option is used to write the file using a temporary 
name and then, after the write is complete, rename it to the real name. Can be 
used to identify files being written and also avoid consumers (not using 
exclusive read locks) reading in progress files. Is often used by <a 
shape="rect" href="ftp2.html" title="FTP2">FTP</a> when uploading big files. 
</td></tr><tr><td
  colspan="1" rowspan="1" class="confluenceTd"> <tt>tempFileName</tt> </td><td 
colspan="1" rowspan="1" class="confluenceTd"> <tt>null</tt> </td><td 
colspan="1" rowspan="1" class="confluenceTd"> <b>Camel 2.1:</b> The <b>same</b> 
as <tt>tempPrefix</tt> option but offering a more fine grained control on the 
naming of the temporary filename as it uses the <a shape="rect" 
href="file-language.html" title="File Language">File Language</a>. 
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>moveExisting</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>null</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>Camel 
2.10.1:</b> <a shape="rect" href="expression.html" 
title="Expression">Expression</a> (such as <a shape="rect" 
href="file-language.html" title="File Language">File Language</a>) used to 
compute file name to use when <tt>fileExist=Move</tt> is configured. To move 
files into a <tt>backup</tt> subdirectory just enter <tt>backup</tt>. Th
 is option only supports the following <a shape="rect" 
href="file-language.html" title="File Language">File Language</a> tokens: 
"file:name", "file:name.ext", "file:name.noext", "file:onlyname", 
"file:onlyname.noext", "file:ext", and "file:parent". Notice the "file:parent" 
is not supported by the <a shape="rect" href="ftp2.html" title="FTP2">FTP</a> 
component, as the FTP component can only move any existing files to a relative 
directory based on current dir as base. </td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>keepLastModified</tt> </td><td 
colspan="1" rowspan="1" class="confluenceTd"> <tt>false</tt> </td><td 
colspan="1" rowspan="1" class="confluenceTd"> <b>Camel 2.2:</b> Will keep the 
last modified timestamp from the source file (if any). Will use the 
<tt>Exchange.FILE_LAST_MODIFIED</tt> header to located the timestamp. This 
header can contain either a <tt>java.util.Date</tt> or <tt>long</tt> with the 
timestamp. If the timestamp exists and the option i
 s enabled it will set this timestamp on the written file. <b>Note:</b> This 
option only applies to the <b>file</b> producer. You <em>cannot</em> use this 
option with any of the ftp producers. </td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>eagerDeleteTargetFile</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>true</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <b>Camel 2.3:</b> Whether or not to eagerly 
delete any existing target file. This option only applies when you use 
<tt>fileExists=Override</tt> and the <tt>tempFileName</tt> option as well. You 
can use this to disable (set it to false) deleting the target file before the 
temp file is written. For example you may write big files and want the target 
file to exists during the temp file is being written. This ensure the target 
file is only deleted until the very last moment, just before the temp file is 
being renamed to the target filename. From <b>Camel 2.10.1</b> onwards th
 is option is also used to control whether to delete any existing files when 
<tt>fileExist=Move</tt> is enabled, and an existing file exists. If this option 
is false, then an exception will be thrown if an existing file existed, if its 
true, then the existing file is deleted before the move operation. 
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>doneFileName</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>null</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>Camel 
2.6:</b> If provided, then Camel will write a 2nd <em>done</em> file when the 
original file has been written. The <em>done</em> file will be empty. This 
option configures what file name to use. Either you can specify a fixed name. 
Or you can use dynamic placeholders. The <em>done</em> file will <b>always</b> 
be written in the same folder as the original file. See <em>writing done 
file</em> section for examples. </td></tr><tr><td colspan="1" rowspan="1" 
class="conf
 luenceTd"><tt>allowNullBody</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> false </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.10.1:</b> Used to specify if a null body is 
allowed during file writing. If set to true then an empty file will be created, 
when set to false, and attempting to send a null body to the file component, a 
GenericFileWriteException of 'Cannot write null body to file.' will be thrown. 
If the `fileExist` option is set to 'Override', then the file will be 
truncated, and if set to `append` the file will remain unchanged. 
</td></tr></tbody></table>
+<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"> Name </th><th colspan="1" rowspan="1" 
class="confluenceTh"> Default Value </th><th colspan="1" rowspan="1" 
class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>fileExist</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>Override</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> What to do if a file already exists with the same name. 
The following values can be specified: <b>Override</b>, <b>Append</b>, 
<b>Fail</b>, <b>Ignore</b>, and <tt><b>Move</b></tt>. <tt>Override</tt>, which 
is the default, replaces the existing file. <tt>Append</tt> adds content to the 
existing file. <tt>Fail</tt> throws a <tt>GenericFileOperationException</tt>, 
indicating that there is already an existing file. <tt>Ignore</tt> silently 
ignores the problem and <b>does not</b> override the existing file, but assumes 
everything is okay. The <
 tt>Move</tt> option requires <b>Camel 2.10.1</b> onwards, and the 
corresponding <tt>moveExisting</tt> option to be configured as well. The option 
<tt>eagerDeleteTargetFile</tt> can be used to control what to do if an moving 
the file, and there exists already an existing file, otherwise causing the move 
operation to fail. The <tt>Move</tt> option will move any existing files, 
before writing the target file. </td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>tempPrefix</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> This option is used to write the file using a temporary 
name and then, after the write is complete, rename it to the real name. Can be 
used to identify files being written and also avoid consumers (not using 
exclusive read locks) reading in progress files. Is often used by <a 
shape="rect" href="ftp2.html" title="FTP2">FTP</a> when uploading big files. 
</td></tr><tr><td
  colspan="1" rowspan="1" class="confluenceTd"> <tt>tempFileName</tt> </td><td 
colspan="1" rowspan="1" class="confluenceTd"> <tt>null</tt> </td><td 
colspan="1" rowspan="1" class="confluenceTd"> <b>Camel 2.1:</b> The <b>same</b> 
as <tt>tempPrefix</tt> option but offering a more fine grained control on the 
naming of the temporary filename as it uses the <a shape="rect" 
href="file-language.html" title="File Language">File Language</a>. 
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>moveExisting</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>null</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>Camel 
2.10.1:</b> <a shape="rect" href="expression.html" 
title="Expression">Expression</a> (such as <a shape="rect" 
href="file-language.html" title="File Language">File Language</a>) used to 
compute file name to use when <tt>fileExist=Move</tt> is configured. To move 
files into a <tt>backup</tt> subdirectory just enter <tt>backup</tt>. Th
 is option only supports the following <a shape="rect" 
href="file-language.html" title="File Language">File Language</a> tokens: 
"file:name", "file:name.ext", "file:name.noext", "file:onlyname", 
"file:onlyname.noext", "file:ext", and "file:parent". Notice the "file:parent" 
is not supported by the <a shape="rect" href="ftp2.html" title="FTP2">FTP</a> 
component, as the FTP component can only move any existing files to a relative 
directory based on current dir as base. </td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>keepLastModified</tt> </td><td 
colspan="1" rowspan="1" class="confluenceTd"> <tt>false</tt> </td><td 
colspan="1" rowspan="1" class="confluenceTd"> <b>Camel 2.2:</b> Will keep the 
last modified timestamp from the source file (if any). Will use the 
<tt>Exchange.FILE_LAST_MODIFIED</tt> header to located the timestamp. This 
header can contain either a <tt>java.util.Date</tt> or <tt>long</tt> with the 
timestamp. If the timestamp exists and the option i
 s enabled it will set this timestamp on the written file. <b>Note:</b> This 
option only applies to the <b>file</b> producer. You <em>cannot</em> use this 
option with any of the ftp producers. </td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>eagerDeleteTargetFile</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>true</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <b>Camel 2.3:</b> Whether or not to eagerly 
delete any existing target file. This option only applies when you use 
<tt>fileExists=Override</tt> and the <tt>tempFileName</tt> option as well. You 
can use this to disable (set it to false) deleting the target file before the 
temp file is written. For example you may write big files and want the target 
file to exists during the temp file is being written. This ensure the target 
file is only deleted until the very last moment, just before the temp file is 
being renamed to the target filename. From <b>Camel 2.10.1</b> onwards th
 is option is also used to control whether to delete any existing files when 
<tt>fileExist=Move</tt> is enabled, and an existing file exists. If this option 
is false, then an exception will be thrown if an existing file existed, if its 
true, then the existing file is deleted before the move operation. 
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>doneFileName</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>null</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> <b>Camel 
2.6:</b> If provided, then Camel will write a 2nd <em>done</em> file when the 
original file has been written. The <em>done</em> file will be empty. This 
option configures what file name to use. Either you can specify a fixed name. 
Or you can use dynamic placeholders. The <em>done</em> file will <b>always</b> 
be written in the same folder as the original file. See <em>writing done 
file</em> section for examples. </td></tr><tr><td colspan="1" rowspan="1" 
class="conf
 luenceTd"><tt>allowNullBody</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> false </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.10.1:</b> Used to specify if a null body is 
allowed during file writing. If set to true then an empty file will be created, 
when set to false, and attempting to send a null body to the file component, a 
GenericFileWriteException of 'Cannot write null body to file.' will be thrown. 
If the `fileExist` option is set to 'Override', then the file will be 
truncated, and if set to `append` the file will remain unchanged. 
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>overruleFileName</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.11:</b> Used to overrule any existing file 
name header, and use this option to compute the file name to produce. Notice 
that if the <a shape="rect" href="exchange.html" title="Exchange">
 Exchange</a> has a header with the key <tt>Exchange.OVERRULE_FILE_NAME</tt> 
then that header take precedence. If the header is absent then this option is 
used. If this option is <tt>null</tt>, then the header 
<tt>Exchange.FILE_NAME</tt> is used, and if that is empty, then an unique name 
is generated. Notice if the <a shape="rect" href="exchange.html" 
title="Exchange">Exchange</a> has the header 
<tt>Exchange.OVERRULE_FILE_NAME</tt> then that header is removed after usage, 
as its meant for being used once only. The purpose of this option is to make it 
easier to pickup files and send them to an endpoint, and overrule the file, to 
write the file using another name, but preserved the existing name, when 
continued routing in Camel. </td></tr></tbody></table>
 </div>
 </div>
 
@@ -204,7 +204,7 @@ move=backup/${date:now:yyyyMMdd}/${file:
 
 <h4><a shape="rect" name="File2-Fileproduceronly"></a>File producer only</h4>
 <div class="confluenceTableSmall"><div class="table-wrap">
-<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"> Header </th><th colspan="1" rowspan="1" 
class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>CamelFileName</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Specifies the name of the file to write (relative to the 
endpoint directory). The name can be a <tt>String</tt>; a <tt>String</tt> with 
a <a shape="rect" href="file-language.html" title="File Language">File 
Language</a> or <a shape="rect" href="simple.html" title="Simple">Simple</a> 
expression; or an <a shape="rect" href="expression.html" 
title="Expression">Expression</a> object. If it's <tt>null</tt> then Camel will 
auto-generate a filename based on the message unique ID. </td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"> <tt>CamelFileNameProduced</tt> 
</td><td colspan="1" rowspan="1" class="confluenceTd"> The actual absolute 
filepath (path + name) for the ou
 tput file that was written. This header is set by Camel and its purpose is 
providing end-users with the name of the file that was written. 
</td></tr></tbody></table>
+<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"> Header </th><th colspan="1" rowspan="1" 
class="confluenceTh"> Description </th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>CamelFileName</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Specifies the name of the file to write (relative to the 
endpoint directory). The name can be a <tt>String</tt>; a <tt>String</tt> with 
a <a shape="rect" href="file-language.html" title="File Language">File 
Language</a> or <a shape="rect" href="simple.html" title="Simple">Simple</a> 
expression; or an <a shape="rect" href="expression.html" 
title="Expression">Expression</a> object. If it's <tt>null</tt> then Camel will 
auto-generate a filename based on the message unique ID. </td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"> <tt>CamelFileNameProduced</tt> 
</td><td colspan="1" rowspan="1" class="confluenceTd"> The actual absolute 
filepath (path + name) for the ou
 tput file that was written. This header is set by Camel and its purpose is 
providing end-users with the name of the file that was written. 
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>CamelOverruleFileName</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.11:</b> Is used for overruling any existing 
file name strategy and use the value as the file name to write. The value can 
be a <a shape="rect" href="file-language.html" title="File Language">File 
Language</a> expression, as a String value for dynamic file names, or a 
constant fixed name as a String. </td></tr></tbody></table>
 </div>
 </div>
 
@@ -414,6 +414,14 @@ from(<span class="code-quote">"file:<spa
 </pre>
 </div></div>
 
+<h4><a shape="rect" 
name="File2-Readfromadirectoryandwritetoanotherdirectoryusingaoverruledynamicname"></a>Read
 from a directory and write to another directory using a overrule dynamic 
name</h4>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:<span 
class="code-comment">//inputdir/?delete=<span 
class="code-keyword">true</span>"</span>).to(<span 
class="code-quote">"file://outputdir?overruleFile=copy-of-${file:name}"</span>)</span>
+</pre>
+</div></div>
+
 <p>Listen on a directory and create a message for each file dropped there. 
Copy the contents to the <tt>outputdir</tt> and delete the file in the 
<tt>inputdir</tt>.</p>
 
 <h4><a shape="rect" 
name="File2-Readingrecursivelyfromadirectoryandwritingtoanother"></a>Reading 
recursively from a directory and writing to another</h4>


Reply via email to