You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Pierre Henry Perret <ph...@gmail.com> on 2011/02/09 15:20:34 UTC
SID
How to get the OSGi Service ID of a component instance (a service) ?
Thanks
--
Pierre
Re: SID
Posted by Guillaume Sauthier <Gu...@objectweb.org>.
Le 09/02/2011 15:59, Pierre Henry Perret a écrit :
> This is exactly what I want to know.
>
> I suppose it is the typed object I'm using :
>
> context.getServiceReference(Class string);
>
Yes
http://www.osgi.org/javadoc/r4v42/org/osgi/framework/ServiceReference.html
> But am I sur the sid is valid not null ?
>
The spec mandates each service to have an id (service.id), pid is optional
http://www.osgi.org/javadoc/r4v42/org/osgi/framework/Constants.html#SERVICE_ID
> Do I not have to use the ServiceRegistration ?
>
ServiceRegistration is the handle the frameworks returns to you when you
register a service.
ServiceReference is a consumer-side object
--G
>
>
>
>
>
> 2011/2/9 Guillaume Sauthier<Gu...@objectweb.org>
>
>
>> There is a service.id (or service.pid) property in the ServiceReference
>> How do you retrieve your reference ?
>> --G
>>
>> Le 09/02/2011 15:20, Pierre Henry Perret a écrit :
>>
>> How to get the OSGi Service ID of a component instance (a service) ?
>>
>>> Thanks
>>>
>>> --
>>> Pierre
>>>
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>
Re: SID
Posted by Pierre Henry Perret <ph...@gmail.com>.
This is exactly what I want to know.
I suppose it is the typed object I'm using :
context.getServiceReference(Class string);
But am I sur the sid is valid not null ?
Do I not have to use the ServiceRegistration ?
2011/2/9 Guillaume Sauthier <Gu...@objectweb.org>
> There is a service.id (or service.pid) property in the ServiceReference
> How do you retrieve your reference ?
> --G
>
> Le 09/02/2011 15:20, Pierre Henry Perret a écrit :
>
> How to get the OSGi Service ID of a component instance (a service) ?
>>
>> Thanks
>>
>> --
>> Pierre
>>
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
Re: SID
Posted by Guillaume Sauthier <Gu...@objectweb.org>.
There is a service.id (or service.pid) property in the ServiceReference
How do you retrieve your reference ?
--G
Le 09/02/2011 15:20, Pierre Henry Perret a écrit :
> How to get the OSGi Service ID of a component instance (a service) ?
>
> Thanks
>
> --
> Pierre
>
>