Dynamic Swing OSGi Demo

I am preparing a few talks about dynamic OSGi applications. To get my hands dirty I started a little demo project to showcase different scenarios. That SWT works very well with OSGi is obvious, since Eclipse RCP is based on OSGi. But there are not many Swing based OSGi applications out there. That’s why I started playing around with the dynamic creation and deletion of Swing GUI.

The demo application shows how to use OSGi Declarative Services (DS) and Spring Dynamic Modules (Spring DM) together with Swing UI (and the Swing Application Framework, JSR 296). The goal of this project is to share best practices when it comes to dynamic OSGi-based applications.

The project home page is http://max-server.myftp.org/trac/pm. There you find a bit of documentation and how to get the sources from svn. The current implementation works well with Equinox, I haven’t tried out other OSGi implementations yet.

I would appreciate if OSGi experts take a look at the source code and help me improving the code base. Here is a screen shot:

10 Comments

I agree that Swing apps using OSGi might dispel the myth that you need to use SWT. I put together a screencast and demo in conjunction with Neil Bartlett at http://www.eclipsezone.com/files/jsig/ for exactly that purpose. Of course as a live demo it couldn’t explore much but does give an idea of what it can do. Keep up the good work.

it includes a Swing based paint program in three flavours: one for each OSGi layer (modularity, lifecycle – extender pattern, services – whiteboard pattern) to show that you can pick and choose which parts of OSGi you want to use.

There’s also some low-level examples of dealing with service dynamics (we’ll be providing examples for the various component models like DS later on).

[…] Kai Toedter has written a demo application that shows how to use OSGi Declarative Services (DS) and Spring Dynamic Modules (Spring DM) together with Swing UI (and the Swing Application Framework, JSR 296). The Person Manager project is licensed under EPL. […]

Since I had some difficulties setting the target platform in 3.4.2 and your description of this important step is a one sentence hint i would think of pointing people to the preferences page of eclipse so no one else have the same problems starting to test your great app.
Link http://eclipsesource.com/blogs/2009/02/24/target-platform-changes/

[…] After lunch I attended a talk by Martin Lipper about general tips on OSGI. A point he made there was that in order to reduce coupling it is preferable to import bundles rather than require them. Also another good point was about extension points; one should not misuse them. For instance if we are not sure who wants to use some particular functionality we should better expose it as a service. Next talk was about the use of OSGI for dynamic application. A demo and discussion can be found at Kai’s blog […]