You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Joel Schuster <jo...@opsysinc.com> on 2012/08/21 14:36:00 UTC

Command with Multiple Arguments

Is there a way to assign separate completers to different arguments? If I
have a command with two arguments for example, how do I assign different
completers? I would have assumed that even using a single completer I could
key off of the 'cursor' argument, but it's always 0.

 

For example, the following does not work, but would seem intuitive for this
problem.

 

<command name="test/assign">

                                    <action
class="org.example.console.commands.MyAssign">

                                                <property name="myCommander"
ref="myCommander" />

                                                <property name="eventAdmin"
ref="eventAdmin" />

                                    </action>

                                    <completers>

                                                <ref
component-id="arg1Completer" />

                                                <ref
component-id="arg2Completer" />

                                                <null />

                                    </completers>

                        </command>

 

 

 

 

Description: OSI Logo - small

 

Joel Schuster

Operational Systems, Inc.

6514 Fairways Drive

Longmont, CO 80503

 

Phone: 719 445 8789

Email: joel.schuster@opsysinc.com

Web:  <http://www.opsysinc.com/> www.opsysinc.com

 


RE: Command with Multiple Arguments

Posted by Joel Schuster <jo...@opsysinc.com>.
My fault, it works just fine. I'm not sure what I was seeing now.

 

Thanks for humoring me.

 

 

- Joel

 

From: Ioannis Canellos [mailto:iocanel@gmail.com] 
Sent: Tuesday, August 21, 2012 10:28 AM
To: user@karaf.apache.org
Subject: Re: Command with Multiple Arguments

 

In your example the first completer in the list will be used for the first
argument, the second completer for the second and so on.

 

This works right now (and for almost 2 years now, if not more). 

 

Can you share some more details on what you want to do?

 

-- 
Ioannis Canellos

 <http://fusesource.com> FuseSource

 

Blog: http://iocanel.blogspot.com <http://iocanel.blogspot.com/> 

Twitter: iocanel

 

 


Re: updating features.xml in auto deploy folder results in duplication

Posted by Andrei Pozolotin <an...@gmail.com>.
Freeman:

great, thank you for the fix!

can you please also commit related issue in FeatureDeploymentListener:

https://issues.apache.org/jira/browse/KARAF-1752

Andrei

-------- Original Message --------
Subject: Re: updating features.xml in auto deploy folder results in
duplication
From: Freeman Fang <fr...@gmail.com>
To: user@karaf.apache.org
Date: Wed 22 Aug 2012 01:22:03 AM CDT
> Hi,
>
> yes, this is a bug, create KARAF-1754[1] to track it.
>
> [1]https://issues.apache.org/jira/browse/KARAF-1754
>
> Freeman
> -------------
> Freeman Fang
>
> FuseSource
> Email:ffang@fusesource.com
> Web: fusesource.com <http://fusesource.com>
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: http://weibo.com/u/1473905042
>
> On 2012-8-22, at 上午11:45, Andrei Pozolotin wrote:
>
>>     Hi,
>>
>>     if I am updating the same features.xml in auto deploy folder,
>>     such as one below
>>     and keep adding more and more features, then
>>
>>     feature:list shows that newly added features do show up,
>>     but the old ones are getting duplicated;
>>
>>     is it a feature or a bug? :-)
>>
>>     Thank you,
>>
>>     Andrei
>>
>>
>>     <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>     <features xmlns="http://karaf.apache.org/xmlns/features/v1.1.0"
>>     name="empty-repository">
>>
>>         <!-- these features should be auto installed -->
>>
>>         <feature install="auto" name="empty-feature-one"
>>     version="1.0.0" description="very empty">
>>         </feature>
>>
>>         <feature install="auto" name="empty-feature-two"
>>     version="2.0.0" description="extra empty">
>>         </feature>
>>
>>     </features>
>>
>


branding as a normal bundle?

Posted by Andrei Pozolotin <an...@gmail.com>.
    *Hi*

    I am not sure why branding needs to be a system bundle export
    http://karaf.apache.org/manual/latest-2.2.x/developers-guide/branding-console.html

    I am curious is there a way to inject it at startup.properties or
    bootFeatures stage, as a normal bundle?

    Thank you,

    Andrei


Re: updating features.xml in auto deploy folder results in duplication

Posted by Andrei Pozolotin <an...@gmail.com>.
there is another bug in FeatureDeploymentListener:

