Hi Alex, I would strongly recommend using the standard Declarative Services annotations (https://osgi.org/javadoc/r6/enterprise/org/osgi/service/component/annotations/package-summary.html <https://osgi.org/javadoc/r6/enterprise/org/osgi/service/component/annotations/package-summary.html>) over the Felix or bnd equivalents.
Regards, Tim > On 27 Apr 2016, at 09:22, Charles Moulliard <[email protected]> wrote: > > Hi Alex, > > Apache Felix SCR or Declarative Service provides Annotations where you can > specify using a filter the service to be used with @Reference (see target) > > --> > > http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/scr-annotations.html#reference > > <http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin/scr-annotations.html#reference> > > http://grepcode.com/file/repo1.maven.org/maven2/org.apache.felix/org.apache.felix.scr.annotations/1.6.0/org/apache/felix/scr/annotations/Reference.java#Reference.target%28%29 > > <http://grepcode.com/file/repo1.maven.org/maven2/org.apache.felix/org.apache.felix.scr.annotations/1.6.0/org/apache/felix/scr/annotations/Reference.java#Reference.target%28%29> > > Regards, > > On Tue, Apr 26, 2016 at 9:33 PM, Alex Soto <[email protected] > <mailto:[email protected]>> wrote: > Hi JB, > > Thanks, > > I understand I can do lookup with bundle context. > I am sorry I don’t know what “DS annotation” is. Can you clarify? > > Also, how about injecting list of all services of the same interface? > > Best regards, > Alex soto > > > > > On Apr 26, 2016, at 3:23 PM, Jean-Baptiste Onofré <[email protected] > > <mailto:[email protected]>> wrote: > > > > Hi Alex, > > > > You want to provide a filter I guess ? > > > > @Reference doesn't support filter for now. However, you can use DS > > annotation (supporting filter) or directly lookup the service via the > > bundle context. > > > > Regards > > JB > > > > On 04/26/2016 08:55 PM, Alex Soto wrote: > >> Hello, > >> > >> I am creating a Karaf command into which I need a service injected. I > >> understand that I need to use the annotation @Reference, but in my case I > >> have different services with the same class, so I need to be able to > >> specify a filter; however, the @Reference annotation does not have any > >> property for this purpose, so how is it done? > >> > >> Best regards, > >> Alex soto > >> > >> > >> > > > > -- > > Jean-Baptiste Onofré > > [email protected] <mailto:[email protected]> > > http://blog.nanthrax.net <http://blog.nanthrax.net/> > > Talend - http://www.talend.com <http://www.talend.com/> > > > > > -- > Charles Moulliard > Apache Committer & PMC / Architect @RedHat > Twitter : @cmoulliard | Blog : http://cmoulliard.github.io > <http://cmoulliard.github.io/> >
