You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Bengt Rodehav <be...@rodehav.com> on 2010/04/09 14:07:51 UTC

iPOJO and ServiceReference

I'm using iPOJO to publish OSGI service on Felix. For logging purposes
(and for some other purposes as well), I need access to the started
service's ServiceReference. How can I get hold of the ServiceReference
from an iPOJO component? Intuitively it makes sense to start using it
in the method marked with @Validate since I assume that the service
has then just been started.

How can I accomplish this?

/Bengt

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


Re: iPOJO and ServiceReference

Posted by "Richard S. Hall" <he...@ungoverned.org>.
Thanks!

-> richard

On 4/13/10 8:38, Bengt Rodehav wrote:
> Richard,
>
> I just filed the following feature request:
>
> https://issues.apache.org/jira/browse/FELIX-2279
>
> /Bengt
>
> 2010/4/9 Richard S. Hall<he...@ungoverned.org>:
>    
>> On 4/9/10 8:07, Bengt Rodehav wrote:
>>      
>>> I'm using iPOJO to publish OSGI service on Felix. For logging purposes
>>> (and for some other purposes as well), I need access to the started
>>> service's ServiceReference. How can I get hold of the ServiceReference
>>> from an iPOJO component? Intuitively it makes sense to start using it
>>> in the method marked with @Validate since I assume that the service
>>> has then just been started.
>>>
>>> How can I accomplish this?
>>>
>>>        
>> Actually, there is no automatic way for a component to get this information
>> about itself. You'd need to get the bundle context in your constructor and
>> then manually publish your services in the @Validate method.
>>
>> I suppose it would be possible to support this by allowing the @Validate
>> method to receive a set of service references. Although this hasn't been
>> needed up until now, feel free to open a feature request if you think it is
>> necessary.
>>
>> Thanks.
>>
>> ->  richard
>>
>>      
>>> /Bengt
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>        
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>>      
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>    

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


Re: iPOJO and ServiceReference

Posted by Bengt Rodehav <be...@rodehav.com>.
Richard,

I just filed the following feature request:

https://issues.apache.org/jira/browse/FELIX-2279

/Bengt

2010/4/9 Richard S. Hall <he...@ungoverned.org>:
> On 4/9/10 8:07, Bengt Rodehav wrote:
>>
>> I'm using iPOJO to publish OSGI service on Felix. For logging purposes
>> (and for some other purposes as well), I need access to the started
>> service's ServiceReference. How can I get hold of the ServiceReference
>> from an iPOJO component? Intuitively it makes sense to start using it
>> in the method marked with @Validate since I assume that the service
>> has then just been started.
>>
>> How can I accomplish this?
>>
>
> Actually, there is no automatic way for a component to get this information
> about itself. You'd need to get the bundle context in your constructor and
> then manually publish your services in the @Validate method.
>
> I suppose it would be possible to support this by allowing the @Validate
> method to receive a set of service references. Although this hasn't been
> needed up until now, feel free to open a feature request if you think it is
> necessary.
>
> Thanks.
>
> -> richard
>
>> /Bengt
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

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


Re: iPOJO and ServiceReference

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 4/9/10 8:07, Bengt Rodehav wrote:
> I'm using iPOJO to publish OSGI service on Felix. For logging purposes
> (and for some other purposes as well), I need access to the started
> service's ServiceReference. How can I get hold of the ServiceReference
> from an iPOJO component? Intuitively it makes sense to start using it
> in the method marked with @Validate since I assume that the service
> has then just been started.
>
> How can I accomplish this?
>    

Actually, there is no automatic way for a component to get this 
information about itself. You'd need to get the bundle context in your 
constructor and then manually publish your services in the @Validate method.

I suppose it would be possible to support this by allowing the @Validate 
method to receive a set of service references. Although this hasn't been 
needed up until now, feel free to open a feature request if you think it 
is necessary.

Thanks.

-> richard

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

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