public class DefaultClusterManager extends Object implements ClusterManager
Constructor and Description |
---|
DefaultClusterManager(AsyncClusterManager asyncClusterManager,
String username,
String password,
CouchbaseEnvironment environment,
ClusterFacade core) |
Modifier and Type | Method and Description |
---|---|
ClusterApiClient |
apiClient()
Returns a new
ClusterApiClient to prepare and perform REST API synchronous requests on this cluster. |
AsyncClusterManager |
async()
Accesses the underlying
AsyncClusterManager to perform asynchronous operations on the cluster. |
static DefaultClusterManager |
create(String username,
String password,
ConnectionString connectionString,
CouchbaseEnvironment environment,
ClusterFacade core)
Deprecated.
|
static DefaultClusterManager |
create(String username,
String password,
List<ConnectionString.UnresolvedSocket> seedNodes,
CouchbaseEnvironment environment,
ClusterFacade core) |
BucketSettings |
getBucket(String name)
Returns the
BucketSettings for the Bucket identified by name with the default management timeout. |
BucketSettings |
getBucket(String name,
long timeout,
TimeUnit timeUnit)
Returns the
BucketSettings for the Bucket identified by name with a custom timeout. |
List<BucketSettings> |
getBuckets()
Returns a list of
BucketSettings for all available Bucket s with the default management timeout. |
List<BucketSettings> |
getBuckets(long timeout,
TimeUnit timeUnit)
Returns a list of
BucketSettings for all available Bucket s with a custom timeout. |
User |
getUser(AuthDomain domain,
String userid)
Get user info in Couchbase with default management timeout.
|
User |
getUser(AuthDomain domain,
String userid,
long timeout,
TimeUnit timeUnit)
Get user info in Couchbase with custom timeout.
|
List<User> |
getUsers(AuthDomain domain)
Get all users in Couchbase with default management timeout.
|
List<User> |
getUsers(AuthDomain domain,
long timeout,
TimeUnit timeUnit)
Get all users in Couchbase with a custom timeout.
|
Boolean |
hasBucket(String name)
Checks if the cluster has a
Bucket identified by the given name with the default management timeout. |
Boolean |
hasBucket(String name,
long timeout,
TimeUnit timeUnit)
Checks if the cluster has a
Bucket identified by the given name with a custom timeout. |
ClusterInfo |
info()
Provides information about the cluster with the default management timeout.
|
ClusterInfo |
info(long timeout,
TimeUnit timeUnit)
Provides information about the cluster with a custom timeout.
|
BucketSettings |
insertBucket(BucketSettings settings)
Inserts a
Bucket with its BucketSettings if it does not already exist with the default
management timeout. |
BucketSettings |
insertBucket(BucketSettings settings,
long timeout,
TimeUnit timeUnit)
Inserts a
Bucket with its BucketSettings if it does not already exist with a custom timeout. |
Boolean |
removeBucket(String name)
Removes a
Bucket identified by its name with the default management timeout. |
Boolean |
removeBucket(String name,
long timeout,
TimeUnit timeUnit)
Removes a
Bucket identified by its name with a custom timeout. |
Boolean |
removeUser(AuthDomain domain,
String username)
Removes a user identified by user name with the default management timeout.
|
Boolean |
removeUser(AuthDomain domain,
String username,
long timeout,
TimeUnit timeUnit)
Removes a user identified by user name with a custom timeout.
|
BucketSettings |
updateBucket(BucketSettings settings)
Updates a
Bucket with its BucketSettings if it does already exist with the default management
timeout. |
BucketSettings |
updateBucket(BucketSettings settings,
long timeout,
TimeUnit timeUnit)
Updates a
Bucket with its BucketSettings if it does already exist with a custom timeout. |
Boolean |
upsertUser(AuthDomain domain,
String username,
UserSettings settings)
Creates/Updates a user with its
UserSettings with default management timeout. |
Boolean |
upsertUser(AuthDomain domain,
String username,
UserSettings settings,
long timeout,
TimeUnit timeUnit)
Creates/Updates a user with its
UserSettings with custom timeout. |
public DefaultClusterManager(AsyncClusterManager asyncClusterManager, String username, String password, CouchbaseEnvironment environment, ClusterFacade core)
@Deprecated public static DefaultClusterManager create(String username, String password, ConnectionString connectionString, CouchbaseEnvironment environment, ClusterFacade core)
public static DefaultClusterManager create(String username, String password, List<ConnectionString.UnresolvedSocket> seedNodes, CouchbaseEnvironment environment, ClusterFacade core)
public AsyncClusterManager async()
ClusterManager
AsyncClusterManager
to perform asynchronous operations on the cluster.async
in interface ClusterManager
AsyncClusterManager
.public ClusterInfo info()
ClusterManager
info
in interface ClusterManager
ClusterInfo
object.public ClusterInfo info(long timeout, TimeUnit timeUnit)
ClusterManager
info
in interface ClusterManager
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.ClusterInfo
object.public List<BucketSettings> getBuckets()
ClusterManager
BucketSettings
for all available Bucket
s with the default management timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.getBuckets
in interface ClusterManager
BucketSettings
.public List<BucketSettings> getBuckets(long timeout, TimeUnit timeUnit)
ClusterManager
BucketSettings
for all available Bucket
s with a custom timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.getBuckets
in interface ClusterManager
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.BucketSettings
.public BucketSettings getBucket(String name)
ClusterManager
BucketSettings
for the Bucket
identified by name with the default management timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.getBucket
in interface ClusterManager
name
- the name of the bucket.BucketSettings
if found or null.public BucketSettings getBucket(String name, long timeout, TimeUnit timeUnit)
ClusterManager
BucketSettings
for the Bucket
identified by name with a custom timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.getBucket
in interface ClusterManager
name
- the name of the bucket.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.BucketSettings
if found or null.public Boolean hasBucket(String name)
ClusterManager
Bucket
identified by the given name with the default management timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.hasBucket
in interface ClusterManager
name
- the name of the bucket.public Boolean hasBucket(String name, long timeout, TimeUnit timeUnit)
ClusterManager
Bucket
identified by the given name with a custom timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.hasBucket
in interface ClusterManager
name
- the name of the bucket.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.public BucketSettings insertBucket(BucketSettings settings)
ClusterManager
Bucket
with its BucketSettings
if it does not already exist with the default
management timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.
- com.couchbase.client.java.error.BucketAlreadyExistsException: If the bucket already exists.
**Note:** Inserting a Bucket is an asynchronous operation on the server side, so even if the
response is returned there is no guarantee that the operation has finished on the server itself.insertBucket
in interface ClusterManager
settings
- the bucket settings that should be applied.public BucketSettings insertBucket(BucketSettings settings, long timeout, TimeUnit timeUnit)
ClusterManager
Bucket
with its BucketSettings
if it does not already exist with a custom timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.
- com.couchbase.client.java.error.BucketAlreadyExistsException: If the bucket already exists.
**Note:** Inserting a Bucket is an asynchronous operation on the server side, so even if the
response is returned there is no guarantee that the operation has finished on the server itself.insertBucket
in interface ClusterManager
settings
- the bucket settings that should be applied.public BucketSettings updateBucket(BucketSettings settings)
ClusterManager
Bucket
with its BucketSettings
if it does already exist with the default management
timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.
- com.couchbase.client.java.error.BucketDoesNotExistException: If the bucket does not exist.
**Note:** Updating a Bucket is an asynchronous operation on the server side, so even if the
response is returned there is no guarantee that the operation has finished on the server itself.updateBucket
in interface ClusterManager
settings
- the bucket settings that should be applied.public BucketSettings updateBucket(BucketSettings settings, long timeout, TimeUnit timeUnit)
ClusterManager
Bucket
with its BucketSettings
if it does already exist with a custom timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.
- com.couchbase.client.java.error.BucketDoesNotExistException: If the bucket does not exist.
**Note:** Updating a Bucket is an asynchronous operation on the server side, so even if the
response is returned there is no guarantee that the operation has finished on the server itself.updateBucket
in interface ClusterManager
settings
- the bucket settings that should be applied.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.public Boolean removeBucket(String name)
ClusterManager
Bucket
identified by its name with the default management timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.
**Note:** Removing a Bucket is an asynchronous operation on the server side, so even if the
response is returned there is no guarantee that the operation has finished on the server itself.removeBucket
in interface ClusterManager
name
- the name of the bucket.public Boolean removeBucket(String name, long timeout, TimeUnit timeUnit)
ClusterManager
Bucket
identified by its name with a custom timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
- com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.
**Note:** Removing a Bucket is an asynchronous operation on the server side, so even if the
response is returned there is no guarantee that the operation has finished on the server itself.removeBucket
in interface ClusterManager
name
- the name of the bucket.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.public Boolean upsertUser(AuthDomain domain, String username, UserSettings settings)
ClusterManager
UserSettings
with default management timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
**Note:** Updating a user is an asynchronous operation on the server side, so even if the
response is returned there is no guarantee that the operation has finished on the server itself.upsertUser
in interface ClusterManager
domain
- the authentication to use, most likely AuthDomain.LOCAL
username
- the user name of the user to be updatedsettings
- the user settings that should be applied.public Boolean upsertUser(AuthDomain domain, String username, UserSettings settings, long timeout, TimeUnit timeUnit)
ClusterManager
UserSettings
with custom timeout.
This method throws:
- java.util.concurrent.TimeoutException: If the timeout is exceeded.
- com.couchbase.client.core.CouchbaseException: If the underlying resources could not be enabled properly.
**Note:** Updating a user is an asynchronous operation on the server side, so even if the
response is returned there is no guarantee that the operation has finished on the server itself.upsertUser
in interface ClusterManager
domain
- the authentication to use, most likely AuthDomain.LOCAL
username
- the user name of the user to be updated.settings
- the user settings that should be applied.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.public Boolean removeUser(AuthDomain domain, String username)
ClusterManager
removeUser
in interface ClusterManager
domain
- the authentication to use, most likely AuthDomain.LOCAL
username
- the user name of the user to be deleted.public Boolean removeUser(AuthDomain domain, String username, long timeout, TimeUnit timeUnit)
ClusterManager
removeUser
in interface ClusterManager
domain
- the authentication to use, most likely AuthDomain.LOCAL
username
- the user name of the user to be deleted.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.public List<User> getUsers(AuthDomain domain)
ClusterManager
getUsers
in interface ClusterManager
public List<User> getUsers(AuthDomain domain, long timeout, TimeUnit timeUnit)
ClusterManager
getUsers
in interface ClusterManager
domain
- the authentication to use, most likely AuthDomain.LOCAL
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.public User getUser(AuthDomain domain, String userid)
ClusterManager
getUser
in interface ClusterManager
public User getUser(AuthDomain domain, String userid, long timeout, TimeUnit timeUnit)
ClusterManager
getUser
in interface ClusterManager
@InterfaceStability.Experimental public ClusterApiClient apiClient()
ClusterManager
ClusterApiClient
to prepare and perform REST API synchronous requests on this cluster.
The requests have a default timeout corresponding to the configured CouchbaseEnvironment.managementTimeout()
.apiClient
in interface ClusterManager
ClusterApiClient
.Copyright © 2015 Couchbase, Inc.