woensdag 24 november 2010

NullController pattern - how to evolve a complex RCP Eclipse client application


Many tutorials and quite a number of books describe how to get started in Eclipse plug-in development. It is only when trying to apply all of this new found knowledge to real world business applications that things get complicated.

Gradual increase of complexity

The main problem during development of large systems is that all parts evolve in parallel: that database schema, the business logic on the servers, the EJB connection code and the RCP client. So it's time to think about what John Gall, much quoted author on System Theory, wrote:
“A complex system that works is invariably found to have evolved from a simple system that worked. The inverse proposition also appears to be true: A complex system designed from scratch never works and cannot be made to work. You have to start over, beginning with a working simple system.”
That is the inspiration for this blog post: you have to start simple and get it to work, then evolve from there. In this blog entry I will share how with a little forethought you can make you RCP client application easier to develop and test. With RCP client application I mean a front end for a large server based business application where multiple users access real time data using an Eclipse RCP based client. All business logic takes place on the server, the client provides a view to the current data and allows users to modify that data.

Basics: Split between UI and Core plug-ins

A good practice is to divide up your functionality in two plug-ins: one to handle most logic, called the Core plug-in, and another containing all code that requires a UI, called the UI plug-in. Only the UI plugin has a dependency on the eclipse GUI framworks: org.eclipse.swt, org.eclipse.jface, org.eclipse.ui and org.eclipse.ui.workbench.
You can check this using the PDE dependency view.

NullController Pattern

The split between UI and Core is also called the Model View Controller or MVC pattern. Basically the UI subscribes to data updates and translates UI events that modify data into method calls to the controller. In Java terms: the controller in Core has subscribe() and unsubscribe() methods that take an application specific listener interface as parameter.
The trick is to make the location of the controller indirect via a Factory, so it can evolve in complexity over time.


The AbstractController includes the code to handle subscribe() and unsubscribe() of one or more views. It probably also contains the code to broadcast new or changed data to the views.


The NullController implementation is the simplest possible form of the interface. All action method calls do nothing and all query methods return either null or, when collections, empty instances (so all iterators in views work).
With this controller you can work on the UI view and button layout and do simple developer testing for button and menu enablement.


The StubController implementation is one step up in complexity. It is entirely resident in the client. All action method calls just provide expected feedback and all query methods return a simple local generated date object or collection. With this controller you can refine the UI interaction by allowing commands based on selection contents and implement selection service code. In this stage you can also demonstrate the UI to customers and users and start the development of training as the perceived behavior of the client will not change much.


The LocalTestController implementation links the UI data objects directly to local server code, but without the intermediate EJB layer. Here we can test whether the data in the data objects is filled consistently from the underlying databases.


When the above all works correctly it is time to insert the EJB layer. Create the J2EEController and deploy the EAR on a test server and then do the final testing using the RCP client.

Next time

I will fill out these basic steps with some code examples to show in more detail how to implement this.


Sample code for this post is available at Github.

maandag 22 november 2010

Eclipse Demo Camp Antwerp approaching!

30 November Eclipse experts and enthusiasts from Belgium and The Netherlands will gather in Kontich near Antwerp to attend Eclipse Demo Camp November 2010/Antwerp.
In prior years it was more of a Netherlands only event, but now it is a combined effort of Industrial TSI and SmartApp.

The presenters currently scheduled are:

  • Ralph Mueller, Eclipse Foundation: "You know the past, can you guess the future of Eclipse?"
  • Ralf Sternberg, EclipseSource: A talk from the Eclipse Summit 2010: "A look ahead at RAP: what's new now and will be noteworthy in the future"
  • Oliver Wolf, Product Manager and Architect at SOPERA GmbH: "SOA at Eclipse"
  • Wim Jongman, Industrial-TSI: Eclipse Mashup: How we use Eclipse Technology to stay ahead.

Previous events were well attended, for a brief photo impression see here for 2010 and 2009.

The number of already registered attendees is currently 17. So when you live or work in the Netherlands or Belgium and you have involvement with Eclipse in general, or Rich Web applications or Service Oriented Architecture in particular, please come and join us next week Tuesday. More information is available here and you can register here.

dinsdag 3 augustus 2010

Where do all Eclipse and Equinox names come from?

What does a year on Earth really look like?

If you wan to know what the names Eclipse, Equinox and others really mean outside our little ecosphere, please have a look at this from Best of YouTube.

It can also give you inspiration for naming your project if you don't want a TLA.

