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 2013/10/21 14:18:53 UTC

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

Author: buildbot
Date: Mon Oct 21 12:18:53 2013
New Revision: 883568

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 Mon Oct 21 12:18:53 2013
@@ -95,15 +95,15 @@
 <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"> Java Class </th><th colspan="1" rowspan="1" class="confluenceTh"> Purpose </th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java">CustomerEntity</a> </td><td colspan="1" rowspan="1" class="confluenceTd"> The JPA entity bean (i.e. a POJO with @Entity) </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/PersonDocument.java">PersonDocument</a> </td><td colspan="1" rowspan="1" class="confluenceTd"> The JAXB2 POJO used to parse the XML </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <a shape="rect" class="external-link" href="http:
 //svn.apache.org/repos/asf/acamel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java">CustomerTransformer</a> </td><td colspan="1" rowspan="1" class="confluenceTd"> The custom <a shape="rect" href="type-converter.html" title="Type Converter">Type Converter</a> used to convert a PersonDocument into a CustomerEntity </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java">EtlRoutes</a> </td><td colspan="1" rowspan="1" class="confluenceTd"> The Camel routing <a shape="rect" href="dsl.html" title="DSL">DSL</a> to define the flow from the files to the converter to the <a shape="rect" href="jpa.html" title="JPA">JPA</a> endpoint </td></tr></tbody></table>
+<table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"> Java Class </th><th colspan="1" rowspan="1" class="confluenceTh"> Purpose </th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <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> </td><td colspan="1" rowspan="1" class="confluenceTd"> The JPA entity bean (i.e. a POJO with @Entity) </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <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> </td><td colspan="1" rowspan="1" class="confluenceTd"> The JAXB2 POJO used to parse the XML </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <a shape="rect" cla
 ss="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> </td><td colspan="1" rowspan="1" class="confluenceTd"> The custom <a shape="rect" href="type-converter.html" title="Type Converter">Type Converter</a> used to convert a PersonDocument into a CustomerEntity </td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"> <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> </td><td colspan="1" rowspan="1" class="confluenceTd"> The Camel routing <a shape="rect" href="dsl.html" title="DSL">DSL</a> to define the flow from the files to the converter to the <a shape="rect" href="jpa.html" title="JPA">JPA</a> endpoint </td></tr></tbody></table>
 </div>
 
 
-<p>The there is the spring configuration file in <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-etl/src/main/resources/META-INF/spring/camel-context.xml">src/resources/META-INF/services/camel-context.xml</a> which defines the JPA template and tells Camel to look in the <b>org.apache.camel.example.etl</b> package to find its routes.</p>
+<p>The 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 <b>org.apache.camel.example.etl</b> package to find its routes.</p>
 
 <h3><a shape="rect" name="ETLExample-Codewalkthrough"></a>Code walkthrough </h3>
 
-<p>So lets start with the route definition in <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/EtlRoutes.java">EtlRoutes</a></p>
+<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" style="border-width: 1px;"><div class="codeContent panelContent">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
@@ -118,7 +118,6 @@ public class EtlRoutes extends SpringRou
         from("jpa:org.apache.camel.example.etl.CustomerEntity?consumeDelete=false&amp;delay=3000&amp;consumeLockEntity=false")
             .setHeader(Exchange.FILE_NAME, el("${in.body.userName}.xml"))
             .to("file:target/customers");
-           
     }
 }
 ]]></script>
@@ -126,9 +125,9 @@ public class EtlRoutes extends SpringRou
 
 <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" title="File2">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="http://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/PersonDocument.java">PersonDocument</a> which since this POJO as an @XmlRootElement annotation from <a shape="rect" href="jaxb.html" title="JAXB">JAXB</a> will kick in the <a shape="rect" href="type-converter.html" title="Type Converter">Type Converter</a> to use JAXB to unmarshall the object.</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" title="JAXB">JAXB</a> will kick in the <a shape="rect" href="type-converter.html" title="Type Converter">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" title="JPA">JPA</a> endpoint. Notice how this endpoint specifies the expected type. So the <a shape="rect" href="type-converter.html" title="Type Converter">Type Converter</a> is gonna try convert the PersonDocument to a <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerEntity.java">CustomerEntity</a>. Here Camel will find the <a shape="rect" class="external-link" href="http://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java">CustomerTransformer</a> class which has an @Converter method</p>
+<p>Then we send the message with a PersonDocument body to the <a shape="rect" href="jpa.html" title="JPA">JPA</a> endpoint. Notice how this endpoint specifies the expected type. So the <a shape="rect" href="type-converter.html" title="Type Converter">Type Converter</a> is gonna try convert the PersonDocument to a <a shape="rect" class="external-link" href="hhttps://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" style="border-width: 1px;"><div class="codeContent panelContent">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
@@ -199,6 +198,24 @@ mvn compile exec:java
 ]]></script>
 </div></div>
 
+<p>Please note that when you run the example for the first time, the converter <tt>CustomerTransformer</tt> 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" style="border-width: 1px;"><div class="codeContent panelContent">
+<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" style="border-width: 1px;"><div class="codeContent panelContent">
+<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" title="Building">Building</a> instructions to create an Eclipse/IDEA project to import</p></div>
         </td>
         <td valign="top">