Eclipse:osgiDS

From RifidiWiki

Revision as of 22:23, 11 May 2008 by Jochen (Talk | contribs)

Jump to: navigation, search

Intro

Getting declarative services into Eclipse RCP was quite a fight but with the help of some fellows from the #eclipse irc channel I finally managed to get 'em up and running.

Prerequisites

First we need to get some missing plugins.
The declarative services spec is part of the services for OSGI R4 but it is not part of the equinox that is distributed with eclipse 3.3.
So we need to go here:[1]

  • Under latest releases select 3.3.2
  • Scroll down to "Incubator" bundles
  • download org.eclipse.equinox.ds<whateverversionisthere>.jar (this is the declarative services plugin)
  • download org.eclipse.equinox.cm<whateverversionisthere>.jar (this is the OSGI admin service)
  • add the downlaoded packages to your plugins directory
  • restart eclipse

How to get it into your RCP

Now comes the tricky part.
Being used to eclipse you would think adding the plugins to your run config and then firing up your app should do the trick.
Nope, as you might have guessed, it's not that easy.
Right now we need to get our hands dirty as we have to directly have to modify the config.ini.
For a regular RCP application you don't have to touch this file and eclipse will create one for you on every run.
But we actually want to use some fairly advanced features of the underlying osgi implementation and that's where we leave the default way.
Open up the run configuration for your RCP app.

Runconfiguration.jpg

The red box shows where you have to edit.
But before it starts to get messy we need a config.ini template tow ork on.
Above the red box you can see a hook at default location. Go to the specified directory and pick the config.ini that is in there.
Opening it up should give you something like this:

  1. Configuration File
  2. Mon May 05 23:09:09 CEST 2008
osgi.bundles=reference\:file\:/home/jochen/bin/eclipse/plugins/org.eclipse.equinox.ds_1.0.0.v20070226.jar@4\:start,reference\:file\:/home/jochen
/bin/eclipse/plugins/org.eclipse.equinox.common_3.3.0.v20070426.jar@2\:start,reference\:file\:/home/jochen/bin/eclipse/plugins
/org.eclipse.update.configurator_3.2.101.R33x_v20070810.jar@3\:start,reference\:file\:/home/jochen/bin/eclipse/plugins 
/org.eclipse.core.runtime_3.3.100.v20070530.jar@start,org.rifidi.designer.rcp.gpioeditor@5
osgi.bundles.defaultStartLevel=5
osgi.install.area=file\:/home/jochen/bin/eclipse
osgi.framework=file\:/home/jochen/bin/eclipse/plugins/org.eclipse.osgi_3.3.2.R33x_v20080105.jar
osgi.configuration.cascaded=false
osgi.splashPath=file\:/home/jochen/workspace/org.rifidi.designer.rcp
Personal tools