Re: Question about @Reference Karaf Command annotation

2020-07-16 Thread Jean-Baptiste Onofre
Hi guys, Thanks for the Jira. I did some cleanup (we had two Jira for the same thing) and I already started to work on a fix. Regards JB > Le 16 juil. 2020 à 15:52, Paul Spencerx a écrit : > > Alex, > I have created the following Jira. Please note the Jira describes the > behavior and

Re: Question about @Reference Karaf Command annotation

2020-07-16 Thread Paul Spencerx
Alex, I have created the following Jira. Please note the Jira describes the behavior and references this thread. You may add information regarding the suspected root cause. https://issues.apache.org/jira/browse/KARAF-6790 Paul Spencer > On Jul 16, 2020, at 8:50 AM, Alex Soto wrote: > >

Re: Question about @Reference Karaf Command annotation

2020-07-16 Thread Paul Spencer
Alex, I have created the following Jira. Please note the Jira describes the behavior and references this thread. You may add information regarding the suspected root cause. https://issues.apache.org/jira/browse/KARAF-6790 Paul Spencer > On Jul 16, 2020, at 8:50 AM, Alex Soto wrote: > > I

Re: Question about @Reference Karaf Command annotation

2020-07-16 Thread Alex Soto
I also believe there is a bug here; I had pasted in a previous post the part of the code I suspect is at fault. Best regards, Alex soto > On Jul 16, 2020, at 6:26 AM, João Assunção > wrote: > > Paul, > you are right. I think there is a bug in the implementation of > SingleServiceTracker

Re: Question about @Reference Karaf Command annotation

2020-07-16 Thread João Assunção
Paul, you are right. I think there is a bug in the implementation of SingleServiceTracker used to bind service references in commands. The filter is used for the listener but is ignored when retrieving the serviceReference. For example: If the command starts and the services are available, it

Re: Question about @Reference Karaf Command annotation

2020-07-15 Thread Paul Spencer
Martin, Parenthesis in the @Reference, org.apache.karaf.shell.api.action.lifecycle.Reference, for the Command did not change the results, this the wrong service was returned. Parenthesis are required for the @Reference,org.osgi.service.component.annotations.Reference, in the @Component.

Re: Re: Question about @Reference Karaf Command annotation

2020-07-15 Thread Martin Lichtin
Yes that should work. You need the parenthesis. The code is doing something like     String filterString = '(' + Constants.OBJECTCLASS + '=' + clazz.getName() + ')';     if (filter != null && !filter.isEmpty()) {     filterString = "(&" + filterString +

Re: Question about @Reference Karaf Command annotation

2020-07-15 Thread João Assunção
Hello all, Have you tried to use an LDAP filter expression? Instead of *color=red* try *(color=red). *(I haven't tried this myself) João Assunção Email: joao.assun...@exploitsys.com Mobile: +351 916968984 Phone: +351 211933149 Web: www.exploitsys.com On Mon, Jul 13, 2020 at 6:33 PM Paul

Re: Question about @Reference Karaf Command annotation

2020-07-13 Thread Paul Spencerx
JB, What is the status of your checking? @Reference for commands is not working for me either. I have included related code and output from Karaf below. *** * Testing commands *** karaf@root()> color --help SUBSHELL color COMMANDS color:get-any Get any Service color:get-blue

Re: Question about @Reference Karaf Command annotation

2020-03-12 Thread Alex Soto
Just to clarify, when I say it does not work, I mean that the injected service is not the correct one matching the filter expression. Best regards, Alex soto > On Mar 12, 2020, at 9:24 AM, Jean-Baptiste Onofre wrote: > > Hi, > > Let me check, but AFAIR, I have a test about that and it

Re: Question about @Reference Karaf Command annotation

2020-03-12 Thread Jean-Baptiste Onofre
Hi, Let me check, but AFAIR, I have a test about that and it seems to work. I will create a Jira to double check. Regards JB > Le 12 mars 2020 à 14:23, Alex Soto a écrit : > > I see, but it is not working for me… > > The PR does not update >

Re: Question about @Reference Karaf Command annotation

2020-03-12 Thread Alex Soto
I see, but it is not working for me… The PR does not update org.apache.karaf.shell.impl.action.command.ManagerImpl#instantiate, shouldn’t this method be updated also to inject the appropriate service when the command is instantiated? (See code fragment I pasted earlier) Best regards, Alex

Re: Question about @Reference Karaf Command annotation

2020-03-12 Thread Jean-Baptiste Onofre
Hi Alex, You can find the change I did about that here: https://github.com/apache/karaf/pull/992 Regards JB > Le 12 mars 2020 à 14:02, Alex Soto a écrit : > > Thanks, JB > > But it doesn’t seem to work for Karaf 4.2.8. > I am not familiar with

Re: Question about @Reference Karaf Command annotation

2020-03-12 Thread Alex Soto
Thanks, JB But it doesn’t seem to work for Karaf 4.2.8. I am not familiar with the internals of Karaf code, but I spotted the following in org.apache.karaf.shell.impl.action.command.ManagerImpl.instantiate of org.apache.karaf.shell.core-4.2.8.jar: Reference ref =

Re: Question about @Reference Karaf Command annotation

2020-03-11 Thread Jean-Baptiste Onofre
Hi, Yes, it’s to "select" the service you want to use. I did the change because previously it wasn’t possible to select, meaning that if you had several services (with the same interface) available, it took the first one. Now, you can specify the LDIF filter to select the exact service you

Question about @Reference Karaf Command annotation

2020-03-11 Thread Alex Soto
Is the filter attribute in annotation org.apache.karaf.shell.api.action.lifecycle.Reference used to filter the injected service on Service attributes? Best regards, Alex soto