|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.basho.riak.client.http.plain.PlainClient
public class PlainClient
An adapter from RiakClient
to a slightly less HTTP, more
Java-centric, interface. Objects are returned without HTTP specific
information and exceptions are thrown on unsuccessful responses.
Constructor Summary | |
---|---|
PlainClient(RiakClient riakClient)
The primary constructor. |
Method Summary | |
---|---|
void |
delete(String bucket,
String key)
|
void |
delete(String bucket,
String key,
RequestMeta meta)
Like RiakClient.delete(String, String, RequestMeta) , except
throws on a non-200 or 404 response. |
RiakObject |
fetch(String bucket,
String key)
|
RiakObject |
fetch(String bucket,
String key,
RequestMeta meta)
Like RiakClient.fetch(String, String, RequestMeta) , except it
returns the fetched object directly or throws if the response is not a
200, 304 or 404. |
Collection<? extends RiakObject> |
fetchAll(String bucket,
String key)
|
Collection<? extends RiakObject> |
fetchAll(String bucket,
String key,
RequestMeta meta)
Like RiakClient.fetch(String, String, RequestMeta) , except it
returns the all the fetched objects directly or throws if the response is
not a 200, 304 or 404. |
RiakObject |
fetchMeta(String bucket,
String key)
|
RiakObject |
fetchMeta(String bucket,
String key,
RequestMeta meta)
Like RiakClient.fetchMeta(String, String, RequestMeta) , except it
returns the fetched object metadata directly or throws if the response is
not a 200, 304 or 404. |
static PlainClient |
getClient(RiakConfig config)
Connect to Riak using the given configuration. |
static PlainClient |
getClient(String url)
Connect to Riak using the given URL. |
RiakBucketInfo |
listBucket(String bucket)
|
RiakBucketInfo |
listBucket(String bucket,
RequestMeta meta)
Like RiakClient.listBucket(String, RequestMeta) , except throws on
a non-200 response |
void |
setBucketSchema(String bucket,
RiakBucketInfo bucketInfo)
|
void |
setBucketSchema(String bucket,
RiakBucketInfo bucketInfo,
RequestMeta meta)
Like RiakClient.setBucketSchema(String, RiakBucketInfo, RequestMeta) ,
except throws on a non-204 response. |
void |
store(RiakObject object)
|
void |
store(RiakObject object,
RequestMeta meta)
Like RiakClient.store(RiakObject, RequestMeta) , except throws on
a non-200 or 204 response and updates the passed in RiakObject
with new metadata from Riak. |
boolean |
stream(String bucket,
String key,
StreamHandler handler,
RequestMeta meta)
Identical to RiakClient.stream(String, String, StreamHandler, RequestMeta) . |
List<? extends List<? extends RiakObject>> |
walk(String bucket,
String key,
RiakWalkSpec walkSpec)
|
List<? extends List<? extends RiakObject>> |
walk(String bucket,
String key,
String walkSpec)
|
List<? extends List<? extends RiakObject>> |
walk(String bucket,
String key,
String walkSpec,
RequestMeta meta)
Like RiakClient.walk(String, String, String, RequestMeta) , except
throws on a non-200 or 404 response. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PlainClient(RiakClient riakClient)
RiakClient
and
installs a custom RiakExceptionHandler
.
Method Detail |
---|
public static PlainClient getClient(RiakConfig config)
public static PlainClient getClient(String url)
public void setBucketSchema(String bucket, RiakBucketInfo bucketInfo, RequestMeta meta) throws RiakIOException, RiakResponseException
RiakClient.setBucketSchema(String, RiakBucketInfo, RequestMeta)
,
except throws on a non-204 response.
RiakIOException
- If an error occurs during communication with the Riak server.
RiakResponseException
- if the server does not successfully update the bucket schema.public void setBucketSchema(String bucket, RiakBucketInfo bucketInfo) throws RiakIOException, RiakResponseException
RiakIOException
RiakResponseException
public RiakBucketInfo listBucket(String bucket, RequestMeta meta) throws RiakIOException, RiakResponseException
RiakClient.listBucket(String, RequestMeta)
, except throws on
a non-200 response
RiakIOException
- If an error occurs during communication with the Riak server.
RiakResponseException
- if the server does not return the bucket informationpublic RiakBucketInfo listBucket(String bucket) throws RiakIOException, RiakResponseException
RiakIOException
RiakResponseException
public void store(RiakObject object, RequestMeta meta) throws RiakIOException, RiakResponseException
RiakClient.store(RiakObject, RequestMeta)
, except throws on
a non-200 or 204 response and updates the passed in RiakObject
with new metadata from Riak.
RiakIOException
- If an error occurs during communication with the Riak server.
RiakResponseException
- If the server does not succesfully store the object.public void store(RiakObject object) throws RiakIOException, RiakResponseException
RiakIOException
RiakResponseException
public RiakObject fetchMeta(String bucket, String key, RequestMeta meta) throws RiakIOException, RiakResponseException
RiakClient.fetchMeta(String, String, RequestMeta)
, except it
returns the fetched object metadata directly or throws if the response is
not a 200, 304 or 404.
RiakObject
or null if object doesn't exist.
RiakIOException
- If an error occurs during communication with the Riak server.
RiakResponseException
- If the server does return a valid objectpublic RiakObject fetchMeta(String bucket, String key) throws RiakIOException, RiakResponseException
RiakIOException
RiakResponseException
public RiakObject fetch(String bucket, String key, RequestMeta meta) throws RiakIOException, RiakResponseException
RiakClient.fetch(String, String, RequestMeta)
, except it
returns the fetched object directly or throws if the response is not a
200, 304 or 404.
RiakObject
or null if object doesn't exist. If siblings
exist, then returns one of the siblings.
RiakIOException
- If an error occurs during communication with the Riak server.
RiakResponseException
- If the server does return a valid objectpublic RiakObject fetch(String bucket, String key) throws RiakIOException, RiakResponseException
RiakIOException
RiakResponseException
public Collection<? extends RiakObject> fetchAll(String bucket, String key, RequestMeta meta) throws RiakIOException, RiakResponseException
RiakClient.fetch(String, String, RequestMeta)
, except it
returns the all the fetched objects directly or throws if the response is
not a 200, 304 or 404.
RiakObject
or null no object exist.
RiakIOException
- If an error occurs during communication with the Riak server.
RiakResponseException
- If the server does return any valid objectspublic Collection<? extends RiakObject> fetchAll(String bucket, String key) throws RiakIOException, RiakResponseException
RiakIOException
RiakResponseException
public boolean stream(String bucket, String key, StreamHandler handler, RequestMeta meta) throws IOException
RiakClient.stream(String, String, StreamHandler, RequestMeta)
.
IOException
public void delete(String bucket, String key, RequestMeta meta) throws RiakIOException, RiakResponseException
RiakClient.delete(String, String, RequestMeta)
, except
throws on a non-200 or 404 response. Note that delete succeeds if the
object did not previously exist (404 response).
RiakIOException
- If an error occurs during communication with the Riak server.
RiakResponseException
- If the object was not deleted.public void delete(String bucket, String key) throws RiakIOException, RiakResponseException
RiakIOException
RiakResponseException
public List<? extends List<? extends RiakObject>> walk(String bucket, String key, String walkSpec, RequestMeta meta) throws RiakIOException, RiakResponseException
RiakClient.walk(String, String, String, RequestMeta)
, except
throws on a non-200 or 404 response.
RiakObject
s corresponding to steps of
the walk. Returns null if the source object doesn't exist.
RiakIOException
- If an error occurs during communication with the Riak server.
RiakResponseException
- If the links could not be walked or the result steps were not
returned.public List<? extends List<? extends RiakObject>> walk(String bucket, String key, String walkSpec) throws RiakIOException, RiakResponseException
RiakIOException
RiakResponseException
public List<? extends List<? extends RiakObject>> walk(String bucket, String key, RiakWalkSpec walkSpec) throws RiakIOException, RiakResponseException
RiakIOException
RiakResponseException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |