Archive

Archive for the ‘Eclipse RCP’ Category

Eclipse RCP/RAP and Remoting with JAX-RS, Spring Data JPA and CXF DOSGi [step4]

juin 18, 2012 8 commentaires

In [step3] we have managed our UserService on Client and Server side with JAX-RS and Apache CXF DOSGi.

Embedding an HTTP server in Equinox

At this step the server side works with the HTTP Server Jetty which is an OSGi bundles. This mode is called Embedding an HTTP server in OSGi container : it means that HTTP server and WEB application are OSGi bundles. The OSGi container starts the HTTP server bundle. Embedding an HTTP server in Equinox explains how this mean is done with Equinox.

You can resume « embedding an HTTP server in OSGi container » like this :

OSGi container -> HTTP Server (bundle) -> WEB Application (bundle).

Equinox in a Servlet Container (ServletBridge)

It works great but sometimes you have not the luck to have an HTTP Server which supports OSGi like Apache Tomcat. For instance in our case, when we wished to deploy our XDocReport RAP Application on CloudBees, whish provides an Non OSGI HTTP Server Apache Tomcat.

Fortunatly, Server-Side Equinox provides Embedding OSGi container in a servlet container mode : it means that it’s a WEB Application which contains the OSGi container (and another bundles) which start the OSGi container. Equinox in a Servlet Container explains how this mean is done with Equinox.
You can resume « embedding OSGi container in a servlet container » like this :

HTTP Server -> WEB Application -> OSGi container.

To manage this mode you must create a classic WAR which hosts your OSGi plugins and ServletBridge. In this article we will explain how to create a WAR with our UserService on server side with the Eclipse Plug-In Libra WAR Product which was created for creating WAR from RAP Application launches. But it can be used too with OSGi launches (like we need in this article).

To create a WAR of CXF DOSGi application (server side), you must :

  • register your JAX-RS service with HttpService :
    <!-- HttpService -->
    <entry key="org.apache.cxf.rs.httpservice.context" value="/UserService" />
    
  • create a WAR which hosts OSGi bundles and ServletBridge. WAR Product gives you the capability to create a *.warproduct file from a launch (RAP, RCP, OSGi lanches, etc). This *.warproduct file is used to export it into a WAR to generate WAR.

At the end of this article we will create the the cxf-dosgi-jpa.war WAR. I have deployed this WAR on the CloudBees to see it on action. You can test for instance go at http://cxf-dosgi-war.opensagres.cloudbees.net/UserService/user/findAll to see JSON of the all users.

Lire la suite…

Eclipse RCP/RAP with Spring DM, Spring Data JPA and Remoting [step8]

avril 15, 2012 2 commentaires

In [step7] we have seen how to use Spring Data JPA to add custom methods to the Dao to manage criteria and pagination.

In this article we will implement a Rich Client with RCP Application to display User list in a SWT Table :

We will see how to we can consume the UserService by using Spring DM by using the SpringExtensionFactory from Martin Lippert.

Lire la suite…

Eclipse RCP/RAP with Spring DM, Spring Data JPA and Remoting [step0]

avril 5, 2012 3 commentaires

XDocReport project provides a modular Eclipse RCP/RAP XDocReport application where you can develop your own module with Eclipse Plugin to manage your domain with CRUD Form and generates some reporting. The online RAP demo provides for instance a Resume module to manage resume (create/update/search resume and generate report resume):

This application is based on :

  • Eclipse RCP to provide Fat Rich Client.
  • Eclipse RAP to provide the same application in WEB mode
  • Eclipse Gemini Blueprint to use Spring on OSGi context. This project is the donation of the Spring DM project to Eclipse
  • Spring Data JPA is used to implement our DAO with JPA. This Spring project is very impressive because you need not code your JPA Query. You must just follow some convention name with your methode DAO interface and that’s all! Spring Data JPA implements (at runtime) for you the JPA DAO.
  • Eclipselink used as JPA Implementation.

