|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.basho.riak.client.RiakFactory
public class RiakFactory
A factory for getting an IRiakClient implementation wrapping the
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 Summary | |
---|---|
RiakFactory()
|
Method Summary | |
---|---|
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)
Wraps a HTTPClientAdapter connecting to the given
url in a DefaultRiakClient |
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)
Wraps a PBClientAdapter connected to host and
port in a DefaultRiakClient . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RiakFactory()
Method Detail |
---|
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
PBClientAdapter
connected to host
and
port
in a DefaultRiakClient
.
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 client
RiakException
public static IRiakClient httpClient(String url) throws RiakException
HTTPClientAdapter
connecting to the given
url
in a DefaultRiakClient
url
- a String of the url for Riak's REST iterface
DefaultRiakClient
delegating to
the HTTP client
RiakException
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 recognized
IllegalArgumentException
- if config is null
RiakException
HTTPClientConfig
,
PBClientConfig
,
ClusterConfig
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |