IConfigurationFactory

public interface IConfigurationFactory

com.android.tradefed.config.IConfigurationFactory


Factory for creating IConfigurations

Summary

Public methods

abstract IConfiguration createConfigurationFromArgs(String[] args, unconsumedArgs)

Create the IConfiguration from command line arguments.

abstract IConfiguration createConfigurationFromArgs(String[] args)

A convenience method which calls ERROR(/#createConfigurationFromArgs(String[],List)) with a null second argument.

abstract IConfiguration createConfigurationFromArgs(String[] args, unconsumedArgs, IKeyStoreClient keyStoreClient)

Create the IConfiguration from command line arguments with a key store.

abstract IGlobalConfiguration createGlobalConfigurationFromArgs(String[] args, nonGlobalArgs)

Create a IGlobalConfiguration from command line arguments.

abstract IConfiguration createPartialConfigurationFromArgs(String[] arrayArgs, IKeyStoreClient keyStoreClient, allowedObjects, TradefedDelegator delegator)

Create a configuration that only contains a set of selected objects.

abstract void dumpConfig(String configName, PrintStream out)

Dumps the contents of the configuration to the given ERROR(/PrintStream)

abstract getConfigList()

Return the list of names of all the configs found in the JARs on the classpath.

abstract getConfigList(String subPath, boolean loadFromEnv)

Variation of getConfigList() where can specify whether or not we also want to load the configuration from the environment.

abstract void printHelp(PrintStream out)

Prints help output for this factory.

abstract void printHelpForConfig(String[] args, boolean importantOnly, PrintStream out)

Prints help output for the IConfiguration specified in command line arguments,

If 'args' refers to a known configuration, a IConfiguration object will be created from XML, and help for that IConfiguration will be outputted.

Public methods

createConfigurationFromArgs

public abstract IConfiguration createConfigurationFromArgs (String[] args, 
                 unconsumedArgs)

Create the IConfiguration from command line arguments.

Expected format is "CONFIG [options]", where CONFIG is the built-in configuration name or a file path to a configuration xml file.

Parameters
args String: the command line arguments

unconsumedArgs : a List which will be populated with the arguments that were not consumed by the Objects associated with the specified config. If this is null, then the implementation will throw ConfigurationException if any unprocessed args remain.

Returns
IConfiguration the loaded IConfiguration. The delegate object Option fields have been populated with values in args.

Throws
ConfigurationException if configuration could not be loaded

createConfigurationFromArgs

public abstract IConfiguration createConfigurationFromArgs (String[] args)

A convenience method which calls ERROR(/#createConfigurationFromArgs(String[],List)) with a null second argument. Thus, it will throw ConfigurationException if any unconsumed arguments remain.

Parameters
args String

Returns
IConfiguration

Throws
ConfigurationException

createConfigurationFromArgs

public abstract IConfiguration createConfigurationFromArgs (String[] args, 
                 unconsumedArgs, 
                IKeyStoreClient keyStoreClient)

Create the IConfiguration from command line arguments with a key store.

Expected format is "CONFIG [options]", where CONFIG is the built-in configuration name or a file path to a configuration xml file.

Parameters
args String: the command line arguments

unconsumedArgs : a List which will be populated with the arguments that were not consumed by the Objects associated with the specified config. If this is null, then the implementation will throw ConfigurationException if any unprocessed args remain.

keyStoreClient IKeyStoreClient: a IKeyStoreClient which is used to obtain sensitive info in the args.

Returns
IConfiguration the loaded IConfiguration. The delegate object Option fields have been populated with values in args.

Throws
ConfigurationException if configuration could not be loaded

createGlobalConfigurationFromArgs

public abstract IGlobalConfiguration createGlobalConfigurationFromArgs (String[] args, 
                 nonGlobalArgs)

Create a IGlobalConfiguration from command line arguments.

Expected format is "CONFIG [options]", where CONFIG is the built-in configuration name or a file path to a configuration xml file.

Parameters
args String: the command line arguments

nonGlobalArgs : a list which will be populated with the arguments that weren't processed as global arguments

Returns
IGlobalConfiguration the loaded IGlobalConfiguration. The delegate object Option fields have been populated with values in args.

Throws
ConfigurationException if configuration could not be loaded

createPartialConfigurationFromArgs

public abstract IConfiguration createPartialConfigurationFromArgs (String[] arrayArgs, 
                IKeyStoreClient keyStoreClient, 
                 allowedObjects, 
                TradefedDelegator delegator)

Create a configuration that only contains a set of selected objects.

Parameters
arrayArgs String: The command line arguments

keyStoreClient IKeyStoreClient: A IKeyStoreClient which is used to obtain sensitive info in the args.

allowedObjects : The set of allowed objects to be created

delegator TradefedDelegator

Returns
IConfiguration The loaded IConfiguration.

Throws
ConfigurationException if configuration could not be loaded

dumpConfig

public abstract void dumpConfig (String configName, 
                PrintStream out)

Dumps the contents of the configuration to the given ERROR(/PrintStream)

Parameters
configName String: the configuration name

out PrintStream: the ERROR(/PrintStream) to dump output to

getConfigList

public abstract  getConfigList ()

Return the list of names of all the configs found in the JARs on the classpath. Does not attempt to load any of the configs, so it is possible to have non working config in this list.

Returns

getConfigList

public abstract  getConfigList (String subPath, 
                boolean loadFromEnv)

Variation of getConfigList() where can specify whether or not we also want to load the configuration from the environment.

Parameters
subPath String: name of the sub-directories to look in for configuration. If null, will have the same behavior as getConfigList().

loadFromEnv boolean: True if we should load the configuration in the environment variable.

Returns

printHelp

public abstract void printHelp (PrintStream out)

Prints help output for this factory.

Prints a generic help info, and lists all available configurations.

Parameters
out PrintStream: the ERROR(/PrintStream) to dump output to

printHelpForConfig

public abstract void printHelpForConfig (String[] args, 
                boolean importantOnly, 
                PrintStream out)

Prints help output for the IConfiguration specified in command line arguments,

If 'args' refers to a known configuration, a IConfiguration object will be created from XML, and help for that IConfiguration will be outputted. Note all other 'args' values will be ignored (ie the help text will describe the current values of Options as loaded from XML, and will not reflect option's values set by the command line args.

If 'args' does not reference a known IConfiguration, the generic printHelp(PrintStream) help will be displayed.

Parameters
args String: the command line arguments

importantOnly boolean: if true, print an abbreviated help listing only the important details

out PrintStream: the ERROR(/PrintStream) to dump output to