I ended up doing OSGI lookup, turned out to be more convenient for me, because I needed to handle all services that matched a particular interface, and since I have not used this Declarative Service approach, I lack experience on how to make it work. Thanks to all who helped.
Now that my initial problem is out of the way, I wonder why the Command API uses a custom @Reference annotation, as opposed to the seemingly more standard Declarative Service @Reference, specially when the DS version offers a richer set of features. Is it because it would force the service to also use the DS annotations? Best regards, Alex soto > On Apr 27, 2016, at 10:21 AM, Jean-Baptiste Onofré <[email protected]> wrote: > > It works if you create another class that contains the DS annotation. Then > you can inject into the command. I did it already. > > Regards > JB > > On 04/27/2016 04:15 PM, Christian Schneider wrote: >> I fully agree .. normally. Unfortunately I think the DS annotations will >> not work for karaf commands as they >> are handled by a custom extender that is not related to DS. >> >> A simple solution might be to inject an intermediate internal DS >> component into the command and do a proper DS service reference in this >> intermediate. >> >> Christian >> >> On 27.04.2016 11:57, Timothy Ward wrote: >>> 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) >>> over the Felix or bnd equivalents. >>> >>> Regards, >>> >>> Tim >>> >> >> -- >> Christian Schneider >> http://www.liquid-reality.de >> >> Open Source Architect >> http://www.talend.com >> > > -- > Jean-Baptiste Onofré > [email protected] > http://blog.nanthrax.net > Talend - http://www.talend.com
