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 2015/03/03 02:19:15 UTC
svn commit: r942039 - in /websites/production/camel/content:
cache/main.pageCache dozer.html
Author: buildbot
Date: Tue Mar 3 01:19:15 2015
New Revision: 942039
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/dozer.html
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/dozer.html
==============================================================================
--- websites/production/camel/content/dozer.html (original)
+++ websites/production/camel/content/dozer.html Tue Mar 3 01:19:15 2015
@@ -85,7 +85,7 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="Dozer-Dozer">Dozer</h2><p>The <strong>dozer:</strong> component provides the ability to map between Java beans using the <a shape="rect" class="external-link" href="http://camel.apache.org/dozer-type-conversion.html">Dozer</a> mapping framework.  Camel also supports the ability to trigger Dozer mappings <a shape="rect" class="external-link" href="http://camel.apache.org/dozer-type-conversion.html">as a type converter</a>.  The primary differences between using a Dozer endpoint and a Dozer converter are:</p><ul><li>The ability to manage Dozer mapping configuration on a per-endpoint basis vs. global configuration via the converter registry.</li><li>A Dozer endpoint can be configured to marshal/unmarshal input and output data using Camel data formats to support a single, any-to-any transformation endpoint</li><li>The Dozer component allows for fine-grained integration and extension of Dozer to support extended functional
ity (e.g. mapping constants to target fields).</li></ul><p>In order to use the Dozer component, Maven users will need to add the following dependency to their <code>pom.xml</code>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 id="Dozer-Dozer">Dozer</h2><p>The <strong>dozer:</strong> component provides the ability to map between Java beans using the <a shape="rect" class="external-link" href="http://camel.apache.org/dozer-type-conversion.html">Dozer</a> mapping framework.  Camel also supports the ability to trigger Dozer mappings <a shape="rect" class="external-link" href="http://camel.apache.org/dozer-type-conversion.html">as a type converter</a>.  The primary differences between using a Dozer endpoint and a Dozer converter are:</p><ul><li>The ability to manage Dozer mapping configuration on a per-endpoint basis vs. global configuration via the converter registry.</li><li>A Dozer endpoint can be configured to marshal/unmarshal input and output data using Camel data formats to support a single, any-to-any transformation endpoint</li><li>The Dozer component allows for fine-grained integration and extension of Dozer to support additional function
ality (e.g. mapping literal values, using expressions for mappings, etc.).</li></ul><p>In order to use the Dozer component, Maven users will need to add the following dependency to their <code>pom.xml</code>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-dozer</artifactId>
@@ -93,14 +93,21 @@
<!-- use the same version as your Camel core version -->
</dependency>
]]></script>
-</div></div><h3 id="Dozer-URIformat">URI format</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="Dozer-URIformat">URI format</h3><p>The Dozer component only supports producer endpoints.</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[dozer:endpointId[?options]
]]></script>
</div></div><p>Where <strong>endpointId</strong> is a name used to uniquely identify the Dozer endpoint configuration. </p><p>An example Dozer endpoint URI:</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[from("direct:orderInput").
to("dozer:transformOrder?mappingFile=orderMapping.xml&targetModel=example.XYZOrder").
to("direct:orderOutput");]]></script>
-</div></div><h3 id="Dozer-Options">Options</h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mappingFile</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>dozerBeanMapping.xml</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The location of a Dozer configuration file. The file is loaded from the classpath by default, but you can use <code>file:</code>, <code>classpath:<span style="font-family: Arial , sans-serif;">, or </span></code><code>http: </code>to load the configuration from a specific location.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>unmarshalId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></
td><td colspan="1" rowspan="1" class="confluenceTd">The id of a dataFormat defined within the Camel Context to use for unmarshalling the mapping input from a non-Java type.<p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>marshalId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span>none</span></p></td><td colspan="1" rowspan="1" class="confluenceTd">The id of a dataFormat defined within the Camel Context to use for marshalling the mapping output to a non-Java type.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>sourceModel</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span>none</span></p></td><td colspan="1" rowspan="1" class="confluenceTd">Fully-qualified class name for the source type used in the mapping. If specified, the input to the mapping is converted to the specified type before being mapped with Dozer.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>
targetModel</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span>none</span></p></td><td colspan="1" rowspan="1" class="confluenceTd">Fully-qualified class name for the target type used in the mapping. This option is required.</td></tr></tbody></table></div><p> </p><p> </p></div>
+</div></div><h3 id="Dozer-Options">Options</h3><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mappingFile</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>dozerBeanMapping.xml</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The location of a Dozer configuration file. The file is loaded from the classpath by default, but you can use <code>file:</code>, <code>classpath:<span style="font-family: Arial , sans-serif;">, or </span></code><code>http: </code>to load the configuration from a specific location.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>unmarshalId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></
td><td colspan="1" rowspan="1" class="confluenceTd">The id of a dataFormat defined within the Camel Context to use for unmarshalling the mapping input from a non-Java type.<p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>marshalId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span>none</span></p></td><td colspan="1" rowspan="1" class="confluenceTd">The id of a dataFormat defined within the Camel Context to use for marshalling the mapping output to a non-Java type.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>sourceModel</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span>none</span></p></td><td colspan="1" rowspan="1" class="confluenceTd">Fully-qualified class name for the source type used in the mapping. If specified, the input to the mapping is converted to the specified type before being mapped with Dozer.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>
targetModel</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span>none</span></p></td><td colspan="1" rowspan="1" class="confluenceTd">Fully-qualified class name for the target type used in the mapping. This option is required.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code><span>mappingConfiguration</span></code></td><td colspan="1" rowspan="1" class="confluenceTd">none</td><td colspan="1" rowspan="1" class="confluenceTd">The name of a <span style="line-height: 1.4285715;">DozerBeanMapperConfiguration bean in the Camel registry which should be used for configuring the Dozer mapping. This is an alternative to the mappingFile option that can be used for fine-grained control over how Dozer is configured.</span></td></tr></tbody></table></div><h3 id="Dozer-UsingDataFormatswithDozer">Using Data Formats with Dozer</h3><p>Dozer does not support non-Java sources and targets for mappings, so it cannot, for example, map an XML document to a Java object
on its own.  Luckily, Camel has extensive support for marshalling between Java and a wide variety of formats using <a shape="rect" class="external-link" href="http://camel.apache.org/data-format.html">data formats</a>.  The Dozer component takes advantage of this support by allowing you to specify that input and output data should be passed through a data format prior to processing via Dozer.  You can always do this on your own outside the call to Dozer, but supporting it directly in the Dozer component allows you to use a single endpoints to configure any-to-any transformation within Camel.</p><p>As an example, let's say you wanted to map between an XML data structure and a JSON data structure using the Dozer component.  If you had the following data formats defined in a Camel Context:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<dataFormats>
+ <json library="Jackson" id="myjson"/>
+ <jaxb contextPath="org.example" id="myjaxb"/>
+</dataFormats>]]></script>
+</div></div><p class="p1">You could then configure a Dozer endpoint to unmarshal the input XML using a JAXB data format and marshal the mapping output using Jackson.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<endpoint uri="dozer:xml2json?marshalId=myjson&amp;unmarshalId=myjaxb&amp;targetModel=org.example.Order"/>]]></script>
+</div></div><p> </p><pre class="p1"> </pre><p class="p1"><span class="s1"><br clear="none"></span></p></div>
</td>
<td valign="top">
<div class="navigation">