com.sun.enterprise.admin.cli
Class MultimodeCommand

java.lang.Object
  extended by com.sun.enterprise.admin.cli.CLICommand
      extended by com.sun.enterprise.admin.cli.MultimodeCommand
All Implemented Interfaces:
org.jvnet.hk2.component.PostConstruct

@Service(name="multimode")
@Scoped(value=org.jvnet.hk2.component.PerLookup.class)
public class MultimodeCommand
extends CLICommand

A scaled-down implementation of multi-mode command.

Author:
केदार(km@dev.java.net), Bill Shannon

Field Summary
private  boolean echo
           
private  java.lang.String encoding
           
private  java.io.File file
           
private  org.jvnet.hk2.component.Habitat habitat
           
private  boolean printPrompt
           
private  java.lang.Boolean printPromptOpt
           
private static LocalStringsImpl strings
           
 
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
MultimodeCommand()
           
 
Method Summary
protected  int executeCommand()
          Execute the command using the options in options and the operands in operands.
private  int executeCommands(java.io.BufferedReader reader)
          Read commands from the specified BufferedReader and execute them.
private  java.lang.String[] getArgs(java.lang.String line)
           
protected  java.util.Collection<CommandModel.ParamModel> usageOptions()
          In the usage message modify the --printprompt option to have a default based on the --interactive option.
protected  void validate()
          The validate method validates that the type and quantity of parameters and operands matches the requirements for this command.
 
Methods inherited from class com.sun.enterprise.admin.cli.CLICommand
checkHelp, execute, getBooleanOption, getCommand, getManPage, getName, getOperandModel, getOption, getPassword, getProgramOptions, getSystemProperties, getSystemProperty, getUsage, initializeLogger, initializePasswords, inject, ok, parse, postConstruct, prepare, prevalidate, printExceptionStackTrace, processProgramOptions, quote, readPassword, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

habitat

private org.jvnet.hk2.component.Habitat habitat

file

private java.io.File file

printPromptOpt

private java.lang.Boolean printPromptOpt

printPrompt

private boolean printPrompt

encoding

private java.lang.String encoding

echo

private boolean echo

strings

private static final LocalStringsImpl strings
Constructor Detail

MultimodeCommand

public MultimodeCommand()
Method Detail

validate

protected void validate()
                 throws CommandException,
                        CommandValidationException
The validate method validates that the type and quantity of parameters and operands matches the requirements for this command. The validate method supplies missing options from the environment.

Overrides:
validate in class CLICommand
Throws:
CommandException - if execution of the command fails
CommandValidationException - if there's something wrong with the options or arguments

usageOptions

protected java.util.Collection<CommandModel.ParamModel> usageOptions()
In the usage message modify the --printprompt option to have a default based on the --interactive option.

Overrides:
usageOptions in class CLICommand

executeCommand

protected int executeCommand()
                      throws CommandException,
                             CommandValidationException
Description copied from class: CLICommand
Execute the command using the options in options and the operands in operands.

Specified by:
executeCommand in class CLICommand
Returns:
the exit code
Throws:
CommandException - if execution of the command fails
CommandValidationException - if there's something wrong with the options or arguments

executeCommands

private int executeCommands(java.io.BufferedReader reader)
                     throws CommandException,
                            CommandValidationException,
                            java.io.IOException
Read commands from the specified BufferedReader and execute them. If printPrompt is set, prompt first.

Returns:
the exit code of the last command executed
Throws:
CommandException
CommandValidationException
java.io.IOException

getArgs

private java.lang.String[] getArgs(java.lang.String line)
                            throws ArgumentTokenizer.ArgumentException
Throws:
ArgumentTokenizer.ArgumentException


Copyright © 2012 GlassFish Community. All Rights Reserved.