camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Camel > Smooks
Date Tue, 24 Aug 2010 09:21:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=CAMEL&amp;forWysiwyg=true"
type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://cwiki.apache.org/confluence/display/CAMEL/Smooks">Smooks</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://cwiki.apache.org/confluence/display/~davsclaus">Claus
Ibsen</a>
    </h4>
        <br/>
                         <h4>Changes (1)</h4>
                                 
    
<div id="page-diffs">
            <table class="diff" cellpadding="0" cellspacing="0">
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" >Parsing from any given data source
to EDI is implemented using Camel [Data Format].  <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{info:title=@Deprecated}
<br>The {{camel-smooks}} component is @deprecated as the Smooks Library will integrate
Camel out of the box. <br>{info} <br> <br></td></tr>
            <tr><td class="diff-unchanged" >{include:EDI} <br></td></tr>
        </table>
</div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h2><a name="Smooks-Smooks"></a>Smooks</h2>

<p>The <b>smooks</b> component supports the <a href="http://milyn.codehaus.org/Smooks"
class="external-link" rel="nofollow">Smooks Library</a> for EDI parsing. The <b>camel-smooks</b>
library is provided by the <a href="http://code.google.com/p/camel-extra/" class="external-link"
rel="nofollow">Camel Extra</a> project which hosts all *GPL related components for
Camel.</p>

<p>It is <b>only</b> the EDI parsing feature that is implemented in this
component. The other features from Smooks are covered in existing camel components.<br/>
Parsing from any given data source to EDI is implemented using Camel <a href="/confluence/display/CAMEL/Data+Format"
title="Data Format">Data Format</a>. </p>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td
valign='top'><img src="/confluence/images/icons/emoticons/information.gif" width="16"
height="16" align="absmiddle" alt="" border="0"></td><td><b>@Deprecated</b><br
/>The <tt>camel-smooks</tt> component is @deprecated as the Smooks Library
will integrate Camel out of the box.</td></tr></table></div>

<h2><a name="Smooks-EDIDataFormat"></a>EDI DataFormat</h2>

<p>This component ships with a EDI dataformat that can be used to format from a <tt>java.io.InputStream</tt>
to XML as a <tt>org.w3c.Document</tt> Object.</p>
<ul>
	<li>marshal = currently not supported by <a href="http://milyn.codehaus.org/Home"
class="external-link" rel="nofollow">Smooks</a></li>
	<li>unmarshal = from stream to XML (can be used when reading EDI files)</li>
</ul>


<p>The EDIDataFormat must be configued with either a:</p>
<ul>
	<li><tt>setSmooksConfig(configfile)</tt> = a fully <a href="http://milyn.codehaus.org/Home"
class="external-link" rel="nofollow">Smooks</a> configuration file</li>
	<li><tt>setMappingModel(modelfile)</tt> = just the mapping model xml file
and Camel will use a default <a href="http://milyn.codehaus.org/Home" class="external-link"
rel="nofollow">Smooks</a> configuration</li>
</ul>


<p>To use the data format simply instantiate an instance, set the configuration (above)
and invoke the unmarshal operation in the route builder:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
DataFormat edi = <span class="code-keyword">new</span> EDIDataFormat();
edi.setMappingModel(<span class="code-quote">"my-order-mapping.xml"</span>);
...
from(<span class="code-quote">"file:<span class="code-comment">//edi/in"</span>).
</span>  unmarshal(edi).
  to(<span class="code-quote">"jms:queue:edi"</span>);
</pre>
</div></div>

<p>And you can also provide the full <a href="http://milyn.codehaus.org/Home" class="external-link"
rel="nofollow">Smooks</a> configuration file where you can configure <a href="http://milyn.codehaus.org/Home"
class="external-link" rel="nofollow">Smooks</a> as you want, in case the default
configuration isn't useful:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
DataFormat edi = <span class="code-keyword">new</span> EDIDataFormat();
edi.setSmooksConfig(<span class="code-quote">"my-smooks-config.xml"</span>);
...
from(<span class="code-quote">"file:<span class="code-comment">//edi/in"</span>).
</span>  unmarshal(edi).
  to(<span class="code-quote">"jms:queue:edi"</span>);
</pre>
</div></div>


<h3><a name="Smooks-Dependencies"></a>Dependencies</h3>

<p>To use EDI in your camel routes you need to add the a dependency on <b>camel-smooks</b>
which implements this data format. </p>

<p>This component is hosted at the <a href="http://camel-extra.googlecode.com/" class="external-link"
rel="nofollow">Camel Extra</a> project since the Smooks library uses a licenses which
cant be included directly in an Apache project.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
        </div>
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Smooks">View Online</a>
        |
        <a href="https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=92971&revisedVersion=5&originalVersion=4">View
Changes</a>
                |
        <a href="https://cwiki.apache.org/confluence/display/CAMEL/Smooks?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message