public class AbstractClient
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected io.vertx.core.http.HttpClient | client HTTP client used to connect to GeoRocket |
Constructor and Description |
---|
AbstractClient(io.vertx.core.http.HttpClient client) Construct a new client using the given HTTP client |
Modifier and Type | Method and Description |
---|---|
protected io.vertx.core.http.HttpClientRequest | configureRequest(io.vertx.core.http.HttpClientRequest request) Configure an HTTP request. |
protected static <T> void | fail(io.vertx.core.http.HttpClientResponse response, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler) Parses an HTTP response and calls the given handler with the parsed error message |
protected static <T> void | fail(io.vertx.core.http.HttpClientResponse response, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler, java.util.function.Function<java.lang.String,java.lang.Throwable> map) Parses an HTTP response, maps it to an exception and then calls the given handler |
protected void | getWithParameter(java.lang.String endpoint, java.lang.String parameterName, java.lang.String parameterValue, java.lang.String query, java.lang.String layer, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>>> handler) Execute a get request with specified path, query and additional parameter |
protected java.lang.String | prepareQuery(java.lang.String query, java.lang.String layer) Prepare a query. |
protected java.lang.String | prepareQuery(java.lang.String query, java.lang.String layer, boolean optimisticMerging) Prepare a query. |
protected void | update(io.vertx.core.http.HttpMethod method, java.lang.String fieldEndpoint, java.lang.String fieldName, java.lang.String query, java.lang.String layer, java.util.List<java.lang.String> updates, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> handler) Update a field in the chunk metadata (such as properties or tags). |
protected java.lang.String | urlencode(java.lang.String str) Convenience method to URL-encode a string |
protected final io.vertx.core.http.HttpClient client
public AbstractClient(io.vertx.core.http.HttpClient client)
client
- the HTTP clientprotected void getWithParameter(java.lang.String endpoint, java.lang.String parameterName, java.lang.String parameterValue, java.lang.String query, java.lang.String layer, io.vertx.core.Handler<io.vertx.core.AsyncResult<io.vertx.core.streams.ReadStream<io.vertx.core.buffer.Buffer>>> handler)
endpoint
- the endpointparameterName
- the name of the query parameterparameterValue
- the value of the query parameterquery
- a search query specifying which chunks to return (may be null
)layer
- the name of the layer where to search for chunks recursively (may be null
)handler
- a handler that will receive the ReadStream
from which the results matching the given criteria can be readprotected void update(io.vertx.core.http.HttpMethod method, java.lang.String fieldEndpoint, java.lang.String fieldName, java.lang.String query, java.lang.String layer, java.util.List<java.lang.String> updates, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>> handler)
Update a field in the chunk metadata (such as properties or tags).
The chunks are either specified by a query
or layer
information or both. If none is given, all chunks in the data store will be updated.
method
- the http method to use for the updatefieldEndpoint
- the path of the endpoint which should be usedfieldName
- the name of the field to updatequery
- a search query specifying the chunks, whose fields should be updated (or null
if the fields of all chunks in all sub-layers from the given layer
should be updated)layer
- the absolute path to the layer from which to update fields (or null
if the entire store should be queried to find the chunks, whose fields should be updated)updates
- a collection of values to updatehandler
- a handler that will be called when the operation has finishedprotected java.lang.String prepareQuery(java.lang.String query, java.lang.String layer)
query
- the search query (may be null
)layer
- the layer to export (may be null
)protected java.lang.String prepareQuery(java.lang.String query, java.lang.String layer, boolean optimisticMerging)
query
- the search query (may be null
)layer
- the layer to export (may be null
)optimisticMerging
- true
if optimistic merging should be enabledprotected java.lang.String urlencode(java.lang.String str)
str
- the stringprotected io.vertx.core.http.HttpClientRequest configureRequest(io.vertx.core.http.HttpClientRequest request)
request
- request the request to configureHttpClientRequest
as given but with options setprotected static <T> void fail(io.vertx.core.http.HttpClientResponse response, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler)
T
- the type of the handler's resultresponse
- the HTTP responsehandler
- the handler to callprotected static <T> void fail(io.vertx.core.http.HttpClientResponse response, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> handler, java.util.function.Function<java.lang.String,java.lang.Throwable> map)
T
- the type of the handler's resultresponse
- the HTTP responsehandler
- the handler to callmap
- a function that maps the parsed error message to an exception