to top
public class

GlobalConfiguration

extends Object
implements IGlobalConfiguration
java.lang.Object
   ↳ com.android.tradefed.config.GlobalConfiguration

Class Overview

An IGlobalConfiguration implementation that stores the loaded config objects in a map

Summary

Constants
String DEVICE_MANAGER_TYPE_NAME
String DEVICE_MONITOR_TYPE_NAME
String DEVICE_REQUIREMENTS_TYPE_NAME
String HOST_OPTIONS_TYPE_NAME
String MULTI_DEVICE_RECOVERY_TYPE_NAME
String SCHEDULER_TYPE_NAME
String WTF_HANDLER_TYPE_NAME
Public Methods
static List<String> createGlobalConfiguration(String[] args)
Sets up the GlobalConfiguration singleton for this TF instance.
ICommandScheduler getCommandScheduler()
Gets the ICommandScheduler to use from the configuration.
Object getConfigurationObject(String typeName)
Gets the custom configuration object with given name.
List<?> getConfigurationObjectList(String typeName)
String getDescription()
IDeviceManager getDeviceManager()
Gets the IDeviceManager to use from the configuration.
static IDeviceManager getDeviceManagerInstance()
Returns a reference to the singleton DeviceManager instance for this TF instance.
List<IDeviceMonitor> getDeviceMonitors()
Gets the list of IDeviceMonitor from the global config.
IDeviceSelection getDeviceRequirements()
Gets the IDeviceSelection to use from the configuration.
static IGlobalConfiguration getInstance()
Returns a reference to the singleton GlobalConfiguration instance for this TF instance.
List<IMultiDeviceRecovery> getMultiDeviceRecoveryHandlers()
Gets the list of IMultiDeviceRecovery to use from the configuration.
String getName()
List<String> getOptionValues(String optionName)
Get a list of option's values.
ITerribleFailureHandler getWtfHandler()
Gets the ITerribleFailureHandler to use from the configuration.
void injectOptionValue(String optionName, String optionValue)
Inject a option value into the set of configuration objects.
void injectOptionValue(String optionName, String optionKey, String optionValue)
Inject a option value into the set of configuration objects.
void printCommandUsage(boolean importantOnly, PrintStream out)
Outputs a command line usage help text for this configuration to given printStream.
void setCommandScheduler(ICommandScheduler scheduler)
Set the ICommandScheduler, replacing any existing values.
void setConfigurationObject(String typeName, Object configObject)
Generic method to set the config object with the given name, replacing any existing value.
void setConfigurationObjectList(String typeName, List<?> configList)
Generic method to set the config object list for the given name, replacing any existing value.
void setDeviceManager(IDeviceManager manager)
Set the IDeviceManager, replacing any existing values.
void setDeviceMonitor(IDeviceMonitor monitor)
Set the IDeviceMonitor.
void setDeviceRequirements(IDeviceSelection devRequirements)
Set the IDeviceSelection, replacing any existing values.
List<String> setOptionsFromCommandLineArgs(List<String> listArgs)
Set the global config Option fields with given set of command line arguments

void setWtfHandler(ITerribleFailureHandler wtfHandler)
void validateOptions()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.tradefed.config.IGlobalConfiguration

Constants

public static final String DEVICE_MANAGER_TYPE_NAME

Constant Value: "device_manager"

public static final String DEVICE_MONITOR_TYPE_NAME

Constant Value: "device_monitor"

public static final String DEVICE_REQUIREMENTS_TYPE_NAME

Constant Value: "device_requirements"

public static final String HOST_OPTIONS_TYPE_NAME

Constant Value: "host_options"

public static final String MULTI_DEVICE_RECOVERY_TYPE_NAME

Constant Value: "multi_device_recovery"

public static final String SCHEDULER_TYPE_NAME

Constant Value: "command_scheduler"

public static final String WTF_HANDLER_TYPE_NAME

Constant Value: "wtf_handler"

Public Methods

public static List<String> createGlobalConfiguration (String[] args)

Sets up the GlobalConfiguration singleton for this TF instance. Must be called once and only once, before anything attempts to call

Parameters
args String
Returns
List<String>
Throws
IllegalStateException if called more than once
ConfigurationException

public ICommandScheduler getCommandScheduler ()

Gets the ICommandScheduler to use from the configuration.

Returns
ICommandScheduler the ICommandScheduler. Will never return null.

public Object getConfigurationObject (String typeName)

