GCSConfigurationServer

public class GCSConfigurationServer
extends Object implements IConfigurationServer

java.lang.Object
   ↳ com.android.tradefed.config.gcs.GCSConfigurationServer


Config server loads configs from Google Cloud Storage (GCS).

Summary

Public constructors

GCSConfigurationServer()

Public methods

InputStream getConfig(String name)

Get config content by its name.

String getCurrentHostConfig()

Get current host's config file name for the current Tradefed session.

Protected methods

File downloadFile(String name)
String getHostConfig(String hostname, String cluster)

Get tradefed global config for host.

boolean sameHost(String currentHostname, String hostname)

Check if two hostnames are for the same host.

Public constructors

GCSConfigurationServer

public GCSConfigurationServer ()

Public methods

getConfig

public InputStream getConfig (String name)

Get config content by its name.

Parameters
name String: config's name

Returns
InputStream an ERROR(/InputStream) is the config file content.

Throws
ConfigurationException

getCurrentHostConfig

public String getCurrentHostConfig ()

Get current host's config file name for the current Tradefed session. Instead of reading the host config file from local files, Tradefed start with an IConfigurationServer will get the host config from the server.

Returns
String a host config file name.

Throws
ConfigurationException

Protected methods

downloadFile

protected File downloadFile (String name)

Parameters
name String

Returns
File

Throws
ConfigurationException

getHostConfig

protected String getHostConfig (String hostname, 
                String cluster)

Get tradefed global config for host. Use cluster name if cluster name if provided, otherwise use hostname.

Parameters
hostname String: host name

cluster String: cluster name.

Returns
String path relative to gcs bucket.

Throws
com.android.tradefed.config.ConfigurationException
ConfigurationException

sameHost

protected boolean sameHost (String currentHostname, 
                String hostname)

Check if two hostnames are for the same host. In config files, we sometimes use short name for host.

Parameters
currentHostname String: current host's name

hostname String: the hostname in config.

Returns
boolean true if they are the same host, otherwise false;