You can find sources from this Eclipse RCP/RAP application on Git.

Our 2 next goals is :

  • manage remoting to provide too Client (RCP Client) and Server (Services on server side) architecture. To do that we have several solutions like :
  • use Eclipse E4 instead of Eclipse RCP as soon as Eclipse RAP will support Eclipse E4.

We spent much time to study how to manage those technologies together but today we like this architecture. Goal of my « Eclipse RCP/RAP with Spring DM, Spring Data JPA and Remoting » articles is to explain step by step how to develop a simple Eclipse RCP/RAP with those Spring technologies, shares several rules that we have discovered with Spring on OSGi context, and manages 2 architectures :

To follow those articles, you must know OSGi, Eclipse RCP:

You can read the next article [step1] which explains how to initialize Spring DM.

Eclipse Nebula Pagination Control

janvier 6, 2012 13 commentaires

In business application with large data, display data in a table with navigation page can be really helpful. In our XDocReport project, we need this feature in our Eclipse RCP/RAP XDocReport application for instance to select resumes to open in the Search Resume Dialog :

This last screenshot is the resume search dialog in WEB context (Eclipse RAP). Here a screenshot in fat client context (Eclipse RCP) :

After several search, it seems that there is no project which provides a SWT pagination control, which works with Eclipse RCP and RAP. So we decided to develop this control and give our code to Eclipse Nebula Project. Today Nebula Team are voting if the project will be accepted or not. Pagination control was accepted by Nebula and today it is stored on Eclipse Nebula Git.

If you are intersted you can read the original bug 367064.

Lire la suite…

Eclipse Nebula Picture Control

janvier 6, 2012 5 commentaires

In some business application, your model (domain) contains sometimes image byte array (ex : photo for person model, logo for project model, etc). In our XDocReport project, we need to manage photo byte array with SWT control for the person model in our Eclipse RCP/RAP XDocReport, in the resume editor :

This last screenshot is the resume editor in WEB context (Eclipse RAP). Here a screenshot in fat client context (Eclipse RCP) :

After several search, it seems that there is no project which provides a SWT picture control, which works with Eclipse RCP and RAP. So we decided to develop SWT PictureControl and give our code to Eclipse Nebula Project.Today Nebula Team are voting if the project will be accepted or not. Pictur control was accepted by Nebula and today it is stored on Eclipse Nebula Git.

If you are intersted you can read the original bug 365948.

Lire la suite…

My first steps with Eclipse RAP [step7]

août 8, 2011 13 commentaires

In [step6] we have seen how to manage UI with SWT Java code (no need to code Javascript). When I started « My first steps with Eclipse RAP » articles, I used Eclipse Helios which provides RAP 1.3. Since June 2011 Eclipse Indigo has been released and provides RAP (runtime and tooling) 1.4 which improves RAP. So, I decided to start over my articles with Eclipse Indigo to benefit from New & Noteworthy of RAP 1.4. In this article we will :

At the end of this article we will compare the two generated RAP and RCP Application code to see the differences between RCP and RAP Application. We will use this comparison in the [step8] to manage RAP (WEB Application) and RCP (Fat client) application with the same code (Single Sourcing).

Lire la suite…

Catégories :Eclipse RAP, Eclipse RCP

Conception d’un client Eclipse RCP et serveur OSGI avec Spring DM [step13]

janvier 8, 2010 5 commentaires

Dans le billet précédant [step12] nous avons initialisé le client RCP qui affiche une liste statique de Users.

Dans ce billet nous allons faire appel au service UserService pour afficher la liste des Users. Un bouton Refresh Users permettra de rappeler le service UserService pour rafraîchir la liste des users :

Pour récupérer le service UserService dans la View, nous utiliserons 2 techniques possibles :

Nous montrerons aussi comment créer des launch qui permettent de lancer :

  • l’application RCP en tant que Client lourd (les services sont dans le même conteneur OSGi que l’application RCP).
  • l’application RCP en tant que Client (Serveur) qui fait appel à un serveur pour utiliser les services.

