Console
public
class
Console
extends Thread
java.lang.Object | ||
↳ | java.lang.Thread | |
↳ | com.android.tradefed.command.Console |
Main TradeFederation console providing user with the interface to interact
Currently supports operations such as- add a command to test
- list devices and their state
- list invocations in progress
- list commands in queue
- dump invocation log to file/stdout
- shutdown
Summary
Nested classes | |
---|---|
class |
Console.ArgRunnable<T>
A |
class |
Console.CaptureList
A convenience type for |
Constants | |
---|---|
String |
DEBUG_PATTERN
|
String |
DUMP_PATTERN
|
String |
EXIT_PATTERN
|
String |
HELP_PATTERN
|
String |
INVOC_PATTERN
|
String |
LIST_COMMANDS_PATTERN
|
String |
LIST_PATTERN
|
String |
REMOVE_PATTERN
|
String |
RUN_PATTERN
|
String |
SET_PATTERN
|
String |
VERSION_PATTERN
|
Fields | |
---|---|
protected
static
final
String |
LINE_SEPARATOR
|
protected
ConsoleReader |
mConsoleReader
|
protected
IKeyStoreFactory |
mKeyStoreFactory
|
protected
ICommandScheduler |
mScheduler
|
Protected constructors | |
---|---|
Console()
|
Public methods | |
---|---|
static
void
|
main(String[] mainArgs)
|
void
|
run()
The main method to launch the console. |
void
|
setArgs(List<String> mainArgs)
Sets the console starting arguments. |
static
void
|
startConsole(Console console, String[] args)
Starts the given Tradefed console with given args |
Protected methods | |
---|---|
String
|
getConsolePrompt()
|
String
|
getGenericHelpString(List<String> genericHelp)
Return the generic help string to display |
static
ConsoleReader
|
getReader()
Return a new ConsoleReader, or |
void
|
printLine(String output)
Display a line of text on console |
void
|
printLine(String output, PrintStream pw)
Print the line to a Printwriter |
void
|
setCustomCommands(RegexTrie<Runnable> trie, List<String> genericHelp, Map<String, String> commandHelp)
A customization point that subclasses can use to alter which commands are available in the console. |
Constants
DEBUG_PATTERN
protected static final String DEBUG_PATTERN
Constant Value: "debug"
DUMP_PATTERN
protected static final String DUMP_PATTERN
Constant Value: "d(?:ump)?"
EXIT_PATTERN
protected static final String EXIT_PATTERN
Constant Value: "(?:q|exit)"
HELP_PATTERN
protected static final String HELP_PATTERN
Constant Value: "\?|h|help"
INVOC_PATTERN
protected static final String INVOC_PATTERN
Constant Value: "i(?:nvocation)?"
LIST_COMMANDS_PATTERN
protected static final String LIST_COMMANDS_PATTERN
Constant Value: "c(?:ommands)?"
LIST_PATTERN
protected static final String LIST_PATTERN
Constant Value: "l(?:ist)?"
REMOVE_PATTERN
protected static final String REMOVE_PATTERN
Constant Value: "remove"
RUN_PATTERN
protected static final String RUN_PATTERN
Constant Value: "r(?:un)?"
SET_PATTERN
protected static final String SET_PATTERN
Constant Value: "s(?:et)?"
VERSION_PATTERN
protected static final String VERSION_PATTERN
Constant Value: "version"
Fields
LINE_SEPARATOR
protected static final String LINE_SEPARATOR
mConsoleReader
protected ConsoleReader mConsoleReader
Protected constructors
Console
protected Console ()
Public methods
main
public static void main (String[] mainArgs)
Parameters | |
---|---|
mainArgs |
String |
Throws | |
---|---|
InterruptedException |
|
ConfigurationException |
run
public void run ()
The main method to launch the console. Will keep running until shutdown command is issued.
setArgs
public void setArgs (List<String> mainArgs)
Sets the console starting arguments.
Parameters | |
---|---|
mainArgs |
List : the arguments
|
startConsole
public static void startConsole (Console console, String[] args)
Starts the given Tradefed console with given args
Parameters | |
---|---|
console |
Console : the Console to start |
args |
String : the command line arguments
|
Throws | |
---|---|
InterruptedException |
|
ConfigurationException |
Protected methods
getConsolePrompt
protected String getConsolePrompt ()
Returns | |
---|---|
String |
the text String to display for the console prompt
|
getGenericHelpString
protected String getGenericHelpString (List<String> genericHelp)
Return the generic help string to display
Parameters | |
---|---|
genericHelp |
List : a list of String representing the generic help to be aggregated.
|
Returns | |
---|---|
String |
getReader
protected static ConsoleReader getReader ()
Return a new ConsoleReader, or null
if an IOException occurs. Note that this
function must be static so that we can run it before the superclass constructor.
Returns | |
---|---|
ConsoleReader |
printLine
protected void printLine (String output)
Display a line of text on console
printLine
protected void printLine (String output, PrintStream pw)
Print the line to a Printwriter
Parameters | |
---|---|
pw |
PrintStream |
setCustomCommands
protected void setCustomCommands (RegexTrie<Runnable> trie, List<String> genericHelp, Map<String, String> commandHelp)
A customization point that subclasses can use to alter which commands are available in the console.
Implementations should modify thegenericHelp
and commandHelp
variables to
document what functionality they may have added, modified, or removed.
Parameters | |
---|---|
trie |
RegexTrie : The RegexTrie to add the commands to |
genericHelp |
List : A List of lines to print when the user runs the "help" command
with no arguments. |
commandHelp |
Map : A Map containing documentation for any new commands that may have
been added. The key is a regular expression to use as a key for RegexTrie .
The value should be a String containing the help text to print for that command.
|
Interfaces
Classes
- CommandFileParser
- CommandFileParser.Bitmask
- CommandFileParser.CommandLine
- CommandFileWatcher
- CommandFileWatcher.CommandFile
- CommandOptions
- CommandRunner
- CommandScheduler
- CommandScheduler.CommandTracker
- CommandScheduler.CommandTrackerIdComparator
- Console
- Console.ArgRunnable
- Console.CaptureList
- Verify
Enums
Exceptions
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.