Google is committed to advancing racial equity for Black communities. See how.

DynamicRemoteFileResolver

public class DynamicRemoteFileResolver
extends Object

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


Class that helps resolving path to remote files.

For example: gs://bucket/path/file.txt will be resolved by downloading the file from the GCS bucket.

New protocols should be added to META_INF/services.

Summary

Nested classes

interface DynamicRemoteFileResolver.FileResolverLoader

Loads implementations of IRemoteFileResolver

Fields

public static final String OPTIONAL_KEY

public static final String UNZIP_KEY

Public constructors

DynamicRemoteFileResolver()
DynamicRemoteFileResolver(DynamicRemoteFileResolver.FileResolverLoader loader)

Public methods

void addExtraArgs( extraArgs)

Add extra args for the query.

void resolvePartialDownloadZip(File destDir, String remoteZipFilePath, includeFilters, excludeFilters)

Download the files matching given filters in a remote zip file.

void setDevice(ITestDevice device)

Sets the device under tests

void setOptionMap( optionMap)

Sets the map of options coming from OptionSetter

static final File unzipIfRequired(File downloadedFile, query)

Utility that allows to check whether or not a file should be unzip and unzip it if required.

final validateRemoteFilePath()

Runs through all the ERROR(/File) option type and check if their path should be resolved.

Fields

OPTIONAL_KEY

public static final String OPTIONAL_KEY

UNZIP_KEY

public static final String UNZIP_KEY

Public constructors

DynamicRemoteFileResolver

public DynamicRemoteFileResolver ()

DynamicRemoteFileResolver

public DynamicRemoteFileResolver (DynamicRemoteFileResolver.FileResolverLoader loader)

Parameters
loader DynamicRemoteFileResolver.FileResolverLoader

Public methods

addExtraArgs

public void addExtraArgs ( extraArgs)

Add extra args for the query.

Parameters
extraArgs

resolvePartialDownloadZip

public void resolvePartialDownloadZip (File destDir, 
                String remoteZipFilePath, 
                 includeFilters, 
                 excludeFilters)

Download the files matching given filters in a remote zip file.

A file inside the remote zip file is only downloaded if its path matches any of the include filters but not the exclude filters.

Parameters
destDir File: the file to place the downloaded contents into.

remoteZipFilePath String: the remote path to the zip file to download, relative to an implementation specific root.

includeFilters : a list of regex strings to download matching files. A file's path matching any filter will be downloaded.

excludeFilters : a list of regex strings to skip downloading matching files. A file's path matching any filter will not be downloaded.

Throws
BuildRetrievalError if files could not be downloaded.

setDevice

public void setDevice (ITestDevice device)

Sets the device under tests

Parameters
device ITestDevice

setOptionMap

public void setOptionMap ( optionMap)

Sets the map of options coming from OptionSetter

Parameters
optionMap

unzipIfRequired

public static final File unzipIfRequired (File downloadedFile, 
                 query)

Utility that allows to check whether or not a file should be unzip and unzip it if required.

Parameters
downloadedFile File

query

Returns
File

validateRemoteFilePath

public final  validateRemoteFilePath ()

Runs through all the ERROR(/File) option type and check if their path should be resolved.

Returns
The list of ERROR(/File) that was resolved that way.

Throws
BuildRetrievalError