Difference between revisions of "Eclipse:osgiDS"
From RifidiWiki
 (→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/]  | + | Here is a little series about osgi (including declarative services, look at part 7 and 8) [http://neilbartlett.name/blog/osgi-articles/]<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.  | 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.  | + | 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.  | + | 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:[http://download.eclipse.org/eclipse/equinox/]  | + | So we need to go here:[http://download.eclipse.org/eclipse/equinox/]<br/>  | 
*Under latest releases select 3.3.2  | *Under latest releases select 3.3.2  | ||
| − | *Scroll down to   | + | *Scroll down to "Incubator" bundles  | 
| − | *download org.eclipse.equinox.ds  | + | *download org.eclipse.equinox.ds<whateverversionisthere>.jar (this is the declarative services plugin)  | 
| − | *download  org.eclipse.equinox.cm  | + | *download  org.eclipse.equinox.cm<whateverversionisthere>.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.  | + | 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.  | + | 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.  | + | 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.  | + | 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.  | + | 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.  | + | 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.  | + | Open up the run configuration for your RCP app.<br/>  | 
| − | + | <br/>  | |
| − | [[Image:Runconfiguration.jpg]]  | + | [[Image:Runconfiguration.jpg]]<br/>  | 
| − | + | <br/>  | |
| − | The red box shows where you have to edit.  | + | 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.  | + | 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.  | + | 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:  | + | Opening it up should give you something like this:<br/>  | 
| − | + | <br/>  | |
  #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/>  | |
| − | 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.  | + | 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.  | + | 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.  | + | 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  |   #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/>  | |
| − | After editing this file store it in any directory and adjust the area that within the red box.  | + | 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.  | + | 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.  | 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/>
<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.