Class SingleEndpointGoodDataRestProvider
- java.lang.Object
-
- com.gooddata.sdk.service.httpcomponents.SingleEndpointGoodDataRestProvider
-
- All Implemented Interfaces:
GoodDataRestProvider
- Direct Known Subclasses:
LoginPasswordGoodDataRestProvider,SstGoodDataRestProvider
public abstract class SingleEndpointGoodDataRestProvider extends java.lang.Object implements GoodDataRestProvider
GoodDataRestProvidercapable to be used with single API endpoint using the ApacheHttpClientto perform HTTP operations. It provides following functionality:- Prepends the URI path with API endpoint (using
UriPrefixingClientHttpRequestFactory - Configures
ResponseErrorHandler - Configures connection according to
GoodDataSettings - Set default headers from
GoodDataSettingsincluding User-Agent - Configures retries in case it's requested
GoodDataHttpClientBuilderto the constructor. Namely the authentication logic remains to be provided by descendants.
-
-
Field Summary
Fields Modifier and Type Field Description protected GoodDataEndpointendpointprotected org.apache.http.client.HttpClienthttpClientprotected org.springframework.web.client.RestTemplaterestTemplateprotected GoodDataSettingssettings
-
Constructor Summary
Constructors Modifier Constructor Description protectedSingleEndpointGoodDataRestProvider(GoodDataEndpoint endpoint, GoodDataSettings settings, GoodDataHttpClientBuilder builder)Creates new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.http.impl.client.HttpClientBuildercreateHttpClientBuilder(GoodDataSettings settings)Creates http client builder, applying given settings.protected org.springframework.web.client.RestTemplatecreateRestTemplate(GoodDataEndpoint endpoint, GoodDataSettings settings, org.apache.http.client.HttpClient httpClient)Creates configured REST templatejava.util.Optional<DataStoreService>getDataStoreService(java.util.function.Supplier<java.lang.String> stagingUriSupplier)Configured DataStoreService if provided.GoodDataEndpointgetEndpoint()org.apache.http.client.HttpClientgetHttpClient()org.springframework.web.client.RestTemplategetRestTemplate()Configured RestTemplate instance.GoodDataSettingsgetSettings()Settings used by the provider.
-
-
-
Field Detail
-
endpoint
protected final GoodDataEndpoint endpoint
-
settings
protected final GoodDataSettings settings
-
httpClient
protected org.apache.http.client.HttpClient httpClient
-
restTemplate
protected org.springframework.web.client.RestTemplate restTemplate
-
-
Constructor Detail
-
SingleEndpointGoodDataRestProvider
protected SingleEndpointGoodDataRestProvider(GoodDataEndpoint endpoint, GoodDataSettings settings, GoodDataHttpClientBuilder builder)
Creates new instance.- Parameters:
endpoint- API endpointsettings- settingsbuilder- custom GoodData http client builder
-
-
Method Detail
-
getRestTemplate
public org.springframework.web.client.RestTemplate getRestTemplate()
Description copied from interface:GoodDataRestProviderConfigured RestTemplate instance.- Specified by:
getRestTemplatein interfaceGoodDataRestProvider- Returns:
- provided RestTemplate
-
getSettings
public GoodDataSettings getSettings()
Description copied from interface:GoodDataRestProviderSettings used by the provider.- Specified by:
getSettingsin interfaceGoodDataRestProvider- Returns:
- used settings
-
getDataStoreService
public java.util.Optional<DataStoreService> getDataStoreService(java.util.function.Supplier<java.lang.String> stagingUriSupplier)
Description copied from interface:GoodDataRestProviderConfigured DataStoreService if provided. By default empty.- Specified by:
getDataStoreServicein interfaceGoodDataRestProvider- Parameters:
stagingUriSupplier- supplier of the data store endpoint- Returns:
- dataStoreService (empty by default)
-
getEndpoint
public GoodDataEndpoint getEndpoint()
- Returns:
- used API endpoint
-
getHttpClient
public org.apache.http.client.HttpClient getHttpClient()
- Returns:
- configured http client
-
createRestTemplate
protected org.springframework.web.client.RestTemplate createRestTemplate(GoodDataEndpoint endpoint, GoodDataSettings settings, org.apache.http.client.HttpClient httpClient)
Creates configured REST template- Parameters:
endpoint- API endpointsettings- settingshttpClient- http client to build RestTemplate on- Returns:
- configured REST template
-
createHttpClientBuilder
protected org.apache.http.impl.client.HttpClientBuilder createHttpClientBuilder(GoodDataSettings settings)
Creates http client builder, applying given settings.- Parameters:
settings- settings to apply- Returns:
- configured builder
-
-