for instance, from R7 cmpn…
112.3.10 Selecting Target Services
…
• The filter is manifested as a component property called the target
property. The target property can also be set by property and properties
elements, see Property and Properties Elements on page 339. The deployer can
also set the target property by establishing a configuration for the component
which sets the value of the target property. This allows the deployer to
override the target property in the component description. See Target Property
on page 357 for more information.
also 112.6.2.1
Hope this helps
David Jencks
> On May 15, 2019, at 10:28 AM, Markus Rathgeb <[email protected]> wrote:
>
> Hi Tim,
>
> can you point me to the part of the spec that states that service
> configuration properties can be used to set such fields (e.g. target filter)?
> I just know that it works ;)
>
> Best regards,
> Markus
>
> Tim Ward <[email protected]> schrieb am Mi., 15. Mai 2019, 15:45:
> Declarative Services is amazing, so this is trivially easy to do. In this
> case you should add the configuration property
>
> service.target
>
> to your configuration dictionary with the value being an LDAP filter
> selecting the service you want to inject.
>
> Note that “service” is the name of your reference (it defaults to the field
> name) and that if your reference has a different name (e.g. if you change the
> name of the field) then the name of the property will change too.
>
> For example:
>
> service.target=(foo=bar)
>
> Inject me with a MyInterfaceB which has the service property foo equal to bar.
>
> All the best,
>
> Tim
>
>> On 15 May 2019, at 14:35, Matthias Leinweber
>> <[email protected]> wrote:
>>
>> Hello Karaf Experts,
>>
>> i am trying to isolate services from each other.
>>
>> For Example you 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
>