ConfigurationFactory

public class ConfigurationFactory
extends Object implements IConfigurationFactory

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


IConfiguration を作成するためのファクトリ。

概要

ネストされたクラス

class ConfigurationFactory.ConfigLoader

1 つのルート構成から含まれる構成を追跡し、循環インクルードで例外をスローする IConfigDefLoader の実装。 

class ConfigurationFactory.ExceptionLoader

 

保護されたコンストラクタ

ConfigurationFactory()

パブリック メソッド

void clearMapConfig()

特定のケースでは、マップをクリアする必要があります。

IConfiguration createConfigurationFromArgs(String[] arrayArgs, List<String> unconsumedArgs, IKeyStoreClient keyStoreClient)

キーストアを使用して、コマンドライン引数から IConfiguration を作成します。

IConfiguration createConfigurationFromArgs(String[] arrayArgs, List<String> unconsumedArgs)

コマンドライン引数から IConfiguration を作成します。

IConfiguration createConfigurationFromArgs(String[] arrayArgs)

null の第 2 引数を指定して createConfigurationFromArgs(String[],List) を呼び出すコンビニエンス メソッド。

IGlobalConfiguration createGlobalConfigurationFromArgs(String[] arrayArgs, List<String> remainingArgs)

コマンドライン引数から IGlobalConfiguration を作成します。

IConfiguration createPartialConfigurationFromArgs(String[] arrayArgs, IKeyStoreClient keyStoreClient, Set<String> allowedObjects, TradefedDelegator delegator)

選択したオブジェクトのセットのみを含む構成を作成します。

void dumpConfig(String configName, PrintStream out)

構成の内容を指定された PrintStream にダンプします。

List<String> getConfigList(String subPath, boolean loadFromEnv)

環境から構成を読み込むかどうかも指定できる getConfigList() のバリエーション。

List<String> getConfigList()

クラスパスの JAR で見つかったすべての構成の名前のリストを返します。

static IConfigurationFactory getInstance()

シングルトン IConfigurationFactory インスタンスを取得します。

void loadAllConfigs(boolean discardExceptions)

クラスパスとテストケース ディレクトリにあるすべての構成を読み込みます。

void loadAndPrintAllConfigs()

すべての構成を読み込んで解析し、すべてのオプション値を設定できることを確認するユーティリティ メソッド。

void printHelp(PrintStream out)

このファクトリのヘルプ出力を出力します。

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

コマンドライン引数で指定された IConfiguration のヘルプ出力を出力します。

「args」が既知の構成を参照している場合、XML から IConfiguration オブジェクトが作成され、その IConfiguration のヘルプが出力されます。

保護されたメソッド

InputStream getBundledConfigStream(String name)
String getConfigPrefix()

クラスパス上の構成 XML ファイルのパス接頭辞を返します。

単体テストでモックできるように公開されています。

BufferedInputStream getConfigStream(String name)

指定された構成名の InputStream を読み込みます。

ConfigurationDef getConfigurationDef(String name, boolean isGlobal, Map<String, String> templateMap)

指定された名前の ConfigurationDef を取得します。

Map<ConfigurationFactory.ConfigId, ConfigurationDef> getMapConfig()

テスト用に公開されています。

boolean isDirectConfiguration(String configName)
String[] reorderArgs(String[] args)

template:map 引数がすべて先頭に移動するように、引数の順序を変更します。

IRemoteFileResolver.ResolvedFile resolveRemoteFile(URI configURI, URI destDir)

保護されたコンストラクタ

ConfigurationFactory

protected ConfigurationFactory ()

パブリック メソッド

clearMapConfig

public void clearMapConfig ()

特定のケースでは、マップをクリアする必要があります。

createConfigurationFromArgs

public IConfiguration createConfigurationFromArgs (String[] arrayArgs, 
                List<String> unconsumedArgs, 
                IKeyStoreClient keyStoreClient)

キーストアを使用して、コマンドライン引数から IConfiguration を作成します。

