|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.enterprise.admin.cli.CLICommand
com.sun.enterprise.admin.cli.remote.RemoteCommand
public class RemoteCommand
A remote command handled by the asadmin CLI.
| Nested Class Summary | |
|---|---|
private class |
RemoteCommand.CLIRemoteAdminCommand
A special RemoteAdminCommand that overrides methods so that we can handle the interactive requirements of a CLI command. |
| Field Summary | |
|---|---|
private Map<String,String> |
attrs
|
private static org.jvnet.hk2.component.Habitat |
manHabitat
A habitat just for finding man pages. |
private static ClassLoader |
moduleClassLoader
A class loader for the "modules" directory. |
private String |
output
|
private File |
outputDir
|
private RemoteCommand.CLIRemoteAdminCommand |
rac
|
private String |
responseFormatType
|
private boolean |
returnAttributes
|
private boolean |
returnOutput
|
private static LocalStringsImpl |
strings
|
private String |
usage
|
private OutputStream |
userOut
|
| Fields inherited from class com.sun.enterprise.admin.cli.CLICommand |
|---|
argv, commandModel, CONNECTION_ERROR, env, ERROR, INVALID_COMMAND_ERROR, logger, metadataErrors, name, operands, options, passwords, programOpts, SUCCESS, WARNING |
| Constructor Summary | |
|---|---|
RemoteCommand()
Construct a new remote command object. |
|
RemoteCommand(String name,
ProgramOptions po,
Environment env)
Construct a new remote command object. |
|
RemoteCommand(String name,
ProgramOptions po,
Environment env,
String responseFormatType,
OutputStream userOut)
Construct a new remote command object. |
|
| Method Summary | |
|---|---|
protected boolean |
checkHelp()
We do all our help processing in executeCommand. |
Map<String,String> |
executeAndReturnAttributes(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()
Runs the command using the specified arguments. |
private static String |
getCommandClass(String cmdName)
Given a command name, return the name of the class that implements that command in the server. |
private BufferedReader |
getLocalManPage()
Try to find a local version of the man page for this command. |
private static org.jvnet.hk2.component.Habitat |
getManHabitat()
Return a Habitat used just for reading man pages from the modules in the modules directory. |
BufferedReader |
getManPage()
Get the man page from the server. |
private static ClassLoader |
getModuleClassLoader()
Return a ClassLoader that loads classes from all the modules (jar files) in the |
String |
getUsage()
Get the usage text. |
private CommandModel |
helpModel()
Return a CommandModel that only includes the --help option. |
private void |
initializeAuth()
|
private void |
initializeRemoteAdminCommand()
|
protected void |
prepare()
The prepare method must ensure that the commandModel field is set. |
void |
setFileOutputDirectory(File dir)
Set the directory in which any returned files will be stored. |
protected void |
validate()
If it's a help request, don't prompt for any missing options. |
| Methods inherited from class com.sun.enterprise.admin.cli.CLICommand |
|---|
execute, getBooleanOption, getCommand, getName, getOperandModel, getOption, getPassword, getProgramOptions, getSystemProperties, getSystemProperty, initializeLogger, initializePasswords, inject, ok, parse, postConstruct, prevalidate, printExceptionStackTrace, processProgramOptions, quote, readPassword, toString, usageOptions |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final LocalStringsImpl strings
private boolean returnOutput
private String output
private boolean returnAttributes
private Map<String,String> attrs
private String usage
private String responseFormatType
private OutputStream userOut
private File outputDir
private RemoteCommand.CLIRemoteAdminCommand rac
private static ClassLoader moduleClassLoader
private static org.jvnet.hk2.component.Habitat manHabitat
| Constructor Detail |
|---|
public RemoteCommand()
throws CommandException
CommandException
public RemoteCommand(String name,
ProgramOptions po,
Environment env)
throws CommandException
CommandException
public RemoteCommand(String name,
ProgramOptions po,
Environment env,
String responseFormatType,
OutputStream userOut)
throws CommandException
CommandException| Method Detail |
|---|
public void setFileOutputDirectory(File dir)
protected void prepare()
throws CommandException,
CommandValidationException
CLICommand
prepare in class CLICommandCommandException
CommandValidationException
protected void validate()
throws CommandException,
CommandValidationException
validate in class CLICommandCommandException - if execution of the command fails
CommandValidationException - if there's something wrong
with the options or arguments
protected boolean checkHelp()
throws CommandException,
CommandValidationException
checkHelp in class CLICommandCommandException
CommandValidationException
protected int executeCommand()
throws CommandException,
CommandValidationException
executeCommand in class CLICommandCommandException - if execution of the command fails
CommandValidationException - if there's something wrong
with the options or arguments
public String executeAndReturnOutput(String... args)
throws CommandException,
CommandValidationException
CommandException
CommandValidationException
public Map<String,String> executeAndReturnAttributes(String... args)
throws CommandException,
CommandValidationException
CommandException
CommandValidationExceptionpublic String getUsage()
getUsage in class CLICommandpublic BufferedReader getManPage()
getManPage in class CLICommandprivate CommandModel helpModel()
private BufferedReader getLocalManPage()
private void initializeRemoteAdminCommand()
throws CommandException
CommandException
private void initializeAuth()
throws CommandException
CommandExceptionprivate static String getCommandClass(String cmdName)
private static org.jvnet.hk2.component.Habitat getManHabitat()
private static ClassLoader getModuleClassLoader()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||