IGlobalConfiguration

public interface IGlobalConfiguration

com.android.tradefed.config.IGlobalConfiguration
Known Indirect Subclasses
GlobalConfiguration An IGlobalConfiguration implementation that stores the loaded config objects in a map  


A class to encompass global configuration information for a single Trade Federation instance (encompassing any number of invocations of actual configurations).

Summary

Public methods

abstract void cloneConfigWithFilter(File outputXml, String[] whitelistConfigs)

Filter the GlobalConfiguration based on a white list and output to an XML file.

abstract ICommandScheduler getCommandScheduler()

Gets the ICommandScheduler to use from the configuration.

abstract Object getConfigurationObject(String typeName)

Gets the custom configuration object with given name.

abstract IDeviceManager getDeviceManager()

Gets the IDeviceManager to use from the configuration.

abstract List<IDeviceMonitor> getDeviceMonitors()

Gets the list of IDeviceMonitor from the global config.

abstract IDeviceSelection getDeviceRequirements()

Gets the IDeviceSelection to use from the configuration.

abstract List<IHostMonitor> getHostMonitors()

Gets the list of IHostMonitor from the global config.

abstract IHostOptions getHostOptions()

Gets the IHostOptions to use from the configuration.

abstract IKeyStoreFactory getKeyStoreFactory()

Gets the IKeyStoreFactory to use from the configuration.

abstract List<IMultiDeviceRecovery> getMultiDeviceRecoveryHandlers()

Gets the list of IMultiDeviceRecovery to use from the configuration.

abstract List<String> getOptionValues(String optionName)

Get a list of option's values.

abstract IShardHelper getShardingStrategy()

Returns the IShardHelper that defines the way to shard a configuration.

abstract ITerribleFailureHandler getWtfHandler()

Gets the ITerribleFailureHandler to use from the configuration.

abstract void injectOptionValue(String optionName, String optionValue)

Inject a option value into the set of configuration objects.

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

Inject a option value into the set of configuration objects.

abstract void setCommandScheduler(ICommandScheduler scheduler)

Set the ICommandScheduler, replacing any existing values.

abstract void setConfigurationObject(String name, Object configObject)

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

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

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

abstract void setDeviceManager(IDeviceManager deviceManager)

Set the IDeviceManager, replacing any existing values.

abstract void setDeviceMonitor(IDeviceMonitor deviceMonitor)

Set the IDeviceMonitor.

abstract void setDeviceRequirements(IDeviceSelection deviceSelection)

Set the IDeviceSelection, replacing any existing values.

abstract void setHostMonitors(List<IHostMonitor> hostMonitors)

Set the IHostMonitor list.

abstract void setHostOptions(IHostOptions hostOptions)

Set the IHostOptions, replacing any existing values.

abstract void setKeyStoreFactory(IKeyStoreFactory factory)

Set the IKeyStoreFactory, replacing any existing values.

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

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

See ArgsOptionParser for expected format

abstract void setShardingStrategy(IShardHelper sharding)

Sets the IShardHelper to be used when sharding a configuration.

abstract void setWtfHandler(ITerribleFailureHandler wtfHandler)

Set the ITerribleFailureHandler.

abstract void validateOptions()

Validate option values.

Public methods

cloneConfigWithFilter

void cloneConfigWithFilter (File outputXml, 
                String[] whitelistConfigs)

Filter the GlobalConfiguration based on a white list and output to an XML file.

For example, for following configuration: <xml> <configuration> <device_monitor class="com.android.tradefed.device.DeviceMonitorMultiplexer" /> <wtf_handler class="com.android.tradefed.log.TerribleFailureEmailHandler" /> <key_store class="com.android.tradefed.util.keystore.JSONFileKeyStoreFactory" /> </configuration> </xml>

all config except "key_store" will be filtered out, and result a config file with following content: <xml> <configuration> <key_store class="com.android.tradefed.util.keystore.JSONFileKeyStoreFactory" /> </configuration> </xml>

Parameters
outputXml File: the XML file to write to

whitelistConfigs String: a String array of configs to be included in the new XML file. If it's set to null, a default list should be used.

Throws
IOException

getCommandScheduler

ICommandScheduler getCommandScheduler ()

Gets the ICommandScheduler to use from the configuration.

Returns
ICommandScheduler the ICommandScheduler. Will never return null.

getConfigurationObject

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

getDeviceManager

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.

getDeviceMonitors

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.

getDeviceRequirements

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.

getHostMonitors

List<IHostMonitor> getHostMonitors ()

Gets the list of IHostMonitor from the global config.

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

getHostOptions

IHostOptions getHostOptions ()

Gets the IHostOptions to use from the configuration.

Returns
IHostOptions the IDeviceManager provided in the configuration.

getKeyStoreFactory

IKeyStoreFactory getKeyStoreFactory ()

Gets the IKeyStoreFactory to use from the configuration.

Returns
IKeyStoreFactory the IKeyStoreFactory or null if no key store factory is set.

getMultiDeviceRecoveryHandlers

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.

getOptionValues

List<String> getOptionValues (String optionName)

Get a list of option's values.

Parameters
optionName String: the map option name

Returns
List<String> a list of the given option's values. null if the option name does not exist.

getShardingStrategy

IShardHelper getShardingStrategy ()

Returns the IShardHelper that defines the way to shard a configuration.

Returns
IShardHelper

getWtfHandler

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

injectOptionValue

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 if failed to set the option's value

injectOptionValue

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 if failed to set the option's value

setCommandScheduler

void setCommandScheduler (ICommandScheduler scheduler)

Set the ICommandScheduler, replacing any existing values.

setConfigurationObject

void setConfigurationObject (String name, 
                Object configObject)

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

Parameters
name String: the unique name of the config object type.

configObject Object: the config object

Throws
ConfigurationException if the configObject was not the correct type

setConfigurationObjectList

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 if any objects in the list are not the correct type

setDeviceManager

void setDeviceManager (IDeviceManager deviceManager)

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

setDeviceMonitor

void setDeviceMonitor (IDeviceMonitor deviceMonitor)

Set the IDeviceMonitor.

Parameters
deviceMonitor IDeviceMonitor: The monitor

Throws
ConfigurationException if an IDeviceMonitor has already been set.

setDeviceRequirements

void setDeviceRequirements (IDeviceSelection deviceSelection)

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

setHostMonitors

void setHostMonitors (List<IHostMonitor> hostMonitors)

Set the IHostMonitor list.

Parameters
hostMonitors List: The list of monitors

Throws
ConfigurationException if an IHostMonitor has already been set.

setHostOptions

void setHostOptions (IHostOptions hostOptions)

Set the IHostOptions, replacing any existing values.

setKeyStoreFactory

void setKeyStoreFactory (IKeyStoreFactory factory)

Set the IKeyStoreFactory, replacing any existing values.

setOptionsFromCommandLineArgs

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

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

See ArgsOptionParser for expected format

Parameters
listArgs List: the command line arguments

Returns
List<String> the unconsumed arguments

Throws
ConfigurationException

setShardingStrategy

void setShardingStrategy (IShardHelper sharding)

Sets the IShardHelper to be used when sharding a configuration.

Parameters
sharding IShardHelper

setWtfHandler

void setWtfHandler (ITerribleFailureHandler wtfHandler)

Set the ITerribleFailureHandler.

Parameters
wtfHandler ITerribleFailureHandler: the WTF handler

Throws
ConfigurationException if an ITerribleFailureHandler has already been set.

validateOptions

void validateOptions ()

Validate option values.

Currently this will just validate that all mandatory options have been set

Throws
ConfigurationException if configuration is missing mandatory fields