Author: buildbot
Date: Wed Apr 25 15:21:28 2012
New Revision: 814413

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/book-component-appendix.html
    websites/production/camel/content/book-in-one-page.html
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/file2.html

Modified: websites/production/camel/content/book-component-appendix.html
==============================================================================
--- websites/production/camel/content/book-component-appendix.html (original)
+++ websites/production/camel/content/book-component-appendix.html Wed Apr 25 
15:21:28 2012
@@ -3642,7 +3642,7 @@ Also, the starting directory must not co
 
 <h4><a shape="rect" name="BookComponentAppendix-Common"></a>Common</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>autoCreate</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Automatically create missing directories in the file's 
pathname. For the file consumer, that means creating the starting directory. 
For the file producer, it means the directory the files should be written to. 
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>bufferSize</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> 
128kb </td><td colspan="1" rowspan="1" class="confluenceTd"> Write buffer sized 
in bytes. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>fileName</tt> </td><td colspan="1" rowspa
 n="1" class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Use <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> to 
dynamically set the filename. For consumers, it's used as a filename filter. 
For producers, it's used to evaluate the filename to write. If an expression is 
set, it take precedence over the <tt>CamelFileName</tt> header. (<b>Note:</b> 
The header itself can also be an <a shape="rect" href="expression.html" 
title="Expression">Expression</a>). The expression options support both 
<tt>String</tt> and <tt>Expression</tt> types. If the expression is a 
<tt>String</tt> type, it is <b>always</b> evaluated using the <a shape="rect" 
href="file-language.html" title="File Language">File Language</a>. If the 
expression is an <tt>Expression</tt> type, the specified <tt>Expression</tt> 
type is used - this allows you, for instance
 , to use <a shape="rect" href="ognl.html" title="OGNL">OGNL</a> expressions. 
For the consumer, you can use it to filter filenames, so you can for instance 
consume today's file using the <a shape="rect" href="file-language.html" 
title="File Language">File Language</a> syntax: 
<tt>mydata-${date:now:yyyyMMdd}.txt</tt>. </td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>flatten</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>false</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> Flatten is used to flatten the file name path 
to strip any leading paths, so it's just the file name. This allows you to 
consume recursively into sub-directories, but when you eg write the files to 
another directory they will be written in a single directory. Setting this to 
<tt>true</tt> on the producer enforces that any file name recived in 
<tt>CamelFileName</tt> header will be stripped for any leading paths. 
</td></tr><tr><td colspan="1" rowspan="1" class="c
 onfluenceTd"> <tt>charset</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.5:</b> this option is used to specify the 
encoding of the file, and camel will set the Exchange property with 
Exchange.CHARSET_NAME with the value of this option. </td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"> 
<tt>copyAndDeleteOnRenameFail</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.9</b>: whether to fallback and do a copy and 
delete file, in case the file could not be renamed directly. This option is not 
available for the <a shape="rect" href="ftp2.html" title="FTP2">FTP</a> 
component. </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>autoCreate</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Automatically create missing directories in the file's 
pathname. For the file consumer, that means creating the starting directory. 
For the file producer, it means the directory the files should be written to. 
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>bufferSize</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> 
128kb </td><td colspan="1" rowspan="1" class="confluenceTd"> Write buffer sized 
in bytes. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>fileName</tt> </td><td colspan="1" rowspa
 n="1" class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Use <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> to 
dynamically set the filename. For consumers, it's used as a filename filter. 
For producers, it's used to evaluate the filename to write. If an expression is 
set, it take precedence over the <tt>CamelFileName</tt> header. (<b>Note:</b> 
The header itself can also be an <a shape="rect" href="expression.html" 
title="Expression">Expression</a>). The expression options support both 
<tt>String</tt> and <tt>Expression</tt> types. If the expression is a 
<tt>String</tt> type, it is <b>always</b> evaluated using the <a shape="rect" 
href="file-language.html" title="File Language">File Language</a>. If the 
expression is an <tt>Expression</tt> type, the specified <tt>Expression</tt> 
type is used - this allows you, for instance
 , to use <a shape="rect" href="ognl.html" title="OGNL">OGNL</a> expressions. 
