Class DefaultClusterManager
java.lang.Object
com.couchbase.client.java.cluster.DefaultClusterManager
- All Implemented Interfaces:
ClusterManager
public class DefaultClusterManager extends Object implements ClusterManager
-
Constructor Summary
Constructors Constructor Description DefaultClusterManager(AsyncClusterManager asyncClusterManager, String username, String password, CouchbaseEnvironment environment, ClusterFacade core)
-
Method Summary
Modifier and Type Method Description ClusterApiClient
apiClient()
Returns a newClusterApiClient
to prepare and perform REST API synchronous requests on this cluster.AsyncClusterManager
async()
Accesses the underlyingAsyncClusterManager
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 theBucketSettings
for theBucket
identified by name with the default management timeout.BucketSettings
getBucket(String name, long timeout, TimeUnit timeUnit)
Returns theBucketSettings
for theBucket
identified by name with a custom timeout.List<BucketSettings>
getBuckets()
Returns a list ofBucketSettings
for all availableBucket
s with the default management timeout.List<BucketSettings>
getBuckets(long timeout, TimeUnit timeUnit)
Returns a list ofBucketSettings
for all availableBucket
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 aBucket
identified by the given name with the default management timeout.Boolean
hasBucket(String name, long timeout, TimeUnit timeUnit)
Checks if the cluster has aBucket
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 aBucket
with itsBucketSettings
if it does not already exist with the default management timeout.BucketSettings
insertBucket(BucketSettings settings, long timeout, TimeUnit timeUnit)
Inserts aBucket
with itsBucketSettings
if it does not already exist with a custom timeout.Boolean
removeBucket(String name)
Removes aBucket
identified by its name with the default management timeout.Boolean
removeBucket(String name, long timeout, TimeUnit timeUnit)
Removes aBucket
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 aBucket
with itsBucketSettings
if it does already exist with the default management timeout.BucketSettings
updateBucket(BucketSettings settings, long timeout, TimeUnit timeUnit)
Updates aBucket
with itsBucketSettings
if it does already exist with a custom timeout.Boolean
upsertUser(AuthDomain domain, String username, UserSettings settings)
Creates/Updates a user with itsUserSettings
with default management timeout.Boolean
upsertUser(AuthDomain domain, String username, UserSettings settings, long timeout, TimeUnit timeUnit)
Creates/Updates a user with itsUserSettings
with custom timeout.
-
Constructor Details
-
DefaultClusterManager
public DefaultClusterManager(AsyncClusterManager asyncClusterManager, String username, String password, CouchbaseEnvironment environment, ClusterFacade core)
-
-
Method Details
-
create
@Deprecated public static DefaultClusterManager create(String username, String password, ConnectionString connectionString, CouchbaseEnvironment environment, ClusterFacade core)Deprecated. -
create
public static DefaultClusterManager create(String username, String password, List<ConnectionString.UnresolvedSocket> seedNodes, CouchbaseEnvironment environment, ClusterFacade core) -
async
Description copied from interface:ClusterManager
Accesses the underlyingAsyncClusterManager
to perform asynchronous operations on the cluster.- Specified by:
async
in interfaceClusterManager
- Returns:
- the underlying
AsyncClusterManager
.
-
info
Description copied from interface:ClusterManager
Provides information about the cluster 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.- Specified by:
info
in interfaceClusterManager
- Returns:
- cluster information wrapped into a
ClusterInfo
object.
-
info
Description copied from interface:ClusterManager
Provides information about the cluster 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.- Specified by:
info
in interfaceClusterManager
- Parameters:
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- cluster information wrapped into a
ClusterInfo
object.
-
getBuckets
Description copied from interface:ClusterManager
Returns a list ofBucketSettings
for all availableBucket
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.- Specified by:
getBuckets
in interfaceClusterManager
- Returns:
- a potentially empty list with
BucketSettings
.
-
getBuckets
Description copied from interface:ClusterManager
Returns a list ofBucketSettings
for all availableBucket
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.- Specified by:
getBuckets
in interfaceClusterManager
- Parameters:
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- a potentially empty list with
BucketSettings
.
-
getBucket
Description copied from interface:ClusterManager
Returns theBucketSettings
for theBucket
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.- Specified by:
getBucket
in interfaceClusterManager
- Parameters:
name
- the name of the bucket.- Returns:
- the
BucketSettings
if found or null.
-
getBucket
Description copied from interface:ClusterManager
Returns theBucketSettings
for theBucket
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.- Specified by:
getBucket
in interfaceClusterManager
- Parameters:
name
- the name of the bucket.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- the
BucketSettings
if found or null.
-
hasBucket
Description copied from interface:ClusterManager
Checks if the cluster has aBucket
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.- Specified by:
hasBucket
in interfaceClusterManager
- Parameters:
name
- the name of the bucket.- Returns:
- true if it was found, false otherwise.
-
hasBucket
Description copied from interface:ClusterManager
Checks if the cluster has aBucket
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.- Specified by:
hasBucket
in interfaceClusterManager
- Parameters:
name
- the name of the bucket.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- true if it was found, false otherwise.
-
insertBucket
Description copied from interface:ClusterManager
Inserts aBucket
with itsBucketSettings
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.- Specified by:
insertBucket
in interfaceClusterManager
- Parameters:
settings
- the bucket settings that should be applied.- Returns:
- the stored bucket settings if succeeded.
-
insertBucket
Description copied from interface:ClusterManager
Inserts aBucket
with itsBucketSettings
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.- Specified by:
insertBucket
in interfaceClusterManager
- Parameters:
settings
- the bucket settings that should be applied.- Returns:
- the stored bucket settings if succeeded.
-
updateBucket
Description copied from interface:ClusterManager
Updates aBucket
with itsBucketSettings
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.- Specified by:
updateBucket
in interfaceClusterManager
- Parameters:
settings
- the bucket settings that should be applied.- Returns:
- the updated bucket settings if succeeded.
-
updateBucket
Description copied from interface:ClusterManager
Updates aBucket
with itsBucketSettings
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.- Specified by:
updateBucket
in interfaceClusterManager
- Parameters:
settings
- the bucket settings that should be applied.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- the updated bucket settings if succeeded.
-
removeBucket
Description copied from interface:ClusterManager
Removes aBucket
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.- Specified by:
removeBucket
in interfaceClusterManager
- Parameters:
name
- the name of the bucket.- Returns:
- true if the removal was successful, false otherwise.
-
removeBucket
Description copied from interface:ClusterManager
Removes aBucket
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.- Specified by:
removeBucket
in interfaceClusterManager
- Parameters:
name
- the name of the bucket.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- true if the removal was successful, false otherwise.
-
upsertUser
Description copied from interface:ClusterManager
Creates/Updates a user with itsUserSettings
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.- Specified by:
upsertUser
in interfaceClusterManager
- Parameters:
domain
- the authentication to use, most likelyAuthDomain.LOCAL
username
- the user name of the user to be updatedsettings
- the user settings that should be applied.- Returns:
- true if succeeded.
-
upsertUser
public Boolean upsertUser(AuthDomain domain, String username, UserSettings settings, long timeout, TimeUnit timeUnit)Description copied from interface:ClusterManager
Creates/Updates a user with itsUserSettings
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.- Specified by:
upsertUser
in interfaceClusterManager
- Parameters:
domain
- the authentication to use, most likelyAuthDomain.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.- Returns:
- true if succeeded.
-
removeUser
Description copied from interface:ClusterManager
Removes a user identified by user 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. **Note:** Removing 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.- Specified by:
removeUser
in interfaceClusterManager
- Parameters:
domain
- the authentication to use, most likelyAuthDomain.LOCAL
username
- the user name of the user to be deleted.- Returns:
- true if the removal was successful, false otherwise.
-
removeUser
Description copied from interface:ClusterManager
Removes a user identified by user 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. **Note:** Removing 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.- Specified by:
removeUser
in interfaceClusterManager
- Parameters:
domain
- the authentication to use, most likelyAuthDomain.LOCAL
username
- the user name of the user to be deleted.timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- true if the removal was successful, false otherwise.
-
getUsers
Description copied from interface:ClusterManager
Get all users in Couchbase 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. - com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.- Specified by:
getUsers
in interfaceClusterManager
- Returns:
- users the list of users.
-
getUsers
Description copied from interface:ClusterManager
Get all users in Couchbase 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.- Specified by:
getUsers
in interfaceClusterManager
- Parameters:
domain
- the authentication to use, most likelyAuthDomain.LOCAL
timeout
- the custom timeout.timeUnit
- the time unit for the custom timeout.- Returns:
- users the list of users.
-
getUser
Description copied from interface:ClusterManager
Get user info in Couchbase 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. - com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.- Specified by:
getUser
in interfaceClusterManager
- Returns:
- user info
-
getUser
Description copied from interface:ClusterManager
Get user info in Couchbase 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. - com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.- Specified by:
getUser
in interfaceClusterManager
- Returns:
- user info
-
apiClient
Description copied from interface:ClusterManager
Returns a newClusterApiClient
to prepare and perform REST API synchronous requests on this cluster. The requests have a default timeout corresponding to the configuredCouchbaseEnvironment.managementTimeout()
.- Specified by:
apiClient
in interfaceClusterManager
- Returns:
- a new
ClusterApiClient
.
-