|
||||||||||
| 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 java.util.Map<java.lang.String,java.lang.String> |
attrs
|
private static org.jvnet.hk2.component.Habitat |
manHabitat
A habitat just for finding man pages. |
private static java.lang.ClassLoader |
moduleClassLoader
A class loader for the "modules" directory. |
private java.lang.String |
output
|
private java.io.File |
outputDir
|
private RemoteCommand.CLIRemoteAdminCommand |
rac
|
private java.lang.String |
responseFormatType
|
private boolean |
returnAttributes
|
private boolean |
returnOutput
|
private static LocalStringsImpl |
strings
|
private java.lang.String |
usage
|
private java.io.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(java.lang.String name,
ProgramOptions po,
Environment env)
Construct a new remote command object. |
|
RemoteCommand(java.lang.String name,
ProgramOptions po,
Environment env,
java.lang.String responseFormatType,
java.io.OutputStream userOut)
Construct a new remote command object. |
|
| Method Summary | |
|---|---|
protected boolean |
checkHelp()
We do all our help processing in executeCommand. |
java.util.Map<java.lang.String,java.lang.String> |
executeAndReturnAttributes(java.lang.String... args)
Execute the command and return the main attributes from the manifest instead of writing out the output. |
java.lang.String |
executeAndReturnOutput(java.lang.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 java.lang.String |
getCommandClass(java.lang.String cmdName)
Given a command name, return the name of the class that implements that command in the server. |
private java.io.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. |
java.io.BufferedReader |
getManPage()
Get the man page from the server. |
private static java.lang.ClassLoader |
getModuleClassLoader()
Return a ClassLoader that loads classes from all the modules (jar files) in the |
java.lang.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(java.io.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 java.lang.String output
private boolean returnAttributes
private java.util.Map<java.lang.String,java.lang.String> attrs
private java.lang.String usage
private java.lang.String responseFormatType
private java.io.OutputStream userOut
private java.io.File outputDir
private RemoteCommand.CLIRemoteAdminCommand rac
private static java.lang.ClassLoader moduleClassLoader
private static org.jvnet.hk2.component.Habitat manHabitat
| Constructor Detail |
|---|
public RemoteCommand()
throws CommandException
CommandException
public RemoteCommand(java.lang.String name,
ProgramOptions po,
Environment env)
throws CommandException
CommandException
public RemoteCommand(java.lang.String name,
ProgramOptions po,
Environment env,
java.lang.String responseFormatType,
java.io.OutputStream userOut)
throws CommandException
CommandException| Method Detail |
|---|
public void setFileOutputDirectory(java.io.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 java.lang.String executeAndReturnOutput(java.lang.String... args)
throws CommandException,
CommandValidationException
CommandException
CommandValidationException
public java.util.Map<java.lang.String,java.lang.String> executeAndReturnAttributes(java.lang.String... args)
throws CommandException,
CommandValidationException
CommandException
CommandValidationExceptionpublic java.lang.String getUsage()
getUsage in class CLICommandpublic java.io.BufferedReader getManPage()
getManPage in class CLICommandprivate CommandModel helpModel()
private java.io.BufferedReader getLocalManPage()
private void initializeRemoteAdminCommand()
throws CommandException
CommandException
private void initializeAuth()
throws CommandException
CommandExceptionprivate static java.lang.String getCommandClass(java.lang.String cmdName)
private static org.jvnet.hk2.component.Habitat getManHabitat()
private static java.lang.ClassLoader getModuleClassLoader()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||