Lire la suite…

Conception d’un client Eclipse RCP et serveur OSGI avec Spring DM [step12]

janvier 5, 2010 6 commentaires

Dans le billet précédant [step11] nous avons vu mis en place Spring Dynamic Module coté client et serveur. Dans ce billet et le suivant nous allons nous concentrer sur la mise en place d’un client Eclipse RCP qui consommera le service UserService pour afficher la liste des Users dans une View.

Dans ce billet nous allons initialiser le client RCP avec une View qui affichera une liste statique de Users (sans faire appel au service UserService) :

Autrement dit, ici nous ne ferons pas appel au service UserService (Full Client/ Client- Server) via Spring DM pour récupérer la liste des User. Notre application RCP dans ce billet dépendra uniquement de notre bundle Domain org.dynaresume.domain qui contient la classe User.

Dans le billet suivant nous expliquerons comment appeler le service UserService comme ce que nous avons fait dans le client simple OSGi org.dynaresume.simpleosgiclient. Ceci permettra d’expliquer comment utiliser Spring DM dans une application RCP.

Lire la suite…

Catégories :DynaResume, Eclipse RCP, OSGi

Conception d’un client Eclipse RCP et serveur OSGI avec Spring DM [step0]

novembre 8, 2009 1 commentaire

Il y a 3 ans j’ai créé le projet GestCV, une application WEB de gestion de CV basé sur Spring, Hibernate, Struts1.x et AJAX. A cette époque je souhaitais utiliser et mettre en évidence toutes les technologies que j’adorais dans un véritable projet.

Aujourd’hui j’ai décidé de me former au développement d’applications Eclipse RCP basé sur les API SWT et JFace que j’ai découvert à travers le développement du plugin Eclipse Akrogen, du projet TK-UI et JFace DOM Databinding. Eclipse RCP me séduit de plus en plus pour les raisons suivantes. Avec Pascal Leclercq nous avons créé ce mois-ci le projet DynaResume OSGI GestCV qui est une version RCP de GestCV (le projet est en phase d’étude). Plus exactement ce projet est basé sur une architecture client/serveur, autrement dit :

  • la couche serveur fournira les services utiles pour la gestion de CV (édition d’un CV, création d’un CV).et sera basée sur OSGI via Spring DM. Les services feront appels à la base de données via Hibernate.
  • la couche cliente sera une application Eclipse RCP qui consommera les services hébérgés sur le serveur.

Nous souhaitons utiliser OSGI dans la couche serveur pour démarrer/arrêter à chaud les services sans devoir redémarrer le serveur (très utile en développement comme en production). OSGI fournit d’autres avantages que je tenterais d’expliquer tout au long de ces billets. Je ne sais pas si nous aboutirons ce projet mais mon but premier est de me former aux technologies OSGI, Spring DM, RCP et de les expliquer par des exemples concrets et détaillés dans des billets.

Mon idée est de rédiger des billets qui expliqueront pas à pas comment réaliser une application Eclipse RCP qui communique avec un serveur OSGI avec Spring DM. Concrètement je vais tenter d’expliquer comment développer une petite application RCP qui affiche/met à jour une liste d’utilisateurs récupérée par des services (OSGI) hébérgés sur le serveur. Je tenterais en même temps d’expliquer l’interêt d’OSGI.

Nous avons aussi envisagé d’étudier plus tard (selon notre temps) ce que peut nous fournir le futur projet Eclipse E4 (moteur CSS (qui est à l’origine celui de projet TK-UI ), Modeled Workbench, SWT Flex…) et RAP (qui d’après ce que j’ai compris permet de déployer l’application RCP en mode WEB ).

Si le sujet vous intéresse, vous pouvez accéder à la série de billets intitulée Conception d’un client Eclipse RCP et serveur OSGI avec Spring DM .

Lire la suite…

Catégories :DynaResume, E4, Eclipse RCP, OSGi, Spring DM