IConfiguration

public interface IConfiguration

com.android.tradefed.config.IConfiguration


Configuration information for a TradeFederation invocation. Each TradeFederation invocation has a single IConfiguration. An IConfiguration stores all the delegate objects that should be used during the invocation, and their associated Option's

Summary

Public methods

abstract IConfiguration clone()

Create a copy of this object.

abstract void dumpXml(PrintWriter output)

Gets the expanded XML file for the config with all options shown for this IConfiguration as a String.

abstract void dumpXml(PrintWriter output, List<String> excludeFilters)

Gets the expanded XML file for the config with all options shown for this IConfiguration minus the objects filters by their key name.

abstract Collection<Object> getAllConfigurationObjectsOfType(String typeName)

Generic interface to get all the object of one given type name across devices.

abstract IBuildProvider getBuildProvider()

Gets the IBuildProvider from the configuration.

abstract String getCommandLine()

Gets the command line used to create this IConfiguration.

abstract ICommandOptions getCommandOptions()

Gets the ICommandOptions to use from the configuration.

abstract ConfigurationDescriptor getConfigurationDescription()

Returns the ConfigurationDescriptor provided in the configuration.

abstract Object getConfigurationObject(String typeName)

Generic interface to get the configuration object with the given type name.

abstract List<?> getConfigurationObjectList(String typeName)

Similar to getConfigurationObject(String), but for configuration object types that support multiple objects.

abstract List<IDeviceConfiguration> getDeviceConfig()

Gets the IDeviceConfigurations from the configuration.

abstract IDeviceConfiguration getDeviceConfigByName(String nameDevice)

Return the IDeviceConfiguration associated to the name provided, null if not found.

abstract TestDeviceOptions getDeviceOptions()

Gets the TestDeviceOptions to use from the configuration.

abstract IDeviceRecovery getDeviceRecovery()

Gets the IDeviceRecovery to use from the configuration.

abstract IDeviceSelection getDeviceRequirements()

Gets the IDeviceSelection to use from the configuration.

abstract JSONArray getJsonCommandUsage()

Returns a JSON representation of this configuration.

abstract ILeveledLogOutput getLogOutput()

Gets the ILeveledLogOutput to use from the configuration.

abstract ILogSaver getLogSaver()

Gets the ILogSaver to use from the configuration.

abstract List<IMetricCollector> getMetricCollectors()

Gets the IMetricCollectors from the configuration.

abstract List<IMultiTargetPreparer> getMultiPreTargetPreparers()

Gets the IMultiTargetPreparers from the configuration that should be executed before any of the devices target_preparers.

abstract List<IMultiTargetPreparer> getMultiTargetPreparers()

Gets the IMultiTargetPreparers from the configuration.

abstract String getName()

Returns the name of the configuration.

abstract List<ISystemStatusChecker> getSystemStatusCheckers()

Gets the ISystemStatusCheckers from the configuration.

abstract List<ITargetPreparer> getTargetPreparers()

Gets the ITargetPreparers from the configuration.

abstract List<ITestInvocationListener> getTestInvocationListeners()

Gets the ITestInvocationListeners to use from the configuration.

abstract List<IRemoteTest> getTests()

Gets the IRemoteTests to run 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 injectOptionValueWithSource(String optionName, String optionKey, String optionValue, String optionSource)

Inject a option value into the set of configuration objects.

abstract void injectOptionValues(List<ConfigurationDef.OptionDef> optionDefs)

Inject multiple option values into the set of configuration objects.

abstract boolean isDeviceConfiguredFake(String deviceName)

Returns whether or not a configured device is tagged isFake=true or not.

abstract void printCommandUsage(boolean importantOnly, PrintStream out)

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

abstract void setBuildProvider(IBuildProvider provider)

Replace the current IBuildProvider in the configuration.

abstract void setCommandLine(String[] arrayArgs)

Sets the command line used to create this IConfiguration.

abstract void setCommandOptions(ICommandOptions cmdOptions)

Set the ICommandOptions, 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 name, List<?> configList)

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

abstract void setDeviceConfig(IDeviceConfiguration deviceConfig)

