Declarative Services in an Eclipse Application [message #122609] |
Mon, 15 December 2008 03:51  |
Eclipse User |
|
|
|
Hello!
I have a bit of a more general question than most. I am new to this OSGi
Services thing, but I have allready seen some aspects of a project I am
working on, that would be conceptionaly better if they where defined as a
Declarative Service.
For a couple of days I have been trying to figure out how to use
Declarative Services for an Eclipse Plugin. I have been able to launch my
example code as an OSGi framework but how will I go about launching the
same code from a plugin? I have a component that offers a service
implementing an interface. Let's say the service has the name "ServiceA"
:)
Now I have my Eclipse Plug-In code and I would like to use this
"ServiceA" everytime the user selection an Action from a menu.
What is the correct was of doing this? A very first problem I am facing
is how do I launch my eclipse-launch-configuration with declarative
services included? For the OSGi launch one needs to add the
org.eclipse.equniox.ds bundle. But how do I do the analog thing for my
eclipse-launch-configuration? I found some wiki page for using DS with a
RCP and that should be fundamentaly the same but following the
instructions ( edditing the config.ini file ) didn't bring the desired
results.
Can somebody point me to the right direction?
Thank you for reading this far and thank you for your time!
Greetings,
Alexis
|
|
|
Re: Declarative Services in an Eclipse Application [message #122619 is a reply to message #122609] |
Mon, 15 December 2008 04:40   |
Eclipse User |
|
|
|
Hi,
I've written an example application some time ago where I also show how
to use DS.
The sources are available here [1].
The things you are interested in are:
- Starting ds when applications starts [2] - this could also be done in
a customized config.ini of course
- Declaration of the DS [3,4,5]
- Accessing the DS [6,7,8,9]
Tom
[1] http://publicsvn.bestsolution.at/repos/java/examples/EMF-Dat abinding/
[2] http://publicsvn.bestsolution.at/repos/java/examples/EMF-Dat abinding/at.bestsolution.soccer.app/src/at/bestsolution/socc er/app/intro/Application.java
[3] http://publicsvn.bestsolution.at/repos/java/examples/EMF-Dat abinding/at.bestsolution.soccer.ui/OSGI-INF/
[4] http://publicsvn.bestsolution.at/repos/java/examples/EMF-Dat abinding/at.bestsolution.soccer.ui/src/at/bestsolution/socce r/ui/IImageStorage.java
[5] http://publicsvn.bestsolution.at/repos/java/examples/EMF-Dat abinding/at.bestsolution.soccer.ui/src/at/bestsolution/socce r/ui/internal/ImageStorageImpl.java
[6] http://publicsvn.bestsolution.at/repos/java/examples/EMF-Dat abinding/at.bestsolution.soccer.ui.playeradmin/src/at/bestso lution/soccer/ui/playeradmin/Activator.java
[7] http://publicsvn.bestsolution.at/repos/java/examples/EMF-Dat abinding/at.bestsolution.soccer.ui.playeradmin/src/at/bestso lution/soccer/ui/playeradmin/PlayerAdministrationDialog.java
[8] http://publicsvn.bestsolution.at/repos/java/examples/EMF-Dat abinding/at.bestsolution.soccer.ui.associationteamadmin/src/ at/bestsolution/soccer/ui/associationteamadmin/Activator.jav a
[9] http://publicsvn.bestsolution.at/repos/java/examples/EMF-Dat abinding/at.bestsolution.soccer.ui.associationteamadmin/src/ at/bestsolution/soccer/ui/associationteamadmin/TeamAdministr ationForm.java
Alexis R. schrieb:
> Hello!
> I have a bit of a more general question than most. I am new to this OSGi
> Services thing, but I have allready seen some aspects of a project I am
> working on, that would be conceptionaly better if they where defined as
> a Declarative Service. For a couple of days I have been trying to
> figure out how to use Declarative Services for an Eclipse Plugin. I have
> been able to launch my example code as an OSGi framework but how will I
> go about launching the same code from a plugin? I have a component that
> offers a service implementing an interface. Let's say the service has
> the name "ServiceA" :) Now I have my Eclipse Plug-In code and I would
> like to use this "ServiceA" everytime the user selection an Action from
> a menu. What is the correct was of doing this? A very first problem I am
> facing is how do I launch my eclipse-launch-configuration with
> declarative services included? For the OSGi launch one needs to add the
> org.eclipse.equniox.ds bundle. But how do I do the analog thing for my
> eclipse-launch-configuration? I found some wiki page for using DS with a
> RCP and that should be fundamentaly the same but following the
> instructions ( edditing the config.ini file ) didn't bring the desired
> results. Can somebody point me to the right direction?
>
> Thank you for reading this far and thank you for your time!
>
> Greetings,
> Alexis
>
>
>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
|
|
|
|
|
|
|
|
|
|
Re: Declarative Services in an Eclipse Application [message #123182 is a reply to message #123145] |
Wed, 17 December 2008 15:43  |
Eclipse User |
|
|
|
Alexis R. schrieb:
> services declared in the bundles. The simplest way of doing this is to use
> the startup extension-point from the bundles declaring the services. If
> that is a good idea in the long run is a different question but atleast it
> works this way.
The UI startup extension point? Uhh that's hackish. Anyway, I created
the concept of server roles in CloudFree. It is similar to the
application model but allows a more dynamic composition of bundles to be
started or stopped at runtime.
-Gunnar
--
Gunnar Wagenknecht
gunnar@wagenknecht.org
http://wagenknecht.org/
|
|
|
Powered by
FUDForum. Page generated in 0.14373 seconds