depending on your timing, auto deploy of feature.xml install="auto"
will fail because dependency bundles from the same xml file are still
resolved by mvn-url

if you keep restarting karaf, all dependencies eventually show up and
feature.xml starts to work :-)

-------- Original Message --------
Subject: Re: updating features.xml in auto deploy folder results in
duplication
From: Freeman Fang <fr...@gmail.com>
To: user@karaf.apache.org
Date: Wed 22 Aug 2012 01:22:03 AM CDT
> Hi,
>
> yes, this is a bug, create KARAF-1754[1] to track it.
>
> [1]https://issues.apache.org/jira/browse/KARAF-1754
>
> Freeman
> -------------
> Freeman Fang
>
> FuseSource
> Email:ffang@fusesource.com
> Web: fusesource.com <http://fusesource.com>
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: http://weibo.com/u/1473905042
>
> On 2012-8-22, at 上午11:45, Andrei Pozolotin wrote:
>
>>     Hi,
>>
>>     if I am updating the same features.xml in auto deploy folder,
>>     such as one below
>>     and keep adding more and more features, then
>>
>>     feature:list shows that newly added features do show up,
>>     but the old ones are getting duplicated;
>>
>>     is it a feature or a bug? :-)
>>
>>     Thank you,
>>
>>     Andrei
>>
>>
>>     <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
>>     <features xmlns="http://karaf.apache.org/xmlns/features/v1.1.0"
>>     name="empty-repository">
>>
>>         <!-- these features should be auto installed -->
>>
>>         <feature install="auto" name="empty-feature-one"
>>     version="1.0.0" description="very empty">
>>         </feature>
>>
>>         <feature install="auto" name="empty-feature-two"
>>     version="2.0.0" description="extra empty">
>>         </feature>
>>
>>     </features>
>>
>


Re: support recursive variable substitution in properties?

Posted by Andrei Pozolotin <an...@gmail.com>.
    Bengt

    Thank you for picking this up - yes system property, same problem

    with non-system property - works ok. I will try to dig into this.

    Andrei 

-------- Original Message --------
Subject: Re: support recursive variable substitution in properties?
From: Bengt Rodehav <be...@rodehav.com>
To: user@karaf.apache.org
Date: Fri 24 Aug 2012 01:17:25 AM CDT
> If the variable you are trying to use is a system property, then we
> have the same problem. I created a JIRA for this a while back:
>
> https://issues.apache.org/jira/browse/KARAF-1152
>
> I did however, believe that using already defined variables should
> work (provided that they have alredy been defined of course).
>
> /Bengt
>
>
> 2012/8/22 Jean-Baptiste Onofré <jb@nanthrax.net <ma...@nanthrax.net>>
>
>     It depends where. If you take a look in jre.properties, you will
>     see variables in.
>
>     It should work. By "does not work", you mean that you have an
>     exception, or the property doesn't include the variable value
>     (maybe a order issue depending where you put the variable first) ?
>
>     Regards
>     JB
>
>     On 08/22/2012 09:11 PM, Andrei Pozolotin wrote:
>
>             *Hi*
>
>
>             the following does not work, when placed in custom.properties:
>
>             org.osgi.framework.system.packages.extra =
>             org.apache.karaf.branding;
>         ${org.osgi.framework.system.packages.extra}
>
>             I am curious if karaf should support recursive variable
>         substitution?
>
>             Thank you,
>
>             Andrei
>
>
>     -- 
>     Jean-Baptiste Onofré
>     jbonofre@apache.org <ma...@apache.org>
>     http://blog.nanthrax.net
>     Talend - http://www.talend.com
>
>


Re: support recursive variable substitution in properties?

Posted by Bengt Rodehav <be...@rodehav.com>.
If the variable you are trying to use is a system property, then we have
the same problem. I created a JIRA for this a while back:

https://issues.apache.org/jira/browse/KARAF-1152

I did however, believe that using already defined variables should work
(provided that they have alredy been defined of course).

/Bengt


2012/8/22 Jean-Baptiste Onofré <jb...@nanthrax.net>

