com.basho.riak.client
Class RiakClient

java.lang.Object
  extended by com.basho.riak.client.RiakClient

Deprecated. with the addition of a protocol buffers client in 0.14 all the existing REST client code should be in client.http.* this class has therefore been moved. Please use com.basho.riak.client.http.RiakClient instead.

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

Legacy interface for interacting with Riak via HTTP.

See Also:
RiakClient, IRiakClient, IRiakObject

Constructor Summary
RiakClient(RiakConfig config)
          Deprecated.  
RiakClient(RiakConfig config, String clientId)
          Deprecated.  
RiakClient(String url)
          Deprecated.  
RiakClient(String url, String clientId)
          Deprecated.  
 
Method Summary
 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. Fetch the RiakObject (which can include sibling objects) stored at bucket and key.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RiakClient

public RiakClient(RiakConfig config)
Deprecated. 

RiakClient

public RiakClient(RiakConfig config,
                  String clientId)
Deprecated. 

RiakClient

public RiakClient(String url)
Deprecated. 

RiakClient

public RiakClient(String url,
                  String clientId)
Deprecated. 
Method Detail

getConfig

public RiakConfig getConfig()
Deprecated. 

setBucketSchema

public HttpResponse setBucketSchema(String bucket,
                                    RiakBucketInfo bucketInfo,
                                    RequestMeta meta)
Deprecated. 
Set the properties for a Riak bucket.

Parameters:
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.
Returns:
HttpResponse containing HTTP response information.
Throws:
IllegalArgumentException - If the provided schema values cannot be serialized to send to Riak.
RiakIORuntimeException - If an error occurs during communication with the Riak server.

setBucketSchema

public HttpResponse setBucketSchema(String bucket,
                                    RiakBucketInfo bucketInfo)
Deprecated. 

getBucketSchema

public BucketResponse getBucketSchema(String bucket,
                                      RequestMeta meta)
Deprecated. 
Return the properties for a Riak bucket without listing the keys in it.

Parameters:
bucket - The target bucket.
meta - Extra metadata to attach to the request such as HTTP headers and query parameters.
Returns:
BucketResponse containing HTTP response information and the parsed schema
Throws:
RiakIORuntimeException - If an error occurs during communication with the Riak server.
RiakResponseRuntimeException - If the Riak server returns a malformed response.

getBucketSchema

public BucketResponse getBucketSchema(String bucket)
Deprecated. 

listBucket

public BucketResponse listBucket(String bucket,
                                 RequestMeta meta)
Deprecated. 
Return the properties and keys for a Riak bucket.

Parameters:
bucket - The bucket to list.
meta - Extra metadata to attach to the request such as HTTP headers and query parameters.
Returns:
BucketResponse containing HTTP response information and the parsed schema and keys
Throws:
RiakIORuntimeException - If an error occurs during communication with the Riak server.
RiakResponseRuntimeException - If the Riak server returns a malformed response.

listBucket

public BucketResponse listBucket(String bucket)
Deprecated. 

streamBucket

public 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.


streamBucket

public BucketResponse streamBucket(String bucket)
Deprecated. 

store

public StoreResponse store(RiakObject object,
                           RequestMeta meta)
Deprecated. 
Store a RiakObject.

Parameters:
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).
Returns:
A StoreResponse containing HTTP response information and any updated information returned by the server such as the vclock, last modified date.
Throws:
RiakIORuntimeException - If an error occurs during communication with the Riak server.
RiakResponseRuntimeException - If the Riak server returns a malformed response.

store

public StoreResponse store(RiakObject object)
Deprecated. 

fetchMeta

public FetchResponse fetchMeta(String bucket,
                               String key,
                               RequestMeta meta)
Deprecated. 
Fetch metadata (e.g. vclock, last modified, vtag) for the RiakObject stored at bucket and key.

Parameters:
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).
Returns:
FetchResponse containing HTTP response information and a RiakObject containing only metadata and no value.
Throws:
RiakIORuntimeException - If an error occurs during communication with the Riak server.
RiakResponseRuntimeException - If the Riak server returns a malformed response.

fetchMeta

public FetchResponse fetchMeta(String bucket,
                               String key)
Deprecated. 

fetch