想定される形式は「CONFIG [options]」です。ここで、CONFIG は組み込みの構成名または構成 XML ファイルへのファイルパスです。

パラメータ
arrayArgs String: コマンドライン引数

unconsumedArgs List: 指定された構成に関連付けられたオブジェクトによって使用されなかった引数が入力されるリスト。これが null の場合、未処理の引数が残っていると、実装は ConfigurationException をスローします。

keyStoreClient IKeyStoreClient: 引数内の機密情報を取得するために使用される IKeyStoreClient

戻り値
IConfiguration 読み込まれた IConfiguration。デリゲート オブジェクトの Option フィールドには、args の値が入力されています。

例外
ConfigurationException

createConfigurationFromArgs

public IConfiguration createConfigurationFromArgs (String[] arrayArgs, 
                List<String> unconsumedArgs)

コマンドライン引数から IConfiguration を作成します。

想定される形式は「CONFIG [options]」です。ここで、CONFIG は組み込みの構成名または構成 XML ファイルへのファイルパスです。

パラメータ
arrayArgs String: コマンドライン引数

unconsumedArgs List: 指定された構成に関連付けられたオブジェクトによって使用されなかった引数が入力されるリスト。これが null の場合、未処理の引数が残っていると、実装は ConfigurationException をスローします。

戻り値
IConfiguration 読み込まれた IConfiguration。デリゲート オブジェクトの Option フィールドには、args の値が入力されています。

例外
ConfigurationException

createConfigurationFromArgs

public IConfiguration createConfigurationFromArgs (String[] arrayArgs)

null の第 2 引数を使用して createConfigurationFromArgs(String[],List) を呼び出すコンビニエンス メソッド。したがって、未消費の引数が残っている場合は ConfigurationException をスローします。

パラメータ
arrayArgs String

戻り値
IConfiguration

例外
ConfigurationException

createGlobalConfigurationFromArgs

public IGlobalConfiguration createGlobalConfigurationFromArgs (String[] arrayArgs, 
                List<String> remainingArgs)

コマンドライン引数から IGlobalConfiguration を作成します。

想定される形式は「CONFIG [options]」です。ここで、CONFIG は組み込みの構成名または構成 XML ファイルへのファイルパスです。

パラメータ
arrayArgs String: コマンドライン引数

remainingArgs List: グローバル引数として処理されなかった引数が入力されるリスト

戻り値
IGlobalConfiguration 読み込まれた IGlobalConfiguration。デリゲート オブジェクトの Option フィールドには、args の値が入力されています。

例外
ConfigurationException

createPartialConfigurationFromArgs

public IConfiguration createPartialConfigurationFromArgs (String[] arrayArgs, 
                IKeyStoreClient keyStoreClient, 
                Set<String> allowedObjects, 
                TradefedDelegator delegator)

選択したオブジェクトのセットのみを含む構成を作成します。

パラメータ
arrayArgs String: コマンドライン引数

keyStoreClient IKeyStoreClient: 引数で機密情報を取得するために使用される IKeyStoreClient

allowedObjects Set: 作成が許可されているオブジェクトのセット

delegator TradefedDelegator

戻り値
IConfiguration 読み込まれた IConfiguration

例外
ConfigurationException

dumpConfig

public void dumpConfig (String configName, 
                PrintStream out)

構成の内容を指定された PrintStream にダンプします

パラメータ
configName String: 構成名

out PrintStream: 出力をダンプする PrintStream

getConfigList

public List<String> getConfigList (String subPath, 
                boolean loadFromEnv)

環境から構成を読み込むかどうかも指定できる getConfigList() のバリエーション。

パラメータ
subPath String: 構成を探すサブディレクトリの名前。null の場合、getConfigList() と同じ動作になります。

loadFromEnv boolean: 環境変数で構成を読み込む必要がある場合は true。

戻り値
List<String>

getConfigList

public List<String> getConfigList ()

