public class RemoteCLICommand extends CLICommand
Modifier and Type | Field and Description |
---|---|
protected List<String> |
reExecutedOperands |
protected ParameterMap |
reExecutedOptions |
argv, ASADMIN, commandModel, CONNECTION_ERROR, env, ERROR, INVALID_COMMAND_ERROR, lineReader, logger, metadataErrors, name, operands, options, passwords, programOpts, SUCCESS, terminal, WARNING
Constructor and Description |
---|
RemoteCLICommand()
Construct a new remote command object.
|
RemoteCLICommand(String name,
ProgramOptions po,
Environment env)
Construct a new remote command object.
|
RemoteCLICommand(String name,
ProgramOptions po,
Environment env,
String responseFormatType,
OutputStream userOut)
Construct a new remote command object.
|
Modifier and Type | Method and Description |
---|---|
int |
execute(String... argv)
Execute this command with the given arguemnts.
|
ActionReport |
executeAndReturnActionReport(String... args)
Execute the command and return the main attributes from the manifest
instead of writing out the output.
|
String |
executeAndReturnOutput(String... args)
Execute the command and return the output as a string instead of writing
it out.
|
protected int |
executeCommand()
Execute the command using the options in options and the
operands in operands.
|
BufferedReader |
getManPage()
Get the man page from the server.
|
String |
getUsage()
Get the usage text.
|
protected void |
inject()
Inject this instance with the final values of all the command
parameters.
|
protected void |
parse()
The parse method sets the options and operands fields
based on the content of the command line arguments.
|
protected void |
prepare()
The prepare method must ensure that the commandModel field is set.
|
protected void |
prevalidate()
The prevalidate method supplies missing options from
the environment.
|
void |
registerListener(String regexpForName,
AdminCommandEventBroker.AdminCommandListener listener) |
void |
setFileOutputDirectory(File dir)
Set the directory in which any returned files will be stored.
|
protected void |
validate()
The validate method can be used by a subclass to validate
that the type and quantity of parameters and operands matches
the requirements for this command.
|
buildLineReader, buildTerminal, checkHelp, closeTerminal, execute, expandManPage, getBooleanOption, getBriefCommandUsage, getCommand, getCommand, getCommandScope, getCommandUsage, getName, getOperandModel, getOption, getOptions, getPassword, getPassword, getProgramOptions, getSystemProperties, getSystemProperty, initializeLogger, initializePasswords, ok, postConstruct, printExceptionStackTrace, processProgramOptions, quote, readPassword, setCommandScope, toString, usageOptions
protected ParameterMap reExecutedOptions
public RemoteCLICommand() throws CommandException
CommandException
public RemoteCLICommand(String name, ProgramOptions po, Environment env) throws CommandException
name
- The command to executepo
- Parameters passed with the command, both those part of the command itself (i.e. enabled) and
those that are inherited for all commands (i.e. adminport)env
- The environment that is executing the commandCommandException
- if the command failed for any reasonpublic RemoteCLICommand(String name, ProgramOptions po, Environment env, String responseFormatType, OutputStream userOut) throws CommandException
name
- The command to executepo
- Parameters passed with the command, both those part of the command itself (i.e. enabled) and
those that are inherited for all commands (i.e. adminport)env
- The environment that is executing the commandresponseFormatType
- userOut
- The OutputStream
that is used to display any output to the userCommandException
- if the command failed for any reasonpublic int execute(String... argv) throws CommandException
CLICommand
execute
in class CLICommand
argv
- Arguments to execute command withCommandException
- if execution of the command failsCommandValidationException
- if there's something wrong
with the options or argumentspublic void setFileOutputDirectory(File dir)
dir
- protected void prepare() throws CommandException, CommandValidationException
CLICommand
prepare
in class CLICommand
CommandException
CommandValidationException
protected void prevalidate() throws CommandException
CLICommand
prevalidate
in class CLICommand
CommandException
- if execution of the command failsCommandValidationException
- if there's something wrong
with the options or argumentsprotected void parse() throws CommandException
CLICommand
parse
in class CLICommand
CommandException
- if execution of the command failsCommandValidationException
- if there's something wrong
with the options or argumentsprotected void validate() throws CommandException, CommandValidationException
CLICommand
validate
in class CLICommand
CommandException
- if execution of the command failsCommandValidationException
- if there's something wrong
with the options or argumentsprotected void inject() throws CommandException
CLICommand
inject
in class CLICommand
CommandException
- if execution of the command failsCommandValidationException
- if there's something wrong
with the options or argumentsprotected int executeCommand() throws CommandException, CommandValidationException
CLICommand
executeCommand
in class CLICommand
CommandException
- if execution of the command failsCommandValidationException
- if there's something wrong
with the options or argumentspublic String executeAndReturnOutput(String... args) throws CommandException, CommandValidationException
args
- CommandException
CommandValidationException
public ActionReport executeAndReturnActionReport(String... args) throws CommandException, CommandValidationException
args
- CommandException
CommandValidationException
public String getUsage()
getUsage
in class CLICommand
public BufferedReader getManPage()
getManPage
in class CLICommand
public void registerListener(String regexpForName, AdminCommandEventBroker.AdminCommandListener listener)
Copyright © 2020. All rights reserved.