You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by co...@christian-vogel.info on 2012/08/02 14:32:38 UTC
DS and FindHook
Hi,
Today I worked a little bit with OSGi Hooks, specially with FindHook and EventListenerHook for services. I wanted to try out proxying services. The EventListenerHook works fine and my services are proxied. But I realized that the FindHook event would'nt be called if a service will get a reference of the service implementation by annotating the related setXXX method with @Reference (Bnd style). Maybe it is not a problem with the annotation, but with DS in general.
This is quite bad, bc there are two services registered one without proxy and one proxied. I only want to get references from the proxied one. In general, without DS, you can get references by calling BundleContext.getServiceReference(java.lang.Class<S> clazz) and the event FindHook.find will be called, where you can decide which ServiceReference you want to return.
What kind of processes will be executed when I'm using DS like approaches (for me: Bnd annotation @Reference)? As I described in the above section: I want to decide which services should be referenced.
Greetings.
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: DS and FindHook
Posted by Felix Meschberger <fm...@adobe.com>.
Hi Christian,
Am 02.08.2012 um 19:42 schrieb <co...@christian-vogel.info> <co...@christian-vogel.info>:
> Hi Felix,
>
> as soon as I've arrived at home I've tried my source code again with little modifications and now it's working. Do not know why now and not before. So, UNFORTUNALITY :) , it had something to do with my code ^^
>
> But nethertheless, thanks for your time :)
Don't worry. Glad to hear it works ;-)
Regards
Felix
>
> Regards.
> Christian
>
> ----- Original Message -----
> From: fmeschbe@adobe.com
> To: users@felix.apache.org
> Date: 02.08.2012 16:58:11
> Subject: Re: DS and FindHook
>
>
>> Hi,
>>
>> Am 02.08.2012 um 16:51 schrieb <co...@christian-vogel.info>:
>>
>>>
>>>> Hi,
>>>>
>>>> Am 02.08.2012 um 16:26 schrieb <co...@christian-vogel.info>:
>>>>
>>>>> I'm using 4.0.1
>>>>
>>>> Hmm, looking at the code the FindHook should actually be called.
>>>>
>>>> Is you FindHook called at all -- for other situations, too ?
>>>
>>> Yes it's called as soon as I'm using BundleContext.getServiceReference() elsewhere
>>>
>>>>
>>>> Is you DS component properly defined to use the bind method ? E.g. are you sure to not mix Apache Felix SCR annotations with BND DS annotations ?
>>>
>>> I'm using the Apache Felix SCR annotations.
>>>
>>>
>>> Maybe I should prepare a little example and I send it to you?
>>
>> Yes, this might help.
>>
>> Regards
>> Felix
>>
>>>
>>>
>>>>
>>>> Regards
>>>> Felix
>>>>
>>>>
>>>>>
>>>>> ----- Original Message -----
>>>>> From: fmeschbe@adobe.com
>>>>> To: users@felix.apache.org
>>>>> Date: 02.08.2012 16:23:28
>>>>> Subject: Re: DS and FindHook
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Am 02.08.2012 um 16:21 schrieb <co...@christian-vogel.info>:
>>>>>>
>>>>>>> Hi Felix,
>>>>>>>
>>>>>>> thx for your answer. I completely forgot to tell that I'm using Apache Felix of course.
>>>>>>>
>>>>>>> I tried my FindHook with the more general way by calling BundleContext.getServiceReference and there it works. So as you told that must be an issue of the framework.
>>>>>>
>>>>>> This of course bears the next question: Which version of the framework are you using ?
>>>>>>
>>>>>> Regards
>>>>>> Felix
>>>>>>
>>>>>>>
>>>>>>> Greetings.
>>>>>>> Christian
>>>>>>>
>>>>>>> ----- Original Message -----
>>>>>>> From: fmeschbe@adobe.com
>>>>>>> To: users@felix.apache.org
>>>>>>> Date: 02.08.2012 16:01:56
>>>>>>> Subject: Re: DS and FindHook
>>>>>>>
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> Am 02.08.2012 um 14:32 schrieb <co...@christian-vogel.info>:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> Today I worked a little bit with OSGi Hooks, specially with FindHook and EventListenerHook for services. I wanted to try out proxying services. The EventListenerHook works fine and my services are proxied. But I realized that the FindHook event would'nt be called if a service will get a reference of the service implementation by annotating the related setXXX method with @Reference (Bnd style). Maybe it is not a problem with the annotation, but with DS in general.
>>>>>>>>>
>>>>>>>>> This is quite bad, bc there are two services registered one without proxy and one proxied. I only want to get references from the proxied one. In general, without DS, you can get references by calling BundleContext.getServiceReference(java.lang.Class<S> clazz) and the event FindHook.find will be called, where you can decide which ServiceReference you want to return.
>>>>>>>>>
>>>>>>>>> What kind of processes will be executed when I'm using DS like approaches (for me: Bnd annotation @Reference)? As I described in the above section: I want to decide which services should be referenced.
>>>>>>>>
>>>>>>>> I can only speak for the Apache Felix DS implementation: I use the BundleContext.getServiceReferences(String, String) to explicitly access service references using the BundleContext of the respective context (thus to also have OSGi security applied). I would assume that candidate service references are send to the FilterHook before getting the result to the DS implementation.
>>>>>>>>
>>>>>>>> So, unless there is a bug in the framework implementation or in your hook registration, your hook should really be called. (and of course only if the getServiceReferences call comes after your hook is registered.
>>>>>>>>
>>>>>>>> Regards
>>>>>>>> Felix
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Greetings.
>>>>>>>>> Christian
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> 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
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>
>
> ---------------------------------------------------------------------
> 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: Re: DS and FindHook
Posted by co...@christian-vogel.info.
Hi Felix,
as soon as I've arrived at home I've tried my source code again with little modifications and now it's working. Do not know why now and not before. So, UNFORTUNALITY :) , it had something to do with my code ^^
But nethertheless, thanks for your time :)
Regards.
Christian
----- Original Message -----
From: fmeschbe@adobe.com
To: users@felix.apache.org
Date: 02.08.2012 16:58:11
Subject: Re: DS and FindHook
> Hi,
>
> Am 02.08.2012 um 16:51 schrieb <co...@christian-vogel.info>:
>
>>
>>> Hi,
>>>
>>> Am 02.08.2012 um 16:26 schrieb <co...@christian-vogel.info>:
>>>
>>>> I'm using 4.0.1
>>>
>>> Hmm, looking at the code the FindHook should actually be called.
>>>
>>> Is you FindHook called at all -- for other situations, too ?
>>
>> Yes it's called as soon as I'm using BundleContext.getServiceReference() elsewhere
>>
>>>
>>> Is you DS component properly defined to use the bind method ? E.g. are you sure to not mix Apache Felix SCR annotations with BND DS annotations ?
>>
>> I'm using the Apache Felix SCR annotations.
>>
>>
>> Maybe I should prepare a little example and I send it to you?
>
> Yes, this might help.
>
> Regards
> Felix
>
>>
>>
>>>
>>> Regards
>>> Felix
>>>
>>>
>>>>
>>>> ----- Original Message -----
>>>> From: fmeschbe@adobe.com
>>>> To: users@felix.apache.org
>>>> Date: 02.08.2012 16:23:28
>>>> Subject: Re: DS and FindHook
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>> Am 02.08.2012 um 16:21 schrieb <co...@christian-vogel.info>:
>>>>>
>>>>>> Hi Felix,
>>>>>>
>>>>>> thx for your answer. I completely forgot to tell that I'm using Apache Felix of course.
>>>>>>
>>>>>> I tried my FindHook with the more general way by calling BundleContext.getServiceReference and there it works. So as you told that must be an issue of the framework.
>>>>>
>>>>> This of course bears the next question: Which version of the framework are you using ?
>>>>>
>>>>> Regards
>>>>> Felix
>>>>>
>>>>>>
>>>>>> Greetings.
>>>>>> Christian
>>>>>>
>>>>>> ----- Original Message -----
>>>>>> From: fmeschbe@adobe.com
>>>>>> To: users@felix.apache.org
>>>>>> Date: 02.08.2012 16:01:56
>>>>>> Subject: Re: DS and FindHook
>>>>>>
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Am 02.08.2012 um 14:32 schrieb <co...@christian-vogel.info>:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> Today I worked a little bit with OSGi Hooks, specially with FindHook and EventListenerHook for services. I wanted to try out proxying services. The EventListenerHook works fine and my services are proxied. But I realized that the FindHook event would'nt be called if a service will get a reference of the service implementation by annotating the related setXXX method with @Reference (Bnd style). Maybe it is not a problem with the annotation, but with DS in general.
>>>>>>>>
>>>>>>>> This is quite bad, bc there are two services registered one without proxy and one proxied. I only want to get references from the proxied one. In general, without DS, you can get references by calling BundleContext.getServiceReference(java.lang.Class<S> clazz) and the event FindHook.find will be called, where you can decide which ServiceReference you want to return.
>>>>>>>>
>>>>>>>> What kind of processes will be executed when I'm using DS like approaches (for me: Bnd annotation @Reference)? As I described in the above section: I want to decide which services should be referenced.
>>>>>>>
>>>>>>> I can only speak for the Apache Felix DS implementation: I use the BundleContext.getServiceReferences(String, String) to explicitly access service references using the BundleContext of the respective context (thus to also have OSGi security applied). I would assume that candidate service references are send to the FilterHook before getting the result to the DS implementation.
>>>>>>>
>>>>>>> So, unless there is a bug in the framework implementation or in your hook registration, your hook should really be called. (and of course only if the getServiceReferences call comes after your hook is registered.
>>>>>>>
>>>>>>> Regards
>>>>>>> Felix
>>>>>>>
>>>>>>>>
>>>>>>>> Greetings.
>>>>>>>> Christian
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> 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
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: DS and FindHook
Posted by Felix Meschberger <fm...@adobe.com>.
Hi,
Am 02.08.2012 um 16:51 schrieb <co...@christian-vogel.info>:
>
>> Hi,
>>
>> Am 02.08.2012 um 16:26 schrieb <co...@christian-vogel.info>:
>>
>>> I'm using 4.0.1
>>
>> Hmm, looking at the code the FindHook should actually be called.
>>
>> Is you FindHook called at all -- for other situations, too ?
>
> Yes it's called as soon as I'm using BundleContext.getServiceReference() elsewhere
>
>>
>> Is you DS component properly defined to use the bind method ? E.g. are you sure to not mix Apache Felix SCR annotations with BND DS annotations ?
>
> I'm using the Apache Felix SCR annotations.
>
>
> Maybe I should prepare a little example and I send it to you?
Yes, this might help.
Regards
Felix
>
>
>>
>> Regards
>> Felix
>>
>>
>>>
>>> ----- Original Message -----
>>> From: fmeschbe@adobe.com
>>> To: users@felix.apache.org
>>> Date: 02.08.2012 16:23:28
>>> Subject: Re: DS and FindHook
>>>
>>>
>>>> Hi,
>>>>
>>>> Am 02.08.2012 um 16:21 schrieb <co...@christian-vogel.info>:
>>>>
>>>>> Hi Felix,
>>>>>
>>>>> thx for your answer. I completely forgot to tell that I'm using Apache Felix of course.
>>>>>
>>>>> I tried my FindHook with the more general way by calling BundleContext.getServiceReference and there it works. So as you told that must be an issue of the framework.
>>>>
>>>> This of course bears the next question: Which version of the framework are you using ?
>>>>
>>>> Regards
>>>> Felix
>>>>
>>>>>
>>>>> Greetings.
>>>>> Christian
>>>>>
>>>>> ----- Original Message -----
>>>>> From: fmeschbe@adobe.com
>>>>> To: users@felix.apache.org
>>>>> Date: 02.08.2012 16:01:56
>>>>> Subject: Re: DS and FindHook
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Am 02.08.2012 um 14:32 schrieb <co...@christian-vogel.info>:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> Today I worked a little bit with OSGi Hooks, specially with FindHook and EventListenerHook for services. I wanted to try out proxying services. The EventListenerHook works fine and my services are proxied. But I realized that the FindHook event would'nt be called if a service will get a reference of the service implementation by annotating the related setXXX method with @Reference (Bnd style). Maybe it is not a problem with the annotation, but with DS in general.
>>>>>>>
>>>>>>> This is quite bad, bc there are two services registered one without proxy and one proxied. I only want to get references from the proxied one. In general, without DS, you can get references by calling BundleContext.getServiceReference(java.lang.Class<S> clazz) and the event FindHook.find will be called, where you can decide which ServiceReference you want to return.
>>>>>>>
>>>>>>> What kind of processes will be executed when I'm using DS like approaches (for me: Bnd annotation @Reference)? As I described in the above section: I want to decide which services should be referenced.
>>>>>>
>>>>>> I can only speak for the Apache Felix DS implementation: I use the BundleContext.getServiceReferences(String, String) to explicitly access service references using the BundleContext of the respective context (thus to also have OSGi security applied). I would assume that candidate service references are send to the FilterHook before getting the result to the DS implementation.
>>>>>>
>>>>>> So, unless there is a bug in the framework implementation or in your hook registration, your hook should really be called. (and of course only if the getServiceReferences call comes after your hook is registered.
>>>>>>
>>>>>> Regards
>>>>>> Felix
>>>>>>
>>>>>>>
>>>>>>> Greetings.
>>>>>>> Christian
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> 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
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: Re: DS and FindHook
Posted by co...@christian-vogel.info.
> Hi,
>
> Am 02.08.2012 um 16:26 schrieb <co...@christian-vogel.info>:
>
>> I'm using 4.0.1
>
> Hmm, looking at the code the FindHook should actually be called.
>
> Is you FindHook called at all -- for other situations, too ?
Yes it's called as soon as I'm using BundleContext.getServiceReference() elsewhere
>
> Is you DS component properly defined to use the bind method ? E.g. are you sure to not mix Apache Felix SCR annotations with BND DS annotations ?
I'm using the Apache Felix SCR annotations.
Maybe I should prepare a little example and I send it to you?
>
> Regards
> Felix
>
>
>>
>> ----- Original Message -----
>> From: fmeschbe@adobe.com
>> To: users@felix.apache.org
>> Date: 02.08.2012 16:23:28
>> Subject: Re: DS and FindHook
>>
>>
>>> Hi,
>>>
>>> Am 02.08.2012 um 16:21 schrieb <co...@christian-vogel.info>:
>>>
>>>> Hi Felix,
>>>>
>>>> thx for your answer. I completely forgot to tell that I'm using Apache Felix of course.
>>>>
>>>> I tried my FindHook with the more general way by calling BundleContext.getServiceReference and there it works. So as you told that must be an issue of the framework.
>>>
>>> This of course bears the next question: Which version of the framework are you using ?
>>>
>>> Regards
>>> Felix
>>>
>>>>
>>>> Greetings.
>>>> Christian
>>>>
>>>> ----- Original Message -----
>>>> From: fmeschbe@adobe.com
>>>> To: users@felix.apache.org
>>>> Date: 02.08.2012 16:01:56
>>>> Subject: Re: DS and FindHook
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>> Am 02.08.2012 um 14:32 schrieb <co...@christian-vogel.info>:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Today I worked a little bit with OSGi Hooks, specially with FindHook and EventListenerHook for services. I wanted to try out proxying services. The EventListenerHook works fine and my services are proxied. But I realized that the FindHook event would'nt be called if a service will get a reference of the service implementation by annotating the related setXXX method with @Reference (Bnd style). Maybe it is not a problem with the annotation, but with DS in general.
>>>>>>
>>>>>> This is quite bad, bc there are two services registered one without proxy and one proxied. I only want to get references from the proxied one. In general, without DS, you can get references by calling BundleContext.getServiceReference(java.lang.Class<S> clazz) and the event FindHook.find will be called, where you can decide which ServiceReference you want to return.
>>>>>>
>>>>>> What kind of processes will be executed when I'm using DS like approaches (for me: Bnd annotation @Reference)? As I described in the above section: I want to decide which services should be referenced.
>>>>>
>>>>> I can only speak for the Apache Felix DS implementation: I use the BundleContext.getServiceReferences(String, String) to explicitly access service references using the BundleContext of the respective context (thus to also have OSGi security applied). I would assume that candidate service references are send to the FilterHook before getting the result to the DS implementation.
>>>>>
>>>>> So, unless there is a bug in the framework implementation or in your hook registration, your hook should really be called. (and of course only if the getServiceReferences call comes after your hook is registered.
>>>>>
>>>>> Regards
>>>>> Felix
>>>>>
>>>>>>
>>>>>> Greetings.
>>>>>> Christian
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> 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
>>
>>
>> ---------------------------------------------------------------------
>> 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: DS and FindHook
Posted by Felix Meschberger <fm...@adobe.com>.
Hi,
Am 02.08.2012 um 16:26 schrieb <co...@christian-vogel.info>:
> I'm using 4.0.1
Hmm, looking at the code the FindHook should actually be called.
Is you FindHook called at all -- for other situations, too ?
Is you DS component properly defined to use the bind method ? E.g. are you sure to not mix Apache Felix SCR annotations with BND DS annotations ?
Regards
Felix
>
> ----- Original Message -----
> From: fmeschbe@adobe.com
> To: users@felix.apache.org
> Date: 02.08.2012 16:23:28
> Subject: Re: DS and FindHook
>
>
>> Hi,
>>
>> Am 02.08.2012 um 16:21 schrieb <co...@christian-vogel.info>:
>>
>>> Hi Felix,
>>>
>>> thx for your answer. I completely forgot to tell that I'm using Apache Felix of course.
>>>
>>> I tried my FindHook with the more general way by calling BundleContext.getServiceReference and there it works. So as you told that must be an issue of the framework.
>>
>> This of course bears the next question: Which version of the framework are you using ?
>>
>> Regards
>> Felix
>>
>>>
>>> Greetings.
>>> Christian
>>>
>>> ----- Original Message -----
>>> From: fmeschbe@adobe.com
>>> To: users@felix.apache.org
>>> Date: 02.08.2012 16:01:56
>>> Subject: Re: DS and FindHook
>>>
>>>
>>>> Hi,
>>>>
>>>> Am 02.08.2012 um 14:32 schrieb <co...@christian-vogel.info>:
>>>>
>>>>> Hi,
>>>>>
>>>>> Today I worked a little bit with OSGi Hooks, specially with FindHook and EventListenerHook for services. I wanted to try out proxying services. The EventListenerHook works fine and my services are proxied. But I realized that the FindHook event would'nt be called if a service will get a reference of the service implementation by annotating the related setXXX method with @Reference (Bnd style). Maybe it is not a problem with the annotation, but with DS in general.
>>>>>
>>>>> This is quite bad, bc there are two services registered one without proxy and one proxied. I only want to get references from the proxied one. In general, without DS, you can get references by calling BundleContext.getServiceReference(java.lang.Class<S> clazz) and the event FindHook.find will be called, where you can decide which ServiceReference you want to return.
>>>>>
>>>>> What kind of processes will be executed when I'm using DS like approaches (for me: Bnd annotation @Reference)? As I described in the above section: I want to decide which services should be referenced.
>>>>
>>>> I can only speak for the Apache Felix DS implementation: I use the BundleContext.getServiceReferences(String, String) to explicitly access service references using the BundleContext of the respective context (thus to also have OSGi security applied). I would assume that candidate service references are send to the FilterHook before getting the result to the DS implementation.
>>>>
>>>> So, unless there is a bug in the framework implementation or in your hook registration, your hook should really be called. (and of course only if the getServiceReferences call comes after your hook is registered.
>>>>
>>>> Regards
>>>> Felix
>>>>
>>>>>
>>>>> Greetings.
>>>>> Christian
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> 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
>
>
> ---------------------------------------------------------------------
> 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: Re: DS and FindHook
Posted by co...@christian-vogel.info.
I'm using 4.0.1
----- Original Message -----
From: fmeschbe@adobe.com
To: users@felix.apache.org
Date: 02.08.2012 16:23:28
Subject: Re: DS and FindHook
> Hi,
>
> Am 02.08.2012 um 16:21 schrieb <co...@christian-vogel.info>:
>
>> Hi Felix,
>>
>> thx for your answer. I completely forgot to tell that I'm using Apache Felix of course.
>>
>> I tried my FindHook with the more general way by calling BundleContext.getServiceReference and there it works. So as you told that must be an issue of the framework.
>
> This of course bears the next question: Which version of the framework are you using ?
>
> Regards
> Felix
>
>>
>> Greetings.
>> Christian
>>
>> ----- Original Message -----
>> From: fmeschbe@adobe.com
>> To: users@felix.apache.org
>> Date: 02.08.2012 16:01:56
>> Subject: Re: DS and FindHook
>>
>>
>>> Hi,
>>>
>>> Am 02.08.2012 um 14:32 schrieb <co...@christian-vogel.info>:
>>>
>>>> Hi,
>>>>
>>>> Today I worked a little bit with OSGi Hooks, specially with FindHook and EventListenerHook for services. I wanted to try out proxying services. The EventListenerHook works fine and my services are proxied. But I realized that the FindHook event would'nt be called if a service will get a reference of the service implementation by annotating the related setXXX method with @Reference (Bnd style). Maybe it is not a problem with the annotation, but with DS in general.
>>>>
>>>> This is quite bad, bc there are two services registered one without proxy and one proxied. I only want to get references from the proxied one. In general, without DS, you can get references by calling BundleContext.getServiceReference(java.lang.Class<S> clazz) and the event FindHook.find will be called, where you can decide which ServiceReference you want to return.
>>>>
>>>> What kind of processes will be executed when I'm using DS like approaches (for me: Bnd annotation @Reference)? As I described in the above section: I want to decide which services should be referenced.
>>>
>>> I can only speak for the Apache Felix DS implementation: I use the BundleContext.getServiceReferences(String, String) to explicitly access service references using the BundleContext of the respective context (thus to also have OSGi security applied). I would assume that candidate service references are send to the FilterHook before getting the result to the DS implementation.
>>>
>>> So, unless there is a bug in the framework implementation or in your hook registration, your hook should really be called. (and of course only if the getServiceReferences call comes after your hook is registered.
>>>
>>> Regards
>>> Felix
>>>
>>>>
>>>> Greetings.
>>>> Christian
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> 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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: DS and FindHook
Posted by Felix Meschberger <fm...@adobe.com>.
Hi,
Am 02.08.2012 um 16:21 schrieb <co...@christian-vogel.info>:
> Hi Felix,
>
> thx for your answer. I completely forgot to tell that I'm using Apache Felix of course.
>
> I tried my FindHook with the more general way by calling BundleContext.getServiceReference and there it works. So as you told that must be an issue of the framework.
This of course bears the next question: Which version of the framework are you using ?
Regards
Felix
>
> Greetings.
> Christian
>
> ----- Original Message -----
> From: fmeschbe@adobe.com
> To: users@felix.apache.org
> Date: 02.08.2012 16:01:56
> Subject: Re: DS and FindHook
>
>
>> Hi,
>>
>> Am 02.08.2012 um 14:32 schrieb <co...@christian-vogel.info>:
>>
>>> Hi,
>>>
>>> Today I worked a little bit with OSGi Hooks, specially with FindHook and EventListenerHook for services. I wanted to try out proxying services. The EventListenerHook works fine and my services are proxied. But I realized that the FindHook event would'nt be called if a service will get a reference of the service implementation by annotating the related setXXX method with @Reference (Bnd style). Maybe it is not a problem with the annotation, but with DS in general.
>>>
>>> This is quite bad, bc there are two services registered one without proxy and one proxied. I only want to get references from the proxied one. In general, without DS, you can get references by calling BundleContext.getServiceReference(java.lang.Class<S> clazz) and the event FindHook.find will be called, where you can decide which ServiceReference you want to return.
>>>
>>> What kind of processes will be executed when I'm using DS like approaches (for me: Bnd annotation @Reference)? As I described in the above section: I want to decide which services should be referenced.
>>
>> I can only speak for the Apache Felix DS implementation: I use the BundleContext.getServiceReferences(String, String) to explicitly access service references using the BundleContext of the respective context (thus to also have OSGi security applied). I would assume that candidate service references are send to the FilterHook before getting the result to the DS implementation.
>>
>> So, unless there is a bug in the framework implementation or in your hook registration, your hook should really be called. (and of course only if the getServiceReferences call comes after your hook is registered.
>>
>> Regards
>> Felix
>>
>>>
>>> Greetings.
>>> Christian
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: Re: DS and FindHook
Posted by co...@christian-vogel.info.
Hi Felix,
thx for your answer. I completely forgot to tell that I'm using Apache Felix of course.
I tried my FindHook with the more general way by calling BundleContext.getServiceReference and there it works. So as you told that must be an issue of the framework.
Greetings.
Christian
----- Original Message -----
From: fmeschbe@adobe.com
To: users@felix.apache.org
Date: 02.08.2012 16:01:56
Subject: Re: DS and FindHook
> Hi,
>
> Am 02.08.2012 um 14:32 schrieb <co...@christian-vogel.info>:
>
>> Hi,
>>
>> Today I worked a little bit with OSGi Hooks, specially with FindHook and EventListenerHook for services. I wanted to try out proxying services. The EventListenerHook works fine and my services are proxied. But I realized that the FindHook event would'nt be called if a service will get a reference of the service implementation by annotating the related setXXX method with @Reference (Bnd style). Maybe it is not a problem with the annotation, but with DS in general.
>>
>> This is quite bad, bc there are two services registered one without proxy and one proxied. I only want to get references from the proxied one. In general, without DS, you can get references by calling BundleContext.getServiceReference(java.lang.Class<S> clazz) and the event FindHook.find will be called, where you can decide which ServiceReference you want to return.
>>
>> What kind of processes will be executed when I'm using DS like approaches (for me: Bnd annotation @Reference)? As I described in the above section: I want to decide which services should be referenced.
>
> I can only speak for the Apache Felix DS implementation: I use the BundleContext.getServiceReferences(String, String) to explicitly access service references using the BundleContext of the respective context (thus to also have OSGi security applied). I would assume that candidate service references are send to the FilterHook before getting the result to the DS implementation.
>
> So, unless there is a bug in the framework implementation or in your hook registration, your hook should really be called. (and of course only if the getServiceReferences call comes after your hook is registered.
>
> Regards
> Felix
>
>>
>> Greetings.
>> Christian
>>
>>
>> ---------------------------------------------------------------------
>> 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: DS and FindHook
Posted by Felix Meschberger <fm...@adobe.com>.
Hi,
Am 02.08.2012 um 14:32 schrieb <co...@christian-vogel.info>:
> Hi,
>
> Today I worked a little bit with OSGi Hooks, specially with FindHook and EventListenerHook for services. I wanted to try out proxying services. The EventListenerHook works fine and my services are proxied. But I realized that the FindHook event would'nt be called if a service will get a reference of the service implementation by annotating the related setXXX method with @Reference (Bnd style). Maybe it is not a problem with the annotation, but with DS in general.
>
> This is quite bad, bc there are two services registered one without proxy and one proxied. I only want to get references from the proxied one. In general, without DS, you can get references by calling BundleContext.getServiceReference(java.lang.Class<S> clazz) and the event FindHook.find will be called, where you can decide which ServiceReference you want to return.
>
> What kind of processes will be executed when I'm using DS like approaches (for me: Bnd annotation @Reference)? As I described in the above section: I want to decide which services should be referenced.
I can only speak for the Apache Felix DS implementation: I use the BundleContext.getServiceReferences(String, String) to explicitly access service references using the BundleContext of the respective context (thus to also have OSGi security applied). I would assume that candidate service references are send to the FilterHook before getting the result to the DS implementation.
So, unless there is a bug in the framework implementation or in your hook registration, your hook should really be called. (and of course only if the getServiceReferences call comes after your hook is registered.
Regards
Felix
>
> Greetings.
> Christian
>
>
> ---------------------------------------------------------------------
> 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