Hi Matthias,

Can't you use filter ?

Each service implementing MyInterfaceB can use a service property that
you filter on @Reference.

Regards
JB

On 15/05/2019 15:35, Matthias Leinweber wrote:
> Hello Karaf Experts,
> 
> 
> i am trying to isolate services from each other. 
> 
> 
> For Exampleyou have a component:
> 
> 
> @Component(
>     configurationPid = "MyInterfacA.factory",
>     configurationPolicy = ConfigurationPolicy.REQUIRE,
> public Class MyInterfaceAImpl implements MyInterfacA{
> 
> @Reference
> 
> MyInterfaceB service;
> 
> 
>  ...}
> 
> 
> During runtime I create multiple services from type MyInterfaceB and
> multiple componentes of MyInterfaceAImpl with configadmin.
> 
> Depending on the configuration of MyInterfaceAImpl I want to filter
> which MyInterfaceB implementation is injected.
> 
> I thought about FindHook but there I dont see a way how to get the
> information which service from the bundle is requesting the reference.
> 
> 
> Is there any chance to do this, or do I have to go for an alternative
> design. Or a better way to isolate services from another?
> 
> 
> 
> Best regards,
> 
> Matthias
> 

-- 
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to