Set a IDeviceConfiguration, replacing any existing value.

abstract void setDeviceConfigList(List<IDeviceConfiguration> deviceConfigs)

Set the IDeviceConfigurations, replacing any existing value.

abstract void setDeviceMetricCollectors(List<IMetricCollector> collectors)

Set the list of IMetricCollectors, replacing any existing values.

abstract void setDeviceOptions(TestDeviceOptions deviceOptions)

Set the TestDeviceOptions, replacing any existing values

abstract void setDeviceRecovery(IDeviceRecovery recovery)

Set the IDeviceRecovery, replacing any existing value.

abstract void setDeviceRequirements(IDeviceSelection deviceSelection)

Set the IDeviceSelection, replacing any existing values

abstract void setLogOutput(ILeveledLogOutput logger)

Set the ILeveledLogOutput, replacing any existing value.

abstract void setLogSaver(ILogSaver logSaver)

Set the ILogSaver, replacing any existing value.

abstract void setMultiPreTargetPreparer(IMultiTargetPreparer multiPreTargPreps)

Convenience method to set a single IMultiTargetPreparer in this configuration that should be executed before any of the devices target_preparers, replacing any existing values

abstract void setMultiPreTargetPreparers(List<IMultiTargetPreparer> multiPreTargPreps)

Set the list of IMultiTargetPreparers in this configuration that should be executed before any of the devices target_preparers, replacing any existing values

abstract void setMultiTargetPreparer(IMultiTargetPreparer multiTargPrep)

Convenience method to set a single IMultiTargetPreparer in this configuration, replacing any existing values

abstract void setMultiTargetPreparers(List<IMultiTargetPreparer> multiTargPreps)

Set the list of IMultiTargetPreparers in this configuration, replacing any existing values

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

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

ArgsOptionParser for expected format

abstract List<String> setOptionsFromCommandLineArgs(List<String> listArgs, IKeyStoreClient keyStoreClient)

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

See ArgsOptionParser for expected format

abstract void setSystemStatusChecker(ISystemStatusChecker systemChecker)

Convenience method to set a single ISystemStatusChecker in this configuration, replacing any existing values

abstract void setSystemStatusCheckers(List<ISystemStatusChecker> systemCheckers)

Set the list of ISystemStatusCheckers in this configuration, replacing any existing values

abstract void setTargetPreparer(ITargetPreparer preparer)

Set the ITargetPreparer, replacing any existing value.

abstract void setTargetPreparers(List<ITargetPreparer> preparers)

Set the list of ITargetPreparers, replacing any existing value.

abstract void setTest(IRemoteTest test)

Convenience method to set a single IRemoteTest in this configuration, replacing any existing values

abstract void setTestInvocationListener(ITestInvocationListener listener)

Convenience method to set a single ITestInvocationListener

abstract void setTestInvocationListeners(List<ITestInvocationListener> listeners)

Set the list of ITestInvocationListeners, replacing any existing values

abstract void setTests(List<IRemoteTest> tests)

Set the list of IRemoteTests in this configuration, replacing any existing values

abstract void validateOptions()

Validate option values.

Public methods

clone

public abstract IConfiguration clone ()

Create a copy of this object.

Returns
IConfiguration a {link IConfiguration} copy

dumpXml

public abstract void dumpXml (PrintWriter output)

Gets the expanded XML file for the config with all options shown for this IConfiguration as a String.

Parameters
output PrintWriter: the writer to print the xml to.

Throws
IOException

dumpXml

public abstract void dumpXml (PrintWriter output, 
                List<String> excludeFilters)

Gets the expanded XML file for the config with all options shown for this IConfiguration minus the objects filters by their key name.

Filter example: Configuration.TARGET_PREPARER_TYPE_NAME.

Parameters
output PrintWriter: the writer to print the xml to.

excludeFilters List: the list of object type that should not be dumped.

Throws
IOException

getAllConfigurationObjectsOfType

public abstract Collection<Object> getAllConfigurationObjectsOfType (String typeName)

Generic interface to get all the object of one given type name across devices.

Parameters
typeName String: the unique type of the configuration object

