You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Snorre Lothar von Gohren Edwin <sn...@gmail.com> on 2013/05/25 21:13:34 UTC

Declarative services and normal activators

Hi, im trying to register a simple DS in my registry. And i inspect the
service and get a confirmation that its registered. I have also made a
small project to see how the DS works on the very basics.

But im trying to integrate the DS to my former project using service
tracker.
So my question is that if its possible to use this code:

@Reference
 public void setApi(Api api){
System.out.println("SETTING API");
this.updateInterface = api;
 }

in a normal activator method? If so I wonder how. I can seem to get te
reference when im updating the current bundle with this method.

My current code is this: https://github.com/Snorlock/prosjektoppgavekode
The two labelupdaters are my interface and imlpmentation for the DS.
And i want to take this service into the other bundles, using @Reference.
Is this possible?

-- 
Mvh
Snorre Lothar von Gohren Edwin
+47 411 611 94

Re: Declarative services and normal activators

Posted by Felix Meschberger <fm...@adobe.com>.
Hi

Am 25.05.2013 um 21:13 schrieb Snorre Lothar von Gohren Edwin:

> Hi, im trying to register a simple DS in my registry. And i inspect the
> service and get a confirmation that its registered. I have also made a
> small project to see how the DS works on the very basics.
> 
> But im trying to integrate the DS to my former project using service
> tracker.
> So my question is that if its possible to use this code:
> 
> @Reference
> public void setApi(Api api){
> System.out.println("SETTING API");
> this.updateInterface = api;
> }
> 
> in a normal activator method? If so I wonder how. I can seem to get te
> reference when im updating the current bundle with this method.

What is a "normal activator method" ?

Basically, a DS service is registered in the service registry and can be consumed by any functionality accessing the service registry. This includes normal ServiceTrackers but also Blueprint or, of course, other DS components.

In any case the @Reference annotation (assuming your a referring to the OSGi DS @Reference annotation) is only usable in @Component annotated components which are managed through DS. In effect the OSGi DS annotations are converted at build time to the normal DS descriptor XML files to be included in the bundles.

Hope this helps.

Regards
Felix

> 
> My current code is this: https://github.com/Snorlock/prosjektoppgavekode
> The two labelupdaters are my interface and imlpmentation for the DS.
> And i want to take this service into the other bundles, using @Reference.
> Is this possible?
> 
> -- 
> Mvh
> Snorre Lothar von Gohren Edwin
> +47 411 611 94


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org