com.sun.enterprise.admin.cli
Class CLIUtil

java.lang.Object
  extended by com.sun.enterprise.admin.cli.CLIUtil

public class CLIUtil
extends java.lang.Object

CLI Utility class


Field Summary
private static int MAX_COMMANDS_TO_DISPLAY
           
private static LocalStringsImpl strings
           
 
Constructor Summary
CLIUtil()
           
 
Method Summary
static void displayClosestMatch(java.lang.String commandName, java.lang.String[] commands, java.lang.String msg, java.util.logging.Logger logger)
          Display the commands from the list that are the closest match to the specified command.
static java.lang.String[] getAllCommands(org.jvnet.hk2.component.Habitat habitat, ProgramOptions po, Environment env)
          Return all commands, local and remote.
private static java.io.File getDebugLogfile()
           
static java.lang.String[] getLocalCommands(org.jvnet.hk2.component.Habitat habitat)
          Get all the known local commands.
private static java.lang.String[] getMatchedCommands(java.lang.String pattern, java.lang.String[] commands)
          Return all the commands that include pattern (just a literal string, not really a pattern) as a substring.
static java.lang.String[] getRemoteCommands(org.jvnet.hk2.component.Habitat habitat, ProgramOptions po, Environment env)
          Get the list of commands from the remote server.
static java.util.Map<java.lang.String,java.lang.String> readPasswordFileOptions(java.lang.String passwordFileName, boolean withPrefix)
          Read passwords from the password file and save them in a java.util.Map.
static void writeCommandToDebugLog(java.lang.String[] args, int exit)
          Log the command, for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_COMMANDS_TO_DISPLAY

private static final int MAX_COMMANDS_TO_DISPLAY
See Also:
Constant Field Values

strings

private static final LocalStringsImpl strings
Constructor Detail

CLIUtil

public CLIUtil()
Method Detail

readPasswordFileOptions

public static java.util.Map<java.lang.String,java.lang.String> readPasswordFileOptions(java.lang.String passwordFileName,
                                                                                       boolean withPrefix)
                                                                                throws CommandException
Read passwords from the password file and save them in a java.util.Map.

Parameters:
passwordFileName - password file name
withPrefix - decides whether prefix should be taken into account
Returns:
Map of the password name and value
Throws:
CommandException

displayClosestMatch

public static void displayClosestMatch(java.lang.String commandName,
                                       java.lang.String[] commands,
                                       java.lang.String msg,
                                       java.util.logging.Logger logger)
                                throws InvalidCommandException
Display the commands from the list that are the closest match to the specified command.

Throws:
InvalidCommandException

getMatchedCommands

private static java.lang.String[] getMatchedCommands(java.lang.String pattern,
                                                     java.lang.String[] commands)
Return all the commands that include pattern (just a literal string, not really a pattern) as a substring.


getAllCommands

public static java.lang.String[] getAllCommands(org.jvnet.hk2.component.Habitat habitat,
                                                ProgramOptions po,
                                                Environment env)
Return all commands, local and remote.

Returns:
the commands as a String array, sorted

getLocalCommands

public static java.lang.String[] getLocalCommands(org.jvnet.hk2.component.Habitat habitat)
Get all the known local commands.

Returns:
the commands as a String array, sorted

getRemoteCommands

public static java.lang.String[] getRemoteCommands(org.jvnet.hk2.component.Habitat habitat,
                                                   ProgramOptions po,
                                                   Environment env)
                                            throws CommandException,
                                                   CommandValidationException
Get the list of commands from the remote server.

Returns:
the commands as a String array, sorted
Throws:
CommandException
CommandValidationException

writeCommandToDebugLog

public static void writeCommandToDebugLog(java.lang.String[] args,
                                          int exit)
Log the command, for debugging.


getDebugLogfile

private static java.io.File getDebugLogfile()


Copyright © 2012 GlassFish Community. All Rights Reserved.