camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r961046 [1/2] - in /websites/production/camel/content: bindy.html book-dataformat-appendix.html book-in-one-page.html cache/main.pageCache
Date Fri, 07 Aug 2015 10:20:07 GMT
Author: buildbot
Date: Fri Aug  7 10:20:07 2015
New Revision: 961046

Log:
Production update by buildbot for camel

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

Modified: websites/production/camel/content/bindy.html
==============================================================================
--- websites/production/camel/content/bindy.html (original)
+++ websites/production/camel/content/bindy.html Fri Aug  7 10:20:07 2015
@@ -84,7 +84,7 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="Bindy-Bindy">Bindy</h2><p>The goal of this component is to allow the parsing/binding of non-structured data (or to be more precise non-XML data)<br clear="none"> to/from Java Beans that have binding mappings defined with annotations. Using Bindy, you can bind data from sources such as :</p><ul class="alternate"><li>CSV records,</li><li>Fixed-length records,</li><li>FIX messages,</li><li>or almost any other non-structured data</li></ul><p>to one or many Plain Old Java Object (POJO). Bindy converts the data according to the type of the java property. POJOs can be linked together with one-to-many relationships available in some cases. Moreover, for data type like Date, Double, Float, Integer, Short, Long and BigDecimal, you can provide the pattern to apply during the formatting of the property.</p><p>For the BigDecimal numbers, you can also define the precision and the decimal or grouping separators.</p><div class="table-wrap"><table class=
 "confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Format Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Pattern example</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Link</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>Date</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>DateFormat</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>"dd-MM-yyyy"</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html" rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>Decimal*</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Decimalformat</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>
 "##.###.###"</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html" rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html</a></p></td></tr></tbody></table></div><p>Decimal* = Double, Integer, Float, Short, Long</p><div class="confluence-information-macro confluence-information-macro-note"><p class="title">Format supported</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This first release only support comma separated values fields and key value pair fields (e.g. : FIX messages).</p></div></div><p>To work with camel-bindy, you must first define your model in a package (e.g. com.acme.model) and for each model class (e.g. Order, Client, Instrument, ...) add the required annotations (described hereafter) to the Class or field.</p><div cla
 ss="confluence-information-macro confluence-information-macro-note"><p class="title">Multiple models</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you use multiple models, each model has to be placed in it's own package to prevent unpredictable results.</p></div></div><h2 id="Bindy-Annotations">Annotations</h2><p>The annotations created allow to map different concept of your model to the POJO like :</p><ul class="alternate"><li>Type of record (csv, key value pair (e.g. FIX message), fixed length ...),</li><li>Link (to link object in another object),</li><li>DataField and their properties (int, type, ...),</li><li>KeyValuePairField (for key = value format like we have in FIX financial messages),</li><li>Section (to identify header, body and footer section),</li><li>OneToMany</li></ul><p>This section will describe them :</p><h3 id="Bindy-1.CsvRecord">1. CsvRecord</h3><p>The Cs
 vRecord annotation is used to identified the root class of the model. It represents a record = a line of a CSV file and can be linked to several children model classes.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Annotation name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Record type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Level</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>CsvRecord</strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>csv</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Class</p></td></tr></tbody></table></div><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Parameter name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Info</p></th></tr><tr><td colspan=
 "1" rowspan="1" class="confluenceTd"><p>separator</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>string</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>mandatory - can be ',' or ';' or 'anything'. This value is interpreted as a regular expression. If you want to use a sign which has a special meaning in regular expressions, e.g. the '|' sign, than you have to mask it, like ' <br clear="none" class="atl-forced-newline"> |'</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>skipFirstLine</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - default value = false - allow to skip the first line of the CSV file</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>crlf</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>string</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - possible values = WINDOWS,UNIX,MAC, or cust
 om; default value = WINDOWS - allow to define the carriage return character to use. If you specify a value other than the three listed before, the value you enter (custom) will be used as the CRLF character(s)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>generateHeaderColumns</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - default value = false - uses to generate the header columns of the CSV generates</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>autospanLine</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.13/2.12.2:</strong> optional - default value = false - if enabled then the last column is auto spanned to end of line, for example if its a comment, etc this allows the line to contain all characters, also the delimiter char.</p></td></tr><tr><td col
 span="1" rowspan="1" class="confluenceTd"><p>isOrdered</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - default value = false - allow to change the order of the fields when CSV is generated</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>quote</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8.3/2.9:</strong> option - allow to specify a quote character of the fields when CSV is generated</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>This annotation is associated to the root class of the model and must be declared one time.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">quoting</td><td colspan="1" rowspan="1" 
 class="confluenceTd">boolean</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.11:</strong>optional - default value = false -&#160;Indicate if the values must be quoted when marshaling when CSV is generated.</td></tr></tbody></table></div><p><strong>case 1 : separator = ','</strong></p><p>The separator used to segregate the fields in the CSV record is ',' :</p><p>10, J, Pauline, M, XD12345678, Fortis Dynamic 15/15, 2500, USD,08-01-2009</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 id="Bindy-Bindy">Bindy</h2><p>The goal of this component is to allow the parsing/binding of non-structured data (or to be more precise non-XML data)<br clear="none"> to/from Java Beans that have binding mappings defined with annotations. Using Bindy, you can bind data from sources such as :</p><ul class="alternate"><li>CSV records,</li><li>Fixed-length records,</li><li>FIX messages,</li><li>or almost any other non-structured data</li></ul><p>to one or many Plain Old Java Object (POJO). Bindy converts the data according to the type of the java property. POJOs can be linked together with one-to-many relationships available in some cases. Moreover, for data type like Date, Double, Float, Integer, Short, Long and BigDecimal, you can provide the pattern to apply during the formatting of the property.</p><p>For the BigDecimal numbers, you can also define the precision and the decimal or grouping separators.</p><div class="table-wrap"><table class=
 "confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Format Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Pattern example</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Link</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>Date</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>DateFormat</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>"dd-MM-yyyy"</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html" rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>Decimal*</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Decimalformat</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>
 "##.###.###"</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html" rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html</a></p></td></tr></tbody></table></div><p>Decimal* = Double, Integer, Float, Short, Long</p><div class="confluence-information-macro confluence-information-macro-note"><p class="title">Format supported</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This first release only support comma separated values fields and key value pair fields (e.g. : FIX messages).</p></div></div><p>To work with camel-bindy, you must first define your model in a package (e.g. com.acme.model) and for each model class (e.g. Order, Client, Instrument, ...) add the required annotations (described hereafter) to the Class or field.</p><div cla
 ss="confluence-information-macro confluence-information-macro-note"><p class="title">Multiple models</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you use multiple models, each model has to be placed in it's own package to prevent unpredictable results.</p><p>From <strong>Camel 2.16</strong> onwards this is no longer the case, as you can safely have multiple models in the same package, as you configure bindy using class names instead of package names now.</p></div></div><h2 id="Bindy-Annotations">Annotations</h2><p>The annotations created allow to map different concept of your model to the POJO like :</p><ul class="alternate"><li>Type of record (csv, key value pair (e.g. FIX message), fixed length ...),</li><li>Link (to link object in another object),</li><li>DataField and their properties (int, type, ...),</li><li>KeyValuePairField (for key = value format like we have in FI
 X financial messages),</li><li>Section (to identify header, body and footer section),</li><li>OneToMany</li></ul><p>This section will describe them :</p><h3 id="Bindy-1.CsvRecord">1. CsvRecord</h3><p>The CsvRecord annotation is used to identified the root class of the model. It represents a record = a line of a CSV file and can be linked to several children model classes.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Annotation name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Record type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Level</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>CsvRecord</strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>csv</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Class</p></td></tr></tbody></table></div><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rows
 pan="1" class="confluenceTh"><p>Parameter name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Info</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>separator</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>string</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>mandatory - can be ',' or ';' or 'anything'. This value is interpreted as a regular expression. If you want to use a sign which has a special meaning in regular expressions, e.g. the '|' sign, than you have to mask it, like ' <br clear="none" class="atl-forced-newline"> |'</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>skipFirstLine</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - default value = false - allow to skip the first line of the CSV file</p></td></tr><tr><td colspan="1" rowspan="1" clas
 s="confluenceTd"><p>crlf</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>string</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - possible values = WINDOWS,UNIX,MAC, or custom; default value = WINDOWS - allow to define the carriage return character to use. If you specify a value other than the three listed before, the value you enter (custom) will be used as the CRLF character(s)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>generateHeaderColumns</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - default value = false - uses to generate the header columns of the CSV generates</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>autospanLine</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.13/2.12.2:</strong> optional - default value
  = false - if enabled then the last column is auto spanned to end of line, for example if its a comment, etc this allows the line to contain all characters, also the delimiter char.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>isOrdered</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - default value = false - allow to change the order of the fields when CSV is generated</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>quote</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8.3/2.9:</strong> option - allow to specify a quote character of the fields when CSV is generated</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenc
 eTd"><p>This annotation is associated to the root class of the model and must be declared one time.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">quoting</td><td colspan="1" rowspan="1" class="confluenceTd">boolean</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.11:</strong>optional - default value = false -&#160;Indicate if the values must be quoted when marshaling when CSV is generated.</td></tr></tbody></table></div><p><strong>case 1 : separator = ','</strong></p><p>The separator used to segregate the fields in the CSV record is ',' :</p><p>10, J, Pauline, M, XD12345678, Fortis Dynamic 15/15, 2500, USD,08-01-2009</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[@CsvRecord( separator = &quot;,&quot; )
 public Class Order {
 ...
@@ -754,18 +754,32 @@ public class Security {
 
 ]]></script>
 </div></div><h3 id="Bindy-UsingtheJavaDSL">Using the Java DSL</h3><p>The next step consists in instantiating the DataFormat <em>bindy</em> class associated with this record type and providing Java package name(s) as parameter.</p><p>For example the following uses the class <code>BindyCsvDataFormat</code> (who correspond to the class associated with the CSV record type) which is configured with "com.acme.model"<br clear="none"> package name to initialize the model objects configured in this package.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[DataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
-]]></script>
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// Camel 2.15 or older (configure by package name)
+DataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+
+?
+// Camel 2.16 onwards (configure by class name)
+DataFormat bindy = new BindyCsvDataFormat(com.acme.model.MyModel.class);]]></script>
 </div></div><h4 id="Bindy-Settinglocale">Setting locale</h4><p>Bindy supports configuring the locale on the dataformat, such as&#160;</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[BindyCsvDataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// Camel 2.15 or older (configure by package name)
+BindyCsvDataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+// Camel 2.16 onwards (configure by class name)
+BindyCsvDataFormat bindy = new BindyCsvDataFormat(com.acme.model.MyModel.class);
 
 bindy.setLocale(&quot;us&quot;);]]></script>
 </div></div><p>Or to use the platform default locale then use "default" as the locale name. Notice this requires Camel 2.14/2.13.3/2.12.5.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[BindyCsvDataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// Camel 2.15 or older (configure by package name)
+BindyCsvDataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+// Camel 2.16 onwards (configure by class name)
+BindyCsvDataFormat bindy = new BindyCsvDataFormat(com.acme.model.MyModel.class);
 
 bindy.setLocale(&quot;default&quot;);]]></script>
 </div></div><p>for older releases you can set it using Java code as shown</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[BindyCsvDataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// Camel 2.15 or older (configure by package name)
+BindyCsvDataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+// Camel 2.16 onwards (configure by class name)
+BindyCsvDataFormat bindy = new BindyCsvDataFormat(com.acme.model.MyModel.class);
+
 
 bindy.setLocale(Locale.getDefault().getISO3Country());]]></script>
 </div></div><h4 id="Bindy-Unmarshaling">Unmarshaling</h4><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
@@ -811,161 +825,7 @@ bindy.setLocale(Locale.getDefault().getI
    .marshal(bindy)
    .to(&quot;file://outbox&quot;)
 ]]></script>
