The Eclipse Rich Client Platform

Now that we know what a rich client platform is, let's see in more detail what features the Eclipse RCP provides.

OSGi framework implementation

Eclipse RCP provides Equinox, an implementation of the OSGi framework. The OSGi framework, according to its specification document, provides a general-purpose, secure, managed Java framework that supports the deployment of extensible and downloadable applications known as bundles. Equinox provides to your client application all the infrastructure it needs to be a modularized application that can easily ship and orchestrate pieces of software from various origins.

The functionalities that the OSGi framework specification provides can be divided into different layers. Let's see these in detail.

The module layer

The module layer extends the Java platform to provide packaging, deploying, and validating services to Java-based projects. This layer defines a unit of modularization named bundle, which contains the necessary resources to provide a certain functionality. Once loaded, a bundle can also provide services to other bundles through the OSGi service platform. Bundles translate to plugins in the Equinox implementation.

Bundles are JAR files with a specific format and content. They must contain a MANIFEST file, which determines what the bundle provides to other bundles, the services it provides for the end user, and the resources that must be available in order to load the bundle.

The life cycle layer

The life cycle layer determines the API (Application Programming Interface) that provides services to manage all the phases of a bundle's life cycle, such as installation, starting, stopping, updating, and uninstallation. Before installation, the bundle is verified for a number of errors, such as compatibility between the bundle and current execution environment and the previous installation of the bundle with the same name and version. If no errors are detected, the bundle is considered valid and can be installed in the OSGi framework. Once installed, the bundle can be started. Before starting a bundle, the OSGi framework must resolve it, which means verifying if all of the bundle's dependencies are met in the current OSGi service platform. The bundle is started by calling its Activator object, which is determined in the MANIFEST file. When the bundle is stopped, all of its resources must be released and the services it provides must be unregistered. Uninstalling a package notifies other bundles about the removal of the bundle and removes every resource associated to it from the persistent storage.

The service layer

The service layer defines the model through which bundles share functionalities between themselves. This layer is tightly integrated with the life cycle layer, as it determines how the bundles' state modifications, such as installation, starting, and stopping, should notify other bundles about its services. Bundles can register or unregister services at any time. Once registered, other bundles can search for that service and utilize them.

The security layer

The security layer is an optional layer that adds security services based on the Java 2 specification. In general terms, it specifies how JAR files that represent bundles (plugins) must be signed so that their authenticity can be verified. This includes determining which signing algorithms can be used and where hash files must be placed in the JAR file, among others.

SWT

The Eclipse RCP provides the Standard Widget Toolkit (SWT) to supply you with all the building blocks you might need to create your application's user interface. This means that every widget presented in Chapters 5, SWT and Chapter 6, More SWT can be used here.

JFace

JFace is a user interface framework that goes on top of the widget toolkit. Its main objective is to make UI programming easier and increase code reuse by providing the following among others:

  • Bigger building blocks than the ones provided by SWT, such as wizards, dialogs, and context help menus
  • Image descriptors and registry, lifting the developer from the obligation of loading, and managing and disposing images
  • Viewers that help populating, sorting, and updating widgets

JFace does not intend to completely hide SWT. It allows the developer to choose between using JFace or SWT directly, depending on what is more convenient in each situation. While JFace is completely dependent on SWT, SWT does not depend on JFace whatsoever.

We have already used some of the JFace features in Chapter 8, Eclipse Development. We utilized the MessageDialog class to display the hello world message without having to worry about creating the dialog and adding its elements, such as the OK button, the information icon, and the message itself. We have also used the ITextSelection class to get the text selected in a text editor.

Eclipse workbench

The Eclipse RCP also allows the Eclipse workbench to be utilized in client applications. You can re-use Eclipse's toolbars, views, editors, and perspectives according to your needs, as well as make custom ones specifically for your application, extending existing Eclipse classes, or making them from scratch. Given that, everything we saw in the Creating New Views section of the previous chapter is also valid here. You will have the whole underlying platform that's required to display and manage the arrangement of these UI elements.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset