WARNING: This class will be REMOVED in the next version.
Please see also IRiakClient, IRiakObject for the new API
@Deprecated public class RiakClient extends Object
RiakClient
,
IRiakClient
,
IRiakObject
Constructor and Description |
---|
RiakClient(RiakConfig config)
Deprecated.
|
RiakClient(RiakConfig config,
String clientId)
Deprecated.
|
RiakClient(String url)
Deprecated.
|
RiakClient(String url,
String clientId)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
HttpResponse |
delete(String bucket,
String key)
Deprecated.
|
HttpResponse |
delete(String bucket,
String key,
RequestMeta meta)
Deprecated.
Delete the object at
bucket and key . |
FetchResponse |
fetch(String bucket,
String key)
Deprecated.
|
FetchResponse |
fetch(String bucket,
String key,
RequestMeta meta)
Deprecated.
|
FetchResponse |
fetchMeta(String bucket,
String key)
Deprecated.
|
FetchResponse |
fetchMeta(String bucket,
String key,
RequestMeta meta)
Deprecated.
Fetch metadata (e.g.
|
BucketResponse |
getBucketSchema(String bucket)
Deprecated.
|
BucketResponse |
getBucketSchema(String bucket,
RequestMeta meta)
Deprecated.
Return the properties for a Riak bucket without listing the keys in it.
|
byte[] |
getClientId()
Deprecated.
A 4-byte unique ID for this client.
|
RiakConfig |
getConfig()
Deprecated.
|
RiakExceptionHandler |
getExceptionHandler()
Deprecated.
The installed exception handler or null if not installed
|
org.apache.http.client.HttpClient |
getHttpClient()
Deprecated.
Return the
HttpClient used to make requests, which can be
configured. |
BucketResponse |
listBucket(String bucket)
Deprecated.
|
BucketResponse |
listBucket(String bucket,
RequestMeta meta)
Deprecated.
Return the properties and keys for a Riak bucket.
|
MapReduceResponse |
mapReduce(String job)
Deprecated.
|
MapReduceResponse |
mapReduce(String job,
RequestMeta meta)
Deprecated.
Execute a map reduce job on the Riak server.
|
MapReduceBuilder |
mapReduceOverBucket(String bucket)
Deprecated.
A convenience method for creating a MapReduceBuilder used for building a
map reduce job to submission to this client
|
MapReduceBuilder |
mapReduceOverObjects(Map<String,Set<String>> objects)
Deprecated.
Same as
mapReduceOverBucket(String) , except over a set
of objects instead of a bucket. |
HttpResponse |
setBucketSchema(String bucket,
RiakBucketInfo bucketInfo)
Deprecated.
|
HttpResponse |
setBucketSchema(String bucket,
RiakBucketInfo bucketInfo,
RequestMeta meta)
Deprecated.
Set the properties for a Riak bucket.
|
void |
setClientId(String clientId)
Deprecated.
|
void |
setExceptionHandler(RiakExceptionHandler exceptionHandler)
Deprecated.
If an exception handler is provided, then the Riak client will hand
exceptions to the handler rather than throwing them.
|
StoreResponse |
store(RiakObject object)
Deprecated.
|
StoreResponse |
store(RiakObject object,
RequestMeta meta)
Deprecated.
Store a
RiakObject . |
FetchResponse |
stream(String bucket,
String key)
Deprecated.
|
FetchResponse |
stream(String bucket,
String key,
RequestMeta meta)
Deprecated.
Similar to fetch(), except the HTTP connection is left open for
successful responses, and the Riak response is provided as a stream.
|
boolean |
stream(String bucket,
String key,
StreamHandler handler,
RequestMeta meta)
Deprecated.
Fetch and process the object stored at
bucket and
key as a stream. |
BucketResponse |
streamBucket(String bucket)
Deprecated.
|
BucketResponse |
streamBucket(String bucket,
RequestMeta meta)
Deprecated.
Same as
listBucket(String, RequestMeta) , except
streams the response, so the user must remember to call
HttpResponseDecorator.close() on the return value. |
WalkResponse |
walk(String bucket,
String key,
RiakWalkSpec walkSpec)
Deprecated.
|
WalkResponse |
walk(String bucket,
String key,
String walkSpec)
Deprecated.
|
WalkResponse |
walk(String bucket,
String key,
String walkSpec,
RequestMeta meta)
Deprecated.
Perform a map/reduce link walking operation and return the objects for
which the "accumulate" flag is true.
|
public RiakClient(RiakConfig config)
public RiakClient(RiakConfig config, String clientId)
public RiakClient(String url)
public RiakConfig getConfig()
public HttpResponse setBucketSchema(String bucket, RiakBucketInfo bucketInfo, RequestMeta meta)
bucket
- The bucket name.bucketInfo
- Contains the schema to use for the bucket. Refer to the Riak
documentation for a list of the recognized properties and the
format of their values.meta
- Extra metadata to attach to the request such as HTTP headers
and query parameters.HttpResponse
containing HTTP response information.IllegalArgumentException
- If the provided schema values cannot be serialized to send to
Riak.RiakIORuntimeException
- If an error occurs during communication with the Riak server.public HttpResponse setBucketSchema(String bucket, RiakBucketInfo bucketInfo)
public BucketResponse getBucketSchema(String bucket, RequestMeta meta)
bucket
- The target bucket.meta
- Extra metadata to attach to the request such as HTTP headers
and query parameters.BucketResponse
containing HTTP response information and
the parsed schemaRiakIORuntimeException
- If an error occurs during communication with the Riak server.RiakResponseRuntimeException
- If the Riak server returns a malformed response.public BucketResponse getBucketSchema(String bucket)
public BucketResponse listBucket(String bucket, RequestMeta meta)
bucket
- The bucket to list.meta
- Extra metadata to attach to the request such as HTTP headers
and query parameters.BucketResponse
containing HTTP response information and
the parsed schema and keysRiakIORuntimeException
- If an error occurs during communication with the Riak server.RiakResponseRuntimeException
- If the Riak server returns a malformed response.public BucketResponse listBucket(String bucket)
public BucketResponse streamBucket(String bucket, RequestMeta meta)
listBucket(String, RequestMeta)
, except
streams the response, so the user must remember to call
HttpResponseDecorator.close()
on the return value.public BucketResponse streamBucket(String bucket)
public StoreResponse store(RiakObject object, RequestMeta meta)
RiakObject
.object
- The RiakObject
to store.meta
- Extra metadata to attach to the request such as w and dw
values for the request, HTTP headers, and other query
parameters. See
RequestMeta.writeParams(Integer, Integer)
.StoreResponse
containing HTTP response information and
any updated information returned by the server such as the
vclock, last modified date.RiakIORuntimeException
- If an error occurs during communication with the Riak server.RiakResponseRuntimeException
- If the Riak server returns a malformed response.public StoreResponse store(RiakObject object)
public FetchResponse fetchMeta(String bucket, String key, RequestMeta meta)
bucket
- The bucket containing the RiakObject
to fetch.key
- The key of the RiakObject
to fetch.meta
- Extra metadata to attach to the request such as an r- value
for the request, HTTP headers, and other query parameters. See
RequestMeta.readParams(int)
.FetchResponse
containing HTTP response information and a
RiakObject
containing only metadata and no value.RiakIORuntimeException
- If an error occurs during communication with the Riak server.RiakResponseRuntimeException
- If the Riak server returns a malformed response.public FetchResponse fetchMeta(String bucket, String key)
public FetchResponse fetch(String bucket, String key, RequestMeta meta)
bucket
- The bucket containing the RiakObject
to fetch.key
- The key of the RiakObject
to fetch.meta
- Extra metadata to attach to the request such as an r- value
for the request, HTTP headers, and other query parameters. See
RequestMeta.readParams(int)
.FetchResponse
containing HTTP response information and a
RiakObject
or sibling objects.RiakIORuntimeException
- If an error occurs during communication with the Riak server.RiakResponseRuntimeException
- If the Riak server returns a malformed response.public FetchResponse fetch(String bucket, String key)
public FetchResponse stream(String bucket, String key, RequestMeta meta)
HttpResponseDecorator.close()
on the
return value.bucket
- The bucket containing the RiakObject
to fetch.key
- The key of the RiakObject
to fetch.meta
- Extra metadata to attach to the request such as an r- value
for the request, HTTP headers, and other query parameters. See
RequestMeta.readParams().FetchResponse
containing HTTP response
information and the response stream. The HTTP connection must be
closed manually by the user by calling
HttpResponseDecorator.close()
.public FetchResponse stream(String bucket, String key)
public boolean stream(String bucket, String key, StreamHandler handler, RequestMeta meta) throws IOException
bucket
and
key
as a stream.bucket
- The bucket containing the RiakObject
to fetch.key
- The key of the RiakObject
to fetch.handler
- A StreamHandler
to process the Riak response.meta
- Extra metadata to attach to the request such as an r- value
for the request, HTTP headers, and other query parameters. See
RequestMeta.readParams().IOException
- If an error occurs during communication with the Riak server.StreamHandler
public HttpResponse delete(String bucket, String key, RequestMeta meta)
bucket
and key
.bucket
- The bucket containing the object.key
- The key of the objectmeta
- Extra metadata to attach to the request such as w and dw
values for the request, HTTP headers, and other query
parameters. See
RequestMeta.writeParams(Integer, Integer)
.HttpResponse
containing HTTP response information.RiakIORuntimeException
- If an error occurs during communication with the Riak server.public HttpResponse delete(String bucket, String key)
public WalkResponse walk(String bucket, String key, String walkSpec, RequestMeta meta)
bucket
- The bucket of the "starting object"key
- The key of the "starting object"walkSpec
- A URL-path (omit beginning /) of the form
bucket,tag-spec,accumulateFlag
The
tag-spec "_"
matches all tags.
accumulateFlag
is either the String "1" or "0".meta
- Extra metadata to attach to the request such as HTTP headers
or query parameters.WalkResponse
containing HTTP response information and a
List
of Lists
, where each sub-list
corresponds to a walkSpec
element that had
accumulateFlag
equal to 1.RiakIORuntimeException
- If an error occurs during communication with the Riak server.RiakResponseRuntimeException
- If the Riak server returns a malformed response.RiakWalkSpec
public WalkResponse walk(String bucket, String key, String walkSpec)
public WalkResponse walk(String bucket, String key, RiakWalkSpec walkSpec)
public MapReduceResponse mapReduce(String job, RequestMeta meta)
job
- JSON string representing the map reduce job to run, which can
be created using MapReduceBuilder
meta
- Extra metadata to attach to the request such as HTTP headers
or query parameters.MapReduceResponse
containing HTTP response information
and the result of the map reduce jobRiakIORuntimeException
- If an error occurs during communication with the Riak server.RiakResponseRuntimeException
- If the Riak server does not return a valid JSON array.public MapReduceResponse mapReduce(String job)
public MapReduceBuilder mapReduceOverBucket(String bucket)
bucket
- The bucket to perform the map reduce job overMapReduceBuilder
to build the map reduce jobpublic MapReduceBuilder mapReduceOverObjects(Map<String,Set<String>> objects)
mapReduceOverBucket(String)
, except over a set
of objects instead of a bucket.objects
- A set of objects represented as a map of { bucket : [ list of
keys in bucket ] }public RiakExceptionHandler getExceptionHandler()
public void setExceptionHandler(RiakExceptionHandler exceptionHandler)
ClientUtils.throwChecked(Throwable)
can be used to throw
undeclared checked exceptions to effectively "convert" RiakClient's
unchecked exceptions to checked exceptions.public org.apache.http.client.HttpClient getHttpClient()
HttpClient
used to make requests, which can be
configured.public byte[] getClientId()
public void setClientId(String clientId)
Copyright © 2013. All Rights Reserved.