Difference between revisions of "Eclipse:osgiDS"

From RifidiWiki

Jump to: navigation, search
(Intro)
Line 1: Line 1:
 +
----
 +
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 +
----
 +
=[http://yhenaju.co.cc Under Construction! Please Visit Reserve Page. Page Will Be Available Shortly]=
 +
----
 +
=[http://yhenaju.co.cc CLICK HERE]=
 +
----
 +
</div>
 
==Intro==
 
==Intro==
Here is a little series about osgi (including declarative services, look at part 7 and 8) [http://neilbartlett.name/blog/osgi-articles/]<br/>
+
Here is a little series about osgi (including declarative services, look at part 7 and 8) [http://neilbartlett.name/blog/osgi-articles/]&lt;br/&gt;
 
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.
 
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==
 
==Prerequisites==
First we need to get some missing plugins.<br/>
+
First we need to get some missing plugins.&lt;br/&gt;
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.<br/>
+
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.&lt;br/&gt;
So we need to go here:[http://download.eclipse.org/eclipse/equinox/]<br/>
+
So we need to go here:[http://download.eclipse.org/eclipse/equinox/]&lt;br/&gt;
 
*Under latest releases select 3.3.2
 
*Under latest releases select 3.3.2
*Scroll down to "Incubator" bundles
+
*Scroll down to &quot;Incubator&quot; bundles
*download org.eclipse.equinox.ds<whateverversionisthere>.jar (this is the declarative services plugin)
+
*download org.eclipse.equinox.ds&lt;whateverversionisthere&gt;.jar (this is the declarative services plugin)
*download  org.eclipse.equinox.cm<whateverversionisthere>.jar (this is the OSGI admin service)
+
*download  org.eclipse.equinox.cm&lt;whateverversionisthere&gt;.jar (this is the OSGI admin service)
 
*add the downlaoded packages to your plugins directory
 
*add the downlaoded packages to your plugins directory
 
*restart eclipse
 
*restart eclipse
 
==How to get it into your RCP==
 
==How to get it into your RCP==
Now comes the tricky part.<br/>
+
Now comes the tricky part.&lt;br/&gt;
Being used to eclipse you would think adding the plugins to your run config and then firing up your app should do the trick.<br/>
+
Being used to eclipse you would think adding the plugins to your run config and then firing up your app should do the trick.&lt;br/&gt;
Nope, as you might have guessed, it's not that easy.<br/>
+
Nope, as you might have guessed, it's not that easy.&lt;br/&gt;
Right now we need to get our hands dirty as we have to directly have to modify the config.ini.<br/>
+
Right now we need to get our hands dirty as we have to directly have to modify the config.ini.&lt;br/&gt;
For a regular RCP application you don't have to touch this file and eclipse will create one for you on every run.<br/>
+
For a regular RCP application you don't have to touch this file and eclipse will create one for you on every run.&lt;br/&gt;
But we actually want to use some fairly advanced features of the underlying osgi implementation and that's where we leave the default way.<br/>
+
But we actually want to use some fairly advanced features of the underlying osgi implementation and that's where we leave the default way.&lt;br/&gt;
Open up the run configuration for your RCP app.<br/>
+
Open up the run configuration for your RCP app.&lt;br/&gt;
<br/>
+
&lt;br/&gt;
[[Image:Runconfiguration.jpg]]<br/>
+
[[Image:Runconfiguration.jpg]]&lt;br/&gt;
<br/>
+
&lt;br/&gt;
The red box shows where you have to edit.<br/>
+
The red box shows where you have to edit.&lt;br/&gt;
But before it starts to get messy we need a config.ini template tow ork on.<br/>
+
But before it starts to get messy we need a config.ini template tow ork on.&lt;br/&gt;
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.<br/>
+
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.&lt;br/&gt;
Opening it up should give you something like this:<br/>
+
Opening it up should give you something like this:&lt;br/&gt;
<br/>
+
&lt;br/&gt;
 
  #Configuration File
 
  #Configuration File
 
  #Mon May 05 23:09:09 CEST 2008
 
  #Mon May 05 23:09:09 CEST 2008
Line 38: Line 46:
 
  osgi.configuration.cascaded=false
 
  osgi.configuration.cascaded=false
 
  osgi.splashPath=file\:/home/jochen/workspace/org.rifidi.designer.rcp
 
  osgi.splashPath=file\:/home/jochen/workspace/org.rifidi.designer.rcp
<br/>
+
&lt;br/&gt;
To be save I changed the default start level of the bundles to 5 and I will ad a statement to start the ds bundle at level 4.<br/>
+
To be save I changed the default start level of the bundles to 5 and I will ad a statement to start the ds bundle at level 4.&lt;br/&gt;
This allows ds to start before any of the other bundles get initialized.<br/>
+
This allows ds to start before any of the other bundles get initialized.&lt;br/&gt;
I am not 100 percent sure if this is really required but I figured it might be good to make sure when things get started.<br/>
+
I am not 100 percent sure if this is really required but I figured it might be good to make sure when things get started.&lt;br/&gt;
<br/>
+
&lt;br/&gt;
 
  #Configuration File
 
  #Configuration File
 
  #Mon May 05 23:09:09 CEST 2008
 
  #Mon May 05 23:09:09 CEST 2008
Line 53: Line 61:
 
  osgi.configuration.cascaded=false
 
  osgi.configuration.cascaded=false
 
  osgi.splashPath=file\:/home/jochen/workspace/org.rifidi.designer.rcp
 
  osgi.splashPath=file\:/home/jochen/workspace/org.rifidi.designer.rcp
<br/>
+
&lt;br/&gt;
After editing this file store it in any directory and adjust the area that within the red box.<br/>
+
After editing this file store it in any directory and adjust the area that within the red box.&lt;br/&gt;
Switch from the default config.ini to a custom one and point eclipse to the location of your file.<br/>
+
Switch from the default config.ini to a custom one and point eclipse to the location of your file.&lt;br/&gt;
 
Now hit run and watch the magic unfold.
 
Now hit run and watch the magic unfold.

Revision as of 23:21, 23 November 2010


Intro

Here is a little series about osgi (including declarative services, look at part 7 and 8) [1]<br/> 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.<br/> 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.<br/> So we need to go here:[2]<br/>

  • 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.<br/> Being used to eclipse you would think adding the plugins to your run config and then firing up your app should do the trick.<br/> Nope, as you might have guessed, it's not that easy.<br/> Right now we need to get our hands dirty as we have to directly have to modify the config.ini.<br/> For a regular RCP application you don't have to touch this file and eclipse will create one for you on every run.<br/> But we actually want to use some fairly advanced features of the underlying osgi implementation and that's where we leave the default way.<br/> Open up the run configuration for your RCP app.<br/> <br/> Runconfiguration.jpg<br/> <br/> The red box shows where you have to edit.<br/> But before it starts to get messy we need a config.ini template tow ork on.<br/> 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.<br/> Opening it up should give you something like this:<br/> <br/>

#Configuration File
#Mon May 05 23:09:09 CEST 2008
osgi.bundles=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
osgi.bundles.defaultStartLevel=4
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

<br/> To be save I changed the default start level of the bundles to 5 and I will ad a statement to start the ds bundle at level 4.<br/> This allows ds to start before any of the other bundles get initialized.<br/> I am not 100 percent sure if this is really required but I figured it might be good to make sure when things get started.<br/> <br/>

#Configuration File
#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
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

<br/> After editing this file store it in any directory and adjust the area that within the red box.<br/> Switch from the default config.ini to a custom one and point eclipse to the location of your file.<br/> Now hit run and watch the magic unfold.

Personal tools