Package com.sun.enterprise.admin.cli
Class CLIUtil
- java.lang.Object
-
- com.sun.enterprise.admin.cli.CLIUtil
-
public class CLIUtil extends Object
CLI Utility class
-
-
Constructor Summary
Constructors Constructor Description CLIUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddisplayClosestMatch(String commandName, String[] commands, String msg, Logger logger)Display the commands from the list that are the closest match to the specified command.static String[]getAllCommands(CLIContainer container, ProgramOptions options, Environment env)Return all commands, local and remote.static String[]getLocalCommands(CLIContainer container)Get all the known local commands.static String[]getRemoteCommands(CLIContainer container, ProgramOptions po, Environment env)Get the list of commands from the remote server.static Map<String,String>readPasswordFileOptions(String passwordFileName, boolean withPrefix)Read passwords from the password file and save them in a java.util.Map.static voidwriteCommandToDebugLog(String cname, Environment env, String[] args, int exit)Log the command, for debugging.
-
-
-
Field Detail
-
LOGGER
protected static final Logger LOGGER
-
-
Method Detail
-
readPasswordFileOptions
public static Map<String,String> readPasswordFileOptions(String passwordFileName, boolean withPrefix) throws CommandException
Read passwords from the password file and save them in a java.util.Map.- Parameters:
passwordFileName- password file namewithPrefix- decides whether prefix should be taken into account- Returns:
- Map of the password name and value
- Throws:
CommandException
-
displayClosestMatch
public static void displayClosestMatch(String commandName, String[] commands, String msg, Logger logger) throws InvalidCommandException
Display the commands from the list that are the closest match to the specified command.- Parameters:
commandName-commands-msg-logger-- Throws:
InvalidCommandException
-
getAllCommands
public static String[] getAllCommands(CLIContainer container, ProgramOptions options, Environment env)
Return all commands, local and remote.- Parameters:
container-options- Options to get the command i.e. admin portenv-- Returns:
- the commands as a String array, sorted
-
getLocalCommands
public static String[] getLocalCommands(CLIContainer container)
Get all the known local commands.- Parameters:
container-- Returns:
- the commands as a String array, sorted
-
getRemoteCommands
public static String[] getRemoteCommands(CLIContainer container, ProgramOptions po, Environment env) throws CommandException, CommandValidationException
Get the list of commands from the remote server.- Parameters:
container-po- Options to get the command i.e. admin portenv-- Returns:
- the commands as a String array, sorted
- Throws:
CommandExceptionCommandValidationException
-
writeCommandToDebugLog
public static void writeCommandToDebugLog(String cname, Environment env, String[] args, int exit)
Log the command, for debugging.- Parameters:
cname-env-args-exit-
-
-