Philipp, it might be beneficial to clarify first which actions you want
wizarded, "Give me a wizard", the effective phrasing of Karaf-780, is
too vague to be workable: which actions do you want the wizards to walk
you through? Even if the answer is "everything", there are over a
hundred actions available with Karaf, so it would still be good to have
an enumerated list of your priorities, also, to judge the value of
creating these wizards to begin with.
My problem with these wizards is that Linux command shells generally
don't have them and everybody's been cool with that for years--so I'm
not sure the Karaf command line needs to be burdened with them,
especially since Karaf is generally for advanced developers who can
actually be irritated by an overly childish/chatty command line
interface. Also, wizard coding is monotonous and has a high potential
of having several bugs, patches and reports of which could distract the
team from core functionality. Finally, if you're thinking that wizards
should take away the need to have to flag the each parameter, i.e.,
"create 1 Sam" instead of "create --id 1 --name Sam") that could be
risky should people get the arguments in the wrong order.
In lieu of wizards it may be better to make sure Karaf's web interface
is enhanced, or a GUI provided that provides an easy way for a user to
run the most common tasks.
Regards,
Glen
On 08/03/2011 05:52 PM, bonomat wrote:
Hi all,
relevant to the issue https://issues.apache.org/jira/browse/KARAF-780
KARAF-780 I want to start a discussion and share my thoughts about the
wizard command:
First I'll try to make clear what the commands needs are:
- it should be always possible to execute the command in one line, (for
script automation, so the wizard should be optional)
- it should be possible to have some optional and non-optional attributes
- if all non-optional attributes are entered in one line the wizard will not
get started
- if some non-optional attributes are missing, the wizard will be started
-furthermore should it be possible
- to accept more complex objects as arguments, i.e. create new instances, or
references to other classes,
what I imagine myself under the word "wizard":
a wizard is for me: to lead the user through some well defined steps, so
according to the description above: if an non-optional attribute was not
set, the user will be asked something like this:
no value defined for field "name": (default: noname):
more in detail:
{code}
@Command(scope = "user", name = "create", description = "Create new user")
public class UserCreationCommand extends OsgiCommandSupport {
@Argument(..., optional=false )
private String id;
@Argument(..., optional=false )
private String name;
@Argument(..., optional=true )
private String age;
protected Object doExecute() throws Exception {
//do something with the arguments, i.e. create a new user instance and
persist it....
}
{/code}
a call can be:
user:create 1 // enter
you have not defined a value defined for field "name": (default: noname):
Goofy ///enter
sumary: .... id=1, name=Goofy, age=null , ok?(yes/no)
or:
user:create //enter
you have not defined a value defined for field "id": (default:
[autogenerated]): ///enter
you have not defined a value defined for field "name": (default: noname):
Goofy ///enter
sumary: .... id=1, name=Goofy, age=null , ok?(yes/no)
but the question is, how do we know if the "1" is the non-optional id and
not the optional age?
so, how i can imagine how this can be implemented:
in the class DefaultActionPreparator in the method:
public boolean prepare(Action action, CommandSession session, List params)
are the attributes checked, so my idea is, to save those attributes which
are not set, but not-optional somewhere in the action class, and before the
method:
protected Object doExecute() will be executed an other method like:
validateInput() will be called,
here it should be possible to accept some user input from the console to
change and extend the attributes.
so, i hope it is a bit more clear what i was thinking about the "wizard",
what do you think about my thoughts?
kind regards
Philipp
--
View this message in context:
http://karaf.922171.n3.nabble.com/Extend-the-karaf-commands-by-a-wizard-tp3223630p3223630.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.
--
Glen Mazza
Talend - http://www.talend.com/ai
Blog - http://www.jroller.com/gmazza
Twitter - glenmazza