Returns
Collection<Object> The list of configuration objects of the given type.

getBuildProvider

public abstract IBuildProvider getBuildProvider ()

Gets the IBuildProvider from the configuration.

Returns
IBuildProvider the IBuildProvider provided in the configuration

getCommandLine

public abstract String getCommandLine ()

Gets the command line used to create this IConfiguration.

Returns
String the command line used to create this IConfiguration.

getCommandOptions

public abstract ICommandOptions getCommandOptions ()

Gets the ICommandOptions to use from the configuration.

Returns
ICommandOptions the ICommandOptions provided in the configuration.

getConfigurationDescription

public abstract ConfigurationDescriptor getConfigurationDescription ()

Returns the ConfigurationDescriptor provided in the configuration.

Returns
ConfigurationDescriptor

getConfigurationObject

public abstract Object getConfigurationObject (String typeName)

Generic interface to get the configuration object with the given type name.

Parameters
typeName String: the unique type of the configuration object

Returns
Object the configuration object or null if the object type with given name does not exist.

getConfigurationObjectList

public abstract List<?> getConfigurationObjectList (String typeName)

Similar to getConfigurationObject(String), but for configuration object types that support multiple objects.

Parameters
typeName String: the unique type name of the configuration object

Returns
List<?> the list of configuration objects or null if the object type with given name does not exist.

getDeviceConfig

public abstract List<IDeviceConfiguration> getDeviceConfig ()

Gets the IDeviceConfigurations from the configuration.

Returns
List<IDeviceConfiguration> the IDeviceConfigurations provided in order in the configuration

getDeviceConfigByName

public abstract IDeviceConfiguration getDeviceConfigByName (String nameDevice)

Return the IDeviceConfiguration associated to the name provided, null if not found.

Parameters
nameDevice String

Returns
IDeviceConfiguration

getDeviceOptions

public abstract TestDeviceOptions getDeviceOptions ()

Gets the TestDeviceOptions to use from the configuration.

Returns
TestDeviceOptions the TestDeviceOptions provided in the configuration.

getDeviceRecovery

public abstract IDeviceRecovery getDeviceRecovery ()

Gets the IDeviceRecovery to use from the configuration.

Returns
IDeviceRecovery the IDeviceRecovery provided in the configuration.

getDeviceRequirements

public abstract IDeviceSelection getDeviceRequirements ()

Gets the IDeviceSelection to use from the configuration.

Returns
IDeviceSelection the IDeviceSelection provided in the configuration.

getJsonCommandUsage

public abstract JSONArray getJsonCommandUsage ()

Returns a JSON representation of this configuration.

The return value is a JSONArray containing JSONObjects to represent each configuration object. Each configuration object entry has the following structure:

 &#123;
     "alias": "device-unavail-email",
     "name": "result_reporter",
     "class": "com.android.tradefed.result.DeviceUnavailEmailResultReporter",
     "options": [ ... ]
   &#125;
 
 
The "options" entry is a JSONArray containing JSONObjects to represent each @Option annotated field. Each option entry has the following structure:
 &#123;
     "updateRule": "LAST",
     "isTimeVal": false,
     "source": "google\/template\/reporters\/asit",
     "importance": "IF_UNSET",
     "description": "The envelope-sender address to use for the messages.",
     "mandatory": false,
     "name": "sender",
     "javaClass": "java.lang.String",
     "value": "tffail@google.com"
   &#125;
 
 
Most of the values come from the @Option annotation. 'javaClass' is the name of the underlying java class for this option. 'value' is a JSON representation of the field's current value. 'source' is the set of config names which set the field's value. For regular objects or Collections, 'source' is a JSONArray containing each contributing config's name. For map fields, sources for each key are tracked individually and stored in a JSONObject. Each key / value pair in the JSONObject corresponds to a key in the map and an array of its source configurations.

Returns
JSONArray

Throws
JSONException

getLogOutput

public abstract ILeveledLogOutput getLogOutput ()

Gets the ILeveledLogOutput to use from the configuration.

Returns
ILeveledLogOutput the ILeveledLogOutput provided in the configuration.

