<?xml version="1.0"?>
<rss version="2.0">

<channel>
	<title>Planet Eclipse</title>
	<link>http://planeteclipse.org/planet/</link>
	<language>en</language>
	<description>Planet Eclipse - http://planeteclipse.org/planet/</description>

<item>
	<title>Ian Bull: Custom touchpoints in p2</title>
	<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=15960</guid>
	<link>http://eclipsesource.com/blogs/2013/05/23/custom-touchpoints-in-p2/</link>
	<description>&lt;p&gt;For most people, p2 is simply the &lt;em&gt;&lt;strong&gt;Install&lt;/strong&gt;  &lt;strong&gt;Software Dialog &lt;/strong&gt;&lt;/em&gt; in Eclipse. While this is certainly true (or at least the Install Software Dialog is built with p2), p2 is much more than this. The &lt;a href=&quot;http://eclipse.org/equinox/p2/&quot;&gt;&lt;em&gt;Eclipse Provisioning Platform&lt;/em&gt; (p2)&lt;/a&gt; is a general purpose platform for &lt;em&gt;provisioning everything and nothing in particular&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Most of the out-of-the-box p2 tools are related to provisioning OSGi bundles (&lt;a href=&quot;http://eclipsesource.com/blogs/2009/04/29/plug-in-vs-bundle/&quot;&gt;or Eclipse plug-ins, if you prefer&lt;/a&gt;), but there is nothing in the core that limits us to Eclipse or OSGi. In fact, you can extend p2 to install whatever you want. In this example I’ll show you how to create a custom &lt;strong&gt;Install Action &lt;/strong&gt;(&lt;em&gt;touchpoint&lt;/em&gt;) that executes an arbitrary binary during installation.&lt;/p&gt;
&lt;h3&gt;Background&lt;/h3&gt;
&lt;p&gt;When you use p2 to install software it goes through a number of steps.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style=&quot;line-height: 12.997159004211426px;&quot;&gt;&lt;strong&gt;A provisioning plan is computed.&lt;/strong&gt; Based on what you already have installed and the install action you’re taking, p2 computes a plan. The plan includes operands such as: &lt;em&gt;remove foo, upgrade bar, install baz, etc..&lt;/em&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Artifacts are fetched and checked&lt;/strong&gt;. Once a plan is constructed, the plan is executed on the &lt;b&gt;p2 engine&lt;/b&gt;. The first step is fetching all the artifacts and the trust checking (checksum validation)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unconfigure / Uninstall.&lt;/strong&gt; If there are any units being removed, they are given a chance to ‘unconfigure’ themsevles. Once this is done, they are &lt;em&gt;uninstalled.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Install / Configure.&lt;/strong&gt; If there are any units being added, they are first installed and then they are given a chance to &lt;em&gt;configure&lt;/em&gt;&lt;strong&gt; &lt;/strong&gt;themselves.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;For installable units being &lt;em&gt;upgraded,&lt;/em&gt; this is essentially an unconfigure / uninstall followed by an instal / configure.&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;&lt;/strong&gt;The Problem&lt;/h3&gt;
&lt;p&gt;p2 has a number of actions you can invoke when an installable unit (IU) is installed, configured, unconfigured or uninstalled. For example, artifacts can be &lt;em&gt;unzipped&lt;strong&gt;, &lt;/strong&gt;copied&lt;/em&gt; or the &lt;em&gt;permissions can be set.&lt;strong&gt; &lt;/strong&gt;&lt;/em&gt;These &lt;em&gt;actions&lt;/em&gt;&lt;strong&gt; &lt;/strong&gt;are called &lt;strong&gt;touchpoint actions&lt;/strong&gt;&lt;em&gt;.&lt;/em&gt; Eclipse has two sets of touchpoint actions, &lt;strong&gt;native &lt;/strong&gt;and &lt;strong&gt;OSGi&lt;/strong&gt;. Native ones are general (such as move, copy, mkdir) while the OSGi ones are Eclipse or OSGi specific (install bundle, set VM Args, etc…).&lt;/p&gt;
&lt;p&gt;While these are a good start (and enough to provision an Eclipse system), often you need custom actions if you are provisioning a highly specific system. Also, not only do you need custom actions, you need them to be installed before they can be used.&lt;/p&gt;
&lt;p&gt;Let’s consider the case where we want to ship and run an arbitrary executable during the installation of a plugin.&lt;/p&gt;
&lt;h3&gt;Touchpoint Actions&lt;/h3&gt;
&lt;p&gt;Custom touchpoint actions can be specified using the &lt;tt&gt;org.eclipse.equinox.p2.engine.action&lt;/tt&gt; extension point. Touchpoint Actions are tied to a &lt;strong&gt;touchpoint&lt;/strong&gt;, the controller responsible for executing the action. You can either write your own custom touchpoint, or simply tie your action to an existing one. In our case, we will tie our touchpoint action to the OSGi touchpoint.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://eclipsesource.com/blogs/wp-content/uploads/2013/05/Screen-Shot-2013-05-22-at-3.43.23-PM.png&quot;&gt;&lt;img alt=&quot;Screen Shot 2013 05 22 at 3.43.23 PM Custom touchpoints in p2&quot; class=&quot;aligncenter size-full wp-image-15983&quot; height=&quot;346&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/uploads/2013/05/Screen-Shot-2013-05-22-at-3.43.23-PM.png&quot; title=&quot;Custom touchpoints in p2&quot; width=&quot;680&quot; /&gt;&lt;/a&gt;All touchpoint actions extend &lt;tt&gt;ProvisioningAction&lt;/tt&gt; and provide two methods &lt;strong&gt;execute &lt;/strong&gt;and &lt;strong&gt;undo&lt;/strong&gt;. Execute is used whenever the provisioning action is invoked. Undo is used if the action needs to be rolled back. In our case we will implement execute to read a parameter and call Runtime#exec on the value of that parameter.&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre class=&quot;java&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; IStatus execute&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;Map&lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;lt&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt;, Object&lt;span style=&quot;color: #339933;&quot;&gt;&amp;amp;&lt;/span&gt;gt&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt; parameters&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
  &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; artifact &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000066; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt; parameters.&lt;span style=&quot;color: #006633;&quot;&gt;containsKey&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;ARTIFACT&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// If an artifact is specified, look it up&lt;/span&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
  &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; program &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;parameters.&lt;span style=&quot;color: #006633;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;PROGRAM&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #003399;&quot;&gt;String&lt;/span&gt; fullPath &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; computeProgramPath&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;artifact, program&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;try&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
    &lt;span style=&quot;color: #003399;&quot;&gt;Runtime&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;getRuntime&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;exec&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;fullPath&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;catch&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #003399;&quot;&gt;IOException&lt;/span&gt; e&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;{&lt;/span&gt;
    e.&lt;span style=&quot;color: #006633;&quot;&gt;printStackTrace&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
    &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Status&lt;span style=&quot;color: #009900;&quot;&gt;(&lt;/span&gt;IStatus.&lt;span style=&quot;color: #006633;&quot;&gt;ERROR&lt;/span&gt;, &lt;span style=&quot;color: #003399;&quot;&gt;Activator&lt;/span&gt;.&lt;span style=&quot;color: #006633;&quot;&gt;PLUGIN_ID&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;&quot;Cannot execute &quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;+&lt;/span&gt; fullPath&lt;span style=&quot;color: #009900;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
  &lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;
  &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;return&lt;/span&gt; Status.&lt;span style=&quot;color: #006633;&quot;&gt;OK_STATUS&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: #009900;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The undo method (that is, the inverse of Runtime#exec) has been left as an exercise to the reader &lt;img alt=&quot;icon wink Custom touchpoints in p2&quot; class=&quot;wp-smiley&quot; src=&quot;http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif&quot; title=&quot;Custom touchpoints in p2&quot; /&gt; .&lt;/p&gt;
&lt;h3&gt;MetaRequirements&lt;/h3&gt;
&lt;p&gt;In order to ensure that  your touchpoints get installed before the components that need them, you can either invoke two updates (update the installer and then update the application) or you can use &lt;strong&gt;MetaRequirements&lt;/strong&gt;. MetaRequirements invoke a two stage plan, ensuring that the touchpoints are fetched and installed before they are invoked.&lt;/p&gt;
&lt;p&gt;MetaRequirements can be declared in a p2.inf file as follows.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt;metaRequirements.0.namespace=org.eclipse.equinox.p2.iu&lt;br /&gt;
metaRequirements.0.name=com.ianbull.p2.touchpoint.exec&lt;br /&gt;
metaRequirements.0.range=[1,2)&lt;br /&gt;
&lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;In this case we’ve specified a metaRequirement on the Installable Unit &lt;tt&gt;com.ianbull.p2.touchpoint.exec&lt;/tt&gt; version &lt;tt&gt;[1.0,2.0)&lt;/tt&gt;. This Installable Unit must exist before our IU can be installed. For OSGi bundles, the p2.inf file should be placed next to the MANIFEST.MF file. In our case, it’s placed in a bundle called &lt;tt&gt;com.ianbull.p2.touchpoint.payload&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;To summarize, before ‘payload’ can be installed, the touchpoint ‘exec’ must be installed and available. Since it’s declared as a metaRequirement, p2 will handle this by using a two-stage plan.&lt;/p&gt;
&lt;h3&gt;Invoking the Touchpoint&lt;/h3&gt;
&lt;p&gt;Now that we’ve created the touchpoint, all we need to do is invoke it. This is done by the Installable Unit which declares the metaRequirement. In our case, we will ship the executable as part of our ‘payload’ plugin.&lt;/p&gt;
&lt;p&gt;We will use two touchpoints, one to set the permission (755) and then our custom touchpoint to launch the application.&lt;/p&gt;
&lt;p&gt;&lt;tt&gt; instructions.install = \&lt;br /&gt;
chmod(targetDir:@artifact,targetFile:payload/someProgram,permissions:755);&lt;/tt&gt;&lt;br /&gt;
&lt;tt&gt;&lt;br /&gt;
instructions.install.import= \&lt;br /&gt;
org.eclipse.equinox.p2.touchpoint.eclipse.chmod&lt;br /&gt;
&lt;/tt&gt;&lt;tt&gt;&lt;br /&gt;
instructions.configure = com.ianbull.p2.touchpoint.exec.Execute(artifact:@artifact, program:payload/someProgram);&lt;/tt&gt;&lt;/p&gt;
&lt;h3&gt;Putting it all Together&lt;/h3&gt;
&lt;p&gt;Once we have these two plugins (the ‘exec’ touchpoint and the ‘payload’) we create a repository that contains them both.&lt;/p&gt;
&lt;p&gt;With the repository in place, we simply invoke the director, or better yet, the p2 &lt;em&gt;Install Software Dialog&lt;/em&gt; to install the payload.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://eclipsesource.com/blogs/wp-content/uploads/2013/05/Screen-Shot-2013-05-22-at-3.12.34-PM.png&quot;&gt;&lt;img alt=&quot;Screen Shot 2013 05 22 at 3.12.34 PM Custom touchpoints in p2&quot; class=&quot;aligncenter size-full wp-image-15975&quot; height=&quot;172&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/uploads/2013/05/Screen-Shot-2013-05-22-at-3.12.34-PM.png&quot; title=&quot;Custom touchpoints in p2&quot; width=&quot;618&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The payload doesn’t actually have any dependency on the ‘exec’ touchpoint, except for the MetaRequirement. This MetaRequirement will cause the ‘exec’ touchpoint to first be installed, and then the touchpoint can be invoked.&lt;/p&gt;
&lt;p&gt;And now during installation, our custom application is started. While this particular application doesn’t do anything useful, it could be an installer for another tool, or it may simply invoke an existing service such as Apache HTTPD.&lt;/p&gt;
&lt;p style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://eclipsesource.com/blogs/wp-content/uploads/2013/05/Screen-Shot-2013-05-22-at-3.13.54-PM.png&quot;&gt;&lt;img alt=&quot;Screen Shot 2013 05 22 at 3.13.54 PM Custom touchpoints in p2&quot; class=&quot;aligncenter  wp-image-15976&quot; height=&quot;332&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/uploads/2013/05/Screen-Shot-2013-05-22-at-3.13.54-PM.png&quot; title=&quot;Custom touchpoints in p2&quot; width=&quot;525&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p style=&quot;text-align: left;&quot;&gt;If you’re interested in the code examples I’ve used here, I’ve pushed them all to &lt;a href=&quot;https://github.com/irbull/com.ianbull.p2.touchpoint.example&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;display: inline-block;&quot;&gt;&lt;a href=&quot;https://twitter.com/intent/tweet?source=webclient&amp;amp;text=Custom+touchpoints+in+p2&amp;amp;via=eclipsesource&amp;amp;url=http://eclipsesource.com/blogs/2013/05/23/custom-touchpoints-in-p2/&quot; style=&quot;margin-right: 5px;&quot; target=&quot;_blank&quot; title=&quot;Share on Twitter&quot;&gt;&lt;img alt=&quot;Twitter&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png&quot; title=&quot;Twitter&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/05/23/custom-touchpoints-in-p2/&quot; style=&quot;margin-right: 5px;&quot; target=&quot;_blank&quot; title=&quot;+1&quot;&gt;&lt;img alt=&quot;Google+&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png&quot; title=&quot;Google+&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/05/23/custom-touchpoints-in-p2/&quot; style=&quot;margin-right: 5px;&quot; target=&quot;_blank&quot; title=&quot;Share on LinkedIn&quot;&gt;&lt;img alt=&quot;LinkedIn&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png&quot; title=&quot;LinkedIn&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/05/23/custom-touchpoints-in-p2/&amp;amp;t=Custom+touchpoints+in+p2&quot; style=&quot;margin-right: 5px;&quot; target=&quot;_blank&quot; title=&quot;Facebook&quot;&gt;&lt;img alt=&quot;Facebook&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png&quot; title=&quot;Facebook&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href=&quot;http://eclipsesource.com/blogs/2013/05/23/custom-touchpoints-in-p2/#comments&quot;&gt;Leave a Comment&lt;/a&gt;. Tagged with &lt;a href=&quot;http://eclipsesource.com/blogs/tag/eclipse/&quot; title=&quot;eclipse Tag&quot;&gt;eclipse&lt;/a&gt;, &lt;a href=&quot;http://eclipsesource.com/blogs/tag/p2/&quot; title=&quot;p2 Tag&quot;&gt;p2&lt;/a&gt;, &lt;a href=&quot;http://eclipsesource.com/blogs/tag/eclipse/&quot; title=&quot;eclipse Tag&quot;&gt;eclipse&lt;/a&gt;, &lt;a href=&quot;http://eclipsesource.com/blogs/tag/p2/&quot; title=&quot;p2 Tag&quot;&gt;p2&lt;/a&gt;&lt;p&gt;&lt;/p&gt;</description>
	<pubDate>Wed, 22 May 2013 22:58:10 +0000</pubDate>
</item>
<item>
	<title>Sebastian Benz: Testing Web Apps with Selenium and Jnario</title>
	<guid isPermaLink="true">http://sebastianbenz.de/testing-your-web-app-with-selenium-and-jnario</guid>
	<link>http://sebastianbenz.de/testing-your-web-app-with-selenium-and-jnario</link>
	<description>&lt;p&gt;As you might know &lt;a href=&quot;http://sebastianbenz.de/introducing-jnario-executable-specifications-for-java&quot;&gt;Jnario&lt;/a&gt; is a new language for testing Java applications.
Jnario takes the ideas of &lt;a href=&quot;http://cukes.info&quot;&gt;Cucumber&lt;/a&gt; and &lt;a href=&quot;http://rspec.info/&quot;&gt;RSpec&lt;/a&gt; from the Ruby world to the Java world. At the same time, Jnario preserves the things we Java developers like so much: type safety and great tool support!&lt;/p&gt;