-</div></div><h3 id="Bindy-Unittest">Unit test</h3><p>Here is two examples showing how to marshall or unmarshall a CSV file with Camel</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Marshall</b></div><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[package org.apache.camel.dataformat.bindy.csv;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.camel.EndpointInject;
-import org.apache.camel.Produce;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink.Client;
-import org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink.Order;
-import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
-import org.junit.Test;
-import org.springframework.config.java.annotation.Bean;
-import org.springframework.config.java.annotation.Configuration;
-import org.springframework.config.java.test.JavaConfigContextLoader;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-
-@ContextConfiguration(locations = &quot;org.apache.camel.dataformat.bindy.csv.BindyComplexCsvMarshallTest$ContextConfig&quot;, loader = JavaConfigContextLoader.class)
-public class BindyComplexCsvMarshallTest extends AbstractJUnit4SpringContextTests {
-
-    private List&lt;Map&lt;String, Object&gt;&gt; models = new ArrayList&lt;Map&lt;String, Object&gt;&gt;();
-    private String result = &quot;10,A1,Julia,Roberts,BE123456789,Belgium Ventage 10/12,150,USD,14-01-2009&quot;;
-
-    @Produce(uri = &quot;direct:start&quot;)
-    private ProducerTemplate template;
-
-    @EndpointInject(uri = &quot;mock:result&quot;)
-    private MockEndpoint resultEndpoint;
-
-    @Test
-    public void testMarshallMessage() throws Exception {
-        resultEndpoint.expectedBodiesReceived(result);
-
-        template.sendBody(generateModel());
-
-        resultEndpoint.assertIsSatisfied();
-    }
-
-    private List&lt;Map&lt;String, Object&gt;&gt; generateModel() {
-        Map&lt;String, Object&gt; model = new HashMap&lt;String, Object&gt;();
-
-        Order order = new Order();
-        order.setOrderNr(10);
-        order.setAmount(new BigDecimal(&quot;150&quot;));
-        order.setIsinCode(&quot;BE123456789&quot;);
-        order.setInstrumentName(&quot;Belgium Ventage 10/12&quot;);
-        order.setCurrency(&quot;USD&quot;);
-
-        Calendar calendar = new GregorianCalendar();
-        calendar.set(2009, 0, 14);
-        order.setOrderDate(calendar.getTime());
-
-        Client client = new Client();
-        client.setClientNr(&quot;A1&quot;);
-        client.setFirstName(&quot;Julia&quot;);
-        client.setLastName(&quot;Roberts&quot;);
-
-        order.setClient(client);
-
-        model.put(order.getClass().getName(), order);
-        model.put(client.getClass().getName(), client);
-
-        models.add(0, model);
-
-        return models;
-    }
-
-    @Configuration
-    public static class ContextConfig extends SingleRouteCamelConfiguration {
-        BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(&quot;org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink&quot;);
-
-        @Override
-        @Bean
-        public RouteBuilder route() {
-            return new RouteBuilder() {
-                @Override
-                public void configure() {
-                    from(&quot;direct:start&quot;).marshal(camelDataFormat).to(&quot;mock:result&quot;);
-                }
-            };
-        }
-    }
-
-}
-]]></script>
-</div></div><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Unmarshall</b></div><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[package org.apache.camel.dataformat.bindy.csv;
-
-import org.apache.camel.EndpointInject;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
-import org.junit.Test;
-import org.springframework.config.java.annotation.Bean;
-import org.springframework.config.java.annotation.Configuration;
-import org.springframework.config.java.test.JavaConfigContextLoader;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-
-@ContextConfiguration(locations = &quot;org.apache.camel.dataformat.bindy.csv.BindyComplexCsvUnmarshallTest$ContextConfig&quot;, loader = JavaConfigContextLoader.class)
-public class BindyComplexCsvUnmarshallTest extends AbstractJUnit4SpringContextTests {
-
-    @EndpointInject(uri = &quot;mock:result&quot;)
-    private MockEndpoint resultEndpoint;
-
-    @Test
-    public void testUnMarshallMessage() throws Exception {
-        resultEndpoint.expectedMessageCount(1);
-        resultEndpoint.assertIsSatisfied();
-    }
-
-    @Configuration
-    public static class ContextConfig extends SingleRouteCamelConfiguration {
-        BindyCsvDataFormat csvBindyDataFormat = new BindyCsvDataFormat(&quot;org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink&quot;);
-
-        @Override
-        @Bean
-        public RouteBuilder route() {
-            return new RouteBuilder() {
-                @Override
-                public void configure() {
-                    from(&quot;file://src/test/data?noop=true&quot;).unmarshal(csvBindyDataFormat).to(&quot;mock:result&quot;);
-                }
-            };
-        }
-    }
-
-}
-]]></script>
-</div></div><p>In this example, BindyCsvDataFormat class has been instantiated in a traditional way but it is also possible to provide information directly to the function (un)marshal like this where BindyType corresponds to the Bindy DataFormat class to instantiate and the parameter contains the list of package names.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[    public static class ContextConfig extends SingleRouteCamelConfiguration {
-        @Override
-        @Bean
-        public RouteBuilder route() {
-            return new RouteBuilder() {
-                @Override
-                public void configure() {
-                    from(&quot;direct:start&quot;)
-                    .marshal().bindy(BindyType.Csv, &quot;org.apache.camel.dataformat.bindy.model.simple.oneclass&quot;)
-                    .to(&quot;mock:result&quot;);
-                }
-            };
-        }
-    }
-]]></script>
-</div></div><h3 id="Bindy-UsingSpringXML">Using Spring XML</h3><p>This is really easy to use Spring as your favorite DSL language to declare the routes to be used for camel-bindy. The following example shows two routes where the first will pick-up records from files, unmarshal the content and bind it to their model. The result is then send to a pojo (doing nothing special) and place them into a queue.</p><p>The second route will extract the pojos from the queue and marshal the content to generate a file containing the csv record</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>spring dsl</b></div><div class="codeContent panelContent pdl">
+</div></div><h3 id="Bindy-UsingSpringXML">Using Spring XML</h3><p>This is really easy to use Spring as your favorite DSL language to declare the routes to be used for camel-bindy. The following example shows two routes where the first will pick-up records from files, unmarshal the content and bind it to their model. The result is then send to a pojo (doing nothing special) and place them into a queue.</p><p>The second route will extract the pojos from the queue and marshal the content to generate a file containing the csv record. The example above is for using Camel 2.16 onwards.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>spring dsl</b></div><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
 
 &lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
@@ -976,13 +836,6 @@ public class BindyComplexCsvUnmarshallTe
        http://camel.apache.org/schema/spring
        http://camel.apache.org/schema/spring/camel-spring.xsd&quot;&gt;
 
-	&lt;bean id=&quot;bindyDataformat&quot; class=&quot;org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat&quot;&gt;
-		&lt;constructor-arg value=&quot;org.apache.camel.bindy.model&quot; /&gt;
-	&lt;/bean&gt;
-
-	&lt;bean id=&quot;csv&quot; class=&quot;org.apache.camel.bindy.csv.HandleOrderBean&quot; /&gt;
-
-
         &lt;!-- Queuing engine - ActiveMq - work locally in mode virtual memory --&gt;
 	&lt;bean id=&quot;activemq&quot; class=&quot;org.apache.activemq.camel.component.ActiveMQComponent&quot;&gt;
 		&lt;property name=&quot;brokerURL&quot; value=&quot;vm://localhost:61616&quot;/&gt;
@@ -990,7 +843,11 @@ public class BindyComplexCsvUnmarshallTe
 
 
 	&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-		&lt;jmxAgent id=&quot;agent&quot; disabled=&quot;false&quot; /&gt;
+
+?
+        &lt;dataFormats&gt;
+          &lt;bindy id=&quot;bindyDataformat&quot; type=&quot;Csv&quot; classType=&quot;org.apache.camel.bindy.model.Order&quot;/&gt;
+        &lt;/dataFormats&gt;
 
 		&lt;route&gt;
 			&lt;from uri=&quot;file://src/data/csv/?noop=true&quot; /&gt;

Modified: websites/production/camel/content/book-dataformat-appendix.html
==============================================================================
--- websites/production/camel/content/book-dataformat-appendix.html (original)
+++ websites/production/camel/content/book-dataformat-appendix.html Fri Aug  7 10:20:07 2015
@@ -1029,7 +1029,7 @@ from(&quot;file://site/inbox&quot;).unma
 &lt;/dependency&gt;
 ]]></script>
 </div></div>
