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
mailto:david.daniel.1...@gmail.com>> wrote:

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
https://mail.google.com/mail/u/0/#search/jline/1539a57f6c379ac3
Gogo shell before was lacking major features like history and
coloring but I think they are being worked now.  Also the base
libraries are used in other things I use like the jline and the
scala shell.  I would love to see additions and bug fixes going back
to the same sources.

On Wed, Apr 27, 2016 at 12:44 PM, Jean-Baptiste Onofré
mailto:j...@nanthrax.net>> wrote:

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 features.
But the community wasn't receptive when we proposed that.

Regards
JB

On 04/27/2016 06:39 PM, Milen Dyankov wrote:

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 in plain Felix it works as regular gogo
command
but if deployed in Karaf it benefits from the nice Karaf
add-ons.

27 kwi 2016 18:32 "Jean-Baptiste Onofré" mailto:j...@nanthrax.net>
>> napisał(a):

 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 kwi 2016 18:20 "Jean-Baptiste Onofré"
mailto:j...@nanthrax.net>
 >
 


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 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
> https://mail.google.com/mail/u/0/#search/jline/1539a57f6c379ac3  Gogo
> shell before was lacking major features like history and coloring but I
> think they are being worked now.  Also the base libraries are used in other
> things I use like the jline and the scala shell.  I would love to see
> additions and bug fixes going back to the same sources.
>
> On Wed, Apr 27, 2016 at 12:44 PM, Jean-Baptiste Onofré 
> wrote:
>
>> 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 features. But the
>> community wasn't receptive when we proposed that.
>>
>> Regards
>> JB
>>
>> On 04/27/2016 06:39 PM, Milen Dyankov wrote:
>>
>>> 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 in plain Felix it works as regular gogo command
>>> but if deployed in Karaf it benefits from the nice Karaf add-ons.
>>>
>>> 27 kwi 2016 18:32 "Jean-Baptiste Onofré" >> > napisał(a):
>>>
>>> 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 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 scope, etc).
>>>
>>>  Regards
>>>  JB
>>>
>>>  On 04/27/2016 05:44 PM, Alex Soto wrote:
>>>
>>>  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é
>>>  mailto:j...@nanthrax.net>
>>> >> 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
>>>

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
https://mail.google.com/mail/u/0/#search/jline/1539a57f6c379ac3  Gogo shell
before was lacking major features like history and coloring but I think
they are being worked now.  Also the base libraries are used in other
things I use like the jline and the scala shell.  I would love to see
additions and bug fixes going back to the same sources.

On Wed, Apr 27, 2016 at 12:44 PM, Jean-Baptiste Onofré 
wrote:

> 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 features. But the
> community wasn't receptive when we proposed that.
>
> Regards
> JB
>
> On 04/27/2016 06:39 PM, Milen Dyankov wrote:
>
>> 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 in plain Felix it works as regular gogo command
>> but if deployed in Karaf it benefits from the nice Karaf add-ons.
>>
>> 27 kwi 2016 18:32 "Jean-Baptiste Onofré" > > napisał(a):
>>
>> 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 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 scope, etc).
>>
>>  Regards
>>  JB
>>
>>  On 04/27/2016 05:44 PM, Alex Soto wrote:
>>
>>  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é
>>  mailto:j...@nanthrax.net>
>> >> 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
>> 

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 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 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é
>> jbono...@apache.org 
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>>
>>
>>
>> --
>> http://about.me/milen
>>
>
> --
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>



-- 
-- 
Christian Schneider
http://www.liquid-reality.de


Open Source Architect
http://www.talend.com



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 features. But the 
community wasn't receptive when we proposed that.


Regards
JB

On 04/27/2016 06:39 PM, Milen Dyankov wrote:

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 in plain Felix it works as regular gogo command
but if deployed in Karaf it benefits from the nice Karaf add-ons.

27 kwi 2016 18:32 "Jean-Baptiste Onofré" mailto:j...@nanthrax.net>> napisał(a):

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 kwi 2016 18:20 "Jean-Baptiste Onofré" mailto:j...@nanthrax.net>
>> 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 scope, etc).

 Regards
 JB

 On 04/27/2016 05:44 PM, Alex Soto wrote:

 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é
 mailto:j...@nanthrax.net>
>> 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é
jbono...@apache.org 
>
http://blog.nanthrax.net
 Talend - http://www.talend.com



 --
 Jean-Baptiste Onofré
jbono...@apache.org 
>
   

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
in plain Felix it works as regular gogo command  but if deployed in Karaf
it benefits from the nice Karaf add-ons.
27 kwi 2016 18:32 "Jean-Baptiste Onofré"  napisał(a):

> 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 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 scope, etc).
>>
>> Regards
>> JB
>>
>> On 04/27/2016 05:44 PM, Alex Soto wrote:
>>
>> 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é
>> mailto:j...@nanthrax.net>> 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é
>> jbono...@apache.org 
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>>
>>
>> --
>> Jean-Baptiste Onofré
>> jbono...@apache.org 
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com
>>
>>
> --
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>


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 kwi 2016 18:20 "Jean-Baptiste Onofré" mailto:j...@nanthrax.net>> 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 scope, etc).

Regards
JB

On 04/27/2016 05:44 PM, Alex Soto wrote:

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é
mailto:j...@nanthrax.net>> 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é
jbono...@apache.org 
http://blog.nanthrax.net
Talend - http://www.talend.com



--
Jean-Baptiste Onofré
jbono...@apache.org 
http://blog.nanthrax.net
Talend - http://www.talend.com



--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


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 scope, etc).
>
> Regards
> JB
>
> On 04/27/2016 05:44 PM, Alex Soto wrote:
>
>> 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é 
>>> 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é
>>> jbono...@apache.org
>>> http://blog.nanthrax.net
>>> Talend - http://www.talend.com
>>>
>>
>>
> --
> Jean-Baptiste Onofré
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>


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 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é  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é
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com




--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


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 4:21 PM, Jean-Baptiste Onofré mailto:j...@nanthrax.net>> 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é
jbono...@apache.org 
http://blog.nanthrax.net
Talend - http://www.talend.com




--
http://about.me/milen


--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


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 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é  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é
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com



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
> 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é
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>



-- 
http://about.me/milen


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 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é
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


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 list of all services of the same interface?

Best regards,
Alex soto




On Apr 26, 2016, at 3:23 PM, Jean-Baptiste Onofré  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é
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com




--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


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 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



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
 
)
 over the Felix or bnd equivalents.

Regards,

Tim


> On 27 Apr 2016, at 09:22, Charles Moulliard  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://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  > 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é  > > 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é
> > jbono...@apache.org 
> > http://blog.nanthrax.net 
> > Talend - http://www.talend.com 
> 
> 
> 
> 
> -- 
> Charles Moulliard
> Apache Committer & PMC / Architect @RedHat
> Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io 
> 
> 



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

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  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é 
> 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é
> > jbono...@apache.org
> > http://blog.nanthrax.net
> > Talend - http://www.talend.com
>
>


-- 
Charles Moulliard
Apache Committer & PMC / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io


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é  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é
> jbono...@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com



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 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é
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com


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 property for this 
purpose, so how is it done?

Best regards,
Alex soto