public class ClientHelper extends Object
Constructor and Description |
---|
ClientHelper(RiakConfig config,
String clientId) |
Modifier and Type | Method and Description |
---|---|
HttpResponse |
delete(String bucket,
String key,
RequestMeta meta)
Same as
RiakClient , except only returning the HTTP response |
HttpResponse |
fetch(String bucket,
String key,
RequestMeta meta) |
HttpResponse |
fetch(String bucket,
String key,
RequestMeta meta,
boolean streamResponse)
Same as
RiakClient , except only returning the HTTP response and
allows the response to be streamed. |
HttpResponse |
fetchCounter(String bucket,
String counter,
RequestMeta meta) |
HttpResponse |
fetchIndex(IndexRequest request) |
HttpResponse |
fetchIndex(String bucket,
String indexName,
long[] values)
Perform the fetch/query on an index
|
HttpResponse |
fetchIndex(String bucket,
String indexName,
String[] values)
Perform the fetch/query on an index
|
HttpResponse |
fetchMeta(String bucket,
String key,
RequestMeta meta)
Same as
RiakClient , except only returning the HTTP response |
HttpResponse |
getBucketSchema(String bucket,
RequestMeta meta)
Same as
RiakClient.getBucketSchema(String, RequestMeta) , except
only returning the HTTP response. |
byte[] |
getClientId()
|
RiakConfig |
getConfig() |
RiakExceptionHandler |
getExceptionHandler() |
org.apache.http.client.HttpClient |
getHttpClient()
Return the
HttpClient used to make requests, which can be
configured. |
HttpResponse |
incrementCounter(String bucket,
String counter,
long increment,
RequestMeta meta) |
HttpResponse |
listBucket(String bucket,
RequestMeta meta,
boolean streamResponse)
Same as
RiakClient , except only returning the HTTP response, and
if streamResponse==true, the response will be streamed back, so the user
is responsible for calling HttpResponseDecorator.close() |
HttpResponse |
listBuckets(boolean streamResponse)
List the buckets in Riak
|
HttpResponse |
mapReduce(String job,
RequestMeta meta)
Same as
RiakClient , except only returning the HTTP response |
HttpResponse |
ping()
Same as
RiakClient.ping() |
HttpResponse |
resetBucketSchema(String bucket) |
HttpResponse |
setBucketSchema(String bucket,
org.json.JSONObject schema,
RequestMeta meta)
|
void |
setClientId(String clientId) |
void |
setExceptionHandler(RiakExceptionHandler exceptionHandler)
Install an exception handler.
|
HttpResponse |
stats()
Same as
RiakClient.stats() |
HttpResponse |
store(RiakObject object,
RequestMeta meta)
Same as
RiakClient , except only returning the HTTP response |
boolean |
stream(String bucket,
String key,
StreamHandler handler,
RequestMeta meta)
Same as
RiakClient , except only returning the HTTP response |
HttpResponse |
toss(RiakIORuntimeException e)
Hands exception
e to installed exception handler if there is
one or throw it. |
HttpResponse |
toss(RiakResponseRuntimeException e) |
HttpResponse |
walk(String bucket,
String key,
String walkSpec,
RequestMeta meta)
Same as
RiakClient , except only returning the HTTP response |
public ClientHelper(RiakConfig config, String clientId)
public byte[] getClientId()
public void setClientId(String clientId)
public HttpResponse setBucketSchema(String bucket, org.json.JSONObject schema, RequestMeta meta)
public HttpResponse getBucketSchema(String bucket, RequestMeta meta)
RiakClient.getBucketSchema(String, RequestMeta)
, except
only returning the HTTP response.public HttpResponse resetBucketSchema(String bucket)
public HttpResponse listBuckets(boolean streamResponse)
HttpResponse
whose body should be the result of asking
Riak to list buckets.public HttpResponse listBucket(String bucket, RequestMeta meta, boolean streamResponse)
RiakClient
, except only returning the HTTP response, and
if streamResponse==true, the response will be streamed back, so the user
is responsible for calling HttpResponseDecorator.close()
public HttpResponse store(RiakObject object, RequestMeta meta)
RiakClient
, except only returning the HTTP responsepublic HttpResponse fetchMeta(String bucket, String key, RequestMeta meta)
RiakClient
, except only returning the HTTP responsepublic HttpResponse fetch(String bucket, String key, RequestMeta meta, boolean streamResponse)
RiakClient
, except only returning the HTTP response and
allows the response to be streamed.bucket
- Same as RiakClient
key
- Same as RiakClient
meta
- Same as RiakClient
streamResponse
- If true, the connection will NOT be released. Use
HttpResponse.getHttpMethod().getResponseBodyAsStream() to get
the response stream; HttpResponse.getBody() will return null.RiakClient
public HttpResponse fetch(String bucket, String key, RequestMeta meta)
public boolean stream(String bucket, String key, StreamHandler handler, RequestMeta meta) throws IOException
RiakClient
, except only returning the HTTP responseIOException
public HttpResponse delete(String bucket, String key, RequestMeta meta)
RiakClient
, except only returning the HTTP responsepublic HttpResponse walk(String bucket, String key, String walkSpec, RequestMeta meta)
RiakClient
, except only returning the HTTP responsepublic HttpResponse mapReduce(String job, RequestMeta meta)
RiakClient
, except only returning the HTTP responsepublic HttpResponse fetchIndex(String bucket, String indexName, String[] values)
bucket
- the bucketindexName
- the name of the indexvalues
- an array of Strings, if only 1 long, then a value, if longer
the 1st 2 elements are treated as the bounds for a rangeHttpResponse
public HttpResponse fetchIndex(String bucket, String indexName, long[] values)
bucket
- the bucketindexName
- the name of the indexvalues
- an array of longs, if only 1 element, then a value, if longer
the 1st 2 elements are treated as the bounds for a rangeHttpResponse
public HttpResponse fetchIndex(IndexRequest request)
public HttpResponse incrementCounter(String bucket, String counter, long increment, RequestMeta meta)
public HttpResponse fetchCounter(String bucket, String counter, RequestMeta meta)
public HttpResponse ping()
RiakClient.ping()
public RiakExceptionHandler getExceptionHandler()
public HttpResponse stats()
RiakClient.stats()
HttpResponse
whose body should be the result of asking
Riak for its stats (status).public void setExceptionHandler(RiakExceptionHandler exceptionHandler)
public HttpResponse toss(RiakIORuntimeException e)
e
to installed exception handler if there is
one or throw it.HttpResponse
.public HttpResponse toss(RiakResponseRuntimeException e)
public org.apache.http.client.HttpClient getHttpClient()
HttpClient
used to make requests, which can be
configured.public RiakConfig getConfig()
Copyright © 2014. All Rights Reserved.