-<h2 id="BookDataFormatAppendix-Bindy">Bindy</h2><p>The goal of this component is to allow the parsing/binding of non-structured data (or to be more precise non-XML data)<br clear="none"> to/from Java Beans that have binding mappings defined with annotations. Using Bindy, you can bind data from sources such as :</p><ul class="alternate"><li>CSV records,</li><li>Fixed-length records,</li><li>FIX messages,</li><li>or almost any other non-structured data</li></ul><p>to one or many Plain Old Java Object (POJO). Bindy converts the data according to the type of the java property. POJOs can be linked together with one-to-many relationships available in some cases. Moreover, for data type like Date, Double, Float, Integer, Short, Long and BigDecimal, you can provide the pattern to apply during the formatting of the property.</p><p>For the BigDecimal numbers, you can also define the precision and the decimal or grouping separators.</p><div class="table-wrap"><table class="confluenceTable"><tb
 ody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Format Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Pattern example</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Link</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>Date</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>DateFormat</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>"dd-MM-yyyy"</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html" rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>Decimal*</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Decimalformat</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>"##.###.###"</p></td>
 <td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html" rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html</a></p></td></tr></tbody></table></div><p>Decimal* = Double, Integer, Float, Short, Long</p><div class="confluence-information-macro confluence-information-macro-note"><p class="title">Format supported</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This first release only support comma separated values fields and key value pair fields (e.g. : FIX messages).</p></div></div><p>To work with camel-bindy, you must first define your model in a package (e.g. com.acme.model) and for each model class (e.g. Order, Client, Instrument, ...) add the required annotations (described hereafter) to the Class or field.</p><div class="confluence-inform
 ation-macro confluence-information-macro-note"><p class="title">Multiple models</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you use multiple models, each model has to be placed in it's own package to prevent unpredictable results.</p></div></div><h2 id="BookDataFormatAppendix-Annotations">Annotations</h2><p>The annotations created allow to map different concept of your model to the POJO like :</p><ul class="alternate"><li>Type of record (csv, key value pair (e.g. FIX message), fixed length ...),</li><li>Link (to link object in another object),</li><li>DataField and their properties (int, type, ...),</li><li>KeyValuePairField (for key = value format like we have in FIX financial messages),</li><li>Section (to identify header, body and footer section),</li><li>OneToMany</li></ul><p>This section will describe them :</p><h3 id="BookDataFormatAppendix-1.CsvRecord">1. CsvRecord<
 /h3><p>The CsvRecord annotation is used to identified the root class of the model. It represents a record = a line of a CSV file and can be linked to several children model classes.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Annotation name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Record type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Level</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>CsvRecord</strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>csv</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Class</p></td></tr></tbody></table></div><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Parameter name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Info</p></th></tr><tr
 ><td colspan="1" rowspan="1" class="confluenceTd"><p>separator</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>string</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>mandatory - can be ',' or ';' or 'anything'. This value is interpreted as a regular expression. If you want to use a sign which has a special meaning in regular expressions, e.g. the '|' sign, than you have to mask it, like ' <br clear="none" class="atl-forced-newline"> |'</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>skipFirstLine</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - default value = false - allow to skip the first line of the CSV file</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>crlf</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>string</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - possible values = WINDOWS,UNIX
 ,MAC, or custom; default value = WINDOWS - allow to define the carriage return character to use. If you specify a value other than the three listed before, the value you enter (custom) will be used as the CRLF character(s)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>generateHeaderColumns</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - default value = false - uses to generate the header columns of the CSV generates</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>autospanLine</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.13/2.12.2:</strong> optional - default value = false - if enabled then the last column is auto spanned to end of line, for example if its a comment, etc this allows the line to contain all characters, also the delimiter char.</p></td></t
 r><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>isOrdered</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - default value = false - allow to change the order of the fields when CSV is generated</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>quote</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8.3/2.9:</strong> option - allow to specify a quote character of the fields when CSV is generated</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>This annotation is associated to the root class of the model and must be declared one time.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">quoting</td><td colspan="1"
  rowspan="1" class="confluenceTd">boolean</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.11:</strong>optional - default value = false -&#160;Indicate if the values must be quoted when marshaling when CSV is generated.</td></tr></tbody></table></div><p><strong>case 1 : separator = ','</strong></p><p>The separator used to segregate the fields in the CSV record is ',' :</p><p>10, J, Pauline, M, XD12345678, Fortis Dynamic 15/15, 2500, USD,08-01-2009</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<h2 id="BookDataFormatAppendix-Bindy">Bindy</h2><p>The goal of this component is to allow the parsing/binding of non-structured data (or to be more precise non-XML data)<br clear="none"> to/from Java Beans that have binding mappings defined with annotations. Using Bindy, you can bind data from sources such as :</p><ul class="alternate"><li>CSV records,</li><li>Fixed-length records,</li><li>FIX messages,</li><li>or almost any other non-structured data</li></ul><p>to one or many Plain Old Java Object (POJO). Bindy converts the data according to the type of the java property. POJOs can be linked together with one-to-many relationships available in some cases. Moreover, for data type like Date, Double, Float, Integer, Short, Long and BigDecimal, you can provide the pattern to apply during the formatting of the property.</p><p>For the BigDecimal numbers, you can also define the precision and the decimal or grouping separators.</p><div class="table-wrap"><table class="confluenceTable"><tb
 ody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Format Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Pattern example</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Link</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>Date</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>DateFormat</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>"dd-MM-yyyy"</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html" rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>Decimal*</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Decimalformat</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>"##.###.###"</p></td>
 <td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html" rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/api/java/text/DecimalFormat.html</a></p></td></tr></tbody></table></div><p>Decimal* = Double, Integer, Float, Short, Long</p><div class="confluence-information-macro confluence-information-macro-note"><p class="title">Format supported</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This first release only support comma separated values fields and key value pair fields (e.g. : FIX messages).</p></div></div><p>To work with camel-bindy, you must first define your model in a package (e.g. com.acme.model) and for each model class (e.g. Order, Client, Instrument, ...) add the required annotations (described hereafter) to the Class or field.</p><div class="confluence-inform
 ation-macro confluence-information-macro-note"><p class="title">Multiple models</p><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you use multiple models, each model has to be placed in it's own package to prevent unpredictable results.</p><p>From <strong>Camel 2.16</strong> onwards this is no longer the case, as you can safely have multiple models in the same package, as you configure bindy using class names instead of package names now.</p></div></div><h2 id="BookDataFormatAppendix-Annotations">Annotations</h2><p>The annotations created allow to map different concept of your model to the POJO like :</p><ul class="alternate"><li>Type of record (csv, key value pair (e.g. FIX message), fixed length ...),</li><li>Link (to link object in another object),</li><li>DataField and their properties (int, type, ...),</li><li>KeyValuePairField (for key = value format like we have in FIX fi
 nancial messages),</li><li>Section (to identify header, body and footer section),</li><li>OneToMany</li></ul><p>This section will describe them :</p><h3 id="BookDataFormatAppendix-1.CsvRecord">1. CsvRecord</h3><p>The CsvRecord annotation is used to identified the root class of the model. It represents a record = a line of a CSV file and can be linked to several children model classes.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Annotation name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Record type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Level</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>CsvRecord</strong></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>csv</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Class</p></td></tr></tbody></table></div><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th col
 span="1" rowspan="1" class="confluenceTh"><p>Parameter name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Info</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>separator</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>string</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>mandatory - can be ',' or ';' or 'anything'. This value is interpreted as a regular expression. If you want to use a sign which has a special meaning in regular expressions, e.g. the '|' sign, than you have to mask it, like ' <br clear="none" class="atl-forced-newline"> |'</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>skipFirstLine</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - default value = false - allow to skip the first line of the CSV file</p></td></tr><tr><td colspan="1" row
 span="1" class="confluenceTd"><p>crlf</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>string</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - possible values = WINDOWS,UNIX,MAC, or custom; default value = WINDOWS - allow to define the carriage return character to use. If you specify a value other than the three listed before, the value you enter (custom) will be used as the CRLF character(s)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>generateHeaderColumns</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - default value = false - uses to generate the header columns of the CSV generates</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>autospanLine</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.13/2.12.2:</strong> optional - 
 default value = false - if enabled then the last column is auto spanned to end of line, for example if its a comment, etc this allows the line to contain all characters, also the delimiter char.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>isOrdered</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>optional - default value = false - allow to change the order of the fields when CSV is generated</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>quote</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.8.3/2.9:</strong> option - allow to specify a quote character of the fields when CSV is generated</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" cla
 ss="confluenceTd"><p>This annotation is associated to the root class of the model and must be declared one time.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">quoting</td><td colspan="1" rowspan="1" class="confluenceTd">boolean</td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.11:</strong>optional - default value = false -&#160;Indicate if the values must be quoted when marshaling when CSV is generated.</td></tr></tbody></table></div><p><strong>case 1 : separator = ','</strong></p><p>The separator used to segregate the fields in the CSV record is ',' :</p><p>10, J, Pauline, M, XD12345678, Fortis Dynamic 15/15, 2500, USD,08-01-2009</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[@CsvRecord( separator = &quot;,&quot; )
 public Class Order {
 ...
@@ -1699,18 +1699,32 @@ public class Security {
 
 ]]></script>
 </div></div><h3 id="BookDataFormatAppendix-UsingtheJavaDSL.2">Using the Java DSL</h3><p>The next step consists in instantiating the DataFormat <em>bindy</em> class associated with this record type and providing Java package name(s) as parameter.</p><p>For example the following uses the class <code>BindyCsvDataFormat</code> (who correspond to the class associated with the CSV record type) which is configured with "com.acme.model"<br clear="none"> package name to initialize the model objects configured in this package.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[DataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
-]]></script>
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// Camel 2.15 or older (configure by package name)
+DataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+
+?
+// Camel 2.16 onwards (configure by class name)
+DataFormat bindy = new BindyCsvDataFormat(com.acme.model.MyModel.class);]]></script>
 </div></div><h4 id="BookDataFormatAppendix-Settinglocale">Setting locale</h4><p>Bindy supports configuring the locale on the dataformat, such as&#160;</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[BindyCsvDataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// Camel 2.15 or older (configure by package name)
+BindyCsvDataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+// Camel 2.16 onwards (configure by class name)
+BindyCsvDataFormat bindy = new BindyCsvDataFormat(com.acme.model.MyModel.class);
 
 bindy.setLocale(&quot;us&quot;);]]></script>
 </div></div><p>Or to use the platform default locale then use "default" as the locale name. Notice this requires Camel 2.14/2.13.3/2.12.5.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[BindyCsvDataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// Camel 2.15 or older (configure by package name)
+BindyCsvDataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+// Camel 2.16 onwards (configure by class name)
+BindyCsvDataFormat bindy = new BindyCsvDataFormat(com.acme.model.MyModel.class);
 
 bindy.setLocale(&quot;default&quot;);]]></script>
 </div></div><p>for older releases you can set it using Java code as shown</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[BindyCsvDataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[// Camel 2.15 or older (configure by package name)
+BindyCsvDataFormat bindy = new BindyCsvDataFormat(&quot;com.acme.model&quot;);
+// Camel 2.16 onwards (configure by class name)
+BindyCsvDataFormat bindy = new BindyCsvDataFormat(com.acme.model.MyModel.class);
+
 
 bindy.setLocale(Locale.getDefault().getISO3Country());]]></script>
 </div></div><h4 id="BookDataFormatAppendix-Unmarshaling">Unmarshaling</h4><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