> It depends where. If you take a look in jre.properties, you will see
> variables in.
>
> It should work. By "does not work", you mean that you have an exception,
> or the property doesn't include the variable value (maybe a order issue
> depending where you put the variable first) ?
>
> Regards
> JB
>
> On 08/22/2012 09:11 PM, Andrei Pozolotin wrote:
>
>>     *Hi*
>>
>>
>>     the following does not work, when placed in custom.properties:
>>
>>     org.osgi.framework.system.**packages.extra =
>>     org.apache.karaf.branding; ${org.osgi.framework.system.**
>> packages.extra}
>>
>>     I am curious if karaf should support recursive variable substitution?
>>
>>     Thank you,
>>
>>     Andrei
>>
>>
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com
>

Re: support recursive variable substitution in properties?

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
It depends where. If you take a look in jre.properties, you will see 
variables in.

It should work. By "does not work", you mean that you have an exception, 
or the property doesn't include the variable value (maybe a order issue 
depending where you put the variable first) ?

Regards
JB

On 08/22/2012 09:11 PM, Andrei Pozolotin wrote:
>     *Hi*
>
>     the following does not work, when placed in custom.properties:
>
>     org.osgi.framework.system.packages.extra =
>     org.apache.karaf.branding; ${org.osgi.framework.system.packages.extra}
>
>     I am curious if karaf should support recursive variable substitution?
>
>     Thank you,
>
>     Andrei
>

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

support recursive variable substitution in properties?

Posted by Andrei Pozolotin <an...@gmail.com>.
    *Hi*

    the following does not work, when placed in custom.properties:

    org.osgi.framework.system.packages.extra =
    org.apache.karaf.branding; ${org.osgi.framework.system.packages.extra}

    I am curious if karaf should support recursive variable substitution?

    Thank you,

    Andrei


Re: updating features.xml in auto deploy folder results in duplication

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

yes, this is a bug, create KARAF-1754[1] to track it.

[1]https://issues.apache.org/jira/browse/KARAF-1754

Freeman
-------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-8-22, at 上午11:45, Andrei Pozolotin wrote:

> Hi,
> 
> if I am updating the same features.xml in auto deploy folder, such as one below
> and keep adding more and more features, then
> 
> feature:list shows that newly added features do show up,
> but the old ones are getting duplicated;
> 
> is it a feature or a bug? :-)
> 
> Thank you, 
> 
> Andrei
> 
> 
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <features xmlns="http://karaf.apache.org/xmlns/features/v1.1.0" name="empty-repository">
> 
>     <!-- these features should be auto installed -->
> 
>     <feature install="auto" name="empty-feature-one" version="1.0.0" description="very empty">
>     </feature>
> 
>     <feature install="auto" name="empty-feature-two" version="2.0.0" description="extra empty">
>     </feature>
> 
> </features>
> 


updating features.xml in auto deploy folder results in duplication

Posted by Andrei Pozolotin <an...@gmail.com>.
    Hi,

    if I am updating the same features.xml in auto deploy folder, such
    as one below
    and keep adding more and more features, then

    feature:list shows that newly added features do show up,
    but the old ones are getting duplicated;

    is it a feature or a bug? :-)

    Thank you,

    Andrei


    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <features xmlns="http://karaf.apache.org/xmlns/features/v1.1.0"
    name="empty-repository">

        <!-- these features should be auto installed -->

        <feature install="auto" name="empty-feature-one" version="1.0.0"
    description="very empty">
        </feature>

        <feature install="auto" name="empty-feature-two" version="2.0.0"
    description="extra empty">
        </feature>

    </features>


Re: Command with Multiple Arguments

Posted by Ioannis Canellos <io...@gmail.com>.
In your example the first completer in the list will be used for the first
argument, the second completer for the second and so on.

This works right now (and for almost 2 years now, if not more).

Can you share some more details on what you want to do?

-- 
*Ioannis Canellos*
*
FuseSource <http://fusesource.com>

**
Blog: http://iocanel.blogspot.com
**
Twitter: iocanel
*

RE: Command with Multiple Arguments

Posted by Joel Schuster <jo...@opsysinc.com>.
Thanks for the clarification. It’s not working for me right now... but I
assume it's me. :)

- Joel


