Archive for the ‘Eclipse RAP’ Category

My first steps with Eclipse RAP [step5]

mai 24, 2011 5 commentaires

In [step4], we have explained how OSGi container and Servlet container can work together. In this article we will explain the generated code of the RAP Hello World that we have generated in the [step1]..

Eclipse RAP Home Page describes RAP like this :

RAP is very similar to Eclipse RCP, but it has an alternative implementation of the SWT API (called RWT) which renders the widgets remotely in a web browser. The RAP application runs on a servlet container and clients can access the application with standard web browsers.

This schema shows RAP architecture. I will use this schema in my articles to explain step by step each component of the RAP architecture. RAP application (like RCP Application) is an Eclipse Plug-In based on the Workbench component. In this article we will see RAP Application and Workbench components :

  • the Workbench component is a collection of windows. Each window contains a menu bar, a toolbar, a shortcut bar and one or more perspectives. Please read Inside the Workbench for more information. For RAP Application, Workbench is managed with the org.eclipse.rap.ui.workbench bundle.
  • RAP Application is an Eclipse Plug-In based on the Workbench. It’s our org.akrogen.dynaresume.raphelloworld bundle.

I suggest you to read Rich Ajax Platform, Part 1: An introduction which explains the generated RAP application (like explained in this article) and compare it with RCP Application code.

Lire la suite…

Catégories:Eclipse RAP

My first steps with Eclipse RAP [step4]

mai 20, 2011 6 commentaires

In [step3], we have explained how to manage dependencies between bundles with Require-Bundle and Import-Package. OSGi services registry was introduced and used to publish/consume a business service UserService which provides list of Users. At this step we have explained OSGi bundle and OSGi container.

RAP Application (like RCP Application) needs OSGi Container, but it also needs Servlet Container, because RAP Application is a WEB Application. When URL is called, the RAP Servlet org.eclipse.rap.ui.internal.servlet.RequestHandler is called. This Servlet is a dispatcher which does the RAP treatments according to the URL request.

In this article I will explain how OSGi Container and Servlet Container can work together. OSGi provides the org.osgi.service.http.HttpService which is a service where you can register/unregister Servlet.

In this article we will create a new bundle org.akrogen.dynaresume.httposgiapplication which register in the OSGi services registry the servlet HelloWorldServlet with the path /helloworld. This servlet will be accessible with the URL http://localhost/helloworld :

Here a schema about the architecture OSGi container and Servlet container used in this article :

Lire la suite…

Catégories:Eclipse RAP

My first steps with Eclipse RAP [step3]

mai 18, 2011 6 commentaires

In [step2] we have created our first OSGi bundle org.akrogen.dynaresume.osgiapplication with PDE (Plug-in Development Environment) and we have used OSGi console to start/stop our bundle. This bundle defines an OSGi Activator which uses classes from org.osgi.framework package. This dependency use Import-Package :

Import-Package: org.osgi.framework;version="1.3.0"

OSGi dependencies can be managed with 2 means :

  • Import-Package : the bundle declares packages that it needs in the MANIFEST.MF. The bundle doesn’t know which bundles export the packages.
  • Require-Bundle : the bundle declares explicitly the required bundles in the MANIFEST.MF .

One other feature of OSGi, is the OSGi services registry where bundle can register/unregister services Publisher) and another bundles can consume services (Consumer) retrieved from the OSGi services registry.

In this article, we will create new Services bundle which will publish UserService service (which gives a list of Users) in the OSGI services registry. org.akrogen.dynaresume.osgiapplication will be modified to consume UserService and displays the list of Users in the System.out. User class will be defined in the bundle.

At first, org.akrogen.dynaresume.osgiapplication will use Require-Bundle,then Import-Package after to see the advantage of this kind of dependency.

