Re: Injecting service into command

2016-04-27 Thread Jean-Baptiste Onofré
Long old story ;) On 04/27/2016 06:59 PM, David Daniel wrote: http://www.mail-archive.com/users%40felix.apache.org/msg16883.html sorry I linked to my email because I make hasty decisions. This link talks about the additions better. On Wed, Apr 27, 2016 at 12:57 PM, David Daniel

Re: Injecting service into command

2016-04-27 Thread David Daniel
http://www.mail-archive.com/users%40felix.apache.org/msg16883.html sorry I linked to my email because I make hasty decisions. This link talks about the additions better. On Wed, Apr 27, 2016 at 12:57 PM, David Daniel wrote: > For what it is worth I would love to

Re: Injecting service into command

2016-04-27 Thread David Daniel
For what it is worth I would love to see the karaf shell start to see what they could give back to the gogo shell. For awhile it seemed like no work was going into improving the gogo shell but recently Guillaume has been putting in some good improvements

Re: Injecting service into command

2016-04-27 Thread Christian Schneider
Interesting. How does that work? Christian 2016-04-27 18:18 GMT+02:00 Jean-Baptiste Onofré : > It's already possible as soon as you register the right command service. > > Regards > JB > > On 04/27/2016 05:43 PM, Milen Dyankov wrote: > >> I personally would prefer to be able

Re: Injecting service into command

2016-04-27 Thread Jean-Baptiste Onofré
I don't see how it can work. If you deploy in pure felix, you won't have the Karaf command "benefits". The R6 annotations are not enough to cover all Karaf command features, and creating annotations on top of that will work only in Karaf. The best would be to enhance Gogo directly with Karaf

Re: Injecting service into command

2016-04-27 Thread Milen Dyankov
Oh those I can do :) I thought you meant karaf command. So to refine my earlier statement I would like to be able to create a karaf command (with all the custom karaf enhancements) but by using standard R6 annotations and perhaps some custom ones on top of that. So that if I deploy my bundle say

Re: Injecting service into command

2016-04-27 Thread Jean-Baptiste Onofré
What I already test is not really Karaf command, but more Gogo command (so with limited feature compared to pure Karaf command) (using the shell-compat feature). It worked fine. Let me find it out. Regards JB On 04/27/2016 06:21 PM, Milen Dyankov wrote: Do you happen to have an example? 27

Re: Injecting service into command

2016-04-27 Thread Milen Dyankov
Do you happen to have an example? 27 kwi 2016 18:20 "Jean-Baptiste Onofré" napisał(a): > We created such annotations to simplify the way to create commands. > > It's possible to use DS to create the command service, but you have to do > some plumbing (service properties for

Re: Injecting service into command

2016-04-27 Thread Jean-Baptiste Onofré
We created such annotations to simplify the way to create commands. It's possible to use DS to create the command service, but you have to do some plumbing (service properties for scope, etc). Regards JB On 04/27/2016 05:44 PM, Alex Soto wrote: I ended up doing OSGI lookup, turned out to

Re: Injecting service into command

2016-04-27 Thread Jean-Baptiste Onofré
It's already possible as soon as you register the right command service. Regards JB On 04/27/2016 05:43 PM, Milen Dyankov wrote: I personally would prefer to be able to create Karaf command with standard R6 annotations instead. Or at least standard compatible ones. On Wed, Apr 27, 2016 at

Re: Injecting service into command

2016-04-27 Thread Alex Soto
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

Re: Injecting service into command

2016-04-27 Thread Milen Dyankov
I personally would prefer to be able to create Karaf command with standard R6 annotations instead. Or at least standard compatible ones. On Wed, Apr 27, 2016 at 4:21 PM, Jean-Baptiste Onofré wrote: > It works if you create another class that contains the DS annotation. Then >

Re: Injecting service into command

2016-04-27 Thread Jean-Baptiste Onofré
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

Re: Injecting service into command

2016-04-27 Thread Jean-Baptiste Onofré
By the way, we can extend the @Reference annotation to add filtering there. Regards JB On 04/26/2016 09:33 PM, Alex Soto 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

Re: Injecting service into command

2016-04-27 Thread Christian Schneider
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

Re: Injecting service into command

2016-04-27 Thread Timothy Ward
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 )

Re: Injecting service into command

2016-04-27 Thread Charles Moulliard
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

Re: Injecting service into command

2016-04-26 Thread Alex Soto
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é

Re: Injecting service into command

2016-04-26 Thread Jean-Baptiste Onofré
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

Injecting service into command

2016-04-26 Thread Alex Soto
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