| Nested classes | 
|---|
  
    
      | 
        
        
        
        
        class | ConfigurationFactory.ConfigLoaderImplementation of IConfigDefLoader that tracks the included configurations from one
 root config, and throws an exception on circular includes. 
        
    
 | 
    
    
    
      | 
        
        
        
        
        class | ConfigurationFactory.ExceptionLoader 
        
    
 | 
    
    
| Public methods | 
|---|
  
  
  
    | 
        
        
        
        
        
        void | 
      clearMapConfig()
      In some particular case, we need to clear the map.
        
    
 | 
  
  
  
  
    | 
        
        
        
        
        
        IConfiguration | 
      createConfigurationFromArgs(String[] arrayArgs,  unconsumedArgs)
      Create the IConfigurationfrom command line arguments. | 
  
  
  
  
    | 
        
        
        
        
        
        IConfiguration | 
      createConfigurationFromArgs(String[] arrayArgs,  unconsumedArgs, IKeyStoreClient keyStoreClient)
      Create the IConfigurationfrom command line arguments with a key store. | 
  
  
  
  
    | 
        
        
        
        
        
        IConfiguration | 
      createConfigurationFromArgs(String[] arrayArgs)
      A convenience method which calls ERROR(/#createConfigurationFromArgs(String[],List))with anullsecond argument. | 
  
  
  
  
    | 
        
        
        
        
        
        IGlobalConfiguration | 
      createGlobalConfigurationFromArgs(String[] arrayArgs,  remainingArgs)
      Create a IGlobalConfigurationfrom command line arguments. | 
  
  
  
  
    | 
        
        
        
        
        
        IConfiguration | 
      createPartialConfigurationFromArgs(String[] arrayArgs, IKeyStoreClient keyStoreClient,  allowedObjects, TradefedDelegator delegator)
      Create a configuration that only contains a set of selected objects.
        
    
 | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      dumpConfig(String configName, PrintStream out)
      Dumps the contents of the configuration to the given ERROR(/PrintStream) | 
  
  
  
  
    | 
        
        
        
        
        
         | 
      getConfigList(String subPath, boolean loadFromEnv)
      Variation of getConfigList()where can specify whether or not we also want to load
 the configuration from the environment. | 
  
  
  
  
    | 
        
        
        
        
        
         | 
      getConfigList()
      Return the list of names of all the configs found in the JARs on the classpath.
        
    
 | 
  
  
  
  
    | 
        
        
        static
        
        
        IConfigurationFactory | 
      getInstance()
      Get the singleton IConfigurationFactoryinstance. | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      loadAllConfigs(boolean discardExceptions)
      Loads all configurations found in classpath and test cases directories.
        
    
 | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      loadAndPrintAllConfigs()
      Utility method that checks that all configs can be loaded, parsed, and
 all option values set.
        
    
 | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      printHelp(PrintStream out)
      Prints help output for this factory.
        
    
 | 
  
  
  
  
    | 
        
        
        
        
        
        void | 
      printHelpForConfig(String[] args, boolean importantOnly, PrintStream out)
      Prints help output for the If 'args' refers to a known configuration, aIConfigurationspecified in command line arguments, IConfigurationobject will be created
 from XML, and help for thatIConfigurationwill be outputted. | 
  
Protected constructors
    ConfigurationFactory
    
protected ConfigurationFactory ()
    
    
    
  
 
Public methods
    clearMapConfig
    
public void clearMapConfig ()
    
    
    
  In some particular case, we need to clear the map.
 
    createConfigurationFromArgs
    
public IConfiguration createConfigurationFromArgs (String[] arrayArgs, 
                 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 | 
|---|
      
        | arrayArgs | 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
                       isnull, then the implementation will throwConfigurationExceptionif any unprocessed args remain. | 
    
    
      
  
 
    createConfigurationFromArgs
    
public IConfiguration createConfigurationFromArgs (String[] arrayArgs, 
                 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 | 
|---|
      
        | arrayArgs | 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
                       isnull, then the implementation will throwConfigurationExceptionif any unprocessed args remain. | 
      
        | keyStoreClient | IKeyStoreClient: aIKeyStoreClientwhich is used to obtain sensitive info in
                       the args. | 
    
    
      
  
 
    createGlobalConfigurationFromArgs
    
public IGlobalConfiguration createGlobalConfigurationFromArgs (String[] arrayArgs, 
                 remainingArgs)
    
    
    
  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 | 
|---|
      
        | arrayArgs | String: the command line arguments | 
      
        | remainingArgs | : a list which will be populated with the arguments that weren't
                      processed as global arguments | 
    
    
      
  
 
    createPartialConfigurationFromArgs
    
public 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: AIKeyStoreClientwhich is used to obtain sensitive info in the
     args. | 
      
        | allowedObjects | : The set of allowed objects to be created | 
      
        | delegator | TradefedDelegator | 
    
    
      
  
 
    dumpConfig
    
public 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: theERROR(/PrintStream)to dump output to | 
    
 
    getConfigList
    
public  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 asgetConfigList(). | 
      
        | loadFromEnv | boolean: True if we should load the configuration in the environment variable. | 
    
    
 
    getConfigList
    
public  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.
    
 
    loadAllConfigs
    
public void loadAllConfigs (boolean discardExceptions)
    
    
    
  Loads all configurations found in classpath and test cases directories.
    
    | Parameters | 
|---|
      
        | discardExceptions | boolean: true if any ConfigurationException should be ignored. | 
    
      
  
 
    loadAndPrintAllConfigs
    
public void loadAndPrintAllConfigs ()
    
    
    
  Utility method that checks that all configs can be loaded, parsed, and
 all option values set.
 Only exposed so that depending project can validate their configs.
 Should not be exposed in the console.
      
  
 
    printHelp
    
public void printHelp (PrintStream out)
    
    
    
  Prints help output for this factory.
 
 Prints a generic help info, and lists all available configurations.
    
 
    printHelpForConfig
    
public 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: iftrue, print an abbreviated help listing only the
 important details | 
      
        | out | PrintStream: theERROR(/PrintStream)to dump output to | 
    
 
Protected methods
    getBundledConfigStream
    
protected InputStream getBundledConfigStream (String name)
    
    
    
  
    
    
 
    getConfigPrefix
    
protected String getConfigPrefix ()
    
    
    
  Return the path prefix of config xml files on classpath
 
Exposed so unit tests can mock.
    
      | Returns | 
|---|
      
        | String | Stringpath with trailing / | 
    
 
    getConfigStream
    
protected BufferedInputStream getConfigStream (String name)
    
    
    
  Loads an InputStream for given config name
    
    | Parameters | 
|---|
      
        | name | String: the configuration name to load | 
    
    
      
  
 
    getConfigurationDef
    
protected ConfigurationDef getConfigurationDef (String name, 
                boolean isGlobal, 
                 templateMap)
    
    
    
  Retrieve the ConfigurationDef for the given name
    
    | Parameters | 
|---|
      
        | name | String: the name of a built-in configuration to load or a file path to configuration file
     to load | 
      
        | isGlobal | boolean | 
      
        | templateMap |  | 
    
    
      
  
 
    getMapConfig
    
protected  getMapConfig ()
    
    
    
  Exposed for testing. Return a copy of the Map.
    
 
    isDirectConfiguration
    
protected boolean isDirectConfiguration (String configName)
    
    
    
  
    
    | Parameters | 
|---|
      
        | configName | String | 
    
    
 
    reorderArgs
    
protected String[] reorderArgs (String[] args)
    
    
    
  Reorder the args so that template:map args are all moved to the front.
    
    
 
  
  
  
    
    
      
    
    
  
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2023-07-19 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-07-19 UTC."],[],[]]