Hi, Am 02.08.2012 um 16:21 schrieb <[email protected]>:
> 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: [email protected] > To: [email protected] > Date: 02.08.2012 16:01:56 > Subject: Re: DS and FindHook > > >> Hi, >> >> Am 02.08.2012 um 14:32 schrieb <[email protected]>: >> >>> 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: [email protected] >>> For additional commands, e-mail: [email protected] >>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

