GoogleApiClientUtilBase
public
class
GoogleApiClientUtilBase
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.util.gcs.GoogleApiClientUtilBase
|
Summary
Fields |
public
static
final
String |
APP_NAME
|
Public methods |
static
HttpRequestInitializer
|
configureRetryStrategy(HttpRequestInitializer initializer)
Setup a retry strategy for the provided HttpRequestInitializer.
|
static
HttpRequestInitializer
|
configureRetryStrategyAndTimeout(HttpRequestInitializer initializer, int connectTimeout, int readTimeout)
Setup a retry strategy for the provided HttpRequestInitializer.
|
static
Credentials
|
createCredential( scopes)
Try to create Google API credential with default credential.
|
static
Credentials
|
createCredentialFromJsonKeyFile(File file, scopes)
Create credential from json key file.
|
static
HttpRequestInitializer
|
setHttpTimeout(HttpRequestInitializer requestInitializer, int connectTimeout, int readTimeout)
|
Fields
APP_NAME
public static final String APP_NAME
Public constructors
GoogleApiClientUtilBase
public GoogleApiClientUtilBase ()
Public methods
public static HttpRequestInitializer configureRetryStrategy (HttpRequestInitializer initializer)
Setup a retry strategy for the provided HttpRequestInitializer. In case of server errors
requests will be automatically retried with an exponential backoff.
Parameters |
initializer |
HttpRequestInitializer : - an initializer which will setup a retry strategy. |
Returns |
HttpRequestInitializer |
an initializer that will retry failed requests automatically. |
public static HttpRequestInitializer configureRetryStrategyAndTimeout (HttpRequestInitializer initializer,
int connectTimeout,
int readTimeout)
Setup a retry strategy for the provided HttpRequestInitializer. In case of server errors
requests will be automatically retried with an exponential backoff.
Parameters |
initializer |
HttpRequestInitializer : - an initializer which will setup a retry strategy. |
connectTimeout |
int |
readTimeout |
int |
Returns |
HttpRequestInitializer |
an initializer that will retry failed requests automatically. |
createCredential
public static Credentials createCredential ( scopes)
Try to create Google API credential with default credential.
Only default credential is used.
Parameters |
scopes |
: scopes for the credential. |
Throws |
|
IOException |
|
GeneralSecurityException |
createCredentialFromJsonKeyFile
public static Credentials createCredentialFromJsonKeyFile (File file,
scopes)
Create credential from json key file.
Parameters |
file |
File : is the p12 key file |
scopes |
: is the API's scope. |
Throws |
|
FileNotFoundException |
|
IOException |
|
GeneralSecurityException |
setHttpTimeout
public static HttpRequestInitializer setHttpTimeout (HttpRequestInitializer requestInitializer,
int connectTimeout,
int readTimeout)
Parameters |
requestInitializer |
HttpRequestInitializer : a HttpRequestInitializer , normally it's Credential . |
connectTimeout |
int : connect timeout in milliseconds. |
readTimeout |
int : read timeout in milliseconds. |
Protected methods
doCreateCredentialFromJsonKeyFile
protected Credentials doCreateCredentialFromJsonKeyFile (File file,
scopes)
Parameters |
file |
File |
scopes |
|
doCreateDefaultCredential
protected Credentials doCreateDefaultCredential ( scopes)