For the consumer, you can use it to filter filenames, so you can for instance 
consume today's file using the <a shape="rect" href="file-language.html" 
title="File Language">File Language</a> syntax: 
<tt>mydata-${date:now:yyyyMMdd}.txt</tt>. </td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>flatten</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>false</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> Flatten is used to flatten the file name path 
to strip any leading paths, so it's just the file name. This allows you to 
consume recursively into sub-directories, but when you eg write the files to 
another directory they will be written in a single directory. Setting this to 
<tt>true</tt> on the producer enforces that any file name recived in 
<tt>CamelFileName</tt> header will be stripped for any leading paths. 
</td></tr><tr><td colspan="1" rowspan="1" class="c
 onfluenceTd"> <tt>charset</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.9.3:</b> this option is used to specify the 
encoding of the file, and camel will set the Exchange property with 
<tt>Exchange.CHARSET_NAME</tt> with the value of this option. You can use this 
on the consumer, to specify the encodings of the files, which allow Camel to 
know the charset it should load the file content in case the file content is 
being accessed. Likewise when writing a file, you can use this option to 
specify which charset to write the file as well. See further below for a 
examples and more important details. </td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>copyAndDeleteOnRenameFail</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>true</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <b>Camel 2.9</b>: whether to fallback and do 
a copy and delete file, in 
 case the file could not be renamed directly. This option is not available for 
the <a shape="rect" href="ftp2.html" title="FTP2">FTP</a> component. 
</td></tr></tbody></table>
 </div>
 </div>
 
