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
.RiakException
public static IRiakClient pbcClient(String host, int port) throws RiakException
RiakException
public static IRiakClient pbcClient(RiakClient delegate)
RiakClient
client in a DefaultRiakClient
.delegate
- the pbc.RiakClient
to wrap.DefaultRiakClient
that delegates to delegate
public static IRiakClient httpClient() throws RiakException
HTTPClientAdapter
connecting to 127.0.0.1:8098/riak in a DefaultRiakClient
DefaultRiakClient
delegating to the HTTP clientRiakException
public static IRiakClient httpClient(String url) throws RiakException
url
- a String of the url for Riak's REST iterfaceDefaultRiakClient
delegating to
the HTTP clientRiakException
public static IRiakClient httpClient(RiakClient delegate) throws RiakException
RiakClient
in a DefaultRiakClient
delegate
- the http.RiakClient
to wrap.DefaultRiakClient
that delegates to delegate
RiakException
public 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 Configuration
IRiakClient
that delegates to a RawClient
configured by config
IOException
NoFactoryForConfigException
- if the Configuration
type is not recognizedIllegalArgumentException
- if config is nullRiakException
HTTPClientConfig
,
PBClientConfig
,
ClusterConfig
Copyright © 2013. All Rights Reserved.