@@ -1756,161 +1770,7 @@ bindy.setLocale(Locale.getDefault().getI
    .marshal(bindy)
    .to(&quot;file://outbox&quot;)
 ]]></script>
-</div></div><h3 id="BookDataFormatAppendix-Unittest">Unit test</h3><p>Here is two examples showing how to marshall or unmarshall a CSV file with Camel</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Marshall</b></div><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[package org.apache.camel.dataformat.bindy.csv;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.camel.EndpointInject;
-import org.apache.camel.Produce;
-import org.apache.camel.ProducerTemplate;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink.Client;
-import org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink.Order;
-import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
-import org.junit.Test;
-import org.springframework.config.java.annotation.Bean;
-import org.springframework.config.java.annotation.Configuration;
-import org.springframework.config.java.test.JavaConfigContextLoader;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-
-@ContextConfiguration(locations = &quot;org.apache.camel.dataformat.bindy.csv.BindyComplexCsvMarshallTest$ContextConfig&quot;, loader = JavaConfigContextLoader.class)
-public class BindyComplexCsvMarshallTest extends AbstractJUnit4SpringContextTests {
-
-    private List&lt;Map&lt;String, Object&gt;&gt; models = new ArrayList&lt;Map&lt;String, Object&gt;&gt;();
-    private String result = &quot;10,A1,Julia,Roberts,BE123456789,Belgium Ventage 10/12,150,USD,14-01-2009&quot;;
-
-    @Produce(uri = &quot;direct:start&quot;)
-    private ProducerTemplate template;
-
-    @EndpointInject(uri = &quot;mock:result&quot;)
-    private MockEndpoint resultEndpoint;
-
-    @Test
-    public void testMarshallMessage() throws Exception {
-        resultEndpoint.expectedBodiesReceived(result);
-
-        template.sendBody(generateModel());
-
-        resultEndpoint.assertIsSatisfied();
-    }
-
-    private List&lt;Map&lt;String, Object&gt;&gt; generateModel() {
-        Map&lt;String, Object&gt; model = new HashMap&lt;String, Object&gt;();
-
-        Order order = new Order();
-        order.setOrderNr(10);
-        order.setAmount(new BigDecimal(&quot;150&quot;));
-        order.setIsinCode(&quot;BE123456789&quot;);
-        order.setInstrumentName(&quot;Belgium Ventage 10/12&quot;);
-        order.setCurrency(&quot;USD&quot;);
-
-        Calendar calendar = new GregorianCalendar();
-        calendar.set(2009, 0, 14);
-        order.setOrderDate(calendar.getTime());
-
-        Client client = new Client();
-        client.setClientNr(&quot;A1&quot;);
-        client.setFirstName(&quot;Julia&quot;);
-        client.setLastName(&quot;Roberts&quot;);
-
-        order.setClient(client);
-
-        model.put(order.getClass().getName(), order);
-        model.put(client.getClass().getName(), client);
-
-        models.add(0, model);
-
-        return models;
-    }
-
-    @Configuration
-    public static class ContextConfig extends SingleRouteCamelConfiguration {
-        BindyCsvDataFormat camelDataFormat = new BindyCsvDataFormat(&quot;org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink&quot;);
-
-        @Override
-        @Bean
-        public RouteBuilder route() {
-            return new RouteBuilder() {
-                @Override
-                public void configure() {
-                    from(&quot;direct:start&quot;).marshal(camelDataFormat).to(&quot;mock:result&quot;);
-                }
-            };
-        }
-    }
-
-}
-]]></script>
-</div></div><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>Unmarshall</b></div><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[package org.apache.camel.dataformat.bindy.csv;
-
-import org.apache.camel.EndpointInject;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.spring.javaconfig.SingleRouteCamelConfiguration;
-import org.junit.Test;
-import org.springframework.config.java.annotation.Bean;
-import org.springframework.config.java.annotation.Configuration;
-import org.springframework.config.java.test.JavaConfigContextLoader;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-
-@ContextConfiguration(locations = &quot;org.apache.camel.dataformat.bindy.csv.BindyComplexCsvUnmarshallTest$ContextConfig&quot;, loader = JavaConfigContextLoader.class)
-public class BindyComplexCsvUnmarshallTest extends AbstractJUnit4SpringContextTests {
-
-    @EndpointInject(uri = &quot;mock:result&quot;)
-    private MockEndpoint resultEndpoint;
-
-    @Test
-    public void testUnMarshallMessage() throws Exception {
-        resultEndpoint.expectedMessageCount(1);
-        resultEndpoint.assertIsSatisfied();
-    }
-
-    @Configuration
-    public static class ContextConfig extends SingleRouteCamelConfiguration {
-        BindyCsvDataFormat csvBindyDataFormat = new BindyCsvDataFormat(&quot;org.apache.camel.dataformat.bindy.model.complex.twoclassesandonelink&quot;);
-
-        @Override
-        @Bean
-        public RouteBuilder route() {
-            return new RouteBuilder() {
-                @Override
-                public void configure() {
-                    from(&quot;file://src/test/data?noop=true&quot;).unmarshal(csvBindyDataFormat).to(&quot;mock:result&quot;);
-                }
-            };
-        }
-    }
-
-}
-]]></script>
-</div></div><p>In this example, BindyCsvDataFormat class has been instantiated in a traditional way but it is also possible to provide information directly to the function (un)marshal like this where BindyType corresponds to the Bindy DataFormat class to instantiate and the parameter contains the list of package names.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[    public static class ContextConfig extends SingleRouteCamelConfiguration {
-        @Override
-        @Bean
-        public RouteBuilder route() {
-            return new RouteBuilder() {
-                @Override
-                public void configure() {
-                    from(&quot;direct:start&quot;)
-                    .marshal().bindy(BindyType.Csv, &quot;org.apache.camel.dataformat.bindy.model.simple.oneclass&quot;)
-                    .to(&quot;mock:result&quot;);
-                }
-            };
-        }
-    }
-]]></script>
-</div></div><h3 id="BookDataFormatAppendix-UsingSpringXML.2">Using Spring XML</h3><p>This is really easy to use Spring as your favorite DSL language to declare the routes to be used for camel-bindy. The following example shows two routes where the first will pick-up records from files, unmarshal the content and bind it to their model. The result is then send to a pojo (doing nothing special) and place them into a queue.</p><p>The second route will extract the pojos from the queue and marshal the content to generate a file containing the csv record</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>spring dsl</b></div><div class="codeContent panelContent pdl">
+</div></div><h3 id="BookDataFormatAppendix-UsingSpringXML.2">Using Spring XML</h3><p>This is really easy to use Spring as your favorite DSL language to declare the routes to be used for camel-bindy. The following example shows two routes where the first will pick-up records from files, unmarshal the content and bind it to their model. The result is then send to a pojo (doing nothing special) and place them into a queue.</p><p>The second route will extract the pojos from the queue and marshal the content to generate a file containing the csv record. The example above is for using Camel 2.16 onwards.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>spring dsl</b></div><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
 
 &lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