> -----Original Message-----
> From: Jean-Baptiste Onofré [mailto:jb@nanthrax.net]
> Sent: Tuesday, August 21, 2012 9:32 AM
> To: user@karaf.apache.org
> Subject: Re: Command with Multiple Arguments
> 
> It 'should' correspond, and it 'should' work right now ;)
> 
> Regards
> JB
> 
> On 08/21/2012 05:20 PM, Joel Schuster wrote:
> > 'could' correspond or 'should' correspond?
> >
> > Is this expected to work right now, or is this a desire for the future.
> >
> > I'll try the AggregateCompleter.
> >
> >
> > - Joel
> >
> >
> >> -----Original Message-----
> >> From: Jean-Baptiste Onofré [mailto:jb@nanthrax.net]
> >> Sent: Tuesday, August 21, 2012 8:33 AM
> >> To: user@karaf.apache.org
> >> Subject: Re: Command with Multiple Arguments
> >>
> >> Hi Joel,
> >>
> >> by default, the list of completer could correspond to the arguments
order.
> >> You can also use a AggregateCompleter and handle the arguments
> >> completion by yourself.
> >>
> >> Regards
> >> JB
> >>
> >> On 08/21/2012 02:36 PM, Joel Schuster wrote:
> >>> Is there a way to assign separate completers to different arguments?
> >>> If I have a command with two arguments for example, how do I assign
> >>> different completers? I would have assumed that even using a single
> >>> completer I could key off of the ‘cursor’ argument, but it’s always 0.
> >>>
> >>> For example, the following does not work, but would seem intuitive
> >>> for this problem.
> >>>
> >>> <commandname=/"test/assign"/>
> >>>
> >>> <actionclass=/"org.example.console.commands.MyAssign"/>
> >>>
> >>> <propertyname=/"myCommander"/ ref=/"myCommander"/ />
> >>>
> >>> <propertyname=/"eventAdmin"/ ref=/"eventAdmin"/ />
> >>>
> >>> </action>
> >>>
> >>> <completers>
> >>>
> >>> <refcomponent-id=/"arg1Completer"/ />
> >>>
> >>> <refcomponent-id=/"arg2Completer"/ />
> >>>
> >>> <null/>
> >>>
> >>> </completers>
> >>>
> >>> </command>
> >>>
> >>> Description: OSI Logo - small
> >>>
> >>> *Joel Schuster*
> >>>
> >>> Operational Systems, Inc.
> >>>
> >>> 6514 Fairways Drive
> >>>
> >>> Longmont, CO 80503
> >>>
> >>> Phone: 719 445 8789
> >>>
> >>> Email: joel.schuster@opsysinc.com
> >>>
> >>> Web: www.opsysinc.com <http://www.opsysinc.com/>
> >>>
> >>
> >> --
> >> Jean-Baptiste Onofré
> >> jbonofre@apache.org
> >> http://blog.nanthrax.net
> >> Talend - http://www.talend.com
> 
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Re: Command with Multiple Arguments

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
It 'should' correspond, and it 'should' work right now ;)

Regards
JB

On 08/21/2012 05:20 PM, Joel Schuster wrote:
> 'could' correspond or 'should' correspond?
>
> Is this expected to work right now, or is this a desire for the future.
>
> I'll try the AggregateCompleter.
>
>
> - Joel
>
>
>> -----Original Message-----
>> From: Jean-Baptiste Onofré [mailto:jb@nanthrax.net]
>> Sent: Tuesday, August 21, 2012 8:33 AM
>> To: user@karaf.apache.org
>> Subject: Re: Command with Multiple Arguments
>>
>> Hi Joel,
>>
>> by default, the list of completer could correspond to the arguments order.
>> You can also use a AggregateCompleter and handle the arguments
>> completion by yourself.
>>
>> Regards
>> JB
>>
>> On 08/21/2012 02:36 PM, Joel Schuster wrote:
>>> Is there a way to assign separate completers to different arguments?
>>> If I have a command with two arguments for example, how do I assign
>>> different completers? I would have assumed that even using a single
>>> completer I could key off of the ‘cursor’ argument, but it’s always 0.
>>>
>>> For example, the following does not work, but would seem intuitive for
>>> this problem.
>>>
>>> <commandname=/"test/assign"/>
>>>
>>> <actionclass=/"org.example.console.commands.MyAssign"/>
>>>
>>> <propertyname=/"myCommander"/ ref=/"myCommander"/ />
>>>
>>> <propertyname=/"eventAdmin"/ ref=/"eventAdmin"/ />
>>>
>>> </action>
>>>
>>> <completers>
>>>
>>> <refcomponent-id=/"arg1Completer"/ />
>>>
>>> <refcomponent-id=/"arg2Completer"/ />
>>>
>>> <null/>
>>>
>>> </completers>
>>>
>>> </command>
>>>
>>> Description: OSI Logo - small
>>>
>>> *Joel Schuster*
>>>
>>> Operational Systems, Inc.
>>>
>>> 6514 Fairways Drive
>>>
>>> Longmont, CO 80503
>>>
>>> Phone: 719 445 8789
>>>
>>> Email: joel.schuster@opsysinc.com
>>>
>>> Web: www.opsysinc.com <http://www.opsysinc.com/>
>>>
>>
>> --
>> Jean-Baptiste Onofré
>> jbonofre@apache.org
>> http://blog.nanthrax.net
>> Talend - http://www.talend.com

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

RE: Command with Multiple Arguments

Posted by Joel Schuster <jo...@opsysinc.com>.
'could' correspond or 'should' correspond?

Is this expected to work right now, or is this a desire for the future.

I'll try the AggregateCompleter.


- Joel


> -----Original Message-----
> From: Jean-Baptiste Onofré [mailto:jb@nanthrax.net]
> Sent: Tuesday, August 21, 2012 8:33 AM
> To: user@karaf.apache.org
> Subject: Re: Command with Multiple Arguments
> 
> Hi Joel,
> 
> by default, the list of completer could correspond to the arguments order.
> You can also use a AggregateCompleter and handle the arguments
> completion by yourself.
> 
> Regards
> JB
> 
> On 08/21/2012 02:36 PM, Joel Schuster wrote:
> > Is there a way to assign separate completers to different arguments?
> > If I have a command with two arguments for example, how do I assign
> > different completers? I would have assumed that even using a single
> > completer I could key off of the ‘cursor’ argument, but it’s always 0.
> >
> > For example, the following does not work, but would seem intuitive for
> > this problem.
> >
> > <commandname=/"test/assign"/>
> >
> > <actionclass=/"org.example.console.commands.MyAssign"/>
> >
> > <propertyname=/"myCommander"/ ref=/"myCommander"/ />
> >
> > <propertyname=/"eventAdmin"/ ref=/"eventAdmin"/ />
> >
> > </action>
> >
> > <completers>
> >
> > <refcomponent-id=/"arg1Completer"/ />
> >
> > <refcomponent-id=/"arg2Completer"/ />
> >
> > <null/>
> >
> > </completers>
> >
> > </command>
> >
> > Description: OSI Logo - small
> >
> > *Joel Schuster*
> >
> > Operational Systems, Inc.
> >
> > 6514 Fairways Drive
> >
> > Longmont, CO 80503
> >
> > Phone: 719 445 8789
> >
> > Email: joel.schuster@opsysinc.com
> >
> > Web: www.opsysinc.com <http://www.opsysinc.com/>
> >
> 
> --
> Jean-Baptiste Onofré
> jbonofre@apache.org
> http://blog.nanthrax.net
> Talend - http://www.talend.com

Re: Command with Multiple Arguments

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Joel,

by default, the list of completer could correspond to the arguments order.
You can also use a AggregateCompleter and handle the arguments 
completion by yourself.

Regards
JB

On 08/21/2012 02:36 PM, Joel Schuster wrote:
> Is there a way to assign separate completers to different arguments? If
> I have a command with two arguments for example, how do I assign
> different completers? I would have assumed that even using a single
> completer I could key off of the ‘cursor’ argument, but it’s always 0.
>
> For example, the following does not work, but would seem intuitive for
> this problem.
>
> <commandname=/"test/assign"/>
>
> <actionclass=/"org.example.console.commands.MyAssign"/>
>
> <propertyname=/"myCommander"/ ref=/"myCommander"/ />
>
> <propertyname=/"eventAdmin"/ ref=/"eventAdmin"/ />
>
> </action>
>
> <completers>
>
> <refcomponent-id=/"arg1Completer"/ />
>
> <refcomponent-id=/"arg2Completer"/ />
>
> <null/>
>
> </completers>
>
> </command>
>
> Description: OSI Logo - small
>
> *Joel Schuster*
>
> Operational Systems, Inc.
>
> 6514 Fairways Drive
>
> Longmont, CO 80503
>
> Phone: 719 445 8789
>
> Email: joel.schuster@opsysinc.com
>
> Web: www.opsysinc.com <http://www.opsysinc.com/>
>

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