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

<channel>
	<title>EclipseSource Blog</title>
	<atom:link href="http://eclipsesource.com/blogs/category/syndicate/feed/?author_name=hstaudacher" rel="self" type="application/rss+xml" />
	<link>http://eclipsesource.com/blogs</link>
	<description>Eclipse Equinox OSGi</description>
	<lastBuildDate>Fri, 17 May 2013 13:50:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>How to Bootstrap a Tabris Application with Maven and Eclipse</title>
		<link>http://eclipsesource.com/blogs/2013/05/14/how-to-bootstrap-a-tabris-application-with-maven-and-eclipse/</link>
		<comments>http://eclipsesource.com/blogs/2013/05/14/how-to-bootstrap-a-tabris-application-with-maven-and-eclipse/#comments</comments>
		<pubDate>Tue, 14 May 2013 13:22:05 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[maven]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[Tabris]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=15753</guid>
		<description><![CDATA[From my point of view bootstrapping a new application is always tricky. Especially when you want to bootstrap an app that uses technology you are not yet familiar with. With this post I want to give you a step by step tutorial on how to bootstrap a Tabris application using Eclipse and Maven. So, let&#8217;s <a href="http://eclipsesource.com/blogs/2013/05/14/how-to-bootstrap-a-tabris-application-with-maven-and-eclipse/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>From my point of view bootstrapping a new application is always tricky. Especially when you want to bootstrap an app that uses technology you are not yet familiar with. With this post I want to give you a step by step tutorial on how to bootstrap a <a href="http://developer.eclipsesource.com/tabris/">Tabris application</a> using Eclipse and Maven. So, let&#8217;s get our hands dirty!</p>
<p><strong>IDE Setup</strong></p>
<p>The first thing you need to do is to download the latest &#8220;<a href="http://www.eclipse.org/downloads/">Eclipse IDE for Java EE Developers</a>&#8220;. This package contains everything you need to create web applications and deploy them to the application servers of your choice. As we want to bootstrap the application with Maven, we also need to install additional tools called &#8220;<a href="http://www.eclipse.org/m2e/">m2e</a>&#8221; which provide a Maven integration for Eclipse. So, after starting your new IDE, go to</p>
<p>&#8220;Help&#8221; -&gt; &#8220;Install New Software&#8221; and paste the p2 repository url (<em>http://download.eclipse.org/technology/m2e/releases</em>) of m2e into the text box. This should look like the screenshot below.</p>
<p><img class="aligncenter" alt="m2e installation How to Bootstrap a Tabris Application with Maven and Eclipse" src="http://download.eclipsesource.com/~hstaudacher/m2e-tabris/m2e-installation.png" width="686" height="650" title="How to Bootstrap a Tabris Application with Maven and Eclipse" /></p>
<p>After the installation was successful, you need to restart the IDE.</p>
<p><strong>Create a Project</strong></p>
<p>The next step is to create a new project. Tabris applications run on the server side. So, we want to create a Web-application project. For this go to <em>&#8220;File&#8221; -&gt; &#8220;New&#8221; -&gt; &#8220;Dynamic Web Project&#8221;, </em>which basically creates a JavaEE project.</p>
<p><img class="aligncenter" alt="new project How to Bootstrap a Tabris Application with Maven and Eclipse" src="http://download.eclipsesource.com/~hstaudacher/m2e-tabris/new-project.png" width="539" height="532" title="How to Bootstrap a Tabris Application with Maven and Eclipse" /></p>
<p>In my example I have named the project &#8220;com.eclipsesource.hello.world&#8221; but you can choose whatever name you like.</p>
<p><strong>Maven</strong></p>
<p>To make things as easy as possible we want <a href="http://maven.apache.org/">Maven</a> to manage our dependencies. This involves two steps. Firstly, we want to have the dependencies during development time and secondly, we want Eclipse to put those dependencies in our &#8220;lib&#8221; folder during deployment time. The first step can be completed easily. Just right click on the newly created project and press <em>&#8220;Configure&#8221; -&gt; &#8220;Convert to Maven Project&#8221;</em>.</p>
<p><img class="aligncenter" alt="convert project How to Bootstrap a Tabris Application with Maven and Eclipse" src="http://download.eclipsesource.com/~hstaudacher/m2e-tabris/convert-project.png" width="580" height="593" title="How to Bootstrap a Tabris Application with Maven and Eclipse" /></p>
<p>This adds a pom.xml to our project to which we can later add dependencies. The second step is a little bit more complicated. To have the depencies copied into the &#8220;lib&#8221; folder we need to create a &#8220;Deployment Assembly&#8221;. To create this, right click on the project and select <em>&#8220;Properties&#8221;</em>. In the left hand navigation tree, select &#8220;Deployment Assembly&#8221;. Within this page we need to add a new assembly. So, click on <em>Add</em> and choose <em>&#8220;Java Build Path Entries&#8221;</em>.</p>
<p style="text-align: center;"><img class="aligncenter" alt="new assembly How to Bootstrap a Tabris Application with Maven and Eclipse" src="http://download.eclipsesource.com/~hstaudacher/m2e-tabris/new-assembly.png" width="526" height="415" title="How to Bootstrap a Tabris Application with Maven and Eclipse" /></p>
<p style="text-align: left;">After pressing &#8220;Next&#8221; we need to tell Eclipse which build path entry we want to have copied. As we want the Maven dependencies to be copied,  we will choose these.</p>
<p style="text-align: left;"><img class="aligncenter" alt="maven assembly How to Bootstrap a Tabris Application with Maven and Eclipse" src="http://download.eclipsesource.com/~hstaudacher/m2e-tabris/maven-assembly.png" width="528" height="416" title="How to Bootstrap a Tabris Application with Maven and Eclipse" /></p>
<p style="text-align: left;">On your machine the dependency tree may be empty, but this is not a problem. Just select &#8220;Maven Dependencies&#8221; and press &#8220;Finish&#8221;. After this you should see the newly created assembly pointing to the &#8220;lib&#8221; folder.</p>
<p style="text-align: left;"><img class="aligncenter" alt="assembly result How to Bootstrap a Tabris Application with Maven and Eclipse" src="http://download.eclipsesource.com/~hstaudacher/m2e-tabris/assembly-result.png" width="618" height="536" title="How to Bootstrap a Tabris Application with Maven and Eclipse" /></p>
<p style="text-align: left;"><strong>Add Tabris</strong></p>
<p style="text-align: left;">After having completed the Maven setup, we can add  a dependency to Tabris because we want to build a Tabris app, right <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_smile.gif' alt="icon smile How to Bootstrap a Tabris Application with Maven and Eclipse" class='wp-smiley' title="How to Bootstrap a Tabris Application with Maven and Eclipse" /> ? So, open the &#8220;pom.xml&#8221; of your project and go to the dependency section. Select &#8220;Add&#8221; and search for &#8220;tabris&#8221;. At this point in time <a href="http://developer.eclipsesource.com/tabris/roadmap/">Tabris 1.0</a> is the current version. Before you select it please make sure that the dependency scope is set to &#8220;runtime&#8221;.</p>
<p style="text-align: left;"><img class="aligncenter" alt="tabris dependency How to Bootstrap a Tabris Application with Maven and Eclipse" src="http://download.eclipsesource.com/~hstaudacher/m2e-tabris/tabris-dependency.png" width="482" height="452" title="How to Bootstrap a Tabris Application with Maven and Eclipse" /></p>
<p style="text-align: left;">After pressing OK and saving the pom.xml Eclipse (m2e) will download Tabris and it&#8217;s dependencies for you.</p>
<p style="text-align: left;"><strong>Creating the App</strong></p>
<p style="text-align: left;">To create the hello world application we need just two classes. The first one is a configuration that tells the framework what to do. In our case it should tell the framework that we want a Tabris UI with only one page. This should look like this:</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Configuration <span style="color: #000000; font-weight: bold;">implements</span> ApplicationConfiguration <span style="color: #009900;">&#123;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> configure<span style="color: #009900;">&#40;</span>Application application<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    TabrisClientInstaller.<span style="color: #006633;">install</span><span style="color: #009900;">&#40;</span>application<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    application.<span style="color: #006633;">addEntryPoint</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/hello&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> TabrisUIEntrypointFactory<span style="color: #009900;">&#40;</span>createConfiguration<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>, <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">private</span> UIConfiguration createConfiguration<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    UIConfiguration uiConfiguration <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> UIConfiguration<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    PageConfiguration startPageConfig <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PageConfiguration<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;root&quot;</span>, StartPage.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    startPageConfig.<span style="color: #006633;">setTopLevel</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    startPageConfig.<span style="color: #006633;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Hello World&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    uiConfiguration.<span style="color: #006633;">addPageConfiguration</span><span style="color: #009900;">&#40;</span>startPageConfig<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">return</span> uiConfiguration<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>




<p style="text-align: left;">After the configuration is complete, we will need a page. I decided to go with an easy one <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink How to Bootstrap a Tabris Application with Maven and Eclipse" class='wp-smiley' title="How to Bootstrap a Tabris Application with Maven and Eclipse" /> . It&#8217;s just a pink colored page that does nothing.</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> StartPage <span style="color: #000000; font-weight: bold;">extends</span> AbstractPage <span style="color: #009900;">&#123;</span>
&nbsp;
  @Override
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> createContent<span style="color: #009900;">&#40;</span><span style="color: #003399;">Composite</span> parent, PageData data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    parent.<span style="color: #006633;">setBackground</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Color</span><span style="color: #009900;">&#40;</span>parent.<span style="color: #006633;">getDisplay</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, <span style="color: #cc66cc;">255</span>, <span style="color: #cc66cc;">150</span>, <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>




<p style="text-align: left;">Basically this is the whole application we want to create.</p>
<p style="text-align: left;"><strong>Configure the Web-Application</strong></p>
<p style="text-align: left;">One last step is to configure the Web-Application. We need to tell the Application that it should use the ApplicationConfiguration created in the previous step. We can do this by modifying the web.xml. You can find this file within your project by expanding the <em>&#8220;WebContent/WEB-INF&#8221;</em> folder. The content of the web.xml should look like this:</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;web-app</span> <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/xml/ns/javaee&quot;</span> <span style="color: #000066;">xmlns:web</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;</span> <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd&quot;</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;3.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.eclipse.rap.applicationConfiguration<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>com.eclipsesource.hello.world.Configuration<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/context-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.eclipse.rap.rwt.engine.RWTServletContextListener<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/listener<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>rwtServlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.eclipse.rap.rwt.engine.RWTServlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>rwtServlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/web-app<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>




<p style="text-align: left;"><strong>Export</strong></p>
<p style="text-align: left;">That&#8217;s it! Our application is ready to be exported. You can do this by right clicking on your project and selecting <em>&#8220;Export&#8221; -&gt; &#8220;WAR-file&#8221;</em>.</p>
<p style="text-align: left;"><img class="aligncenter" alt="export How to Bootstrap a Tabris Application with Maven and Eclipse" src="http://download.eclipsesource.com/~hstaudacher/m2e-tabris/export.png" width="495" height="684" title="How to Bootstrap a Tabris Application with Maven and Eclipse" /></p>
<p style="text-align: left;">After you have the .war file ready you can deploy it to whatever servlet container you want.</p>
<p style="text-align: left;"><strong>Access the Application</strong></p>
<p style="text-align: left;">To access the application you need a Tabris mobile client. You can download them from the <a href="http://developer.eclipsesource.com/tabris/downloads/">Tabris download page</a>. I have used the iOS client and the application looks like the one in the screenshot below. You need to point your client to your server, e.g. http://localhost:8080/com.eclipsesource.hello.world/hello.</p>
<p style="text-align: left;"><img class="aligncenter" alt="hello How to Bootstrap a Tabris Application with Maven and Eclipse" src="http://download.eclipsesource.com/~hstaudacher/m2e-tabris/hello.png" width="396" height="744" title="How to Bootstrap a Tabris Application with Maven and Eclipse" /></p>
<p style="text-align: left;">If you have any open questions please don&#8217;t hesitate to leave a comment.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=How+to+Bootstrap+a+Tabris+Application+with+Maven+and+Eclipse&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/05/14/how-to-bootstrap-a-tabris-application-with-maven-and-eclipse/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/05/14/how-to-bootstrap-a-tabris-application-with-maven-and-eclipse/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/05/14/how-to-bootstrap-a-tabris-application-with-maven-and-eclipse/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/05/14/how-to-bootstrap-a-tabris-application-with-maven-and-eclipse/&amp;t=How+to+Bootstrap+a+Tabris+Application+with+Maven+and+Eclipse" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/><a href="http://eclipsesource.com/blogs/2013/05/14/how-to-bootstrap-a-tabris-application-with-maven-and-eclipse/#comments">Leave a Comment</a>. Tagged with <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/maven/' title='maven Tag'>maven</a>, <a href='http://eclipsesource.com/blogs/tag/mobile/' title='mobile Tag'>mobile</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/maven/' title='maven Tag'>maven</a>, <a href='http://eclipsesource.com/blogs/tag/mobile/' title='mobile Tag'>mobile</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/05/14/how-to-bootstrap-a-tabris-application-with-maven-and-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tabris 1.0 is here!</title>
		<link>http://eclipsesource.com/blogs/2013/04/16/tabris-1-0-is-here/</link>
		<comments>http://eclipsesource.com/blogs/2013/04/16/tabris-1-0-is-here/#comments</comments>
		<pubDate>Tue, 16 Apr 2013 08:55:55 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Editors choice]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[new and noteworthy]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[Tabris]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=15384</guid>
		<description><![CDATA[Today we are proud to release Tabris 1.0. If you have not followed us so far you probably don&#8217;t know what Tabris is. Let me put it in one sentence: Tabris is the first Java-Toolkit for the cross-platform development of native mobile Apps. It enables you to write iOS and Android Apps completely in Java with <a href="http://eclipsesource.com/blogs/2013/04/16/tabris-1-0-is-here/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://developer.eclipsesource.com/tabris/"><img class="size-full wp-image-15402 alignright" alt="tabris logo Tabris 1.0 is here!" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/tabris-logo.png" width="325" height="236" title="Tabris 1.0 is here!" /></a>Today we are proud to release <a href="http://developer.eclipsesource.com/tabris/">Tabris 1.0</a>. If you have not followed us so far you probably don&#8217;t know what Tabris is. Let me put it in one sentence: Tabris is the first Java-Toolkit for the cross-platform development of native mobile Apps. It enables you to write iOS and Android Apps completely in Java with a single code base. With this post, I want to sum up our journey till now and show you which features have made it into the 1.0 release.</p>
<p>Tabris sits on top of <a href="http://eclipse.org/rap/">Eclipse RAP</a>. RAP provides a UI Toolkit to write Web applications using Java. This UI Toolkit is based on Widgets, so you don&#8217;t have to mess around with HTML. To be able to display those widgets in a browser, RAP uses a protocol which is based on JSON. Within this protocol are messages that instruct the browser e.g. to display a button, or a tree, and so on. What Tabris does is to provide two alternative clients which are an iOS and an Android client. Those clients simply understand the RAP protocol messages and display widgets using the native counterparts.</p>
<p>On <a href="http://eclipsesource.com/blogs/2010/04/28/rap-2-0-protocol/">April 28th, 2010</a> we have previewed a version of the RAP protocol which basically marked the start of Tabris internally. Two months later (<a href="http://eclipsesource.com/blogs/2010/06/11/writing-ipadiphoneipod-applications-with-swt/">June 11th, 2010</a>), we had the first working prototype which has used Apple&#8217;s iAd JavaScript framework for rendering. Since then we have worked on what is today released as Tabris. It includes two native clients and an extension of the server side RAP API. This extension, which is just another jar, is necessary because the RAP API is based on the Standard Widget Toolkit (SWT). SWT is limited when it is used on mobile devices. There are no APIs for Geolocation, Camera and other things a mobile App typically use.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/tabris-mdevices.png"><img class="alignright size-full wp-image-15407" alt="tabris mdevices Tabris 1.0 is here!" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/04/tabris-mdevices.png" width="302" height="370" title="Tabris 1.0 is here!" /></a>The first time we made our mobile clients public was the start of our &#8220;developer preview&#8221; back in <a href="http://eclipsesource.com/blogs/2012/01/31/rap-mobile-ios-and-android-apps-written-in-java/">January 31st, 2012</a>. At this time we concentrated on implementing a proper support for the SWT widgets. Since then, we have released <a href="https://github.com/eclipsesource/tabris/issues/milestones?state=closed">14 milestones</a>. The last public milestone was tagged with <a href="http://eclipsesource.com/blogs/2013/02/18/tabris-0-11-0-new-noteworthy/">0.11.0</a>. We think that this was the most important one for Tabris. It introduced a feature called the <a href="http://eclipsesource.com/blogs/2013/02/19/inside-the-tabris-ui/">Tabris UI</a>. Tabris UI is a higher level API for creating a frame for your mobile application. The native clients use native navigation concepts to display a Tabris UI-based application. On Android this is the ActionBar and on iOS these are the ViewControllers. So, since Tabris 0.11.0 it has been possible to write native applications using native Widgets combined with native navigation concepts.</p>
<p>In the last weeks we have concentrated on Bug fixing and API cleanup to ship a release we can be proud of. If you would like to try out Tabris yourself, just <a href="http://developer.eclipsesource.com/tabris/downloads/">download the 30 day trial version</a>. This trial has no functional limitations! To get started with this trial we have created some detailed <a href="http://developer.eclipsesource.com/tabris/docs/">getting started guides</a> you can use. We have also created a <a href="http://developer.eclipsesource.com/tabris/demos/">bunch of screencasts</a> that show some of the features Tabris provides. You can find the new &amp; noteworthy articles so far below:</p>
<ul>
<li><a href="http://eclipsesource.com/blogs/2012/02/27/rap-mobile-for-android-0-5-3-new-and-noteworthy/">Tabris 0.5.3</a></li>
<li><a href="http://eclipsesource.com/blogs/2012/03/14/rap-mobile-0-5-4-new-and-noteworthy/">Tabris 0.5.4</a></li>
<li><a href="http://eclipsesource.com/blogs/2012/03/30/rap-mobile-0-5-5-new-and-noteworthy/">Tabris 0.5.5</a></li>
<li><a href="http://eclipsesource.com/blogs/2012/04/11/rap-mobile-0-5-6-new-and-noteworthy/">Tabris 0.5.6</a></li>
<li><a href="http://eclipsesource.com/blogs/2012/05/02/rap-mobile-0-5-7-new-and-noteworthy/">Tabris 0.5.7</a></li>
<li><a href="http://eclipsesource.com/blogs/2012/05/15/rap-mobile-0-5-8-new-and-noteworthy/">Tabris 0.5.8</a></li>
<li><a href="http://eclipsesource.com/blogs/2012/06/20/tabris-0-6-0-new-and-noteworthy/">Tabris 0.6.0</a></li>
<li><a href="http://eclipsesource.com/blogs/2012/07/13/tabris-0-6-1-new-and-noteworthy/">Tabris 0.6.1</a></li>
<li><a href="https://github.com/eclipsesource/tabris/issues?milestone=1&amp;state=closed">Tabris 0.6.2</a></li>
<li><a href="http://eclipsesource.com/blogs/2012/09/06/tabris-0-7-0-new-and-noteworthy/">Tabris 0.7.0</a></li>
<li><a href="http://eclipsesource.com/blogs/2012/10/19/tabris-0-8-0-new-and-noteworthy/">Tabris 0.8.0</a></li>
<li><a href="http://eclipsesource.com/blogs/2012/12/18/tabris-0-9-0-new-noteworthy/">Tabris 0.9.0</a></li>
<li><a href="http://eclipsesource.com/blogs/2013/01/17/tabris-0-10-0-new-noteworthy/">Tabris 0.10.0</a></li>
<li><a href="http://eclipsesource.com/blogs/2013/02/18/tabris-0-11-0-new-noteworthy/">Tabris 0.11.0</a></li>
</ul>
<p>At this point I want to thank the community which has provided us with great feedback, feature requests and bug reports. I also want to thank the rest of the Tabris team: <a href="http://eclipsesource.com/blogs/author/jordi/">Jordi Böhme López</a>, <a href="http://eclipsesource.com/blogs/author/jeick/">Johannes Eickhold</a>, <a href="http://eclipsesource.com/blogs/author/mpost/">Moritz Post</a> and <a href="http://eclipsesource.com/blogs/author/ivan/">Ivan Furnadjiev</a> for doing a great job over the last year! And last but not least, many thanks to the <a href="http://projects.eclipse.org/projects/rt.rap">Eclipse RAP team</a> for their great support!</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Tabris+1.0+is+here%21&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/04/16/tabris-1-0-is-here/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/04/16/tabris-1-0-is-here/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/04/16/tabris-1-0-is-here/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/04/16/tabris-1-0-is-here/&amp;t=Tabris+1.0+is+here%21" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/><a href="http://eclipsesource.com/blogs/2013/04/16/tabris-1-0-is-here/#comments">8 Comments</a>. Tagged with <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/ios/' title='iOS Tag'>iOS</a>, <a href='http://eclipsesource.com/blogs/tag/new-and-noteworthy/' title='new and noteworthy Tag'>new and noteworthy</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a>, <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/ios/' title='iOS Tag'>iOS</a>, <a href='http://eclipsesource.com/blogs/tag/new-and-noteworthy/' title='new and noteworthy Tag'>new and noteworthy</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/04/16/tabris-1-0-is-here/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Meet us at EclipseCon 2013 in Boston</title>
		<link>http://eclipsesource.com/blogs/2013/03/11/meet-us-at-eclipsecon-2013-in-boston/</link>
		<comments>http://eclipsesource.com/blogs/2013/03/11/meet-us-at-eclipsecon-2013-in-boston/#comments</comments>
		<pubDate>Mon, 11 Mar 2013 17:04:01 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[Planet OSGi]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[eclipsecon]]></category>
		<category><![CDATA[emf]]></category>
		<category><![CDATA[modeling]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[Tabris]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=14876</guid>
		<description><![CDATA[Only two weeks left until EclipseCon! I&#8217;m sure everyone&#8217;s excited to see the new location, make new and meet old friends. This year we have plenty of talks ranging from runtime over mobile to modeling. Pick your choices! Highly Interactive Mobile Apps with RAP (J. Böhme López, H. Staudacher): Smartphones and Tablets have become ubiquitous. The <a href="http://eclipsesource.com/blogs/2013/03/11/meet-us-at-eclipsecon-2013-in-boston/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/03/eclipseCon2013.png"><img class="size-full wp-image-14883 alignright" style="padding-left: 10px;" alt="eclipseCon2013 Meet us at EclipseCon 2013 in Boston" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/03/eclipseCon2013.png" width="318" height="91" title="Meet us at EclipseCon 2013 in Boston" /></a>Only two weeks left until <a href="http://www.eclipsecon.org/2013/">EclipseCon</a>! I&#8217;m sure everyone&#8217;s excited to see the new location, make new and meet old friends. This year we have plenty of talks ranging from runtime over mobile to modeling. Pick your choices!</p>
<ul>
<li><strong>Highly Interactive Mobile Apps with RAP</strong> (<a href="http://eclipsesource.com/blogs/author/jordi/">J. Böhme López</a>, <a href="http://eclipsesource.com/blogs/author/hstaudacher/">H. Staudacher</a>): Smartphones and Tablets have become ubiquitous. The competitiveness of the market is a win for consumers but a nightmare for developers. To write an application targeted for multiple devices, developers will be faced with an array of platforms and programming languages. <a href="http://www.eclipsecon.org/2013/sessions/highly-interactive-mobile-apps-rap">Reade more&#8230;</a></li>
<li><strong>Deploy and Manage RAP Applications on Equinox, Jetty, Virgo, Apache Karaf, and Tomcat</strong> (<a href="http://eclipsesource.com/blogs/author/mknauer/">M. Knauer)</a>: You&#8217;ve written a RAP-based application, but now you want to make it available to the public? Deploying and managing <a href="http://eclipse.org/rap/">Eclipse RAP</a> applications is challenging because there are so many options to choose from. <a href="http://www.eclipsecon.org/2013/sessions/deploy-and-manage-rap-applications-equinox-jetty-virgo-apache-karaf-and-tomcat">Read more&#8230;</a></li>
<li>
<p id="page-title"><strong>Eclipse/OSGi Puzzlers &#8211; Traps and Pitfalls</strong> (B. Muskalla from Tasktop, <a href="http://eclipsesource.com/blogs/author/hstaudacher/">H. Staudacher</a>): Every API has its quirks. Based on the popular <a href="http://www.youtube.com/watch?v=wbp-3BJWsU8">&#8216;Java Puzzlers&#8217;</a> talks by Joshua Bloch we will present the first Eclipse/OSGi Puzzles talk. What to expect? Traps and Pitfalls from the Eclipse and OSGi universe for you to participate. Besides the common pitfalls we will dive into well known Eclipse APIs and their quirks. Together we will investigate the ramifications of using these APIs. <a href="http://www.eclipsecon.org/2013/sessions/eclipseosgi-puzzlers-traps-and-pitfalls">Read more&#8230;</a></p>
</li>
<li>
<p id="page-title"><strong>EMF Dos and Don’ts</strong> (<a href="http://eclipsesource.com/blogs/author/mkoegel/">M. Koegel</a>, E. Mueller): EMF is very powerful and most of the time fairly simple to use, but of course there are rocks and shallows: Why are there so many Adapters on my EObjects? After overriding some generated code the XML serialization stopped working? My subpackages are not recognized by framework X? EcoreUtil.delete is dead slow? <a href="http://www.eclipsecon.org/2013/sessions/emf-do%E2%80%99s-and-don%E2%80%99t%E2%80%99s">Read more&#8230;</a></p>
</li>
<li>
<p id="page-title"><strong>What every Eclipse developer should know about EMF</strong> (<a href="http://eclipsesource.com/blogs/author/mkoegel/">M. Koegel</a>, E. Mueller): Many talks about e4, modeling and other topics assume you have used the Eclipse Modeling Framework (EMF) before. But what if you haven’t? What is all this modeling stuff about? What is EMF anyway? And who is this Ed guy? <a href="http://www.eclipsecon.org/2013/sessions/what-every-eclipse-developer-should-know-about-emf">Read more&#8230;</a></p>
</li>
<li>
<p id="page-title"><strong>Fuzzy Testing</strong> (<a href="http://eclipsesource.com/blogs/author/mkoegel/">M. Koegel</a>, E. Mueller): Many of the test cases for an application involve data defined by the data model. To achieve good test coverage it is customary to run the test cases for a variety of different input data sets. This can be achieved by manually specifying different input data. However, this is a complex task and it is easy to miss important input data and thereby miss bugs. <a href="http://www.eclipsecon.org/2013/sessions/fuzzy-testing">Read more&#8230;</a></p>
</li>
<li>
<p id="page-title"><strong>Modeling Symposium</strong> (<a href="http://eclipsesource.com/blogs/author/jhelming/">J. Helming</a>, Ed Merks from Itemis): The modeling community is among the most active and diverse in Eclipse&#8217;s ecosystem. The modeling symposium aims to provide a forum for community members to present a brief overview of their work. We will encourage minutes lightning talks to facilitate a broad range of speakers. The primary goal is to introduce interesting, new technological features. <a href="http://www.eclipsecon.org/2013/sessions/modelling-symposium">Read more&#8230;</a></p>
</li>
<li><strong>What every Eclipse developer should know about Eclipse 4</strong> (e4) (<a href="http://eclipsesource.com/blogs/author/jhelming/">J. Helming</a>, E. Neufeld):  This tutorial will give you a jumpstart into the new concepts of the Eclipse 4 Application Platform. If you have previous experience developing with RCP 3.x, but limited or no experience with e4, this tutorial is designed for you. Based on a sample RCP application, we introduce the most important features of the new platform, such as the Application Model, Dependency Injection and the new Programming Model. <a href="http://www.eclipsecon.org/2013/sessions/what-every-eclipse-developer-should-know-about-eclipse-4-e4">Read more&#8230;</a></li>
</ul>
<p>Quite a few of my EclipseSource colleagues are busy right now preparing talks and demos and we hope to meet you there. If you can&#8217;t make it to a talk don&#8217;t be shy and meet us at the bar (after the talks) <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink Meet us at EclipseCon 2013 in Boston" class='wp-smiley' title="Meet us at EclipseCon 2013 in Boston" /> .</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Meet+us+at+EclipseCon+2013+in+Boston&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/03/11/meet-us-at-eclipsecon-2013-in-boston/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/03/11/meet-us-at-eclipsecon-2013-in-boston/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/03/11/meet-us-at-eclipsecon-2013-in-boston/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/03/11/meet-us-at-eclipsecon-2013-in-boston/&amp;t=Meet+us+at+EclipseCon+2013+in+Boston" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/><a href="http://eclipsesource.com/blogs/2013/03/11/meet-us-at-eclipsecon-2013-in-boston/#comments">Leave a Comment</a>. Tagged with <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/eclipsecon/' title='eclipsecon Tag'>eclipsecon</a>, <a href='http://eclipsesource.com/blogs/tag/emf/' title='emf Tag'>emf</a>, <a href='http://eclipsesource.com/blogs/tag/modeling/' title='modeling Tag'>modeling</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a>, <a href='http://eclipsesource.com/blogs/tag/eclipse/' title='eclipse Tag'>eclipse</a>, <a href='http://eclipsesource.com/blogs/tag/eclipsecon/' title='eclipsecon Tag'>eclipsecon</a>, <a href='http://eclipsesource.com/blogs/tag/emf/' title='emf Tag'>emf</a>, <a href='http://eclipsesource.com/blogs/tag/modeling/' title='modeling Tag'>modeling</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/03/11/meet-us-at-eclipsecon-2013-in-boston/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Inside the Tabris UI</title>
		<link>http://eclipsesource.com/blogs/2013/02/19/inside-the-tabris-ui/</link>
		<comments>http://eclipsesource.com/blogs/2013/02/19/inside-the-tabris-ui/#comments</comments>
		<pubDate>Tue, 19 Feb 2013 09:34:15 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[rap]]></category>
		<category><![CDATA[Tabris]]></category>
		<category><![CDATA[ui]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=14413</guid>
		<description><![CDATA[As you may have read in the Tabris 0.11.0 new and noteworthy post, we have created a small UI framework called the &#8220;Tabris UI&#8221;. In this post I will dive into the details of this framework. Grab a coffee and open your mind . Let&#8217;s get started&#8230; Background Almost a year ago we released our <a href="http://eclipsesource.com/blogs/2013/02/19/inside-the-tabris-ui/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>As you may have read in the <a href="http://eclipsesource.com/blogs/2013/02/18/tabris-0-11-0-new-noteworthy/">Tabris 0.11.0 new and noteworthy post</a>, we have created a small UI framework called the &#8220;Tabris UI&#8221;. In this post I will dive into the details of this framework. Grab a coffee and open your mind <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink Inside the Tabris UI" class='wp-smiley' title="Inside the Tabris UI" /> . Let&#8217;s get started&#8230;</p>
<h2>Background</h2>
<p>Almost a year ago we released our <a href="http://eclipsesource.com/blogs/2012/01/31/rap-mobile-ios-and-android-apps-written-in-java/">first public milestone</a> (back then Tabris was RAP mobile). Since then we have worked hard towards the Tabris 1.0 release. The basic idea behind Tabris was always to use the SWT Java API to create UIs for mobile devices. This idea hasn&#8217;t changed much. Since the first milestone Tabris has had many adopters and we&#8217;ve received a lot of good feedback. One topic that especially got us thinking was stated as follows: &#8220;Tabris is nice and SWT allows me to create a rich UI. But, it doesn&#8217;t allow me to use common navigation concepts&#8221;. Said another way, the problem for developers is that each platform has it&#8217;s own navigation concepts. For Android this is the ActionBar and for iOS it is the View Controllers as highlighted in the screenshot below.</p>
<div style="text-align: center; width: 100%;"><a style="width: 100%;" href="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/ui-concepts.png"><img class="aligncenter size-full wp-image-14419" style="display: inline;" alt="ui concepts Inside the Tabris UI" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/ui-concepts.png" width="766" height="405" title="Inside the Tabris UI" /></a></div>
<p>With plain SWT it&#8217;s not possible to create a UI using those concepts and as result it was not possible with the early versions of Tabris either. Note here, that the operative word in the last sentence is &#8220;was&#8221; -  because, we have created a small UI framework on top of SWT that enables you to create UIs using native navigation concepts. This framework now forms the core of Tabris.</p>
<h2>Abstraction</h2>
<p>Tabris is a framework for cross-platform mobile apps. The basic concept of Tabris is that you write the UI in Java and it runs on the server. A device calls the server and renders your UI with native components. This means that when you create an SWT Button on iOS, an iOS button will be created and on Android, an Android button will be created. As a result, you can create applications with one code base that serves multiple platforms. This means that we can&#8217;t (and don&#8217;t want to) port the concepts of the different platforms to a server side API. We have to create an abstraction! That is, an encapsulation of the concepts of all platforms into a simple, understandable API.</p>
<p>This API is called &#8220;Tabris UI&#8221;. The key parts are two types, <code>Page</code> and <code>Action</code>. To make it clear what these types are we can take a look at another image.</p>
<div style="text-align: center; width: 100%;"><a style="width: 100%;" href="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/areas.png"><img class="aligncenter size-full wp-image-14425" style="display: inline;" alt="areas Inside the Tabris UI" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/areas.png" width="800" height="699" title="Inside the Tabris UI" /></a></div>
<p>The red shaded area of these images is the <code>Page</code> which basically contains your controls. In the green shaded boxes you can see two Actions. An <code>Action</code> is an element that a user can press (to activate) and which is located outside of the Page.</p>
<h2>Concepts</h2>
<p>Let&#8217;s look a little deeper into Pages and Actions. Pages can be chained together in any order. This means a user&#8217;s button click can be used to open a new page. When you do this multiple times a chain will be created. Within this chain you will be able to browse backward to the previous page . This concept is called page chaining. Every chain has a root element. This is what we call the &#8220;top level&#8221; page. One application can have multiple top level pages and all can mark the beginning of a chain. Let&#8217;s take a look at a diagram.</p>
<div style="text-align: center; width: 100%;"><a style="width: 100%;" href="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/pages.png"><img class="aligncenter size-full wp-image-14432" style="display: inline;" alt="pages Inside the Tabris UI" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/pages.png" width="516" height="301" title="Inside the Tabris UI" /></a></div>
<p>This diagram could represent almost any application. The usual flow of an application is that you start on a top level page and browse through several pages, going deeper into the application. As you can see on the image this is what we call chaining. But one top level page is not enough for most application. Think about a bookstore application. The possible top level pages are &#8220;All Books, Favorites, Popular Books&#8221;. Each top level page will contain another set of books you can browse through. So, when you have several top level pages you need to be able to browse from one top level page to another or to browse from a normal page to a top level page. This is shown with the red arrows on the diagram. What&#8217;s not possible is to navigate from one page in a chain to a page in another chain because only one chain can exist at any given time. The pages in a chain are created when they are visited and they will be destroyed when you navigate in reverse and leave them (e.g. when you jump back to the top level page or the previous page).</p>
<p>Actions have a lifecycle similar to Pages. Similar but not exactly the same. Two types of Actions exist. Global Actions and Page Actions. A Global Action is visible regardless of which page the user is on. Page-Actions exist only on a specific page. They are created when the page is created and will be destroyed when the page is destroyed. You can see the difference in the following screenshots. In these images the Global Action is shaded in green. It has application scope. The Page-Action is shaded red. It has page scope.</p>
<div style="text-align: center; width: 100%;"><a style="width: 100%;" href="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/actions.png"><img class="aligncenter size-full wp-image-14436" style="display: inline;" alt="actions Inside the Tabris UI" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/actions.png" width="700" height="568" title="Inside the Tabris UI" /></a></div>
<p>&nbsp;</p>
<h2>Programming Model</h2>
<p>You will create Page and Action objects to enable the main functions of your applications. And, in most cases you will quickly reach a point where the components need to communicate. Of course, you can access a Page directly from within an Action but this is not good practice. We prefer a loosely coupled communication between components. This communication can be accomplished by using a context. In the Tabris UI it&#8217;s called a UI and you can use it for navigation and influencing the state of actions too. The key feature of the communication is that you can a data store from it. When I talk about a store think about a simple <code>Map</code>, encapsulated in the type <code>PageData</code>. A PageData object has the same lifecycle as a page. Each page has it&#8217;s own data, even top level pages. This is because you will need to pass data in your chain. You can navigate to a new page and pass in a <code>PageData</code> object which then marks the page store of the new page. Let&#8217;s take a look at another diagram.</p>
<div style="text-align: center; width: 100%;"><a style="width: 100%;" href="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/store1.png"><img class="aligncenter size-full wp-image-14444" style="display: inline;" alt="store1 Inside the Tabris UI" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/store1.png" width="518" height="131" title="Inside the Tabris UI" /></a></div>
<p>As you might notice it shows the same page chain as above. What&#8217;s different is that it shows the new PageData objects that will be passed to a new page. In this data you can save page state information such as a selection.</p>
<h2>Configuration</h2>
<p>What we have not described in the preceding paragraphs is how the different components come together. This is all done via configuration. To be explicit the type that matters is called <code>UIConfiguration</code>. You will need to create an instance and add your Page configurations and Action configurations to it. What are Page and Action configurations? As the name says, they are the configurations of a Page or an Action. A Page doesn&#8217;t know anything about it&#8217;s title, if it&#8217;s a top level page or about it&#8217;s image. And this is the same for Actions. This information needs to be declared within a <code>PageConfiguration</code> or <code>ActionConfiguration</code> object. The diagram below shows how this works.</p>
<div style="text-align: center; width: 100%;"><a style="width: 100%;" href="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/configuration.png"><img class="aligncenter size-full wp-image-14465" style="display: inline;" alt="configuration Inside the Tabris UI" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/configuration.png" width="425" height="466" title="Inside the Tabris UI" /></a></div>
<p>As you can see, the Tabris UI framework is responsible for creating Page and Action objects from the configuration. This also means that you will need to add Page or Action Class objects to it&#8217;s configuration. After you have created your configuration it can be passed in as a constructor argument into the <code>TabrisUIEntryPointFactory</code> object. As a result this needs to be added to an <code>Application</code> within your <code>ApplicationConfiguration</code> implementation.</p>
<h2>Ready to use</h2>
<p>Using everything described above, you can write powerful applications that will have a platform specific user experience. We have created an example for the Tabris UI. It&#8217;s the bookstore example mentioned earlier. You can see the flow of this app in the picture below.</p>
<div style="text-align: center; width: 100%;"><a style="width: 100%;" href="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/result.png"><img class="aligncenter size-full wp-image-14461" style="display: inline;" alt="result Inside the Tabris UI" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/result.png" width="707" height="533" title="Inside the Tabris UI" /></a></div>
<p>You can look into <a href="https://github.com/eclipsesource/tabris-demos/tree/master/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/ui">this example on github</a>. It&#8217;s licensed under the <a href="http://www.eclipse.org/legal/epl-v10.html">EPL 1.0</a>, so feel free to use it as a starting point for your application.</p>
<h2>Outlook</h2>
<p>The current implementation is targeted for phones because only one page can be visible at a time. Of course it can be used on tablets too, but having only one page at a time on a tablet is not the way most Apps work. We are working on an enhancement on top of the Tabris UI to be able to define groups of pages that can be visible at the same time for tablet devices.</p>
<p>We hope you will enjoy using the Tabris UI as much as we do. For me, it&#8217;s a breakthrough feature for Tabris and for cross-platform development for mobile apps. As always, feel free to disagree <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink Inside the Tabris UI" class='wp-smiley' title="Inside the Tabris UI" /> .</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Inside+the+Tabris+UI&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/02/19/inside-the-tabris-ui/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/02/19/inside-the-tabris-ui/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/02/19/inside-the-tabris-ui/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/02/19/inside-the-tabris-ui/&amp;t=Inside+the+Tabris+UI" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/ios/' title='iOS Tag'>iOS</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a>, <a href='http://eclipsesource.com/blogs/tag/ui/' title='ui Tag'>ui</a>, <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/ios/' title='iOS Tag'>iOS</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/rap/' title='rap Tag'>rap</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a>, <a href='http://eclipsesource.com/blogs/tag/ui/' title='ui Tag'>ui</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/02/19/inside-the-tabris-ui/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Tabris 0.11.0 – New &amp; Noteworthy</title>
		<link>http://eclipsesource.com/blogs/2013/02/18/tabris-0-11-0-new-noteworthy/</link>
		<comments>http://eclipsesource.com/blogs/2013/02/18/tabris-0-11-0-new-noteworthy/#comments</comments>
		<pubDate>Mon, 18 Feb 2013 08:45:17 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[EclipseSource News]]></category>
		<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[new and noteworthy]]></category>
		<category><![CDATA[Tabris]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=13695</guid>
		<description><![CDATA[Today I&#8217;d like to present Tabris 0.11.0. This build marks the last public milestone before the 1.0 release. From my point of view this milestone is a breakthrough for cross-platform mobile development in Java. We have managed to abstract common mobile navigation patterns into a Java API. In addition to this we have added support <a href="http://eclipsesource.com/blogs/2013/02/18/tabris-0-11-0-new-noteworthy/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;d like to present <a href="http://developer.eclipsesource.com/tabris/downloads/">Tabris 0.11.0</a>. This build marks the last public milestone before the 1.0 release. From my point of view this milestone is a breakthrough for cross-platform mobile development in Java. We have managed to abstract common mobile navigation patterns into a Java API. In addition to this we have added support for SWT Menus and facilities to gain device specific information and much more. Let&#8217;s dive into some details&#8230;</p>
<h2>SWT Menus</h2>
<p>Menus were an often requested feature in Tabris. With this milestone we have implemented support for menus on phones and tablets. A common use case for menus is a long press on any item within the UI. We even support dynamic menu items, so you can add items while the menu is open and they will be rendered correctly on the client. Just a note that when creating a menu, the style flags will be ignored because menus on mobile devices don&#8217;t currently support styles.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/menus.png"><img class="aligncenter size-full wp-image-14386" alt="menus Tabris 0.11.0 – New & Noteworthy" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/menus.png" width="720" height="600" title="Tabris 0.11.0 – New & Noteworthy" /></a></p>
<h2>ClientDevice</h2>
<p>The <code>ClientDevice</code> type has existed for a while now to gather information on which platform is accessing the server. For this milestone we have enhanced this type to get even more information about the client. We also transformed it into a <a href="http://eclipsesource.com/blogs/2013/02/06/rap-2-0-countdown-35/">ClientService</a> to make it accessible with <code>RWT.getClient().getService( ClientDevice.class )</code>. You can get the following information from the ClientDevice:</p>
<ul>
<li><strong>Timezone Offset:</strong> An offset in minutes to UTC. This is inherited from the RWT type ClientInfo.</li>
<li><strong>Locales:</strong> The locale used on the accessing device. Also from ClientInfo</li>
<li><strong>Orientation:</strong> The orientation of the accessing device. Can be landscape or portrait.</li>
<li><strong>Capabilities:</strong> Information regarding the capabilities of the accessing device such as phone or location capabilities.</li>
<li><strong>ConnectionType:</strong> The connection type of the accessing device. Can be wifi or cellular.</li>
<li><strong>Platform:</strong> The platform of the accessing device. Can be Android, iOS or web.</li>
</ul>
<p>Accessing this information is really easy. Check out the following snippet:</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">ClientDevice device <span style="color: #339933;">=</span> RWT.<span style="color: #006633;">getClient</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getService</span><span style="color: #009900;">&#40;</span> ClientDevice.<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Orientation orientation <span style="color: #339933;">=</span> device.<span style="color: #006633;">getOrientation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>



<br/>

<p>We have also created a demo showing the full feature set, <a href="https://github.com/eclipsesource/tabris-demos/blob/master/com.eclipsesource.tabris.demos/src/com/eclipsesource/tabris/demos/entrypoints/ClientDeviceDemo.java">hosted on github</a>.</p>
<h2>ClientStore</h2>
<p>One of the biggest advantages of Tabris is that it doesn&#8217;t store any relevant data on the device. But, sometimes it would be good to have small amounts of data stored, such as the ID of a previously logged-in user. This is comparable to cookies for a web-browser. A website will never store big data in a cookie but small ID&#8217;s that associate it with a data set stored on the server-side. With the new <code>ClientStore</code> implementation you can do exactly this. A small amount of data is stored on the device and is transferred back to the server during the next session (but not with every request as with cookies). Using the store can look like this:</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">ClientStore store <span style="color: #339933;">=</span> RWT.<span style="color: #006633;">getClient</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getService</span><span style="color: #009900;">&#40;</span> ClientStore.<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
store.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;foo&quot;</span>, <span style="color: #0000ff;">&quot;bar&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">String</span> bar <span style="color: #339933;">=</span> store.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;foo&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>




<h2>Tabris UI</h2>
<p>A huge issue for all cross-platform technologies for mobile devices is that you can&#8217;t build an app that uses the native navigation concepts. I mean you can try to emulate these concepts but you will end up with messy code because you need to differentiate for each of the platforms. From my point of view this is also the biggest drawback of HTML5. In Tabris 0.11.0 we have created an abstraction for these navigation concepts. This enables you to create your application once and our client implementations will render it in a way typical for the platform it runs on. To make this clear we have created a &#8220;Bookstore&#8221; example which can be found on github. The following screenshots show the concepts of the Tabris UI using this example. I will tell you more about the <a href="http://eclipsesource.com/blogs/2013/02/19/inside-the-tabris-ui/">details of the Tabris UI in a separate post</a>.</p>
<div style="text-align: center; width: 100%;"><a style="width: 100%;" href="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/ui.png"><img class="aligncenter size-full wp-image-14394" style="display: inline;" alt="ui Tabris 0.11.0 – New & Noteworthy" src="http://eclipsesource.com/blogs/wp-content/uploads/2013/02/ui.png" width="482" height="1776" title="Tabris 0.11.0 – New & Noteworthy" /></a></div>
<h2>What&#8217;s Next for Tabris</h2>
<p>Over the next month we will concentrate on topics like bug fixing, stability and clean-up to create an awesome 1.0 release. Of course, you can comment on all topics and contribute your ideas &#8211; it&#8217;s all publicly available on <a href="https://github.com/eclipsesource/tabris/issues?state=open">GitHub Issues</a>.</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Tabris+0.11.0+%E2%80%93+New+%26%23038%3B+Noteworthy&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/02/18/tabris-0-11-0-new-noteworthy/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/02/18/tabris-0-11-0-new-noteworthy/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/02/18/tabris-0-11-0-new-noteworthy/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/02/18/tabris-0-11-0-new-noteworthy/&amp;t=Tabris+0.11.0+%E2%80%93+New+%26%23038%3B+Noteworthy" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/ios/' title='iOS Tag'>iOS</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/mobile/' title='mobile Tag'>mobile</a>, <a href='http://eclipsesource.com/blogs/tag/new-and-noteworthy/' title='new and noteworthy Tag'>new and noteworthy</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a>, <a href='http://eclipsesource.com/blogs/tag/android/' title='android Tag'>android</a>, <a href='http://eclipsesource.com/blogs/tag/ios/' title='iOS Tag'>iOS</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/mobile/' title='mobile Tag'>mobile</a>, <a href='http://eclipsesource.com/blogs/tag/new-and-noteworthy/' title='new and noteworthy Tag'>new and noteworthy</a>, <a href='http://eclipsesource.com/blogs/tag/tabris/' title='Tabris Tag'>Tabris</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/02/18/tabris-0-11-0-new-noteworthy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OSGi JAX-RS Connector 2.2.0 released (JAX-RS 2.0 update)</title>
		<link>http://eclipsesource.com/blogs/2013/01/14/osgi-jax-rs-connector-2-2-0-released-jax-rs-2-0-update/</link>
		<comments>http://eclipsesource.com/blogs/2013/01/14/osgi-jax-rs-connector-2-2-0-released-jax-rs-2-0-update/#comments</comments>
		<pubDate>Mon, 14 Jan 2013 15:00:26 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[Planet OSGi]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JAX-RS]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=13365</guid>
		<description><![CDATA[There&#8217;s good news for our OSGi JAX-RS Connector. We&#8217;ve added a consumer implementation that gives you the opportunity to reuse your @Path/@Provider interfaces to consume REST services in a generic way. Over the last few weeks I&#8217;d used this consumer a lot and decided that it should go into this release of the connector. So, <a href="http://eclipsesource.com/blogs/2013/01/14/osgi-jax-rs-connector-2-2-0-released-jax-rs-2-0-update/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s good news for our OSGi JAX-RS Connector. We&#8217;ve added a <a href="http://eclipsesource.com/blogs/2012/11/27/consuming-rest-services-in-java-the-cool-way/">consumer implementation</a> that gives you the opportunity to reuse your @Path/@Provider interfaces to consume REST services in a generic way. Over the last few weeks I&#8217;d used this consumer a lot and decided that it should go into this release of the connector. So, today I&#8217;m proud to present the OSGi JAX-RS Connector 2.2.0. It contains the following changes:</p>
<ul>
<li><span style="line-height: 13px;">Updated to <a href="http://jersey.java.net/">Jersey</a> 2.0 m11 and correspondingly to <a href="http://jax-rs-spec.java.net/">JAX-RS 2.0</a>. A large rework was required in order to use JAX-RS 2.0 because the Jersey implementation changed a lot under the hood.</span></li>
<li>Added the JAX-RS Consumer Version 1.0. It uses the <a href="http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/client/Client.html">JAX-RS 2.0 Client API</a> to send requests.</li>
</ul>
<p>Please read the <a href="https://github.com/hstaudacher/osgi-jax-rs-connector/blob/master/README.md">README</a> for more details. As always the changes are available as a <a href="http://hstaudacher.github.com/osgi-jax-rs-connector">p2 repository</a> or can be downloaded directly from the <a href="https://github.com/hstaudacher/osgi-jax-rs-connector">GitHub repository</a> (gh-pages branch). I would love to read some feedback <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink OSGi JAX RS Connector 2.2.0 released (JAX RS 2.0 update)" class='wp-smiley' title="OSGi JAX RS Connector 2.2.0 released (JAX RS 2.0 update)" /> .</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=OSGi+JAX-RS+Connector+2.2.0+released+%28JAX-RS+2.0+update%29&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2013/01/14/osgi-jax-rs-connector-2-2-0-released-jax-rs-2-0-update/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2013/01/14/osgi-jax-rs-connector-2-2-0-released-jax-rs-2-0-update/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2013/01/14/osgi-jax-rs-connector-2-2-0-released-jax-rs-2-0-update/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2013/01/14/osgi-jax-rs-connector-2-2-0-released-jax-rs-2-0-update/&amp;t=OSGi+JAX-RS+Connector+2.2.0+released+%28JAX-RS+2.0+update%29" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/jax-rs/' title='JAX-RS Tag'>JAX-RS</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/jax-rs/' title='JAX-RS Tag'>JAX-RS</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2013/01/14/osgi-jax-rs-connector-2-2-0-released-jax-rs-2-0-update/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Consuming REST services in OSGi the cool way</title>
		<link>http://eclipsesource.com/blogs/2012/11/28/consuming-rest-services-in-osgi-the-cool-way/</link>
		<comments>http://eclipsesource.com/blogs/2012/11/28/consuming-rest-services-in-osgi-the-cool-way/#comments</comments>
		<pubDate>Wed, 28 Nov 2012 08:50:25 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[Planet OSGi]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JAX-RS]]></category>
		<category><![CDATA[rest]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=12669</guid>
		<description><![CDATA[I recently introduced you to the JAX-RS Consumer. If you&#8217;ve read that post you might remember that I promised to write about the OSGi integration of the consumer. This is the topic of this short post. As you might know, a while ago I created the OSGI-JAX-RS connector. This connector gives you the opportunity to <a href="http://eclipsesource.com/blogs/2012/11/28/consuming-rest-services-in-osgi-the-cool-way/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>I recently introduced you to the <a href="http://eclipsesource.com/blogs/2012/11/27/consuming-rest-services-in-java-the-cool-way/">JAX-RS Consumer</a>. If you&#8217;ve read that post you might remember that I promised to write about the OSGi integration of the consumer. This is the topic of this short post.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/11/consumer.jpg"><img class="alignleft size-medium wp-image-12670" title="consumer" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/11/consumer-300x228.jpg" alt="consumer 300x228 Consuming REST services in OSGi the cool way" width="300" height="228" /></a>As you might know, a while ago I created the <a href="http://eclipsesource.com/blogs/2012/01/23/an-osgi-jax-rs-connector-part-1-publishing-rest-services/">OSGI-JAX-RS connector</a>. This connector gives you the opportunity to publish your <code>@Path</code>/<code>@Provider</code> resources by registering them as OSGi services. So, why not consume a REST service as an OSGi service? That&#8217;s exactly what the JAX-RS Consumer OSGi integration provides. It registers an OSGi service called ConsumerPublisher. Using this service you can publish your <code>@Path</code> interfaces. The <code>ConsumerPublisher</code> creates consumer objects out of them and registers them as OSGi services. Afterwards you will be able to consume them as you do with all other OSGi services.</p>
<p>This is best explained with a small example. Let&#8217;s say we are using Declarative Services. So, this gives us the option to register a component and inject the <code>ConsumerPublisher</code> as in the code below.</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Publisher <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> addConsumerPublisher<span style="color: #009900;">&#40;</span> ConsumerPublisher publisher <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    publisher.<span style="color: #006633;">publishConsumers</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;http://server:port/root&quot;</span>, 
                                <span style="color: #000000; font-weight: bold;">new</span> Class<span style="color: #339933;">&lt;?&gt;</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span> MyResource.<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #009900;">&#125;</span>, 
                                <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Object</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#123;</span><span style="color: #000000; font-weight: bold;">new</span> CustomProvider<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>




<p>When the JAX-RS consumer bundle is started, the <code>ConsumerPublisher</code> service will be registered and is injected into our component. What we have to do additionally, is to add a base url, our <code>@Path</code> interfaces and the custom <code>@Providers</code> we want to use. The <code>ConsumerPublisher</code> takes care of creating the consumer objects out of the interfaces and registers them as OSGi services. In this example we can afterwards get/call a service of the type <code>MyResource</code>.</p>
<p>If you would like to try this out yourself I have created a <a href="https://github.com/downloads/hstaudacher/osgi-jax-rs-connector/com.eclipsesource.jaxrs.consumer-p2repo-1.0.0.201211261819.zip">p2 repository</a> containing the consumer and it&#8217;s dependencies. A <a href="https://github.com/hstaudacher/osgi-jax-rs-connector/tree/master/examples/com.eclipsesource.jaxrs.consumer.example">working example</a> can also be found on <a href="https://github.com/hstaudacher/osgi-jax-rs-connector/tree/master/examples/com.eclipsesource.jaxrs.consumer.example">GitHub</a>. Any feedback is very welcome <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink Consuming REST services in OSGi the cool way" class='wp-smiley' title="Consuming REST services in OSGi the cool way" /> .</p>
<p>&nbsp;</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Consuming+REST+services+in+OSGi+the+cool+way&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/11/28/consuming-rest-services-in-osgi-the-cool-way/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/11/28/consuming-rest-services-in-osgi-the-cool-way/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/11/28/consuming-rest-services-in-osgi-the-cool-way/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/11/28/consuming-rest-services-in-osgi-the-cool-way/&amp;t=Consuming+REST+services+in+OSGi+the+cool+way" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/jax-rs/' title='JAX-RS Tag'>JAX-RS</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a>, <a href='http://eclipsesource.com/blogs/tag/rest/' title='rest Tag'>rest</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/jax-rs/' title='JAX-RS Tag'>JAX-RS</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a>, <a href='http://eclipsesource.com/blogs/tag/rest/' title='rest Tag'>rest</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/11/28/consuming-rest-services-in-osgi-the-cool-way/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Consuming REST services in Java the cool way</title>
		<link>http://eclipsesource.com/blogs/2012/11/27/consuming-rest-services-in-java-the-cool-way/</link>
		<comments>http://eclipsesource.com/blogs/2012/11/27/consuming-rest-services-in-java-the-cool-way/#comments</comments>
		<pubDate>Tue, 27 Nov 2012 09:48:41 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JAX-RS]]></category>
		<category><![CDATA[Planet OSGi]]></category>
		<category><![CDATA[rest]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=12653</guid>
		<description><![CDATA[When creating a REST API with Java you probably go with JAX-RS . It&#8217;s a nice and well thought-out standard. Having the services encapsulated as plain Java objects with some annotations feels good to me. But this is all different when it comes to consuming REST services. During the last month I have searched for <a href="http://eclipsesource.com/blogs/2012/11/27/consuming-rest-services-in-java-the-cool-way/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>When creating a <a href="http://tomayko.com/writings/rest-to-my-wife">REST</a> API with Java you probably go with <a href="http://jax-rs-spec.java.net/">JAX-RS</a> . It&#8217;s a nice and well thought-out standard. Having the services encapsulated as plain Java objects with some annotations feels good to me. But this is all different when it comes to consuming REST services. During the last month I have searched for libraries that meet the following expectations:</p>
<ol>
<li>I don&#8217;t want to mess around with a crappy API.</li>
<li>I want to encapsulate the consumption of the service in a plain Java object.</li>
<li>I just want to consume REST services, so the library should have a small footprint.</li>
<li>I would love to reuse the specification of REST service which I have already used for the server side.</li>
</ol>
<p>I will skip expectation number 1 because I don&#8217;t want to point fingers <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink Consuming REST services in Java the cool way" class='wp-smiley' title="Consuming REST services in Java the cool way" /> . Coming to the second point, my thoughts are that encapsulating a service is not the problem. I have also decided to encapsulate it by myself, if there is no other way. My research has led me to only one library that does this job for me. This is <a href="http://crest.codegist.org/">CRest</a>, an annotation based API that is pretty similar to the one from JAX-RS and partly compatible with JAX-RS 1.0. But &#8220;pretty similar&#8221;and &#8220;partly compatible&#8221; isn&#8217;t enough from my point of view because this leads to duplicated interface definitions and version conflicts when using a newer JAX-RS version. I have also looked at libraries like the well-known <a href="http://hc.apache.org/httpclient-3.x/">Apache HTTP Client</a>, an <a href="https://github.com/kevinsawicki/http-request">URLConnection abstraction from Kevin Sawicki</a> or the <a href="http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/index.html">JAX-RS 2.0 Client API</a> and so on. Every library I looked at didn&#8217;t meet my expectations on one or two points.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/11/overall.jpg"><img class="alignleft size-medium wp-image-12656" title="overall" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/11/overall-300x184.jpg" alt="overall 300x184 Consuming REST services in Java the cool way" width="300" height="184" /></a>My optimal vision of consuming REST services with Java would be to reuse the interface I have defined for the server-side (the <code>@Path</code> resource) and to create a consumer out of it automatically. Having such a solution would also guarantee compile time safety when building the server and the client because you need to define your interface just once and reuse it on both sides. Last week I found almost exactly what I was looking for. <a href="http://cxf.apache.org/docs/jax-rs-client-api.html#JAX-RSClientAPI-ProxybasedAPI">Apache CXF provides a proxy based API</a> that takes a <code>@Path</code> resource and creates a consumer out of it. But as it is with most libraries, this cool functionality is part of a monolith. I don&#8217;t want 200 lines of dependency definitions, I don&#8217;t want dependencies to JAX-WS when doing JAX-RS and I don&#8217;t want to use a communication framework when I just want to consume some REST services  <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink Consuming REST services in Java the cool way" class='wp-smiley' title="Consuming REST services in Java the cool way" /> .</p>
<p>In the end I found myself implementing the library I needed on my own. The result is a very small library that consists of only about 500 lines of code and has the very fancy name JAX-RS Consumer. It gives you the opportunity to transform your <code>@Path</code> interface into a consumer object. Under the hood the Jersey client is used which is taking over tasks like the wiring between <code>@Path</code> and <code>@Providers</code>, sending the actual request, and so on. The single plain Java API it provides is best explained with an example:</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">MyResource resource <span style="color: #339933;">=</span> ConsumerFactory.<span style="color: #006633;">createConsumer</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;http://server:port/root&quot;</span>, 
                                                    MyResource.<span style="color: #000000; font-weight: bold;">class</span>, 
                                                    <span style="color: #000000; font-weight: bold;">new</span> CustomProvider<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
resource.<span style="color: #006633;">doSomething</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>




<p>As you can see there is a <code>ConsumerFactory</code> which takes several arguments.  The first one is the base url of the service provider. The second is the class object of your <code>@Path</code> interface. The third is an optional varargs array of <code>@Provider</code>s. It returns an instance of your service interface which sends the defined requests when accessing the object&#8217;s methods. If you want to try this out I have written a <a href="https://github.com/hstaudacher/osgi-jax-rs-connector/blob/master/examples/com.eclipsesource.jaxrs.consumer.example/src/com/eclipsesource/jaxrs/consumer/example/Main.java">simple example that consumes a little GitHub API</a>.</p>
<p>There is one more thing. The JAX-RS Consumer also has an OSGi integration, but this is a topic for another post. If you want to get familiar with the consumer here are the resources you will probably be looking for . Don&#8217;t be shy to open issues for it, it&#8217;s in an early state <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink Consuming REST services in Java the cool way" class='wp-smiley' title="Consuming REST services in Java the cool way" /> .</p>
<ul>
<li><a href="https://github.com/hstaudacher/osgi-jax-rs-connector">git repository at GitHub</a> (also contains the <a href="http://eclipsesource.com/blogs/2012/01/23/an-osgi-jax-rs-connector-part-1-publishing-rest-services/">OSGi-JAX-RS Connector</a>)</li>
<li><a href="https://github.com/hstaudacher/osgi-jax-rs-connector/blob/master/examples/com.eclipsesource.jaxrs.consumer.example/src/com/eclipsesource/jaxrs/consumer/example/Main.java">Example consuming GitHub API</a></li>
<li>Download: <a href="https://github.com/downloads/hstaudacher/osgi-jax-rs-connector/com.eclipsesource.jaxrs.consumer-1.0.0.201211261819.zip">JAX-RS Consumer</a>, <a href="https://github.com/downloads/hstaudacher/osgi-jax-rs-connector/jersey-2.0-m10-all.zip">Jersey 2.0 m10 incl. dependencies</a></li>
</ul>
<p>&nbsp;</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=Consuming+REST+services+in+Java+the+cool+way&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/11/27/consuming-rest-services-in-java-the-cool-way/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/11/27/consuming-rest-services-in-java-the-cool-way/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/11/27/consuming-rest-services-in-java-the-cool-way/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/11/27/consuming-rest-services-in-java-the-cool-way/&amp;t=Consuming+REST+services+in+Java+the+cool+way" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/jax-rs/' title='JAX-RS Tag'>JAX-RS</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a>, <a href='http://eclipsesource.com/blogs/tag/rest/' title='rest Tag'>rest</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/jax-rs/' title='JAX-RS Tag'>JAX-RS</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a>, <a href='http://eclipsesource.com/blogs/tag/rest/' title='rest Tag'>rest</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/11/27/consuming-rest-services-in-java-the-cool-way/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A Software Craftsman&#8217;s Toolbox: Lightweight Java libraries that make life easier.</title>
		<link>http://eclipsesource.com/blogs/2012/11/07/a-software-craftsmans-toolbox-lightweight-java-libraries-that-make-life-easier/</link>
		<comments>http://eclipsesource.com/blogs/2012/11/07/a-software-craftsmans-toolbox-lightweight-java-libraries-that-make-life-easier/#comments</comments>
		<pubDate>Wed, 07 Nov 2012 09:01:38 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[Gson]]></category>
		<category><![CDATA[guava]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Mockito]]></category>
		<category><![CDATA[restfuse]]></category>
		<category><![CDATA[Software craftsmanship]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=12322</guid>
		<description><![CDATA[As a software developer you will use plenty of frameworks during your career. There are the big beasts like Spring, ActiveMQ or OSGi that you have to master in order to build the foundations of your applications. And then, there are the small frameworks. Let&#8217;s call them lightweight tools. Like a carpenter, the lightweight tools <a href="http://eclipsesource.com/blogs/2012/11/07/a-software-craftsmans-toolbox-lightweight-java-libraries-that-make-life-easier/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/11/box.png"><img class="alignright size-full wp-image-12430" title="box" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/11/box.png" alt="box A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." width="150" height="138" /></a>As a software developer you will use plenty of frameworks during your career. There are the big beasts like Spring, ActiveMQ or OSGi that you have to master in order to build the foundations of your applications. And then, there are the small frameworks. Let&#8217;s call them lightweight tools. Like a carpenter, the lightweight tools are kept in a toolbox. The carpenter will use industrial machines to get his project started and shaped but he will always go back to his handy, personalized set of tools to finish up the details. In his toolbox he has many tools that each do just one job well. This post is about those tools!</p>
<p>Most of the time I work on the server-side. As a result my toolbox is full of libraries that are good for servers but not limited to them. So, I split up the tools into categories. Let&#8217;s start with the screwdrivers <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." class='wp-smiley' title="A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." /> . Nothing bigger than a birdhouse can be built without screws! Screwdrivers in software development are core libraries. In my toolbox there are two.</p>
<p>The first one is <a href="https://code.google.com/p/guava-libraries/">Google Guava</a>. You may have read some <a href="http://eclipsesource.com/blogs/tag/guava/">previous posts about Guava</a> or you may already know this little library. For those of you who don&#8217;t, Guava is a core Library developed by, and also used at Google. It&#8217;s a good example of &#8220;What helps me, may help you&#8221;. This library contains a lot of helpers that you will find useful in your day-to-day work with Java. This includes working with collections, hashing, I/O, primitive types and others. It also contains what I think is a rich, enhanced feature set. This includes concepts for caching, functional idioms or an event bus. While most of the time I use the basics of this framework, I found the enhanced features are also useful for those special occasions.</p>
<p>When I am working with code that has to deal with date and time, the second core library that comes in handy is <a href="http://joda-time.sourceforge.net/">Joda Time</a>. This library exists because Java&#8217;s Date API prior to 1.7 is simply &#8220;<a href="http://practicallyagile.com/2009/05/java-dates-still-suck/">not so good</a>&#8220;. The Joda guys rethought the problem of handling dates, and as a result created a well-designed, small, API for handling dates. Convince yourself with this self-explanatory example:</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> isAfterPayDay<span style="color: #009900;">&#40;</span>DateTime datetime<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>datetime.<span style="color: #006633;">getMonthOfYear</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>   <span style="color: #666666; font-style: italic;">// February is month 2!!</span>
    <span style="color: #000000; font-weight: bold;">return</span> datetime.<span style="color: #006633;">getDayOfMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">26</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #000000; font-weight: bold;">return</span> datetime.<span style="color: #006633;">getDayOfMonth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">28</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>




<p>When it comes to implementing a WebService e.g. a REST API, the screwdrivers don&#8217;t help much anymore. A special tool is needed like a <a href="http://en.wikipedia.org/wiki/Wrench">pipe box spanner</a> <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." class='wp-smiley' title="A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." /> . Two of the libraries I like most for the server-side are Jersey and Gson.</p>
<p><a href="http://jersey.java.net/">Jersey</a> is an implementation of the JAX-RS specification. This specification defines an annotation-based API that makes it possible to publish plain Java objects as web resources. While Jersey is the reference implementation of JAX-RS it also influenced the JAX-RS 2.0 specification by providing a Client API that as far as I can tell, acted as a basis for the specification&#8217;s client API. Another cool thing about Jersey is its loose coupling. It ships as different jar files. The full bundle contains a server, the client and all the other stuff needed. But it can also be used as a plain JAX-RS implementation by bridging the specification API and the Servlet API. A nice side effect is that all jar files are packaged as OSGi bundles and a good <a href="https://github.com/hstaudacher/osgi-jax-rs-connector">OSGi integration</a> exists <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." class='wp-smiley' title="A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." /> . A simple service can look like this:</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// The Java class will be hosted at the URI path &amp;quot;/helloworld&amp;quot;</span>
@Path<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;/helloworld&quot;</span> <span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HelloWorldResource <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// The Java method will process HTTP GET requests</span>
  @GET 
  <span style="color: #666666; font-style: italic;">// The Java method will produce content identified by the MIME Media</span>
  <span style="color: #666666; font-style: italic;">// type &quot;text/plain&quot;;</span>
  @Produces<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;text/plain&quot;</span> <span style="color: #009900;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getClichedMessage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Return some cliched textual content</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;Hello World&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>




<p><a href="http://code.google.com/p/google-gson/">Gson</a> is not dedicated to server-side deployment, but is widely used on servers. It&#8217;s a mapper between Java Objects and JSON. This is nothing new but the API provided by Gson is very useable. I don&#8217;t know the Gson developers but they seem to have committed themselves to this principle: &#8220;<a href="http://www.youtube.com/watch?v=wbp-3BJWsU8">Make it easy to do the commonly correct thing. Make it possible to do the exotic things.</a>&#8221; As a result it&#8217;s very, very easy to de/serialize objects with Gson and the standard de/serialization is good enough for 90% of the use cases I&#8217;ve encountered. But when it comes to special de/serialization it&#8217;s possible to <a href="https://sites.google.com/site/gson/gson-user-guide#TOC-Custom-Serialization-and-Deserialization">hook in and define per type de/serializers</a>. A simple serialization of an object looks like this:</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> BagOfPrimitives <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> value1 <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> value2 <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;abc&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">transient</span> <span style="color: #000066; font-weight: bold;">int</span> value3 <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
  BagOfPrimitives<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// no-args constructor</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
...
<span style="color: #006633;">BagOfPrimitives</span> obj <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BagOfPrimitives<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Gson gson <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Gson<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">String</span> json <span style="color: #339933;">=</span> gson.<span style="color: #006633;">toJson</span><span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>




<p>When we talk about servers we also need to talk about clients. So, when a client is implemented that uses any kind of HTTP connection one task comes up every time. This is sending requests. Honestly, I could never understand why this topic was so hard. I mean, it&#8217;s just sending some Strings over the ether. If you search for Java HTTP libraries you will find a whole bunch of them with all kinds of fancy features. But sorry &#8211; we&#8217;re talking about tools and adding a whole framework for just sending HTTP requests feels odd to me. Of course, there is the URLConnection API, but from my point of view, this is as suboptimal as the standard Date API. Recently I found one HTTP client wrapper that really fit my needs. This is the <a href="https://github.com/kevinsawicki/http-request">HttpRequest class from Kevin Sawicki</a>. It&#8217;s just a single class called HttpRequest that provides static methods to send requests. That&#8217;s it! Ok, it makes testing a little more complicated, but this is a topic for another post <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." class='wp-smiley' title="A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." /> . A simple HTTP request with this tool looks like this:</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">String</span> response <span style="color: #339933;">=</span> HttpRequest.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;http://google.com&quot;</span> <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">body</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Response was: &quot;</span> <span style="color: #339933;">+</span> response<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>




<p>The libraries above are very useful but we haven&#8217;t talked about the tools that really form an application. These are tools for testing! In our carpenter&#8217;s world, these are the spirit levels (with the bubble) <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." class='wp-smiley' title="A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." /> . I always go with <a href="http://junit.org/">Junit</a>, so most of the tools I will list are for this framework.</p>
<p>If a core library for testing exists, for me, it&#8217;s definitely <a href="http://code.google.com/p/mockito/">Mockito</a>. The Mockito developers have done their job right! They have combined a kick-ass API with a rich feature set, and I really believe that the creators have brought mocking in Java to a new level. Mockito provides a well-designed, fluent, API to handle mocks. Probably the most valuable feature of Mockito is that it allows me to stick with the &#8220;<a href="http://developer-in-test.blogspot.de/2009/05/build-operate-check-clear-test-pattern.html">build, operate, check</a>&#8221; testing pattern. A simple mocked test looks like this in Mockito:</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> SecondPartTest <span style="color: #009900;">&#123;</span> 
  @Test
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testSomething<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Strategy strategy <span style="color: #339933;">=</span> mock<span style="color: #009900;">&#40;</span> Strategy.<span style="color: #000000; font-weight: bold;">class</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Something objectUnderTest <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Something<span style="color: #009900;">&#40;</span> strategy <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    objectUnderTest.<span style="color: #006633;">doSomething</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    verify<span style="color: #009900;">&#40;</span> strategy <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">doSomethingConcrete</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>




<p>The second library that is pretty handy is <a href="http://code.google.com/p/caliper/">Caliper</a>. It&#8217;s not really for testing but for performance measurement. (I just added this to the testing category for lack of a better place.) With Caliper you can code micro benchmarks. To understand what a micro benchmark is, it&#8217;s best to read the Caliper Definition:</p>
<blockquote><p>A microbenchmark attempts to measure the performance of a &#8220;small&#8221; bit of code. These tests are typically in the sub-millisecond range. The code being tested usually performs no I/O, or else is a test of some single, specific I/O task.</p>
<p>Microbenchmarking is very different from <em>profiling</em>! When profiling, you work with an entire application, either in production or in an environment very <em>painstakingly</em> contrived to resemble production. Because of this, you get performance data that is, for lack of a better term, <em>real</em>. When you microbenchmark, you get a result that is essentially <em>fictional</em>, and you must be very careful about what conclusions you draw from it.</p></blockquote>
<p>The cool thing about Caliper is that they also provide an app to view the results in a meaningful way. They also store the different runs of your tests for comparison. It&#8217;s worthwhile to take a look at it. A simple micro benchmark can look like this:</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> MyBenchmark <span style="color: #000000; font-weight: bold;">extends</span> SimpleBenchmark <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> timeMyOperation<span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">int</span> reps <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span> <span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> reps<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      MyClass.<span style="color: #006633;">myOperation</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>




<p>The last tool for testing I wrote myself. (So, yes, here comes a little self-marketing <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." class='wp-smiley' title="A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." /> .) This library is called <a href="http://developer.eclipsesource.com/restfuse/">restfuse</a> and it&#8217;s for testing REST APIs. I wrote it to solve the pain of spending half  my test code building up simple requests. Restfuse just sits on top of JUnit and uses the JUnit @Rule mechanism to accomplish its tasks. The thinking behind it is that the request is just a configuration topic and this can be executed outside of the test method&#8217;s body. The result is an annotation-based API that&#8217;s also capable of testing asynchronous REST API&#8217;s. A simple test can look like this:</p>



<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> RestfuseTest <span style="color: #009900;">&#123;</span>
&nbsp;
  @Rule
  <span style="color: #000000; font-weight: bold;">public</span> Destination destination <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Destination<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;http://restfuse.com&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
  @<span style="color: #003399;">Context</span>
  <span style="color: #000000; font-weight: bold;">private</span> Response response<span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// will be injected after every request</span>
&nbsp;
  @HttpTest<span style="color: #009900;">&#40;</span> method <span style="color: #339933;">=</span> <span style="color: #003399;">Method</span>.<span style="color: #006633;">GET</span>, path <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;/&quot;</span> <span style="color: #009900;">&#41;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> checkRestfuseOnlineStatus<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    assertOk<span style="color: #009900;">&#40;</span> response <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>  
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>




<p>Now you know what&#8217;s in my toolbox! Feel free to disagree or let me have a look inside your toolbox by writing a comment <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." class='wp-smiley' title="A Software Craftsmans Toolbox: Lightweight Java libraries that make life easier." /> .</p>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=A+Software+Craftsman%26%238217%3Bs+Toolbox%3A+Lightweight+Java+libraries+that+make+life+easier.&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/11/07/a-software-craftsmans-toolbox-lightweight-java-libraries-that-make-life-easier/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/11/07/a-software-craftsmans-toolbox-lightweight-java-libraries-that-make-life-easier/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/11/07/a-software-craftsmans-toolbox-lightweight-java-libraries-that-make-life-easier/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/11/07/a-software-craftsmans-toolbox-lightweight-java-libraries-that-make-life-easier/&amp;t=A+Software+Craftsman%26%238217%3Bs+Toolbox%3A+Lightweight+Java+libraries+that+make+life+easier." target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/gson/' title='Gson Tag'>Gson</a>, <a href='http://eclipsesource.com/blogs/tag/guava/' title='guava Tag'>guava</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/mockito/' title='Mockito Tag'>Mockito</a>, <a href='http://eclipsesource.com/blogs/tag/restfuse/' title='restfuse Tag'>restfuse</a>, <a href='http://eclipsesource.com/blogs/tag/software-craftsmanship/' title='Software craftsmanship Tag'>Software craftsmanship</a>, <a href='http://eclipsesource.com/blogs/tag/gson/' title='Gson Tag'>Gson</a>, <a href='http://eclipsesource.com/blogs/tag/guava/' title='guava Tag'>guava</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/mockito/' title='Mockito Tag'>Mockito</a>, <a href='http://eclipsesource.com/blogs/tag/restfuse/' title='restfuse Tag'>restfuse</a>, <a href='http://eclipsesource.com/blogs/tag/software-craftsmanship/' title='Software craftsmanship Tag'>Software craftsmanship</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/11/07/a-software-craftsmans-toolbox-lightweight-java-libraries-that-make-life-easier/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>OSGi-JAX-RS Connector 2.1.0 released</title>
		<link>http://eclipsesource.com/blogs/2012/10/26/osgi-jax-rs-connector-2-1-0-released/</link>
		<comments>http://eclipsesource.com/blogs/2012/10/26/osgi-jax-rs-connector-2-1-0-released/#comments</comments>
		<pubDate>Fri, 26 Oct 2012 14:08:30 +0000</pubDate>
		<dc:creator>Holger Staudacher</dc:creator>
				<category><![CDATA[Planet Eclipse]]></category>
		<category><![CDATA[Planet OSGi]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[rest]]></category>

		<guid isPermaLink="false">http://eclipsesource.com/blogs/?p=12038</guid>
		<description><![CDATA[Two months ago the OSGi JAX-RS was released in Version 2.0. Today I&#8217;m proud to announce Version 2.1. In addition to minor improvements, a new feature was added based on the work of Dirk Lecluse. It&#8217;s now possible to register @Provider annotated objects as OSGi services. The @Provider annotation is used to register custom de/serialization. Now <a href="http://eclipsesource.com/blogs/2012/10/26/osgi-jax-rs-connector-2-1-0-released/" style="text-decoration: none;">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Two months ago <a href="http://eclipsesource.com/blogs/2012/08/27/osgi-jax-rs-connector-2-0-released/">the OSGi JAX-RS was released in Version 2.0</a>. Today I&#8217;m proud to announce <a href="https://github.com/hstaudacher/osgi-jax-rs-connector">Version 2.1</a>. In addition to minor improvements, a new feature was added based on the work of <a href="https://github.com/dilec">Dirk Lecluse</a>. It&#8217;s now possible to register <a href="http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/ext/Provider.html"><code>@Provider</code></a> annotated objects as OSGi services. The <code>@Provider</code> annotation is used to register custom de/serialization. Now you can implement a custom <a href="http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/ext/MessageBodyWriter.html"><code>MessageBodyWriter</code></a>, <a href="http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/ext/MessageBodyReader.html"><code>MessageBodyReader</code></a>, <a href="http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/ext/ContextResolver.html"><code>ContextResolver</code></a> or <a href="http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/ext/ExceptionMapper.html"><code>ExceptionMapper</code></a>, annotate it with <code>@Provider</code> and simply register it as OSGi service. All the connector does is wire together the resources with the provider.</p>
<p><a href="http://eclipsesource.com/blogs/wp-content/uploads/2012/10/connector.jpg"><img class="alignright size-medium wp-image-12043" title="connector" src="http://eclipsesource.com/blogs/wp-content/uploads/2012/10/connector-300x189.jpg" alt="connector 300x189 OSGi JAX RS Connector 2.1.0 released" width="300" height="189" /></a><strong><em>As a side note:</em></strong> A few days ago I was asked why I would like to register <a href="http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/javax/ws/rs/Path.html"><code>@Path</code></a> or <code>@Provider</code> annotated objects as OSGi services. The answer is that it enables you to wire up your REST interface with the rest of your system loosely. For example, the serialization in my system is an OSGi service too. So, when registering an <code>@Provider</code> as a service I can use <a href="http://eclipsesource.com/blogs/2009/06/23/eclipse-galileo-feature-top-10-list-number-2/">Declarative Services</a> to hook my serialization object into the provider. This enables me to separate domain and framework code because I don&#8217;t have to get the service myself &#8211; which is a good thing, right? <img src='http://eclipsesource.com/blogs/wp-includes/images/smilies/icon_wink.gif' alt="icon wink OSGi JAX RS Connector 2.1.0 released" class='wp-smiley' title="OSGi JAX RS Connector 2.1.0 released" /> </p>
<p>If you would like to use the connector here are the resources to start with:</p>
<ul>
<li><a href="http://jersey.java.net/">Jersey</a>, the library used by the connector.</li>
<li><a href="http://jax-rs-spec.java.net/nonav/2.0-SNAPSHOT/apidocs/index.html">JAX-RS 2.0 API Documentation</a>.</li>
<li><a href="https://github.com/hstaudacher/osgi-jax-rs-connector">GitHub repository</a></li>
<li>p2 repository: <a href="http://hstaudacher.github.com/osgi-jax-rs-connector">http://hstaudacher.github.com/osgi-jax-rs-connector</a></li>
<li><a href="https://github.com/hstaudacher/osgi-jax-rs-connector/tree/master/com.eclipsesource.jaxrs.connector.example.ds/src/com/eclipsesource/jaxrs/connector/example/ds/provider">Example for the @Provider integration</a>.</li>
<li><a href="https://github.com/hstaudacher/osgi-jax-rs-connector/tree/master/com.eclipsesource.jaxrs.connector.example/src/com/eclipsesource/jaxrs/connector/example">Example for registering @Path resources</a>. <a href="https://github.com/hstaudacher/osgi-jax-rs-connector/tree/master/com.eclipsesource.jaxrs.connector.example.ds/src/com/eclipsesource/jaxrs/connector/example/ds">Also available using DS</a>.</li>
</ul>
<p><br/><div style="display: inline-block"><a href="https://twitter.com/intent/tweet?source=webclient&amp;text=OSGi-JAX-RS+Connector+2.1.0+released&amp;via=eclipsesource&amp;url=http://eclipsesource.com/blogs/2012/10/26/osgi-jax-rs-connector-2-1-0-released/" target="_blank" title="Share on Twitter" style="margin-right: 5px;"><img title="Twitter" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/twitter.png" alt="Twitter"/></a><a href="https://plus.google.com/share?url=http://eclipsesource.com/blogs/2012/10/26/osgi-jax-rs-connector-2-1-0-released/" target="_blank" title="+1" style="margin-right: 5px;"><img title="Google+" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/google_plus.png" alt="Google+"/></a><a href="http://www.linkedin.com/cws/share?url=http://eclipsesource.com/blogs/2012/10/26/osgi-jax-rs-connector-2-1-0-released/" target="_blank" title="Share on LinkedIn" style="margin-right: 5px;"><img title="LinkedIn" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/linkedin.png" alt="LinkedIn"/></a><a href="https://www.facebook.com/sharer/sharer.php?u=http://eclipsesource.com/blogs/2012/10/26/osgi-jax-rs-connector-2-1-0-released/&amp;t=OSGi-JAX-RS+Connector+2.1.0+released" target="_blank" title="Facebook" style="margin-right: 5px;"><img title="Facebook" src="http://eclipsesource.com/blogs/wp-content/plugins/custom-about-author/images/social_media/facebook.png" alt="Facebook"/></a></div><br/>Comments are off for this post.. Tagged with <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/open-source/' title='Open Source Tag'>Open Source</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a>, <a href='http://eclipsesource.com/blogs/tag/rest/' title='rest Tag'>rest</a>, <a href='http://eclipsesource.com/blogs/tag/java/' title='Java Tag'>Java</a>, <a href='http://eclipsesource.com/blogs/tag/open-source/' title='Open Source Tag'>Open Source</a>, <a href='http://eclipsesource.com/blogs/tag/osgi/' title='Planet OSGi Tag'>Planet OSGi</a>, <a href='http://eclipsesource.com/blogs/tag/rest/' title='rest Tag'>rest</a></p>]]></content:encoded>
			<wfw:commentRss>http://eclipsesource.com/blogs/2012/10/26/osgi-jax-rs-connector-2-1-0-released/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
