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
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ClusterApiClientapiClient()Returns a newClusterApiClientto prepare and perform REST API synchronous requests on this cluster.AsyncClusterManagerasync()Accesses the underlyingAsyncClusterManagerto perform asynchronous operations on the cluster.static DefaultClusterManagercreate(String username, String password, ConnectionString connectionString, CouchbaseEnvironment environment, ClusterFacade core)Deprecated.static DefaultClusterManagercreate(String username, String password, List<ConnectionString.UnresolvedSocket> seedNodes, CouchbaseEnvironment environment, ClusterFacade core)BucketSettingsgetBucket(String name)Returns theBucketSettingsfor theBucketidentified by name with the default management timeout.BucketSettingsgetBucket(String name, long timeout, TimeUnit timeUnit)Returns theBucketSettingsfor theBucketidentified by name with a custom timeout.List<BucketSettings>getBuckets()Returns a list ofBucketSettingsfor all availableBuckets with the default management timeout.List<BucketSettings>getBuckets(long timeout, TimeUnit timeUnit)Returns a list ofBucketSettingsfor all availableBuckets with a custom timeout.UsergetUser(AuthDomain domain, String userid)Get user info in Couchbase with default management timeout.UsergetUser(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.BooleanhasBucket(String name)Checks if the cluster has aBucketidentified by the given name with the default management timeout.BooleanhasBucket(String name, long timeout, TimeUnit timeUnit)Checks if the cluster has aBucketidentified by the given name with a custom timeout.ClusterInfoinfo()Provides information about the cluster with the default management timeout.ClusterInfoinfo(long timeout, TimeUnit timeUnit)Provides information about the cluster with a custom timeout.BucketSettingsinsertBucket(BucketSettings settings)Inserts aBucketwith itsBucketSettingsif it does not already exist with the default management timeout.BucketSettingsinsertBucket(BucketSettings settings, long timeout, TimeUnit timeUnit)Inserts aBucketwith itsBucketSettingsif it does not already exist with a custom timeout.BooleanremoveBucket(String name)Removes aBucketidentified by its name with the default management timeout.BooleanremoveBucket(String name, long timeout, TimeUnit timeUnit)Removes aBucketidentified by its name with a custom timeout.BooleanremoveUser(AuthDomain domain, String username)Removes a user identified by user name with the default management timeout.BooleanremoveUser(AuthDomain domain, String username, long timeout, TimeUnit timeUnit)Removes a user identified by user name with a custom timeout.BucketSettingsupdateBucket(BucketSettings settings)Updates aBucketwith itsBucketSettingsif it does already exist with the default management timeout.BucketSettingsupdateBucket(BucketSettings settings, long timeout, TimeUnit timeUnit)Updates aBucketwith itsBucketSettingsif it does already exist with a custom timeout.BooleanupsertUser(AuthDomain domain, String username, UserSettings settings)Creates/Updates a user with itsUserSettingswith default management timeout.BooleanupsertUser(AuthDomain domain, String username, UserSettings settings, long timeout, TimeUnit timeUnit)Creates/Updates a user with itsUserSettingswith custom timeout.
-
-
-
Constructor Detail
-
DefaultClusterManager
public DefaultClusterManager(AsyncClusterManager asyncClusterManager, String username, String password, CouchbaseEnvironment environment, ClusterFacade core)
-
-
Method Detail
-
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
public AsyncClusterManager async()
Description copied from interface:ClusterManagerAccesses the underlyingAsyncClusterManagerto perform asynchronous operations on the cluster.- Specified by:
asyncin interfaceClusterManager- Returns:
- the underlying
AsyncClusterManager.
-
info
public ClusterInfo info()
Description copied from interface:ClusterManagerProvides 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:
infoin interfaceClusterManager- Returns:
- cluster information wrapped into a
ClusterInfoobject.
-
info
public ClusterInfo info(long timeout, TimeUnit timeUnit)
Description copied from interface:ClusterManagerProvides 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:
infoin interfaceClusterManager- Parameters:
timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- cluster information wrapped into a
ClusterInfoobject.
-
getBuckets
public List<BucketSettings> getBuckets()
Description copied from interface:ClusterManagerReturns a list ofBucketSettingsfor all availableBuckets 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:
getBucketsin interfaceClusterManager- Returns:
- a potentially empty list with
BucketSettings.
-
getBuckets
public List<BucketSettings> getBuckets(long timeout, TimeUnit timeUnit)
Description copied from interface:ClusterManagerReturns a list ofBucketSettingsfor all availableBuckets 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:
getBucketsin interfaceClusterManager- Parameters:
timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- a potentially empty list with
BucketSettings.
-
getBucket
public BucketSettings getBucket(String name)
Description copied from interface:ClusterManagerReturns theBucketSettingsfor theBucketidentified 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:
getBucketin interfaceClusterManager- Parameters:
name- the name of the bucket.- Returns:
- the
BucketSettingsif found or null.
-
getBucket
public BucketSettings getBucket(String name, long timeout, TimeUnit timeUnit)
Description copied from interface:ClusterManagerReturns theBucketSettingsfor theBucketidentified 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:
getBucketin interfaceClusterManager- Parameters:
name- the name of the bucket.timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- the
BucketSettingsif found or null.
-
hasBucket
public Boolean hasBucket(String name)
Description copied from interface:ClusterManagerChecks if the cluster has aBucketidentified 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:
hasBucketin interfaceClusterManager- Parameters:
name- the name of the bucket.- Returns:
- true if it was found, false otherwise.
-
hasBucket
public Boolean hasBucket(String name, long timeout, TimeUnit timeUnit)
Description copied from interface:ClusterManagerChecks if the cluster has aBucketidentified 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:
hasBucketin 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
public BucketSettings insertBucket(BucketSettings settings)
Description copied from interface:ClusterManagerInserts aBucketwith itsBucketSettingsif 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:
insertBucketin interfaceClusterManager- Parameters:
settings- the bucket settings that should be applied.- Returns:
- the stored bucket settings if succeeded.
-
insertBucket
public BucketSettings insertBucket(BucketSettings settings, long timeout, TimeUnit timeUnit)
Description copied from interface:ClusterManagerInserts aBucketwith itsBucketSettingsif 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:
insertBucketin interfaceClusterManager- Parameters:
settings- the bucket settings that should be applied.- Returns:
- the stored bucket settings if succeeded.
-
updateBucket
public BucketSettings updateBucket(BucketSettings settings)
Description copied from interface:ClusterManagerUpdates aBucketwith itsBucketSettingsif 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:
updateBucketin interfaceClusterManager- Parameters:
settings- the bucket settings that should be applied.- Returns:
- the updated bucket settings if succeeded.
-
updateBucket
public BucketSettings updateBucket(BucketSettings settings, long timeout, TimeUnit timeUnit)
Description copied from interface:ClusterManagerUpdates aBucketwith itsBucketSettingsif 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:
updateBucketin 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
public Boolean removeBucket(String name)
Description copied from interface:ClusterManagerRemoves aBucketidentified 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:
removeBucketin interfaceClusterManager- Parameters:
name- the name of the bucket.- Returns:
- true if the removal was successful, false otherwise.
-
removeBucket
public Boolean removeBucket(String name, long timeout, TimeUnit timeUnit)
Description copied from interface:ClusterManagerRemoves aBucketidentified 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:
removeBucketin 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
public Boolean upsertUser(AuthDomain domain, String username, UserSettings settings)
Description copied from interface:ClusterManagerCreates/Updates a user with itsUserSettingswith 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:
upsertUserin interfaceClusterManager- Parameters:
domain- the authentication to use, most likelyAuthDomain.LOCALusername- 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:ClusterManagerCreates/Updates a user with itsUserSettingswith 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:
upsertUserin interfaceClusterManager- Parameters:
domain- the authentication to use, most likelyAuthDomain.LOCALusername- 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
public Boolean removeUser(AuthDomain domain, String username)
Description copied from interface:ClusterManagerRemoves 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:
removeUserin interfaceClusterManager- Parameters:
domain- the authentication to use, most likelyAuthDomain.LOCALusername- the user name of the user to be deleted.- Returns:
- true if the removal was successful, false otherwise.
-
removeUser
public Boolean removeUser(AuthDomain domain, String username, long timeout, TimeUnit timeUnit)
Description copied from interface:ClusterManagerRemoves 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:
removeUserin interfaceClusterManager- Parameters:
domain- the authentication to use, most likelyAuthDomain.LOCALusername- 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
public List<User> getUsers(AuthDomain domain)
Description copied from interface:ClusterManagerGet 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:
getUsersin interfaceClusterManager- Returns:
- users the list of users.
-
getUsers
public List<User> getUsers(AuthDomain domain, long timeout, TimeUnit timeUnit)
Description copied from interface:ClusterManagerGet 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:
getUsersin interfaceClusterManager- Parameters:
domain- the authentication to use, most likelyAuthDomain.LOCALtimeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- users the list of users.
-
getUser
public User getUser(AuthDomain domain, String userid)
Description copied from interface:ClusterManagerGet 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:
getUserin interfaceClusterManager- Returns:
- user info
-
getUser
public User getUser(AuthDomain domain, String userid, long timeout, TimeUnit timeUnit)
Description copied from interface:ClusterManagerGet 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:
getUserin interfaceClusterManager- Returns:
- user info
-
apiClient
@Experimental public ClusterApiClient apiClient()
Description copied from interface:ClusterManagerReturns a newClusterApiClientto prepare and perform REST API synchronous requests on this cluster. The requests have a default timeout corresponding to the configuredCouchbaseEnvironment.managementTimeout().- Specified by:
apiClientin interfaceClusterManager- Returns:
- a new
ClusterApiClient.
-
-