You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2014/06/13 15:17:59 UTC

svn commit: r912447 - in /websites/production/camel/content: cache/main.pageCache etl-example.html

Author: buildbot
Date: Fri Jun 13 13:17:59 2014
New Revision: 912447

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/etl-example.html

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

Modified: websites/production/camel/content/etl-example.html
==============================================================================
--- websites/production/camel/content/etl-example.html (original)
+++ websites/production/camel/content/etl-example.html Fri Jun 13 13:17:59 2014
@@ -84,28 +84,8 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="ETLExample-ExtractTransformLoad(ETL)Example">Extract Transform Load (ETL) Example </h2>
-
-<p>The <a shape="rect" href="etl.html">ETL</a> (Extract, Transform, Load) example shows how to load data into a database using Camel. In this example we will poll for files, transform them and then store them in the database via the <a shape="rect" href="jpa.html">JPA</a> component.</p>
-
-<h3 id="ETLExample-Overview">Overview</h3>
-
-<p>This example lives in the <em>examples/camel-example-etl</em> directory and will poll for XML files in the child <em>src/data</em> directory. When the files are detected, they are converted, using the fallback <a shape="rect" href="jaxb.html">JAXB</a> <a shape="rect" href="type-converter.html">Type Converter</a> to a PersonDocument class. This POJO is then transformed using a custom <a shape="rect" href="type-converter.html">Type Converter</a> into a CustomerEntity bean using the CustomerTransformer class. Then this bean is stored in the database via the <a shape="rect" href="jpa.html">JPA</a> component.</p>
-
-<p>The code for this example is as follows</p>
-
-<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Java Class </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Purpose </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java" rel="nofollow">CustomerEntity</a> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The JPA entity bean (i.e. a POJO with @Entity) </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/PersonDocument.java" rel="nofollow">PersonDocument</a> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The JAXB2 POJO used to parse the XML </p></td></tr><tr><td
  colspan="1" rowspan="1" class="confluenceTd"><p> <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java" rel="nofollow">CustomerTransformer</a> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The custom <a shape="rect" href="type-converter.html">Type Converter</a> used to convert a PersonDocument into a CustomerEntity </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java" rel="nofollow">EtlRoutes</a> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> The Camel routing <a shape="rect" href="dsl.html">DSL</a> to define the flow from the files to the converter to the <a shape="rect" href="jpa.html">JPA</a> endpoint </p></td></tr></tbody></table></d
 iv>
-
-
-<p>Then there is the spring configuration file in <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/resources/META-INF/spring/camel-context.xml" rel="nofollow">src/resources/META-INF/services/camel-context.xml</a> which defines the JPA template and tells Camel to look in the <strong>org.apache.camel.example.etl</strong> package to find its routes.</p>
-
-<h3 id="ETLExample-Codewalkthrough">Code walkthrough </h3>
-
-<p>So lets start with the route definition in <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java" rel="nofollow">EtlRoutes</a></p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-public class EtlRoutes extends SpringRouteBuilder {
+<div class="wiki-content maincontent"><h2 id="ETLExample-ExtractTransformLoad(ETL)Example">Extract Transform Load (ETL) Example</h2><p>The <a shape="rect" href="etl.html">ETL</a> (Extract, Transform, Load) example shows how to load data into a database using Camel. In this example we will poll for files, transform them and then store them in the database via the <a shape="rect" href="jpa.html">JPA</a> component.</p><h3 id="ETLExample-Overview">Overview</h3><p>This example lives in the <em>examples/camel-example-etl</em> directory and will poll for XML files in the child <em>src/data</em> directory. When the files are detected, they are converted, using the fallback <a shape="rect" href="jaxb.html">JAXB</a> <a shape="rect" href="type-converter.html">Type Converter</a> to a PersonDocument class. This POJO is then transformed using a custom <a shape="rect" href="type-converter.html">Type Converter</a> into a CustomerEntity bean using the CustomerTransformer class. Then this bean is sto
 red in the database via the <a shape="rect" href="jpa.html">JPA</a> component.</p><p>The code for this example is as follows</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Java Class</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Purpose</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java" rel="nofollow">CustomerEntity</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The JPA entity bean (i.e. a POJO with @Entity)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/PersonDocument.java" rel="nofollow">PersonDocument</a></
 p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The JAXB2 POJO used to parse the XML</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java" rel="nofollow">CustomerTransformer</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The custom <a shape="rect" href="type-converter.html">Type Converter</a> used to convert a PersonDocument into a CustomerEntity</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java" rel="nofollow">EtlRoutes</a></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The Camel routing <a shape="rect" href="dsl.html">DSL</a> to define the flow from the fil
 es to the converter to the <a shape="rect" href="jpa.html">JPA</a> endpoint</p></td></tr></tbody></table></div><p>Then there is the spring configuration file in <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/resources/META-INF/spring/camel-context.xml" rel="nofollow">src/resources/META-INF/services/camel-context.xml</a> which defines the JPA template and tells Camel to look in the <strong>org.apache.camel.example.etl</strong> package to find its routes.</p><h3 id="ETLExample-Codewalkthrough">Code walkthrough</h3><p>So lets start with the route definition in <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java" rel="nofollow">EtlRoutes</a></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[public class EtlRoutes extends SpringRouteBuilder {
     public void configure() throws Exception {
 
         from(&quot;file:src/data?noop=true&quot;)
@@ -119,17 +99,8 @@ public class EtlRoutes extends SpringRou
     }
 }
 ]]></script>
