public class RiakConnector
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ACTION_COUNT |
static int |
ACTION_DELETE |
static int |
ACTION_FETCH |
static int |
ACTION_LIST |
static int |
ACTION_STORE |
protected java.lang.String |
hostname |
protected boolean |
isConnected |
protected java.lang.String |
password |
protected int |
port |
protected com.basho.riak.client.IRiakClient |
riakClient |
protected int |
timeout |
protected java.lang.String |
uri |
protected java.lang.String |
username |
Constructor and Description |
---|
RiakConnector(java.util.Map props)
Creates new RiakConnector
|
Modifier and Type | Method and Description |
---|---|
void |
close()
closes and shutdown the Riak client
|
int |
delete(java.lang.String bucketName,
java.lang.String key)
deletes the key and returns number of keys removed or -1 on failure
|
com.basho.riak.client.IRiakObject |
fetch(java.lang.String bucketName,
java.lang.String key)
returns IRiakObject for the key or null on failure
|
com.basho.riak.client.bucket.Bucket |
fetchBucket(java.lang.String bucketName)
returns the Bucket or null if name does not exist in Riak
|
java.lang.String |
getURI() |
boolean |
isConnected() |
java.lang.String[] |
list()
returns an array of all bucket names
|
static void |
main(java.lang.String[] args)
tests Riak basic operations
|
java.lang.String |
reconnect()
It reconnects and returns null or error message upon failure
|
java.lang.String |
store(java.lang.String bucketName,
java.lang.String key,
java.lang.String data)
returns id of the inserted doc or null on failure
|
java.lang.String |
store(java.lang.String bucketName,
java.lang.String key,
java.lang.String data,
java.util.Map<java.lang.String,java.lang.String> meta)
returns id of the inserted doc with meta data or null on failure
|
protected java.lang.String hostname
protected java.lang.String username
protected java.lang.String password
protected java.lang.String uri
protected int port
protected int timeout
protected boolean isConnected
public static final int ACTION_LIST
public static final int ACTION_COUNT
public static final int ACTION_FETCH
public static final int ACTION_STORE
public static final int ACTION_DELETE
protected com.basho.riak.client.IRiakClient riakClient
public RiakConnector(java.util.Map props)
public java.lang.String getURI()
public boolean isConnected()
public java.lang.String reconnect()
public com.basho.riak.client.bucket.Bucket fetchBucket(java.lang.String bucketName) throws com.basho.riak.client.RiakException
com.basho.riak.client.RiakException
public com.basho.riak.client.IRiakObject fetch(java.lang.String bucketName, java.lang.String key) throws com.basho.riak.client.RiakException
com.basho.riak.client.RiakException
public java.lang.String store(java.lang.String bucketName, java.lang.String key, java.lang.String data) throws com.basho.riak.client.RiakException
com.basho.riak.client.RiakException
public java.lang.String store(java.lang.String bucketName, java.lang.String key, java.lang.String data, java.util.Map<java.lang.String,java.lang.String> meta) throws com.basho.riak.client.RiakException
com.basho.riak.client.RiakException
public int delete(java.lang.String bucketName, java.lang.String key) throws com.basho.riak.client.RiakException
com.basho.riak.client.RiakException
public java.lang.String[] list() throws com.basho.riak.client.RiakException
com.basho.riak.client.RiakException
public void close()
public static void main(java.lang.String[] args)