@@ -1921,13 +1781,6 @@ public class BindyComplexCsvUnmarshallTe
        http://camel.apache.org/schema/spring
        http://camel.apache.org/schema/spring/camel-spring.xsd&quot;&gt;
 
-	&lt;bean id=&quot;bindyDataformat&quot; class=&quot;org.apache.camel.dataformat.bindy.csv.BindyCsvDataFormat&quot;&gt;
-		&lt;constructor-arg value=&quot;org.apache.camel.bindy.model&quot; /&gt;
-	&lt;/bean&gt;
-
-	&lt;bean id=&quot;csv&quot; class=&quot;org.apache.camel.bindy.csv.HandleOrderBean&quot; /&gt;
-
-
         &lt;!-- Queuing engine - ActiveMq - work locally in mode virtual memory --&gt;
 	&lt;bean id=&quot;activemq&quot; class=&quot;org.apache.activemq.camel.component.ActiveMQComponent&quot;&gt;
 		&lt;property name=&quot;brokerURL&quot; value=&quot;vm://localhost:61616&quot;/&gt;
@@ -1935,7 +1788,11 @@ public class BindyComplexCsvUnmarshallTe
 
 
 	&lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-		&lt;jmxAgent id=&quot;agent&quot; disabled=&quot;false&quot; /&gt;
+
+?
+        &lt;dataFormats&gt;
+          &lt;bindy id=&quot;bindyDataformat&quot; type=&quot;Csv&quot; classType=&quot;org.apache.camel.bindy.model.Order&quot;/&gt;
+        &lt;/dataFormats&gt;
 
 		&lt;route&gt;
 			&lt;from uri=&quot;file://src/data/csv/?noop=true&quot; /&gt;



Mime
View raw message