@@ -3756,6 +3756,70 @@ move=backup/${date:now:yyyyMMdd}/${file:
 
 <p>This allows you for instance to know how many files exists in this batch 
and for instance let the <a shape="rect" href="aggregator2.html" 
title="Aggregator2">Aggregator2</a> aggregate this number of files.</p>
 
+<h3><a shape="rect" name="BookComponentAppendix-Usingcharset"></a>Using 
charset</h3>
+<p><b>Available as of Camel 2.9.3</b> <br clear="none">
+The charset option allows to configure an encoding of the files on both the 
consumer and producer endpoints. For example if you read utf-8 files, and want 
to convert the files to iso-8859-1, you can do:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox?charset=utf-8"</span>)
+  .to(<span class="code-quote">"file:outbox?charset=iso-8859-1"</span>)
+</pre>
+</div></div>
+
+<p>You can also use the <tt>convertBodyTo</tt> in the route. In the example 
below we have still input files in utf-8 format, but we want to convert the 
file content to a byte array in iso-8859-1 format. And then let a bean process 
the data. Before writing the content to the outbox folder using the current 
charset.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox?charset=utf-8"</span>)
+  .convertBodyTo(<span class="code-object">byte</span>[].class, <span 
class="code-quote">"iso-8859-1"</span>)
+  .to(<span class="code-quote">"bean:myBean"</span>)
+  .to(<span class="code-quote">"file:outbox"</span>);
+</pre>
+</div></div>
+
+<p>If you omit the charset on the consumer endpoint, then Camel does not know 
the charset of the file, and would by default use "UTF-8". However you can 
configure a JVM system property to override and use a different default 
encoding with the key <tt>org.apache.camel.default.charset</tt>.</p>
+
+<p>In the example below this could be a problem if the files is not in UTF-8 
encoding, which would be the default encoding for read the files.<br 
clear="none">
+In this example when writing the files, the content has already been converted 
to a byte array, and thus would write the content directly as is (without any 
further encodings).</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox"</span>)
+  .convertBodyTo(<span class="code-object">byte</span>[].class, <span 
class="code-quote">"iso-8859-1"</span>)
+  .to(<span class="code-quote">"bean:myBean"</span>)
+  .to(<span class="code-quote">"file:outbox"</span>);
+</pre>
+</div></div>
+
+<p>You can also override and control the encoding dynamic when writing files, 
by setting a property on the exchange with the key 
<tt>Exchange.CHARSET_NAME</tt>. For example in the route below we set the 
property with a value from a message header.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox"</span>)
+  .convertBodyTo(<span class="code-object">byte</span>[].class, <span 
class="code-quote">"iso-8859-1"</span>)
+  .to(<span class="code-quote">"bean:myBean"</span>)
+  .setProperty(Exchange.CHARSET_NAME, header(<span 
class="code-quote">"someCharsetHeader"</span>))
+  .to(<span class="code-quote">"file:outbox"</span>);
+</pre>
+</div></div>
+
+<p>We suggest to keep things simpler, so if you pickup files with the same 
encoding, and want to write the files in a specific encoding, then favor to use 
the <tt>charset</tt> option on the endpoints.</p>
+
+<p>Notice that if you have explicit configured a <tt>charset</tt> option on 
the endpoint, then that configuration is used, regardless of the 
<tt>Exchange.CHARSET_NAME</tt> property.</p>
+
+<p>If you have some issues then you can enable DEBUG logging on 
<tt>org.apache.camel.component.file</tt>, and Camel logs when it reads/write a 
file using a specific charset.<br clear="none">
+For example the route below will log the following:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox?charset=utf-8"</span>)
+  .to(<span class="code-quote">"file:outbox?charset=iso-8859-1"</span>)
+</pre>
+</div></div>
+<p>And the logs:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+DEBUG GenericFileConverter           - Read file 
/Users/davsclaus/workspace/camel/camel-core/target/charset/input/input.txt with 
charset utf-8
+DEBUG FileOperations                 - Using Reader to write file: 
target/charset/output.txt with charset: iso-8859-1
+</pre>
+</div></div>
 
 <h3><a shape="rect" 
name="BookComponentAppendix-Commongotchaswithfolderandfilenames"></a>Common 
gotchas with folder and filenames</h3>
 
@@ -4351,7 +4415,7 @@ you need to implement a custom <tt>Excep
  * Custom {@link ExceptionHandler} to be used on the file consumer, to send
  * exceptions to a Camel route, to let Camel deal with the error.
  */
-<span class="code-keyword">private</span> class MyExceptionHandler <span 
class="code-keyword">implements</span> ExceptionHandler {
+<span class="code-keyword">private</span> <span 
class="code-keyword">static</span> class MyExceptionHandler <span 
class="code-keyword">implements</span> ExceptionHandler {
 
     <span class="code-keyword">private</span> ProducerTemplate template;
 
@@ -8007,11 +8071,7 @@ jcr:<span class="code-comment">//user:pa
 
 <h3><a shape="rect" name="BookComponentAppendix-Example"></a>Example</h3>
 <p>The snippet below creates a node named <tt>node</tt> under the 
<tt>/home/test</tt> node in the content repository.  One additional attribute 
is added to the node as well: <tt>my.contents.property</tt> which will contain 
the body of the message being sent.</p>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-java">from(<span 
class="code-quote">"direct:a"</span>).setProperty(JcrConstants.JCR_NODE_NAME, 
constant(<span class="code-quote">"node"</span>))
-    .setProperty(<span class="code-quote">"my.contents.property"</span>, 
body()).to(<span class="code-quote">"jcr:<span 
class="code-comment">//user:pass@repository/home/test"</span>);</span>
-</pre>
-</div></div>
+<div class="error"><span class="error">Error formatting macro: snippet: 
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>
 
 <h3><a shape="rect" name="BookComponentAppendix-SeeAlso"></a>See Also</h3>
 <ul><li><a shape="rect" href="configuring-camel.html" title="Configuring 
Camel">Configuring Camel</a></li><li><a shape="rect" href="component.html" 
title="Component">Component</a></li><li><a shape="rect" href="endpoint.html" 
title="Endpoint">Endpoint</a></li><li><a shape="rect" 
href="getting-started.html" title="Getting Started">Getting 
Started</a></li></ul>

Modified: websites/production/camel/content/book-in-one-page.html
==============================================================================
--- websites/production/camel/content/book-in-one-page.html (original)
+++ websites/production/camel/content/book-in-one-page.html Wed Apr 25 15:21:28 
2012
@@ -23852,7 +23852,7 @@ Also, the starting directory must not co
 
 <h4><a shape="rect" name="BookInOnePage-Common"></a>Common</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>autoCreate</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Automatically create missing directories in the file's 
pathname. For the file consumer, that means creating the starting directory. 
For the file producer, it means the directory the files should be written to. 
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>bufferSize</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> 
128kb </td><td colspan="1" rowspan="1" class="confluenceTd"> Write buffer sized 
in bytes. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>fileName</tt> </td><td colspan="1" rowspa
 n="1" class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Use <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> to 
dynamically set the filename. For consumers, it's used as a filename filter. 
For producers, it's used to evaluate the filename to write. If an expression is 
set, it take precedence over the <tt>CamelFileName</tt> header. (<b>Note:</b> 
The header itself can also be an <a shape="rect" href="expression.html" 
title="Expression">Expression</a>). The expression options support both 
<tt>String</tt> and <tt>Expression</tt> types. If the expression is a 
<tt>String</tt> type, it is <b>always</b> evaluated using the <a shape="rect" 
href="file-language.html" title="File Language">File Language</a>. If the 
expression is an <tt>Expression</tt> type, the specified <tt>Expression</tt> 
type is used - this allows you, for instance
 , to use <a shape="rect" href="ognl.html" title="OGNL">OGNL</a> expressions. 
For the consumer, you can use it to filter filenames, so you can for instance 
consume today's file using the <a shape="rect" href="file-language.html" 
title="File Language">File Language</a> syntax: 
<tt>mydata-${date:now:yyyyMMdd}.txt</tt>. </td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>flatten</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>false</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> Flatten is used to flatten the file name path 
to strip any leading paths, so it's just the file name. This allows you to 
consume recursively into sub-directories, but when you eg write the files to 
another directory they will be written in a single directory. Setting this to 
<tt>true</tt> on the producer enforces that any file name recived in 
<tt>CamelFileName</tt> header will be stripped for any leading paths. 
</td></tr><tr><td colspan="1" rowspan="1" class="c
 onfluenceTd"> <tt>charset</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.5:</b> this option is used to specify the 
encoding of the file, and camel will set the Exchange property with 
Exchange.CHARSET_NAME with the value of this option. </td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"> 
<tt>copyAndDeleteOnRenameFail</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.9</b>: whether to fallback and do a copy and 
delete file, in case the file could not be renamed directly. This option is not 
available for the <a shape="rect" href="ftp2.html" title="FTP2">FTP</a> 
component. </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>autoCreate</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Automatically create missing directories in the file's 
pathname. For the file consumer, that means creating the starting directory. 
For the file producer, it means the directory the files should be written to. 
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>bufferSize</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> 
128kb </td><td colspan="1" rowspan="1" class="confluenceTd"> Write buffer sized 
in bytes. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>fileName</tt> </td><td colspan="1" rowspa
 n="1" class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Use <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> to 
dynamically set the filename. For consumers, it's used as a filename filter. 
For producers, it's used to evaluate the filename to write. If an expression is 
set, it take precedence over the <tt>CamelFileName</tt> header. (<b>Note:</b> 
The header itself can also be an <a shape="rect" href="expression.html" 
title="Expression">Expression</a>). The expression options support both 
<tt>String</tt> and <tt>Expression</tt> types. If the expression is a 
<tt>String</tt> type, it is <b>always</b> evaluated using the <a shape="rect" 
href="file-language.html" title="File Language">File Language</a>. If the 
expression is an <tt>Expression</tt> type, the specified <tt>Expression</tt> 
type is used - this allows you, for instance
 , to use <a shape="rect" href="ognl.html" title="OGNL">OGNL</a> expressions. 
For the consumer, you can use it to filter filenames, so you can for instance 
consume today's file using the <a shape="rect" href="file-language.html" 
title="File Language">File Language</a> syntax: 
<tt>mydata-${date:now:yyyyMMdd}.txt</tt>. </td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>flatten</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>false</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> Flatten is used to flatten the file name path 
to strip any leading paths, so it's just the file name. This allows you to 
consume recursively into sub-directories, but when you eg write the files to 
another directory they will be written in a single directory. Setting this to 
<tt>true</tt> on the producer enforces that any file name recived in 
<tt>CamelFileName</tt> header will be stripped for any leading paths. 
</td></tr><tr><td colspan="1" rowspan="1" class="c
 onfluenceTd"> <tt>charset</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.9.3:</b> this option is used to specify the 
encoding of the file, and camel will set the Exchange property with 
<tt>Exchange.CHARSET_NAME</tt> with the value of this option. You can use this 
on the consumer, to specify the encodings of the files, which allow Camel to 
know the charset it should load the file content in case the file content is 
being accessed. Likewise when writing a file, you can use this option to 
specify which charset to write the file as well. See further below for a 
examples and more important details. </td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>copyAndDeleteOnRenameFail</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>true</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <b>Camel 2.9</b>: whether to fallback and do 
a copy and delete file, in 
 case the file could not be renamed directly. This option is not available for 
the <a shape="rect" href="ftp2.html" title="FTP2">FTP</a> component. 
</td></tr></tbody></table>
 </div>
 </div>
 
@@ -23966,6 +23966,70 @@ move=backup/${date:now:yyyyMMdd}/${file:
 
 <p>This allows you for instance to know how many files exists in this batch 
and for instance let the <a shape="rect" href="aggregator2.html" 
title="Aggregator2">Aggregator2</a> aggregate this number of files.</p>
 
+<h3><a shape="rect" name="BookInOnePage-Usingcharset"></a>Using charset</h3>
+<p><b>Available as of Camel 2.9.3</b> <br clear="none">
+The charset option allows to configure an encoding of the files on both the 
consumer and producer endpoints. For example if you read utf-8 files, and want 
to convert the files to iso-8859-1, you can do:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox?charset=utf-8"</span>)
+  .to(<span class="code-quote">"file:outbox?charset=iso-8859-1"</span>)
+</pre>
+</div></div>
+
+<p>You can also use the <tt>convertBodyTo</tt> in the route. In the example 
below we have still input files in utf-8 format, but we want to convert the 
file content to a byte array in iso-8859-1 format. And then let a bean process 
the data. Before writing the content to the outbox folder using the current 
charset.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox?charset=utf-8"</span>)
+  .convertBodyTo(<span class="code-object">byte</span>[].class, <span 
class="code-quote">"iso-8859-1"</span>)
+  .to(<span class="code-quote">"bean:myBean"</span>)
+  .to(<span class="code-quote">"file:outbox"</span>);
+</pre>
+</div></div>
+
+<p>If you omit the charset on the consumer endpoint, then Camel does not know 
the charset of the file, and would by default use "UTF-8". However you can 
configure a JVM system property to override and use a different default 
encoding with the key <tt>org.apache.camel.default.charset</tt>.</p>
+
+<p>In the example below this could be a problem if the files is not in UTF-8 
encoding, which would be the default encoding for read the files.<br 
clear="none">
+In this example when writing the files, the content has already been converted 
to a byte array, and thus would write the content directly as is (without any 
further encodings).</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox"</span>)
+  .convertBodyTo(<span class="code-object">byte</span>[].class, <span 
class="code-quote">"iso-8859-1"</span>)
+  .to(<span class="code-quote">"bean:myBean"</span>)
+  .to(<span class="code-quote">"file:outbox"</span>);
+</pre>
+</div></div>
+
+<p>You can also override and control the encoding dynamic when writing files, 
by setting a property on the exchange with the key 
<tt>Exchange.CHARSET_NAME</tt>. For example in the route below we set the 
property with a value from a message header.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox"</span>)
+  .convertBodyTo(<span class="code-object">byte</span>[].class, <span 
class="code-quote">"iso-8859-1"</span>)
+  .to(<span class="code-quote">"bean:myBean"</span>)
+  .setProperty(Exchange.CHARSET_NAME, header(<span 
class="code-quote">"someCharsetHeader"</span>))
+  .to(<span class="code-quote">"file:outbox"</span>);
+</pre>
+</div></div>
+
+<p>We suggest to keep things simpler, so if you pickup files with the same 
encoding, and want to write the files in a specific encoding, then favor to use 
the <tt>charset</tt> option on the endpoints.</p>
+
+<p>Notice that if you have explicit configured a <tt>charset</tt> option on 
the endpoint, then that configuration is used, regardless of the 
<tt>Exchange.CHARSET_NAME</tt> property.</p>
+
+<p>If you have some issues then you can enable DEBUG logging on 
<tt>org.apache.camel.component.file</tt>, and Camel logs when it reads/write a 
file using a specific charset.<br clear="none">
+For example the route below will log the following:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox?charset=utf-8"</span>)
+  .to(<span class="code-quote">"file:outbox?charset=iso-8859-1"</span>)
+</pre>
+</div></div>
+<p>And the logs:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+DEBUG GenericFileConverter           - Read file 
/Users/davsclaus/workspace/camel/camel-core/target/charset/input/input.txt with 
charset utf-8
+DEBUG FileOperations                 - Using Reader to write file: 
target/charset/output.txt with charset: iso-8859-1
+</pre>
+</div></div>
 
 <h3><a shape="rect" 
name="BookInOnePage-Commongotchaswithfolderandfilenames"></a>Common gotchas 
with folder and filenames</h3>
 
@@ -24561,7 +24625,7 @@ you need to implement a custom <tt>Excep
  * Custom {@link ExceptionHandler} to be used on the file consumer, to send
  * exceptions to a Camel route, to let Camel deal with the error.
  */
-<span class="code-keyword">private</span> class MyExceptionHandler <span 
class="code-keyword">implements</span> ExceptionHandler {
+<span class="code-keyword">private</span> <span 
class="code-keyword">static</span> class MyExceptionHandler <span 
class="code-keyword">implements</span> ExceptionHandler {
 
     <span class="code-keyword">private</span> ProducerTemplate template;
 
@@ -28217,11 +28281,7 @@ jcr:<span class="code-comment">//user:pa
 
 <h3><a shape="rect" name="BookInOnePage-Example"></a>Example</h3>
 <p>The snippet below creates a node named <tt>node</tt> under the 
<tt>/home/test</tt> node in the content repository.  One additional attribute 
is added to the node as well: <tt>my.contents.property</tt> which will contain 
the body of the message being sent.</p>
-<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
-<pre class="code-java">from(<span 
class="code-quote">"direct:a"</span>).setProperty(JcrConstants.JCR_NODE_NAME, 
constant(<span class="code-quote">"node"</span>))
-    .setProperty(<span class="code-quote">"my.contents.property"</span>, 
body()).to(<span class="code-quote">"jcr:<span 
class="code-comment">//user:pass@repository/home/test"</span>);</span>
-</pre>
-</div></div>
+<div class="error"><span class="error">Error formatting macro: snippet: 
java.lang.IndexOutOfBoundsException: Index: 20, Size: 20</span> </div>
 
 <h3><a shape="rect" name="BookInOnePage-SeeAlso"></a>See Also</h3>
 <ul><li><a shape="rect" href="configuring-camel.html" title="Configuring 
Camel">Configuring Camel</a></li><li><a shape="rect" href="component.html" 
title="Component">Component</a></li><li><a shape="rect" href="endpoint.html" 
title="Endpoint">Endpoint</a></li><li><a shape="rect" 
href="getting-started.html" title="Getting Started">Getting 
Started</a></li></ul>

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/file2.html
==============================================================================
--- websites/production/camel/content/file2.html (original)
+++ websites/production/camel/content/file2.html Wed Apr 25 15:21:28 2012
@@ -109,7 +109,7 @@ Also, the starting directory must not co
 
 <h4><a shape="rect" name="File2-Common"></a>Common</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>autoCreate</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Automatically create missing directories in the file's 
pathname. For the file consumer, that means creating the starting directory. 
For the file producer, it means the directory the files should be written to. 
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>bufferSize</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> 
128kb </td><td colspan="1" rowspan="1" class="confluenceTd"> Write buffer sized 
in bytes. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>fileName</tt> </td><td colspan="1" rowspa
 n="1" class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Use <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> to 
dynamically set the filename. For consumers, it's used as a filename filter. 
For producers, it's used to evaluate the filename to write. If an expression is 
set, it take precedence over the <tt>CamelFileName</tt> header. (<b>Note:</b> 
The header itself can also be an <a shape="rect" href="expression.html" 
title="Expression">Expression</a>). The expression options support both 
<tt>String</tt> and <tt>Expression</tt> types. If the expression is a 
<tt>String</tt> type, it is <b>always</b> evaluated using the <a shape="rect" 
href="file-language.html" title="File Language">File Language</a>. If the 
expression is an <tt>Expression</tt> type, the specified <tt>Expression</tt> 
type is used - this allows you, for instance
 , to use <a shape="rect" href="ognl.html" title="OGNL">OGNL</a> expressions. 
For the consumer, you can use it to filter filenames, so you can for instance 
consume today's file using the <a shape="rect" href="file-language.html" 
title="File Language">File Language</a> syntax: 
<tt>mydata-${date:now:yyyyMMdd}.txt</tt>. </td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>flatten</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>false</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> Flatten is used to flatten the file name path 
to strip any leading paths, so it's just the file name. This allows you to 
consume recursively into sub-directories, but when you eg write the files to 
another directory they will be written in a single directory. Setting this to 
<tt>true</tt> on the producer enforces that any file name recived in 
<tt>CamelFileName</tt> header will be stripped for any leading paths. 
</td></tr><tr><td colspan="1" rowspan="1" class="c
 onfluenceTd"> <tt>charset</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.5:</b> this option is used to specify the 
encoding of the file, and camel will set the Exchange property with 
Exchange.CHARSET_NAME with the value of this option. </td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"> 
<tt>copyAndDeleteOnRenameFail</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.9</b>: whether to fallback and do a copy and 
delete file, in case the file could not be renamed directly. This option is not 
available for the <a shape="rect" href="ftp2.html" title="FTP2">FTP</a> 
component. </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>autoCreate</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>true</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Automatically create missing directories in the file's 
pathname. For the file consumer, that means creating the starting directory. 
For the file producer, it means the directory the files should be written to. 
</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>bufferSize</tt> </td><td colspan="1" rowspan="1" class="confluenceTd"> 
128kb </td><td colspan="1" rowspan="1" class="confluenceTd"> Write buffer sized 
in bytes. </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> 
<tt>fileName</tt> </td><td colspan="1" rowspa
 n="1" class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> Use <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> to 
dynamically set the filename. For consumers, it's used as a filename filter. 
For producers, it's used to evaluate the filename to write. If an expression is 
set, it take precedence over the <tt>CamelFileName</tt> header. (<b>Note:</b> 
The header itself can also be an <a shape="rect" href="expression.html" 
title="Expression">Expression</a>). The expression options support both 
<tt>String</tt> and <tt>Expression</tt> types. If the expression is a 
<tt>String</tt> type, it is <b>always</b> evaluated using the <a shape="rect" 
href="file-language.html" title="File Language">File Language</a>. If the 
expression is an <tt>Expression</tt> type, the specified <tt>Expression</tt> 
type is used - this allows you, for instance
 , to use <a shape="rect" href="ognl.html" title="OGNL">OGNL</a> expressions. 
For the consumer, you can use it to filter filenames, so you can for instance 
consume today's file using the <a shape="rect" href="file-language.html" 
title="File Language">File Language</a> syntax: 
<tt>mydata-${date:now:yyyyMMdd}.txt</tt>. </td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>flatten</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>false</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> Flatten is used to flatten the file name path 
to strip any leading paths, so it's just the file name. This allows you to 
consume recursively into sub-directories, but when you eg write the files to 
another directory they will be written in a single directory. Setting this to 
<tt>true</tt> on the producer enforces that any file name recived in 
<tt>CamelFileName</tt> header will be stripped for any leading paths. 
</td></tr><tr><td colspan="1" rowspan="1" class="c
 onfluenceTd"> <tt>charset</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>null</tt> </td><td colspan="1" rowspan="1" 
class="confluenceTd"> <b>Camel 2.9.3:</b> this option is used to specify the 
encoding of the file, and camel will set the Exchange property with 
<tt>Exchange.CHARSET_NAME</tt> with the value of this option. You can use this 
on the consumer, to specify the encodings of the files, which allow Camel to 
know the charset it should load the file content in case the file content is 
being accessed. Likewise when writing a file, you can use this option to 
specify which charset to write the file as well. See further below for a 
examples and more important details. </td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"> <tt>copyAndDeleteOnRenameFail</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <tt>true</tt> </td><td colspan="1" 
rowspan="1" class="confluenceTd"> <b>Camel 2.9</b>: whether to fallback and do 
a copy and delete file, in 
 case the file could not be renamed directly. This option is not available for 
the <a shape="rect" href="ftp2.html" title="FTP2">FTP</a> component. 
</td></tr></tbody></table>
 </div>
 </div>
 
@@ -223,6 +223,70 @@ move=backup/${date:now:yyyyMMdd}/${file:
 
 <p>This allows you for instance to know how many files exists in this batch 
and for instance let the <a shape="rect" href="aggregator2.html" 
title="Aggregator2">Aggregator2</a> aggregate this number of files.</p>
 
+<h3><a shape="rect" name="File2-Usingcharset"></a>Using charset</h3>
+<p><b>Available as of Camel 2.9.3</b> <br clear="none">
+The charset option allows to configure an encoding of the files on both the 
consumer and producer endpoints. For example if you read utf-8 files, and want 
to convert the files to iso-8859-1, you can do:</p>
+
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox?charset=utf-8"</span>)
+  .to(<span class="code-quote">"file:outbox?charset=iso-8859-1"</span>)
+</pre>
+</div></div>
+
+<p>You can also use the <tt>convertBodyTo</tt> in the route. In the example 
below we have still input files in utf-8 format, but we want to convert the 
file content to a byte array in iso-8859-1 format. And then let a bean process 
the data. Before writing the content to the outbox folder using the current 
charset.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox?charset=utf-8"</span>)
+  .convertBodyTo(<span class="code-object">byte</span>[].class, <span 
class="code-quote">"iso-8859-1"</span>)
+  .to(<span class="code-quote">"bean:myBean"</span>)
+  .to(<span class="code-quote">"file:outbox"</span>);
+</pre>
+</div></div>
+
+<p>If you omit the charset on the consumer endpoint, then Camel does not know 
the charset of the file, and would by default use "UTF-8". However you can 
configure a JVM system property to override and use a different default 
encoding with the key <tt>org.apache.camel.default.charset</tt>.</p>
+
+<p>In the example below this could be a problem if the files is not in UTF-8 
encoding, which would be the default encoding for read the files.<br 
clear="none">
+In this example when writing the files, the content has already been converted 
to a byte array, and thus would write the content directly as is (without any 
further encodings).</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox"</span>)
+  .convertBodyTo(<span class="code-object">byte</span>[].class, <span 
class="code-quote">"iso-8859-1"</span>)
+  .to(<span class="code-quote">"bean:myBean"</span>)
+  .to(<span class="code-quote">"file:outbox"</span>);
+</pre>
+</div></div>
+
+<p>You can also override and control the encoding dynamic when writing files, 
by setting a property on the exchange with the key 
<tt>Exchange.CHARSET_NAME</tt>. For example in the route below we set the 
property with a value from a message header.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox"</span>)
+  .convertBodyTo(<span class="code-object">byte</span>[].class, <span 
class="code-quote">"iso-8859-1"</span>)
+  .to(<span class="code-quote">"bean:myBean"</span>)
+  .setProperty(Exchange.CHARSET_NAME, header(<span 
class="code-quote">"someCharsetHeader"</span>))
+  .to(<span class="code-quote">"file:outbox"</span>);
+</pre>
+</div></div>
+
+<p>We suggest to keep things simpler, so if you pickup files with the same 
encoding, and want to write the files in a specific encoding, then favor to use 
the <tt>charset</tt> option on the endpoints.</p>
+
+<p>Notice that if you have explicit configured a <tt>charset</tt> option on 
the endpoint, then that configuration is used, regardless of the 
<tt>Exchange.CHARSET_NAME</tt> property.</p>
+
+<p>If you have some issues then you can enable DEBUG logging on 
<tt>org.apache.camel.component.file</tt>, and Camel logs when it reads/write a 
file using a specific charset.<br clear="none">
+For example the route below will log the following:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+from(<span class="code-quote">"file:inbox?charset=utf-8"</span>)
+  .to(<span class="code-quote">"file:outbox?charset=iso-8859-1"</span>)
+</pre>
+</div></div>
+<p>And the logs:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent 
panelContent">
+<pre class="code-java">
+DEBUG GenericFileConverter           - Read file 
/Users/davsclaus/workspace/camel/camel-core/target/charset/input/input.txt with 
charset utf-8
+DEBUG FileOperations                 - Using Reader to write file: 
target/charset/output.txt with charset: iso-8859-1
+</pre>
+</div></div>
 
 <h3><a shape="rect" 
name="File2-Commongotchaswithfolderandfilenames"></a>Common gotchas with folder 
and filenames</h3>
 
@@ -818,7 +882,7 @@ you need to implement a custom <tt>Excep
  * Custom {@link ExceptionHandler} to be used on the file consumer, to send
  * exceptions to a Camel route, to let Camel deal with the error.
  */
-<span class="code-keyword">private</span> class MyExceptionHandler <span 
class="code-keyword">implements</span> ExceptionHandler {
+<span class="code-keyword">private</span> <span 
class="code-keyword">static</span> class MyExceptionHandler <span 
class="code-keyword">implements</span> ExceptionHandler {
 
     <span class="code-keyword">private</span> ProducerTemplate template;
 


Reply via email to