Case study: Eclipse Rich Ajax Platform Use at CAS Software AG

Introduction

CAS Software AG is a software company based out of Karlsruhe, Germany which was founded in 1986. They are experts in the domain of CRM (Customer Relationship Management), specifically in the SME (Small-Medium Enterprise) sector. CAS Software has earned recognition over the years for their software products in the CRM domain including specialty CRM products for education, auto dealerships and member based organizations and associations.

Most recently CAS Software has been working on a product called CAS PIA (Personal Information Assistant) which will be a SaaS (Software as a Service) offering, the first such offering from CAS. It is built on a number of technologies which will be discussed in more detail later. This case study will take a focus on Eclipse RAP (Rich Ajax Platform) and how it was applied to the architecture of CAS PIA, as well as some interesting uses for RAP, lessons learned by CAS while using it, and future directions for their products.

Domain

CAS Software AG develops CRM (Customer Relationship Management) software for the freelancer and SME (Small-Medium Enterprise) sector. The audience that CAS is targeting currently tends to not use specific CRM applications, instead they tend to use a mix of tools and applications to track their customers, marketing, etc. However, CAS believes there is a great demand for software that helps manage customer information in a central and easily accessible manner. There are desktop applications available for specific industries but they tend to be very narrowly focused on CRM only features. By using technologies such as Eclipse RAP and Eclipse Equinox CAS PIA is able to deliver not only the "standard" CRM features, but also provide the ability to manage marketing campaigns, e-mail merges, personalized letters in a clean and modular package.

By making use of Eclipse RAP for the user interface, CAS PIA provides a desktop-like experience which quickly allows users to feel comfortable with the application. The user interface is designed with ergonomics in mind, making use of familiar widgets and behaviors such as drag and drop, all things users expect even from web applications. Additionally, the online functionality allows for all colleagues within a business to manage appointments, tasks and documents, as well as other important work flows and processes such as address transfer and route planning. In the following section, we’ll dive into the architecture developed for CAS PIA and how open source software played a vital role.

Solution Overview

CRM solutions have been around for years, both on the desktop and online, and in recent times have become quite feature rich. Users expect certain features and characteristics beyond the basics when working with these applications such as reporting, security, familiar look and feel, as well as, quick and responsive user interfaces. With the many expectations and requirements from users of CRM solutions, CAS chose to employ open source software as the basis of their solution.

CAS PIA is a web application designed to easily scale by utilizing several server instances which share the work load and provide redundancy. Each server instance runs Apache Tomcat, as the application server, which contains a RAP-based application layer and a server core. The application layer is responsible for displaying the user interface and handling user interactions, whereas the server core provides the business functions and database access.

CAS chose to go with a web based application so customers wouldn’t have to worry about installation, hardware costs and configuration, and security of their data. Also, the web based approach allows users to access CAS PIA from any location without having to install a thick client no each computer. The presentation layer that would be the front-end of the web application utilizes Eclipse RAP. The RAP project page describes it as a framework which enables developers:

