Console
  public
  
  
  
  class
  Console
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | 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.CaptureListA convenience type for  | 
| Fields | |
|---|---|
| 
    protected
    static
    final
    String | DEBUG_PATTERN
 | 
| 
    protected
    static
    final
    String | DUMP_PATTERN
 | 
| 
    protected
    static
    final
    String | EXIT_PATTERN
 | 
| 
    protected
    static
    final
    String | HELP_PATTERN
 | 
| 
    protected
    static
    final
    String | INVOC_PATTERN
 | 
| 
    protected
    static
    final
    String | LINE_SEPARATOR
 | 
| 
    protected
    static
    final
    String | LIST_COMMANDS_PATTERN
 | 
| 
    protected
    static
    final
    String | LIST_PATTERN
 | 
| 
    protected
    static
    final
    String | REMOVE_PATTERN
 | 
| 
    protected
    static
    final
    String | RUN_PATTERN
 | 
| 
    protected
    static
    final
    String | SET_PATTERN
 | 
| 
    protected
    static
    final
    String | VERSION_PATTERN
 | 
| 
    protected
    
    
    LineReader | 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(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(Return the generic help string to display | 
| 
        
        
        static
        
        
        LineReader | 
      getReader()
      Return a new LineReader, 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, A customization point that subclasses can use to alter which commands are available in the console. | 
Fields
DEBUG_PATTERN
protected static final String DEBUG_PATTERN
DUMP_PATTERN
protected static final String DUMP_PATTERN
EXIT_PATTERN
protected static final String EXIT_PATTERN
HELP_PATTERN
protected static final String HELP_PATTERN
INVOC_PATTERN
protected static final String INVOC_PATTERN
LINE_SEPARATOR
protected static final String LINE_SEPARATOR
LIST_COMMANDS_PATTERN
protected static final String LIST_COMMANDS_PATTERN
LIST_PATTERN
protected static final String LIST_PATTERN
REMOVE_PATTERN
protected static final String REMOVE_PATTERN
RUN_PATTERN
protected static final String RUN_PATTERN
SET_PATTERN
protected static final String SET_PATTERN
VERSION_PATTERN
protected static final String VERSION_PATTERN
mConsoleReader
protected LineReader mConsoleReader
Protected constructors
Console
protected Console ()
Public methods
main
public static void main (String[] mainArgs)
| Parameters | |
|---|---|
| mainArgs | String | 
| Throws | |
|---|---|
| ConfigurationException | |
run
public void run ()
The main method to launch the console. Will keep running until shutdown command is issued.
setArgs
public void setArgs (mainArgs) 
Sets the console starting arguments.
| Parameters | |
|---|---|
| mainArgs | : the arguments | 
startConsole
public static void startConsole (Console console, String[] args)
Starts the given Tradefed console with given args
| Parameters | |
|---|---|
| console | Console: theConsoleto start | 
| args | String: the command line arguments | 
| Throws | |
|---|---|
| ConfigurationException | |
Protected methods
getConsolePrompt
protected String getConsolePrompt ()
| Returns | |
|---|---|
| String | the text Stringto display for the console prompt | 
getGenericHelpString
protected String getGenericHelpString (genericHelp) 
Return the generic help string to display
| Parameters | |
|---|---|
| genericHelp | : a list ofStringrepresenting the generic help to be aggregated. | 
| Returns | |
|---|---|
| String | |
getReader
protected static LineReader getReader ()
Return a new LineReader, or null if an IOException occurs. Note that this function
 must be static so that we can run it before the superclass constructor.
| Returns | |
|---|---|
| LineReader | |
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,genericHelp, commandHelp) 
A customization point that subclasses can use to alter which commands are available in the console.
Implementations should modify the genericHelp and commandHelp variables to
 document what functionality they may have added, modified, or removed.
| Parameters | |
|---|---|
| trie | RegexTrie: TheRegexTrieto add the commands to | 
| genericHelp | : AERROR(/List)of lines to print when the user runs the "help" command
     with no arguments. | 
| commandHelp | : AERROR(/Map)containing documentation for any new commands that may have
     been added. The key is a regular expression to use as a key forRegexTrie. The
     value should be a String containing the help text to print for that command. | 
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-07-19 UTC.
