The purpose of the @Reference.target is to be overridden by configuration, adding the filter to the requirement would basically destroy that use case.
For what you want there is a very good solution: Plain Old Java Types … I suspect that in your code you already do some casting to a more specific type from RComponent? If that is the case then you have a bad code smell, which is also visible in Camel I think. We ‘know’ the type but we’re forced to go to properties to line things up as we want. However, I am guessing so you might need it in a different scenario. If you want to do what you want I think you can use the annotation support in bnd for requirements. @RequireCapability( ns=“osgi.service”, filter=“(&(objectClass=org.apache.karaf.rcomp.api.RComponent)(name=${value}))” ) @interface ReqRc { String value(); } @ReqRc(“mqtt” ) @Component(property=“name=mqtt”) public class … Hope this helps. Kind regards, Peter Kriens > On 17 Aug 2017, at 10:07, Christian Schneider <ch...@die-schneider.net> wrote: > > I am currently working on a little framework that offers components with a > common service interface but different property value per component. > > LIke: > > https://github.com/cschneider/reactive-components/blob/master/rcomp-mqtt/src/main/java/org/apache/karaf/rcomp/mqtt/MqttComponent.java > @Component(property="name=mqtt") > > A user of the mqtt component will use a filter like this: > @Reference(target="(name=mqtt)") > > Bnd creates a requirement like this: > osgi.service;filter:="(objectClass=org.apache.karaf.rcomp.api.RComponent)";effective:=active > > The requirement does not include the filter. > > It would be nice if bndtools or karaf later could help me by auto picking or > recommending the mqtt component bundle when the user bundle is required. > > Can I somehow make bnd create a requirement including a filter? .. or > alternatively is there another easy to use way how a specific provider can > announce itself and a user bundle can specify the requirement for a specific > provider? > > I think this same problem applies to Apache Camel. When a user bundle uses a > certain camel component then the resolver currently does not help with this > and the bundle fails at runtime. > > Christian > > -- > Christian Schneider > http://www.liquid-reality.de > > Open Source Architect > http://www.talend.com > > _______________________________________________ > OSGi Developer Mail List > osgi-dev@mail.osgi.org > https://mail.osgi.org/mailman/listinfo/osgi-dev _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev