ConfigurationDef

public class ConfigurationDef
extends Object

java.lang.Object
   ↳ com.android.tradefed.config.ConfigurationDef


Holds a record of a configuration, its associated objects and their options.

Summary

Nested classes

class ConfigurationDef.ConfigObjectDef

Object to hold info for a className and the appearance number it has (e.g. if a config has the same object twice, the first one will have the first appearance number). 

Fields

public static final String DEFAULT_DEVICE_NAME

Public constructors

ConfigurationDef(String name)

Public methods

int addConfigObjectDef(String typeName, String className)

Adds a config object to the definition

String addExpectedDevice(String deviceName, boolean isFake)

Add a device that needs to be tracked and whether or not it's real.

void addOptionDef(String optionName, String optionKey, String optionValue, String optionSource, String type)

Adds option to the definition

IConfiguration createConfiguration()

Creates a configuration from the info stored in this definition, and populates its fields with the provided option values.

IConfiguration createConfiguration( allowedObjects)

Creates a configuration from the info stored in this definition, and populates its fields with the provided option values.

String getDescription()

Returns a short description of the configuration

getExpectedDevices()

Returns the current Map of tracked devices and if they are real or not.

String getName()

Gets the name of this configuration definition

boolean isMultiDeviceMode()

Returns whether or not the recorded configuration is multi-device or not.

void setDescription(String description)

Sets the configuration definition description

void setMultiDeviceMode(boolean multiDeviceMode)

Protected methods

void checkRejectedObjects( rejectedObjects, Throwable cause)

Evaluate rejected objects map, if any throw an exception.

void injectOptions(IConfiguration config, optionList)

Fields

DEFAULT_DEVICE_NAME

public static final String DEFAULT_DEVICE_NAME

Public constructors

ConfigurationDef

public ConfigurationDef (String name)

Parameters
name String

Public methods

addConfigObjectDef

public int addConfigObjectDef (String typeName, 
                String className)

Adds a config object to the definition

Parameters
typeName String: the config object type name

className String: the class name of the config object

Returns
int the number of times this className has appeared in this ConfigurationDef, including this time. Because all ConfigurationDef methods return these classes with a constant ordering, this index can serve as a unique identifier for the just-added instance of clasName.

addExpectedDevice

public String addExpectedDevice (String deviceName, 
                boolean isFake)

Add a device that needs to be tracked and whether or not it's real.

Parameters
deviceName String

isFake boolean

Returns
String

addOptionDef

public void addOptionDef (String optionName, 
                String optionKey, 
                String optionValue, 
                String optionSource, 
                String type)

Adds option to the definition

Parameters
optionName String: the name of the option

optionKey String

optionValue String: the option value

optionSource String

type String

createConfiguration

public IConfiguration createConfiguration ()

Creates a configuration from the info stored in this definition, and populates its fields with the provided option values.

Returns
IConfiguration the created IConfiguration

Throws
ConfigurationException if configuration could not be created

createConfiguration

public IConfiguration createConfiguration ( allowedObjects)

Creates a configuration from the info stored in this definition, and populates its fields with the provided option values.

Parameters
allowedObjects : the set of TF objects that we will create out of the full configuration

Returns
IConfiguration the created IConfiguration

Throws
ConfigurationException if configuration could not be created

getDescription

public String getDescription ()

Returns a short description of the configuration

Returns
String

getExpectedDevices

public  getExpectedDevices ()

Returns the current Map of tracked devices and if they are real or not.

Returns

getName

public String getName ()

Gets the name of this configuration definition

Returns
String name of this configuration.

isMultiDeviceMode

public boolean isMultiDeviceMode ()

Returns whether or not the recorded configuration is multi-device or not.

Returns
boolean

setDescription

public void setDescription (String description)

Sets the configuration definition description

Parameters
description String

setMultiDeviceMode

public void setMultiDeviceMode (boolean multiDeviceMode)

Parameters
multiDeviceMode boolean

Protected methods

checkRejectedObjects

protected void checkRejectedObjects ( rejectedObjects, 
                Throwable cause)

Evaluate rejected objects map, if any throw an exception.

Parameters
rejectedObjects

cause Throwable

Throws
ClassNotFoundConfigurationException

injectOptions

protected void injectOptions (IConfiguration config, 
                 optionList)

Parameters
config IConfiguration

optionList

Throws
ConfigurationException