getLogSaver

public abstract ILogSaver getLogSaver ()

Gets the ILogSaver to use from the configuration.

Returns
ILogSaver the ILogSaver provided in the configuration.

getMetricCollectors

public abstract List<IMetricCollector> getMetricCollectors ()

Gets the IMetricCollectors from the configuration.

Returns
List<IMetricCollector>

getMultiPreTargetPreparers

public abstract List<IMultiTargetPreparer> getMultiPreTargetPreparers ()

Gets the IMultiTargetPreparers from the configuration that should be executed before any of the devices target_preparers.

Returns
List<IMultiTargetPreparer> the IMultiTargetPreparers provided in order in the configuration

getMultiTargetPreparers

public abstract List<IMultiTargetPreparer> getMultiTargetPreparers ()

Gets the IMultiTargetPreparers from the configuration.

Returns
List<IMultiTargetPreparer> the IMultiTargetPreparers provided in order in the configuration

getName

public abstract String getName ()

Returns the name of the configuration.

Returns
String

getSystemStatusCheckers

public abstract List<ISystemStatusChecker> getSystemStatusCheckers ()

Gets the ISystemStatusCheckers from the configuration.

Returns
List<ISystemStatusChecker> the ISystemStatusCheckers provided in order in the configuration

getTargetPreparers

public abstract List<ITargetPreparer> getTargetPreparers ()

Gets the ITargetPreparers from the configuration.

Returns
List<ITargetPreparer> the ITargetPreparers provided in order in the configuration

getTestInvocationListeners

public abstract List<ITestInvocationListener> getTestInvocationListeners ()

Gets the ITestInvocationListeners to use from the configuration.

Returns
List<ITestInvocationListener> the ITestInvocationListeners provided in the configuration.

getTests

public abstract List<IRemoteTest> getTests ()

Gets the IRemoteTests to run from the configuration.

Returns
List<IRemoteTest> the tests provided in the configuration

injectOptionValue

public abstract 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

Throws
ConfigurationException if failed to set the option's value

injectOptionValue

public abstract 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 option name

optionKey String: the optional key for map options, or null

optionValue String: the map option value

Throws
ConfigurationException if failed to set the option's value

injectOptionValueWithSource

public abstract void injectOptionValueWithSource (String optionName, 
                String optionKey, 
                String optionValue, 
                String optionSource)

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

optionKey String: the optional key for map options, or null

optionValue String: the map option value

optionSource String: the source config that provided this option value

Throws
ConfigurationException if failed to set the option's value

injectOptionValues

public abstract void injectOptionValues (List<ConfigurationDef.OptionDef> optionDefs)

Inject multiple option values into the set of configuration objects.

Useful to inject many option values at once after creating a new object.

Parameters
optionDefs List: a list of option defs to inject

Throws
ConfigurationException if failed to set option values

isDeviceConfiguredFake

public abstract boolean isDeviceConfiguredFake (String deviceName)

Returns whether or not a configured device is tagged isFake=true or not.

Parameters
deviceName String

Returns
boolean

printCommandUsage

public abstract void printCommandUsage (boolean importantOnly, 
                PrintStream out)

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

Parameters
importantOnly boolean: if true only print help for the important options

out PrintStream: the PrintStream to use.

Throws
ConfigurationException

setBuildProvider

public abstract void setBuildProvider (IBuildProvider provider)

Replace the current IBuildProvider in the configuration.

Parameters
provider IBuildProvider: the new IBuildProvider

setCommandLine

public abstract void setCommandLine (String[] arrayArgs)

Sets the command line used to create this IConfiguration. This stores the whole command line, including the configuration name, unlike setOptionsFromCommandLineArgs.

Parameters
arrayArgs String: the command line

setCommandOptions

public abstract void setCommandOptions (ICommandOptions cmdOptions)

Set the ICommandOptions, replacing any existing values

setConfigurationObject

public abstract 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

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

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

Parameters
name 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

setDeviceConfig

public abstract void setDeviceConfig (IDeviceConfiguration deviceConfig)

Set a IDeviceConfiguration, replacing any existing value.

setDeviceConfigList

