public abstract class CliCommand extends Object
| Modifier and Type | Field and Description | 
|---|---|
protected PrintStream | 
err  | 
protected PrintStream | 
out  | 
protected ZooKeeper | 
zk  | 
| Constructor and Description | 
|---|
CliCommand(String cmdStr,
          String optionStr)
a CLI command with command string and options. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addToMap(Map<String,CliCommand> cmdMap)
add this command to a map. 
 | 
abstract boolean | 
exec()  | 
String | 
getCmdStr()
get the string used to call this command 
 | 
String | 
getOptionStr()
get the option string 
 | 
String | 
getUsageStr()
get a usage string, contains the command and the options 
 | 
abstract CliCommand | 
parse(String[] cmdArgs)
parse the command arguments 
 | 
void | 
setErr(PrintStream err)
Set err printStream (usable for testing) 
 | 
void | 
setOut(PrintStream out)
Set out printStream (usable for testing) 
 | 
void | 
setZk(ZooKeeper zk)
set the zookeeper instance 
 | 
protected ZooKeeper zk
protected PrintStream out
protected PrintStream err
public void setOut(PrintStream out)
out - public void setErr(PrintStream err)
err - public void setZk(ZooKeeper zk)
zk - the ZooKeeper instance.public String getCmdStr()
public String getOptionStr()
public String getUsageStr()
public void addToMap(Map<String,CliCommand> cmdMap)
cmdMap - public abstract CliCommand parse(String[] cmdArgs) throws CliParseException
cmdArgs - CliParseExceptionpublic abstract boolean exec()
                      throws CliException
CliExceptionCopyright © 2008–2021 The Apache Software Foundation. All rights reserved.