public abstract class AbstractQueryExecutor<QueryT extends Query<QueryT,QueryResultT>,QueryResultT extends QueryResult<QueryT,QueryResultT>> extends Object implements QueryExecutor<QueryT,QueryResultT>
QueryExecutor
implementations.Modifier and Type | Field and Description |
---|---|
protected static Duration |
DEFAULT_LONG_RUNNING_REQUEST_THRESHOLD |
protected static int |
MAX_UNCOMPRESSED_PAYLOAD_LENGTH |
Constructor and Description |
---|
AbstractQueryExecutor() |
Modifier and Type | Method and Description |
---|---|
protected URI |
appendQueryParam(URI uri,
String queryParamKey,
String queryParamValue) |
protected QueryResultT |
deserializeQuery(ErpConfigContext configContext,
QueryT query,
QuerySerializer<QueryT,QueryResultT> querySerializer,
String responseBody) |
protected QueryResultT |
executeQuery(ErpConfigContext configContext,
QueryT query,
QuerySerializer<QueryT,QueryResultT> querySerializer) |
protected String |
executeRequest(ErpConfigContext configContext,
SerializedQuery<QueryT> serializedQuery) |
protected org.apache.http.entity.ByteArrayEntity |
getBodyAsCompressedEntity(String body) |
QueryExecutionMeasurements |
getMeasurements() |
protected String |
getNonSensitiveHeadersAsString(List<Header> headers)
Converts the given headers to a String while omitting sensitive headers to avoid leaking them to logs.
|
protected String |
getQueryExecutionFailedMessage(QueryT query) |
protected String |
getRequestBody(ErpConfigContext configContext,
Destination destination,
SerializedQuery<QueryT> serializedQuery) |
protected List<Header> |
getRequestHeaders(ErpConfigContext configContext,
Destination destination,
SerializedQuery<QueryT> serializedQuery) |
protected RequestMethod |
getRequestMethod(ErpConfigContext configContext,
Destination destination,
SerializedQuery<QueryT> serializedQuery) |
protected URI |
getRequestUri(ErpConfigContext configContext,
Destination destination,
SerializedQuery<QueryT> serializedQuery) |
protected void |
handleBadGateway(String responseBody,
List<Header> responseHeaders) |
protected void |
handleForbidden(String responseBody,
List<Header> responseHeaders) |
protected void |
handleHttpError(ErpConfigContext configContext,
int statusCode,
String responseBody,
List<Header> responseHeaders) |
protected void |
handleHttpStatus(ErpConfigContext configContext,
int statusCode,
String responseBody,
List<Header> responseHeaders) |
protected void |
handleInternalServerError(String responseBody,
List<Header> responseHeaders) |
protected void |
handleServiceUnavailableError(ErpConfigContext configContext,
String responseBody,
List<Header> responseHeaders) |
protected void |
handleUnauthorized(String responseBody,
List<Header> responseHeaders) |
protected void |
logReadAccessAttempt(QueryT query) |
protected org.apache.http.client.methods.HttpUriRequest |
newRequest(ErpConfigContext configContext,
RequestMethod requestMethod,
URI requestUri,
List<Header> requestHeaders,
String requestBody) |
protected void |
recordExecutionDuration(SerializedQuery<QueryT> serializedQuery,
org.apache.http.RequestLine requestLine,
org.apache.http.StatusLine statusLine,
List<Header> responseHeaders,
String responseBody) |
protected SerializedQuery<QueryT> |
serializeQuery(ErpConfigContext configContext,
QueryT query,
QuerySerializer<QueryT,QueryResultT> querySerializer) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
execute
protected static final int MAX_UNCOMPRESSED_PAYLOAD_LENGTH
protected static final Duration DEFAULT_LONG_RUNNING_REQUEST_THRESHOLD
protected org.apache.http.entity.ByteArrayEntity getBodyAsCompressedEntity(String body) throws QuerySerializationException
QuerySerializationException
protected URI appendQueryParam(URI uri, String queryParamKey, String queryParamValue) throws QuerySerializationException
QuerySerializationException
protected void handleHttpStatus(ErpConfigContext configContext, int statusCode, String responseBody, List<Header> responseHeaders) throws QueryExecutionException
QueryExecutionException
protected void handleHttpError(ErpConfigContext configContext, int statusCode, String responseBody, List<Header> responseHeaders) throws QueryExecutionException
QueryExecutionException
protected void handleUnauthorized(String responseBody, List<Header> responseHeaders) throws LogonErrorException
LogonErrorException
protected void handleForbidden(String responseBody, List<Header> responseHeaders) throws AccessDeniedException
AccessDeniedException
protected void handleInternalServerError(String responseBody, List<Header> responseHeaders) throws QueryExecutionException
QueryExecutionException
protected void handleServiceUnavailableError(ErpConfigContext configContext, String responseBody, List<Header> responseHeaders) throws QueryExecutionException
QueryExecutionException
protected void handleBadGateway(String responseBody, List<Header> responseHeaders) throws QueryExecutionException
QueryExecutionException
protected String getNonSensitiveHeadersAsString(List<Header> headers)
@NonNull protected QueryResultT executeQuery(ErpConfigContext configContext, QueryT query, QuerySerializer<QueryT,QueryResultT> querySerializer) throws QuerySerializationException, QueryExecutionException, DestinationNotFoundException, DestinationAccessException
@Nonnull protected SerializedQuery<QueryT> serializeQuery(ErpConfigContext configContext, QueryT query, QuerySerializer<QueryT,QueryResultT> querySerializer) throws QuerySerializationException, QueryExecutionException, DestinationNotFoundException, DestinationAccessException
@Nonnull protected QueryResultT deserializeQuery(ErpConfigContext configContext, QueryT query, QuerySerializer<QueryT,QueryResultT> querySerializer, String responseBody) throws QuerySerializationException, QueryExecutionException, DestinationNotFoundException, DestinationAccessException
@Nonnull protected RequestMethod getRequestMethod(ErpConfigContext configContext, Destination destination, SerializedQuery<QueryT> serializedQuery)
@Nonnull protected URI getRequestUri(ErpConfigContext configContext, Destination destination, SerializedQuery<QueryT> serializedQuery)
@Nonnull protected List<Header> getRequestHeaders(ErpConfigContext configContext, Destination destination, SerializedQuery<QueryT> serializedQuery)
@Nonnull protected String getRequestBody(ErpConfigContext configContext, Destination destination, SerializedQuery<QueryT> serializedQuery)
protected org.apache.http.client.methods.HttpUriRequest newRequest(ErpConfigContext configContext, RequestMethod requestMethod, URI requestUri, List<Header> requestHeaders, String requestBody) throws QuerySerializationException
QuerySerializationException
protected void logReadAccessAttempt(QueryT query)
protected void recordExecutionDuration(SerializedQuery<QueryT> serializedQuery, org.apache.http.RequestLine requestLine, org.apache.http.StatusLine statusLine, List<Header> responseHeaders, String responseBody)
protected String executeRequest(ErpConfigContext configContext, SerializedQuery<QueryT> serializedQuery) throws QuerySerializationException, QueryExecutionException, DestinationNotFoundException, DestinationAccessException
public QueryExecutionMeasurements getMeasurements()
Copyright © 2018 SAP SE. All rights reserved.