RAP/Equinox WAR products
This document is a proposal for the GSoC 2010 project: WAR deployment for Equinox based applications and was created by Holger Staudacher as part of his GSoC application. This is a living document. Feel free to edit or add things.
WAR deployment for Equinox based applications
The purpose of the RAP project is to enable developers to build rich, Ajax-enabled Web applications using the Eclipse development model, plug-ins and a Java-only API. After completing a RAP application the next step is generally to publish the application on a web server, i.e. in a servlet container or application server. But this step, also known as deployment, sounds simpler than it is in the real world. When searching the RAP newsgroup for "WAR deployment" 210 threads appear. The reason for this is that many developers have problems deploying a RAP application. These problems exist because RAP products build on top of Server-Side Equinox. Equinox has special requirements for the deployable archive. To making things easier for beginners and to simplify the deployment process a good approach and tooling is needed. The goal of this GSoC 2010 project is to provide this approach and tooling.
How does this fit in the RAP context
RAP is probably the biggest consumer of the Server-Side Equinox technology. With this fact it's in the interest of the RAP community to have a good concept and tooling for users. This project will be mentored by the lead of the RAP team (Rüdiger Herrmann) and initially hosted at the RAP CVS. While doing this project as part of Eclipse RAP we can recognize user needs because there is a bunch of people at the RAP community which are interested in a good concept and tooling for deploying Equinox and RAP based applications. At a later stage, the results can hopefully be contributed to PDE (aka "Equinox Tooling"), though this is outside the scope of this project.
Why does Equinox have special deployment requirements?
While deploying a Server-Side Equinox Application, Equinox and all bundles required by the application need to be integrated in a servlet-contianer. The incoming requests must be forwarded from the Equinox instance to the participating resources. This creates certain requirements for successfully deploying an Equinox based application as a WAR. The requirements are:
- All dependencies need to be resolved for the bundles that are being deployed.
- The config.ini must be set up properly.
- The javax.servlet bundle must be excluded from the deployment.
- The servletbridge (both sides) must be present.
- A bundle that provides the HttpService must be present.
- The basic folder structure must be intact (WEB-INF folder, web.xml, etc.).
How can the deployment process be improved?
A good approach for building eclipse based applications is the RCP product approach. With this approach developers can create product configurations. These configurations are the basis for exporting RCP applications as executable products. To improve the server-side Equinox deployment process this approach can be adopted. A concept called the WAR product should be introduced. With this concept developers can create WAR product configurations which hold the necessary information for exporting an Equinox based application as a deployable WAR.
Having a good approach is one thing, but the right tooling is needed as well. Decent tooling exists for the RCP product. PDE comes with wizards for creating product configurations and for exporting a product. In addition, a configuration editor is available to help avoid syntax errors. Similar tooling for the WAR product will be needed. This tooling will make the deployment process much simpler and avoid errors during deployment. The following images show the RCP product tooling. This tooling can act as the basis for the WAR product tooling and will make RCP developers feel at home.
The goal of this GSoC project is to develop tooling to export server-side Equinox bundles in WAR files. The tooling should provide the following functionality:
- New WAR product configuration wizard
- Create a configuration, optionally from an existing OSGi launch configuration or from a basic set.
- WAR configuration editor
- Create the web.xml file.
- Add the servletbridge lib.
- Specify from where the web.xml file should be taken or alternatively where the WEB-INF folder resides.
- Start the export wizard.
- Offer validation for a given configuration
- Check that all dependencies are resolved for the bundles that are being deployed.
- Make sure the javax.servlet bundle is excluded from the deployment.
- Make sure the servletbridge (both sides) is present.
- Check that a bundle that provides the HttpService is present.
- Make sure the basic folder structure is intact (WEB-INF folder, web.xml, etc.).
- Create the deployable WAR file to a defined destination.
- Export Wizard
- Read and validate WAR configuration files
- Optional: Create a automated build script (ANT?) to make the deployment simpler.
The described functionality may change during the coding period.