Gets the custom configuration object with given name.

Parameters
typeName String: the unique type of the configuration object
Returns
Object the object or null if object with that name is not found

public List<?> getConfigurationObjectList (String typeName)

Parameters
typeName String
Returns
List<?>

public String getDescription ()

Returns
String a short user readable description this Configuration

public IDeviceManager getDeviceManager ()

Gets the IDeviceManager to use from the configuration. Manages the set of available devices for testing

Returns
IDeviceManager the IDeviceManager provided in the configuration.

public static IDeviceManager getDeviceManagerInstance ()

Returns a reference to the singleton DeviceManager instance for this TF instance.

Returns
IDeviceManager
Throws
IllegalStateException if has not already been called.

public List<IDeviceMonitor> getDeviceMonitors ()

Gets the list of IDeviceMonitor from the global config.

Returns
List<IDeviceMonitor> the list of IDeviceMonitor from the global config, or null if none was specified.

public IDeviceSelection getDeviceRequirements ()

Gets the IDeviceSelection to use from the configuration. Represents a global filter on which devices the DeviceManager can see.

Returns
IDeviceSelection the IDeviceSelection provided in the configuration.

public static IGlobalConfiguration getInstance ()

Returns a reference to the singleton GlobalConfiguration instance for this TF instance.

Returns
IGlobalConfiguration
Throws
IllegalStateException if has not already been called.

public List<IMultiDeviceRecovery> getMultiDeviceRecoveryHandlers ()

Gets the list of IMultiDeviceRecovery to use from the configuration.

Returns
List<IMultiDeviceRecovery> the list of IMultiDeviceRecovery, or null if not set.

public String getName ()

Returns
String the name of this Configuration

public List<String> getOptionValues (String optionName)

Get a list of option's values.

Parameters
optionName String: the map option name
Returns
List<String>

public ITerribleFailureHandler getWtfHandler ()

Gets the ITerribleFailureHandler to use from the configuration. Handles what to do in the event that a WTF (What a Terrible Failure) occurs.

Returns
ITerribleFailureHandler the ITerribleFailureHandler provided in the configuration, or null if no handler is set

public void injectOptionValue (String optionName, String optionValue)

Inject a option value into the set of configuration objects.

Useful to provide values for options that are generated dynamically.

Parameters
optionName String: the option name
optionValue String: the option value(s)
Throws
ConfigurationException

public void injectOptionValue (String optionName, String optionKey, String optionValue)

Inject a option value into the set of configuration objects.

Useful to provide values for options that are generated dynamically.

Parameters
optionName String: the map option name
optionKey String: the map option key
optionValue String: the map option value
Throws
ConfigurationException

public void printCommandUsage (boolean importantOnly, PrintStream out)

Outputs a command line usage help text for this configuration to given printStream.

Parameters
importantOnly boolean
out PrintStream: the PrintStream to use.
Throws
ConfigurationException}
ConfigurationException

public void setCommandScheduler (ICommandScheduler scheduler)

Set the ICommandScheduler, replacing any existing values.

public void setConfigurationObject (String typeName, Object configObject)

Generic method to set the config object with the given name, replacing any existing value.

Parameters
typeName String: the unique name of the config object type.
configObject Object: the config object
Throws
ConfigurationException

public void setConfigurationObjectList (String typeName, List<?> configList)

Generic method to set the config object list for the given name, replacing any existing value.

Parameters
typeName String: the unique name of the config object type.
configList List: the config object list
Throws
ConfigurationException

public void setDeviceManager (IDeviceManager manager)

Set the IDeviceManager, replacing any existing values. This sets the manager for the test devices

public void setDeviceMonitor (IDeviceMonitor monitor)

Set the IDeviceMonitor.

Parameters
monitor IDeviceMonitor: The monitor

public void setDeviceRequirements (IDeviceSelection devRequirements)

Set the IDeviceSelection, replacing any existing values. This sets a global device filter on which devices the DeviceManager can see.

public List<String> setOptionsFromCommandLineArgs (List<String> listArgs)

Set the global config Option fields with given set of command line arguments

Parameters
listArgs List: the command line arguments
Returns
List<String> the unconsumed arguments
Throws
ConfigurationException

public void setWtfHandler (ITerribleFailureHandler wtfHandler)

Set the ITerribleFailureHandler.

Parameters
wtfHandler ITerribleFailureHandler: the WTF handler

public void validateOptions ()