&lt;p&gt;In this post I demonstrate how easy it is to write Cucumber style acceptance tests in Jnario. Jnario has some unique features, which makes writing given, when, then style scenarios a lot easier than in Cucumber or JBehave. I will show how to use Jnario by implementing a simple acceptance test for a web app using the browser automation tool &lt;a href=&quot;http://docs.seleniumhq.org/&quot;&gt;Selenium&lt;/a&gt;. We will also cover more advanced topics such as how to encapsulate setup and teardown logic for scenarios and how to generate reports from your scenarios.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;center&quot; height=&quot;575&quot; src=&quot;http://sebastianbenz.de/images/selenium/editor.gif&quot; title=&quot;Jnario Editor&quot; width=&quot;627&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Jnario is a language specifically designed for testing based on &lt;a href=&quot;http://www.xtend-lang.org&quot;&gt;Xtend&lt;/a&gt;. Xtend is a new language for the JVM featuring lambda expressions, type-inference, multi-line strings and more. The good thing about Xtend is that it uses the same type system as Java and compiles to readable Java code. This means when writing specs with Jnario, you can use all the goodness of Xtend resulting in less boilerplate code in your specs. Furthermore, Jnario is easy to integrate into existing Java projects, as specifications compile to plain Java JUnit tests.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;center&quot; height=&quot;259&quot; src=&quot;http://sebastianbenz.de/images/selenium/junit_run.png&quot; title=&quot;Jnario JUnit execution&quot; width=&quot;685&quot; /&gt;&lt;/p&gt;




&lt;h2&gt;Getting Started&lt;/h2&gt;

&lt;p&gt;First you need to install the Jnario tooling for Eclipse (if you haven’t already), the easiest way to do this is via the &lt;a href=&quot;http://www.jnario.org/updates/releases/&quot;&gt;update site&lt;/a&gt; or the &lt;a href=&quot;http://marketplace.eclipse.org/content/jnario&quot;&gt;Eclipse Marketplace&lt;/a&gt;. Eclipse is not strictly required for this tutorial, but its going to be a lot more convenient.&lt;/p&gt;

&lt;p&gt;We will be using &lt;a href=&quot;http://maven.apache.org/&quot;&gt;Maven&lt;/a&gt; to manage our dependencies and to compile our specs. The easiest way to set up a new Jnario project using maven to use the Jnario Maven Archetype. If your are using the &lt;a href=&quot;http://eclipse.org/m2e/&quot;&gt;Maven tooling for Eclipse&lt;/a&gt; just create a new maven project and select the jnario-archetype:&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;center&quot; height=&quot;406&quot; src=&quot;http://sebastianbenz.de/images/selenium/wizard1.png&quot; title=&quot;Jnario Maven Archetype&quot; width=&quot;620&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Otherwise enter the following on the command line to create a new maven project:&lt;/p&gt;

&lt;pre&gt;$ mvn archetype:generate                                  \
  -DarchetypeGroupId=org.jnario                           \
  -DarchetypeArtifactId=jnario-archetype                  \
  -DarchetypeVersion=0.4.2                                \
  -DgroupId=org.jnario                                    \
  -DartifactId=selenium
&lt;/pre&gt;


&lt;p&gt;Afterwards we have to add the selenium dependencies to our pom file:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-xml&quot;&gt;   ...
   &amp;lt;dependencies&amp;gt;
    ...
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;org.seleniumhq.selenium&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;selenium-java&amp;lt;/artifactId&amp;gt;
            &amp;lt;version&amp;gt;2.32.0&amp;lt;/version&amp;gt;
        &amp;lt;/dependency&amp;gt;
        &amp;lt;dependency&amp;gt;
            &amp;lt;groupId&amp;gt;com.opera&amp;lt;/groupId&amp;gt;
            &amp;lt;artifactId&amp;gt;operadriver&amp;lt;/artifactId&amp;gt;
        &amp;lt;/dependency&amp;gt;
    &amp;lt;/dependencies&amp;gt;
  &amp;lt;dependencyManagement&amp;gt;
        &amp;lt;dependencies&amp;gt;
            &amp;lt;dependency&amp;gt;
                &amp;lt;groupId&amp;gt;com.opera&amp;lt;/groupId&amp;gt;
                &amp;lt;artifactId&amp;gt;operadriver&amp;lt;/artifactId&amp;gt;
                &amp;lt;version&amp;gt;0.18&amp;lt;/version&amp;gt;
                &amp;lt;exclusions&amp;gt;
                    &amp;lt;exclusion&amp;gt;
                        &amp;lt;groupId&amp;gt;org.seleniumhq.selenium&amp;lt;/groupId&amp;gt;
                        &amp;lt;artifactId&amp;gt;selenium-remote-driver&amp;lt;/artifactId&amp;gt;
                    &amp;lt;/exclusion&amp;gt;
                &amp;lt;/exclusions&amp;gt;
            &amp;lt;/dependency&amp;gt;
        &amp;lt;/dependencies&amp;gt;
    &amp;lt;/dependencyManagement&amp;gt;
&lt;/pre&gt;


&lt;p&gt;That is all we need to do for setting up Jnario. You can verify whether everything works by running:&lt;/p&gt;

&lt;pre&gt;$ mvn clean install
&lt;/pre&gt;


&lt;p&gt;This will compile and run the example specs in the new project. If the build is successful, we can safely delete the example files “src/main/org/jnario/selenium/HelloWorld.xtend” and “src/test/org/jnario/selenium/HelloWorld.spec” and get started.&lt;/p&gt;

&lt;h2&gt;Our first Scenario&lt;/h2&gt;

&lt;p&gt;To demonstrate how to use Jnario with Selenium, we will test a web app most of us should be familiar with: the Google Search. Our goal is to test, when we search for a certain keyword that the search result contains matching websites.&lt;/p&gt;

&lt;p&gt;Jnario features two different languages for writing tests, one for unit tests and one for high-level acceptance tests similar to &lt;a href=&quot;http://cukes.info&quot;&gt;Cucumber&lt;/a&gt;. As the feature we are going to test is pretty high-level and can easily be understood by a non-technical stakeholder, we will be using the acceptance spec language. To create a new feature definition use the wizard via &lt;strong&gt;New File-&amp;gt;Jnario-&amp;gt;Jnario Feature&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;center&quot; height=&quot;634&quot; src=&quot;http://sebastianbenz.de/images/selenium/wizard_feature.png&quot; title=&quot;Jnario Feature Wizard&quot; width=&quot;525&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Jnario feature files use a format similar to Cucumber with some small differences, which we will look into later. The basic idea is the same, to use &lt;strong&gt;Given&lt;/strong&gt;, &lt;strong&gt;When&lt;/strong&gt;, &lt;strong&gt;Then&lt;/strong&gt; steps to describe &lt;a href=&quot;https://sites.google.com/site/unclebobconsultingllc/the-truth-about-bdd&quot;&gt;simple scenarios&lt;/a&gt;. In our example, we establish the precondition in the &lt;strong&gt;Given&lt;/strong&gt; step that we open Google search in a browser. In the following &lt;strong&gt;When&lt;/strong&gt; step we search for the “Jnario” keyword. Afterwards, we describe in the &lt;strong&gt;Then&lt;/strong&gt; step the expected outcome, namely, to find the Jnario slogan “Executable Specifications for Java” in our search results:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;package org.jnario.selenium

Feature: &lt;span class=&quot;nocode&quot;&gt;Searching for web pages via Google&lt;/span&gt;

  In order to safe time
  As a developer
  I want to find web sites faster

  Scenario: &lt;span class=&quot;nocode&quot;&gt;Searching for Jnario&lt;/span&gt;

   Given I opened &quot;http://www.google.com&quot; in a browser
   When &lt;span class=&quot;nocode&quot;&gt;I search for &quot;Jnario&quot;&lt;/span&gt;
   Then the result should contain &quot;Jnario - Executable Specifications for Java&quot;
&lt;/pre&gt;


&lt;p&gt;Note that we use quotes to define step parameters, such as &lt;code&gt;&quot;http://www.google.com&quot;&lt;/code&gt;. We will use this later, when we make our specification executable.&lt;/p&gt;

&lt;h2&gt;Executable Specification FTW&lt;/h2&gt;

&lt;p&gt;So far we have defined a simple acceptance criterion for our feature. We can already execute it as a JUnit test by right-clicking our feature file and selecting &lt;strong&gt;Run as-&amp;gt;JUnit Test&lt;/strong&gt;. It might be surprising, but our scenario passes already. The reason is that our scenario will be ignored by JUnit as we haven’t provided an implementation for our steps yet.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;center&quot; height=&quot;214&quot; src=&quot;http://sebastianbenz.de/images/selenium/pending.png&quot; title=&quot;Jnario JUnit execution&quot; width=&quot;596&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In Jnario you don’t need to define a separate parser for your scenarios. Instead, you can directly add the necessary execution logic into your scenarios. You can think of a scenario as a normal Java class where the scenario is the class and each step is a separate method. So, we can setup the selenium infrastructure by declaring two fields. One field contains the web driver and one the web driver wait util. The web driver is responsible for controlling and accessing the browser. The syntax for declaring fields is similar to &lt;a href=&quot;http://www.eclipse.org/xtend/documentation.html#fields&quot;&gt;Xtend&lt;/a&gt;:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;  Scenario: &lt;span class=&quot;nocode&quot;&gt;Searching for Jnario&lt;/span&gt;
     val driver = new HtmlUnitDriver
     val wait = new WebDriverWait(driver, 30)
&lt;/pre&gt;


&lt;p&gt;Now we need to make our &lt;strong&gt;Given&lt;/strong&gt; step executable. We simply use the selenium API to retrieve a webpage via the web driver. Step parameters, such as the URL, can be accessed via the implicit variable &lt;strong&gt;args&lt;/strong&gt;, which is a list of all parameter strings:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;   Given I opened &quot;http://www.google.com&quot;
     driver.get(args.first)
&lt;/pre&gt;


&lt;p&gt;The web search is performed using the driver’s findElement API. Note that in Jnario static members are accessed by &lt;code&gt;::&lt;/code&gt; instead of &lt;code&gt;.&lt;/code&gt; as in Java:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;   When &lt;span class=&quot;nocode&quot;&gt;I search for&lt;/span&gt; &quot;Jnario&quot;
     val searchBox = driver.findElement(By::name(&quot;q&quot;))
     searchBox.sendKeys(args.first)
     searchBox.submit
&lt;/pre&gt;


&lt;p&gt;Finally, we check whether the search results contain the expected string. As it can take a while until the browser returns our search result, we need to define a waiting condition. We use the WebDriverWait, which we declared as a field earlier.&lt;/p&gt;

&lt;p&gt;The nice thing in Jnario is that instead of implementing the wait condition in an anonymous subclass, we can use Xtend’s lambda expressions. A lambda expression is declared within brackets and will be automatically converted into an instance of Function, which is required by WebDriverWait#until. Lambda expressions are one of the features making code written in Jnario/Xtend a lot more readable than plain Java code.&lt;/p&gt;

&lt;p&gt;When the web page is returned on time, we retrieve the content of the webpage and assert that our expected string is contained. The assertion is written using Jnario’s &lt;a href=&quot;http://jnario.org/org/jnario/spec/tests/integration/UsingShouldSpec.html&quot;&gt;should expressions&lt;/a&gt;. Finally, we clean up and close the browser via the web driver:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;   Then the result should contain &quot;Jnario - Executable Specifications for Java&quot;
     wait.until[ findElement(By::id(&quot;resultStats&quot;)) != null ]
     val content = driver.findElement(By::tagName(&quot;body&quot;)).getText() 
     content should contain args.first
     driver.close
&lt;/pre&gt;


&lt;p&gt;That’s all we need to do to make our scenario executable. We can now run it as a normal JUnit test and check whether the Google search really works as expected. Here is the complete definition of our feature:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;package org.jnario.selenium

import org.openqa.selenium.By
import org.openqa.selenium.support.ui.WebDriverWait
import org.openqa.selenium.htmlunit.HtmlUnitDriver

Feature: Searching for web pages via Google

  ...

  Scenario: &lt;span class=&quot;nocode&quot;&gt;Searching for Jnario&lt;/span&gt;
     val driver = new HtmlUnitDriver
     val wait = new WebDriverWait(driver, 30)

   Given I opened &quot;http://www.google.com&quot;
     driver.get(args.first)

   When &lt;span class=&quot;nocode&quot;&gt;I search for&lt;/span&gt; &quot;Jnario&quot;
     val searchBox = driver.findElement(By::name(&quot;q&quot;))
     searchBox.sendKeys(args.first)
     searchBox.submit

   Then the result should contain &quot;Jnario - Executable Specifications for Java&quot;
     wait.until[findElement(By::id(&quot;resultStats&quot;)) != null]
     val content = driver.findElement(By::tagName(&quot;body&quot;)).getText() 
     content should contain args.first
     driver.close
&lt;/pre&gt;


&lt;p&gt;When you think now that your feature is no longer as readable as before, you might be right, but you can quickly change this by pressing &lt;code&gt;Ctrl/Cmd + SHIFT + f&lt;/code&gt; in the editor to make the code magically disappear (and reappear).&lt;/p&gt;

&lt;h2&gt;Adding another Scenario&lt;/h2&gt;

&lt;p&gt;Let’s test whether Google search not only works for Jnario, but also for the Xtend homepage. In Jnario you can reuse existing steps and their implementation in other scenarios. So we can easily add another scenario based on our existing steps. We just change the parameters to search for xtend homepage instead.&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;Feature: &lt;span class=&quot;nocode&quot;&gt;Searching for web pages via Google&lt;/span&gt;

  ...

  Scenario: &lt;span class=&quot;nocode&quot;&gt;Searching for Jnario&lt;/span&gt;

    Given I opened &quot;http://www.google.com&quot; in a browser
    When &lt;span class=&quot;nocode&quot;&gt;I search for &lt;/span&gt;&quot;Jnario&quot;
    Then the result should contain &quot;Jnario - Executable Specifications for Java&quot;
   
  Scenario: &lt;span class=&quot;nocode&quot;&gt;Searching for Xtend&lt;/span&gt;

    Given I opened &quot;http://www.google.com&quot;
    When &lt;span class=&quot;nocode&quot;&gt;I search for &lt;/span&gt;&quot;Xtend Lang&quot;
    Then the result should contain &quot;Xtend - Modernized Java&quot;
&lt;/pre&gt;


&lt;p&gt;The Jnario editor offers code completion via &lt;code&gt;Ctrl + SPACE&lt;/code&gt; showing all available steps. Note how the keyword color varies in steps. It is &lt;strong&gt;green&lt;/strong&gt; if the step has an implementation, &lt;strong&gt;red&lt;/strong&gt; if no step with implementation exists and &lt;strong&gt;grey&lt;/strong&gt; if another step with implementation exists.&lt;/p&gt;

&lt;h2&gt;Using Spec Extensions&lt;/h2&gt;

&lt;p&gt;There is one problem in the implementation of our scenario. We close the browser in our &lt;strong&gt;Then&lt;/strong&gt; step. This makes it impossible to write tests like:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;  Scenario: &lt;span class=&quot;nocode&quot;&gt;Searching for Something&lt;/span&gt;

    Given I opened &quot;http://www.google.com&quot;
    When &lt;span class=&quot;nocode&quot;&gt;I search for &lt;/span&gt;&quot;Something&quot;
    Then the result should contain &quot;Something&quot;
    And the result should contain &quot;Something else&quot;
&lt;/pre&gt;


&lt;p&gt;When we execute the &lt;strong&gt;Then&lt;/strong&gt; step a second time we won’t be able to retrieve the contents of the web page, as the driver is already closed. We need to move the closing of the driver into a separate tear down method. In Jnario this is supported via &lt;a href=&quot;http://jnario.org/org/jnario/feature/tests/integration/SetupTeardownWithFeatureExtensionsFeature.html&quot;&gt;spec extensions&lt;/a&gt;. A spec extension encapsulates common helper method together with setup and tear down logic.&lt;/p&gt;

&lt;p&gt;In our example, we create a new Xtend (or Java) class in which we extend the HtmlUnitDriver:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-xtend&quot;&gt;package org.jnario.selenium

import org.junit.After
import org.openqa.selenium.htmlunit.HtmlUnitDriver

class HtmlUnitDriverExtension extends HtmlUnitDriver {
    
    @After override void close(){
       super.close()
    }

}
&lt;/pre&gt;


&lt;p&gt;We simply override the close method and add the JUnit @After annotation. This way we tell Jnario to execute this method after our scenario is performed. Now, we need to replace the HtmlUnitDriver in our feature with our HtmlUnitDriverExtension and add the additional &lt;strong&gt;extension&lt;/strong&gt; keyword:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;extension HtmlUnitDriverExtension driver = new HtmlUnitDriverExtension
&lt;/pre&gt;


