Repository: camel Updated Branches: refs/heads/master 058c86661 -> 4979edfc0
Added camel-beanio docs to gitbook Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4979edfc Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4979edfc Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4979edfc Branch: refs/heads/master Commit: 4979edfc0e02240b351a041f0edf7b91c6cac663 Parents: 058c866 Author: Andrea Cosentino <[email protected]> Authored: Wed Jan 27 13:29:40 2016 +0100 Committer: Andrea Cosentino <[email protected]> Committed: Wed Jan 27 13:29:40 2016 +0100 ---------------------------------------------------------------------- .../camel-beanio/src/main/docs/beanio.adoc | 91 ++++++++++++++++++++ docs/user-manual/en/SUMMARY.md | 1 + 2 files changed, 92 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/4979edfc/components/camel-beanio/src/main/docs/beanio.adoc ---------------------------------------------------------------------- diff --git a/components/camel-beanio/src/main/docs/beanio.adoc b/components/camel-beanio/src/main/docs/beanio.adoc new file mode 100644 index 0000000..a045a17 --- /dev/null +++ b/components/camel-beanio/src/main/docs/beanio.adoc @@ -0,0 +1,91 @@ +[[BeanIO-BeanIO]] +BeanIO +~~~~~~ + +*Available as of Camel 2.10* + +The BeanIO link:data-format.html[Data Format] uses +http://beanio.org/[BeanIO] to handle flat payloads (such as XML, CSV, +delimited, or fixed length formats). + +BeanIO is configured using a +http://beanio.org/2.0/docs/reference/index.html#TheMappingFile[mappings +XML] file where you define the mapping from the flat format to Objects +(POJOs). This mapping file is mandatory to use. + +[[BeanIO-Options]] +Options +^^^^^^^ +[width="100%",cols="10%,10%,80%",options="header",] +|======================================================================= +|Option |Default |Description + +|mapping | | The BeanIO mapping file. The option is mandatory. Is by default loaded +from the classpath. You can prefix with `file:`, `http:`, or +`classpath:` to denote from where to load the mapping file. + +|streamName | |The name of the stream to use. This option is mandatory. + +|ignoreUnidentifiedRecords |`false` |Whether to ignore unidentified records. + +|ignoreUnexpectedRecords |`false` |Whether to ignore unexpected records. + +|ignoreInvalidRecords |`false` |Whether to ignore invalid records. + +|encoding |Platform default |The charset to use. +|======================================================================= + +[[BeanIO-Usage]] +Usage +^^^^^ + +An example of a +https://svn.apache.org/repos/asf/camel/trunk/components/camel-beanio/src/test/resources/org/apache/camel/dataformat/beanio/mappings.xml[mapping +file is here]. + +[[BeanIO-UsingJavaDSL]] +Using Java DSL +++++++++++++++ + +To use the `BeanIODataFormat` you need to configure the data format with +the mapping file, as well the name of the stream. + + In Java DSL this can be done as shown below. The streamName is +"employeeFile". + +Then we have two routes. The first route is for transforming CSV data +into a List<Employee> Java objects. Which we then +link:splitter.html[split], so the mock endpoint + + receives a message for each row. + +The 2nd route is for the reverse operation, to transform a +List<Employee> into a stream of CSV data. + +The CSV data could for example be as below: + +[[BeanIO-UsingXMLDSL]] +Using XML DSL ++++++++++++++ + +To use the BeanIO data format in XML, you need to configure it using the +<beanio> XML tag as shown below. The routes is similar to the example +above. + +[[BeanIO-Dependencies]] +Dependencies +^^^^^^^^^^^^ + +To use BeanIO in your Camel routes you need to add a dependency on +*camel-beanio* which implements this data format. + +If you use Maven you can just add the following to your pom.xml, +substituting the version number for the latest & greatest release (see +link:download.html[the download page for the latest versions]). + +[source,xml] +--------------------------------------- +<dependency> + <groupId>org.apache.camel</groupId> + <artifactId>camel-beanio</artifactId> + <version>2.10.0</version> +</dependency> +--------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/4979edfc/docs/user-manual/en/SUMMARY.md ---------------------------------------------------------------------- diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md index 3ffac29..e9a8d17 100644 --- a/docs/user-manual/en/SUMMARY.md +++ b/docs/user-manual/en/SUMMARY.md @@ -91,6 +91,7 @@ * [Bam](bam.adoc) * [Barcode](barcode-data-format.adoc) * [Base64](base64.adoc) + * [BeanIO](beanio.adoc) * [CDI](cdi.adoc) * [JMS](jms.adoc) * [Metrics](metrics.adoc)
