blob: b0780a8689a0c6eb208ad5ce9c273a74c92788c5 [file] [log] [blame]
<!DOCTYPE html>
<html data-n-head="" data-n-head-ssr>
<head>
<meta data-n-head="true" charset="utf-8"><meta data-n-head="true" content="width=device-width,initial-scale=1" name="viewport"><meta data-n-head="true" content="Eclipse Unide: Understand Industry devices" name="description" data-hid="description"><title data-n-head="true">Eclipse unide - PPMP Use Cases: Template for PPMP transformation</title><link href="/unide/favicon.ico" rel="icon" data-n-head="true" type="image/x-icon"><base href="/unide/"><link href="/unide/files/app.afe60790845d32718c70d2bd3d6005bc.css" rel="stylesheet"><style data-vue-ssr-id="771fc815:0">body .sidebar div{margin-bottom:2em;font-size:.875em}body .sidebar div .subtitle{margin-bottom:.5rem}</style><style data-vue-ssr-id="d5b0f30e:0">@keyframes spinAround{0%{transform:rotate(0)}to{transform:rotate(359deg)}}header.nav-header{box-shadow:0 3px 5px 0 #ddd;margin-bottom:2em;padding-bottom:0}header.nav-header nav.navbar{display:flex;align-items:flex-end;border-bottom:5px solid #50237f}header.nav-header nav.navbar .navbar-burger{margin-left:0;height:auto}header.nav-header nav.navbar .navbar-burger span{height:2px;width:25px}header.nav-header nav.navbar .navbar-burger span:first-child{margin-top:-9px}header.nav-header nav.navbar .navbar-burger span:nth-child(3){margin-top:7px}header.nav-header nav.navbar .navbar-brand{align-self:stretch}header.nav-header nav.navbar .navbar-brand .navbar-item img{max-height:none;width:240px}header.nav-header nav.navbar .navbar-item,header.nav-header nav.navbar .navbar-link,header.nav-header nav.navbar .navbar-link a{color:#a7a7a7}header.nav-header nav.navbar .navbar-item.is-active,header.nav-header nav.navbar .navbar-item:hover,header.nav-header nav.navbar .navbar-link a.is-active,header.nav-header nav.navbar .navbar-link a:hover,header.nav-header nav.navbar .navbar-link.is-active,header.nav-header nav.navbar .navbar-link:hover{color:#78be20}header.nav-header nav.navbar .navbar-item:hover,header.nav-header nav.navbar .navbar-link a:hover,header.nav-header nav.navbar .navbar-link:hover{background-color:transparent;text-decoration:none;font-weight:700}header.nav-header nav.navbar .navbar-item .dropdown-trigger,header.nav-header nav.navbar .navbar-link .dropdown-trigger,header.nav-header nav.navbar .navbar-link a .dropdown-trigger{display:flex}@media screen and (min-width:1024px){.nav-header .container>.navbar .navbar-menu{margin-right:1rem}}@media screen and (max-width:1007px){header.nav-header nav.navbar{flex-direction:column;align-items:stretch}header.nav-header nav.navbar .navbar-menu{order:1;box-shadow:none}}@media screen and (min-width:1008px){nav.navbar .container .navbar-menu{height:40px}}</style><style data-vue-ssr-id="73fc20d4:0">@keyframes spinAround{0%{transform:rotate(0)}to{transform:rotate(359deg)}}.article h1{font-weight:400}.article h2,.article h3,.article h4{color:#a7a7a7}.article .card{border-radius:5px}.article .card .card-header{border-radius:5px 5px 0 0}.article .card .card-header.is-primary{background-color:#50237f}.article .card .card-header.is-primary .card-header-title{color:#fff}.article .card.figure{margin-bottom:1rem;text-align:center}@media screen and (min-width:415px){.article .card.figure.is-pulled-left,.article .card.figure.is-pulled-right{max-width:33%}.article .card.figure.is-pulled-left{margin-right:1rem;text-align:left}.article .card.figure.is-pulled-right{margin-left:1rem}.article .card.figure.is-pulled-right .card-content{text-align:right}}.article .card.figure .card-content{padding:.5rem;font-size:.75rem}.article .card.figure figure{margin:0}.article>.columns.pageNav{margin-top:2em}.article>.columns.pageNav .column a.button{font-size:.9em;padding:1.3rem}.article pre[class*=language-]{max-height:400px}</style><style data-vue-ssr-id="fc44206e:0">.recentPosts ul{list-style:none}</style><style data-vue-ssr-id="3dafb0ac:0">.blogArchives ul{list-style:none}</style>
</head>
<body data-n-head="">
<div id="__nuxt" data-server-rendered="true"><div class="nuxt-progress" style="width:0%;height:2px;background-color:#50237f;opacity:0"></div><div id="__layout"><div><header class="nav-header"><div class="container"><nav class="navbar"><div class="navbar-menu" id="navMenu"><div class="navbar-start"><a href="/unide/" class="navbar-item">
Home
</a><a href="/unide/proposal" class="navbar-item">
Proposal
</a><a href="/unide/specification" class="navbar-item">
Specification
</a><a href="/unide/blog" class="navbar-item is-active">
Blog Archives
</a><a href="/unide/faq" class="navbar-item">
FAQ
</a></div></div><div class="navbar-brand"><div class="navbar-burger burger"><span></span><span></span><span></span></div><a href="/unide/" class="navbar-item nuxt-link-active"><img src="logo.svg"></a></div></nav></div></header><div class="container"><div class="header clearfix"></div><div class="columns"><div class="article column is-8"><h1 class="title is-3">
PPMP Use Cases: Template for PPMP transformation
</h1><h2 class="subtitle is-6"><i class="fa fa-calendar"></i>  
09/04/18
</h2><div class="content"><div><h1>Quick start</h1>
<p>In <a href="https://www.eclipse.org/unide/blog/2018/2/11/Transform-PPMP-with-camel/">a previous blog post</a>, I have already introduced Apache Camel as a tool to transform to PPMP. In this post, I want to dive a little deeper to get you started with your own transformation.<br>
You can find corresponding source code with some transformation examples <a href="https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement/tree/master/camel-integrator">in the repository of the Eclipse PPM Testbed</a>. After download or checkout of the project, you can easily package everything necessary for an installation via <a href="https://maven.apache.org/">Apache Maven</a> and java 8+:</p>
<pre class="language-bash"><code class="language-bash"><span class="token function">git</span> clone https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement.git
<span class="token function">cd</span> eclipseiot-testbed-productionperformancemanagement
<span class="token function">cd</span> camel-integrator
mvn package
</code></pre>
<p>After successful build, you should get a zip file at <code>target/camel-integrator-*-assembly.zip</code> with the following content</p>
<ul>
<li><code>bin</code><br>
The IntegratorStarter* files for Windows and Linux can be used to start the integrator manually. WinServiceInstaller.bat und WinServiceUninstaller.bat can be executed with Admin permissions in Windows to register/unregister this java application as Windows Service called "Integrator Service".</li>
<li><code>conf</code><br>
This is where the main configuration file <code>application-context.xml</code>, further included spring xml configurations, as well as the configuration for logging <code>log4j.properties</code> and a key-value-file for quick configuration <code>application.properties</code> can be found. After modification of any of them, the integrator should be restarted.</li>
<li><code>lib</code><br>
Contains all java dependencies and their dependencies as individual jar files</li>
<li><code>log</code><br>
After the first start, you will find an additional directory that contains the logs of every execution, as defined in the <code>conf/log4j.properties</code> file.</li>
</ul>
<p>So this <code>camel-integrator-*-assembly.zip</code> is all you need, ready to being shipped and installed in your target system.</p>
<h1>How can I modify this?</h1>
<p>In the <code>conf</code> folder of the output or <code>src/main/resources</code> src folder, you'll find multiple examples on how to use Apache Camel with Production Performance Management Protocol. Most of the examples are based on <a href="https://github.com/apache/camel/blob/master/components/camel-spring/src/main/docs/spring.adoc">spring xml</a>.<br>
The most important terms to understand them are:</p>
<table>
<thead>
<tr>
<th>xml tag</th>
<th>meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>bean</td>
<td>additional functionality, coded as java class / function</td>
</tr>
<tr>
<td>camelContext</td>
<td>the main, camel specific configurations</td>
</tr>
<tr>
<td>route</td>
<td>describes the data flow as process</td>
</tr>
<tr>
<td>from / to</td>
<td>entry / exit points for the data flow. This is also, were external systems are accessed via <a href="https://github.com/apache/camel/tree/camel-2.21.0/components">components</a></td>
</tr>
<tr>
<td>onException</td>
<td>error handling for the data flow</td>
</tr>
<tr>
<td>pipeline, multicast, ...</td>
<td>routing of data via <a href="http://camel.apache.org/enterprise-integration-patterns.html">Enterprise Integration pattern</a></td>
</tr>
</tbody>
</table>
<p>Among others, you'll find:</p>
<div class="card figure is-pulled-right">
<div class="card-image">
<figure class="image">
<img src="/unide/images/blog/Transform-PPMP-with-camel-2-logfile.png" alt="html log file" title="html log file">
</figure>
</div>
<div class="card-content">
html logfile before transformation to PPMP
</div>
</div>
<ul>
<li><code>application-context.xml</code><br>
Main entry file to start camel routes. It contains a general PPMP validation REST endpoint that reuses the route from <code>ppmp-validate-context.xml</code></li>
<li><code>mqtt-context.xml</code><br>
A simple example of converting transport protocol (mqtt to REST), without looking at the payload</li>
<li><code>ppmp-splitAndRewrite-context.xml</code><br>
Shows how to receive (PPMP-) payload via different REST paths (/rest or /ppm), and each forwarding to two seperate endpoints (/rest and /ppm)
<ul>
<li><code>ppmpRewrite.xml</code> and <code>ppmRewrite.xml</code><br>
mapping examples to rewrite the urls</li>
</ul>
</li>
<li><code>ppmp-validate-context.xml</code><br>
A simple validation route for PPMP messages that can be reused in many other routes.</li>
<li><code>psi6000-transform-context.xml</code><br>
A more advanced example of converting a psi6000 JSON format, converting it to plain old java object (POJO), transforming that to PPMP POJOs (using <a href="https://github.com/eclipse/unide.java">unide.java</a>) and forwarding these to actual REST endpoints</li>
<li><code>kistler.xml</code><br>
This example takes html files with a structure similar to the test file in <a href="https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement/blob/master/camel-integrator/src/test/data/00000855.html"><code>src/test/data/00000855.html</code></a>, cleans the html structure, retrieves the relevant parts via <a href="https://en.wikipedia.org/wiki/XPath">XPath</a> and creates a PPMP process message out of that</li>
<li><code>application.properties</code><br>
Contains key/value pairs that can be used in the camel context configurations.</li>
<li><code>log4j.properties</code><br>
The configuration for logging. For testing purposes, the log4j.properties in /src/test/resources is used.</li>
</ul>
<p>In order to get familiar with these transformations, I suggest you:</p>
<ul>
<li>open the <code>application-context.xml</code> in your favorite editor</li>
<li>remove the <code>&lt;import .../></code> statements</li>
<li>add your own <code>&lt;route>...&lt;/route></code>, maybe as simple as<pre class="language-xml"><code class="language-xml"> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>route</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>from</span> <span class="token attr-name">uri</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>jetty:http://0.0.0.0:9090/<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>setBody</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>simple</span><span class="token punctuation">></span></span>hello world!<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>simple</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>setBody</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>route</span><span class="token punctuation">></span></span>
</code></pre>
</li>
<li>start a run directly (with bundling to a zip file) with:<pre class="language-bash"><code class="language-bash"> mvn exec:java
</code></pre>
</li>
<li>and review the result. With the example above, just open the url <a href="http://localhost:9090">http://localhost:9090</a> and see the <code>hello world!</code> in your browser</li>
</ul>
<p>If you prefer a visual model of these camel xml definitions, you could also make use of <a href="https://tools.jboss.org/features/fusetools.html">JBoss Fuse Tooling</a> which is available for <a href="https://projects.eclipse.org/releases/oxygen">Eclipse Workbench 4.3+</a> through <a href="https://marketplace.eclipse.org/content/jboss-tools">the Marketplace</a>. Be aware that this might cause additional overhead.</p>
<div class="card figure">
<div class="card-image">
<figure class="image">
<img src="/unide/images/blog/Transform-PPMP-with-camel-2-eclipse.png" alt="JBoss Tools" title="JBoss Tools for Eclipse Workbench">
</figure>
</div>
<div class="card-content">
JBoss Tools for Eclipse Workbench
</div>
</div>
<p>If you want to make use of any other of the (as of camel 2.21.0) <a href="https://github.com/apache/camel/tree/camel-2.21.0/components">281+ components</a>, you should add the respective maven dependency to the <code>pom.xml</code>. For example:</p>
<pre class="language-xml"><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>project</span> <span class="token attr-name">xmlns</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://maven.apache.org/POM/4.0.0<span class="token punctuation">"</span></span> <span class="token attr-name"><span class="token namespace">xmlns:</span>xsi</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.w3.org/2001/XMLSchema-instance<span class="token punctuation">"</span></span>
<span class="token attr-name"><span class="token namespace">xsi:</span>schemaLocation</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>
...
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependencies</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">></span></span>org.apache.camel<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">></span></span>camel-amqp<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>version</span><span class="token punctuation">></span></span>${camel.version}<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>version</span><span class="token punctuation">></span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">></span></span>
...
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependencies</span><span class="token punctuation">></span></span>
...
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>project</span><span class="token punctuation">></span></span>
</code></pre>
<h1>Testing</h1>
<p>Testing is an important part of the development cycle, especially for the core components that have to work reliably in a production environment.<br>
The project includes example tests in the <code>src/test</code> folder:</p>
<ul>
<li><code>java</code><br>
contains the actual java unit tests that make use of <a href="https://github.com/apache/camel/blob/61a58836da57bab38ce719cbd1effd36253687a4/docs/user-manual/en/spring-testing.adoc"><code>CamelSpringTestSupport</code></a> to wire xml CamelContext configuration, test data and expected results together</li>
<li><code>resources</code><br>
contains the spring xml configuration that is used by the java test classes and resamble the actual configurations from <code>src/main/resources</code></li>
<li><code>data</code><br>
contains testdata for the data flows and the transformation</li>
</ul>
<p>Tests can easily be run from within an IDE (eclipse, visual code studio etc.) or via commandline</p>
<pre class="language-bash"><code class="language-bash">mvn <span class="token function">test</span>
</code></pre>
<p>You will see the output of the test runs. If it looks like this, it works as expected:</p>
<pre class="language-bash"><code class="language-bash">Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.846 sec
Results <span class="token keyword">:</span>
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> ------------------------------------------------------------------------
<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> BUILD SUCCESS
<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> ------------------------------------------------------------------------
<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> Total time: 32.267 s
<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> Finished at: 2018-04-09T15:25:25+02:00
<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> Final Memory: 25M/85M
<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> ------------------------------------------------------------------------
</code></pre>
<h1>Summary</h1>
<p>The provided camel project template facilitates the creation of simple connectors. You can download it, modify or extend it, package the integrator to a zip file and deploy it on a target server. The included scripts help registering the integrator as an operating system service to run 24/7.</p>
</div></div><div class="columns pageNav"><div class="column"><a href="/unide/blog/2018/3/26/Release-0.2.0" class="button is-fullwidth"><span class="icon"><i class="fa fa-chevron-left"></i></span><span>Unide 0.2.0 released</span></a></div><!----></div></div><div class="sidebar column is-3 is-offset-1"><div class="recentPosts"><h4 class="subtitle is-5">
Recent Posts
</h4><ul><li><a href="/unide/blog/2018/9/4/Template-for-PPMP-transformation" class="nuxt-link-exact-active nuxt-link-active">
PPMP Use Cases: Template for PPMP transformation
</a><li><a href="/unide/blog/2018/3/26/Release-0.2.0">
Unide 0.2.0 released
</a><li><a href="/unide/blog/2018/2/13/grinding-machine-scenario">
PPMP Use Cases: Unide and the Eclipse Production Performance Management Testbed
</a><li><a href="/unide/blog/2018/2/11/Transform-PPMP-with-camel">
PPMP Use Cases: Simple Transformation with Apache Camel
</a><li><a href="/unide/blog/2018/1/26/New-website">
Updated Website
</a></ul></div><div class="blogArchives"><h4 class="subtitle is-5">
Blog Archives
</h4><ul><li><a href="/unide/blog/2018/9" class="nuxt-link-active">
October 2018
</a>
(1)
<li><a href="/unide/blog/2018/3">
April 2018
</a>
(1)
<li><a href="/unide/blog/2018/2">
March 2018
</a>
(2)
<li><a href="/unide/blog/2018/1">
February 2018
</a>
(1)
<li><a href="/unide/blog/2017/10">
November 2017
</a>
(2)
<li><a href="/unide/blog/2017/6">
July 2017
</a>
(2)
<li><a href="/unide/blog/2017/3">
April 2017
</a>
(1)
<li><a href="/unide/blog/2016/9">
October 2016
</a>
(4)
</ul></div></div></div></div><footer class="footer"><div class="container"><div class="content has-text-centered"><ul><span><a href="http://www.eclipse.org/legal/privacy.php">Privacy Policy</a></span><span><a href="http://www.eclipse.org/legal/termsofuse.php">Terms of Use</a></span><span><a href="http://www.eclipse.org/legal/copyright.php">Copyright Agent</a></span><span><a href="https://eclipse.org/security/">Security reports</a></span><span><a href="http://www.eclipse.org/legal/">Legal</a></span></ul></div></div></footer></div></div></div><script type="text/javascript">window.__NUXT__={layout:"sidebar",data:[{post:{name:"Template-for-PPMP-transformation",content:'<h1>Quick start</h1>\n<p>In <a href="https://www.eclipse.org/unide/blog/2018/2/11/Transform-PPMP-with-camel/">a previous blog post</a>, I have already introduced Apache Camel as a tool to transform to PPMP. In this post, I want to dive a little deeper to get you started with your own transformation.<br>\nYou can find corresponding source code with some transformation examples <a href="https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement/tree/master/camel-integrator">in the repository of the Eclipse PPM Testbed</a>. After download or checkout of the project, you can easily package everything necessary for an installation via <a href="https://maven.apache.org/">Apache Maven</a> and java 8+:</p>\n<pre class="language-bash"><code class="language-bash"><span class="token function">git</span> clone https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement.git\n<span class="token function">cd</span> eclipseiot-testbed-productionperformancemanagement\n<span class="token function">cd</span> camel-integrator\nmvn package\n</code></pre>\n<p>After successful build, you should get a zip file at <code>target/camel-integrator-*-assembly.zip</code> with the following content</p>\n<ul>\n<li><code>bin</code><br>\nThe IntegratorStarter* files for Windows and Linux can be used to start the integrator manually. WinServiceInstaller.bat und WinServiceUninstaller.bat can be executed with Admin permissions in Windows to register/unregister this java application as Windows Service called &quot;Integrator Service&quot;.</li>\n<li><code>conf</code><br>\nThis is where the main configuration file <code>application-context.xml</code>, further included spring xml configurations, as well as the configuration for logging <code>log4j.properties</code> and a key-value-file for quick configuration <code>application.properties</code> can be found. After modification of any of them, the integrator should be restarted.</li>\n<li><code>lib</code><br>\nContains all java dependencies and their dependencies as individual jar files</li>\n<li><code>log</code><br>\nAfter the first start, you will find an additional directory that contains the logs of every execution, as defined in the <code>conf/log4j.properties</code> file.</li>\n</ul>\n<p>So this <code>camel-integrator-*-assembly.zip</code> is all you need, ready to being shipped and installed in your target system.</p>\n<h1>How can I modify this?</h1>\n<p>In the <code>conf</code> folder of the output or <code>src/main/resources</code> src folder, you\'ll find multiple examples on how to use Apache Camel with Production Performance Management Protocol. Most of the examples are based on <a href="https://github.com/apache/camel/blob/master/components/camel-spring/src/main/docs/spring.adoc">spring xml</a>.<br>\nThe most important terms to understand them are:</p>\n<table>\n<thead>\n<tr>\n<th>xml tag</th>\n<th>meaning</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>bean</td>\n<td>additional functionality, coded as java class / function</td>\n</tr>\n<tr>\n<td>camelContext</td>\n<td>the main, camel specific configurations</td>\n</tr>\n<tr>\n<td>route</td>\n<td>describes the data flow as process</td>\n</tr>\n<tr>\n<td>from / to</td>\n<td>entry / exit points for the data flow. This is also, were external systems are accessed via <a href="https://github.com/apache/camel/tree/camel-2.21.0/components">components</a></td>\n</tr>\n<tr>\n<td>onException</td>\n<td>error handling for the data flow</td>\n</tr>\n<tr>\n<td>pipeline, multicast, ...</td>\n<td>routing of data via <a href="http://camel.apache.org/enterprise-integration-patterns.html">Enterprise Integration pattern</a></td>\n</tr>\n</tbody>\n</table>\n<p>Among others, you\'ll find:</p>\n<div class="card figure is-pulled-right">\n\t<div class="card-image">\n\t\t<figure class="image">\n\t\t\t<img alt="html log file" title="html log file" src="/unide/images/blog/Transform-PPMP-with-camel-2-logfile.png"></img>\n\t\t</figure>\n\t</div>\n\t<div class="card-content">\n\t\thtml logfile before transformation to PPMP\n\t</div>\n</div>\n<ul>\n<li><code>application-context.xml</code><br>\nMain entry file to start camel routes. It contains a general PPMP validation REST endpoint that reuses the route from <code>ppmp-validate-context.xml</code></li>\n<li><code>mqtt-context.xml</code><br>\nA simple example of converting transport protocol (mqtt to REST), without looking at the payload</li>\n<li><code>ppmp-splitAndRewrite-context.xml</code><br>\nShows how to receive (PPMP-) payload via different REST paths (/rest or /ppm), and each forwarding to two seperate endpoints (/rest and /ppm)\n<ul>\n<li><code>ppmpRewrite.xml</code> and <code>ppmRewrite.xml</code><br>\nmapping examples to rewrite the urls</li>\n</ul>\n</li>\n<li><code>ppmp-validate-context.xml</code><br>\nA simple validation route for PPMP messages that can be reused in many other routes.</li>\n<li><code>psi6000-transform-context.xml</code><br>\nA more advanced example of converting a psi6000 JSON format, converting it to plain old java object (POJO), transforming that to PPMP POJOs (using <a href="https://github.com/eclipse/unide.java">unide.java</a>) and forwarding these to actual REST endpoints</li>\n<li><code>kistler.xml</code><br>\nThis example takes html files with a structure similar to the test file in <a href="https://github.com/eclipselabs/eclipseiot-testbed-productionperformancemanagement/blob/master/camel-integrator/src/test/data/00000855.html"><code>src/test/data/00000855.html</code></a>, cleans the html structure, retrieves the relevant parts via <a href="https://en.wikipedia.org/wiki/XPath">XPath</a> and creates a PPMP process message out of that</li>\n<li><code>application.properties</code><br>\nContains key/value pairs that can be used in the camel context configurations.</li>\n<li><code>log4j.properties</code><br>\nThe configuration for logging. For testing purposes, the log4j.properties in /src/test/resources is used.</li>\n</ul>\n<p>In order to get familiar with these transformations, I suggest you:</p>\n<ul>\n<li>open the <code>application-context.xml</code> in your favorite editor</li>\n<li>remove the <code>&lt;import .../&gt;</code> statements</li>\n<li>add your own <code>&lt;route&gt;...&lt;/route&gt;</code>, maybe as simple as<pre class="language-xml"><code class="language-xml"> <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>route</span><span class="token punctuation">></span></span>\n \t<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>from</span> <span class="token attr-name">uri</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>jetty:http://0.0.0.0:9090/<span class="token punctuation">"</span></span> <span class="token punctuation">/></span></span>\n \t<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>setBody</span><span class="token punctuation">></span></span>\n \t\t<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>simple</span><span class="token punctuation">></span></span>hello world!<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>simple</span><span class="token punctuation">></span></span>\n \t<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>setBody</span><span class="token punctuation">></span></span>\n <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>route</span><span class="token punctuation">></span></span>\n</code></pre>\n</li>\n<li>start a run directly (with bundling to a zip file) with:<pre class="language-bash"><code class="language-bash"> mvn exec:java\n</code></pre>\n</li>\n<li>and review the result. With the example above, just open the url <a href="http://localhost:9090">http://localhost:9090</a> and see the <code>hello world!</code> in your browser</li>\n</ul>\n<p>If you prefer a visual model of these camel xml definitions, you could also make use of <a href="https://tools.jboss.org/features/fusetools.html">JBoss Fuse Tooling</a> which is available for <a href="https://projects.eclipse.org/releases/oxygen">Eclipse Workbench 4.3+</a> through <a href="https://marketplace.eclipse.org/content/jboss-tools">the Marketplace</a>. Be aware that this might cause additional overhead.</p>\n<div class="card figure">\n\t<div class="card-image">\n\t\t<figure class="image">\n\t\t\t<img alt="JBoss Tools" title="JBoss Tools for Eclipse Workbench" src="/unide/images/blog/Transform-PPMP-with-camel-2-eclipse.png"></img>\n\t\t</figure>\n\t</div>\n\t<div class="card-content">\n\t\tJBoss Tools for Eclipse Workbench\n\t</div>\n</div>\n<p>If you want to make use of any other of the (as of camel 2.21.0) <a href="https://github.com/apache/camel/tree/camel-2.21.0/components">281+ components</a>, you should add the respective maven dependency to the <code>pom.xml</code>. For example:</p>\n<pre class="language-xml"><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>project</span> <span class="token attr-name">xmlns</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://maven.apache.org/POM/4.0.0<span class="token punctuation">"</span></span> <span class="token attr-name"><span class="token namespace">xmlns:</span>xsi</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://www.w3.org/2001/XMLSchema-instance<span class="token punctuation">"</span></span>\n\t<span class="token attr-name"><span class="token namespace">xsi:</span>schemaLocation</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>\n\t...\n\t<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependencies</span><span class="token punctuation">></span></span>\n\t\t<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>dependency</span><span class="token punctuation">></span></span>\n\t\t\t<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>groupId</span><span class="token punctuation">></span></span>org.apache.camel<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>groupId</span><span class="token punctuation">></span></span>\n\t\t\t<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>artifactId</span><span class="token punctuation">></span></span>camel-amqp<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>artifactId</span><span class="token punctuation">></span></span>\n\t\t\t<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>version</span><span class="token punctuation">></span></span>${camel.version}<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>version</span><span class="token punctuation">></span></span>\n\t\t<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependency</span><span class="token punctuation">></span></span>\n\t...\n\t<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>dependencies</span><span class="token punctuation">></span></span>\n\t...\n<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>project</span><span class="token punctuation">></span></span>\n</code></pre>\n<h1>Testing</h1>\n<p>Testing is an important part of the development cycle, especially for the core components that have to work reliably in a production environment.<br>\nThe project includes example tests in the <code>src/test</code> folder:</p>\n<ul>\n<li><code>java</code><br>\ncontains the actual java unit tests that make use of <a href="https://github.com/apache/camel/blob/61a58836da57bab38ce719cbd1effd36253687a4/docs/user-manual/en/spring-testing.adoc"><code>CamelSpringTestSupport</code></a> to wire xml CamelContext configuration, test data and expected results together</li>\n<li><code>resources</code><br>\ncontains the spring xml configuration that is used by the java test classes and resamble the actual configurations from <code>src/main/resources</code></li>\n<li><code>data</code><br>\ncontains testdata for the data flows and the transformation</li>\n</ul>\n<p>Tests can easily be run from within an IDE (eclipse, visual code studio etc.) or via commandline</p>\n<pre class="language-bash"><code class="language-bash">mvn <span class="token function">test</span>\n</code></pre>\n<p>You will see the output of the test runs. If it looks like this, it works as expected:</p>\n<pre class="language-bash"><code class="language-bash">Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.846 sec\n\nResults <span class="token keyword">:</span>\n\nTests run: 3, Failures: 0, Errors: 0, Skipped: 0\n\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> ------------------------------------------------------------------------\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> BUILD SUCCESS\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> ------------------------------------------------------------------------\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> Total time: 32.267 s\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> Finished at: 2018-04-09T15:25:25+02:00\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> Final Memory: 25M/85M\n<span class="token punctuation">[</span>INFO<span class="token punctuation">]</span> ------------------------------------------------------------------------\n</code></pre>\n<h1>Summary</h1>\n<p>The provided camel project template facilitates the creation of simple connectors. You can download it, modify or extend it, package the integrator to a zip file and deploy it on a target server. The included scripts help registering the integrator as an operating system service to run 24/7.</p>\n',url:"/blog/2018/9/4/Template-for-PPMP-transformation",title:"PPMP Use Cases: Template for PPMP transformation",date:"2018-09-04T00:00:00.000Z",tags:["use cases"],prev:{url:"/blog/2018/3/26/Release-0.2.0",title:"Unide 0.2.0 released"}}}],error:null,state:{},serverRendered:!0}</script><script defer src="/unide/files/manifest.6d8462e17778bc2ab94c.js"></script><script defer src="/unide/files/layouts_sidebar.7c421ad9e58e5e68f949.js"></script><script defer src="/unide/files/pages_article.dfd7fcb83848670d21b1.js"></script><script defer src="/unide/files/vendor.3960437a749191406982.js"></script><script defer src="/unide/files/app.ac89eaaf53fc974d7229.js"></script>