&lt;p&gt;&lt;a href=&quot;http://www.eclipse.org/xtend/documentation.html#extensionMethods&quot;&gt;Extensions&lt;/a&gt; are a Xtend feature which allows extending the behavior of objects without changing their class. In our example, it is now possible to call all &lt;strong&gt;driver&lt;/strong&gt; methods directly without the field name. For example, we can now write:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;val searchBox = findElement(By::name(&quot;q&quot;))
&lt;/pre&gt;


&lt;p&gt;instead of:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;val searchBox = driver.findElement(By::name(&quot;q&quot;))
&lt;/pre&gt;


&lt;p&gt;This makes extension fields a great way to encapsulate testing helpers without adding additional syntactic noise to your tests! Here is our updated scenario:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;package org.jnario.selenium

import org.openqa.selenium.By
import org.openqa.selenium.support.ui.WebDriverWait

Feature: Searching for web pages via Google

  ...

  Scenario: &lt;span class=&quot;nocode&quot;&gt;Searching for Jnario&lt;/span&gt;
     extension HtmlUnitDriverExtension driver = new HtmlUnitDriverExtension
     val wait = new WebDriverWait(driver, 30)

   Given I opened &quot;http://www.google.com&quot;
     get(args.first)

   When &lt;span class=&quot;nocode&quot;&gt;I search for&lt;/span&gt; &quot;Jnario&quot;
     val searchBox = findElement(By::name(&quot;q&quot;))
     searchBox.sendKeys(args.first)
     searchBox.submit

   Then the result should contain &quot;Jnario - Executable Specifications for Java&quot;
     wait.until[findElement(By::id(&quot;resultStats&quot;)) != null]
     val content = findElement(By::tagName(&quot;body&quot;)).getText() 
     content should contain args.first
&lt;/pre&gt;


&lt;h2&gt;Getting things dry&lt;/h2&gt;

&lt;p&gt;Another thing, which could be improved in our feature definition, is that we define the same precondition in both scenarios. This is a duplication, which makes it harder to maintain our features in the future. We can avoid this by using &lt;strong&gt;background scenarios&lt;/strong&gt;, similar to Cucumber. A background scenario defines steps to be executed before each scenario. Using a background, we can rewrite our scenario by moving the given step from both scenarios into a single background scenario:&lt;/p&gt;

&lt;pre class=&quot;prettyprint lang-feature&quot;&gt;package org.jnario.selenium

import org.openqa.selenium.By
import org.openqa.selenium.support.ui.WebDriverWait

Feature: &lt;span class=&quot;nocode&quot;&gt;Searching for web pages via Google&lt;/span&gt;

  ...

  Background:
     extension HtmlUnitDriverExtension  driver = new HtmlUnitDriverExtension
     val wait = new WebDriverWait(driver, 30)
     
   Given I opened &quot;http://www.google.com&quot;
     get(args.first)

  Scenario: &lt;span class=&quot;nocode&quot;&gt;Searching for Jnario&lt;/span&gt;

   When &lt;span class=&quot;nocode&quot;&gt;I search for &lt;/span&gt;&quot;Jnario&quot;
     val searchBox = findElement(By::name(&quot;q&quot;))
     searchBox.sendKeys(args.first)
     searchBox.submit

   Then the result should contain &quot;Jnario - Executable Specifications for Java&quot;
     wait.until[findElement(By::id(&quot;resultStats&quot;)) != null]
     val content = findElement(By::tagName(&quot;body&quot;)).getText() 
     content should contain args.first

  Scenario: Searching for Xtend
     
    When &lt;span class=&quot;nocode&quot;&gt;I search for &lt;/span&gt;&quot;Xtend Lang&quot;
    Then the result should contain &quot;Xtend - Modernized Java&quot;
&lt;/pre&gt;


&lt;h2&gt;Generating a report&lt;/h2&gt;

&lt;p&gt;As we set up our project using maven, we can easily create HTML reports from our spec. The generated reports contain a nicely formatted HTML version of our feature and will also tell us which scenario passed and which failed. These reports are a great way to communicate the current state of a project with the stakeholders.&lt;/p&gt;

&lt;p&gt;&lt;img class=&quot;center&quot; height=&quot;530&quot; src=&quot;http://sebastianbenz.de/images/selenium/failure.png&quot; title=&quot;Jnario Report&quot; width=&quot;624&quot; /&gt;&lt;/p&gt;

&lt;p&gt;First we need to execute our spec via maven:&lt;/p&gt;

&lt;pre&gt;$ mvn clean test
&lt;/pre&gt;


&lt;p&gt;Afterwards we can generate the HTML reports to &lt;strong&gt;target/jnario-doc&lt;/strong&gt; via:&lt;/p&gt;

&lt;pre&gt;$ mvn org.jnario:report:generate
&lt;/pre&gt;


&lt;h2&gt;Summary&lt;/h2&gt;

&lt;p&gt;In this post we have seen how easy it is to write acceptance tests with Jnario. However, Jnario provides a &lt;a href=&quot;http://jnario.org/org/jnario/spec/tests/documentation/IntroducingJnarioSpecsSpec.html&quot;&gt;lot&lt;/a&gt; &lt;a href=&quot;http://jnario.org/org/jnario/suite/documentation/IntroducingJnarioSuitesSpec.html&quot;&gt;more&lt;/a&gt; &lt;a href=&quot;http://jnario.org/org/jnario/spec/tests/integration/UsingShouldSpec.html&quot;&gt;features&lt;/a&gt; than what we have covered in this post. If you want try Jnario or learn more about it, head over to the official page &lt;a href=&quot;http://www.jnario.org&quot;&gt;www.jnario.org&lt;/a&gt;. There is also a &lt;a href=&quot;https://groups.google.com/group/jnario&quot;&gt;mailing list&lt;/a&gt; available for questions and discussions. You should follow me on &lt;a href=&quot;https://twitter.com/#!/sebabenz&quot;&gt;twitter&lt;/a&gt; if you want to stay up-to-date with Jnario.&lt;/p&gt;</description>
	<pubDate>Wed, 22 May 2013 20:13:00 +0000</pubDate>
</item>
<item>
	<title>Dirk Fauth: Eclipse Internationalization Part 2/4 – New Message Extension by Dirk Fauth and Tom Schindl</title>
	<guid isPermaLink="false">http://www.vogella.com/blog/?p=6002</guid>
	<link>http://www.vogella.com/blog/2013/05/22/eclipse-internationalization-part-24-new-message-extension-by-dirk-fauth-and-tom-schindl/</link>
	<description>&lt;p dir=&quot;ltr&quot; id=&quot;docs-internal-guid-33865e8a-ccc8-45dd-0e4a-f3370199cf39&quot;&gt;In my &lt;a href=&quot;http://www.vogella.com/blog/2013/05/03/eclipse-internationalization-part-14-current-situation-by-dirk-fauth/&quot; title=&quot;Eclipse Internationalization Part 1/4 – Current Situation&quot;&gt;last blog&lt;/a&gt; post I explained the current available solutions for translating an Eclipse 4 application and what is wrong with them.&lt;/p&gt;
