public class CouchbaseFactoryBean extends Object implements FactoryBean<com.couchbase.client.CouchbaseClient>, InitializingBean, DisposableBean, PersistenceExceptionTranslator
CouchbaseClient.
To set the properties correctly on the CouchbaseClient a CouchbaseConnectionFactoryBuilder is used.
After all properties are set, the client is constructed and used.| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_BUCKET
Defines the default bucket name to be used if no other bucket name is supplied.
|
static String |
DEFAULT_DESTROY_METHOD
The name of the default shutdown method to call when the context is destroyed.
|
static String |
DEFAULT_LOGGER_PROPERTY
Use SLF4J as the default logger if not instructed otherwise.
|
static String |
DEFAULT_NODE
Defines the default hostname to be used if no other list is supplied.
|
static String |
DEFAULT_PASSWORD
Defines the password of the default bucket.
|
| Constructor and Description |
|---|
CouchbaseFactoryBean() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Instantiate the
CouchbaseClient. |
void |
destroy()
Shutdown the client when the bean is destroyed.
|
com.couchbase.client.CouchbaseClient |
getObject()
Return the underlying
CouchbaseClient. |
Class<?> |
getObjectType()
Returns the object type of the client.
|
boolean |
isSingleton()
The client should be returned as a singleton.
|
void |
setBucket(String bucket)
Set the bucket to be used.
|
void |
setFailureMode(String mode)
Set the failure mode if memcached buckets are used.
|
void |
setHost(String hosts)
Set the array of nodes from a delimited list of hosts.
|
void |
setNodes(URI[] nodes)
Set the nodes as an array of URIs.
|
void |
setObservePollInterval(int interval)
Set the observe poll interval in miliseconds.
|
void |
setObservePollMax(int max)
Set the maximum number of polls.
|
void |
setOpQueueMaxBlockTime(int time)
Set the operation queue maximum block time in miliseconds.
|
void |
setOpTimeout(int timeout)
Set the operation timeout in miliseconds.
|
void |
setPassword(String password)
Set the password.
|
void |
setReconnectThresholdTime(int time)
Set the reconnect threshold time in seconds.
|
void |
setViewTimeout(int timeout)
Set the view timeout in miliseconds.
|
DataAccessException |
translateExceptionIfPossible(RuntimeException ex)
Translate exception if possible.
|
public static final String DEFAULT_NODE
public static final String DEFAULT_BUCKET
public static final String DEFAULT_PASSWORD
public static final String DEFAULT_DESTROY_METHOD
public static final String DEFAULT_LOGGER_PROPERTY
public void setObservePollInterval(int interval)
interval - the observe poll interval.public void setObservePollMax(int max)
max - the maximum number of polls.public void setReconnectThresholdTime(int time)
time - the reconnect threshold time.public void setViewTimeout(int timeout)
timeout - the view timeout.public void setFailureMode(String mode)
FailureMode to use.mode - the failure mode.public void setOpTimeout(int timeout)
timeout - the operation timeout.public void setOpQueueMaxBlockTime(int time)
time - the operation queue maximum block time.public void destroy()
throws Exception
destroy in interface DisposableBeanException - if shutdown failed.public com.couchbase.client.CouchbaseClient getObject()
throws Exception
CouchbaseClient.getObject in interface FactoryBean<com.couchbase.client.CouchbaseClient>Exception - if returning the client failed.public Class<?> getObjectType()
getObjectType in interface FactoryBean<com.couchbase.client.CouchbaseClient>CouchbaseClient class.public boolean isSingleton()
isSingleton in interface FactoryBean<com.couchbase.client.CouchbaseClient>public void setBucket(String bucket)
bucket - the bucket to use.public void setPassword(String password)
password - the password to use.public void setHost(String hosts)
hosts - a comma separated list of hosts.public void setNodes(URI[] nodes)
nodes - the nodes to connect to.public void afterPropertiesSet()
throws Exception
CouchbaseClient.afterPropertiesSet in interface InitializingBeanException - if something goes wrong during instantiation.public DataAccessException translateExceptionIfPossible(RuntimeException ex)
translateExceptionIfPossible in interface PersistenceExceptionTranslatorex - the exception to translate.Copyright © 2011-2015–2016 Pivotal Software, Inc.. All rights reserved.