<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>EclipseSource Blog &#187; Florian Waibel</title>
	<atom:link href="http://eclipsesource.com/blogs/author/fwaibel/feed/" rel="self" type="application/rss+xml" />
	<link>http://eclipsesource.com/blogs</link>
	<description>Eclipse Equinox OSGi</description>
	<lastBuildDate>Tue, 21 May 2013 09:56:42 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>JUnit &#8211; the Difference between Practice and @Theory</title>
		<link>http://eclipsesource.com/blogs/2013/04/11/junit-the-difference-of-practice-and-theory/</link>
		<comments>http://eclipsesource.com/blogs/2013/04/11/junit-the-difference-of-practice-and-theory/#comments</comments>
		<pubDate>Thu, 11 Apr 2013 09:00:15 +0000</pubDate>
		<dc:creator>Florian Waibel</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Editors choice]]></category>
		<category><![CDATA[clean code]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Software craftsmanship]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=15158</guid>
		<description><![CDATA[Lately a colleague showed me how to improve JUnit tests written for a distance calculator. Speaking with other developers I found out that the majority wasn&#8217;t aware of the undocumented @Theories Runner which can be found in an experimental package in JUnit, so I decided to share this valuable &#8220;experiment&#8221;. In contrast to the parameterized <a href="http://eclipsesource.com/blogs/2013/04/11/junit-the-difference-of-practice-and-theory/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Lately a colleague showed me how to improve JUnit tests written for a distance calculator. Speaking with other developers I found out that the majority wasn&#8217;t aware of the undocumented @Theories Runner which can be found in an experimental package in JUnit, so I decided to share this valuable &#8220;experiment&#8221;.</p>
<p>In contrast to the parameterized JUnit test, the Theories-runner will try out all possible combinations of data points against your test methods marked with the @Theory annotation.</p>
<p>But let&#8217;s get your hands dirty. Obviously the first thing to do is run the test with the Theories-runner and declare some data points:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">@RunWith<span style="color: #009900;">&#40;</span>Theories.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DistanceCalculatorTest <span style="color: #009900;">&#123;</span>
&nbsp;
  @DataPoint
  <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> LatLng es_1 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LatLng<span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">49.0060285</span>, <span style="color: #cc66cc;">8.4006111</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  @DataPoint
  <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> LatLng es_2 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LatLng<span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">49.0060285</span>, <span style="color: #cc66cc;">8.4005789</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  @DataPoint
  <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> LatLng es_3 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LatLng<span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">49.0060056</span>, <span style="color: #cc66cc;">8.4005611</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
...</pre></td></tr></table></div>

<p>The implementation of the distance calculator should be:</p>
<ul>
<li>Commutative,</li>
<li>Positive semidefinite</li>
<li>And fullfill the triangle equality</li>
</ul>
<p>Which can be written down using the following three @Theory annotated test methods (which do not accept null values):</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">@Theory<span style="color: #009900;">&#40;</span>nullsAccepted <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> distanceIsCommutative<span style="color: #009900;">&#40;</span>LatLng p1, LatLng p2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    assertThat<span style="color: #009900;">&#40;</span>distanceCalculator.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>p1, p2<span style="color: #009900;">&#41;</span>, is<span style="color: #009900;">&#40;</span>distanceCalculator.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>p2, p1<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
@Theory<span style="color: #009900;">&#40;</span>nullsAccepted <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> distanceIsPositiveSemidefinite<span style="color: #009900;">&#40;</span>LatLng p1, LatLng p2<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    assertThat<span style="color: #009900;">&#40;</span>distanceCalculator.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>p1, p2<span style="color: #009900;">&#41;</span>, is<span style="color: #009900;">&#40;</span>greaterThanOrEqualTo<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span>.<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
@Theory<span style="color: #009900;">&#40;</span>nullsAccepted <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> distanceFulfillsTriangleEquality<span style="color: #009900;">&#40;</span>LatLng p1, LatLng p2, LatLng p3<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    assertThat<span style="color: #009900;">&#40;</span>distanceCalculator.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>p1, p2<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> distanceCalculator.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>p2, p3<span style="color: #009900;">&#41;</span>, 
        is<span style="color: #009900;">&#40;</span>greaterThanOrEqualTo<span style="color: #009900;">&#40;</span>distanceCalculator.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>p1, p3<span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> delta<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Sometimes you have to assume preconditions to test specific parts of your implementation. In the following @Theory the assumption is either p1 or p2 is null, which should lead to an IllegalArgumentException when using the calculator…</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">@DataPoint
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> LatLng nullPoint <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span>
&nbsp;
@Rule
<span style="color: #000000; font-weight: bold;">public</span> ExpectedException distanceCalculatorException <span style="color: #339933;">=</span> ExpectedException.<span style="color: #006633;">none</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
@Theory
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> distanceToNullNotDefined<span style="color: #009900;">&#40;</span>LatLng p1, LatLng p2<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    assumeTrue<span style="color: #009900;">&#40;</span>p1 <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #339933;">||</span> p2 <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    distanceCalculatorException.<span style="color: #006633;">expect</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">IllegalArgumentException</span>.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    distanceCalculator.<span style="color: #006633;">calculate</span><span style="color: #009900;">&#40;</span>p1, p2<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>It is very simple to add more corner cases. The following snippet adds two representations of the north pole:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">@DataPoint
<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> LatLng north_pole_1 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LatLng<span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">90</span>, <span style="color: #cc66cc;">10</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
@DataPoint
<span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">public</span> LatLng north_pole_2 <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LatLng<span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">90</span>, <span style="color: #cc66cc;">20</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>If you add a test which won&#8217;t work with the whole data points available (e.g. near the poles in this example) they can be easily filtered out by adding a more complex assumption at the beginning of the test method.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">@Theory<span style="color: #009900;">&#40;</span>nullsAccepted <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> runningTowardsThePole<span style="color: #009900;">&#40;</span>LatLng pt<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// this test does not work at the poles</span>
    assumeThat<span style="color: #009900;">&#40;</span>pt.<span style="color: #006633;">lat</span>, is<span style="color: #009900;">&#40;</span>allOf<span style="color: #009900;">&#40;</span>greaterThan<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">89</span>.<span style="color: #009900;">&#41;</span>, lessThan<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">89</span>.<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
...
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Just a side note. Rewriting the tests for the distance calculator in fact discovered a bug in the original implementation of the distance calculator using LatLng(-1, -1) as NIRVANA. Thanks again Hauke for teaching me this lesson.</p>
<p>Have fun verifying your code with theories.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=JUnit+%26%238211%3B+the+Difference+between+Practice+and+%40Theory&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/04/11/junit-the-difference-of-practice-and-theory/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/04/11/junit-the-difference-of-practice-and-theory/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/04/11/junit-the-difference-of-practice-and-theory/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/04/11/junit-the-difference-of-practice-and-theory/&amp;t=JUnit+%26%238211%3B+the+Difference+between+Practice+and+%40Theory" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/><a href="http://eclipsesource.com/blogs/2013/04/11/junit-the-difference-of-practice-and-theory/#comments">1 Comment</a>. Tagged with <a href='http://eclipsesource.com/blogs/tag/clean-code/' title='clean code Tag'>clean code</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/software-craftsmanship/' title='Software craftsmanship Tag'>Software craftsmanship</a>, <a href='http://eclipsesource.com/blogs/tag/testing/' title='testing Tag'>testing</a>, <a href='http://eclipsesource.com/blogs/tag/clean-code/' title='clean code Tag'>clean code</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/software-craftsmanship/' title='Software craftsmanship Tag'>Software craftsmanship</a>, <a href='http://eclipsesource.com/blogs/tag/testing/' title='testing Tag'>testing</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/04/11/junit-the-difference-of-practice-and-theory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Updated Tutorial: Developing Web Application Bundles with RAP and Virgo</title>
		<link>http://eclipsesource.com/blogs/2013/03/18/14961/</link>
		<comments>http://eclipsesource.com/blogs/2013/03/18/14961/#comments</comments>
		<pubDate>Mon, 18 Mar 2013 12:35:27 +0000</pubDate>
		<dc:creator>Florian Waibel</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Editors choice]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[virgo]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=14961</guid>
		<description><![CDATA[This is just a heads up for those interested in developing RAP applications with Virgo. I finished updating our tutorial to RAP 2.0 and Virgo 3.6.x (aka Sky). The first part guides you through the setup of your Eclipse IDE and Virgo Jetty Server. The second part is a short walkthrough on how to create <a href="http://eclipsesource.com/blogs/2013/03/18/14961/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>This is just a heads up for those interested in developing RAP applications with Virgo. I finished updating our <a href="http://eclipsesource.com/blogs/tutorials/developing-web-application-bundles-with-rap-and-virgo/" title="Developing Web Application Bundles with RAP and Virgo">tutorial</a> to <a href="http://eclipse.org/rap">RAP</a> 2.0 and <a href="http://eclipse.org/virgo/">Virgo</a> 3.6.x (aka Sky).</p>
<p>The first part guides you through the setup of your Eclipse IDE and Virgo Jetty Server. The second part is a short walkthrough on how to create a Hello World Web Application Bundle (WAB) with RAP.</p>
<p>Feedback welcome.</p>
<p>[1] Developing Web Application Bundles with RAP and Virgo &#8211; <a href="http://eclipsesource.com/blogs/tutorials/developing-web-application-bundles-with-rap-and-virgo/" title="Developing Web Application Bundles with RAP and Virgo">http://eclipsesource.com/blogs/tutorials/developing-web-application-bundles-with-rap-and-virgo/</a><br />
[2] RAP – Enabling modular business apps for desktop, browser and mobile – <a href="http://eclipse.org/rap" title="RAP – Enabling modular business apps for desktop, browser and mobile">http://eclipse.org/rap</a><br />
[3] Virgo from eclipseRT – <a href="http://eclipse.org/virgo/">http://eclipse.org/virgo/</a></p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Updated+Tutorial%3A+Developing+Web+Application+Bundles+with+RAP+and+Virgo&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/03/18/14961/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/03/18/14961/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/03/18/14961/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/03/18/14961/&amp;t=Updated+Tutorial%3A+Developing+Web+Application+Bundles+with+RAP+and+Virgo" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/><a href="http://eclipsesource.com/blogs/2013/03/18/14961/#comments">1 Comment</a>. Tagged with <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tutorial/' title='tutorial Tag'>tutorial</a>, <a href='http://eclipsesource.com/blogs/tag/virgo/' title='virgo Tag'>virgo</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tutorial/' title='tutorial Tag'>tutorial</a>, <a href='http://eclipsesource.com/blogs/tag/virgo/' title='virgo Tag'>virgo</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/03/18/14961/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RAP 2.0 Available on Maven Central</title>
		<link>http://eclipsesource.com/blogs/2013/02/14/rap-2-0-available-on-maven-central/</link>
		<comments>http://eclipsesource.com/blogs/2013/02/14/rap-2-0-available-on-maven-central/#comments</comments>
		<pubDate>Thu, 14 Feb 2013 12:33:16 +0000</pubDate>
		<dc:creator>Florian Waibel</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=14286</guid>
		<description><![CDATA[Hot on the heels of the release of RAP 2.0 the bundles have been uploaded to Maven Central. Time for another coffee break with RAP and Maven. Before you get your coffee grab the updated sample project from GitHub[1]. $ cd /tmp $ git clone git://github.com/eclipsesource/rap-maven-examples.git and trigger the Maven action: $ cd rap-maven-examples/com.eclipsesource.rap.examples.maven $ <a href="http://eclipsesource.com/blogs/2013/02/14/rap-2-0-available-on-maven-central/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/5020665036_958795863c.png"><img src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/5020665036_958795863c.png" alt="5020665036 958795863c RAP 2.0 Available on Maven Central" width="230" height="180" class="alignright size-full wp-image-14312" title="RAP 2.0 Available on Maven Central" /></a></p>
<p>Hot on the heels of the release of RAP 2.0 the bundles have been uploaded to Maven Central. Time for another <a href="http://eclipsesource.com/blogs/2012/09/13/rap-on-the-quick-the-pure-maven-way/" title="RAP on the Quick: The pure Maven Way">coffee break</a> with RAP and Maven.</p>
<p>Before you get your coffee grab the updated sample project from <a href="https://github.com/eclipsesource/rap-maven-examples">GitHub</a>[1].</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">$ cd /tmp
$ git clone git://github.com/eclipsesource/rap-maven-examples.git</pre></td></tr></table></div>

<p>and trigger the Maven action:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">$ cd rap-maven-examples/com.eclipsesource.rap.examples.maven
$ mvn jetty:run</pre></td></tr></table></div>

<p>While maven is doing it&#8217;s job downloading the new RAP jars you can either go for a coffee or have a quick look at the changes done to migrate the RAP 1.5 based example to RAP 2.</p>
<p>No surprise the version of RAP has been bumped to 2.0.0:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">                &lt;dependency&gt;
                        &lt;groupId&gt;org.eclipse.rap&lt;/groupId&gt;
                        &lt;artifactId&gt;org.eclipse.rap.rwt&lt;/artifactId&gt;
-                       &lt;version&gt;1.5.0&lt;/version&gt;
+                       &lt;version&gt;2.0.0&lt;/version&gt;
                &lt;/dependency&gt;</pre></td></tr></table></div>

<p>The Java packages have been renamed from org.eclipse.rwt to org.eclipse.rap.rwt. An organize import will update your java code easily.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">-import org.eclipse.rwt.application.Application;
-import org.eclipse.rwt.application.ApplicationConfiguration;
-import org.eclipse.rwt.client.WebClient;
+import org.eclipse.rap.rwt.application.Application;
+import org.eclipse.rap.rwt.application.ApplicationConfiguration;
+import org.eclipse.rap.rwt.client.WebClient;</pre></td></tr></table></div>

<p>But do not forget about the other locations like web.xml:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">        &lt;listener&gt;
-               &lt;listener-class&gt;org.eclipse.rwt.engine.RWTServletContextListener&lt;/listener-class&gt;
+               &lt;listener-class&gt;org.eclipse.rap.rwt.engine.RWTServletContextListener&lt;/listener-class&gt;
        &lt;/listener&gt;
&nbsp;
        &lt;servlet&gt;
                &lt;servlet-name&gt;rwtServlet&lt;/servlet-name&gt;
-               &lt;servlet-class&gt;org.eclipse.rwt.engine.RWTServlet&lt;/servlet-class&gt;
+               &lt;servlet-class&gt;org.eclipse.rap.rwt.engine.RWTServlet&lt;/servlet-class&gt;
        &lt;/servlet&gt;</pre></td></tr></table></div>

<p>The RAP team decided to consolidate the interface names and removed the &#8220;I&#8221; in interfaces like the IEntryPoint. The interfaces with &#8220;I&#8221; are still available, but have been marked deprecated.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">-import org.eclipse.rwt.lifecycle.IEntryPoint;
+import org.eclipse.rap.rwt.application.EntryPoint;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
&nbsp;
-public class DemoApplication implements IEntryPoint {
+public class DemoApplication implements EntryPoint {</pre></td></tr></table></div>

<p>Please have a look at the <a href="http://eclipse.org/rap/noteworthy/2.0/migration-guide/" title="RAP 2.0 Migration Guide">RAP 2.0 Migration Guide</a>[2] for more details how to migrate your own applications.</p>
<p>In the meantime your console should show something like:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">[INFO] Scanning for projects...
...
2013-02-14 09:14:17.272:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 10 seconds.</pre></td></tr></table></div>

<p>and the RAP 2.0 standalone application should be available at <a title="http://localhost:8080/maven_example" href="http://localhost:8080/maven_example" rel="nofollow">http://localhost:8080/maven_example</a></p>
<p>I hope you enjoyed your still hot cup of coffee while following the steps above…</p>
<p>&#8211;</p>
<p>[1] RAP Maven examples &#8211; <a title="GitHub - RAP Maven examples" href="https://github.com/eclipsesource/rap-maven-examples">https://github.com/eclipsesource/rap-maven-examples</a><br />
[2] RAP 2.0 Migration Guide &#8211; <a href="http://eclipse.org/rap/noteworthy/2.0/migration-guide/" title="RAP 2.0 Migration Guide">http://eclipse.org/rap/noteworthy/2.0/migration-guide/</a></p>
<p>The image is from <a href="http://www.flickr.com/photos/stephaniewatson/5020665036/">http://www.flickr.com/photos/stephaniewatson/5020665036/</a></p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=RAP+2.0+Available+on+Maven+Central&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/02/14/rap-2-0-available-on-maven-central/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/02/14/rap-2-0-available-on-maven-central/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/02/14/rap-2-0-available-on-maven-central/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/02/14/rap-2-0-available-on-maven-central/&amp;t=RAP+2.0+Available+on+Maven+Central" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/maven/' title='maven Tag'>maven</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/maven/' title='maven Tag'>maven</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/02/14/rap-2-0-available-on-maven-central/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deployment habits are changing at the speed of a container ship</title>
		<link>http://eclipsesource.com/blogs/2013/01/18/deployment-habits-are-changing-at-the-speed-of-a-container-ship/</link>
		<comments>http://eclipsesource.com/blogs/2013/01/18/deployment-habits-are-changing-at-the-speed-of-a-container-ship/#comments</comments>
		<pubDate>Fri, 18 Jan 2013 10:45:32 +0000</pubDate>
		<dc:creator>Florian Waibel</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[vrigo]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=13643</guid>
		<description><![CDATA[Thank you very much for participating in the survey &#8220;How will you run your RAP application in 2013?&#8220;. Very interesting results. Deployment habits seem to be rather conservative in the environment of RAP. image from http://www.flickr.com/photos/danramarch/2875308394/ During the last few weeks we collected around 150 replies. First I thought I was looking at the results <a href="http://eclipsesource.com/blogs/2013/01/18/deployment-habits-are-changing-at-the-speed-of-a-container-ship/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Thank you very much for participating in the survey &#8220;<a href="http://eclipsesource.com/blogs/2012/12/06/how-will-you-run-your-rap-application-in-2013/" title="How will you run your RAP application in 2013?">How will you run your RAP application in 2013?</a>&#8220;.<br />
Very interesting results. Deployment habits seem to be rather conservative in the environment of RAP.</p>
<p><a href="http://eclipsesource.com/blogs/2013/01/18/deployment-habits-are-changing-at-the-speed-of-a-container-ship/container_ship/" rel="attachment wp-att-13651"><img src="http://eclipsesource.com/blogs/wp-content/uploads/2013/01/container_ship.png" alt="container ship Deployment habits are changing at the speed of a container ship" width="375" height="500" class="aligncenter size-full wp-image-13651" title="Deployment habits are changing at the speed of a container ship" /></a></p>
<p>image from <a href="http://www.flickr.com/photos/danramarch/2875308394/">http://www.flickr.com/photos/danramarch/2875308394/</a></p>
<p>During the last few weeks we collected around 150 replies. First I thought I was looking at the results from our<br />
poll started two years ago. The distribution is almost the same as back then.<br />
The lion&#8217;s share will keep running their RAP applications using war deployment.</p>
<p>Most of the participants will run RAP on a plain Servlet Container. Followed by those who plan to deploy on an application server and only a small number target war deployment in the cloud.<br />
There seem to be a small group of war deployment users migrating from application server deployment towards plain Servlet Container (remember numbers are very small).</p>
<p>About a third of the participants are planning to run RAP in a standalone Equinox and/or with a homebrewed launch script, almost the same percentage as in 2010.</p>
<p>The group of people planning to use OSGi containers like Virgo, Karaf or Felix gain some weight, but are still outnumbered 1:3 by those using plain Equinox.</p>
<p>What is holding you back using a cool Web admin console to deploy and manage artifacts? To use the excellent diagnostics features available in Virgo?</p>
<p>I wonder if you could assist the Virgo project that I work on by taking a few minutes to complete the <a href="http://bit.ly/ZX73GL" title="Eclipse Virgo Community Survey">Virgo Community Survey</a>[1] (including fun quiz)</p>
<p>&#8211;</p>
<p>[1] Virgo Community Survey &#8211; <a href="http://bit.ly/ZX73GL" title="Eclipse Virgo Community Survey">http://bit.ly/ZX73GL</a></p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Deployment+habits+are+changing+at+the+speed+of+a+container+ship&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/01/18/deployment-habits-are-changing-at-the-speed-of-a-container-ship/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/01/18/deployment-habits-are-changing-at-the-speed-of-a-container-ship/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/01/18/deployment-habits-are-changing-at-the-speed-of-a-container-ship/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/01/18/deployment-habits-are-changing-at-the-speed-of-a-container-ship/&amp;t=Deployment+habits+are+changing+at+the+speed+of+a+container+ship" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/vrigo/' title='vrigo Tag'>vrigo</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/vrigo/' title='vrigo Tag'>vrigo</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/01/18/deployment-habits-are-changing-at-the-speed-of-a-container-ship/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How will you run your RAP application in 2013?</title>
		<link>http://eclipsesource.com/blogs/2012/12/06/how-will-you-run-your-rap-application-in-2013/</link>
		<comments>http://eclipsesource.com/blogs/2012/12/06/how-will-you-run-your-rap-application-in-2013/#comments</comments>
		<pubDate>Thu, 06 Dec 2012 08:57:23 +0000</pubDate>
		<dc:creator>Florian Waibel</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[war deployment]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=12756</guid>
		<description><![CDATA[In late 2010 we asked &#8220;How do you run your RAP application today ? (2010)&#8220;. In those days most installations were WAR deployments (&#62;50%) running in a plain Tomcat/Jetty container or an application server (Poll results). I&#8217;m curious to see if the landscape of RAP installations has changed over the last two years&#8230; and would <a href="http://eclipsesource.com/blogs/2012/12/06/how-will-you-run-your-rap-application-in-2013/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>In late 2010 we asked &#8220;<a title="How do you run your RAP applications today" href="http://eclipsesource.com/blogs/2010/12/15/how-do-you-run-your-rap-application-today/">How do you run your RAP application today ? (2010)</a>&#8220;. In those days most installations were WAR deployments (&gt;50%) running in a plain Tomcat/Jetty container or an application server (<a title=" Poll results on RAP deployment" href="http://eclipsesource.com/blogs/2011/02/07/poll-results-on-rap-deployment/">Poll results</a>).</p>
<p>I&#8217;m curious to see if the landscape of RAP installations has changed over the last two years&#8230; and would like to invite you to participate in this quick poll. Thanks for your time!</p>
<p><script type="text/javascript">// <![CDATA[
var cookie_booroo=0, surveyid=35487, random_booroo=0, enddate_booroo=0, maxchecked_booroo=5, jsonurl_booroo='http://booroo.com/app/vote.asp', customurl_booroo='',jsonThemeString={"poll":{"bg_hide":1,"bg_opacity":0,"bg_color_start":"ffffff","bg_color_end":"ffffff","border_color":"a1a1a1","border_style":"solid","border_size_t":0,"border_size_r":0,"border_size_b":0,"border_size_l":0,"border_size_grouper":1,"border_radius_grouper":1,"border_radius_t":4,"border_radius_r":4,"border_radius_b":4,"border_radius_l":4,"border_size":1,"border_radius":0,"border_pref":0,"shadow_x":0,"shadow_y":0,"shadow_size":"0","shadow_blur":0,"shadow_color":"000000","shadow_style":"","padding_grouper":1,"padding_t":0,"padding_r":0,"padding_b":0,"padding_l":0,"margin_grouper":0,"margin_t":0,"margin_r":0,"margin_b":50,"margin_l":0},"pollpreview":{"bg_hide":0,"bg_opacity":0,"bg_color_start":"ffffff","bg_color_end":"ffffff","border_color":"a1a1a1","border_style":"solid","border_size_t":1,"border_size_r":0,"border_size_b":0,"border_size_l":0,"border_size_grouper":0,"border_radius_grouper":1,"border_radius_t":0,"border_radius_r":0,"border_radius_b":0,"border_radius_l":0,"border_size":1,"border_radius":0,"border_pref":1,"padding_grouper":1,"padding_t":10,"padding_r":10,"padding_b":10,"padding_l":10},"pquestion":{"bg_hide":0,"bg_opacity":0,"bg_color_start":"ffffff","bg_color_end":"ffffff","border_style":"solid","border_size_t":1,"border_size_r":1,"border_size_b":0,"border_size_l":1,"border_size_grouper":1,"border_radius_grouper":0,"border_radius_t":6,"border_radius_r":6,"border_radius_b":0,"border_radius_l":0,"border_size":0,"border_radius":0,"border_pref":0,"border_color":"ffffff","font_family":"Arial,Helvetica,sans-serif","font_size":15,"font_color":"f8a025","font_bold":"bold","font_italic":"normal","text_shadow":0,"text_shadow_h":1,"text_shadow_v":1,"text_shadow_blur":0,"text_shadow_color":"949494","padding_grouper":1,"padding_t":10,"padding_r":10,"padding_b":10,"padding_l":10,"margin_grouper":0,"margin_t":0,"margin_r":0,"margin_b":0,"margin_l":0,"font_underline":"none"},"alabel":{"font_family":"Arial,Helvetica,sans-serif","font_size":12,"font_color":"212121","font_bold":"bold","font_italic":"normal","text_shadow":0,"text_shadow_h":0,"text_shadow_v":0,"text_shadow_blur":4,"text_shadow_color":"444444","padding_grouper":0,"padding_t":7,"padding_r":0,"padding_b":7,"padding_l":0,"margin_grouper":0,"margin_t":0,"margin_r":0,"margin_b":0,"margin_l":0,"font_underline":"none","answer_seperator":1},"bartext":{"font_family":"Arial,Helvetica,sans-serif","font_size":15,"font_color":"2e2e2e","font_bold":"bold","font_italic":"normal","text_shadow":0,"text_shadow_h":0,"text_shadow_v":0,"text_shadow_blur":2,"text_shadow_color":"444444","padding_grouper":0,"padding_t":0,"padding_r":0,"padding_b":0,"padding_l":0,"margin_grouper":0,"margin_t":0,"margin_r":0,"margin_b":0,"margin_l":0,"font_underline":"none"},"qviewa":{"font_family":"Arial,Helvetica,sans-serif","font_size":11,"font_color":"444444","font_bold":"bold","font_italic":"normal","font_color_hover":"444444","font_underline":"underline","text_shadow":0,"text_shadow_h":1,"text_shadow_v":1,"text_shadow_blur":1,"text_shadow_color":"444444","padding_grouper":1,"padding_t":0,"padding_r":0,"padding_b":0,"padding_l":0,"margin_grouper":1,"margin_t":0,"margin_r":0,"margin_b":0,"margin_l":0},"qbutton":{"font_family":"Arial,Helvetica,sans-serif","font_size":14,"font_bold":"bold","font_italic":"normal","font_color":"ffffff","text_shadow":1,"text_shadow_h":1,"text_shadow_v":1,"text_shadow_blur":0,"text_shadow_color":"636263","bg_hide":0,"bg_opacity":0,"bg_color_start":"f7b35b","bg_color_end":"e69327","border_color":"e69327","border_style":"solid","border_size_t":1,"border_size_r":1,"border_size_b":1,"border_size_l":1,"border_size_grouper":0,"border_radius_grouper":0,"border_radius_t":0,"border_radius_r":0,"border_radius_b":0,"border_radius_l":0,"border_size":1,"border_radius":0,"border_pref":0,"padding_grouper":0,"padding_t":4,"padding_r":8,"padding_b":4,"padding_l":8,"margin_grouper":0,"margin_t":8,"margin_r":0,"margin_b":0,"margin_l":6,"font_underline":"none"},"bar":{"bg_hide":0,"bg_opacity":0,"bg_color_start":"f7b35b","bg_color_end":"f8a025","border_color":"e69327","border_style":"solid","border_size_t":1,"border_size_r":1,"border_size_b":1,"border_size_l":1,"border_size_grouper":0,"border_radius_grouper":0,"border_radius_t":0,"border_radius_r":0,"border_radius_b":0,"border_radius_l":0,"border_size":1,"border_radius":0,"border_pref":0,"padding_grouper":1,"padding_t":6,"padding_r":6,"padding_b":6,"padding_l":6,"margin_grouper":1,"margin_t":4,"margin_r":4,"margin_b":4,"margin_l":4},"barperc":{"font_family":"Arial,Helvetica,sans-serif","font_size":10,"font_color":"0f0f0f","text_shadow":0,"text_shadow_h":1,"text_shadow_v":1,"text_shadow_blur":3,"text_shadow_color":"444444","font_underline":"none"},"defaultpage":{"bg_color_start":"ffffff","bg_color_end":"ffffff","youtube_url":"","background_image_url":"","background_image_style":"Stretched","background_image_width":"1200","background_image_height":"904","poll_position":"2","bg_width":310},"help":{"help_shown":0}}; 
// ]]&gt;</script></p>
<p><!--[if lt IE 7]></p>
<link rel="stylesheet" type="text/css" media="screen" href="http://booroo.com/app_content/theme_poll/2/custom_themes/css/ie.css" /><![endif]-->
<div id="booroo_poll_container35487">
<div class="poll_booroo35487 "><!-- change poll width here --></p>
<div class="pquestion_booroo35487">How will you run your RAP application in 2013?</div>
<div class="pollpreview_booroo35487 cleanslate">
<div class="content_booroo">
<div class="options_booroo">
<form class="form_booroo">
<fieldset>
<div class="padded_booroo"><input type="hidden" name="qid" value="35487" /><input type="hidden" name="sid" value="1i2dsw79g6p0nd135487" /><input type="hidden" name="pqid" value="23890" /></p>
<div class="items_booroo">
<div class="row_booroo"><label for="ans-116459"><input id="ans-116459" class="checkbox_booroo" type="checkbox" name="ans-116459" value="1" />War deployment in a plain Servlet Container (Tomcat, Jetty)</label></div>
<div class="row_booroo"><label for="ans-116460"><input id="ans-116460" class="checkbox_booroo" type="checkbox" name="ans-116460" value="1" />War deployment in an application server (JBoss, Glassfish, &#8230;)</label></div>
<div class="row_booroo"><label for="ans-116461"><input id="ans-116461" class="checkbox_booroo" type="checkbox" name="ans-116461" value="1" />Standalone Equinox with plain OSGi HttpService</label></div>
<div class="row_booroo"><label for="ans-116462"><input id="ans-116462" class="checkbox_booroo" type="checkbox" name="ans-116462" value="1" />Other OSGi container (Virgo, Karaf, Felix, &#8230;)</label></div>
<div class="row_booroo"><label for="ans-116463"><input id="ans-116463" class="checkbox_booroo" type="checkbox" name="ans-116463" value="1" />War deployment in a cloud environment</label></div>
<div class="row_booroo"><label for="ans-116464"><input id="ans-116464" class="checkbox_booroo" type="checkbox" name="ans-116464" value="1" />Command Line / homebrewed launch script</label></div>
</div>
<div><input id="ans-other" class="text_booroo" type="text" name="ans-other" value="Other: (Please specify)" /></div>
<div id="submit_booroo" class="submit_booroo"><input class="qbutton_booroo35487" type="button" value="Vote Now" /><a class="qviewa_booroo35487">View results</a></div>
<div class="booroo_footer">
<p>Powered by BooRoo.com</p>
</div>
</div>
</fieldset>
</form>
</div>
<div class="results_booroo" style="display: none !important;">
<div class="padded_booroo">
<div class="row_booroo"><strong>War deployment in a plain Servlet Container (Tomcat, Jetty)</strong><img id="res-116459" class="result_booroo" style="width: 0%;" src="http://booroo.com/app_content/theme_poll/2/custom_themes/images/graph.gif" alt="graph How will you run your RAP application in 2013?"  title="How will you run your RAP application in 2013?" /><span>0%</span></div>
<div class="row_booroo"><strong>War deployment in an application server (JBoss, Glassfish, &#8230;)</strong><img id="res-116460" class="result_booroo" style="width: 0%;" src="http://booroo.com/app_content/theme_poll/2/custom_themes/images/graph.gif" alt="graph How will you run your RAP application in 2013?"  title="How will you run your RAP application in 2013?" /><span>0%</span></div>
<div class="row_booroo"><strong>Standalone Equinox with plain OSGi HttpService</strong><img id="res-116461" class="result_booroo" style="width: 0%;" src="http://booroo.com/app_content/theme_poll/2/custom_themes/images/graph.gif" alt="graph How will you run your RAP application in 2013?"  title="How will you run your RAP application in 2013?" /><span>0%</span></div>
<div class="row_booroo"><strong>Other OSGi container (Virgo, Karaf, Felix, &#8230;)</strong><img id="res-116462" class="result_booroo" style="width: 0%;" src="http://booroo.com/app_content/theme_poll/2/custom_themes/images/graph.gif" alt="graph How will you run your RAP application in 2013?"  title="How will you run your RAP application in 2013?" /><span>0%</span></div>
<div class="row_booroo"><strong>War deployment in a cloud environment</strong><img id="res-116463" class="result_booroo" style="width: 0%;" src="http://booroo.com/app_content/theme_poll/2/custom_themes/images/graph.gif" alt="graph How will you run your RAP application in 2013?"  title="How will you run your RAP application in 2013?" /><span>0%</span></div>
<div class="row_booroo"><strong>Command Line / homebrewed launch script</strong><img id="res-116464" class="result_booroo" style="width: 0%;" src="http://booroo.com/app_content/theme_poll/2/custom_themes/images/graph.gif" alt="graph How will you run your RAP application in 2013?"  title="How will you run your RAP application in 2013?" /><span>0%</span></div>
<div class="row_booroo"><strong>Other: (Please specify)</strong><img id="res-999999" class="result_booroo" style="width: 0%;" src="http://booroo.com/app_content/theme_poll/2/custom_themes/images/graph.gif" alt="graph How will you run your RAP application in 2013?"  title="How will you run your RAP application in 2013?" /><span>0%</span></div>
</div>
<div class="booroo_footer">
<p>Create a poll like this</p>
</div>
</div>
</div>
</div>
</div>
<div style="clear:both"></div>
</div>
<p><!--Requires jquery 1.6.1 --><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script><script type="text/javascript" src="http://booroo.com/app/polltheme/2/poll-min.js"></script></p>
<p>We&#8217;ll publish the results of this poll here on this blog early in 2013.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=How+will+you+run+your+RAP+application+in+2013%3F&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/12/06/how-will-you-run-your-rap-application-in-2013/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/12/06/how-will-you-run-your-rap-application-in-2013/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/12/06/how-will-you-run-your-rap-application-in-2013/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/12/06/how-will-you-run-your-rap-application-in-2013/&amp;t=How+will+you+run+your+RAP+application+in+2013%3F" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/war-deployment/' title='war deployment Tag'>war deployment</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/war-deployment/' title='war deployment Tag'>war deployment</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/12/06/how-will-you-run-your-rap-application-in-2013/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Running RAP 2.0 powered Web Application Bundles (WAB) on Virgo</title>
		<link>http://eclipsesource.com/blogs/2012/11/05/running-rap-2-0-powered-web-application-bundles-wab-on-virgo/</link>
		<comments>http://eclipsesource.com/blogs/2012/11/05/running-rap-2-0-powered-web-application-bundles-wab-on-virgo/#comments</comments>
		<pubDate>Mon, 05 Nov 2012 10:08:30 +0000</pubDate>
		<dc:creator>Florian Waibel</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[Planet OSGi]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[virgo]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=12128</guid>
		<description><![CDATA[With the latest RAP 2.0 milestone M2[1], you can run RAP based Web Application Bundles (WAB) with the unmodified RAP artifacts installed into your Virgo Jetty Server[2]. No more Eclipse buddy classloading required as noted in a previous post. Before version 2.0 M2, the RAP framework did not try to load configuration classes from the <a href="http://eclipsesource.com/blogs/2012/11/05/running-rap-2-0-powered-web-application-bundles-wab-on-virgo/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>With the latest RAP 2.0 milestone M2[1], you can run RAP based Web Application Bundles (WAB) with the unmodified RAP artifacts installed into your Virgo Jetty Server[2]. No more Eclipse buddy classloading required as noted in a previous <a href="http://eclipsesource.com/blogs/2011/08/10/how-to-extend-the-virgo-jetty-server-to-support-the-rap-widget-toolkit/">post</a>.</p>
<p>Before version 2.0 M2, the RAP framework did not try to load configuration classes from the thread&#8217;s context class loader (TCCL). Therefore, it was not possible to put the RAP libraries outside of your WAR file or use WABs with unmodified RAP artifacts.</p>
<p>With <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=367033">Bug 367033</a>[3] solved it has become very easy to develop Web Application Bundles with RAP. We&#8217;ve prepared a short <a href="http://eclipsesource.com/blogs/tutorials/developing-web-application-bundles-with-rap-and-virgo/">tutorial</a>[4] and a small example at <a href="https://github.com/eclipsesource/rap-virgo-examples">GitHUB</a>[5].</p>
<p>We invite you to take a look at our new tutorial, clone the example code &#8220;com.eclipsesource.rap.examples.helloworld.webbundle&#8221; and give it a try …</p>
<p>[1] 2.0 M2 Milestone Build &#8211; <a href="http://www.eclipse.org/downloads/download.php?file=/rt/rap/2.0/rap-2.0.0-M2-20121001-1623.zip">http://www.eclipse.org/downloads/download.php?file=/rt/rap/2.0/rap-2.0.0-M2-20121001-1623.zip</a><br />
[2] Virgo &#8211; <a href="http://www.eclipse.org/virgo/">http://www.eclipse.org/virgo/</a><br />
[3] Bug 367033 &#8211; RWTServletContextListener should use context class loader to load configurator class <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=367033">https://bugs.eclipse.org/bugs/show_bug.cgi?id=367033</a><br />
[4] Tutorial: Developing Web Application Bundles with RAP and Virgo &#8211; <a href="http://eclipsesource.com/blogs/tutorials/developing-web-application-bundles-with-rap-and-virgo/">http://eclipsesource.com/blogs/tutorials/developing-web…-rap-and-virgo/</a><br />
[5] WAB example using RAP &#8211; <a href="https://github.com/eclipsesource/rap-virgo-examples">https://github.com/eclipsesource/rap-virgo-examples</a></p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Running+RAP+2.0+powered+Web+Application+Bundles+%28WAB%29+on+Virgo&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/11/05/running-rap-2-0-powered-web-application-bundles-wab-on-virgo/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/11/05/running-rap-2-0-powered-web-application-bundles-wab-on-virgo/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/11/05/running-rap-2-0-powered-web-application-bundles-wab-on-virgo/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/11/05/running-rap-2-0-powered-web-application-bundles-wab-on-virgo/&amp;t=Running+RAP+2.0+powered+Web+Application+Bundles+%28WAB%29+on+Virgo" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/virgo/' title='virgo Tag'>virgo</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/virgo/' title='virgo Tag'>virgo</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/11/05/running-rap-2-0-powered-web-application-bundles-wab-on-virgo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RAP on the Quick: The pure Maven Way</title>
		<link>http://eclipsesource.com/blogs/2012/09/13/rap-on-the-quick-the-pure-maven-way/</link>
		<comments>http://eclipsesource.com/blogs/2012/09/13/rap-on-the-quick-the-pure-maven-way/#comments</comments>
		<pubDate>Thu, 13 Sep 2012 07:43:29 +0000</pubDate>
		<dc:creator>Florian Waibel</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[jetty]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=10881</guid>
		<description><![CDATA[Lately I was talking with a colleague if it is possible to kickstart a RAP standalone &#8220;Hello World&#8221; example in less than a coffee break(*). Well it depends… on the content of your local Maven directory and/or your internet connection. To make this happen you should postpone getting your coffee for now. Just go to <a href="http://eclipsesource.com/blogs/2012/09/13/rap-on-the-quick-the-pure-maven-way/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Lately I was talking with a colleague if it is possible to kickstart a <a href="http://eclipse.org/rap/">RAP</a> standalone &#8220;Hello World&#8221; example in less than a coffee break(*).</p>
<p>Well it depends…</p>
<p>on the content of your local Maven directory and/or your internet connection. <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink RAP on the Quick: The pure Maven Way" class='wp-smiley' title="RAP on the Quick: The pure Maven Way" /> </p>
<p>To make this happen you should postpone getting your coffee for now. Just go to a local temporary folder and grab the sample project from GitHub[1]</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">$ cd /tmp
$ git clone git://github.com/eclipsesource/rap-maven-examples.git</pre></td></tr></table></div>

<p>Change into the directory of the example and start the RAP example with the Maven-Jetty-Plugin:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">$ cd rap-maven-examples/com.eclipsesource.rap.examples.maven
$ mvn jetty:run</pre></td></tr></table></div>

<p>Now it&#8217;s a perfect time to go and get some tea or coffee&#8230;</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">[INFO] Scanning for projects...
...
2012-09-13 09:12:07.425:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 10 seconds.</pre></td></tr></table></div>

<p>Point your browser to <a title="http://localhost:8080/maven_example" href="http://localhost:8080/maven_example" rel="nofollow">http://localhost:8080/maven_example</a> and see the RAP example in action.</p>
<p>If you have a fast internet connection I&#8217;m pretty positive that your coffee is still hot. So maybe there is even some time of the coffee break left to have a look at the example code&#8230;or to leave a comment.</p>
<p>[1] RAP Maven examples &#8211; <a title="GitHub - RAP Maven examples" href="https://github.com/eclipsesource/rap-maven-examples">https://github.com/eclipsesource/rap-maven-examples</a></p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=RAP+on+the+Quick%3A+The+pure+Maven+Way&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/09/13/rap-on-the-quick-the-pure-maven-way/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/09/13/rap-on-the-quick-the-pure-maven-way/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/09/13/rap-on-the-quick-the-pure-maven-way/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/09/13/rap-on-the-quick-the-pure-maven-way/&amp;t=RAP+on+the+Quick%3A+The+pure+Maven+Way" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/jetty/' title='jetty Tag'>jetty</a>, <a href='http://eclipsesource.com/blogs/tag/maven/' title='maven Tag'>maven</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/jetty/' title='jetty Tag'>jetty</a>, <a href='http://eclipsesource.com/blogs/tag/maven/' title='maven Tag'>maven</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/09/13/rap-on-the-quick-the-pure-maven-way/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>How to create blueprints for your OSGi building blocks</title>
		<link>http://eclipsesource.com/blogs/2012/08/11/how-to-create-blueprints-for-your-osgi-building-blocks/</link>
		<comments>http://eclipsesource.com/blogs/2012/08/11/how-to-create-blueprints-for-your-osgi-building-blocks/#comments</comments>
		<pubDate>Sat, 11 Aug 2012 13:28:03 +0000</pubDate>
		<dc:creator>Florian Waibel</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[Planet OSGi]]></category>
		<category><![CDATA[clean code]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=9993</guid>
		<description><![CDATA[With OSGi we are able to implement building blocks for modular applications. Dependency injection frameworks support us in writing flexible, testable and clean code. The &#8220;Blueprint Container Specification&#8221; defines a dependency injection framework to build applications that run in an OSGi framework. The specification was added in version 4.2 to the OSGi compendium Specification[1]. This <a href="http://eclipsesource.com/blogs/2012/08/11/how-to-create-blueprints-for-your-osgi-building-blocks/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>With OSGi we are able to implement building blocks for modular applications. Dependency injection frameworks support us in writing flexible, testable and clean code. The &#8220;Blueprint Container Specification&#8221; defines a dependency injection framework to build applications that run in an OSGi framework. The specification was added in version 4.2 to the OSGi compendium Specification[1]. This specification is derived from the Spring Dynamic Modules project[2] which is an extension to the Spring dependency injection framework where you can take advantage of the services offered by the OSGi environment.</p>
<p>Essentially, a <a href="http://en.wikipedia.org/wiki/Blueprint">Blueprint</a> documents an architecture or an engineering design. Sounds promising. In addition, with the releases of Apache Aries[3] and Gemini Blueprint[4], the reference implementation for the Blueprint Container (chapter 121 of the OSGi 4.2 Compendium Specification), there are two open source implementations available.</p>
<p>Blueprint components are defined inside Blueprint XML resources. The location of these resource files can be specified with the Bundle-Blueprint manifest header. If the header is absent the default value: OSGI-INF/blueprint/*.xml will be used.</p>
<p>The sample below shows the body of a Blueprint definition:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;blueprint</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0&quot;</span> <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- Declare your beans here --&gt;</span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/blueprint<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Let&#8217;s test drive a Gemini Blueprint.</p>
<p>We&#8217;re going to develop two OSGi bundles. One contains an embedded database and exports a datasource as an OSGi service. The second bundle connects to the datasource provided and extends the built-in shell with basic functionality to execute simple SQL commands.</p>
<p>The following Blueprint Definitions describe the blueprint of the first of our bundles, a DataSourceProxy wrapping a simple DataSource:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;h2.datasource&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.jdbc.datasource.SimpleDriverDataSource&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;driverClass&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;org.h2.Driver&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;url&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;datasource.proxy&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;argument</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;h2.datasource&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>The dependency graph facilitates visual inspection of the blueprint.<br />
<div id="attachment_10011" class="wp-caption aligncenter" style="width: 319px"><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/08/Screen-shot-2012-08-08-at-8.36.01-AM.png"><img src="http://eclipsesource.com/blogs/wp-content/uploads/2012/08/Screen-shot-2012-08-08-at-8.36.01-AM.png" alt="Screen shot 2012 08 08 at 8.36.01 AM How to create blueprints for your OSGi building blocks" title="Blueprint of bundle exporting javax.sql.DataSource" width="309" height="261" class="size-full wp-image-10011" /></a><p class="wp-caption-text">Blueprint of bundle exporting javax.sql.DataSource</p></div></p>
<p>We grant access to our lazy proxy to other OSGi bundles as as an OSGi service via the standard javax.sql.DataSource interface:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;datasource.proxy&quot;</span> <span style="color: #000066;">interface</span>=<span style="color: #ff0000;">&quot;javax.sql.DataSource&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>Hidden in the logs you will find an entry &#8220;Publishing service under classes [{javax.sql.DataSource}]&#8221; telling you that the definition has been successfully interpreted by the Blueprint Container.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">INFO  region-dm-11                 o.e.g.b.e.i.d.startup.DependencyWaiterApplicationContextExecutor  No outstanding OSGi service dependencies, completing initialization for OsgiBundleXmlApplicationContext(bundle=com.eclipsesource.examples.virgo.blueprint, config=bundleentry://156.fwk1968988860/OSGI-INF/blueprint/beans.xml) 
INFO  region-dm-11                 o.s.beans.factory.support.DefaultListableBeanFactory              Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6dbe7935: defining beans [driver,datasource,.org.eclipse.gemini.blueprint.service.exporter.support.OsgiServiceFactoryBean#0,blueprintBundle,blueprintBundleContext,blueprintContainer,blueprintConverter]; root of factory hierarchy 
INFO  region-dm-11                 o.e.g.blueprint.service.exporter.support.OsgiServiceFactoryBean   Publishing service under classes [{javax.sql.DataSource}]</pre></td></tr></table></div>

<p>Consuming an OSGi service is just as easy. Instead of defining a service with a reference, a reference is defined with an Id:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;reference</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;datasource&quot;</span> <span style="color: #000066;">interface</span>=<span style="color: #ff0000;">&quot;javax.sql.DataSource&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></td></tr></table></div>

<p>The following definition shows how to inject the DataSource into the JdbcTemplate and the JdbcTemplate into the SqlCommandProvider,</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;jdbcTemplate&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.jdbc.core.JdbcTemplate&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;dataSource&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;datasource&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;sqlCommandProvider&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.eclipsesource.examples.virgo.blueprint.sql.SqlCommandProvider&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;jdbcTemplate&quot;</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;jdbcTemplate&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>which results in this blueprint for our second bundle.</p>
<div id="attachment_10013" class="wp-caption aligncenter" style="width: 312px"><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/08/Screen-shot-2012-08-08-at-8.53.05-AM.png"><img src="http://eclipsesource.com/blogs/wp-content/uploads/2012/08/Screen-shot-2012-08-08-at-8.53.05-AM.png" alt="Screen shot 2012 08 08 at 8.53.05 AM How to create blueprints for your OSGi building blocks" title="Blueprint of the bundle importing javax.sql.DataSource" width="302" height="244" class="size-full wp-image-10013" /></a><p class="wp-caption-text">Blueprint of the bundle importing javax.sql.DataSource</p></div>
<p>In addition to consuming an OSGi service, the second bundle contributes to the Apache Felix Gogo[5] Shell. This requires defining additional service properties as shown in the snippet below:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;sqlCommandProvider&quot;</span> <span style="color: #000066;">auto-export</span>=<span style="color: #ff0000;">&quot;all-classes&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service-properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;osgi.command.scope&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>sql<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;entry</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;osgi.command.function&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;array</span> <span style="color: #000066;">value-type</span>=<span style="color: #ff0000;">&quot;java.lang.String&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>execute<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>queryForInt<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/array<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/entry<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service-properties<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Putting it all together allows us to access the database via the OSGi console:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">osgi&gt; sql:execute CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255))
osgi&gt; sql:queryForInt SELECT COUNT(*) FROM TEST
0
osgi&gt; sql:execute INSERT INTO TEST VALUES(1, \'Hello\')                   
osgi&gt; sql:queryForInt SELECT COUNT(*) FROM TEST        
1</pre></td></tr></table></div>

<p>Let&#8217;s document the architecture of OSGi applications!</p>
<p>The example code has been written using Virgo Jetty Server 3.5.0.RELEASE with Gemini Blueprint 1.0.1.M01 and is available on <a href="https://github.com/eclipsesource/rap-virgo-examples">GitHUB</a>.</p>
<p>&#8211;</p>
<p>[1] OSGi Alliance Specifications &#8211; http://www.osgi.org/Specifications/HomePage<br />
[2] Spring Dynamic Modules &#8211; http://www.springsource.org/osgi/<br />
[3] Apache Aries &#8211; http://aries.apache.org/modules/blueprint.html<br />
[4] Gemini Blueprint &#8211; http://www.eclipse.org/gemini/blueprint/<br />
[5] Apache Felix Gogo &#8211; http://felix.apache.org/site/apache-felix-gogo.html</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=How+to+create+blueprints+for+your+OSGi+building+blocks&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/08/11/how-to-create-blueprints-for-your-osgi-building-blocks/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/08/11/how-to-create-blueprints-for-your-osgi-building-blocks/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/08/11/how-to-create-blueprints-for-your-osgi-building-blocks/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/08/11/how-to-create-blueprints-for-your-osgi-building-blocks/&amp;t=How+to+create+blueprints+for+your+OSGi+building+blocks" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/clean-code/' title='clean code Tag'>clean code</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/syndicate/' title='Planet Eclipse Tag'>Planet Eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a>, <a href='http://eclipsesource.com/blogs/tag/clean-code/' title='clean code Tag'>clean code</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/syndicate/' title='Planet Eclipse Tag'>Planet Eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/08/11/how-to-create-blueprints-for-your-osgi-building-blocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing RAP applications with Virgo</title>
		<link>http://eclipsesource.com/blogs/2012/07/05/developing-rap-applications-with-virgo/</link>
		<comments>http://eclipsesource.com/blogs/2012/07/05/developing-rap-applications-with-virgo/#comments</comments>
		<pubDate>Thu, 05 Jul 2012 07:16:32 +0000</pubDate>
		<dc:creator>Florian Waibel</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[Planet OSGi]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[Tabris]]></category>
		<category><![CDATA[virgo]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=8752</guid>
		<description><![CDATA[This post shows how to develop RAP applications with Virgo. The first part guides you through the setup for a Virgo Server instance and how to extend it to become a RAP runtime. The second part is a short walkthrough of how to create a Hello World RAP application using the new RAP OSGi integration. <a href="http://eclipsesource.com/blogs/2012/07/05/developing-rap-applications-with-virgo/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>This post shows how to develop RAP applications with Virgo. The first part guides you through the setup for a Virgo Server instance and how to extend it to become a RAP runtime. The second part is a short walkthrough of how to create a Hello World RAP application using the new RAP OSGi integration.</p>
<p><strong>Extend Virgo Kernel 3.0 to support the RAP Widget Toolkit 1.5</strong></p>
<p>Setup has become easier with the use of Jetty 8.1.3 and the RAP OSGi integration. If you&#8217;re using Virgo 2.1.x and RAP 1.4 please follow the instructions <a title="How to extend the Virgo Jetty Server to support the RAP Widget Toolkit" href="http://eclipsesource.com/blogs/2011/08/10/how-to-extend-the-virgo-jetty-server-to-support-the-rap-widget-toolkit/">How to extend the Virgo Jetty Server to support the RAP Widget Toolkit</a>[1] and <a title="Running RAP on Virgo" href="http://eclipsesource.com/blogs/2010/10/28/running-rap-on-virgo/">Running RAP on Virgo</a>[2].</p>
<p>In the following installation we will provide a RAP runtime based on Virgo using an HttpService provided by Jetty. The runtime is built on top of a Virgo Kernel. Jetty, the HttpService and RAP are added as extensions described in <a href="http://www.eclipse.org/virgo/documentation/virgo-documentation-3.0.0.x/docs/virgo-programmer-guide/html/ch04s03.html">plan artifacts</a>[3]. These plans are added to the list of initial artifacts. Let&#8217;s get started:</p>
<p>Download Virgo Kernel 3.0.3.RELEASE from <a title="Virgo Releases" href="http://www.eclipse.org/virgo/download/">Virgo Releases</a>[4] and install VK to a location of your choice. This location will be referenced as ${VIRGO_HOME} throughout the next steps.</p>
<p>The following bundles from the Jetty and Equinox project provide an OSGi HttpService:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">org.eclipse.jetty.continuation_8.1.3.v20120522.jar
org.eclipse.jetty.http_8.1.3.v20120522.jar
org.eclipse.jetty.io_8.1.3.v20120522.jar
org.eclipse.jetty.security_8.1.3.v20120522.jar
org.eclipse.jetty.server_8.1.3.v20120522.jar
org.eclipse.jetty.servlet_8.1.3.v20120522.jar
org.eclipse.jetty.util_8.1.3.v20120522.jar</pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">javax.servlet_3.0.0.v201112011016.jar
org.eclipse.equinox.http.jetty_3.0.0.v20120522-1841.jar
org.eclipse.equinox.http.servlet_1.1.300.v20120522-1841.jar</pre></td></tr></table></div>

<p>Another two bundles for the RAP widget toolkit and it&#8217;s OSGi integration.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">org.eclipse.rap.rwt_1.5.0.20120612-1458.jar
org.eclipse.rap.rwt.osgi_1.5.0.20120612-1458.jar</pre></td></tr></table></div>

<p>The easiest way to get all those bundles is to download the <a href="http://www.eclipse.org/downloads/download.php?file=/rt/rap/1.5/rap-runtime-1.5.0-R-20120612-1458.zip">RAP runtime</a>. Otherwise please visit the projects download pages listed below:</p>
<ul>
<li><a title="Jetty Distributions from Eclipse" href="http://www.eclipse.org/jetty/downloads.php">Jetty Distributions from Eclipse</a>[5]</li>
<li><a title="Equinox Integration Build: 3.8" href="http://download.eclipse.org/equinox/drops/R-3.8-201206081400/index.php">Equinox Integration Build: 3.8</a>[6]</li>
<li><a title="RAP downloads" href="http://eclipse.org/rap/downloads/">RAP downloads</a>[7]</li>
</ul>
<p>Copy all the listed bundles into ${VIRGO_HOME}/repository/ext to make them available for use in plan artifacts. To extend the core functionality of Virgo add the plan artifacts <a href="http://download.eclipsesource.com/~fwaibel/virgo/jetty-8.1.3.plan">jetty-8.1.3.plan</a>[8] and <a href="http://download.eclipsesource.com/~fwaibel/virgo/rap-1.5.0.plan">rap-1.5.0.plan</a>[9] next to the downloaded bundles into ${VIRGO_HOME}/repository/ext.</p>
<p>Add the two plan artifacts describing your extensions to the list of initial artifacts to your ${VIRGO_HOME}/config/org.eclipse.virgo.kernel.userregion.properties.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;"># the next line must not be broken with back-slashes
initialArtifacts = repository:plan/org.eclipse.virgo.kernel.userregion.springdm,repository:plan/org.eclipse.jetty,repository:plan/org.eclipse.rap.rwt</pre></td></tr></table></div>

<p><strong>NOTE:</strong><br />
On Unix systems access to the HttpService default port is restricted (<1024). The HttpService port can be easily configured by adding a line similar to</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">org.osgi.service.http.port=18080</pre></td></tr></table></div>

<p>to the {VIRGO_HOME}/lib/org.eclipse.virgo.kernel.launch.properties. This is described in detail in the blog post, &#8220;<a href="http://codewax.org/osgi/extending-virgo-with-a-httpservice/">Extending Virgo with a HttpService.</a>&#8220;[10]</p>
<p>Fire up the Virgo instance by running ${VIRGO_HOME}/bin/startup.sh with the two new extensions and look for the script that shows that the plans defining the two extensions have been started:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">[2012-06-19 17:44:36.248] start-signalling-1            Started bundle 'org.eclipse.equinox.http.jetty' version '3.0.0.v20120522-1841'. 
[2012-06-19 17:44:36.249] start-signalling-1            Started plan 'org.eclipse.jetty' version '8.1.3'. 
[2012-06-19 17:44:36.361] system-artifacts              Installing plan 'org.eclipse.rap.rwt' version '1.5.0'. 
[2012-06-19 17:44:38.255] system-artifacts              Installing bundle 'org.eclipse.rap.rwt' version '1.5.0.20120605-1606'. 
[2012-06-19 17:44:38.324] system-artifacts              Installing bundle 'org.eclipse.rap.rwt.osgi' version '1.5.0.20120605-1606'. 
[2012-06-19 17:44:38.391] system-artifacts              Installed bundle 'org.eclipse.rap.rwt' version '1.5.0.20120605-1606'. 
[2012-06-19 17:44:38.394] system-artifacts              Installed bundle 'org.eclipse.rap.rwt.osgi' version '1.5.0.20120605-1606'. 
[2012-06-19 17:44:38.396] system-artifacts              Installed plan 'org.eclipse.rap.rwt' version '1.5.0'. 
[2012-06-19 17:44:38.451] system-artifacts              Starting plan 'org.eclipse.rap.rwt' version '1.5.0'. 
[2012-06-19 17:44:38.455] system-artifacts              Starting bundle 'org.eclipse.rap.rwt' version '1.5.0.20120605-1606'. 
[2012-06-19 17:44:38.461] start-signalling-1            Started bundle 'org.eclipse.rap.rwt' version '1.5.0.20120605-1606'. 
[2012-06-19 17:44:38.465] system-artifacts              Starting bundle 'org.eclipse.rap.rwt.osgi' version '1.5.0.20120605-1606'. 
[2012-06-19 17:44:38.629] start-signalling-1            Started bundle 'org.eclipse.rap.rwt.osgi' version '1.5.0.20120605-1606'. 
[2012-06-19 17:44:38.631] start-signalling-1            Started plan 'org.eclipse.rap.rwt' version '1.5.0'. 
[2012-06-19 17:44:38.634] sync Event Dispatcher Thread  User region ready.</pre></td></tr></table></div>

<p><strong>Hello Virgo World</strong></p>
<p>Now that the Virgo/RAP runtime is prepared it&#8217;s a good time to setup your Eclipse / <a href="http://wiki.eclipse.org/Virgo/Tooling">Virgo tooling</a>[11]. Then, you can follow the step by step guide to get the demo up and running on your own computer. This demo has been written using Spring Tool Suite 3.0.0.M2 with Eclipse Virgo Tools installed.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/Screen-shot-2012-07-02-at-12.31.17-PM1.png"><img class="alignleft  wp-image-8779" title="Screen shot 2012-07-02 at 12.31.17 PM" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/Screen-shot-2012-07-02-at-12.31.17-PM1.png" alt="Screen shot 2012 07 02 at 12.31.17 PM1 Developing RAP applications with Virgo" width="275" height="104" /></a><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/Screen-shot-2012-07-02-at-11.58.29-AM1.png"><img class="alignright  wp-image-8783" title="Servers view with RAP server" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/Screen-shot-2012-07-02-at-11.58.29-AM1.png" alt="Screen shot 2012 07 02 at 11.58.29 AM1 Developing RAP applications with Virgo" width="274" height="103" /></a>Use the Virgo Tools to create a Server definition pointing to the Virgo Kernel prepared in the section above.</p>
<p>Create a new OSGi bundle project with the New Bundle Project wizard as shown in the screenshot below.<br />
<a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/Screen-shot-2012-07-02-at-1.12.36-PM.png"><img class="aligncenter size-full wp-image-8789" title="New bundle project wizard" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/Screen-shot-2012-07-02-at-1.12.36-PM.png" alt="Screen shot 2012 07 02 at 1.12.36 PM Developing RAP applications with Virgo" width="640" height="484" /></a></p>
<p>Find your Server in the Server view and open the context menu to &#8220;Add and Remove…&#8221; the created bundle project or simply drag&#8217;n'drop the project onto your freshly created server definition.</p>
<p>A final small step and we can start programming the actual RAP demo application. Make RWT known to your bundle by adding it as a dependency. The infrastructure bundle org.eclipse.rap.rwt.osgi is not a necessary dependency. It just works in the background and will connect our application to the HttpService once we have added our ApplicationConfiguration.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/add-rwt-dependencies1.png"><img class="aligncenter size-full wp-image-8797" title="add rwt dependencies" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/add-rwt-dependencies1.png" alt="add rwt dependencies1 Developing RAP applications with Virgo" width="717" height="526" /></a></p>
<p>Now it&#8217;s time for some Java hacking. Create a demo application,</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DemoApplication <span style="color: #000000; font-weight: bold;">implements</span> IEntryPoint <span style="color: #009900;">&#123;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> createUI<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		Display display <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Display<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		Shell mainShell <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Shell<span style="color: #009900;">&#40;</span>display, SWT.<span style="color: #006633;">TITLE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		mainShell.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;RAP Virgo Demo&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		mainShell.<span style="color: #006633;">setMaximized</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		mainShell.<span style="color: #006633;">setLayout</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">GridLayout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #003399;">Button</span> button <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Button</span><span style="color: #009900;">&#40;</span>mainShell, SWT.<span style="color: #006633;">PUSH</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		button.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello Virgo world!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		mainShell.<span style="color: #006633;">layout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		mainShell.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>and a basic configuration:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> DemoApplicationConfiguration <span style="color: #000000; font-weight: bold;">implements</span> ApplicationConfiguration <span style="color: #009900;">&#123;</span>
&nbsp;
	@Override
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> configure<span style="color: #009900;">&#40;</span>Application application<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">Map</span> properties <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">HashMap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		properties.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>WebClient.<span style="color: #006633;">PAGE_TITLE</span>, <span style="color: #0000ff;">&quot;RAP Virgo Demo&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		application.<span style="color: #006633;">addEntryPoint</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/virgo_demo&quot;</span>, DemoApplication.<span style="color: #000000; font-weight: bold;">class</span>, properties <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>The demo application as well as the configuration should be self explanatory. We expect to see a button &#8220;Hello Virgo world!&#8221; registered at the web context path &#8220;/virgo_demo&#8221; in a browser with the title &#8220;RAP Virgo Demo.&#8221; To make this happen we simply need to register our DemoApplicationConfiguration as an OSGi service.</p>
<p>There are many ways to do this. In this demo we create a Spring application context to register the configuration for us.</p>
<p>Create a new &#8220;Spring Bean Configuration File&#8221; with:</p>
<ul>
<li>A configuration bean</li>
<li>and an OSGi service referencing the configuration bean.</li>
</ul>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;beans</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">xmlns:osgi</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/osgi&quot;</span></span>
<span style="color: #009900;">  <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd</span>
<span style="color: #009900;">    http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;simpleConfiguration&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.eclipsesource.rap.virgo.demo.DemoApplicationConfiguration&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;osgi:service</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;simpleConfiguration&quot;</span> <span style="color: #000066;">interface</span>=<span style="color: #ff0000;">&quot;org.eclipse.rwt.application.ApplicationConfiguration&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/beans<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>If your server is already running, saving this file will automatically trigger a redeployment of the demo bundle. The  org.eclipse.rap.rwt.osgi bundle will do the necessary steps and register the demo application at the HttpService that is already running. You should be able to observe a successful deployment in the Console view:</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/Screen-shot-2012-07-02-at-1.43.51-PM1.png"><img class="aligncenter size-full wp-image-8810" title="Screen shot 2012-07-02 at 1.43.51 PM" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/Screen-shot-2012-07-02-at-1.43.51-PM1.png" alt="Screen shot 2012 07 02 at 1.43.51 PM1 Developing RAP applications with Virgo" width="1099" /></a></p>
<p>Check the result at <a href="localhost:18080/virgo_demo">localhost:18080/virgo_demo</a> &#8230; Congratulations! You successfully deployed your first RAP application on Virgo!</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/Screen-shot-2012-07-04-at-11.36.16-AM.png"><img src="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/Screen-shot-2012-07-04-at-11.36.16-AM.png" alt="Screen shot 2012 07 04 at 11.36.16 AM Developing RAP applications with Virgo" title="RAP Virgo Demo in a browser" width="480" height="352" class="aligncenter size-full wp-image-8891" /></a><br />
If you are curious enough, extend your RWT extension with <a href="http://developer.eclipsesource.com/tabris/">Tabris</a>[12] and enjoy your demo app on mobile devices without changing a single line of code&#8230;</p>
<p><strong>Running the demo on an Android device without changing a line of code</strong></p>
<p>Install two more bundles in your Virgo server and replace your RAP extension plan with the following Tabris variant:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plan</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;com.eclipsesource.tabris&quot;</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;0.6.0&quot;</span> <span style="color: #000066;">scoped</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">atomic</span>=<span style="color: #ff0000;">&quot;true&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.eclipse.org/virgo/schema/plan&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;</span>
<span style="color: #009900;">		        http://www.eclipse.org/virgo/schema/plan</span>
<span style="color: #009900;">		        http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifact</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;bundle&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;org.json&quot;</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;[1, 2)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifact</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;bundle&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;com.eclipsesource.tabris&quot;</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;[0.6, 1)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifact</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;bundle&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;org.eclipse.rap.rwt&quot;</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;[1.5, 2)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;artifact</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;bundle&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;org.eclipse.rap.rwt.osgi&quot;</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;[1.5, 2)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plan<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Do not forget to update the VK configuration and replace the initial artifact org.eclipse.rap.rwt with com.eclipsesource.tabris.</p>
<p>Restart your server to pick up the Tabris extension instead of plain RAP, then fire up your <a href="https://yoxos.eclipsesource.com/userdata/profile/9b581113715eee8f5ac61b12ec08dd1d">Tabris profile</a>[13] and you&#8217;ll be able to see the Android version of the demo application.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/Screen-shot-2012-07-04-at-11.20.15-AM.png"><img src="http://eclipsesource.com/blogs/wp-content/uploads/2012/07/Screen-shot-2012-07-04-at-11.20.15-AM.png" alt="Screen shot 2012 07 04 at 11.20.15 AM Developing RAP applications with Virgo" title="RAP Virgo Demo in an android emulator" width="800" class="aligncenter size-full wp-image-8886" /></a></p>
<p>Get the source of the <a href="https://github.com/eclipsesource/rap-virgo-examples">rap-virgo-examples</a> and enjoy developing RAP applications for Virgo.</p>
<p>&#8211;</p>
<p>[1] <a href="http://eclipsesource.com/blogs/2011/08/10/how-to-extend-the-virgo-jetty-server-to-support-the-rap-widget-toolkit/">How to extend the Virgo Jetty Server to support the RAP Widget Toolkit</a><br />
[2] <a href="http://eclipsesource.com/blogs/2010/10/28/running-rap-on-virgo/">http://eclipsesource.com/blogs/2010/10/28/running-rap-on-virgo/</a><br />
[3] <a href="http://www.eclipse.org/virgo/documentation/virgo-documentation-3.0.0.x/docs/virgo-programmer-guide/html/ch04s03.html">http://www.eclipse.org/virgo/documentation/virgo-documentation-3.0.0.x/docs/virgo-programmer-guide/html/ch04s03.html</a><br />
[4] Virgo Releases &#8211; <a href="http://www.eclipse.org/virgo/download/">http://www.eclipse.org/virgo/download/</a><br />
[5] Jetty Distributions from Eclipse &#8211; <a href="http://www.eclipse.org/jetty/downloads.php">http://www.eclipse.org/jetty/downloads.php</a><br />
[6] Equinox Integration Build: 3.8 &#8211; <a href="http://download.eclipse.org/equinox/drops/R-3.8-201206081400/index.php">http://download.eclipse.org/equinox/drops/R-3.8-201206081400/index.php</a><br />
[7] Eclipse RAP downloads &#8211; <a href="http://eclipse.org/rap/downloads/">http://eclipse.org/rap/downloads/</a><br />
[8] Jetty 8.1.3 plan artefact- <a href="http://download.eclipsesource.com/~fwaibel/virgo/jetty-8.1.3.plan">http://download.eclipsesource.com/~fwaibel/virgo/jetty-8.1.3.plan</a><br />
[9] RAP 1.5 plan artefact &#8211; <a href="http://download.eclipsesource.com/~fwaibel/virgo/rap-1.5.0.plan">http://download.eclipsesource.com/~fwaibel/virgo/rap-1.5.0.plan</a><br />
[10] Extending Virgo with a HttpService &#8211; <a href="http://codewax.org/osgi/extending-virgo-with-a-httpservice/">http://codewax.org/osgi/extending-virgo-with-a-httpservice/</a><br />
[11] Virgo/Tooling <a href="http://wiki.eclipse.org/Virgo/Tooling">http://wiki.eclipse.org/Virgo/Tooling</a><br />
[12] Tabris &#8211; <a href="http://developer.eclipsesource.com/tabris/">http://developer.eclipsesource.com/tabris/</a><br />
[13] Tabris profile &#8211; <a href="https://yoxos.eclipsesource.com/userdata/profile/9b581113715eee8f5ac61b12ec08dd1d">https://yoxos.eclipsesource.com/userdata/profile/9b581113715eee8f5ac61b12ec08dd1d</a></p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Developing+RAP+applications+with+Virgo&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/07/05/developing-rap-applications-with-virgo/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/07/05/developing-rap-applications-with-virgo/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/07/05/developing-rap-applications-with-virgo/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/07/05/developing-rap-applications-with-virgo/&amp;t=Developing+RAP+applications+with+Virgo" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a>, <a href='http://eclipsesource.com/blogs/tag/virgo/' title='virgo Tag'>virgo</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a>, <a href='http://eclipsesource.com/blogs/tag/virgo/' title='virgo Tag'>virgo</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/07/05/developing-rap-applications-with-virgo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to build a cluster with Jetty / OSGi</title>
		<link>http://eclipsesource.com/blogs/2011/08/12/how-to-build-a-cluster-with-jetty-osgi/</link>
		<comments>http://eclipsesource.com/blogs/2011/08/12/how-to-build-a-cluster-with-jetty-osgi/#comments</comments>
		<pubDate>Fri, 12 Aug 2011 13:56:43 +0000</pubDate>
		<dc:creator>Florian Waibel</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[Planet OSGi]]></category>
		<category><![CDATA[jetty]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6365</guid>
		<description><![CDATA[In this blog post I describe how to set up a cluster node with an embedded Jetty Server inside Equinox. Basically I followed the instructions available at the Jetty Wiki page Session Clustering Using a Database [1]. There are two Jetty configuration files involved: /etc/jetty.xml defining a JDBCSessionIdManager /WEB-INF/jetty-web.xml defining a JDBCSessionManager The main jetty.xml <a href="http://eclipsesource.com/blogs/2011/08/12/how-to-build-a-cluster-with-jetty-osgi/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>In this blog post I describe how to set up a cluster node with an embedded Jetty Server inside Equinox.</p>
<p>Basically I followed the instructions available at the Jetty Wiki page <a href="http://wiki.eclipse.org/Jetty/Feature/Session_Clustering_Using_a_Database">Session Clustering Using a Database</a> [1].</p>
<p>There are two Jetty configuration files involved:</p>
<ul>
<li>/etc/jetty.xml defining a JDBCSessionIdManager</li>
<li>/WEB-INF/jetty-web.xml defining a JDBCSessionManager</li>
</ul>
<p>The main jetty.xml resides in the folder etc of the jetty.home.bundle which itself is a fragment of org.eclipse.jetty.osgi.boot. The jetty.osgi.boot bundle is provided by the Jetty team and is responsible for bootstrapping Jetty in an OSGi environment.</p>
<p>The main configuration file contains the JDBCSessionIdManager definition using a H2 database:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Set</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;sessionIdManager&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;New</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;jdbcidmgr&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.eclipse.jetty.server.session.JDBCSessionIdManager&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Ref</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;Server&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Set</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;workerName&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;SystemProperty</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;worker.name&quot;</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">&quot;primary&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Set<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Call</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;setDriverInfo&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.h2.Driver<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jdbc:h2:tcp://localhost:9101/sessions<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Call<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Set</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;scavengeInterval&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>60<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Set<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/New<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Set<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Call</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;setAttribute&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>jdbcIdMgr<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Ref</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;jdbcidmgr&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Call<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><strong>Note</strong>: To reuse the configuration in multiple cluster nodes I use a SystemProperty tag to give every node a unique &#8220;worker.name&#8221;.  The database configuration is hardwired to a local H2 database.</p>
<p>With additional system properties I can tell the Jetty bootstrapper where to look for the global Jetty configuration and which port the Jetty instance should bind to:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">-Dworker.name=primary
-Djetty.port=18081
-Djetty.home.bundle=com.eclipsesource.cluster.jetty.home.bundle</pre></td></tr></table></div>

<p>To enable the Jetty server to load the H2 database drivers I added a dynamic import directive via the fragment org.eclipse.jetty.serverdynamic.import:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="text" style="font-family:monospace;">Fragment-Host: org.eclipse.jetty.server;bundle-version=&quot;7.4.2&quot;
DynamicImport-Package: *</pre></td></tr></table></div>

<p>The web application specific configuration /WEB-INF/jetty-web.xml is located in the web bundle, com.eclipsesource.cluster.jetty.demo.webbundle. This configuration file contains the JDBCSessionManager definition.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Configure</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.eclipse.jetty.webapp.WebAppContext&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Get</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;server&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Get</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;jdbcIdMgr&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;sessionIdManager&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Get<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Set</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;sessionHandler&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;New</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.eclipse.jetty.server.session.SessionHandler&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;New</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.eclipse.jetty.server.session.JDBCSessionManager&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Set</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;idManager&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Ref</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;jdbcIdMgr&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
          <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Set<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/New<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Arg<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/New<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Set<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Configure<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><strong>Note</strong>: &#8220;jdbcIdMgr&#8221; is a <strong>Ref</strong>erence to the jetty.xml from jetty.home.bundle.</p>
<p>If you want to try it out yourself, the code is available at <a href="https://github.com/eclipsesource/com.eclipsesource.cluster">GitHUB</a> [2].</p>
<p><strong>Note</strong>: The bundle com.eclipsesource.cluster.h2 contains an Eclipse launch configuration to start a local H2 database which is needed to run the example.</p>
<p>[1] <a href="http://wiki.eclipse.org/Jetty/Feature/Session_Clustering_Using_a_Database">http://wiki.eclipse.org/Jetty/Feature/Session_Clustering_Using_a_Database</a><br />
[2] <a href="https://github.com/eclipsesource/com.eclipsesource.cluster">https://github.com/eclipsesource/com.eclipsesource.cluster</a></p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=How+to+build+a+cluster+with+Jetty+%2F+OSGi&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2011/08/12/how-to-build-a-cluster-with-jetty-osgi/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2011/08/12/how-to-build-a-cluster-with-jetty-osgi/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2011/08/12/how-to-build-a-cluster-with-jetty-osgi/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2011/08/12/how-to-build-a-cluster-with-jetty-osgi/&amp;t=How+to+build+a+cluster+with+Jetty+%2F+OSGi" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/jetty/' title='jetty Tag'>jetty</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a>, <a href='http://eclipsesource.com/blogs/tag/jetty/' title='jetty Tag'>jetty</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/08/12/how-to-build-a-cluster-with-jetty-osgi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
