public abstract class HttpDataAdapterBase<T,A extends Decoder<T>> extends SimpleCachingDataAdapter<T,A>
DataAdapter instances that communicate with sources via the HTTP protocol.| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
BASE_ADDRESS_PARAM_NAME |
DEFAULT_CACHE_SIZEclosed| Constructor and Description |
|---|
HttpDataAdapterBase()
Creates a new instance of the
HttpDataAdapterBase class. |
HttpDataAdapterBase(java.net.URL baseAddress)
Creates a new instance of the
HttpDataAdapterBase class for the specified base address. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected abstract java.net.URI |
craftFetchUri(java.lang.String path,
java.time.Instant begin,
java.time.Instant end) |
protected java.net.URI |
craftRequestUri(java.lang.String path,
java.util.List<org.apache.http.NameValuePair> params) |
protected java.net.URI |
craftRequestUri(java.lang.String path,
org.apache.http.NameValuePair... params) |
protected static javax.net.ssl.SSLContext |
createSslCustomContext() |
protected <R> R |
doHttpGet(java.net.URI requestUri,
org.apache.http.client.ResponseHandler<R> responseHandler) |
java.net.URL |
getBaseAddress()
Returns the source's base address
|
java.util.Map<java.lang.String,java.lang.String> |
getParams()
Returns a map of all parameters required to establish a connection to the underlying data source
|
protected org.apache.http.impl.client.CloseableHttpClient |
httpClientFactory() |
void |
loadParams(java.util.Map<java.lang.String,java.lang.String> params)
Sets the parameters required to establish a connection to the underlying data source
|
byte[] |
onCacheMiss(java.lang.String path,
java.time.Instant begin,
java.time.Instant end)
Gets raw data from the source as an output stream, for the time interval specified.
|
void |
setBaseAddress(java.net.URL baseAddress)
Sets the source's base address
|
fetchRawDatafetchDecodedData, getBindingTree, getDecoder, getEncoding, getId, getSourceName, getTimeZoneId, isClosed, onStart, ping, setId, toString, validateParameter, validateParameterNullityprotected static final java.lang.String BASE_ADDRESS_PARAM_NAME
public HttpDataAdapterBase()
throws CannotInitializeDataAdapterException
HttpDataAdapterBase class.CannotInitializeDataAdapterException - if the DataAdapter cannot be initialized.public HttpDataAdapterBase(java.net.URL baseAddress)
throws CannotInitializeDataAdapterException
HttpDataAdapterBase class for the specified base address.baseAddress - the source's base addressCannotInitializeDataAdapterException - if the DataAdapter cannot be initialized.public byte[] onCacheMiss(java.lang.String path,
java.time.Instant begin,
java.time.Instant end)
throws DataAdapterException
SimpleCachingDataAdapteronCacheMiss in class SimpleCachingDataAdapter<T,A extends Decoder<T>>path - the path of the data in the sourcebegin - the start of the time interval.end - the end of the time interval.DataAdapterException - if an error occurs while retrieving data from the source.public java.util.Map<java.lang.String,java.lang.String> getParams()
DataAdapterpublic void loadParams(java.util.Map<java.lang.String,java.lang.String> params)
throws DataAdapterException
DataAdapterloadParams in class DataAdapter<T,A extends Decoder<T>>params - the parameters required to establish a connection to the underlying data sourceDataAdapterExceptionpublic void close()
protected <R> R doHttpGet(java.net.URI requestUri,
org.apache.http.client.ResponseHandler<R> responseHandler)
throws DataAdapterException
DataAdapterExceptionprotected static javax.net.ssl.SSLContext createSslCustomContext()
throws java.security.KeyStoreException,
java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.cert.CertificateException,
java.security.KeyManagementException,
java.security.UnrecoverableKeyException,
java.security.NoSuchProviderException
java.security.KeyStoreExceptionjava.io.IOExceptionjava.security.NoSuchAlgorithmExceptionjava.security.cert.CertificateExceptionjava.security.KeyManagementExceptionjava.security.UnrecoverableKeyExceptionjava.security.NoSuchProviderExceptionprotected org.apache.http.impl.client.CloseableHttpClient httpClientFactory()
throws CannotInitializeDataAdapterException
protected java.net.URI craftRequestUri(java.lang.String path,
java.util.List<org.apache.http.NameValuePair> params)
throws SourceCommunicationException
SourceCommunicationExceptionprotected java.net.URI craftRequestUri(java.lang.String path,
org.apache.http.NameValuePair... params)
throws SourceCommunicationException
SourceCommunicationExceptionprotected abstract java.net.URI craftFetchUri(java.lang.String path,
java.time.Instant begin,
java.time.Instant end)
throws DataAdapterException
DataAdapterExceptionpublic java.net.URL getBaseAddress()
public void setBaseAddress(java.net.URL baseAddress)
baseAddress - the source's base addressCopyright © 2018 Frederic Thevenet. All rights reserved.