to 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 (plus JFace).... RAP is very similar to Eclipse RCP, but instead of being executed on a desktop computer RAP is run on a server and clients can access the application with standard browsers. This is mainly achieved by providing a special implementation of SWT (a subset of SWT API). (http://www.eclipse.org/rap/about.php)

Below is a simple architecture diagram which compares Eclipse RCP to Eclipse RAP.

Eclipse RAP was utilized as the user interface in the presentation layer for CAS PIA for several reasons:

Look and Feel - they were able to build very rich, ergonomic, theme-able interfaces that were difficult to distinguish from a thick client.

Development Efficiency - the AJAX and JavaScript is baked into ready to use components which is hidden from the developer, allowing developers to code in Java with their familiar libraries and IDE.

Flexibility - although RAP allows developers to stay away from writing JavaScript, HTML and CSS, it’s flexible enough so that custom components and styles could be added without any issue.

Engineering Quality - Eclipse and their products employ best practice software design and practices, no exception with RAP.

Single Codebase - RAP can be compiled into an AJAX or RCP application.

The presentation layer also consists of an OSGi runtime which provides modularity and reusability amongst other CAS products. CAS chose the Eclipse Equinox project as their implementation provider for OSGi and is defined as:

...an implementation of the OSGi R4 core framework specification, a set of bundles that implement various optional OSGi services and other infrastructure for running OSGi-based systems.

More generally, the goal of the Equinox project is to be a first class OSGi community and foster the vision of Eclipse as a landscape of bundles. As part of this, it is responsible for developing and delivering the OSGi framework implementation used for all of Eclipse.

By taking advantage of the separation provided by Equinox, CAS has implemented core modules, which consists of multiple bundles, that are common components used in various applications. Each module provides various extension points which allows specific behavior to be implemented based on the application being developed. For example, a user management module could be used in many applications but a contact management module is more specific to a CRM related application. The flexibility provided by OSGi allows for modules to easily be extended and included (or not included) easily, such as during the build or deployment phases.

The other side of CAS PIA is the business logic and typical server-side related functionality referred to as the server core or EIM (Enterprise Information Management). The EIM was designed and developed to form the heart of a complete line of enterprise products being developed by CAS. The server core provides remote access capabilities through the use of Sun JAX-WS, RMI and REST services, which are all extensible in a modular fashion by their use of the Spring Framework.

The persistence layer uses MySQL databases but also contains custom components created specifically by CAS. The custom components provide an extensible data model, a specialized query language (CAS-SQL), and a permission management component. The permission management component relies on the ACEGI framework to authenticate the user with a corporate authentication service but then it provides ACL’s (Access Control List) for each object at the database layer. This custom permission system is similar to Oracle’s OLS (Oracle Label Security) but allows CAS to re-use it on other products that may use a database other than MySQL.

Unit Testing Eclipse RAP

Unit testing is an important aspect in any software development effort, even on the client side of the software. Many times, developers of the user interface portions of software applications find it difficult to unit test their code. Typically, this is because there is a mesh of presentation and application logic which makes unit tests complex to develop and maintain. The developers at CAS have put a lot of effort into keeping as much logic on the server as possible where unit testing is much more robust. However, not everything can be done on the server and this is where a solid UI design plays a major factor.

By implementing the user interface using common design patterns such as MVC, Presentation Model, Model View Presenter, etc the view is decoupled from logic which in turn allows unit testing to become an easier task. Even with a solid design there are additional issues to face, especially when testing a RAP user interface. First, RAP UI components consist of a Java layer and a JavaScript layer which means there are two sections of code to test. Qooxdoo, the Ajax application framework used by RAP, provides unit testing tools similar to functionality provided by JUnit and JSUnit. CAS has taken advantage of these tools to test the JavaScript layer of their custom components and they have used JUnit to test the Java layer. Below is a unit test provided by CAS that demonstrates testing the JavaScript layer of a custom component:

This particular test is looking for memory leaks potentially caused by the DateChooser component, one of the custom components developed by CAS. The MemoryLeakUtil class is a custom utility class created by CAS which makes use of several functions provided by Qooxdoo, such as listing all objects in memory. Using the functionality provided by Qooxdoo they can easily test for memory leak errors which are quite common in the development of custom JavaScript components. The second issue faced when testing RAP user interfaces is handling the asynchronous and dynamic state of the UI. There are several tools that provide the capability to record a users interaction with the application, store it as a script and allow it to be re-run over and over. This type of testing helps examine the behavior and interaction of the user interface as if a real user was maniuplating it, however they tend to have limitations. In their brief examination of web application testing tools to this point CAS hasn't found one that handles the asynchronous and non-page based user interface, again this an Ajax based application where content is loaded dynamically without having to change pages.

One area of unit testing that can also sometimes be an issue is testing the interaction with the server and/or data layers. Often times unit tests are written that directly communicate with the servers, databases, etc in order to properly execute their tests. This type of testing has drawbacks, which the CAS developers have experienced, most often revolving around the slowness of the unit tests because of the communication required with the other layers of the application. A common solution is to use mock objects which essentially stand in place of the "real thing" during unit testing. There are a variety of mock object frameworks for Java including Mockito, EasyMock and JMock which aim to simplify the creation of mock objects. There are also mock object frameworks availabel for JavaScript such as JSMock and Mock4JS.

Previously you saw an example of unit testing the JavaScript layer of a custom component, in a moment you'll see an example of testing the Java layer. As of Eclipse RAP 1.1 the framework essentially includes the equivalent to JUnit tests with the exception that it allows for tests to run which require an OSGi environment to be running. If you require unit tests which update the UI during their execution you can simply extend from org.eclipse.rap.junit.RAPTestCase. However, if visual updates to the user interface are not required for your unit tests then you can simply extend from the defacto JUnit org.junit.TestCase instead. Below is an example of a RAP test case that interacts with the UI:

This example demonstrates how the actual UI components are being tested to verify the number of visible views. This does provide a step in the right direction for unit testing RAP based applications, however it doesn’t provide automated user driven interaction. The ability to test the UI, by simulating a user clicking on a button or entering a value into a text field is something better left to other tools which CAS will be investigating in the near future.

Custom User Interface Components

Out of the box RAP provides a large subset of components found in SWT referred to as the RAP Widget Toolkit, or RWT, which should suffice many applications. However, when the need arises for something beyond "standard" Eclipse RAP supports the capability for developing and using custom components. The first thing to consider when developing a custom component is what type of component it will be, in RAP there are two distinguished types "compound" and "owner drawn". Compound components are just a combination of existing RAP components that are put together to provide new behavior or functionality in the UI. On the other hand, owner drawn components are components which originate in JavaScript and typically require a lot of heavy lifting and sometimes third party libraries. The RAP Developer Guide provides a step by step tutorial on creating an "owner drawn" custom component which outlines the entire process with screenshots and code samples. As mentioned in the tutorial there are four main steps in the custom component development process:

Create a Java implementation of the component which will run on the server.

Create a JavaScript implementation of the component which will run in the browser.

Create an adapter, in Java, which connects the JavaScript component with the Java component and the RAP lifecycle

Register the JavaScript files by adding extensions to the org.eclipse.rap.ui.resources extension point.

The developers at CAS had to create several custom components including a calendar, date picker, toolbar and an accordion navigation control similar to one found in Microsoft Outlook. The calendar and toolbar are examples of "owner drawn" components that were developed in JavaScript, with CSS and HTML, and translated into RAP components for use in CAS PIA. Qooxdoo does provide a wealth of functionality and abstraction to the development of components which eases the process. Shown below a screenshot which shows a couple "owner drawn" components, specifically a calendar and a toolbar.

As you can see the calendar component provides a lot of functionality such as the navigable mini-calendar in the upper-left hand corner, a navigable detailed calendar in the middle, the ability to add appointments and filter the calendar based on custom views (i.e. "All Appointments"). This particular component is made up of around 20,000 lines of code and required a lot of time and effort to implement. The other "owner drawn" component shown in the image above is the toolbar which provides functionality seen most recently in applications such as Microsoft Office and Microsoft Outlook.

An example of a compound component would be the time chooser which can be found in CAS PIA and is shown in the screenshots below.

This compound component is made up of several components including a Dialog, Buttons and Combo's which work together to make up the time chooser. Another thing that is noticable in the screenshots from CAS PIA is an overall style or theme to the application. RAP provides theming through the use of Cascading Style Sheets (CSS) and requires extensions to be added to the org.eclipse.rap.ui.themes extension point in the plugin.xml file for the application.

When developing custom RAP components there are several things to think about and keep in mind during the design and development phases. First, to get started there is bit of a learning curve for developers who will need to be familiar with HTML, JavaScript, CSS and Qooxdoo in order to develop custom components. I mention this because one of the benefits of RAP is that developers can write Java code and are able to stay away from JavaScript, which is true except in the case of custom components. Secondly, developers are required to do whatever is necessary to provide a functioning component across various browsers. The developers who have written the core components that are included with RAP have gone to great lengths to ensure browser compatibility and in a future release of Qooxdoo there is expected to be significant enhancements to abstract the browser compatibility issue away from component developers. Finally, one other thing to keep in mind is that the version of Qooxdoo that is included with RAP is not the same as you might download from their website. Instead the developers of RAP have chosen to include a subset of Qooxdoo which still provides required functionality but allows them to reduce the overall size of the framework. Ultimately this means that certain functions and classes may not be available to RAP developers which appear in the Qooxdoo API.

Issues Experienced During Development

As with any technology that is new to developers there are bound to be learning curves and issues along the way. During the development of CAS PIA the development team ran into several problems related to performance and deployment.

The first issue they ran into immediately was poor performance and high resource consumption on both the client and server sides. CAS was able to make some improvements by implementing object pooling and caching which enabled the reuse of GUI controls instead of creating them again and again. These home grown solutions completely removed their issues related to performance and resource consumption, however, it wasn't enough to completely erase their performance issues in Internet Explorer which has prevented CAS PIA from supporting it. CAS is confident that near-term improvements to the Qooxdoo framework and the upcoming release of Internet Explorer 8 will provide reasonable performance and allow CAS to support IE. On the other hand, other browsers most notably Firefox, have recently been improved in ways that have continued to increase performance and decrease resource usage on the client side.

Another issue that caused some pain was building and deploying the RAP component of the application by using a continuous integration (CI) build process. This was only an issue because CAS chose to deploy Eclipse Equinox into Tomcat, as opposed to embedding the web server into the Equinox runtime. On the build side of the issue, CAS uses the Releng-Tools from Eclipse which allows for automated nightly builds, however, they found that there was very little documentation and a lot of magic with the use of Ant (i.e. dynamically generated build scripts). It took lots of log monitoring and trial and error to eventually get things tweaked to the point that nightly builds were up and running.

At the same time CAS had to work through issues with deploying Equinox into Tomcat. The suggested solution for this configuration is to generate a single WAR file which includes all business bundles plus the runtime environment, Equinox and RAP. However, CAS PIA also required that the EIM, which is a a non-OSGi component, be integrated with the RAP part of the application so that both parts could communicate directly without using web services or RMI. There were two steps taken to resolve this issue, first they had to put the EIM server component into the "lib" directory of their WAR file. The second step involved special configuration of the servlet bridge in the web.xml file of the application. Specifically CAS made use of the "extendedFrameworkExports" parameter of the servlet bridge which allowed the EIM and RAP components to be integrated as required.

Lessons Learned

CAS Software is very active in developing and deploying Eclipse RAP applications, and even with the issues they experienced in getting started they have enjoyed working with Eclipse RAP. They have found their developers have become quite productive with it, primarily because the Java developers are used to the Eclipse IDE, debugging support and component model.

Once CAS worked through the issues mentioned above and the generally steep learning curve, everyone enjoyed working with RAP. The only feature CAS hopes RAP will provide in the future is the ability to trigger actions in the client from the server. Currently CAS PIA uses a homegrown solution for which is not the ideal resolution, but CAS is optimistic with regards to the future of RAP.

Future Directions

CAS Software AG is currently leading the CRM market in the Small-Medium Enterprise segment and they plan on expanding that lead into all of Europe by 2010. CAS PIA will begin to see marketing and promotion ramping up during the first quarter of 2009. The end goal is to be the leading European provider of SaaS CRM for companies up to 20 seats.

CAS will continue their strong commitment to using and supporting Eclipse RAP, in fact CAS will be teaching a RAP course in February 2009 at the University of Szeged in Hungary.

"The only feature CAS hopes RAP will provide in the future is the ability to trigger actions in the client from the server."

Could you please give an example of what kind of such features you would like to implement that isn't now possible with RAP? I once made a prototype application that could send server notifications to the client from time to time, which the client displayed on its status area.

thanks for your comment. The quote "The only feature CAS hopes RAP will provide in the future is the ability to trigger actions in the client from the server" is a bit misleading. RAP provides the so called UICallbacks which allow the server to push information to the browser client. In CAS PIA we use UICallbacks for several features, e.g. notifying the user about a newly arrived e-Mail.

In (local) testing environment the UICallbacks work well, but in production scenario there arise some problems with them: For example the client-side request needed for the callbacks is blocked by some HTTP proxies. A second problem is that long-running callbacks (for example the mail notification callback) can "die" because of connection losses or protocol timeouts. Because RAP uses one XmlHttpRequest for all registered UICallbacks and because this request isn't restarted after interruption, all data sent from server to client by all the different callback actions doesn't arrive at client side any more.

In summary for short-time server-to-client-actions we still use the RAP UICallbacks, but we avoid long-running ones.

Is your profile up-to-date? Please take a moment to review and update.

Email Address

Note: If updating/changing your email, a validation request will be sent

Company name:

Keep current company name

Update Company name to:

Company role:

Keep current company role

Update company role to:

Company size:

Keep current company Size

Update company size to:

Country/Zone:

Keep current country/zone

Update country/zone to:

State/Province/Region:

Keep current state/province/region

Update state/province/region to:

Subscribe to our newsletter?

Subscribe to our industry email notices?

You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.

We notice you're using an ad blocker

We understand why you use ad blockers. However to keep InfoQ free we need your support. InfoQ will not provide your data to third parties without individual opt-in consent. We only work with advertisers relevant to our readers. Please consider whitelisting us.