|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthenplus.AbstractCommand
public abstract class AbstractCommand
Implementation of a Command with default settings. Override what is necessary in your Command. It makes sense to derive plug-ins from this AbstractCommand - this makes the plug-in more robust with regard to newly added methods.
Field Summary |
---|
Fields inherited from interface henplus.Command |
---|
EXEC_FAILED, SUCCESS, SYNTAX_ERROR |
Constructor Summary | |
---|---|
AbstractCommand()
|
Method Summary | |
---|---|
protected int |
argumentCount(String command)
convenience method: returns the number of elements in this string, separated by whitespace. |
Iterator |
complete(CommandDispatcher disp,
String partialCommand,
String lastWord)
Returns a list of strings that are possible at this stage. |
String |
getLongDescription(String cmd)
returns a longer string describing this action. |
Option |
getOption(String arg0)
|
protected Options |
getOptions()
|
String |
getShortDescription()
return a short string describing the purpose of the commands handled by this Command-implementation. |
String |
getSynopsis(String cmd)
retuns a synopsis-string. |
void |
handleCommandline(CommandLine line)
After parsing the parameters, this method is called. |
boolean |
isComplete(String command)
returns, whether the command is complete. |
boolean |
participateInCommandCompletion()
returns 'false', if the commands supported by this Commands should not be part of the toplevel command completion. |
void |
registerOptions(Options r)
Override this method if you want to register command-specific options |
boolean |
requiresValidSession(String cmd)
returns true, if this command requires a valid SQLSession, i.e. |
void |
setOptions(Options options)
Options are set, after the commandline has been parsed. |
void |
shutdown()
shutdown this command. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface henplus.Command |
---|
execute, getCommandList |
Constructor Detail |
---|
public AbstractCommand()
Method Detail |
---|
public String getShortDescription()
Command
'describe a database object'
)
Should contain no newline, no leading spaces.
getShortDescription
in interface Command
public String getLongDescription(String cmd)
Command
getLongDescription
in interface Command
cmd
- The command the long description is asked for. This
is one of the possible commands returned by
Command.getCommandList()
.public String getSynopsis(String cmd)
Command
export-xml <table> <filename>
help [command]
Should contain no newline, no leading spaces. This synopsis is printed in the detailed help of a command or if the execute()-method returned a SYNTAX_ERROR.
getSynopsis
in interface Command
cmd
- the command the synopsis is for. This is one of the possible
commands returned by Command.getCommandList()
.public boolean participateInCommandCompletion()
Command
participateInCommandCompletion
in interface Command
public Iterator complete(CommandDispatcher disp, String partialCommand, String lastWord)
Command
complete
in interface Command
disp
- the CommandDispatcher - you might want to access
other values through it.partialCommand
- The command typed so farlastWord
- the last word returned by readline.public void shutdown()
Command
shutdown
in interface Command
public boolean isComplete(String command)
Command
This method is called, whenever the input encounters a newline or a semicolon to decide if this separator is to separate different commands or if it is part of the command itself.
The delimiter (newline or semicolon) is contained (at the end)
in the String passed to this method. This
method returns false
, if the delimiter is part of the
command and will not be regarded as delimiter between commands -- the
reading part of the command dispatcher will go on reading characters
and not execute the command.
This method will return true for most simple commands like 'help'. For commands that have a more complicated syntax, this might not be true.
isComplete
in interface Command
command
- the partial command read so far given to decide by
the command whether it is complete or not.public boolean requiresValidSession(String cmd)
Command
Command.execute(SQLSession,String,String)
method makes use of the
session (e.g. to get some Database connection) or not. Return 'true'
if unsure (you should be sure..). This is to thwart attempts to
execute a command without session.
requiresValidSession
in interface Command
cmd
- the subcommand this is requested for; one of the
commands returned by Command.getCommandList()
.protected int argumentCount(String command)
protected Options getOptions()
public void setOptions(Options options)
Command
setOptions
in interface Command
public Option getOption(String arg0)
public void registerOptions(Options r)
registerOptions
in interface Command
r
- public void handleCommandline(CommandLine line)
Command
handleCommandline
in interface Command
line
- TODO
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |