PAW - Process & Analytics Workbench

Playing with Data in PAW

This blog is about all the thoughts, features, decisions, and musings going into creating PAW - the Processing and Analytics Workbench for managing your data.

Saturday, February 12, 2011

Auto-Update Again

We have been using the Eclipse RCP framework as the basis for PAW. It comes with auto-update capability. However, as we started to use it, it becomes very complex- since as the developer, it's very hard to understand how the components are managed and when there's something wrong - what is wrong. We were also having to release changes as both updated installers as well as through the update mechanism for Eclipse. After a couple of issues that I spent weeks trying to debug and fix, I finally gave up on using the Eclipse P2 mechanism - it's too complicated, adds about 5-8MB to the download, and was making me spend more time on the framework than working on the product functionality.

Now, we're using the Eclipse OSGI mechanism to do installs and updates. It's much simpler to understand (the bundles are in clearly marked directories) and the API to make updates is much simpler.

TO INSTALL:
BundleContext.install('http://myserver/bundles/mybundle-1.0.0.jar')

TO UNINSTALL
bundle.uninstall()


The final program structure I came up with has a launcher which also comes with an installer. This runs with the OSGI bundle and some SWT libraries to show progress in a UI. It is basically something like this..


// create the framework
ServiceLoader loader = ServiceLoader.load(FrameworkFactory.class);
FrameworkFactory ff = loader.iterator().next();
Map config = new HashMap();
config.put("osgi.configuration.area", configDirectory);
config.put("osgi.user.area", workspaceDirectory);
config.put("osgi.instance.area", workspaceDirectory);
fwk = ff.newFramework(config);

// start it
fwk.start();

// do any installs and uninstalls
ctxt = frk.getBundleContext();
ctxt.install().....

// start the right bundle, then get the application and launch it
Runnable app = (Runnable)getService("myapp.id") // THIS IS PSEUDOCODE
app.run();

// finally stop the framework
fwk.stop()



That was roughly it to get the code working, and reduce the client footprint by 8MB - of Eclipse plugins that I wasn't using!

No comments: