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
GoodDataRestProvider
capable to be used with single API endpoint using the ApacheHttpClient
to 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
GoodDataSettings
including User-Agent - Configures retries in case it's requested
GoodDataHttpClientBuilder
to the constructor. Namely the authentication logic remains to be provided by descendants.
-
-
Field Summary
Fields Modifier and Type Field Description protected GoodDataEndpoint
endpoint
protected org.apache.http.client.HttpClient
httpClient
protected org.springframework.web.client.RestTemplate
restTemplate
protected GoodDataSettings
settings
-
Constructor Summary
Constructors Modifier Constructor Description protected
SingleEndpointGoodDataRestProvider(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.HttpClientBuilder
createHttpClientBuilder(GoodDataSettings settings)
Creates http client builder, applying given settings.protected org.springframework.web.client.RestTemplate
createRestTemplate(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.GoodDataEndpoint
getEndpoint()
org.apache.http.client.HttpClient
getHttpClient()
org.springframework.web.client.RestTemplate
getRestTemplate()
Configured RestTemplate instance.GoodDataSettings
getSettings()
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:GoodDataRestProvider
Configured RestTemplate instance.- Specified by:
getRestTemplate
in interfaceGoodDataRestProvider
- Returns:
- provided RestTemplate
-
getSettings
public GoodDataSettings getSettings()
Description copied from interface:GoodDataRestProvider
Settings used by the provider.- Specified by:
getSettings
in interfaceGoodDataRestProvider
- Returns:
- used settings
-
getDataStoreService
public java.util.Optional<DataStoreService> getDataStoreService(java.util.function.Supplier<java.lang.String> stagingUriSupplier)
Description copied from interface:GoodDataRestProvider
Configured DataStoreService if provided. By default empty.- Specified by:
getDataStoreService
in 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
-
-