<?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; eclipse</title>
	<atom:link href="http://eclipsesource.com/blogs/tag/eclipse/feed/" rel="self" type="application/rss+xml" />
	<link>http://eclipsesource.com/blogs</link>
	<description>Eclipse Equinox OSGi</description>
	<lastBuildDate>Fri, 03 Feb 2012 17:54:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
		<item>
		<title>RAP mobile &#8211; iOS and Android apps written in Java</title>
		<link>http://eclipsesource.com/blogs/2012/01/31/rap-mobile-ios-and-android-apps-written-in-java/</link>
		<comments>http://eclipsesource.com/blogs/2012/01/31/rap-mobile-ios-and-android-apps-written-in-java/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 17:28:00 +0000</pubDate>
		<dc:creator>Jochen Krause</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[rap mobile]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6989</guid>
		<description><![CDATA[Industry experts have predicted that mobile computing is going to have a huge impact on the software industry. I agree. That’s why we asked ourselves if OSGi, RAP and Eclipse RT can help overcome some of the challenges in mobile app development. Some of the most common problems involved in mobile development include dealing with [...]]]></description>
			<content:encoded><![CDATA[<p>Industry experts have predicted that mobile computing is going to have a huge impact on the software industry. I agree. That’s why we asked ourselves if <a href="http://eclipse.org/equinox/">OSGi</a>, <a href="http://eclipse.org/rap/">RAP</a> and Eclipse RT can help overcome some of the challenges in mobile app development.</p>
<p>Some of the most common problems involved in mobile development include dealing with multi-platform, security and maturity of the available platforms. But does multi-platform really matter with iOS breaking adoption records? I am sure that Google and Microsoft believe that their platforms will become breakthrough successes as well. While no one can make a definitive statement about their future success, I don’t think that anyone would bet a fortune on their failure either. This leaves us with three options for addressing multi-platform: <a href="http://www.html5rocks.com/en/">HTML5</a>, development for each platform or making a bet on which will be the most successful.</p>
<p>HTML5 is great technology &#8211; not only for mobile &#8211; but there is a growing body of <a href="http://www.nytimes.com/2012/01/02/technology/hewlett-packards-touchpad-was-built-on-flawed-software-some-say.html?_r=4&amp;pagewanted=all">lessons learned the hard way</a>. Our own experience revealed that it is easy to get started with HTML5 and that the state-of-the-art JavaScript libraries look really great. But when it comes to running and using the apps the excitement mostly turned into disillusion. The other two options did not seem like good solutions for us, so we decided to add another option: <a href="http://rapmobile.eclipsesource.com">RAP mobile</a>.</p>
<p style="text-align: center;"><a href="http://rapmobile.eclipsesource.com"><img class="size-full wp-image-6994 aligncenter" title="logo" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/01/logo.png" alt="logo RAP mobile   iOS and Android apps written in Java" width="300" height="42" /></a></p>
<p style="text-align: left;">RAP mobile gives us some key advantages over the alternatives.  First, it allows multi-platform development in Java.  It uses the iOS and Android native widget toolkits for rendering the user interface with optimal performance and native look and feel.  And, it provides a mature and Open Source platform for writing and deploying business applications on standard JEE servers. It also provides a solution for common data security concerns with mobile devices.</p>
<p>Today we launched the RAP mobile developer preview program and the RAP mobile project site. If you are curious about how RAP mobile works and what it has to offer visit <a href="http://rapmobile.eclipsesource.com">http://rapmobile.eclipsesource.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/01/31/rap-mobile-ios-and-android-apps-written-in-java/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Javascript validation with JSHint in Eclipse</title>
		<link>http://eclipsesource.com/blogs/2012/01/26/javascript-validation-with-jshint-eclipse/</link>
		<comments>http://eclipsesource.com/blogs/2012/01/26/javascript-validation-with-jshint-eclipse/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 22:07:00 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6965</guid>
		<description><![CDATA[Besides all the Java code in the RAP project, we also have more than 250 JavaScript files which total up to 75k lines of code. For such an amount of code, you should have some kind of code analysis that detects common coding problems like unintentional global variables. We use the JSEclipse plug-in for JavaScript [...]]]></description>
			<content:encoded><![CDATA[<p>Besides all the Java code in the <a href="http://eclipse.org/rap">RAP</a> project, we also have more than 250 JavaScript files which total up to 75k lines of code. For such an amount of code, you should have some kind of code analysis that detects common coding problems like unintentional global variables. We use the JSEclipse plug-in for JavaScript editing which detects some, but not many JavaScript problems.</p>
<p>A while ago, we&#8217;ve tried to use <a href="http://jslint.com/">JSLint</a>, a tool written by JavaScript guru Douglas Crockford. Unfortunately, this tools produces several thousand warnings on our code base, many of them were not really problems but debatable coding style issues and there was no way to turn them off. JSLint&#8217;s lack of customizability recently lead to a <a href="http://anton.kovalyov.net/2011/02/20/why-i-forked-jslint-to-jshint/">fork</a> named <a href="http://www.jshint.com/">JSHint</a> that is going to provide more flexible <a href="http://www.jshint.com/options/">configuration options</a>.</p>
<p>Like JSLint, JSHint is written in JavaScript, but can be run on the command line using tools like <a href="http://www.mozilla.org/rhino/">Rhino</a> or JavaScriptCore. I tried JSHint on our codebase with good results using a shell script that runs it on top of Rhino. Unfortunately, checking all our 250+ *.js files keeps my machine busy for 5 minutes and 40 seconds and effectively turns it into a fan heater. This is not because JSHint itself is so demanding, but because for every file, a JVM has to be started, Rhino has to be loaded, then Rhino has to parse and load the JSHint JavaScript library, and then finally, jshint can parse and validate the source file.</p>
<p>Encouraged by the good results I tried to find a solution that doesn&#8217;t have this overhead. And as an Eclipse hacker and user, I certainly wanted to integrate the tool into my daily working environment. The result is a simple, yet efficient <a href="http://github.eclipsesource.com/jshint-eclipse/">JSHint Eclipse integration</a> that validates the same bunch of *.js files in less than 15 seconds.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/01/jshint-eclipse-screenshot.png"><img class="aligncenter wp-image-6969" title="jshint-eclipse" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/01/jshint-eclipse-screenshot.png" alt="jshint eclipse screenshot Javascript validation with JSHint in Eclipse" width="600" height="430" /></a></p>
<p>This speedup could be achieved by exploiting the way Eclipse builds projects: It uses the same builder instance to visit all files of the project recursively. That makes it possible to load and configure the JSHint library only once for the entire project and reuse it for all files being checked. Of course, validating all files of a project is only necessary for a full rebuild. During normal work, single files are being validated instantly when they have changed.</p>
<p>Although the configuration options are still somewhat basic, this integration proved to be very helpful already. I thought that it may be useful for others as well and decided to build and publish a first version. It&#8217;s available on the <a href="http://github.eclipsesource.com/jshint-eclipse/">jshint-eclipse page</a>. There&#8217;s an update site that let&#8217;s you install the plug-in right into your Eclipse IDE. If you find the plug-in useful, have ideas for improvements, find a problem or want to contribute, I&#8217;m happy to hear about it. To report problems, please use the <a href="https://github.com/eclipsesource/jshint-eclipse/issues">github issue tracker</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/01/26/javascript-validation-with-jshint-eclipse/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eclipse Juno M4: RAP speaks JSON</title>
		<link>http://eclipsesource.com/blogs/2011/12/16/eclipse-juno-m4-rap-speaks-json/</link>
		<comments>http://eclipsesource.com/blogs/2011/12/16/eclipse-juno-m4-rap-speaks-json/#comments</comments>
		<pubDate>Fri, 16 Dec 2011 16:32:19 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[juno]]></category>
		<category><![CDATA[new and noteworthy]]></category>
		<category><![CDATA[protocol]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6825</guid>
		<description><![CDATA[In the RAP framework, the widgets in a website are remotely controlled by the web server. The server does this by sending messages to the client in response to Ajax requests. Until now, those messages used to contain proprietary JavaScript that has been evaluated by the browser. Apart from the drawbacks of using eval to [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://eclipse.org/rap">RAP</a> framework, the widgets in a website are remotely controlled by the web server. The server does this by sending messages to the client in response to Ajax requests. Until now, those messages used to contain proprietary JavaScript that has been evaluated by the browser. Apart from the drawbacks of using <em>eval</em> to process server responses, this tightly couples RAP to its default browser client. The messages were so specific that only this client could understand them.</p>
<p>One of our goals for RAP 1.5 is to open the framework for alternative client implementations. After all, the messages from the server contain precise rendering commands that are not at all specific to JavaScript. Commands like &#8220;create a button with text &#8216;<code>Ok</code>&#8216;, set its size to <code>190x25px</code>, and place it at pos <code>(23,42)</code>&#8221; or &#8220;change the text color of the label with id &#8216;<code>w47</code>&#8216; to &#8216;<code>#ff0000</code>&#8216;&#8221; can be rendered by any client that is able to create and manipulate widgets. It doesn&#8217;t have to be a JavaScript client, also clients written in other languages like Java or Objective C can implement it. Clients can render widgets with any UI technology, be it SVG or even a mobile device&#8217;s native widget set.</p>
<p>To allow for those cases, we exchanged the communication format with a simple <a href="http://wiki.eclipse.org/RAP/Protocol">predefined format</a> based on <a href="http://json.org/">JSON</a>. With the <a href="http://eclipse.org/rap/noteworthy/1.5/news_M4.php">M4 build published today</a>, all responses from a RAP server are now plain JSON. This also makes the debugging much easier, since developer tools like <a href="http://getfirebug.com">Firebug</a> display the structure of a message.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2011/12/RAP-Firebug-JSON.png"><img class="aligncenter size-full wp-image-6828" title="RAP Session in Firebug (JSON)" src="http://eclipsesource.com/blogs/wp-content/uploads/2011/12/RAP-Firebug-JSON.png" alt="RAP Firebug JSON Eclipse Juno M4: RAP speaks JSON" width="600" height="301" /></a></p>
<p>When <a href="http://eclipsesource.com/blogs/tag/protocol/">designing the protocol</a>, we took great care not to limit the exchange format to widgets. Instead, we created a generic synchronization protocol for any kind of objects. Objects are identified with a unique id, and every operation is related to a target object that is referenced by its unique id. There are different types of operations: one to create an object, one to destroy it, one to change some properties on an object, etc. Every message from the server contains a list of operations, besides some meta information.</p>
<p>You&#8217;ve guessed that we already have some prototypes for alternative RAP clients in progress. We&#8217;ll write about them soon&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/12/16/eclipse-juno-m4-rap-speaks-json/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Effective Mockito Part 4</title>
		<link>http://eclipsesource.com/blogs/2011/10/17/effective-mockito-part-4/</link>
		<comments>http://eclipsesource.com/blogs/2011/10/17/effective-mockito-part-4/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 07:55:31 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[craftsmanship]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[Mocking]]></category>
		<category><![CDATA[Mockito]]></category>
		<category><![CDATA[test driven]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6545</guid>
		<description><![CDATA[This Effective Mockito Post will be IDE specific again but related to the last post on Mockito&#8217;s spies. If you&#8217;ve read Part 3 you should now be familiar how to use them to &#8220;pseudo mock&#8221; statics. When writing code it often comes to a point where we want to debug using single step debugging. When [...]]]></description>
			<content:encoded><![CDATA[<p>This Effective Mockito Post will be IDE specific again but related to the <a href="http://eclipsesource.com/blogs/2011/10/13/effective-mockito-part-3/">last post</a> on <a href="http://docs.mockito.googlecode.com/hg/latest/org/mockito/Mockito.html#spy(T)">Mockito&#8217;s spies</a>. If you&#8217;ve read Part 3 you should now be familiar how to use them to &#8220;pseudo mock&#8221; statics. When writing code it often comes to a point where we want to debug using single step debugging. When using <a href="http://code.google.com/p/mockito/">Mockito</a> and especially when spies come into the game there is still something pretty annoying.</p>
<p>That is, when we want to debug our Object-Under-Test&#8217;s real method and the object is a spy. When we try to step into the object&#8217;s method we always land in internal Mockito code. After a little reading we can drill deeper but the next landing place is in java.lang.reflect code and so on. To be honest, this is really not the nicest way to debug code. What I want is that regardless of whether I use spies or not, when I step into an object&#8217;s method I land directly in this method. In the past my workaround was to set a breakpoint in the test at the method call and in the method itself. This enabled me to stop at the first point and resume the execution until it stops the second time in the method. But there is a much more elegant way. Let&#8217;s see how we can do this.</p>
<p>First of all, let&#8217;s take a look at an example. The code below shows a simple test from the <a href="http://eclipsesource.com/blogs/2011/10/13/effective-mockito-part-3/">last Effective Mockito post</a>. The test uses a spy to &#8220;pseudo mock&#8221; a static method. We set a breakpoint in the line of the <code>isPropertySet</code> call and debug this method. Sadly when doing this we run into the effect described above.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@RunWith<span style="color: #009900;">&#40;</span> MockitoJUnitRunner.<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> MyObjectText <span style="color: #009900;">&#123;</span>
&nbsp;
  @Spy
  <span style="color: #000000; font-weight: bold;">private</span> MyObject objectUnderTest<span style="color: #339933;">;</span>
&nbsp;
  @Test
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testIsPropertySet<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    doReturn<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;some runtime property&quot;</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">when</span><span style="color: #009900;">&#40;</span> objectUnderTest <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getProperty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">boolean</span> isPropertySet <span style="color: #339933;">=</span> objectUnderTest.<span style="color: #006633;">isPropertySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    assertFalse<span style="color: #009900;">&#40;</span> isPropertySet <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></div></div>

<p>When using <a href="http://www.eclipse.org/downloads/">Eclipse</a> there is a very simple way to avoid this called &#8220;Step Filtering&#8221;. We can add packages or classes to this Filterlist using the preferences. When filters are activated the classes will automatically be skipped during debugging. By setting a filter like the one in the screenshot below we can simply step over the Mockito and reflection code.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2011/10/stepfilters.png"><img class="aligncenter size-full wp-image-6553" title="stepfilters" src="http://eclipsesource.com/blogs/wp-content/uploads/2011/10/stepfilters.png" alt="stepfilters Effective Mockito Part 4" width="652" height="599" /></a></p>
<p>If you are not using Eclipse there is probably a similar way to achieve this with your IDE. It would be cool if you would share this tip with us in a comment. Meantime, I hope that Step Filtering is as helpful to you as it is for me.  Finally, I want to thank <a href="http://eclipsesource.com/blogs/author/fwaibel/">Fluffi</a> and <a href="http://www.codeaffine.com/author/fappel/">Frank</a> for getting me to dive into this.</p>
<p><a href="http://twitter.com/hstaudacher"><img src="http://download.eclipsesource.com/~hstaudacher/followme.png" title="Follow @hstaudacher" width="191" height="58" border="0" alt="followme Effective Mockito Part 4" /></a></p>
<p><strong><em>Read the other Effective Mockito posts:</em></strong></p>
<ul>
<li><a href="http://eclipsesource.com/blogs/2011/09/19/effective-mockito-part-1/">Effective Mockito Part 1</a></li>
<li><a href="http://eclipsesource.com/blogs/2011/09/29/effective-mockito-part-2/">Effective Mockito Part 2</a></li>
<li><a href="http://eclipsesource.com/blogs/2011/10/13/effective-mockito-part-3/">Effective Mockito Part 3</a></li>
<li><a href="http://eclipsesource.com/blogs/2011/10/17/effective-mockito-part-4/">Effective Mockito Part 4</a></li>
<li><a href="http://eclipsesource.com/blogs/2011/11/16/effective-mockito-part-5/">Effective Mockito Part 5</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/10/17/effective-mockito-part-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lightweight OSGi Applications using RAP&#8217;s Widget Toolkit</title>
		<link>http://eclipsesource.com/blogs/2011/08/29/lightweight-osgi-applications-using-raps-widget-toolkit/</link>
		<comments>http://eclipsesource.com/blogs/2011/08/29/lightweight-osgi-applications-using-raps-widget-toolkit/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 20:04:06 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[milestone]]></category>
		<category><![CDATA[new and noteworthy]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6394</guid>
		<description><![CDATA[RAP is well known as an &#8220;RCP for the web browser&#8221;, including workbench, extension points, and all that stuff. Indeed, one of the greatest features of RAP is its ability to reuse RCP code in web applications. But did you know that you can also use RAP&#8217;s widget toolkit (RWT) to create simple web UIs [...]]]></description>
			<content:encoded><![CDATA[<p>RAP is well known as an &#8220;RCP for the web browser&#8221;, including workbench, extension points, and all that stuff. Indeed, one of the greatest features of RAP is its ability to reuse RCP code in web applications. But did you know that you can also use RAP&#8217;s widget toolkit (RWT) to create simple web UIs for your applications, without the heavy weight Eclipse UI stack?</p>
<p>With RAP 1.5, you can now simply include RWT in any OSGi application. You only need two bundles: <code>org.eclipse.rap.rwt</code> (the RAP widget toolkit itself) and <code>org.eclipse.rap.rwt.osgi</code> which integrates RWT with the OSGi HTTP service. There are no tie-ins with Equinox anymore, thus RAP also works with other OSGi containers.</p>
<p>To create a UI with RWT, you have to implement the interface <code>IEntryPoint</code>, here&#8217;s a simple example:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <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>
    <span style="color: #666666; font-style: italic;">// Create a maximized top-level shell without trimmings that represents the main &quot;page&quot;</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 page <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;">NO_TRIM</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    page.<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>
    page.<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: #666666; font-style: italic;">// Create contents of main shell</span>
    <span style="color: #003399;">Label</span> label <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Label</span><span style="color: #009900;">&#40;</span> page, SWT.<span style="color: #006633;">NONE</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    label.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Hello&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <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> page, 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;World&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Open the top-level shell and run the main loop to process events</span>
    page.<span style="color: #006633;">layout</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    page.<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;">while</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>page.<span style="color: #006633;">isDisposed</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>display.<span style="color: #006633;">readAndDispatch</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        display.<span style="color: #006633;">sleep</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    display.<span style="color: #006633;">dispose</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></pre></div></div>

<p>Now what&#8217;s new is that, instead of registering this entry point with an extension point, you can now implement the new <code>Configurator</code> interface like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <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> <span style="color: #003399;">Context</span> context <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    context.<span style="color: #006633;">addEntryPoint</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;default&quot;</span>, SimpleEntryPoint.<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    context.<span style="color: #006633;">addBranding</span><span style="color: #009900;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> AbstractBranding<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      @Override
      <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getServletName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;simple&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      @Override
      <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getTitle<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;Simple RWT Example&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>When this implementation is registered as an OSGi service, you can access the UI with a web browser:<br />
<a href="http://eclipsesource.com/blogs/wp-content/uploads/2011/08/RWTSimple.png"><br />
<img src="http://eclipsesource.com/blogs/wp-content/uploads/2011/08/RWTSimple.png" alt="RWTSimple Lightweight OSGi Applications using RAPs Widget Toolkit" title="RWT Simple Example" width="550" height="251" class="aligncenter size-full wp-image-6399" /></a><br />
You can check out the example project <code>example.rwt.simple</code> from my <a href="https://github.com/ralfstx/rap-helpers">rap-helpers repository on github</a>. Please note that for this example to run you need declarative services in your target platform, which are not included in the RAP 1.5M1 target but in the latest nightly build. Also be aware that the new API is still provisional and may change again until the final release.</p>
<p>Kudos to Frank Appel, who contributed the new OSGi integration. He has a more detailed introduction to the new OSGi integration and examples for configuration in <a href="http://www.codeaffine.com/2011/08/26/raprwt-osgi-integration/">his blog</a>. BTW, Frank and me plan to demo the possibilities of this approach in our talk <a href="http://www.eclipsecon.org/sessions/dynamic-web-applications-osgi-and-rap">Dynamic web applications with OSGi and RAP</a> at the EclipseCon Europe &#8211; vote for it if you&#8217;re interested!</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/08/29/lightweight-osgi-applications-using-raps-widget-toolkit/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Single-Sourcing with declarative services</title>
		<link>http://eclipsesource.com/blogs/2011/07/08/single-sourcing-with-declarative-services/</link>
		<comments>http://eclipsesource.com/blogs/2011/07/08/single-sourcing-with-declarative-services/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 09:51:16 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[declarative services]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[rcp]]></category>
		<category><![CDATA[rt]]></category>
		<category><![CDATA[Single Sourcing]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6229</guid>
		<description><![CDATA[In my last blog post I introduced the idea of using OSGi services for single sourcing a RAP/RCP application. I think this approach is quite elegant, but it has one major drawback. When you use normal OSGi services in your application you will mix your application code with the OSGi Framework code everytime you reference [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://eclipsesource.com/blogs/2011/06/20/using-osgi-services-to-single-source-an-rcp-and-rap-application/">my last blog post</a> I introduced the idea of using <a href="http://osgi.org">OSGi</a> services for single sourcing a <a href="http://eclipse.org/rap">RAP</a>/RCP application. I think this approach is quite elegant, but it has one major drawback. When you use normal OSGi services in your application you will mix your application code with the OSGi Framework code everytime you reference or register a service. Not only does this look ugly, it&#8217;s also hard to test.</p>
<p>Luckily there is a lifesaver called Declarative Services. (For those of you who are familiar with declarative services, skip to the next paragraph.) The OSGi declarative services (ds) are specified in the <a href="http://www.osgi.org/Download/File?url=/download/r4v42/r4.cmpn.pdf">OSGi compendium</a> so they are standardized. It&#8217;s just a component framework on top of OSGi services. It gives you the ability to register and consume services in a declarative way using some xml files and simple accessors in your classes.</p>
<p>I&#8217;ll take the same example from in <a href="http://eclipsesource.com/blogs/2011/06/20/using-osgi-services-to-single-source-an-rcp-and-rap-application/">my last blog post</a> and use it to look at ds for single sourcing.  In that blog, we single sourced a themed button widget.  We can use the same interfaces and service implementations, and the only differences will be how the services will be registered and referenced.</p>
<p>First, let&#8217;s take a look at the service registration. In our example we need to register the services in the rap and rcp bundles. It&#8217;s common practice to put all service declarations in a folder called OSGI-INF in the root of your project. Once you&#8217;ve created this folder you can create a &#8220;component definition&#8221; using the wizard. After this you need to fill in three things: first, the filename of your choice, second, the component name which needs to be unique in the framework and third, the component itself.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2011/07/componentWizard.png"><img class="aligncenter size-full wp-image-6232" title="componentWizard" src="http://eclipsesource.com/blogs/wp-content/uploads/2011/07/componentWizard.png" alt="componentWizard Single Sourcing with declarative services" width="537" height="570" /></a></p>
<p>The component is the fully qualified classname of your implementation. In the case of service registration, it&#8217;s your service implementation. To add the service registration, press &#8216;Finish&#8217; to open the component editor. We only want to register a service, so we jump to the service tab. In the bottom section you can add the service interface.</p>
<p>To understand what happens in the background let&#8217;s recap what we have declared. We defined a service interface, a service implementation, a component name and a filename. The component framework takes care of instantiating the service implementation and registering it as a service using the service interface. It registers the component using the component name. The filename will be automatically added to your bundle&#8217;s manifest. That&#8217;s all, the next time we start this bundle the service will be registered. Your component definition should look something like this:</p>

<div class="wp_syntax"><div 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;scr:component</span> <span style="color: #000066;">xmlns:scr</span>=<span style="color: #ff0000;">&quot;http://www.osgi.org/xmlns/scr/v1.1.0&quot;</span> <span style="color: #000066;">immediate</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;com.eclipsesource.app.rap.service.provider&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;implementation</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.eclipsesource.app.rap.RAPSingelSourcingService&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<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;provide</span> <span style="color: #000066;">interface</span>=<span style="color: #ff0000;">&quot;com.eclipsesource.app.ISingleSourcingService&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<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scr:component<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Now we get to the service referencing. As you recall, we need to reference the service in our app bundle. Therefore, we need to create a component in this bundle too. In this example I decided to reference the service in the bundle&#8217;s activator and provide it with a static accessor. But you can reference it wherever you want. In this case the component is our Activator. The only difference to the service registration is in the service tab of the component editor. Instead of providing a service, we are now referencing one. You can do this by clicking &#8216;Add&#8217; in the upper section of this tab.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2011/07/serviceReferencing.png"><img class="aligncenter size-full wp-image-6233" title="serviceReferencing" src="http://eclipsesource.com/blogs/wp-content/uploads/2011/07/serviceReferencing.png" alt="serviceReferencing Single Sourcing with declarative services" width="521" height="315" /></a></p>
<p>After this you need to declare the Interface of the service you want to reference, in our case the ISingleSoucingService. The question is now, &#8220;how does this service finds its way to the Activator?&#8221; The answer is binding methods. In the reference you can specify a bind and an unbind method e.g. setService and unsetService. You need to add these methods to your activator with the service as a parameter. That&#8217;s all &#8211; we are referencing the service now. Your component should look something like this:</p>

<div class="wp_syntax"><div 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;scr:component</span> <span style="color: #000066;">xmlns:scr</span>=<span style="color: #ff0000;">&quot;http://www.osgi.org/xmlns/scr/v1.1.0&quot;</span> <span style="color: #000066;">enabled</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;com.eclipsesource.app.servic.consumer&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;implementation</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;com.eclipsesource.internal.app.Activator&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;reference</span> <span style="color: #000066;">bind</span>=<span style="color: #ff0000;">&quot;setSingleSourcingService&quot;</span> <span style="color: #000066;">cardinality</span>=<span style="color: #ff0000;">&quot;1..1&quot;</span> <span style="color: #000066;">interface</span>=<span style="color: #ff0000;">&quot;com.eclipsesource.app.ISingleSourcingService&quot;</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ISingleSourcingService&quot;</span> <span style="color: #000066;">policy</span>=<span style="color: #ff0000;">&quot;dynamic&quot;</span> <span style="color: #000066;">unbind</span>=<span style="color: #ff0000;">&quot;unsetSingleSourcingService&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/scr:component<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>The last thing we need is a little bit of glue to bring these components together. The glue is in the <code>org.eclipse.equinox.ds</code> bundle. This bundle contains the component framework implementation, and to make everything work together you need to add this bundle to your launch configuration. It&#8217;s not included in the <a href="http://eclipse.org/rap">RAP</a> target components, but you can download it using the <a href="http://wiki.eclipse.org/Eclipse_Project_Update_Sites">Indigo release site</a> or the <a href="http://download.eclipse.org/equinox/">Equinox SDK</a>.</p>
<p>I added a branch called &#8220;ds&#8221; to the <a href="https://github.com/eclipsesource/rap-single-sourcing">repository on github</a> from the last blog. This branch represents an example implementation using ds for single sourcing.</p>
<p>Have fun declaring services <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink Single Sourcing with declarative services" class='wp-smiley' title="Single Sourcing with declarative services" /> </p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/07/08/single-sourcing-with-declarative-services/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using OSGi services to single-source an RCP and RAP Application</title>
		<link>http://eclipsesource.com/blogs/2011/06/20/using-osgi-services-to-single-source-an-rcp-and-rap-application/</link>
		<comments>http://eclipsesource.com/blogs/2011/06/20/using-osgi-services-to-single-source-an-rcp-and-rap-application/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 08:18:23 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[OSGi]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[rcp]]></category>
		<category><![CDATA[services]]></category>
		<category><![CDATA[Single Sourcing]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6083</guid>
		<description><![CDATA[Probably one of RAP’s best known features is its single-sourcing capabilities. Some time ago we created a guide on Single-Sourcing RCP and RAP applications. The guide recommended a technique where a facade and fragments were used to invoke the RCP or RAP implementation during runtime. With this post I want to show you how to [...]]]></description>
			<content:encoded><![CDATA[<p>Probably one of <a href="http://eclipse.org/rap">RAP’s</a> best known features is its single-sourcing capabilities. Some time ago we created a <a href="http://eclipsesource.com/en/info/rcp-rap-single-sourcing-guideline/">guide on Single-Sourcing RCP and RAP applications</a>. The guide recommended a technique where a facade and fragments were used to invoke the RCP or RAP implementation during runtime. With this post I want to show you how to achieve the same the <a href="http://www.osgi.org/Main/HomePage">OSGi</a> way.</p>
<p>For single-sourcing a RAP or RCP application, its straightforward to use the power of <a href="http://www.osgi.org/Main/HomePage">OSGi </a>because it&#8217;s included in both platforms out-of-the-box. OSGi has a central concept called services which are simply POJOs and are used to allow communication between modules. And, you can register or resolve services at any time in your code.</p>
<p>The basic Idea behind using OSGi services for single-sourcing is as follows. We need to extract all the things that vary into separate, platform specific bundles. To use the different implementations, we have to create an interface in a “common” bundle that contains the methods we want to use. The platform specific bundles have to register an implementation of this interface as a service. In the “common” bundle we can reference the registered services and use them to get the platform specific stuff. More specifically, we register a <a href="http://eclipse.org/rap">RAP</a> implementation in a “rap” bundle and an RCP implementation in an “rcp” bundle. The only thing we need to do then is to start the right bundles on the associated platform to get the right service.</p>
<p>With this solution we can extract the platform specific stuff into separate bundles and we don&#8217;t have to rely on fragments. So enough talking. Let&#8217;s look at some code. I decided to create a very simple single-sourcing interface which can be used to get the WidgetUtil.CUSTOM_VARIANT constant value. This constant exists only in RAP so, it&#8217;s a good example for showing how to handle the differences.</p>

<div class="wp_syntax"><div 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;">interface</span> ISingleSourcingService <span style="color: #009900;">&#123;</span>
  <span style="color: #003399;">String</span> getCustomVariantString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I have created three bundles: one that contains the application which is entitled &#8220;com.eclipsesource.app&#8221; and one for each platform. These are called &#8220;com.eclipsesource.app.rap&#8221; and &#8220;com.eclipsesource.app.rcp&#8221;. Both platform bundles implement the interface.<br />
RAP:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getCustomVariantString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> WidgetUtil.<span style="color: #006633;">CUSTOM_VARIANT</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>RCP:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getCustomVariantString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// There are no custom variants in RCP</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>And both bundles are registering the service in their Activator during the start method call.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> start<span style="color: #009900;">&#40;</span> BundleContext bundleContext <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>
    <span style="color: #003399;">Activator</span>.<span style="color: #006633;">context</span> <span style="color: #339933;">=</span> bundleContext<span style="color: #339933;">;</span>
    registration <span style="color: #339933;">=</span> context.<span style="color: #006633;">registerService</span><span style="color: #009900;">&#40;</span> ISingleSourcingService.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
                                            <span style="color: #000000; font-weight: bold;">new</span> RAPSingelSourcingService<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
                                            <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>When it comes to using the service in the common &#8220;app&#8221; bundle we can use a ServiceTracker to get the service implementation (<a href="http://eclipsesource.com/blogs/2009/05/12/osgi-declarative-services/">you can also use DS</a>).</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">private</span> ISingleSourcingService getSingleSourcingService<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// We use a tracker to get the service. We also can use DS to get it.</span>
    Bundle bundle <span style="color: #339933;">=</span> FrameworkUtil.<span style="color: #006633;">getBundle</span><span style="color: #009900;">&#40;</span> getClass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    BundleContext context <span style="color: #339933;">=</span> bundle.<span style="color: #006633;">getBundleContext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ServiceTracker tracker
      <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ServiceTracker<span style="color: #009900;">&#40;</span> context,
                            ISingleSourcingService.<span style="color: #000000; font-weight: bold;">class</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>,
                            <span style="color: #000066; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    tracker.<span style="color: #006633;">open</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ISingleSourcingService service <span style="color: #339933;">=</span> tracker.<span style="color: #006633;">getService</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    tracker.<span style="color: #006633;">close</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> service<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

<p>The only thing we have to do now is to create two launch configurations which contain the associated platform-specific bundle.</p>
<p>That’s it! You can find the sources in <a href="https://github.com/eclipsesource/rap-single-sourcing">this github repository</a>. Have fun using OSGi services to single-source applications.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/06/20/using-osgi-services-to-single-source-an-rcp-and-rap-application/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>High availability clustering for RAP/RWT in Eclipse Juno</title>
		<link>http://eclipsesource.com/blogs/2011/06/16/high-availability-clustering-for-raprwt-in-eclipse-juno/</link>
		<comments>http://eclipsesource.com/blogs/2011/06/16/high-availability-clustering-for-raprwt-in-eclipse-juno/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 09:12:24 +0000</pubDate>
		<dc:creator>Rüdiger Herrmann</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[juno]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=6003</guid>
		<description><![CDATA[While most of us are busy with that latest bits of the Indigo release, some have the joy to work on one of the next new features in RAP: support for high availablity clusters. Let me briefly mark out what we mean by clustering support and what we don&#8217;t. Load balancing clusters are used if [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_6008" class="wp-caption alignright" style="width: 180px"><a href="http://eclipsesource.com/blogs/wp-content/uploads/2011/06/cluster.jpg"><img class="size-full wp-image-6008" src="http://eclipsesource.com/blogs/wp-content/uploads/2011/06/cluster.jpg" alt="cluster High availability clustering for RAP/RWT in Eclipse Juno" width="170" height="227" title="High availability clustering for RAP/RWT in Eclipse Juno" /></a><p class="wp-caption-text">Computer cluster, taken from http://thefullwiki.org/Parallel_programming</p></div>
<p>While most of us are busy with that latest bits of the <a href="http://eclipse.org/indigo/">Indigo</a> release, some have the joy to work on one of the next new features in <a href="http://eclipse.org/rap">RAP</a>: support for high availablity clusters.</p>
<p>Let me briefly mark out what we mean by clustering support and what we don&#8217;t. <a href="http://en.wikipedia.org/wiki/Load_balancing_(computing)">Load balancing</a> clusters are used if you whish to provide your applications to a large number of users. If your application provides critical servies you may also want to make it fail safe by running it in a <a href="http://en.wikipedia.org/wiki/High-availability_cluster">high availablity cluster</a>.</p>
<p>A high availability cluster operates by having redundant nodes. So that if one node crashes, the service as a whole is unafected as other nodes take over the work. Whereas load balancing RAP applications is possible since ever, failover clusters put further requirements on the framework.</p>
<p>To be able to migrate sessions between nodes in a cluster, all session data has to be serializable. Also, the current implementation preserves the server-side execution flow within a <em>UIThread</em> in order to single-source RCP applications. These two form the main work areas.</p>
<ul>
<li>All session data must be prepared for distributing sessions among cluster nodes for failsafe operation.</li>
<li>A new life cycle for processing requests without a UIThread was implemented and RAP can be configured to run with either of them.</li>
</ul>
<p>The new life cycle also makes it easier to access security or transaction contexts and is conform to the <a href="http://www.oracle.com/technetwork/java/javaee/tech/index.html">JEE Specification</a>. If you don&#8217;t use blocking dialogs or workbench features and want to be able to eventually run your application in a cluster &#8211; then this is for you.</p>
<p>For more details, see the <a href="http://wiki.eclipse.org/RAP/RWT_Cluster">RAP Wiki</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/06/16/high-availability-clustering-for-raprwt-in-eclipse-juno/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>You don&#8217;t have to use git to access code on github</title>
		<link>http://eclipsesource.com/blogs/2011/06/10/you-dont-have-to-use-git-to-access-code-on-github/</link>
		<comments>http://eclipsesource.com/blogs/2011/06/10/you-dont-have-to-use-git-to-access-code-on-github/#comments</comments>
		<pubDate>Fri, 10 Jun 2011 15:37:23 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[syndicate]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[egit]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[GitHub]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=5965</guid>
		<description><![CDATA[I guess a lot of people would agree that github is the current kick-ass platform for developing software. Many platforms showed up fast and with the same speed they disappeared. Github is different. It&#8217;s also genuinely innovative. For several months I use github to share small projects (widgets, tools, small plug-ins). When I write a [...]]]></description>
			<content:encoded><![CDATA[<p>I guess a lot of people would agree that <a href="http://github.com">github</a> is the current kick-ass platform for developing software. Many platforms showed up fast and with the same speed they disappeared. Github is different. It&#8217;s also genuinely innovative. For several months I use <a href="http://github.com">github</a> to share small projects (widgets, tools, small plug-ins). When I write a blog about something new I always link the associated github repository.</p>
<p>A few days ago some people mentioned to me that it&#8217;s great that the sources from my posts are open but they can&#8217;t install git on their machines due to security restrictions in their company. They aren&#8217;t even allowed to install <a href="http://eclipse.org/egit">egit</a> as an Eclipse plug-in. But there is  good news. <strong>You don&#8217;t have to use git when you want to get sources from github</strong>. You can download every branch from every (public) github repository without git. When you browse to a repository you can simply press the download button on the right and download the latest version of the repository as zip or tar.gz. Is this simple? As I said, it&#8217;s a kick-ass platform <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink You dont have to use git to access code on github" class='wp-smiley' title="You dont have to use git to access code on github" /> </p>
<p style="text-align: center;"><a href="http://eclipsesource.com/blogs/wp-content/uploads/2011/06/github.png"><img class="aligncenter size-full wp-image-5966" title="github" src="http://eclipsesource.com/blogs/wp-content/uploads/2011/06/github.png" alt="github You dont have to use git to access code on github" width="666" height="319" /></a></p>
<p style="text-align: center;">&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/06/10/you-dont-have-to-use-git-to-access-code-on-github/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Key Bindings in RAP</title>
		<link>http://eclipsesource.com/blogs/2011/04/27/key-bindings-in-rap/</link>
		<comments>http://eclipsesource.com/blogs/2011/04/27/key-bindings-in-rap/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 08:07:39 +0000</pubDate>
		<dc:creator>Ralf Sternberg</dc:creator>
				<category><![CDATA[eclipse]]></category>
		<category><![CDATA[news]]></category>
		<category><![CDATA[syndicate]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[indigo]]></category>
		<category><![CDATA[rap]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=5745</guid>
		<description><![CDATA[Support for key bindings (bug 282449) has been one of the most requested features for RAP. So I&#8217;m happy to say that since 1.4 M5, RAP implements the JFace key bindings API, provides the org.eclipse.ui.bindings extension point, and enables most of the default workbench key bindings. As a result, you can now use most* of the [...]]]></description>
			<content:encoded><![CDATA[<p>Support for key bindings (<del><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=282449">bug 282449</a></del>) has been one of the most requested features for RAP. So I&#8217;m happy to say that since 1.4 M5, RAP implements the JFace key bindings API, provides the <code>org.eclipse.ui.bindings</code> extension point, and enables most of the default workbench key bindings. As a result, you can now use most* of the key shortcuts of your application also in the browser–if your application uses the workbench. But many use RAP without using the workbench. So how can you enable key bindings in a plain RWT application?</p>
<p>In M7, we now introduce a simple way of doing this. Let&#8217;s first have a look on how you would implement a key binding in SWT. You would have to register a global listener for key events on the display like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">display.<span style="color: #006633;">addFilter</span><span style="color: #009900;">&#40;</span> SWT.<span style="color: #006633;">KeyDown</span>, <span style="color: #000000; font-weight: bold;">new</span> Listener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> handleEvent<span style="color: #009900;">&#40;</span> <span style="color: #003399;">Event</span> event <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> event.<span style="color: #006633;">stateMask</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> event.<span style="color: #006633;">keyCode</span> <span style="color: #339933;">==</span> SWT.<span style="color: #006633;">ESCAPE</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">// handle escape key</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Well, you can now use the same code in RWT.</p>
<p>But there&#8217;s one more thing to it: RWT is a client-server architecture and we don&#8217;t want the browser client to send a request for each and every key stroke. The server should only be notified when the user presses one of the key sequences that we are really interested in. Therefore, we have to inform the client, which key sequences should be <q>active</q>.  This information can now be attached to the display using <code>Display.setData()</code> with the new constant <code>RWT.ACTIVE_KEYS</code> as property key. The value of this property must be an array of strings, each one representing a single active key sequence. The syntax is the same that you know from key binding extensions for the workbench.  So if you want to enable some simple key bindings like, for example, &#8220;c&#8221; for compose and &#8220;x&#8221; for delete, and maybe some more advanced key sequences like &#8220;Ctrl+F11&#8243; for power-users, you could write something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">display.<span style="color: #006633;">setData</span><span style="color: #009900;">&#40;</span> RWT.<span style="color: #006633;">ACTIVE_KEYS</span>, <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;C&quot;</span>, <span style="color: #0000ff;">&quot;X&quot;</span>, <span style="color: #0000ff;">&quot;CTRL+F11&quot;</span> <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
display.<span style="color: #006633;">addFilter</span><span style="color: #009900;">&#40;</span> SWT.<span style="color: #006633;">KeyDown</span>, <span style="color: #000000; font-weight: bold;">new</span> Listener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> handleEvent<span style="color: #009900;">&#40;</span> <span style="color: #003399;">Event</span> event <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> event.<span style="color: #006633;">stateMask</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> event.<span style="color: #006633;">character</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'C'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      handleCompose<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> event.<span style="color: #006633;">stateMask</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> event.<span style="color: #006633;">character</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'X'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      handleDelete<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span> event.<span style="color: #006633;">stateMask</span> <span style="color: #339933;">==</span> SWT.<span style="color: #006633;">CTRL</span> <span style="color: #339933;">&amp;&amp;</span> event.<span style="color: #006633;">keyCode</span> <span style="color: #339933;">==</span> SWT.<span style="color: #006633;">F11</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      doSomeAdvancedStuff<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Only the first line is RAP-specific. So for a single-sourcing RWT/SWT application, you only have to care about the constant. I&#8217;m sure you have an idea how to do that. M7 will be available on May 7–easy to remember.</p>
<p><small>*) Some shortcuts may be reserved by some browsers and cannot be used. Other shortcuts will override browser actions, like Ctrl-N (new window) Ctrl-T (new tab) etc. You also may not like to disable C&amp;P in form fields by adding key bindings for Ctrl-C etc. So you have to choose your web key bindings wisely&#8230; Ah, and sequences of key strokes like Ctrl+X T are not yet supported.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2011/04/27/key-bindings-in-rap/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

