public class RiakFactory extends Object
RawClient of your choice.
Use the newClient method, passing an implementation of Configuration.
The factory will look up a RiakClientFactory implementation and pass
your Configuration to it.
For example:
Configuration conf = new PBClientConfig.Builder().withHost("my-riak-host.com").withPort(9000).build();
IRiakClient client = RiakFactory.newClient(conf);
Also provides convenience methods for grabbing a default configuration pb or http client.
Configuration,
ClusterConfig| Constructor and Description |
|---|
RiakFactory() |
| Modifier and Type | Method and Description |
|---|---|
static IRiakClient |
httpClient()
Wraps a
HTTPClientAdapter connecting to 127.0.0.1:8098/riak in a DefaultRiakClient |
static IRiakClient |
httpClient(RiakClient delegate)
Wraps the given
RiakClient in a DefaultRiakClient |
static IRiakClient |
httpClient(String url)
|
static IRiakClient |
newClient(Configuration config)
Uses the given
config to generate an IRiakClient
instance. |
static IRiakClient |
pbcClient()
Wraps a
PBClientAdapter connected to 127.0.0.1:8087 in a DefaultRiakClient. |
static IRiakClient |
pbcClient(RiakClient delegate)
Wraps the given
RiakClient client in a DefaultRiakClient. |
static IRiakClient |
pbcClient(String host,
int port)
|
public static IRiakClient pbcClient() throws RiakException
PBClientAdapter connected to 127.0.0.1:8087 in a DefaultRiakClient.RiakExceptionpublic static IRiakClient pbcClient(String host, int port) throws RiakException
RiakExceptionpublic static IRiakClient pbcClient(RiakClient delegate)
RiakClient client in a DefaultRiakClient.delegate - the pbc.RiakClient to wrap.DefaultRiakClient that delegates to delegatepublic static IRiakClient httpClient() throws RiakException
HTTPClientAdapter connecting to 127.0.0.1:8098/riak in a DefaultRiakClientDefaultRiakClient delegating to the HTTP clientRiakExceptionpublic static IRiakClient httpClient(String url) throws RiakException
url - a String of the url for Riak's REST iterfaceDefaultRiakClient delegating to
the HTTP clientRiakExceptionpublic static IRiakClient httpClient(RiakClient delegate) throws RiakException
RiakClient in a DefaultRiakClientdelegate - the http.RiakClient to wrap.DefaultRiakClient that delegates to delegateRiakExceptionpublic static IRiakClient newClient(Configuration config) throws RiakException
config to generate an IRiakClient
instance.
See the available Configuration implementations for details.config - a concrete implementation of ConfigurationIRiakClient that delegates to a RawClient
configured by configIOExceptionNoFactoryForConfigException - if the Configuration type is not recognizedIllegalArgumentException - if config is nullRiakExceptionHTTPClientConfig,
PBClientConfig,
ClusterConfigCopyright © 2014. All Rights Reserved.