vrijdag 25 juni 2010

Eclipse Demo Camp Nieuwegein

On June 23 there was an Eclipse Democamp at Industrial TSI in Nieuwegein to celebrate the launch of Helios.As usual Yuri Kok, owner of the Dutch Eclipse User Group on LinkedIn managed to organize all the necessary ingredients like advanced networking facilities, an expectant audience of about 40 people and a number of speakers.

KEYNOTE: Wim Jongman, Helios & OSGi Remote Services

Wim Jongman introduced the new Helios release, which includes 39 projects! After that he quickly went to a demonstration of Eclipse Remote Services, and the Zookeeper discovery mechanism implementation that Remain BV (co-host of the event) has contributed to the ECF. This was a very nice demonstration that included a new widget: the "osgiloscope".

Olivier Wolf, "SOA at Eclipse -- the Eclipse SOA Initiative"

Oliver Wolf of SOPERA next introduced us the SOA Intiative at Eclipse,describing the role of community and industry working group, the split between modelling and runtime, what projects are part of the SOA Initiative and more. Revelaing was his slide that showed what areas still need to be filled in.

Drinks and slices

Always an important part of an evening gathering, this was organised splendidly: a choice of pizzas and drinks!

Ief Cuynen and Tom Bauwens, SmartApps - Single-sourcing demo Eclipse RCP / RAP

RAP and RCP are both part of the Helios release and have reached maturity. Tom showed a real life application where the shared code base and the very rich display on both the web and RCP were amply demonstrated. He also offered tips on organising your code using plugins for the shared stuff and fragments for the RCP or RAP specific stuff.

Jelle Herold, Stream BV - Statebox & Typewriter

After telling us about statebox, a process modelling and runtime engine, last time, this time Jelle described the typewriter library.Because statebox needs to work with data and types from all sorts of systems, many of them non-java, using java.lang.reflect was not an option.
Jelle's solution is an interface only reflection API, with implementations for Java (obviously), Swing, Wicket, Drupal, Solr and JFace.
He invited us to look at and use his code http://bitbucket.org/wires/typewriter.He can be contacted at jelle AT defekt DOT nl

Olivier Wolf, "Eclipse Swordfish -- Service-oriented software development made easy"

Oliver had brought a second presentation about Swordfish, a SOA engine part of the Eclipse SOA Initiative. To show us some examples he demonstrated their use of the new Discovery UI API part of Helios, that is also used by Eclipse Marketplace and Mylyn Connector discovery. We see the already(!) familiar Discovery UI, followed by the Installation part. Then he had the audience stunned by the popup of a compulsory registration dialog! See below:He then went on to explain that this was all rather simple, just using p2 requirements to download the registration code from the server and p2 touch points to invoke this code before proceeding!He promised to explain all in a blog post soon!

Doru Gardan, ST-Ericsson - "Hardware debugging on a Digital Signal Processor"

To remind us that not everyone is on the latest and shiniest new release of Eclipse. He demonstrated their customised C-compiler and debugger stuff running in Ganymede. He compiled a demo program and ran it on the hardware with chip attached to his laptop.


Eclipse is doing well in the Netherlands, but we still need to go a long way for all users to interact and be aware of the community aspects. So all in all an informative evening that was very well hosted by Industrial TSI. Thank you, Yuri and all your colleagues!

maandag 7 juni 2010

Getting started with Hudson & Eclipse

Why automated build?

After reading these two blog posts by Andrew Niefer here and here I understand that there is simply no way to build a custom updatable RCP application manually from Eclipse. The export options are too limited so I opened bug 316059 to make this exporting easier.

Why Hudson?

As the Eclipse building infrastructure itself is employing Hudson I expect that automating the build of RCP applications will be possible with Hudson. The first step is to download Hudson from hudson-ci.org. I installed it on my Mac in /usr/local/hudson/.


I don't like starting up Terminal to manually start it everytime so I created a LaunchAgent for it. Place the following plist xml in file /Library/LaunchAgents/org.hudson-ci.agent.plist and Hudson will start automagically every time on login.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
<plist version="1.0">

I employ one POJO jar in my RCP app and I managed to set this up in a few hours to extract from CVS, run checkstyle, findbugs, junit tests, emma tests code coverage and do final build. Next time I'll cover building a an Eclipse feature and update site.

Moving HUDSON_HOME (Added on 2010 06 11)

