public abstract class GoogleApiProxyFactory extends Object
| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.eventbus.EventBus |
eventBus |
| Modifier | Constructor and Description |
|---|---|
protected |
GoogleApiProxyFactory(Map<String,String> credential,
com.google.common.eventbus.EventBus eventBus,
org.ctoolkit.restapi.client.provider.AuthKeyProvider keyProvider)
Create factory instance.
|
| Modifier and Type | Method and Description |
|---|---|
org.ctoolkit.restapi.client.ApiToken<? extends com.google.api.client.http.HttpRequestInitializer> |
authorize(Collection<String> scopes,
String userAccount,
String prefix)
Creates the thread-safe Google-specific implementation of the OAuth 2.0.
|
protected void |
configureHttpRequest(com.google.api.client.http.HttpRequest request,
int numberOfRetries,
int readTimeout)
Configure HTTP request right before execution.
|
String |
getApiKey(String prefix)
Returns value set by
ApiCredential.setApiKey(String)
or defined by property file. |
String |
getApplicationName(String prefix)
Returns value set by
ApiCredential.setApplicationName(String)
or defined by property file. |
String |
getClientId(String prefix)
Returns value set by
ApiCredential.setClientId(String)
or defined by property file. |
String |
getEndpointUrl(String prefix)
Returns value set by
ApiCredential.setEndpointUrl(String)
or defined by property file. |
String |
getFileName(String prefix)
Returns value set by
ApiCredential.setFileName(String)
or defined by property file. |
String |
getFileNameJsonStream(String prefix)
Returns value set by
ApiCredential.setFileNameJsonStream(String)
or defined by property file. |
com.google.api.client.http.HttpTransport |
getHttpTransport()
Returns singleton instance of the HTTP transport.
|
com.google.api.client.json.JsonFactory |
getJsonFactory()
Returns singleton instance of the JSON factory.
|
int |
getNumberOfRetries(String prefix)
Returns value set by
ApiCredential.setNumberOfRetries(int)
or defined by property file. |
String |
getProjectId(String prefix)
Returns value set by
ApiCredential.setProjectId(String)
or defined by property file. |
int |
getReadTimeout(String prefix)
Returns value set by
ApiCredential.setRequestReadTimeout(int)
or defined by property file. |
String |
getServiceAccountEmail(String prefix)
Returns value set by
ApiCredential.setServiceAccountEmail(String)
or defined by property file. |
InputStream |
getServiceAccountJsonStream(String prefix)
Returns the Google APIs service account key as JSON.
|
URL |
getServiceAccountPrivateKeyP12Resource(String prefix) |
InputStream |
getServiceAccountPrivateKeyP12Stream(String prefix) |
boolean |
isCredentialOn(String prefix)
Returns value set by
ApiCredential.setCredentialOn(boolean)
or defined by property file. |
boolean |
isDisableGZipContent(String prefix)
Returns value set by
ApiCredential.setDisableGZipContent(boolean) (boolean)}
or defined by property file. |
boolean |
isJsonConfiguration(String prefix) |
com.google.api.client.http.HttpRequestInitializer |
newRequestConfig(String prefix,
com.google.api.client.http.HttpResponseInterceptor interceptor) |
public final com.google.api.client.http.HttpTransport getHttpTransport()
throws GeneralSecurityException,
IOException
GeneralSecurityExceptionIOExceptionpublic final com.google.api.client.json.JsonFactory getJsonFactory()
public String getProjectId(@Nullable String prefix)
ApiCredential.setProjectId(String)
or defined by property file.
If specific credential wouldn't not be found, default will be returned.prefix - the prefix used to identify specific credential or null for defaultMissingResourceException - if default credential was requested and haven't been foundpublic String getClientId(@Nullable String prefix)
ApiCredential.setClientId(String)
or defined by property file.
If specific credential wouldn't not be found, default will be returned.prefix - the prefix used to identify specific credential or null for defaultMissingResourceException - if default credential was requested and haven't been foundpublic final boolean isDisableGZipContent(@Nullable String prefix)
ApiCredential.setDisableGZipContent(boolean) (boolean)}
or defined by property file.
If specific credential wouldn't not be found, default will be returned.prefix - the prefix used to identify specific credential or null for defaultpublic final String getServiceAccountEmail(@Nullable String prefix)
ApiCredential.setServiceAccountEmail(String)
or defined by property file.
If specific credential wouldn't not be found, default will be returned.prefix - the prefix used to identify specific credential or null for defaultMissingResourceException - if default credential was requested and haven't been foundpublic final String getApplicationName(@Nullable String prefix)
ApiCredential.setApplicationName(String)
or defined by property file.
If specific credential wouldn't not be found, default will be returned.prefix - the prefix used to identify specific credential or null for defaultMissingResourceException - if default credential was requested and haven't been foundpublic final String getFileName(@Nullable String prefix)
ApiCredential.setFileName(String)
or defined by property file.
If specific credential wouldn't not be found, default will be returned.prefix - the prefix used to identify specific credential or null for defaultMissingResourceException - if default credential was requested and haven't been foundpublic final String getFileNameJsonStream(@Nullable String prefix)
ApiCredential.setFileNameJsonStream(String)
or defined by property file.
If specific credential wouldn't not be found, default will be returned.prefix - the prefix used to identify specific credential or null for defaultMissingResourceException - if default credential was requested and haven't been foundpublic final String getApiKey(@Nullable String prefix)
ApiCredential.setApiKey(String)
or defined by property file.
If specific credential wouldn't not be found, default will be returned.prefix - the prefix used to identify specific credential or null for defaultMissingResourceException - if default credential was requested and haven't been foundpublic final String getEndpointUrl(@Nullable String prefix)
ApiCredential.setEndpointUrl(String)
or defined by property file.
If specific credential wouldn't not be found, default will be returned.prefix - the prefix used to identify specific credential or null for defaultMissingResourceException - if default credential was requested and haven't been foundpublic int getNumberOfRetries(@Nullable String prefix)
ApiCredential.setNumberOfRetries(int)
or defined by property file.
If specific credential wouldn't not be found, default will be returned.prefix - the prefix used to identify specific credential or null for defaultpublic int getReadTimeout(@Nullable String prefix)
ApiCredential.setRequestReadTimeout(int)
or defined by property file.
If specific credential wouldn't not be found, default will be returned 20000 (20 seconds).prefix - the prefix used to identify specific credential or null for defaultpublic final boolean isCredentialOn(@Nullable String prefix)
ApiCredential.setCredentialOn(boolean)
or defined by property file.
If specific credential wouldn't not be found, default will be returned.prefix - the prefix used to identify specific credential or null for defaultpublic org.ctoolkit.restapi.client.ApiToken<? extends com.google.api.client.http.HttpRequestInitializer> authorize(Collection<String> scopes, String userAccount, String prefix) throws GeneralSecurityException, IOException
scopes - the space-separated OAuth scopes to use with the service account flow
or null for none.userAccount - the email address. If you want to impersonate a user account, specify the email address.
Useful for domain-wide delegation.GeneralSecurityException, - IOExceptionGeneralSecurityExceptionIOExceptionpublic boolean isJsonConfiguration(String prefix)
public URL getServiceAccountPrivateKeyP12Resource(String prefix)
public InputStream getServiceAccountJsonStream(String prefix)
prefix - the prefix used to identify specific credentialpublic InputStream getServiceAccountPrivateKeyP12Stream(String prefix)
public com.google.api.client.http.HttpRequestInitializer newRequestConfig(@Nullable String prefix, @Nullable com.google.api.client.http.HttpResponseInterceptor interceptor)
protected final void configureHttpRequest(@Nonnull com.google.api.client.http.HttpRequest request, int numberOfRetries, int readTimeout)
request - the HTTP requestnumberOfRetries - the number of configured retriesreadTimeout - the request read timeout in millisecondsCopyright © 2017 Comvai - TurnOnline.biz. All rights reserved.