public FetchResponse fetch(String bucket,
                           String key,
                           RequestMeta meta)
Deprecated. 
Fetch the RiakObject (which can include sibling objects) stored at bucket and key.

Parameters:
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).
Returns:
FetchResponse containing HTTP response information and a RiakObject or sibling objects.
Throws:
RiakIORuntimeException - If an error occurs during communication with the Riak server.
RiakResponseRuntimeException - If the Riak server returns a malformed response.

fetch

public FetchResponse fetch(String bucket,
                           String key)
Deprecated. 

stream

public 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. The user must remember to call HttpResponseDecorator.close() on the return value.

Parameters:
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().
Returns:
A streaming FetchResponse containing HTTP response information and the response stream. The HTTP connection must be closed manually by the user by calling HttpResponseDecorator.close().

stream

public FetchResponse stream(String bucket,
                            String key)
Deprecated. 

stream

public boolean stream(String bucket,
                      String key,
                      StreamHandler handler,
                      RequestMeta meta)
               throws IOException
Deprecated. 
Fetch and process the object stored at bucket and key as a stream.

Parameters:
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().
Returns:
Result from calling handler.process() or true if handler is null.
Throws:
IOException - If an error occurs during communication with the Riak server.
See Also:
StreamHandler

delete

public HttpResponse delete(String bucket,
                           String key,
                           RequestMeta meta)
Deprecated. 
Delete the object at bucket and key.

Parameters:
bucket - The bucket containing the object.
key - The key of the object
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).
Returns:
HttpResponse containing HTTP response information.
Throws:
RiakIORuntimeException - If an error occurs during communication with the Riak server.

delete

public HttpResponse delete(String bucket,
                           String key)
Deprecated. 

walk

public 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.

Parameters:
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.
Returns:
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.
Throws:
RiakIORuntimeException - If an error occurs during communication with the Riak server.
RiakResponseRuntimeException - If the Riak server returns a malformed response.
See Also:
RiakWalkSpec

walk

public WalkResponse walk(String bucket,
                         String key,
                         String walkSpec)
Deprecated. 

walk

public WalkResponse walk(String bucket,
                         String key,
                         RiakWalkSpec walkSpec)
Deprecated. 

mapReduce

public MapReduceResponse mapReduce(String job,
                                   RequestMeta meta)
Deprecated. 
Execute a map reduce job on the Riak server.

Parameters:
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.
Returns:
MapReduceResponse containing HTTP response information and the result of the map reduce job
Throws:
RiakIORuntimeException - If an error occurs during communication with the Riak server.
RiakResponseRuntimeException - If the Riak server does not return a valid JSON array.

mapReduce

public MapReduceResponse mapReduce(String job)
Deprecated. 

mapReduceOverBucket

public MapReduceBuilder mapReduceOverBucket(String bucket)
Deprecated. 
A convenience method for creating a MapReduceBuilder used for building a map reduce job to submission to this client

Parameters:
bucket - The bucket to perform the map reduce job over
Returns:
A MapReduceBuilder to build the map reduce job

mapReduceOverObjects

public MapReduceBuilder mapReduceOverObjects(Map<String,Set<String>> objects)
Deprecated. 
Same as mapReduceOverBucket(String), except over a set of objects instead of a bucket.

Parameters:
objects - A set of objects represented as a map of { bucket : [ list of keys in bucket ] }

getExceptionHandler

public RiakExceptionHandler getExceptionHandler()
Deprecated. 
The installed exception handler or null if not installed


setExceptionHandler

public 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. ClientUtils.throwChecked(Throwable) can be used to throw undeclared checked exceptions to effectively "convert" RiakClient's unchecked exceptions to checked exceptions.


getHttpClient

public org.apache.http.client.HttpClient getHttpClient()
Deprecated. 
Return the HttpClient used to make requests, which can be configured.


getClientId

public byte[] getClientId()
Deprecated. 
A 4-byte unique ID for this client. The ID is base 64 encoded and sent to Riak to generating the object vclock on store operations. Refer to the Riak documentation and http://lists.basho.com/pipermail/riak-users_lists.basho.com/2009- November/000153.html for information about the client ID.


setClientId

public void setClientId(String clientId)
Deprecated. 


Copyright © 2012. All Rights Reserved.