At the end of this article we will have 3 OSGi bundles :

  • org.akrogen.dynaresume.domain : OSGi bundle which defines and export Java Bean Domain
  • : OSGi bundle which registers in the OSGi services registry (in the Activator#start) an implementation of which is able to returns the list of Users :
    import java.util.Collection;
    import org.akrogen.dynaresume.domain.User;
    public interface UserService {
    	Collection<User> findAllUsers();
  • org.akrogen.dynaresume.osgiapplication : OSGi bundle creates a thread (in the Activator#start) which get UserService from the OSGi services registry every 5 seconds then call UserService#findAllUsers() to display User in the System.out.

This schema shows you that there are dependencies between OSGi bundles. Dependencies can be managed with Require-Bundle or Import-Package.

Lire la suite…

Catégories:Eclipse RAP

My first steps with Eclipse RAP [step2]

mai 16, 2011 4 commentaires

In [step1] we have generated our first RAP Hello World Application. RAP Application is (like RCP Application) an Eclipse Plugin which is an OSGi bundle. Before explaining generated code of the RAP Hello World Application you need to understand OSGi.

I’ve decided to explain quickly OSGi by using PDE (Plug-in Development Environment) with 3 articles :

  • [step2] (this article) explains how to create OSGi bundle with PDE, how to run the OSGi container (Equinox) which manage a set of bundles (coming from Workspace + Target Platform) to start/stop bundle with OSGi console.
  • [step3] explains how to OSGi manage the dependencies between several bundles with Required-Bundle and Import-Package declared in the MANIFEST.MF and show in action the OSGi registry services which is used to share services between bundles (SOA Architecture).
  • [step4] explains how to use Servlet into OSGi context with OSGi HttpService. This article is interesting because it will explain how RAP Application works : RAP Servlet org.eclipse.rap.ui.internal.servlet.RequestHandler is called when URL is accessed.

In this article we create an OSGi bundle org.akrogen.dynaresume.osgiapplication which defines a simple OSGi Activator which displays in the System.out when the bundle is started and stopped. Here is a scheme which shows in action org.akrogen.dynaresume.osgiapplication managed with OSGi container (Equinox) :

Lire la suite…

Catégories:Eclipse RAP, Equinox

My first steps with Eclipse RAP [step1]

In [step0] I have introduced Eclipse RAP and explained why we have chosen Eclipse RAP for XDocReport. In this step, we will generate a RAP Hello World by using Eclipse PDE Wizard "RAP Hello World". At the end of this article we will be able to launch this WEB Application :

The goal of this article is to explain how to :

Generated code, RAP Target Platform… will be explained in the next articles.

Lire la suite…

Catégories:Eclipse RAP

My first steps with Eclipse RAP [step0]

mai 10, 2011 2 commentaires

I’m one of XDocReport developer which is a Java API to generate report with docx, odt. Our XDocReport JSP online demo doesn’t use any JEE framework. Only JSP is used and now we would like to use a JEE Framework. But which JEE Framework? Indeed,there is a lot of JEE Framework like GWT, Struts2, Play, Wicket, JBoss Seam…that’s cool but it’s hard to choose the best framework depending on the need of the WEB Application that you want to create.

Need of JEE Framework

For XDocReport case, we would like to provide a WEB Application with several features :

  • Rich UI: for instance to fill the XDocReport data-model form which is used to replace fields in the docx, odt document and generate report could be improved with pretty Rich UI. Rich UI means that you must use a well Javascript library which provides pretty UI widgets and support AJAX.
  • No Javascript to code: in my past I have developed several Rich UI (autocomplete, treeview, slider, swap…) in the JSControlsTags project. It was very hard and today I’m a lazy developer who we would like avoid developing Javascript code. So I’m looking for JEE Framework which provides Rich UI without coding Javascript. I prefer to manage my UI with Java code (ex : add listener to a Java widget instead of adding listener to a Javascript widget). Debug Java is more easy than debug Javascript even though we have great Javascript tools for a year (FireBug, Google Chrome…).
  • Plugin mechanism: for XDocReport we want to provide an extensible WEB Application, in other words provide a framework for reporting with commons features like upload a document, preview generated report and give the capability to extend the WEB Application for provide custom data-model form depending on the selected report. Extend the WEB Application with plugin system could be used for instance to develop a resume WEB Application which manage resume (create resume in a DB, generate resume…) like Dynaresume.
  • OSGi support which help a lot to have extensible application. Register/Unregister service gives you the capability to have a modular application.
  • Fat client : XDocReport want to provide 2 types of application : WEB Application and Fat client. Since I’m lazy developer I’m looking for a Framework which manage the both and use the same Java code for the 2 types application. This feature is called Single Sourcing.

Eclipse RAP

After studying several JEE Framework, we decided to use Eclipse RAP :

The Rich Ajax Platform lets you build rich, Ajax-enabled Web applications by using the Eclipse development model, plug-ins with the well known Eclipse workbench extension points and a widget toolkit with SWT API. Existing RCP applications can be run as Web applications with only minor changes.

You can play if you wish with our XDocReport RAP online demo.
Lire la suite…

Catégories:Eclipse RAP

Recevez les nouvelles publications par mail.

Rejoignez 169 autres abonnés