クラスパスの JAR にあるすべての構成の名前のリストを返します。構成の読み込みを試行しないため、このリストに機能しない構成が含まれている可能性があります。

戻り値
List<String>

getInstance

public static IConfigurationFactory getInstance ()

シングルトン IConfigurationFactory インスタンスを取得します。

戻り値
IConfigurationFactory

loadAllConfigs

public void loadAllConfigs (boolean discardExceptions)

クラスパスとテストケース ディレクトリにあるすべての構成を読み込みます。

パラメータ
discardExceptions boolean: ConfigurationException を無視する場合は true。

例外
com.android.tradefed.config.ConfigurationException
ConfigurationException

loadAndPrintAllConfigs

public void loadAndPrintAllConfigs ()

すべての構成を読み込んで解析し、すべてのオプション値を設定できることを確認するユーティリティ メソッド。依存プロジェクトが構成を検証できるように公開されています。コンソールに公開しないでください。

例外
ConfigurationException 1 つ以上の構成の読み込みに失敗した場合

printHelp

public void printHelp (PrintStream out)

この Factory のヘルプ出力を出力します。

一般的なヘルプ情報を出力し、使用可能なすべての構成を一覧表示します。

パラメータ
out PrintStream: 出力をダンプする PrintStream

printHelpForConfig

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

コマンドライン引数で指定された IConfiguration のヘルプ出力を出力します。

「args」が既知の構成を参照している場合、XML から IConfiguration オブジェクトが作成され、その IConfiguration のヘルプが出力されます。他のすべての「args」値は無視されます(つまり、ヘルプ テキストには、XML から読み込まれた Option の現在の値が記述され、コマンドライン引数で設定されたオプションの値は反映されません)。

「args」が既知の IConfiguration を参照していない場合は、一般的な printHelp(PrintStream) ヘルプが表示されます。

パラメータ
args String: コマンドライン引数

importantOnly boolean: true の場合、重要な詳細のみを記載した省略形のヘルプ一覧を出力します

out PrintStream: 出力をダンプする PrintStream

保護されたメソッド

getBundledConfigStream

protected InputStream getBundledConfigStream (String name)

パラメータ
name String

戻り値
InputStream

getConfigPrefix

protected String getConfigPrefix ()

クラスパス上の構成 XML ファイルのパス接頭辞を返します。

単体テストでモックできるように公開されています。

戻り値
String 末尾に / が付いている String パス

getConfigStream

protected BufferedInputStream getConfigStream (String name)

指定された構成名の InputStream を読み込みます

パラメータ
name String: ロードする構成の名前

戻り値
BufferedInputStream 構成コンテンツを読み取るための BufferedInputStream

例外
ConfigurationException 構成が見つからなかった場合

getConfigurationDef

protected ConfigurationDef getConfigurationDef (String name, 
                boolean isGlobal, 
                Map<String, String> templateMap)

指定された名前の ConfigurationDef を取得する

パラメータ
name String: ロードする組み込み構成の名前、またはロードする構成ファイルへのファイルパス

isGlobal boolean

templateMap Map

戻り値
ConfigurationDef ConfigurationDef

例外
ConfigurationException 構成の読み込み中にエラーが発生した場合

getMapConfig

protected Map<ConfigurationFactory.ConfigId, ConfigurationDef> getMapConfig ()

テスト用に公開されています。Map のコピーを返します。

戻り値
Map<ConfigurationFactory.ConfigId, ConfigurationDef>

isDirectConfiguration

protected boolean isDirectConfiguration (String configName)

パラメータ
configName String

戻り値
boolean

reorderArgs

protected String[] reorderArgs (String[] args)

template:map 引数がすべて先頭に移動するように、引数の順序を変更します。

パラメータ
args String

戻り値
String[]

resolveRemoteFile

protected IRemoteFileResolver.ResolvedFile resolveRemoteFile (URI configURI, 
                URI destDir)

パラメータ
configURI URI

destDir URI

戻り値
IRemoteFileResolver.ResolvedFile

例外
BuildRetrievalError