public abstract void setDeviceConfigList (List<IDeviceConfiguration> deviceConfigs)

Set the IDeviceConfigurations, replacing any existing value.

setDeviceMetricCollectors

public abstract void setDeviceMetricCollectors (List<IMetricCollector> collectors)

Set the list of IMetricCollectors, replacing any existing values.

Parameters
collectors List

setDeviceOptions

public abstract void setDeviceOptions (TestDeviceOptions deviceOptions)

Set the TestDeviceOptions, replacing any existing values

Parameters
deviceOptions TestDeviceOptions

setDeviceRecovery

public abstract void setDeviceRecovery (IDeviceRecovery recovery)

Set the IDeviceRecovery, replacing any existing value.

setDeviceRequirements

public abstract void setDeviceRequirements (IDeviceSelection deviceSelection)

Set the IDeviceSelection, replacing any existing values

setLogOutput

public abstract void setLogOutput (ILeveledLogOutput logger)

Set the ILeveledLogOutput, replacing any existing value.

setLogSaver

public abstract void setLogSaver (ILogSaver logSaver)

Set the ILogSaver, replacing any existing value.

setMultiPreTargetPreparer

public abstract void setMultiPreTargetPreparer (IMultiTargetPreparer multiPreTargPreps)

Convenience method to set a single IMultiTargetPreparer in this configuration that should be executed before any of the devices target_preparers, replacing any existing values

setMultiPreTargetPreparers

public abstract void setMultiPreTargetPreparers (List<IMultiTargetPreparer> multiPreTargPreps)

Set the list of IMultiTargetPreparers in this configuration that should be executed before any of the devices target_preparers, replacing any existing values

setMultiTargetPreparer

public abstract void setMultiTargetPreparer (IMultiTargetPreparer multiTargPrep)

Convenience method to set a single IMultiTargetPreparer in this configuration, replacing any existing values

setMultiTargetPreparers

public abstract void setMultiTargetPreparers (List<IMultiTargetPreparer> multiTargPreps)

Set the list of IMultiTargetPreparers in this configuration, replacing any existing values

setOptionsFromCommandLineArgs

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

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

ArgsOptionParser for expected format

Parameters
listArgs List: the command line arguments

Returns
List<String> the unconsumed arguments

Throws
ConfigurationException

setOptionsFromCommandLineArgs

public abstract List<String> setOptionsFromCommandLineArgs (List<String> listArgs, 
                IKeyStoreClient keyStoreClient)

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

See ArgsOptionParser for expected format

Parameters
listArgs List: the command line arguments

keyStoreClient IKeyStoreClient: IKeyStoreClient to use.

Returns
List<String> the unconsumed arguments

Throws
ConfigurationException

setSystemStatusChecker

public abstract void setSystemStatusChecker (ISystemStatusChecker systemChecker)

Convenience method to set a single ISystemStatusChecker in this configuration, replacing any existing values

setSystemStatusCheckers

public abstract void setSystemStatusCheckers (List<ISystemStatusChecker> systemCheckers)

Set the list of ISystemStatusCheckers in this configuration, replacing any existing values

setTargetPreparer

public abstract void setTargetPreparer (ITargetPreparer preparer)

Set the ITargetPreparer, replacing any existing value.

setTargetPreparers

public abstract void setTargetPreparers (List<ITargetPreparer> preparers)

Set the list of ITargetPreparers, replacing any existing value.

setTest

public abstract void setTest (IRemoteTest test)

Convenience method to set a single IRemoteTest in this configuration, replacing any existing values

setTestInvocationListener

public abstract void setTestInvocationListener (ITestInvocationListener listener)

Convenience method to set a single ITestInvocationListener

setTestInvocationListeners

public abstract void setTestInvocationListeners (List<ITestInvocationListener> listeners)

Set the list of ITestInvocationListeners, replacing any existing values

setTests

public abstract void setTests (List<IRemoteTest> tests)

Set the list of IRemoteTests in this configuration, replacing any existing values

validateOptions

public abstract void validateOptions ()

Validate option values.

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

Throws
ConfigurationException if config is not valid