After some time I noticed that my home directory was increasing in size, leading to rapid and longer TmeMachine backups. I like the backups of my development tools to be different and under my direct (script) control so I needed to move the Hudson home directory. Luckily this can be done easily!

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
<plist version="1.0">
<!-- Moving HUDSON_HOME to /_some_other_volume_/Hudson/ -->

Now copy everything using terminal:

$ cp -pR .hudson/ /_some_other_volume_/Hudson/
and restart Hudson.

$ ps -lA | grep hudson
501 _XXXX_ 565 4004 0 47 0 2972192 212840 - ↵
→ S a9a87e0 ?? 0:40.14 ↵
→ /usr/bin/java -jar /usr/local/hudson/hudson.war --httpPort=9090
$ kill _XXXX_
$ sudo launchctl list

Then try in your browser: And now everything appears to be located in the new location!

zaterdag 29 mei 2010

Bug 184532 RESOLVED: Industrial Connector moved to Eclipselabs


The Mylyn project has grown tremendously and taken on new directions since bug 184532 [connector] Generic SQL connector was opened in 2007. Widescale adoption and praise for Mylyn and the foundation of Tasktop was followed by the release of many commercial connectors.
As Mik has pointed out elsewhere, the Mylyn dev team simply does not have the resources to maintain the many contributions offered, one of which was this SQL connector.
This is the only way for the Mylyn project to stay in innovation mode, stay out of maintenance mode! We understand and respect that decision as we too will benefit from that innovation.

The Industrial SQL Connector for Mylyn does have an active though not very visible user community as it is the basis of the Mylyn connector of the commercial software change management product of Remain Software.

As can be seen from the entries in bug 184532 mentioned above also some people have used the Industrial SQL Connector to create connections to their in-house SQL based systems.

Move to Eclipselabs.org

For this reason we have decided to take the opportunity to join the newly formed Eclipselabs.org with code hosting at Google code, and no longer actively pursue becoming part of mylyn core. There we will have our own dedicated Wiki, issue tracker, SVN repository and update site, so we no longer have to free ride on the eclipse.org infrastucture.
As a consequence the projects and packages will be renamed to get rid of the org.eclipse.mylyn.* prefix and revert back to com.industrialtsi.mylyn.*, but will keep the EPL as license.

The new location for the project and source code is here:

We will be updating the Wiki and blog in the days to come. We fixed some more bugs, upgraded the version to 0.9.6 and offer a preliminary update site here:

We are also present in the Eclipse Marketplace to be ready for Helios release here:

The above is an edited and more elaborate version of the closing comment on bug 184532.

dinsdag 11 mei 2010

Preparing for Helios & Eclipse Marketplace

Have you also created plugin that you want to make easy to install? Then make sure your plugin is listed at Eclipse Marketplace and add the feature ids of the base install from you site.xml. 5 minutes work that make it a lot easier for your users!

Upcoming Eclipse Helios release

I received a mail recently from the ever active Lynn Gayowski, the Marketing Events Manager for the Eclipse Foundation.
The upcoming Helios release is one huge event and everybody in the eco system can be involved, either by testing the milestones or by preparing for one of the exiting UI improvements in Helios: the Eclipse Marketplace client.

Eclipse Marketplace client

The Eclipse Marketplace is the website where you can find hundreds of plugins and RCP applications that will make your work easier: special purpose editors, task management, source code control, ...
Until now you could lookup a plugin on the marketplace and then use the update site for that plugin to install it in your eclipse.
A complicated process that involves webbrowser, search, copy, eclipse, add update site, paste, select, install, restart. This quickly adds up to several minutes. In Helios this is all replaced by a single menu selection Help/Eclipse Solution Catalogs.

Only 5 minutes to set up!

Lynn requested that I provide information to make this client also show the Industrial SQL Connector for Mylyn that I have blogged about here in the past. The steps to take are clearly described here. It is basically copying the feature id's from your site.xml to the data in the market place.

All in all it took me just 5 minutes to set up for two solutions I manage, including editing the descriptions in HTML to look nice in the information hover, and adding an image. Thanks for the tip Lynn!

maandag 18 januari 2010

Eclipse Function keys in Snow Leopard

I recently upgraded to Mac OSX Snow Leopard and was really sorry that I lost all the Eclipse function keys, as they are reassigned for the OS: Show Dashboard, brightness up/down, etc. Luckily I soon discovered this option in System Preferences for Keyboard:

Luckily it also work the other way around, so you can keep f4 to mean Dashboard, but use fn+f4 to do Show Hierarchy.