-</div></div>
-
-<p>The above sets up a route from the <em>src/data</em> directory. Notice we're using the <em>noop</em> mode of the <a shape="rect" href="file2.html">File</a> component so that the files are not moved or deleted when they are processed (so when the tool is restarted they will be processed again).</p>
-
-<p>We're converting the body of the message to a <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/PersonDocument.java" rel="nofollow">PersonDocument</a> which since this POJO as an @XmlRootElement annotation from <a shape="rect" href="jaxb.html">JAXB</a> will kick in the <a shape="rect" href="type-converter.html">Type Converter</a> to use JAXB to unmarshall the object.</p>
-
-<p>Then we send the message with a PersonDocument body to the <a shape="rect" href="jpa.html">JPA</a> endpoint. Notice how this endpoint specifies the expected type. So the <a shape="rect" href="type-converter.html">Type Converter</a> is gonna try convert the PersonDocument to a <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java" rel="nofollow">CustomerEntity</a>. Here Camel will find the <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java" rel="nofollow">CustomerTransformer</a> class which has an @Converter method</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-@Converter
+</div></div><p>The above sets up a route from the <em>src/data</em> directory. Notice we're using the <em>noop</em> mode of the <a shape="rect" href="file2.html">File</a> component so that the files are not moved or deleted when they are processed (so when the tool is restarted they will be processed again). Because the file consumer uses a memory based <a shape="rect" class="external-link" href="http://camel.apache.org/idempotent-consumer.html">Idempotent Consumer</a> every file is only processed once (per program run) (see also <em>noop</em> and <em>idempotent*</em> options from <a shape="rect" class="external-link" href="http://camel.apache.org/file2.html">file</a> component).</p><p>We're converting the body of the message to a <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/PersonDocument.java" rel="nofollow">PersonDocument</a> which since this POJO as an @XmlRootElement
  annotation from <a shape="rect" href="jaxb.html">JAXB</a> will kick in the <a shape="rect" href="type-converter.html">Type Converter</a> to use JAXB to unmarshall the object.</p><p>Then we send the message with a PersonDocument body to the <a shape="rect" href="jpa.html">JPA</a> endpoint. Notice how this endpoint specifies the expected type. So the <a shape="rect" href="type-converter.html">Type Converter</a> is gonna try convert the PersonDocument to a <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java" rel="nofollow">CustomerEntity</a>. Here Camel will find the <a shape="rect" class="external-link" href="https://github.com/apache/camel/blob/master/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java" rel="nofollow">CustomerTransformer</a> class which has an @Converter method</p><div class="code panel pdl" style="b
 order-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[@Converter
 public final class CustomerTransformer {
 
     private static final Logger LOG = LoggerFactory.getLogger(CustomerTransformer.class);
@@ -184,53 +155,28 @@ public final class CustomerTransformer {
 
 }
 ]]></script>
-</div></div>
-
-<p>which performs the necessary conversion to an entity bean which is then stored in the database</p>
-
-<h3 id="ETLExample-Runningtheexample">Running the example</h3>
-
-<p>To run the example we use the <a shape="rect" href="camel-maven-plugin.html">Camel Maven Plugin</a>. For example from the source or binary distribution the following should work</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-cd examples/camel-example-etl
+</div></div><p>which performs the necessary conversion to an entity bean which is then stored in the database</p><h3 id="ETLExample-Runningtheexample">Running the example</h3><p>To run the example we use the <a shape="rect" href="camel-maven-plugin.html">Camel Maven Plugin</a>. For example from the source or binary distribution the following should work</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[cd examples/camel-example-etl
 mvn camel:run
 ]]></script>
-</div></div>
-
-<p>If you prefer you can just run the Main directly using</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-mvn compile exec:java
+</div></div><p>If you prefer you can just run the Main directly using</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[mvn compile exec:java
 ]]></script>
-</div></div>
-
-<p>Please note that when you run the example for the first time, the converter <code>CustomerTransformer</code> will not be able to find any entities inside the database, so that along the logs written into the console you should see:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-...
+</div></div><p>Please note that when you run the example for the first time, the converter <code>CustomerTransformer</code> will not be able to find any entities inside the database, so that along the logs written into the console you should see:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[...
 thread #0 - file://src/data] CustomerTransformer            INFO  Created a new CustomerEntity Customer[userName: james firstName: null surname: null] as no matching persisted entity found.
 ...
 thread #0 - file://src/data] CustomerTransformer            INFO  Created a new CustomerEntity Customer[userName: hiram firstName: null surname: null] as no matching persisted entity found.
 ...
 ]]></script>
-</div></div>
-
-<p>However running the example for a second time, as the entites have been already inserted into the database, the log should now say:</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
-...
+</div></div><p>However running the example for a second time, as the entites have been already inserted into the database, the log should now say:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[...
 thread #0 - file://src/data] CustomerTransformer            INFO  Found a matching CustomerEntity Customer[userName: james firstName: James surname: Strachan] having the userName james.
 ...
 thread #0 - file://src/data] CustomerTransformer            INFO  Found a matching CustomerEntity Customer[userName: hiram firstName: Hiram surname: Chirino] having the userName hiram.
 ...
 ]]></script>
-</div></div>
-
-<p>Failing that you can run the Main from inside your IDE if you prefer. Follow the <a shape="rect" href="building.html">Building</a> instructions to create an Eclipse/IDEA project to import</p></div>
+</div></div><p>Failing that you can run the Main from inside your IDE if you prefer. Follow the <a shape="rect" href="building.html">Building</a> instructions to create an Eclipse/IDEA project to import</p></div>
         </td>
         <td valign="top">
           <div class="navigation">