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, unconsumedArgs)

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

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

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

IConfiguration createConfigurationFromArgs(String[] arrayArgs)

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

IGlobalConfiguration createGlobalConfigurationFromArgs(String[] arrayArgs, remainingArgs)

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

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

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

void dumpConfig(String configName, PrintStream out)

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

getConfigList(String subPath, boolean loadFromEnv)

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

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」が既知の構成を参照している場合、IConfiguration オブジェクトが XML から作成され、その IConfiguration のヘルプが出力されます。

保護されたメソッド

InputStream getBundledConfigStream(String name)
String getConfigPrefix()

クラスパス上の config xml ファイルのパスパラフィックスを返します

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

BufferedInputStream getConfigStream(String name)

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

ConfigurationDef getConfigurationDef(String name, boolean isGlobal, templateMap)

指定された名前の 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, 
                 unconsumedArgs)

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

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

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

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

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

例外
ConfigurationException

createConfigurationFromArgs

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

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

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

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

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

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

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

例外
ConfigurationException

createConfigurationFromArgs

public IConfiguration createConfigurationFromArgs (String[] arrayArgs)

2 番目の引数として null を指定して ERROR(/#createConfigurationFromArgs(String[],List)) を呼び出すコンビニエンス メソッド。したがって、消費されていない引数が残っている場合は ConfigurationException がスローされます。

パラメータ
arrayArgs String

戻り値
IConfiguration

例外
ConfigurationException

createGlobalConfigurationFromArgs

public IGlobalConfiguration createGlobalConfigurationFromArgs (String[] arrayArgs, 
                 remainingArgs)

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

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

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

remainingArgs : グローバル引数として処理されなかった引数を格納するリスト

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

例外
ConfigurationException

createPartialConfigurationFromArgs

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

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

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

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

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

delegator TradefedDelegator

戻り値
IConfiguration 読み込まれた IConfiguration

例外
ConfigurationException

dumpConfig

public void dumpConfig (String configName, 
                PrintStream out)

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

パラメータ
configName String: 構成名

out PrintStream: 出力をダンプする ERROR(/PrintStream)

getConfigList

public  getConfigList (String subPath, 
                boolean loadFromEnv)

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

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

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

戻り値

getConfigList

public  getConfigList ()

クラスパスの JAR で見つかったすべての構成の名前のリストを返します。構成の読み込みは試行されません。そのため、このリストに動作しない構成が含まれている可能性があります。

戻り値

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)

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

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

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

printHelpForConfig

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

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

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

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

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

importantOnly boolean: true の場合、重要な詳細のみを記載した簡潔なヘルプを出力します。

out PrintStream: 出力をダンプする ERROR(/PrintStream)

保護されたメソッド

getBundledConfigStream

protected InputStream getBundledConfigStream (String name)

パラメータ
name String

戻り値
InputStream

getConfigPrefix

protected String getConfigPrefix ()

クラスパス上の config xml ファイルのパスパラフィックスを返します

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

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

getConfigStream

protected BufferedInputStream getConfigStream (String name)

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

パラメータ
name String: 読み込む構成名

戻り値
BufferedInputStream 構成内容の読み取り用の ERROR(/BufferedInputStream)

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

getConfigurationDef

protected ConfigurationDef getConfigurationDef (String name, 
                boolean isGlobal, 
                 templateMap)

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

パラメータ
name String: 読み込む組み込み構成の名前、または読み込む構成ファイルのファイルパス

isGlobal boolean

templateMap

戻り値
ConfigurationDef ConfigurationDef

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

getMapConfig

protected  getMapConfig ()

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

戻り値

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