com.basho.riak.client.http
Class RiakConfig

java.lang.Object
  extended by com.basho.riak.client.http.RiakConfig

public class RiakConfig
extends Object

Configuration settings for connecting to a Riak instance such as the base Riak URL and HttpClient settings. A pre-constructed HttpClient can also be provided.


Field Summary
static Pattern BASE_URL_PATTERN
           
 
Constructor Summary
RiakConfig()
           
RiakConfig(String url)
           
RiakConfig(String ip, String port, String prefix)
           
RiakConfig(URL url)
           
 
Method Summary
 String getBaseUrl()
          The host and port of the Riak server, which is extracted from the specified Riak URL.
 org.apache.http.client.HttpClient getHttpClient()
          The pre-constructed HttpClient for a client to use if one was provided
 String getMapReducePath()
          The path to the Riak map reduce resource, which defaults to /mapred
 String getMapReduceUrl()
          The full URL of Riak map reduce resource, which is calculated by combining the host and port from the Riak URL and the map reduce path.
 Integer getMaxConnections()
           
 String getPingPath()
           
 String getPingUrl()
          The full URL of the Riak ping resource, which is calculated by combining the host and port from the Riak URL and the ping path.
 org.apache.http.client.HttpRequestRetryHandler getRetryHandler()
          Get value set for the http client retry handler, the default retry handler for requests.
 String getStatsUrl()
          The full URL of the Riak status (stats) resource, which is calculated by combining the host and port from the Riak URL and the stats path.
 Integer getTimeout()
           
 String getUrl()
          The base URL used by a client to construct object URLs
 void setHttpClient(org.apache.http.client.HttpClient httpClient)
          Provide a pre-constructed HttpClient for clients to use to connect to Riak
 void setMapReducePath(String path)
           
 void setMaxConnections(Integer maxConnections)
          Value to set for the HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS and the HttpConnectionManagerParams.MAX_HOST_CONNECTIONS properties: overall maximum number of connections used by the HttpClient and the maximum number of connections per host.
 void setPingPath(String path)
           
 void setRetryHandler(org.apache.http.client.HttpRequestRetryHandler retryHandler)
          Value to set for the http client retry handler, the default retry handler for requests.
 void setTimeout(Integer timeout)
          Value to set for the properties: HttpClientParams#CONNECTION_MANAGER_TIMEOUT, HttpClientParams#SO_TIMEOUT, HttpConnectionManagerParams#CONNECTION_TIMEOUT which sets the timeout milliseconds for retrieving an HTTP connection and data over the connection.
 void setUrl(String url)
          Set the base URL that clients should use to construct object URLs (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_URL_PATTERN

public static Pattern BASE_URL_PATTERN
Constructor Detail

RiakConfig

public RiakConfig()

RiakConfig

public RiakConfig(String url)

RiakConfig

public RiakConfig(URL url)

RiakConfig

public RiakConfig(String ip,
                  String port,
                  String prefix)
Method Detail

getUrl

public String getUrl()
The base URL used by a client to construct object URLs


setUrl

public void setUrl(String url)
Set the base URL that clients should use to construct object URLs (e.g. http://localhost:8098/riak).


getMapReduceUrl

public String getMapReduceUrl()
The full URL of Riak map reduce resource, which is calculated by combining the host and port from the Riak URL and the map reduce path.


getPingUrl

public String getPingUrl()
The full URL of the Riak ping resource, which is calculated by combining the host and port from the Riak URL and the ping path.


getStatsUrl

public String getStatsUrl()
The full URL of the Riak status (stats) resource, which is calculated by combining the host and port from the Riak URL and the stats path.


getBaseUrl

public String getBaseUrl()
The host and port of the Riak server, which is extracted from the specified Riak URL.


getMapReducePath

public String getMapReducePath()
The path to the Riak map reduce resource, which defaults to /mapred


setMapReducePath

public void setMapReducePath(String path)

getPingPath

public String getPingPath()

setPingPath

public void setPingPath(String path)

getHttpClient

public org.apache.http.client.HttpClient getHttpClient()
The pre-constructed HttpClient for a client to use if one was provided


setHttpClient

public void setHttpClient(org.apache.http.client.HttpClient httpClient)
Provide a pre-constructed HttpClient for clients to use to connect to Riak


setTimeout

public void setTimeout(Integer timeout)
Value to set for the properties: HttpClientParams#CONNECTION_MANAGER_TIMEOUT, HttpClientParams#SO_TIMEOUT, HttpConnectionManagerParams#CONNECTION_TIMEOUT which sets the timeout milliseconds for retrieving an HTTP connection and data over the connection. Null for default.


getTimeout

public Integer getTimeout()

setMaxConnections

public void setMaxConnections(Integer maxConnections)
Value to set for the HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS and the HttpConnectionManagerParams.MAX_HOST_CONNECTIONS properties: overall maximum number of connections used by the HttpClient and the maximum number of connections per host. The latter is set to overcome the default 2 connections per host in HttpClient.


getMaxConnections

public Integer getMaxConnections()

getRetryHandler

public org.apache.http.client.HttpRequestRetryHandler getRetryHandler()
Get value set for the http client retry handler, the default retry handler for requests.

See Also:
HttpRequestRetryHandler, DefaultHttpRequestRetryHandler

setRetryHandler

public void setRetryHandler(org.apache.http.client.HttpRequestRetryHandler retryHandler)
Value to set for the http client retry handler, the default retry handler for requests.

See Also:
HttpRequestRetryHandler, DefaultHttpRequestRetryHandler


Copyright © 2012. All Rights Reserved.