&lt;p&gt;In this blog post I will show you a new solution for translating your Eclipse 4 application. This one is created as an OSGi service and gets rid of all the disadvantages of the existing solutions. The main idea and implementation was created by &lt;a href=&quot;http://tomsondev.bestsolution.at/&quot; title=&quot;Tomsondev Blog&quot;&gt;Tom Schindl&lt;/a&gt;, while I extended it to the current state, so we are writing this blog post together.&lt;/p&gt;
&lt;p&gt;To use the services you need to install the latest E4 tools into your IDE or at least create a target-platform that contains the location to it. You could for example use the p2 update site for the E4 tools provided by vogella to get the latest version. (see here for more information &lt;a href=&quot;http://www.vogella.com/blog/2013/03/12/eclipse-4-tools-update-sites-available-from-vogella/&quot; id=&quot;docs-internal-guid-33865e8a-ccd5-a32c-769e-b3497d1bdc0e&quot;&gt;http://www.vogella.com/blog/2013/03/12/eclipse-4-tools-update-sites-available-from-vogella/&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;As the constant based solution has several benefits when used in combination with the tooling, e.g. code completion, refactoring and find references, the solution designed by Tom uses a similar approach. The big difference is, that it is not constant but member based. So using that solution is working on an instance of a message class, which means that it can be collected by the garbage collector if it is not referenced anymore and values can be changed at runtime.&lt;/p&gt;
&lt;p&gt;Another advantage over the existing mechanisms is a more technical one. The existing translation mechanism in Eclipse is based on Java 1.4 and has some workaround code to deal with a special use case. What most people are not aware of is that the process on resolving a resource bundle is a little bit different than resolving a key out of a loaded resource bundle. Guess you have a loaded resource bundle for the locale &lt;em&gt;de_DE&lt;/em&gt;, the search order for a key in that resource bundle looks like this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;bundle_de_DE.properties&lt;/li&gt;
&lt;li&gt;bundle_de.properties&lt;/li&gt;
&lt;li&gt;bundle.properties&lt;/li&gt;
&lt;/ol&gt;
&lt;p dir=&quot;ltr&quot; id=&quot;docs-internal-guid-33865e8a-cd7d-016b-1cc3-bef1a2b30fc9&quot;&gt;So it is searching from the most specific to the default bundle for that key. If the default bundle is configured to contain the English translations, if you missed to translate a key to German, the English one will be returned.&lt;/p&gt;
&lt;p&gt;For resolving a resource bundle the process differs slightly with a huge impact. Guess you are running on a system that has the German locale set as default locale. Your application contains only the German and the default resource bundle files as shown above. What would you expect to get for translation if you set the application locale to &lt;em&gt;fr_FR&lt;/em&gt;? Only knowing about the process above, you would expect to get the English translations out of the default resource bundle. But on resolving and loading the resource bundle, the default locale is used as fallback. So the following search order is used to resolve the bundle for &lt;em&gt;fr_FR&lt;/em&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;bundle_fr_FR.properties&lt;/li&gt;
&lt;li&gt;bundle_fr.properties&lt;/li&gt;
&lt;li&gt;bundle_de_DE.properties&lt;/li&gt;
&lt;li&gt;bundle_de.properties&lt;/li&gt;
&lt;li&gt;bundle.properties&lt;/li&gt;
&lt;/ol&gt;
&lt;p dir=&quot;ltr&quot; id=&quot;docs-internal-guid-33865e8a-cd83-5f33-1b2c-5c16fb95dff4&quot;&gt;This means you will get the German translations on a German system if you try to localize your application to &lt;em&gt;fr_FR&lt;/em&gt; and there are no such resource bundle files in your application.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;In Equinox resolving the resource bundle was implemented like resolving keys without taking the default locale as fallback into account. That was reported and fixed a while ago (&lt;a href=&quot;https://bugs.eclipse.org/bugs/show_bug.cgi?id=330602&quot;&gt;https://bugs.eclipse.org/bugs/show_bug.cgi?id=330602&lt;/a&gt;). A technical switch was introduced that allows to specify the &lt;code&gt;equinox.root.locale&lt;/code&gt; as system property. If it is not set it will be treated as en by default. Now if the value for &lt;code&gt;equinox.root.locale&lt;/code&gt; is &lt;em&gt;en&lt;/em&gt; and the locale with language code &lt;em&gt;en&lt;/em&gt; is requested, the default locale is not used as fallback.&lt;/p&gt;
&lt;p&gt;Also the loading of resource bundles out of an OSGi bundle is a bit different because of the fragment support and the classloader per bundle. Using the Java 1.4 API dealing with all of these facts was quite difficult and caused the limitation that only properties based resource bundles are supported.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot; id=&quot;docs-internal-guid-33865e8a-cd84-ac39-7597-4cb578ab3923&quot;&gt;With Java 1.6 the &lt;code&gt;ResourceBundle.Control&lt;/code&gt; class was introduced. It allows you to take control on how resource bundles are loaded, how the candidate locales are determined, e.g. using a fallback locale or not, and how the caching of the loaded resource bundles should be handled. The new message extension is based on Java 1.6 and makes use of this &lt;code&gt;ResourceBundle.Control&lt;/code&gt; to deal with the described issues above in a more convenient way. Using the Java default mechanism instead of the custom workaround also enables the usage of class based resource bundles. The advantage of using class based resource bundles will be explained in the last blog post in this series.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;To use the new message extension you need to add the &lt;code&gt;org.eclipse.e4.tools.services&lt;/code&gt; bundle to the required plugins in your &lt;code&gt;MANIFEST.MF&lt;/code&gt;. This bundle contains the OSGi services that are necessary for the new message extension and will give you access to two new annotations, &lt;code&gt;@Message&lt;/code&gt; and &lt;code&gt;@Translation&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To explain those annotations and their usage we first need to create the &lt;code&gt;Messages&lt;/code&gt; class that will contain our translations.&lt;/p&gt;
&lt;pre class=&quot;programlisting&quot;&gt;public class Messages {
	public String label_message;
}&lt;/pre&gt;
&lt;p dir=&quot;ltr&quot;&gt;Comparing the implementation with the constant based OSGi NLS solution you will notice that&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Messages&lt;/code&gt; is a POJO and does not implement or extend something&lt;/li&gt;
&lt;li&gt;There are no constants but member variables&lt;/li&gt;
&lt;li&gt;There is no static initialization block needed anymore&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now that we have the &lt;code&gt;Messages&lt;/code&gt; class, we need to configure where to get the translation values that should be put into those member variables. As different developers have different opinions on where to put their resource bundles to, the new message extension supports a quite flexible approach to specify where the resource bundle files can be found. When processing the initialization, the mechanism searches for the resource bundle files in the following order:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check for a configuration via &lt;code&gt;@Message&lt;/code&gt; annotation
&lt;pre class=&quot;programlisting&quot;&gt;@Message(contributorURI=”...”)
public class Messages {
	public String label_message;
}&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Check for resource bundle files with the same base name and in the same package as the &lt;code&gt;Messages&lt;/code&gt; class&lt;br /&gt;
&lt;img alt=&quot;NamedMessages&quot; class=&quot;aligncenter size-full wp-image-6012&quot; height=&quot;112&quot; src=&quot;http://www.vogella.com/blog/wp-content/uploads/2013/05/NamedMessages.png&quot; width=&quot;263&quot; /&gt;&lt;/li&gt;
&lt;li&gt;Check for OSGi resource bundles configured in &lt;code&gt;MANIFEST.MF&lt;/code&gt;&lt;br /&gt;
If you placed your resource bundle files in &lt;em&gt;OSGI-INF/l10n&lt;/em&gt; and named in bundle, there is nothing else you have to do&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;@Message annotation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;@Message&lt;/code&gt; annotation is optional and only necessary if you want to configure the location of the resource bundle files or the caching behaviour. To configure the location of the resource bundle files, you need to set the &lt;em&gt;contributorURI&lt;/em&gt; parameter to the annotation. This parameter supports the following location patterns:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;platform:/[plugin|fragment]/[Bundle-SymbolicName]&lt;/code&gt;&lt;br /&gt;
Load the OSGi resource bundle out of the bundle/fragment named [Bundle-SymbolicName]&lt;br /&gt;
For example:&lt;br /&gt;
&lt;code&gt;@Message(contributorURI=&quot;platform:/plugin/com.beone.e4.translation.extension&quot;)&lt;/code&gt;&lt;br /&gt;
will load the OSGi resource bundle that is configured in the &lt;code&gt;MANIFEST.MF&lt;/code&gt; of the &lt;code&gt;com.beone.e4.translation.extension&lt;/code&gt; plugin&lt;/li&gt;
&lt;li&gt;&lt;code&gt;platform:/[plugin|fragment]/[Bundle-SymbolicName]/[Path]/[Basename]&lt;/code&gt;&lt;br /&gt;
Load the resource bundle specified by [Path] and [Basename] out of the bundle/fragment named [Bundle-SymbolicName].&lt;br /&gt;
For example:&lt;br /&gt;
&lt;code&gt;@Message(contributorURI=&quot;platform:/plugin/com.beone.e4.translation/resources/another&quot;)&lt;/code&gt;&lt;br /&gt;
will load the resource bundle that is located in the folder &lt;em&gt;resources/other&lt;/em&gt; in the &lt;code&gt;com.beone.e4.translation&lt;/code&gt; plugin.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bundleclass://[plugin|fragment]/[Fully-Qualified-Classname]&lt;/code&gt;&lt;br /&gt;
Instantiate the class based resourcebundle specified by [Fully-Qualified-Classname] out of the bundle/fragment named [Bundle-SymbolicName]. Note that the class needs to be a subtype of &lt;code&gt;ResourceBundle&lt;/code&gt;.&lt;br /&gt;
For example:&lt;br /&gt;
&lt;code&gt;@Message(contributorURI=&quot;bundleclass://com.beone.e4.translation/com.beone.e4.translation.resources.MockBundle&quot;)&lt;/code&gt;&lt;br /&gt;
will load the class based resource bundle &lt;code&gt;MockBundle&lt;/code&gt; in package &lt;code&gt;com.beone.e4.translation.resources&lt;/code&gt; in the &lt;code&gt;com.beone.e4.translation&lt;/code&gt; plugin.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Using the bundleclass &lt;em&gt;contributorURI&lt;/em&gt; enables you to use class based resource bundles. What’s possible by implementing them will be explained in a later post.&lt;/p&gt;
&lt;p&gt;While the constant based OSGi NLS translation mechanism had no chance to update the translation values at runtime and kept them in memory forever, you can specify the caching behaviour for messages in the new message extension. This is done by the &lt;em&gt;referenceType&lt;/em&gt; parameter of the &lt;code&gt;@Message&lt;/code&gt; annotation.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;If the same translations are requested for injection at several places, for memory efficiency the same instance will be returned. This is achieved by internally caching the created instances as a &lt;code&gt;SoftReference&lt;/code&gt; by default. As they are not hard references, once all requestors are garbage collected (e.g. the parts were closed) the message instance can be garbage collected as well. Using &lt;code&gt;SoftReferences&lt;/code&gt; as default has the advantage that e.g. if a part is closed and opened again within a very short time, the message instance can be reused instead of being garbage collected and newly created. In case the default behavior does not suite your needs the &lt;code&gt;@Message&lt;/code&gt; annotation provides the following caching/garbage collection strategies:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NONE&lt;/code&gt;: The message instance is not cached. Each requestor gets its own instance.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;WEAK&lt;/code&gt;: The message instance is cached as a weak reference. If every requestor was garbage collected, the message instance is also discarded at the next garbage collection cycle.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SOFT&lt;/code&gt;: The message instance is cached as a soft reference. If every requestor was garbage collected, the message instance is not immediately discarded with the next garbage collection cycle, but will retain for a while in memory.&lt;/li&gt;
&lt;/ul&gt;
&lt;p dir=&quot;ltr&quot; id=&quot;docs-internal-guid-33865e8a-cd8e-e960-3dc7-9df1a1b9a3ce&quot;&gt;The strategy to use can be specified by setting the annotation parameter &lt;em&gt;referenceType&lt;/em&gt;. The following for example will set the strategy to &lt;code&gt;ReferenceType.NONE&lt;/code&gt; which means that every requestor will get its own instance of the messages class:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;@Message(referenceType=ReferenceType.NONE)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;@Translation annotation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;After the messages class is created and connected to the resource bundle, it can simply be used by injecting the &lt;code&gt;Messages&lt;/code&gt; instance with the &lt;code&gt;@Translation&lt;/code&gt; annotation:&lt;/p&gt;
&lt;pre class=&quot;programlisting&quot;&gt;@Inject
@Translation
private Messages messages;
...
myLabel.setText(messages.label_message);&lt;/pre&gt;
&lt;p&gt;Compared with the &lt;code&gt;TranslationService&lt;/code&gt; that is already available in Eclipse 4, you are injecting your &lt;code&gt;Messages&lt;/code&gt; instance without the need to know the &lt;em&gt;contributionURI&lt;/em&gt; of the containing bundle or the key of the translation you are requesting.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;@PostConstruct annotation&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;With the latest implementation it is possibility to add methods annotated with &lt;code&gt;@PostConstruct&lt;/code&gt;. Following the dependency injection rules, this method will be executed after the &lt;code&gt;Messages&lt;/code&gt; instance is created. This allows you to use placeholders like with using the constant based &lt;code&gt;NLS.bind()&lt;/code&gt; solution. Guess you have a property that looks like this:&lt;/p&gt;
&lt;pre class=&quot;programlisting&quot;&gt;my.label.message = {0} says {1}&lt;/pre&gt;
&lt;p&gt;You could initialize this property by adding a method annotated with &lt;code&gt;@PostConstruct&lt;/code&gt; to your &lt;code&gt;Messages&lt;/code&gt; class.&lt;/p&gt;
&lt;pre class=&quot;programlisting&quot;&gt;public class Messages {
	public String my_label_message;

	@PostConstruct
	public void format() {
		my_label_message = MessageFormat.format(
			my_label_message, &quot;Dirk&quot;, &quot;Cool&quot;);
	}
}&lt;/pre&gt;
&lt;p&gt;Note that the method annotated with &lt;code&gt;@PostConstruct&lt;/code&gt; in the &lt;code&gt;Messages&lt;/code&gt; class does not support parameters as it doesn’t support dependency injection at that place. This is quite the default behaviour when thinking of &lt;code&gt;@PostConstruct&lt;/code&gt; in the JavaEE context. As &lt;code&gt;@PostConstruct&lt;/code&gt; in Eclipse 4 generally supports dependency injection, we need to mention that in this special case it is not supported.&lt;/p&gt;
&lt;p&gt;A small but personally huge improvement in properties key handling is the handling of the dot as property key separator. Using the constant based solution you need to use a separator that is valid within a Java variable, e.g. the underscore. This is because the dot is not valid as part of a field name and the binding from key to constant is directly without transformation. The new message extension at least supports the dot as key separator within the properties. So the properties can look like you know them from other Java frameworks. Of course you still can’t use it as separator in the fields. But as you can see in the example above, using the dot in the properties file is possible when using the underscore as separator in the Messages field.&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;text-decoration: underline;&quot;&gt;Links:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.vogella.com/blog/2013/05/03/eclipse-internationalization-part-14-current-situation-by-dirk-fauth/&quot; title=&quot;Eclipse Internationalization Part 1/4 – Current Situation&quot;&gt;Eclipse Internationalization Part 1/4 – Current Situation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Eclipse Internationalization Part 2/4 – New Message Extension&lt;/li&gt;
&lt;/ul&gt;</description>
	<pubDate>Wed, 22 May 2013 19:46:01 +0000</pubDate>
</item>
<item>
	<title>Markus Kuppe: Buckminster rmap to p2 (composite) repository metadata</title>
	<guid isPermaLink="false">https://www.lemmster.de/blog/?p=1173</guid>
	<link>http://www.lemmster.de/blog/index.php/2013/05/22/1173</link>
	<description>&lt;div class=&quot;standard&quot;&gt;ECF has been using an &lt;a href=&quot;http://git.eclipse.org/c/ecf/org.eclipse.ecf.git/tree/releng/org.eclipse.ecf.releng.bm/rmap2b3aggr.xsl&quot;&gt;rmap to b3aggr&lt;/a&gt; xslt stylesheet for a while now, and today I needed a similar stylesheet to convert to p2 composite repositories (single sourcing repositories feed from Buckminster to the p2 director). It takes an rmap and spits out composite repository metadata referring to all http:// and ftp:// provider uris in the rmap. For an example check out this &lt;a href=&quot;https://raw.github.com/kuppe/epp.packages/master/features/org.eclipse.epp.allpackages.feature/epp.rmap&quot;&gt;rmap&lt;/a&gt; and the &lt;a href=&quot;http://download.vogella.com/p2/M-MASTER-voclipse/workspace/p2repo/&quot;&gt;generated metadata&lt;/a&gt;. As a generator use&lt;/div&gt;
&lt;pre&gt;&lt;div class=&quot;standard&quot;&gt;xsltproc --stringparam timestamp $((`date +%s * 1000)) --stringparam 
repository file:///a/local/p2/repo/ rmap2compositeRepository.xsl my.rmap&lt;/div&gt;&lt;/pre&gt;
&lt;div class=&quot;standard&quot;&gt;In case anybody else needs it, here is the xslt stylesheet:&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;
&amp;lt;xsl:stylesheet version=&quot;1.0&quot;
    xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;
    xmlns:bm=&quot;http://www.eclipse.org/buckminster/RMap-1.0&quot;&amp;gt;
    &amp;lt;xsl:output method=&quot;xml&quot; indent=&quot;yes&quot; encoding=&quot;UTF-8&quot;/&amp;gt;

    &amp;lt;xsl:strip-space elements=&quot;*&quot;/&amp;gt;

    &amp;lt;!-- overwrite via parameters --&amp;gt;
    &amp;lt;xsl:param name=&quot;repository&quot;&amp;gt;file:///dev/null&amp;lt;/xsl:param&amp;gt;
    &amp;lt;xsl:param name=&quot;title&quot;&amp;gt;vogella Packages Repository&amp;lt;/xsl:param&amp;gt;
    &amp;lt;xsl:param name=&quot;timestamp&quot;&amp;gt;13691573970000&amp;lt;/xsl:param&amp;gt;
    &amp;lt;xsl:param name=&quot;type&quot;&amp;gt;org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository&amp;lt;/xsl:param&amp;gt;

    &amp;lt;xsl:template match=&quot;bm:provider&quot;&amp;gt;
        &amp;lt;!-- only accept public http|ftp repositories --&amp;gt;
        &amp;lt;xsl:if test=&quot;starts-with(bm:uri/@format, 'http://') or starts-with(bm:uri/@format, 'ftp://')&quot;&amp;gt;

                &amp;lt;!-- remove dangling ?importType=binary --&amp;gt;
                &amp;lt;xsl:choose&amp;gt;
                        &amp;lt;xsl:when test=&quot;contains(bm:uri/@format, '?importType=binary')&quot;&amp;gt;
                        	&amp;lt;child location=&quot;{substring-before(bm:uri/@format, '?importType=binary')}&quot;/&amp;gt;
                        &amp;lt;/xsl:when&amp;gt;
                        &amp;lt;xsl:otherwise&amp;gt;
                        	&amp;lt;child location=&quot;{bm:uri/@format}&quot;/&amp;gt;
                        &amp;lt;/xsl:otherwise&amp;gt;
                &amp;lt;/xsl:choose&amp;gt;
        &amp;lt;/xsl:if&amp;gt;
    &amp;lt;/xsl:template&amp;gt;

    &amp;lt;xsl:template match=&quot;/&quot;&amp;gt;

            &amp;lt;repository name='&amp;amp;quot;{$title}&amp;amp;quot;' type='{$type}' version='1.0.0'&amp;gt;

              &amp;lt;properties size='2'&amp;gt;
                &amp;lt;property name='p2.compressed' value='true'/&amp;gt;
                &amp;lt;property name='p2.timestamp' value='{$timestamp}'/&amp;gt;
              &amp;lt;/properties&amp;gt;
              &amp;lt;children&amp;gt;
                &amp;lt;child location='{$repository}'/&amp;gt;
                &amp;lt;!-- match all the child nodes of the template match=/ node --&amp;gt;
                &amp;lt;xsl:apply-templates/&amp;gt;
              &amp;lt;/children&amp;gt;
            &amp;lt;/repository&amp;gt;

    &amp;lt;/xsl:template&amp;gt;

&amp;lt;/xsl:stylesheet&amp;gt;&lt;/pre&gt;
&lt;/div&gt;</description>
	<pubDate>Wed, 22 May 2013 15:50:30 +0000</pubDate>
</item>
<item>
	<title>Pascal Rapicault: Remediation support, goodbye cryptic p2 dependency error message.</title>
	<guid isPermaLink="false">tag:blogger.com,1999:blog-27225531.post-1656459738551465171</guid>
	<link>http://www.rapicorp.com/2013/05/remediation-support-goodbye-cryptic-p2.html</link>
	<description>Thanks to the sponsoring of JBoss, you can now say goodbye to the cryptic dependency error messages. Indeed, starting with Eclipse Kepler, when p2 is not able to complete the requested installation, it proactively searches for alternate ways to help you proceed.This search for alternate solutions is done automatically as soon as p2 realizes that it can't proceed with the installation. No special</description>
	<pubDate>Tue, 21 May 2013 15:28:46 +0000</pubDate>
	<author>noreply@blogger.com (Pascal)</author>
</item>
<item>
	<title>Eclipse Scout: What happened at the Eclipse Stammtisch Zurich</title>
	<guid isPermaLink="false">http://www.bsiag.com/scout/?p=814</guid>
	<link>http://www.bsiag.com/scout/eclipse-stammtisch-zurich-mai-2013/</link>
	<description>&lt;p&gt;Last week we had a great time at the &lt;a href=&quot;http://wiki.eclipse.org/Eclipse_Stammtisch_Zurich_2013_Mai&quot; title=&quot;Eclipse Stammtisch Zurich 2013 Mai - Homepage&quot;&gt;Eclipse Stammtisch Zurich&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot; id=&quot;attachment_815&quot; style=&quot;width: 310px;&quot;&gt;&lt;a href=&quot;http://www.bsiag.com/scout/wp-content/uploads/2013/05/Scout.jpg&quot;&gt;&lt;img alt=&quot;Eclipse Scout Talk&quot; class=&quot;size-medium wp-image-815&quot; height=&quot;225&quot; src=&quot;http://www.bsiag.com/scout/wp-content/uploads/2013/05/Scout-300x225.jpg&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;Eclipse Scout Talk&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;em&gt;Ken Lee&lt;/em&gt; and &lt;em&gt;Matthias Zimmermann&lt;/em&gt; presented &lt;a href=&quot;http://eclipse.org/scout/&quot; title=&quot;Eclipse Scout - Homepage&quot;&gt;Eclipse Scout&lt;/a&gt;. The motto this year: “&lt;em&gt;Write your application once – run on rich, web and mobile&lt;/em&gt;”. Since last year Application written on top of the Eclipse Scout Framework can be rendered in a Browser with &lt;a href=&quot;http://eclipse.org/rap/&quot; title=&quot;Eclipse RAP - Remote Application Platform - Homepage&quot;&gt;Eclipse RAP&lt;/a&gt; (Remote Application Platform). With Kepler this renderer was extended (model transformation, optimized components, optimized theme) to support mobile and tablets. Scout application can be rendered as web applications for those devices.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot; id=&quot;attachment_816&quot; style=&quot;width: 310px;&quot;&gt;&lt;a href=&quot;http://www.bsiag.com/scout/wp-content/uploads/2013/05/Xtext_Orion.jpg&quot;&gt;&lt;img alt=&quot;Xtext meets Orion Talk&quot; class=&quot;size-medium wp-image-816&quot; height=&quot;225&quot; src=&quot;http://www.bsiag.com/scout/wp-content/uploads/2013/05/Xtext_Orion-300x225.jpg&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;Xtext meets Orion Talk&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;em&gt;Holger Schill&lt;/em&gt; demonstrated his prototype that allows editing &lt;a href=&quot;http://www.eclipse.org/Xtext/&quot; title=&quot;Xtext - Homepage&quot;&gt;Xtext&lt;/a&gt; based DSL in web editors. It is based on &lt;a href=&quot;http://www.eclipse.org/orion/&quot; title=&quot;Orion - Homepage&quot;&gt;Orion&lt;/a&gt; (with some modifications) and it uses some help of an Eclipse IDE running as a server (it calculates the editor behavior: quick tip, validations…). It was a really interesting talk, only one slide and a big demo.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot; id=&quot;attachment_817&quot; style=&quot;width: 310px;&quot;&gt;&lt;a href=&quot;http://www.bsiag.com/scout/wp-content/uploads/2013/05/Orion.jpg&quot;&gt;&lt;img alt=&quot;Eclipse Orion Talk&quot; class=&quot;size-medium wp-image-817&quot; height=&quot;225&quot; src=&quot;http://www.bsiag.com/scout/wp-content/uploads/2013/05/Orion-300x225.jpg&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;Eclipse Orion Talk&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;http://www.eclipse.org/orion/&quot; title=&quot;Orion - Homepage&quot;&gt;Eclipse Orion&lt;/a&gt;: “&lt;em&gt;It is not Eclipse in the browser; it is a new editor in the web (using the browser as a platform)&lt;/em&gt;”. That is what &lt;em&gt;Mike Milinkovich&lt;/em&gt; explained during its talk. The demonstration was really impressive. The primary targeted programming languages are coming from the web (html, javascript, css…). It is really impressive, in comparison to the editor providing only syntax highlighting. You can try it online on &lt;a href=&quot;https://orionhub.org&quot; title=&quot;OrionHub&quot;&gt;orionhub&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;wp-caption alignnone&quot; id=&quot;attachment_818&quot; style=&quot;width: 310px;&quot;&gt;&lt;a href=&quot;http://www.bsiag.com/scout/wp-content/uploads/2013/05/m4m.jpg&quot;&gt;&lt;img alt=&quot;Measure for Measure Talk&quot; class=&quot;size-medium wp-image-818&quot; height=&quot;225&quot; src=&quot;http://www.bsiag.com/scout/wp-content/uploads/2013/05/m4m-300x225.jpg&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;p class=&quot;wp-caption-text&quot;&gt;Measure for Measure Talk&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;The presentation of &lt;em&gt;Werner Keil&lt;/em&gt; was about &lt;a href=&quot;http://www.eclipse.org/uomo/&quot; title=&quot;Eclipse UOMo - Homepage&quot;&gt;Eclipse UOMo&lt;/a&gt;, a project that ease the correct use of units in a Java project. This is particularly useful when different system communicate which each other. As illustration Werner choose the Shakespeare quote “&lt;em&gt;Say what you will, my false outweighs your true&lt;/em&gt;”. Indeed, when not properly handled a system might define 32 liters, where another understands 32 gallons.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://wiki.eclipse.org/Eclipse_DemoCamps_Kepler_2013/Zurich&quot;&gt;&lt;img alt=&quot;Democamp Zurich&quot; class=&quot;size-full wp-image-819&quot; height=&quot;60&quot; src=&quot;http://www.bsiag.com/scout/wp-content/uploads/2013/05/Democamp_zurich.png&quot; width=&quot;194&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We will be happy to meet the Eclipse Community in Zurich for the &lt;a href=&quot;http://wiki.eclipse.org/Eclipse_DemoCamps_Kepler_2013/Zurich&quot; title=&quot;Eclipse Kepler Democamp - June 2013&quot;&gt;Kepler Democamp&lt;/a&gt;. It will take place on 27th June at the ETH main building. &lt;/p&gt;
&lt;p&gt;Meet the &lt;a href=&quot;http://www.bsiag.com/en/technology/eclipse-scout.html&quot; title=&quot;Eclipse Scout Technology&quot;&gt;Eclipse Scout team&lt;/a&gt; at the following &lt;a href=&quot;http://www.bsiag.com/en/marketing-events/technology-events.html&quot; title=&quot;Eclipse Scout events&quot;&gt;other events&lt;/a&gt;.&lt;/p&gt;</description>
	<pubDate>Tue, 21 May 2013 10:19:04 +0000</pubDate>
</item>
<item>
	<title>Thomas Kratz: Consuming emf bundles from p2 with maven : b3</title>
	<guid isPermaLink="false">tag:blogger.com,1999:blog-4243137685413731189.post-1239665928114404028</guid>
	<link>http://thomaskratz.blogspot.com/2013/04/consuming-emf-bundles-from-p2-with.html</link>
	<description>Some of the eclipse libraries are not so thightly bound to OSGi and lately I wanted to use EMF in a grails project. It came to me that there are no current maven artifacts available for EMF, so I had to roll my own.&lt;br /&gt;&lt;br /&gt;Asking stackoverflow, I first tried to re-jar the bundles with tycho, but that gave me all the OSGI-deps in one jar, what wasn't what I was looking for. After reding through some discussions around maven and p2 in the eclipse bugzilla, I noticed that b3 has the capability to mirror a p2 repository in a maven compliant layout.&lt;br /&gt;&lt;br /&gt;As I wanted to use the xsd to ecore converter I created a aggregation for the xsd sdk&lt;br /&gt;notice the maven config at the end of the aggregator tag. &lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://gist.github.com/eiswind/5381710&quot;&gt;https://gist.github.com/eiswind/5381710&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then I uploaded it to google drive, so that I can consume the repo from heroku build. One major drawback is, that the source bundles are not maven conformant, so that attaching them automagically won't work.</description>
	<pubDate>Tue, 21 May 2013 09:43:34 +0000</pubDate>
	<author>noreply@blogger.com (Thomas Kratz)</author>
</item>
<item>
	<title>Thomas Kratz: Building a custom RAP Widget based on Select2</title>
	<guid isPermaLink="false">tag:blogger.com,1999:blog-4243137685413731189.post-7724289691263761783</guid>
	<link>http://thomaskratz.blogspot.com/2013/05/building-custom-rap-widget-based-on.html</link>
	<description>This weekend a started to play aorund with new new RAP API introduced in 2.0. It really looks promising.&lt;br /&gt;&lt;br /&gt;I started off with the CKEditor Example and created a combo-replacement based on Select2.js. By the way I had more a fight with the select2 api (that I didn't know) than with the rap api thats quite straightforward. I could answer nearly all of my questions from the source. &lt;br /&gt;&lt;br /&gt;Here's the example for those who want to try: &lt;br /&gt;&lt;br /&gt;It supports markup and (what I always miss on the standard combo) it has &quot;clear selection&quot;. When you create it with SWT.MULTI it supports the cute Multiselect feature of select2. &lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;https://gist.github.com/eiswind/5611873&quot;&gt;https://gist.github.com/eiswind/5611873&lt;/a&gt; java backend&lt;br /&gt;&lt;a href=&quot;https://gist.github.com/eiswind/5611866&quot;&gt;https://gist.github.com/eiswind/5611866&lt;/a&gt; js client</description>
	<pubDate>Tue, 21 May 2013 09:42:28 +0000</pubDate>
	<author>noreply@blogger.com (Thomas Kratz)</author>
</item>
<item>
	<title>Maximilian Kögel: EMF Dos and Don´ts #10</title>
	<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=15800</guid>
	<link>http://eclipsesource.com/blogs/2013/05/21/emf-dos-and-don%c2%b4ts-10/</link>
	<description>&lt;p dir=&quot;ltr&quot;&gt;EMF is a very powerful framework and with power comes…responsibility. You can achieve great things with a minimum of effort using EMF, but if something goes wrong, you can also spend hours trying to find out why. This blog post is part of a &lt;a href=&quot;http://eclipsesource.com/blogs/2013/02/26/emf-do%C2%B4s-and-don%C2%B4ts/&quot;&gt;series&lt;/a&gt; on things you should do and things you should not do when using EMF. You can use the &lt;a href=&quot;http://eclipsesource.com/blogs/2013/02/26/emf-do%C2%B4s-and-don%C2%B4ts/&quot;&gt;link to the series pilot&lt;/a&gt; to navigate to the start and the link below to navigate to the next blog once it is published.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;EMF Dos #10: Use EMF ComposedAdapterFactory&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In my &lt;a href=&quot;http://eclipsesource.com/blogs/2013/05/16/emf-dos-and-don%C2%B4ts-9/&quot;&gt;previous blog post&lt;/a&gt;, I discussed AdapterFactoryLabelProvider and AdapterFactoryContentProvider, which can be used to provide labels and children for your entities in viewers. Both require an AdapterFactory in their constructors that will be used to retrieve the actual ItemProviders and their entity-specific implementation.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;If you pass in the AdapterFactory of a specific model, the provider will only be able to provide labels for entities of the given model. However, viewers often need to display entities of multiple models. Of course, there is a solution to this with EMF: ComposedAdapterFactory.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;A ComposedAdapterFactory is a composition of AdapterFactories, as the name implies. You can construct it with a collection of AdapterFactories, and it will delegate calls to adapt() to the resepective AdapterFactory based on the entity type. If you want to display multiple models in one viewer, you just combine all the models’ AdapterFactories into one ComposedAdapterFactory and pass it to the AdapterFactoryLabelProvider and AdapterFactoryContentProvider.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;If you do not want to restrict your viewer to specific models but want to use all models available in your current target platform, you can pass in ComposedAdapterFactory.Descriptor.Registry.INSTANCE, which is the registry of all available AdapterFactories. By default, the  AdapterFactory of a generated Edit-Plugin is registered via the org.eclipse.emf.edit.itemProviderAdapterFactories extension point and thereby added to the aforementioned registry.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;If the AdapterFactoryLabelProvider/AdapterFactoryContentProvider and the ComposedAdapterFactory are based on the registry, your viewers can be fully decoupled from the actual models they display while still providing customized icons, labels and content.&lt;/p&gt;
&lt;p&gt;Stay tuned for more Dos and Don´ts in my next blog!&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;display: inline-block;&quot;&gt;&lt;a href=&quot;https://twitter.com/intent/tweet?source=webclient&amp;amp;text=EMF+Dos+and+Don%C2%B4ts+%2310&amp;amp;via=eclipsesource&amp;amp;url=http://eclipsesource.com/blogs/2013/05/21/emf-dos-and-don%c2%b4ts-10/&quot; style=&quot;margin-right: 5px;&quot; target=&quot;_blank&quot; title=&quot;Share on Twitter&quot;&gt;&lt;img alt=&quot;Twitter&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png&quot; title=&quot;Twitter&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/05/21/emf-dos-and-don%c2%b4ts-10/&quot; style=&quot;margin-right: 5px;&quot; target=&quot;_blank&quot; title=&quot;+1&quot;&gt;&lt;img alt=&quot;Google+&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png&quot; title=&quot;Google+&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/05/21/emf-dos-and-don%c2%b4ts-10/&quot; style=&quot;margin-right: 5px;&quot; target=&quot;_blank&quot; title=&quot;Share on LinkedIn&quot;&gt;&lt;img alt=&quot;LinkedIn&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png&quot; title=&quot;LinkedIn&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/05/21/emf-dos-and-don%c2%b4ts-10/&amp;amp;t=EMF+Dos+and+Don%C2%B4ts+%2310&quot; style=&quot;margin-right: 5px;&quot; target=&quot;_blank&quot; title=&quot;Facebook&quot;&gt;&lt;img alt=&quot;Facebook&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png&quot; title=&quot;Facebook&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href=&quot;http://eclipsesource.com/blogs/2013/05/21/emf-dos-and-don%c2%b4ts-10/#comments&quot;&gt;2 Comments&lt;/a&gt;. Tagged with &lt;a href=&quot;http://eclipsesource.com/blogs/tag/eclipse/&quot; title=&quot;eclipse Tag&quot;&gt;eclipse&lt;/a&gt;, &lt;a href=&quot;http://eclipsesource.com/blogs/tag/emf/&quot; title=&quot;emf Tag&quot;&gt;emf&lt;/a&gt;, &lt;a href=&quot;http://eclipsesource.com/blogs/tag/eclipse/&quot; title=&quot;eclipse Tag&quot;&gt;eclipse&lt;/a&gt;, &lt;a href=&quot;http://eclipsesource.com/blogs/tag/emf/&quot; title=&quot;emf Tag&quot;&gt;emf&lt;/a&gt;&lt;p&gt;&lt;/p&gt;</description>
	<pubDate>Tue, 21 May 2013 08:18:56 +0000</pubDate>
</item>
<item>
	<title>OSGi Alliance: RFP 154 Network Interface Information Service now publicly available</title>
	<guid isPermaLink="false">tag:blogger.com,1999:blog-18772002.post-3672904755862333770</guid>
	<link>http://blog.osgi.org/2013/05/rfp-154-network-interface-information.html</link>
	<description>Java standard APIs (i.e. java.net.NetworkInterface, java.net.InetAddress)provide functions that allow IP network interface information, such as the IPaddress and MAC address to be obtained.However, the bundle that wants to get network interface information has tomonitor whether the information has changed or not for a certain period oftime. Changes in network interface can be pushed to the</description>
	<pubDate>Tue, 21 May 2013 08:03:02 +0000</pubDate>
	<author>noreply@blogger.com (Kai Hackbarth)</author>
</item>
<item>
	<title>Jan Kohnlein: Another Xtend and JavaFX Story</title>
	<guid isPermaLink="false">tag:blogger.com,1999:blog-1495223311988358528.post-2390339904901538583</guid>
	<link>http://koehnlein.blogspot.com/2013/05/another-xtend-and-javafx-story.html</link>
	<description>For my spare time &lt;a href=&quot;http://www.oracle.com/technetwork/java/javafx/overview/index.html&quot;&gt;JavaFX&lt;/a&gt; project, I was looking for a way to export a scene to &lt;a href=&quot;http://www.w3.org/Graphics/SVG/&quot;&gt;SVG&lt;/a&gt;. Googling a bit I stumbled over a &lt;a href=&quot;http://harmoniccode.blogspot.de/2012/11/shapes-shapes-shapes.html&quot;&gt;blog entry by Gerrit Grunwald&lt;/a&gt; who implemented an &lt;a href=&quot;https://github.com/JFXtras/jfxtras-labs/blob/2.2/src/main/java/jfxtras/labs/util/ShapeConverter.java&quot;&gt;JavaFX shape to SVG path converter class&lt;/a&gt; for the &lt;a href=&quot;https://github.com/JFXtras&quot;&gt;JFXtras&lt;/a&gt; project. It looked good so I decided to give it a try. &lt;br /&gt;&lt;h3&gt; &lt;/h3&gt;&lt;h3&gt;Java to Xtend&lt;/h3&gt;The class is of course written in Java. Even though there is no technical reason - Java and &lt;a href=&quot;http://www.xtend-lang.org/&quot;&gt;Xtend&lt;/a&gt; classes can coexist in the same project without any problems - I wanted to convert it to &lt;a href=&quot;http://www.xtend-lang.org/&quot;&gt;Xtend&lt;/a&gt; as well. I am a lazy guy. Luckily &lt;a href=&quot;https://groups.google.com/forum/?fromgroups#!topic/xtend-lang/6BRrZRVkq6s&quot;&gt;Krzysztof Rzymkowski had recently posted&lt;/a&gt; on the &lt;a href=&quot;https://groups.google.com/forum/?fromgroups#!forum/xtend-lang&quot;&gt;Xtend group&lt;/a&gt; that he had started to implement a &lt;a href=&quot;https://github.com/rzymek/java2xtend&quot;&gt;Java to Xtend converter&lt;/a&gt;. It even has a &lt;a href=&quot;http://www.j2x.cloudbees.net/&quot;&gt;web interface&lt;/a&gt;, and except for one slight issue with a &lt;code&gt;for&lt;/code&gt;-loop it worked like a charm. Great work, Krzysztof!&lt;br /&gt;&lt;br /&gt;Of course the resulting code is pretty Java-like, so I wanted to improve on it using more of the cool Xtend features. I found quite a few spots to do so, reducing the amount of code significantly and enhancing readability a lot. The remainder of this post is about this ongoing love of JavaFX and Xtend. The complete source code will likely be made open-source soon.&lt;br /&gt;&lt;h3&gt; &lt;/h3&gt;&lt;h3&gt;Dispatch Methods&lt;/h3&gt;The class starts with a method that only contains an &lt;code class=&quot;prettyprint lang-java&quot;&gt;instanceof&lt;/code&gt;-cascade to delegate to the conversion method for the specific subclass of &lt;code&gt;Shape&lt;/code&gt; the parameter has:&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;public static String shapeToSvgString(final Shape SHAPE) {&lt;br /&gt;   final StringBuilder fxPath = new StringBuilder();&lt;br /&gt;   if (Line.class.equals(SHAPE.getClass())) {&lt;br /&gt;      fxPath.append(convertLine((Line) SHAPE));&lt;br /&gt;   } else if (Arc.class.equals(SHAPE.getClass())) { &lt;br /&gt;      fxPath.append(convertArc((Arc) SHAPE)); &lt;br /&gt;   } else if (QuadCurve.class.equals(SHAPE.getClass())) {&lt;br /&gt;      fxPath.append(convertQuadCurve((QuadCurve) SHAPE));&lt;br /&gt;   } ... &lt;/pre&gt;In Xtend I can use &lt;a href=&quot;http://www.eclipse.org/xtend/documentation.html#polymorphicDispatch&quot;&gt;dispatch methods&lt;/a&gt; to realize this: They must have the same method and number of parameters, but different parameter types. The Xtend compiler then generates the dispatcher method with the &lt;code class=&quot;prettyprint lang-java&quot;&gt;instanceof&lt;/code&gt;-cascade automatically. So renaming the delegate methods and marking them as &lt;code class=&quot;prettyprint lang-xtend&quot;&gt;dispatch&lt;/code&gt; made the dispatcher method obsolete. &lt;br /&gt;&lt;pre class=&quot;prettyprint lang-xtend&quot;&gt;def dispatch String toSvgString(Line line) ...&lt;br /&gt;def dispatch String toSvgString(Arc arc) ...&lt;br /&gt;def dispatch String toSvgString(QuadCurve quadCurve) ...&lt;br /&gt;&lt;/pre&gt;Tip: If you want to delegate from one dispatch case to another, the  original methods are available with an underscore preceeding their name.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Templates&lt;/h3&gt;An SVG path is kind of a cryptic string. In the Java code it is assembled using a &lt;code&gt;StringBuilder&lt;/code&gt;, e.g.&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;final StringBuilder fxPath = new StringBuilder();&lt;br /&gt;fxPath.append(&quot;M &quot;).append(CENTER_X).append(&quot; &quot;)&lt;br /&gt;   .append(CENTER_Y - RADIUS).append(&quot; &quot;);&lt;br /&gt;fxPath.append(&quot;C &quot;)&lt;br /&gt;   .append(CENTER_X + CONTROL_DISTANCE)&lt;br /&gt;   .append(&quot; &quot;).append(CENTER_Y - RADIUS).append(&quot; &quot;)&lt;br /&gt;   .append(CENTER_X + RADIUS).append(&quot; &quot;)&lt;br /&gt;   .append(CENTER_Y - CONTROL_DISTANCE)&lt;br /&gt;   .append(&quot; &quot;)&lt;br /&gt;   .append(CENTER_X + RADIUS).append(&quot; &quot;)&lt;br /&gt;   .append(CENTER_Y).append(&quot; &quot;);&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;That's the best you can do with Java. In Xtend we have &lt;a href=&quot;http://www.eclipse.org/xtend/documentation.html#templates&quot;&gt;template expressions&lt;/a&gt; - multiline strings which can be interrupted with values from expressions. Even &lt;code class=&quot;prettyprint lang-xtend&quot;&gt;IF&lt;/code&gt;-conditions and &lt;code class=&quot;prettyprint lang-xtend&quot;&gt;FOR&lt;/code&gt;-loops are supported. With carefully chosen regular expressions for find/replace and some manual fine-tuning the above becomes nicely readable&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-xtend&quot;&gt;'''M «centerX» «centerY - radius»&lt;br /&gt;   C «centerX + controlDistance» «centerY - radius» &lt;br /&gt;   «centerX + radius» «centerY - controlDistance» &lt;br /&gt;   «centerX + radius» «centerY»&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;h3&gt;Switch Expression&lt;/h3&gt;I found another finer-grained &lt;code class=&quot;prettyprint lang-java&quot;&gt;instanceof&lt;/code&gt;-cascade in the &lt;code&gt;convertPath&lt;/code&gt; method:&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-java&quot;&gt;final StringBuilder fxPath = new StringBuilder();&lt;br /&gt;for (PathElement element : PATH.getElements()) {&lt;br /&gt;   if (MoveTo.class.equals(element.getClass())) {&lt;br /&gt;      fxPath.append(&quot;M &quot;)&lt;br /&gt;         .append(((MoveTo) element).getX()).append(&quot; &quot;)&lt;br /&gt;         .append(((MoveTo) element).getY()).append(&quot; &quot;);&lt;br /&gt;   } else if (LineTo.class.equals(element.getClass())) {&lt;br /&gt;      fxPath.append(&quot;L &quot;)&lt;br /&gt;         .append(((LineTo) element).getX()).append(&quot; &quot;)&lt;br /&gt;         .append(((LineTo) element).getY()).append(&quot; &quot;);&lt;br /&gt;   } else if (CubicCurveTo.class.equals(element.getClass())) { &lt;br /&gt;      fxPath.append(&quot;C &quot;)&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;As the bodies of the &lt;code class=&quot;prettyprint lang-java&quot;&gt;if&lt;/code&gt;-statements are so simple, I decided to use Xtend's &lt;a href=&quot;http://www.eclipse.org/xtend/documentation.html#switchExpression&quot;&gt;switch&lt;/a&gt; instead. It allows to use type guards for the cases and automatically cast the switch variable to that type inside the case's body: &lt;br /&gt;&lt;pre class=&quot;prettyprint lang-xtend&quot;&gt;val it = new StringBuilder&lt;br /&gt;for (element : path.elements) {&lt;br /&gt;   switch element {&lt;br /&gt;      MoveTo: append('''M «element.x» «element.y» ''')&lt;br /&gt;      LineTo: append('''L «element.x» «element.y» ''')&lt;br /&gt;      CubicCurveTo: append('''C «element.controlX1»...&lt;br /&gt;&lt;/pre&gt;I could further use the operator &lt;code class=&quot;prettyprint lang-xtend&quot;&gt;=&amp;gt;&lt;/code&gt; instead of the Builder class and the operator &lt;code class=&quot;prettyprint lang-xtend&quot;&gt;&amp;lt;=&amp;gt;&lt;/code&gt; replacing &lt;code class=&quot;prettyprint lang-java&quot;&gt;Double.compare&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Extension Import (Client Side)&lt;/h3&gt;From a client side, the &lt;code&gt;shapeToSvgString&lt;/code&gt; method is a utility method for &lt;code&gt;Shapes&lt;/code&gt;. In Xtend, you can import such methods using a &lt;a href=&quot;http://www.eclipse.org/xtend/documentation.html#extensionImports&quot;&gt;static extension import&lt;/a&gt;. That makes them callable in extension syntax, as if the method was defined in the class of the first parameter. To further improve readability, I renamed the methods to &lt;code&gt;toSvgString&lt;/code&gt; such that I can now write&lt;br /&gt;&lt;pre class=&quot;prettyprint lang-xtend&quot;&gt;import static extension ...ShapeConverter.*&lt;br /&gt;... &lt;br /&gt;new Rectangle.toSvgString&lt;/pre&gt;</description>
	<pubDate>Mon, 20 May 2013 21:03:41 +0000</pubDate>
	<author>noreply@blogger.com (Jan Köhnlein)</author>
</item>
<item>
	<title>Francis Upton: Moving to a Mac</title>
	<guid isPermaLink="false">http://francisu.wordpress.com/?p=81</guid>
	<link>http://francisu.wordpress.com/2013/05/20/moving-to-a-mac/</link>
	<description>&lt;p&gt;With my new gig at &lt;a href=&quot;http://talend.com&quot;&gt;Talend&lt;/a&gt; I have requested a MacBook Pro as a company computer, thinking that since I’m now an architect I will have to do more writing and (god forbid) slides. Of course I will continue to develop software, both for the company and in my open source work. For years, my preferred development platform has been Unix (shows how old I am, I really mean Unix) or Linux. And I have had to work on all three of Windows, Linux and the Mac to test my software. Though I had a Mac, I did not work on it very much. Thanks to Eclipse things just worked there pretty well, I only had a few Mac-specific issues.&lt;/p&gt;
&lt;p&gt;So I started to move everything to the Mac and I was shocked at how good it was. Really just good. Everything just feels better than the Ubuntu GUI that I was using (Gnome 3 — I just could not deal with Unity). I spent the money and got the Thunderbolt display and it’s just amazing, so big and clear, and it is essentially a docking station. Everything works fine with my &lt;a href=&quot;http://www.kinesis-ergo.com/advantage.htm&quot;&gt;odd keyboard&lt;/a&gt; and &lt;a href=&quot;http://www.aerobicmouse.com/&quot;&gt;mouse&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Unfortunately, there is an &lt;a href=&quot;https://bugs.eclipse.org/bugs/show_bug.cgi?id=301330&quot;&gt;Eclipse SWT issue (it looks like)&lt;/a&gt; which is preventing me from running all 3000 or so of the data transformation unit tests on the Mac, so I have spent a couple of days working on characterizing it, and the thing that I found really shocking about the Mac was &lt;a href=&quot;http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Introduction/Introduction.html&quot;&gt;Instruments&lt;/a&gt;. I could get a ton of profiling information from a running program with an amazing GUI with no effort. By combining this with JProfiler, I should be able to get what I need to characterize (and even possibly fix) this leak problem.&lt;/p&gt;
&lt;p&gt;I have never considered having Windows as my daily machine, and now that I have had the Mac, I’m never going back. It’s just that good.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/francisu.wordpress.com/81/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/francisu.wordpress.com/81/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=francisu.wordpress.com&amp;amp;blog=21758652&amp;amp;post=81&amp;amp;subd=francisu&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</description>
	<pubDate>Mon, 20 May 2013 06:50:24 +0000</pubDate>
</item>
<item>
	<title>Francis Upton: Now at Talend</title>
	<guid isPermaLink="false">http://francisu.wordpress.com/?p=68</guid>
	<link>http://francisu.wordpress.com/2013/05/20/now-at-talend/</link>
	<description>&lt;p&gt;After many years of leading Oakland Software to develop really good data transformation technology, I have moved to a new phase, having &lt;a href=&quot;http://online.wsj.com/article/PR-CO-20130516-907708.html?mod=googlenews_wsj&quot; target=&quot;_blank&quot;&gt;sold these assets to Talend&lt;/a&gt;. A little while ago, I joined Talend as a Senior Architect responsible for data transformation as well as other cross product issues and I’m very excited to be part of this team of extremely bright and talented folks.&lt;/p&gt;
&lt;p&gt;For quite a while now the Oakland Data Transformer has worked well with the Talend ESB runtime technologies, and now that it’s part of Talend we will work on integration at the Talend Open Studio level for a future Talend release. You will hear more about that as the work progresses.&lt;/p&gt;
&lt;p&gt;I am very grateful to the open source community, mostly to my friends at Eclipse on which my product is based. It would not have been possible to make such a high functionality and robust product without the extensive infrastructure provided by Eclipse to do such things. I think however that the most important part of Eclipse is the culture. It’s a culture of openness, mutual respect, and encouragement. People are encouraged to be nice, helpful, and not at all arrogant and this is the case with everyone I have worked with there over the years. It’s been an amazing experience being part of it and I hope to continue my small contributions to Eclipse.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/francisu.wordpress.com/68/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/francisu.wordpress.com/68/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=francisu.wordpress.com&amp;amp;blog=21758652&amp;amp;post=68&amp;amp;subd=francisu&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</description>
	<pubDate>Mon, 20 May 2013 06:28:56 +0000</pubDate>
</item>
<item>
	<title>Francis Upton: Jenkins EC2 work</title>
	<guid isPermaLink="false">http://francisu.wordpress.com/?p=64</guid>
	<link>http://francisu.wordpress.com/2013/05/20/jenkins-ec2-work/</link>
	<description>&lt;p&gt;About a year ago, I have gotten involved pretty extensively in the &lt;a href=&quot;https://wiki.jenkins-ci.org/display/JENKINS/Amazon+EC2+Plugin&quot; target=&quot;_blank&quot; title=&quot;Jenkins EC2 Plugin&quot;&gt;Jenkins EC2 plugin&lt;/a&gt; where I’m now the maintainer. This was motivated by wanting to move my company’s (Oakland Software — now mostly part of &lt;a href=&quot;http://talend.com&quot; target=&quot;_blank&quot;&gt;Talend&lt;/a&gt;) build process to EC2 and finding out that it was simply not possible unless some significant work was done on the plugin. Seeing that the plugin was missing an active maintainer, I requested the responsibility (which was quickly granted as it the custom in Jenkins).&lt;/p&gt;
&lt;p&gt;I have done 3 major releases in the last year with both contributions originated by me and from many members of the community adding significant features like:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Support stopping instead of terminating instances&lt;/li&gt;
&lt;li&gt;Allow the use of EC2 spot instances&lt;/li&gt;
&lt;li&gt;Proper support for multiple clouds&lt;/li&gt;
&lt;li&gt;Greatly increase the accuracy and reliability of starting and stopping instances and adhering to limits&lt;/li&gt;
&lt;li&gt;Many bug fixes&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I remain active with this project and working closely with several members of the Jenkins community to improve it. With these improvements the plugin has become more popular gaining nearly 200 new installations in the past year.&lt;/p&gt;
&lt;p&gt;In addition to coordinating and helping with contributions, I would like to start a conversation about looking the new &lt;a href=&quot;https://cloud.google.com/products/compute-engine&quot; target=&quot;_blank&quot;&gt;Google Compute Engine&lt;/a&gt; service, which is similar to EC2. We should be able to leverage what we have learned in the EC2 plugin and to the refactoring necessary to cleanly support the Google service in addition to Amazon’s. Ideas and contributions are welcome.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/francisu.wordpress.com/64/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/francisu.wordpress.com/64/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=francisu.wordpress.com&amp;amp;blog=21758652&amp;amp;post=64&amp;amp;subd=francisu&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</description>
	<pubDate>Mon, 20 May 2013 06:10:03 +0000</pubDate>
</item>
<item>
	<title>Karsten Thoms: Remove “Build path specifies execution environment…” warnings from Problems View</title>
	<guid isPermaLink="false">http://kthoms.wordpress.com/?p=522</guid>
	<link>http://kthoms.wordpress.com/2013/05/17/remove-build-path-specifies-execution-environment-warnings-from-problems-view/</link>
	<description>&lt;p&gt;I have often workspaces with projects which specify Java 1.5 as minimal execution environment. On my machine there is no JDK 1.5 installed, and it turns out that getting one for Mac OSX Mountain Lion is not trivial. Actually I don’t need a JDK 1.5, since the standard 1.6 JDK is compatible. However, this raises in the workspace these annoying warnings.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://kthoms.files.wordpress.com/2013/05/screenshot-2013-05-17-um-10-32-31.png&quot;&gt;&lt;img alt=&quot;screenshot 2013-05-17 um 10.32.31&quot; class=&quot;alignnone size-large wp-image-523&quot; height=&quot;18&quot; src=&quot;http://kthoms.files.wordpress.com/2013/05/screenshot-2013-05-17-um-10-32-31.png?w=802&amp;amp;h=18&quot; width=&quot;802&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In the Execution Environments setting it is possible to mark the Java 1.6 installation as compatible to the J2SE-1.5 Execution Environment:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://kthoms.files.wordpress.com/2013/05/screenshot-2013-05-17-um-10-52-311.png&quot;&gt;&lt;img alt=&quot;screenshot 2013-05-17 um 10.52.31&quot; class=&quot;alignnone size-large wp-image-528&quot; height=&quot;471&quot; src=&quot;http://kthoms.files.wordpress.com/2013/05/screenshot-2013-05-17-um-10-52-311.png?w=623&amp;amp;h=471&quot; width=&quot;623&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Although the JDK 1.6 is marked compatible now, it is not “strictly compatible”, so the warning message remains.&lt;/p&gt;
&lt;p&gt;Next you could try to disable the warning message. There is a setting for this in the preference dialog &lt;em&gt;Java/Compiler/Building&lt;/em&gt;:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://kthoms.files.wordpress.com/2013/05/screenshot-2013-05-17-um-10-35-17.png&quot;&gt;&lt;img alt=&quot;screenshot 2013-05-17 um 10.35.17&quot; class=&quot;alignnone size-large wp-image-529&quot; height=&quot;501&quot; src=&quot;http://kthoms.files.wordpress.com/2013/05/screenshot-2013-05-17-um-10-35-17.png?w=622&amp;amp;h=501&quot; width=&quot;622&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;After changing the setting you are asked to rebuild the projects. But again, the warning do not disappear. I suspect this to be a bug and raised &lt;a href=&quot;https://bugs.eclipse.org/bugs/show_bug.cgi?id=408317&quot; title=&quot;Bug#408317&quot;&gt;Bug#408317&lt;/a&gt; for this.&lt;/p&gt;
&lt;p&gt;So the last chance is to filter these warnings. Therefore select the options menu in the Problems View and open the “Configure Contents” dialog. In the “Types” selection tree expand the “Java Build Path Problems” node and uncheck “JRE System Library Problem”.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://kthoms.files.wordpress.com/2013/05/screenshot-2013-05-17-um-11-03-53.png&quot;&gt;&lt;img alt=&quot;screenshot 2013-05-17 um 11.03.53&quot; class=&quot;alignnone size-large wp-image-530&quot; height=&quot;492&quot; src=&quot;http://kthoms.files.wordpress.com/2013/05/screenshot-2013-05-17-um-11-03-53.png?w=619&amp;amp;h=492&quot; width=&quot;619&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Finally the warning messages disappear from the Problems View. However, they are just filtered from the view, the projects themselves will still have these resource markers, so you will have a warning overlay icon on the project in the Package Explorer View although the Problems View might be empty.&lt;/p&gt;
&lt;p&gt;But this raises the next problem: Now the warning disappears and the code is compiled with Java 1.6, and thus against the 1.6 API. This leads to the problem that you could accidently use API from &amp;gt;= 1.6. For example, usage of &lt;em&gt;String#isEmpty()&lt;/em&gt; would compile even if the Execution Environment is set to J2SE-1.5 (the Execution Environment anyway just defines the lowest requirement) and also if Java source compatibility is set to 1.6 in the compiler settings.&lt;/p&gt;
&lt;p&gt;We need to detect this unwanted use of API that is not 1.5 compatible. Therefore the &lt;a href=&quot;http://wiki.eclipse.org/PDE/Resources/Execution_Environments&quot;&gt;PDE tooling offers support to install an Execution Environment Description for J2SE-1.5 and set up API tooling.&lt;/a&gt; This will finally allow us to detect illegal API use:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://kthoms.files.wordpress.com/2013/05/screenshot-2013-05-17-um-14-00-15.png&quot;&gt;&lt;img alt=&quot;screenshot 2013-05-17 um 14.00.15&quot; class=&quot;alignnone size-large wp-image-534&quot; height=&quot;120&quot; src=&quot;http://kthoms.files.wordpress.com/2013/05/screenshot-2013-05-17-um-14-00-15.png?w=591&amp;amp;h=120&quot; width=&quot;591&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I like to thank Laurent Goubet and Mikael Barbero for their valuable comments on the potential API problems.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/kthoms.wordpress.com/522/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/kthoms.wordpress.com/522/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=kthoms.wordpress.com&amp;amp;blog=6829080&amp;amp;post=522&amp;amp;subd=kthoms&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</description>
	<pubDate>Fri, 17 May 2013 09:27:06 +0000</pubDate>
</item>
<item>
	<title>Alex Ruiz: Android Studio: our new, shiny Android IDE</title>
	<guid isPermaLink="true">http://alexruiz.developerblogs.com/?p=2700</guid>
	<link>http://alexruiz.developerblogs.com/?p=2700</link>
	<description>&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;img alt=&quot;&quot; class=&quot;aligncenter size-medium wp-image-2701&quot; height=&quot;300&quot; src=&quot;http://alexruiz.developerblogs.com/files/2013/05/512_512-300x300.png&quot; width=&quot;300&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The cat is out of the bag: yesterday, during &lt;a href=&quot;https://developers.google.com/events/io/&quot; target=&quot;_blank&quot;&gt;Google I/O&lt;/a&gt;‘s keynote, we announced our new &lt;a href=&quot;http://www.jetbrains.com/idea/&quot;&gt;IntelliJ IDEA&lt;/a&gt;-based Android IDE, &lt;a href=&quot;http://developer.android.com/sdk/installing/studio.html&quot; target=&quot;_blank&quot;&gt;Android Studio&lt;/a&gt;. This is what my team has been working on for the past months.&lt;/p&gt;
&lt;p&gt;From what I read on the web, Android Studio has been pretty well received. I personally heard nice comments about it, from “awesome!” to “fantastic!” and “really cool.”&lt;/p&gt;
&lt;p&gt;Here are some highlights about Android Studio. I’ll be writing more detailed blogs about our IDE soon. Before I continue, let me make this clear: &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;This is a personal blog. The opinions expressed here represent my own and not those of my employer, Google.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;With that out of the way, here we go:&lt;/p&gt;
&lt;h3&gt;Our goal is to be Gradle-centric&lt;/h3&gt;
&lt;p&gt;We are working closely with the &lt;a href=&quot;http://www.gradle.org/gradleware&quot;&gt;Gradleware&lt;/a&gt; folks on a new &lt;a href=&quot;http://www.gradle.org/&quot;&gt;Gradle&lt;/a&gt;-based &lt;a href=&quot;http://tools.android.com/tech-docs/new-build-system/user-guide&quot;&gt;build system&lt;/a&gt;. Right now, with Android Studio, you can create new Gradle-based Android projects or import existing ones. When you build your project in Android Studio, we disable the default IDEA Java builders and delegate the build to Gradle. You get the same output from building within Android Studio or from the command line. Our goal is to have Gradle build files as the only source of truth.&lt;/p&gt;
&lt;h3&gt;This is an early access preview&lt;/h3&gt;
&lt;p&gt;Even though it is possible to create applications with Android Studio, there are still rough corners, bugs and features that we have not implemented yet.  It would be great to get as many bug reports and feature requests from early adopters. Here is the list of &lt;a href=&quot;http://tools.android.com/knownissues&quot; target=&quot;_blank&quot;&gt;known issues&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;We still support Eclipse&lt;/h3&gt;
&lt;p&gt;We will be supporting &lt;a href=&quot;http://developer.android.com/tools/sdk/eclipse-adt.html&quot; target=&quot;_blank&quot;&gt;Eclipse ADT&lt;/a&gt; as well. In fact, we plan to add similar Gradle support to ADT. The catch here is that given limitations in Eclipse, especially JDT, we cannot guarantee a development experience as smooth as Android Studio. You can, however, export your Eclipse-based Android project as a Gradle project, and then import it into Android Studio.&lt;/p&gt;
&lt;h3&gt;This is not a fork of IntelliJ IDEA&lt;/h3&gt;
&lt;p&gt;We have been working, and continue to work, really close with &lt;a href=&quot;http://www.jetbrains.com/&quot; target=&quot;_blank&quot;&gt;JetBrains&lt;/a&gt;, the folks behind the best Java IDE, IDEA. They implemented the changes we needed in their platform in order to develop Android Studio. Eventually, you will be able drop Android Studio as a plug-in into your copy of IDEA.&lt;/p&gt;
&lt;p&gt;That’s it for now. Stay tuned for more Android Studio posts :)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; &lt;a href=&quot;https://plus.google.com/+XavierDucrohet/posts&quot; target=&quot;_blank&quot;&gt;Xav&lt;/a&gt;‘s and &lt;a href=&quot;https://plus.google.com/+TorNorbye/posts&quot; target=&quot;_blank&quot;&gt;Tor&lt;/a&gt;‘s Google I/O talk “What’s New in Android Developer Tools” is on &lt;a href=&quot;https://www.youtube.com/watch?v=lmv1dTnhLH4&quot; target=&quot;_blank&quot;&gt;YouTube&lt;/a&gt;!&lt;/p&gt;</description>
	<pubDate>Fri, 17 May 2013 00:58:39 +0000</pubDate>
</item>
<item>
	<title>Maximilian Kögel: EMF Dos and Don´ts #9</title>
	<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=15706</guid>
	<link>http://eclipsesource.com/blogs/2013/05/16/emf-dos-and-don%c2%b4ts-9/</link>
	<description>&lt;p dir=&quot;ltr&quot;&gt;EMF is a very powerful framework and with power comes…responsibility. You can achieve great things with a minimum of effort using EMF, but if something goes wrong, you can also spend hours trying to find out why. This blog post is part of a &lt;a href=&quot;http://eclipsesource.com/blogs/2013/02/26/emf-do%C2%B4s-and-don%C2%B4ts/&quot;&gt;series&lt;/a&gt; on things you should do and things you should not do when using EMF. You can use the &lt;a href=&quot;http://eclipsesource.com/blogs/2013/02/26/emf-do%C2%B4s-and-don%C2%B4ts/&quot;&gt;link to the series pilot&lt;/a&gt; to navigate to the start and the link below to navigate to the next blog once it is published.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;&lt;strong&gt;EMF Dos #9: Use EMF ItemProviders&lt;/strong&gt;&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;To display entities in a tree view or in other views, you need a label provider and a content provider. The label provider provides an icon and a text to display each entity type. The content provider defines the children of an entity. Additionally, the label and content providers need to notify their viewers if the label or content changes due to data changes. The viewers will update only if there are data changes. You could implement the label and content providers manually, which is a lot of work, or you can rely on EMF-generated infrastructure.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;For every entity defined in your Ecore, EMF will generate an ItemProvider in the Edit-Plugin. The ItemProvider implements methods to get an icon and a text for the entity (getText() and getImage()). Since you want to display all kinds of entities in a tree view, you need to create a label provider that will know the type of your entity and use the matching ItemProvider to retrieve a text and an icon. This label provider needs to implement  the ILabelProvider interface. Similarly, a content provider would have to implement the ITreeContentProvider interface and define the children for all the different kinds of entities. For this purpose, EMF provides a fully functional label and content providers: AdapterFactoryLabelProvider and AdapterFactoryContentProvider. They both work in the same way,  so I will focus on the AdapterFactoryLabelProvider.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;Conceptually, an AdapterFactoryLabelProvider is able to provide labels for all supported entities by delegating to the appropriate generated ItemProviders. Technically, the AdapterFactoryLabelProvider requires an AdapterFactory to do this (see the constructor). An AdapterFactory creates adapters (wrappers) for a given entity. For each EMF model, EMF generates an AdapterFactory for the ItemProviders of its entities. Basically, the adapt() method of the AdapterFactory returns the appropriate ItemProvider for a specific  entity.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;To construct an AdapterFactoryLabelProvider,  you can pass in the AdapterFactory of your model, and the label provider will be able to display your entities based on their ItemProviders.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;If you want to display entities from multiple models you can use a ComposedAdapterFactory, which I will describe in my next blog.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;The AdapterFactoryLabelProvider will —  with the help of the ItemProviders — update its viewers if any of the entities it provided a label for change. Furthermore, the AdapterFactoryLabelProvider is very loosely coupled to the ItemProviders that implement entity-specific display behaviour.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;Since the ItemProviders are generated (but can be adapted if necessary), the AdapterFactoryLabelProvider and AdapterFactoryContentProvider really are a big productivity boost in displaying EMF-based entities in your viewers.&lt;/p&gt;
&lt;p dir=&quot;ltr&quot;&gt;Stay tuned for more Dos and Don´ts in my &lt;a href=&quot;http://eclipsesource.com/blogs/2013/05/21/emf-dos-and-don%C2%B4ts-10/&quot;&gt;next blog&lt;/a&gt;!&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style=&quot;display: inline-block;&quot;&gt;&lt;a href=&quot;https://twitter.com/intent/tweet?source=webclient&amp;amp;text=EMF+Dos+and+Don%C2%B4ts+%239&amp;amp;via=eclipsesource&amp;amp;url=http://eclipsesource.com/blogs/2013/05/16/emf-dos-and-don%c2%b4ts-9/&quot; style=&quot;margin-right: 5px;&quot; target=&quot;_blank&quot; title=&quot;Share on Twitter&quot;&gt;&lt;img alt=&quot;Twitter&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png&quot; title=&quot;Twitter&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/05/16/emf-dos-and-don%c2%b4ts-9/&quot; style=&quot;margin-right: 5px;&quot; target=&quot;_blank&quot; title=&quot;+1&quot;&gt;&lt;img alt=&quot;Google+&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png&quot; title=&quot;Google+&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/05/16/emf-dos-and-don%c2%b4ts-9/&quot; style=&quot;margin-right: 5px;&quot; target=&quot;_blank&quot; title=&quot;Share on LinkedIn&quot;&gt;&lt;img alt=&quot;LinkedIn&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png&quot; title=&quot;LinkedIn&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/05/16/emf-dos-and-don%c2%b4ts-9/&amp;amp;t=EMF+Dos+and+Don%C2%B4ts+%239&quot; style=&quot;margin-right: 5px;&quot; target=&quot;_blank&quot; title=&quot;Facebook&quot;&gt;&lt;img alt=&quot;Facebook&quot; src=&quot;http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png&quot; title=&quot;Facebook&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href=&quot;http://eclipsesource.com/blogs/2013/05/16/emf-dos-and-don%c2%b4ts-9/#comments&quot;&gt;Leave a Comment&lt;/a&gt;. Tagged with &lt;a href=&quot;http://eclipsesource.com/blogs/tag/eclipse/&quot; title=&quot;eclipse Tag&quot;&gt;eclipse&lt;/a&gt;, &lt;a href=&quot;http://eclipsesource.com/blogs/tag/emf/&quot; title=&quot;emf Tag&quot;&gt;emf&lt;/a&gt;, &lt;a href=&quot;http://eclipsesource.com/blogs/tag/eclipse/&quot; title=&quot;eclipse Tag&quot;&gt;eclipse&lt;/a&gt;, &lt;a href=&quot;http://eclipsesource.com/blogs/tag/emf/&quot; title=&quot;emf Tag&quot;&gt;emf&lt;/a&gt;&lt;p&gt;&lt;/p&gt;</description>
	<pubDate>Thu, 16 May 2013 10:54:39 +0000</pubDate>
</item>
<item>
	<title>Annamalai Chockalingam: UpdateSite available for eclipse-utils finally</title>
	<guid isPermaLink="false">tag:blogger.com,1999:blog-2310191777550204104.post-4056931162167348846</guid>
	<link>http://eclipseo.blogspot.com/2013/05/updatesite-available-for-eclipse-utils.html</link>
	<description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot;&gt;Hey Guys ! Finally created an updateSite for eclipse-utils.&lt;br /&gt;You can now download the utility plugins from the following link&lt;br /&gt;&lt;br /&gt;Update Site :: &lt;a href=&quot;http://www.ancitconsulting.com/eclipse-utils/&quot;&gt;http://www.ancitconsulting.com/eclipse-utils/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Following Plugins will be available in the build&lt;br /&gt;1.gSearch&lt;br /&gt;2.Comment / Remove System.out.println from Selected Resource or Workspace&lt;br /&gt;3.Zip and Email from Project Explorer&lt;br /&gt;4.Show in File Explorer from Project Explorer&lt;/div&gt;</description>
	<pubDate>Thu, 16 May 2013 09:55:48 +0000</pubDate>
	<author>noreply@blogger.com (Its_Me_Malai)</author>
</item>
<item>
	<title>Andrei Loskutov: IntelliJ IDEA for Android</title>
	<guid isPermaLink="true">http://www.jroller.com/andyl/entry/intellij_idea_for_android</guid>
	<link>http://www.jroller.com/andyl/entry/intellij_idea_for_android</link>
	<description>&lt;p&gt;That's an interesting move: &lt;a href=&quot;https://plus.google.com/u/0/116539451797396019960/posts/9FpcpegSfWN&quot;&gt;Google announced to choose IntelliJ IDEA for the new Android Studio IDE&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;The guys are not dumb - if they do such things, they have good reasons. I never had pleasure to use Android plugins for Eclipse, so I can't really judge if it was good or not...&lt;/p&gt;&lt;p&gt;But what does it mean for Eclipse?&lt;b&gt; Is Eclipse not good enough for &lt;strike&gt;Google&lt;/strike&gt; Android developers?&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Would be interesting know what are the &lt;b&gt;real&lt;/b&gt; reasons to leave Eclipse land for IntelliJ IDEA adventure.&lt;/p&gt;&lt;p&gt; Here are few candidates from me (just in random order):&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Lack of &quot;core platform&quot; development since few years (e4 is a fancy toy in a beta stage, sorry)&lt;/li&gt;&lt;li&gt;Bugs, bugs, bugs everywhere, feature requests waiting years in bugzilla (&lt;a href=&quot;https://bugs.eclipse.org/bugs/show_bug.cgi?id=35779&quot;&gt;word wrapping&lt;/a&gt;?)&lt;/li&gt;&lt;li&gt;Overcomplicated / error prone installation of 3rd party tools / over-engineered update manager (p2) story&lt;/li&gt;&lt;li&gt;Lack of customization options for IDE (according to speakers, extensibility of IntelliJ is one of the reasons to choose it)&lt;/li&gt;&lt;li&gt;Lack of standardization, chaos outside of &quot;standard&quot; JDT world (each and every language/VCS/technology stack plugin does things differently)&lt;/li&gt;&lt;li&gt;Last but not least, my favorite: with Swing you never see &quot;no more handles&quot; crashes.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Yep Google, I'm disappointed Eclipse user too.&lt;/p&gt;</description>
	<pubDate>Wed, 15 May 2013 22:07:18 +0000</pubDate>
</item>
<item>
	<title>Angelo Zerr: Mongo JEE [step6]</title>
	<guid isPermaLink="false">http://angelozerr.wordpress.com/?p=7337</guid>
	<link>http://angelozerr.wordpress.com/2013/05/15/mongo_jee_step6/</link>
	<description>&lt;p&gt;In &lt;a href=&quot;http://angelozerr.wordpress.com/2013/05/14/mongo_jee_step5/&quot;&gt;[step5]&lt;/a&gt; we have modified our JAX-RS LogsService to returns List of Pojo by using :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://mongojack.org/&quot;&gt;MongoJack&lt;/a&gt; to get List of Pojo from Mongo DB.
  &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://cxf.apache.org/docs/jax-rs.html&quot;&gt;Apache CXF&lt;/a&gt; &lt;strong&gt;JSONProvider&lt;/strong&gt; based on &lt;a href=&quot;http://jettison.codehaus.org/&quot;&gt;Jettison&lt;/a&gt; to serialize the Pojo Log to JSON stream.
&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;With Pojo Mapper MongoJack, the LogsService looks like this: &lt;/p&gt;
&lt;pre class=&quot;brush: java; title: ; notranslate&quot;&gt;@GET
@Path(&quot;/all&quot;)
@Produces(MediaType.APPLICATION_JSON)
public List&amp;lt;Log&amp;gt; findAll() {
	DB db = MongoHolder.connect().getDB(&quot;websites&quot;);
	DBCollection dbColl = db.getCollection(&quot;logs&quot;);
	JacksonDBCollection&amp;lt;Log, String&amp;gt; coll = JacksonDBCollection.wrap(
          dbColl, Log.class, String.class);
	return coll.find().toArray();
}&lt;/pre&gt;
&lt;p&gt;When I have studied how to use Mongo in JEE Application with JAX-RS, I have read the great article &lt;a href=&quot;http://architects.dzone.com/articles/modern-web-apps-using-jax-rs&quot;&gt;Modern Web Apps using JAX-RS, MongoDB, JSON, and jQuery&lt;/a&gt;. After reading this article, I told me &quot;why we need to use a Pojo Mapper with JAX-RS although Mongo manages their data with BSON representation?&quot;, on other words why we could not develop our JAX-RS service like this : &lt;/p&gt;
&lt;pre class=&quot;brush: java; title: ; notranslate&quot;&gt;@GET
@Path(&quot;/all&quot;)
@Produces(MediaType.APPLICATION_JSON)
public DBCursor findAll() {
	DB db = MongoHolder.connect().getDB(&quot;websites&quot;);
	DBCollection coll = db.getCollection(&quot;logs&quot;);
	return coll.find();
}&lt;/pre&gt;
&lt;p&gt;Using DBCursor avoids to create a Pojo and avoids to serialize the Pojo to JSON. So I have decided to create &lt;a href=&quot;https://github.com/angelozerr/mongo-jee&quot;&gt;Mongo JEE&lt;/a&gt; project. In this article we will modify our JAX-RS LogsService to use Mongo DBCursor in the service by using the JAX-RS provider of the Mongo JEE.&lt;/p&gt;
&lt;p&gt;&lt;span id=&quot;more-7337&quot;&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;Download&lt;/h2&gt;
&lt;p&gt;You can download &lt;a href=&quot;https://dl.dropboxusercontent.com/u/2903680/wordpress-blog/tutoriels/java/mongo-jee/step6.zip&quot;&gt;step6.zip&lt;/a&gt; which hosts the Eclipse Project which contains the explained sources in this article. To use it, unzip it and import this project in your Eclipse workspace. As soon as you will do that, your workspace will look like this : &lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;http://angelozerr.files.wordpress.com/2013/05/mongojee_step61.png?w=595&quot; /&gt;&lt;/p&gt;
&lt;p&gt;This Eclipse project contains: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://angelozerr.wordpress.com/feed/#LogService&quot;&gt;LogService&lt;/a&gt; is JAX-RS service which returns Mongo DBCursor.
  &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://angelozerr.wordpress.com/feed/#MyJaxrsApplication&quot;&gt;MyJaxrsApplication&lt;/a&gt; is JAX-RS application which register the JAX-RS LogsService and Mongo JEE JAX-RS providers.
  &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://angelozerr.wordpress.com/feed/#web.xml&quot;&gt;web.xml&lt;/a&gt; declares the Apache CXF JAX-RS implementation and set MyJaxrsApplication as JAX-RS Application
  &lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Download JARs with maven&lt;/h3&gt;
&lt;p&gt;This project contains the same dependencies than &lt;a href=&quot;http://angelozerr.wordpress.com/2013/05/14/mongo_jee_step4/&quot;&gt;step4&lt;/a&gt; (no need to use MongoJack and Apache CXF JSONProvider).&lt;/p&gt;
&lt;h2&gt;LogsService – DBCursor&lt;/h2&gt;
&lt;p&gt;Modify org.samples.mongodb.services.&lt;strong&gt;LogsService&lt;/strong&gt; like this: &lt;/p&gt;
&lt;pre class=&quot;brush: java; title: ; notranslate&quot;&gt;package org.samples.mongodb.services;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.jee.MongoHolder;

@Path(&quot;/logs&quot;)
public class LogsService {

	@GET
	@Path(&quot;/all&quot;)
	@Produces(MediaType.APPLICATION_JSON)
	public DBCursor findAll() {
		DB db = MongoHolder.connect().getDB(&quot;websites&quot;);
		DBCollection coll = db.getCollection(&quot;logs&quot;);
		return coll.find();
	}

}&lt;/pre&gt;
&lt;h2&gt;Without Mongo JEE&lt;/h2&gt;
&lt;p&gt;In this step we will not use Mongo JEE to manage DBCursor with JAX-RS. We will see the problem without JAX-RS provider and we will fix it by developping our own JAX-RS provider.&lt;/p&gt;
&lt;h3&gt;MyJaxrsApplication  – with problems&lt;/h3&gt;
&lt;p&gt;At this step we will use the MyJaxrsApplication of the previous article &lt;a href=&quot;http://angelozerr.wordpress.com/2013/05/14/mongo_jee_step5/‎&quot;&gt;[step5]&lt;/a&gt; : &lt;/p&gt;
&lt;pre class=&quot;brush: java; title: ; notranslate&quot;&gt;package org.samples.mongodb.jaxrs;

import java.util.HashSet;
import java.util.Set;

import javax.ws.rs.core.Application;

import org.samples.mongodb.services.LogsService;

public class MyJaxrsApplication extends Application {

	private final Set&amp;lt;Object&amp;gt; singletons;

	public MyJaxrsApplication() {
		singletons = new HashSet&amp;lt;Object&amp;gt;();
		addSingleton(new LogsService());
	}

	protected void addSingleton(Object singleton) {
		singletons.add(singleton);
	}

	@Override
	public Set&amp;lt;Object&amp;gt; getSingletons() {
		return singletons;
	}
}&lt;/pre&gt;
&lt;h3 id=&quot;test&quot;&gt;Test LogsService – with problem&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;run the StartServer class to start the server.&lt;/li&gt;
&lt;li&gt;access with your webbrowser to the URL &lt;a href=&quot;http://localhost:8081/mongo/jaxrs/logs/all&quot;&gt;http://localhost:8081/mongo/jaxrs/logs/all/&lt;/a&gt; and you will see the following error :
&lt;pre class=&quot;brush: plain; title: ; notranslate&quot;&gt;No message body writer has been found for response class DBCursor.&lt;/pre&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This error occurs because Apache CXF &lt;strong&gt;doesn’t find JAX-RS provider to serialize the DBCursor to JSON&lt;/strong&gt;. Mongo JEE provides those JAX-RS provider but before using it, it can be interesting to develop it (with simply mean).&lt;/p&gt;
&lt;h3&gt;MyDBCursorProvider&lt;/h3&gt;
&lt;p&gt;To fix the previous problem, create JAX-RS provider org.samples.mongodb.jaxrs.&lt;strong&gt;MyDBCursorProvider&lt;/strong&gt; to serialize DBCursor to JSON like this:&lt;/p&gt;
&lt;pre class=&quot;brush: java; title: ; notranslate&quot;&gt;package org.samples.mongodb.jaxrs;

import java.io.IOException;
import java.io.OutputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;

import javax.ws.rs.Consumes;
import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.ext.MessageBodyWriter;
import javax.ws.rs.ext.Provider;

import com.mongodb.DBCursor;
import com.mongodb.jee.util.JSON;

@Provider
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public class MyDBCursorProvider implements MessageBodyWriter&amp;lt;DBCursor&amp;gt; {

	@Override
	public boolean isWriteable(Class&amp;lt;?&amp;gt; atype, Type genericType,
			Annotation[] annotations, MediaType mediaType) {
		if (DBCursor.class.isAssignableFrom(atype)) {
			// the given class type is DBCursor
			return true;
		}
		return false;
	}

	public void writeTo(DBCursor cursor, Class&amp;lt;?&amp;gt; type, Type genericType,
			Annotation[] annotations, MediaType mediaType,
			MultivaluedMap&amp;lt;String, Object&amp;gt; httpHeaders,
			OutputStream entityStream) throws IOException,
			WebApplicationException {

		// Write the DBCursor as JSON array stream.
		JSON.serialize(cursor, entityStream);
	}

	@Override
	public long getSize(DBCursor t, Class&amp;lt;?&amp;gt; type, Type genericType,
			Annotation[] annotations, MediaType mediaType) {
		// Return -1 if the content length cannot be determined
		return -1;
	}

}&lt;/pre&gt;
&lt;p&gt;To use our JAX-RS provider, we need to register it in the JAX-RS Application. To do that modify org.samples.mongodb.jaxrs.&lt;strong&gt;MyJaxrsApplication&lt;/strong&gt; like this: &lt;/p&gt;
&lt;pre class=&quot;brush: java; title: ; notranslate&quot;&gt;package org.samples.mongodb.jaxrs;

import java.util.HashSet;
import java.util.Set;

import javax.ws.rs.core.Application;

import org.samples.mongodb.services.LogsService;

public class MyJaxrsApplication extends Application {

	private final Set&amp;lt;Class&amp;lt;?&amp;gt;&amp;gt; classes;
	private final Set&amp;lt;Object&amp;gt; singletons;

	public MyJaxrsApplication() {
		classes = new HashSet&amp;lt;Class&amp;lt;?&amp;gt;&amp;gt;();
		addClass(MyDBCursorProvider.class);
		 
		singletons = new HashSet&amp;lt;Object&amp;gt;();
		addSingleton(new LogsService());
	}

	@Override
	public Set&amp;lt;Class&amp;lt;?&amp;gt;&amp;gt; getClasses() {
		return classes;
	}

	protected void addClass(Class&amp;lt;?&amp;gt; clazz) {
		classes.add(clazz);
	}

	protected void addSingleton(Object singleton) {
		singletons.add(singleton);
	}

	@Override
	public Set&amp;lt;Object&amp;gt; getSingletons() {
		return singletons;
	}
}&lt;/pre&gt;
&lt;h3 id=&quot;test&quot;&gt;Test LogsService – MyDBCursorProvider&lt;/h3&gt;
&lt;p&gt;Now we can test our JAX-RS provider : &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;run the StartServer class to start the server.&lt;/li&gt;
&lt;li&gt;access with your webbrowser to the URL &lt;a href=&quot;http://localhost:8081/mongo/jaxrs/logs/all&quot;&gt;http://localhost:8081/mongo/jaxrs/logs/all/&lt;/a&gt; to see the JSON array of logs and see the &quot;application/json&quot; of the content type :&lt;br /&gt;
&lt;img src=&quot;http://angelozerr.files.wordpress.com/2013/05/mongojee_jaxrs_streamingoutput_chrome.png?w=595&quot; /&gt;
  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can check that the JSON array is the same than the Mongo JSON array like (see &lt;a href=&quot;http://angelozerr.wordpress.com/2013/05/14/mongo_jee_step4/&quot;&gt;[step4]&lt;/a&gt;).&lt;/p&gt;
&lt;h2&gt;With Mongo JEE&lt;/h2&gt;
&lt;p&gt;Mongo JEE provides &lt;a href=&quot;https://github.com/angelozerr/mongo-jee/tree/master/mongo-jee/src/main/java/com/mongodb/jee/jaxrs/providers&quot;&gt;several JAX-RS providers for Mongo&lt;/a&gt; and provides too a JAX-RS Application &lt;a href=&quot;https://github.com/angelozerr/mongo-jee/blob/master/mongo-jee/src/main/java/com/mongodb/jee/jaxrs/JaxrsMongoApplication.java&quot;&gt;JaxrsMongoApplication&lt;/a&gt; which registers Mongo JAX-RS providers.&lt;/p&gt;
&lt;h3&gt;MyJaxrsApplication – JaxrsMongoApplication&lt;/h3&gt;
&lt;p&gt;Modify MyJaxrsApplication to extend JaxrsMongoApplication  like this: &lt;/p&gt;
&lt;pre class=&quot;brush: java; title: ; notranslate&quot;&gt;package org.samples.mongodb.jaxrs;

import org.samples.mongodb.services.LogsService;

import com.mongodb.jee.jaxrs.JaxrsMongoApplication;

public class MyJaxrsApplication extends JaxrsMongoApplication {

	public MyJaxrsApplication() {
		super.addSingleton(new LogsService());
	}

}&lt;/pre&gt;
&lt;p&gt;Run the StartServer class to start the server and check that service works again.&lt;/p&gt;
&lt;h3&gt;Remove _id&lt;/h3&gt;
&lt;p&gt;The returned JSON stream to the browser, contains  the &quot;_id&quot; key. But it’s possible to remove &quot;_id&quot; property .&lt;/p&gt;
&lt;p&gt;Modify LogsService like this:&lt;/p&gt;
&lt;pre class=&quot;brush: java; title: ; notranslate&quot;&gt;package org.samples.mongodb.services;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import com.mongodb.BasicDBObject;
import com.mongodb.DB;
import com.mongodb.DBCollection;
import com.mongodb.DBCursor;
import com.mongodb.jee.MongoHolder;

@Path(&quot;/logs&quot;)
public class LogsService {

	@GET
	@Path(&quot;/all&quot;)
	@Produces(MediaType.APPLICATION_JSON)
	public DBCursor findAll() {
		DB db = MongoHolder.connect().getDB(&quot;websites&quot;);
		DBCollection coll = db.getCollection(&quot;logs&quot;);
		BasicDBObject fieldsToIgnore = new BasicDBObject(&quot;_id&quot;, false);
		return coll.find(null, fieldsToIgnore);
	}

}&lt;/pre&gt;
&lt;p&gt;Restart the server and test it to check that every thing is working again.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;In this article we have seen how to manage Mongo structure with JAX-RS service by using Mongo JEE. &lt;/p&gt;
&lt;p&gt;In the next article [step7] we will add a new method service to return paginated logs list.&lt;/p&gt;
&lt;br /&gt;  &lt;a href=&quot;http://feeds.wordpress.com/1.0/gocomments/angelozerr.wordpress.com/7337/&quot; rel=&quot;nofollow&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://feeds.wordpress.com/1.0/comments/angelozerr.wordpress.com/7337/&quot; /&gt;&lt;/a&gt; &lt;img alt=&quot;&quot; border=&quot;0&quot; height=&quot;1&quot; src=&quot;http://stats.wordpress.com/b.gif?host=angelozerr.wordpress.com&amp;amp;blog=10338309&amp;amp;post=7337&amp;amp;subd=angelozerr&amp;amp;ref=&amp;amp;feed=1&quot; width=&quot;1&quot; /&gt;</description>
	<pubDate>Wed, 15 May 2013 21:41:30 +0000</pubDate>
</item>

</channel>
</rss>
