Package com.couchbase.client.java.bucket
Class DefaultBucketManager
java.lang.Object
com.couchbase.client.java.bucket.DefaultBucketManager
- All Implemented Interfaces:
BucketManager
public class DefaultBucketManager extends Object implements BucketManager
-
Method Summary
Modifier and Type Method Description AsyncBucketManagerasync()Returns the underlyingAsyncBucketManagerfor asynchronous execution.List<String>buildN1qlDeferredIndexes()Instruct the query engine to trigger the build of indexes that have been deferred, within the default management timeout.List<String>buildN1qlDeferredIndexes(long timeout, TimeUnit timeUnit)Instruct the query engine to trigger the build of indexes that have been deferred, within a custom timeout.static DefaultBucketManagercreate(CouchbaseEnvironment environment, String bucket, String password, ClusterFacade core)static DefaultBucketManagercreate(CouchbaseEnvironment environment, String bucket, String username, String password, ClusterFacade core)booleancreateN1qlIndex(String indexName, boolean ignoreIfExist, boolean defer, Object... fields)Create a secondary index for the current bucket, with the default management timeout.booleancreateN1qlIndex(String indexName, List<Object> fields, Expression whereClause, boolean ignoreIfExist, boolean defer)Create a secondary index for the current bucket, with the default management timeout.booleancreateN1qlIndex(String indexName, List<Object> fields, Expression whereClause, boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)Create a secondary index for the current bucket, with a custom timeout.booleancreateN1qlPrimaryIndex(boolean ignoreIfExist, boolean defer)Create a primary index for the current bucket, within the default management timeout.booleancreateN1qlPrimaryIndex(boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)Create a primary index for the current bucket, within a custom timeout.booleancreateN1qlPrimaryIndex(String customName, boolean ignoreIfExist, boolean defer)Create a custom-named primary index for the current bucket, within the default management timeout.booleancreateN1qlPrimaryIndex(String customName, boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)Create a custom-named primary index for the current bucket, within a custom timeout.booleandropN1qlIndex(String name, boolean ignoreIfNotExist)Drop the given secondary index associated with the current bucket, within the default management timeout.booleandropN1qlIndex(String name, boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)Drop the given secondary index associated with the current bucket, within a custom timeout.booleandropN1qlPrimaryIndex(boolean ignoreIfNotExist)Drop the default primary index (Index.PRIMARY_NAME) associated with the current bucket, within the default management timeout.booleandropN1qlPrimaryIndex(boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)Drop the default primary index (Index.PRIMARY_NAME) associated with the current bucket, within a custom timeout.booleandropN1qlPrimaryIndex(String customName, boolean ignoreIfNotExist)Drop the given custom-named primary index associated with the current bucket, within the default management timeout.booleandropN1qlPrimaryIndex(String customName, boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)Drop the given custom-named primary index associated with the current bucket, within a custom timeout.Booleanflush()Flushes the bucket (removes all data) with the default management timeout.Booleanflush(long timeout, TimeUnit timeUnit)Flushes the bucket (removes all data) with a custom timeout.DesignDocumentgetDesignDocument(String name)Loads a publishedDesignDocumentby its name with the default management timeout.DesignDocumentgetDesignDocument(String name, boolean development)Loads aDesignDocumentby its name from either development or production with the default management timeout.DesignDocumentgetDesignDocument(String name, boolean development, long timeout, TimeUnit timeUnit)Loads aDesignDocuments by its name from either development or production with a custom timeout.DesignDocumentgetDesignDocument(String name, long timeout, TimeUnit timeUnit)Loads a publishedDesignDocumentby its name with the a custom timeout.List<DesignDocument>getDesignDocuments()Loads all publishedDesignDocuments with the default management timeout.List<DesignDocument>getDesignDocuments(boolean development)Loads allDesignDocuments from either development or production with the default management timeout.List<DesignDocument>getDesignDocuments(boolean development, long timeout, TimeUnit timeUnit)Loads allDesignDocuments from either development or production with a custom timeout.List<DesignDocument>getDesignDocuments(long timeout, TimeUnit timeUnit)Loads all publishedDesignDocuments with a custom timeout.BucketInfoinfo()Returns information about the connected bucket with the default management timeout.BucketInfoinfo(long timeout, TimeUnit timeUnit)Returns information about the connected bucket with a custom timeout.DesignDocumentinsertDesignDocument(DesignDocument designDocument)Inserts aDesignDocumentinto production if it does not exist with the default management timeout.DesignDocumentinsertDesignDocument(DesignDocument designDocument, boolean development)Inserts aDesignDocumentinto development or production if it does not exist with the default management timeout.DesignDocumentinsertDesignDocument(DesignDocument designDocument, boolean development, long timeout, TimeUnit timeUnit)Inserts aDesignDocumentinto development or production if it does not exist with a custom timeout.DesignDocumentinsertDesignDocument(DesignDocument designDocument, long timeout, TimeUnit timeUnit)Inserts aDesignDocumentinto production if it does not exist with a custom timeout.List<IndexInfo>listN1qlIndexes()List all N1QL GSI indexes that are registered for the current bucket, with the default management timeout.List<IndexInfo>listN1qlIndexes(long timeout, TimeUnit timeUnit)List all N1QL GSI indexes that are registered for the current bucket, with a custom timeout.DesignDocumentpublishDesignDocument(String name)Publishes aDesignDocumentfrom development into production with the default management timeout.DesignDocumentpublishDesignDocument(String name, boolean overwrite)Publishes aDesignDocumentfrom development into production with the default management timeout.DesignDocumentpublishDesignDocument(String name, boolean overwrite, long timeout, TimeUnit timeUnit)Publishes aDesignDocumentfrom development into production with a custom timeout.DesignDocumentpublishDesignDocument(String name, long timeout, TimeUnit timeUnit)Publishes aDesignDocumentfrom development into production with a custom timeout.BooleanremoveDesignDocument(String name)Removes aDesignDocumentfrom production by its name with the default management timeout.BooleanremoveDesignDocument(String name, boolean development)Removes aDesignDocumentfrom production or development by its name with the default management timeout.BooleanremoveDesignDocument(String name, boolean development, long timeout, TimeUnit timeUnit)Removes aDesignDocumentfrom production or development by its name with a custom timeout.BooleanremoveDesignDocument(String name, long timeout, TimeUnit timeUnit)Removes aDesignDocumentfrom production by its name with a custom timeout.DesignDocumentupsertDesignDocument(DesignDocument designDocument)Upserts (inserts or replaces) aDesignDocumentinto production with the default management timeout.DesignDocumentupsertDesignDocument(DesignDocument designDocument, boolean development)Upserts (inserts or replaces) aDesignDocumentinto production or development with the default management timeout.DesignDocumentupsertDesignDocument(DesignDocument designDocument, boolean development, long timeout, TimeUnit timeUnit)Upserts (inserts or replaces) aDesignDocumentinto production or development with a custom timeout.DesignDocumentupsertDesignDocument(DesignDocument designDocument, long timeout, TimeUnit timeUnit)Upserts (inserts or replaces) aDesignDocumentinto production with a custom timeout.List<IndexInfo>watchN1qlIndexes(List<String> watchList, long watchTimeout, TimeUnit watchTimeUnit)Watches all given indexes (possibly including the primary one), polling the query service until they become "online" or the watchTimeout has expired.
-
Method Details
-
create
public static DefaultBucketManager create(CouchbaseEnvironment environment, String bucket, String password, ClusterFacade core) -
create
public static DefaultBucketManager create(CouchbaseEnvironment environment, String bucket, String username, String password, ClusterFacade core) -
async
Description copied from interface:BucketManagerReturns the underlyingAsyncBucketManagerfor asynchronous execution.- Specified by:
asyncin interfaceBucketManager- Returns:
- the underlying bucket manager.
-
info
Description copied from interface:BucketManagerReturns information about the connected bucket with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be decoded.- Specified by:
infoin interfaceBucketManager- Returns:
- bucket information wrapped in a
BucketInfo.
-
flush
Description copied from interface:BucketManagerFlushes the bucket (removes all data) with the default management timeout. Note that flushing takes some time on the server to be performed properly, so do not set a too low timeout. Also, flush needs to be enabled on the bucket, otherwise an exception will be raised. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.FlushDisabledException: If flush is disabled. - com.couchbase.client.core.CouchbaseException: If the server response could not be parsed.- Specified by:
flushin interfaceBucketManager- Returns:
- true if the bucket was flushed, an exception thrown if otherwise.
-
getDesignDocuments
Description copied from interface:BucketManagerLoads all publishedDesignDocuments with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Specified by:
getDesignDocumentsin interfaceBucketManager- Returns:
- a potentially empty list containing published
DesignDocuments.
-
getDesignDocuments
Description copied from interface:BucketManagerLoads allDesignDocuments from either development or production with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Specified by:
getDesignDocumentsin interfaceBucketManager- Parameters:
development- ifDesignDocuments should be loaded from development or from production.- Returns:
- a potentially empty list containing published
DesignDocuments.
-
getDesignDocument
Description copied from interface:BucketManagerLoads a publishedDesignDocumentby its name with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocumentis not found.- Specified by:
getDesignDocumentin interfaceBucketManager- Parameters:
name- the name of theDesignDocument.- Returns:
- a
DesignDocumentif found.
-
getDesignDocument
Description copied from interface:BucketManagerLoads aDesignDocumentby its name from either development or production with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocumentis not found.- Specified by:
getDesignDocumentin interfaceBucketManager- Parameters:
name- the name of theDesignDocument.development- ifDesignDocumentshould be loaded from development or from production.- Returns:
- a
DesignDocumentif found.
-
insertDesignDocument
Description copied from interface:BucketManagerInserts aDesignDocumentinto production if it does not exist with the default management timeout. Note that inserting aDesignDocumentis not an atomic operation, but instead internally performs aBucketManager.getDesignDocument(String)operation first. While expected to be very uncommon, a race condition may happen if two users at the same time perform this operation with the sameDesignDocument. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocumentexists.- Specified by:
insertDesignDocumentin interfaceBucketManager- Parameters:
designDocument- theDesignDocumentto insert.- Returns:
- the inserted
DesignDocumenton success.
-
insertDesignDocument
Description copied from interface:BucketManagerInserts aDesignDocumentinto development or production if it does not exist with the default management timeout. Note that inserting aDesignDocumentis not an atomic operation, but instead internally performs aBucketManager.getDesignDocument(String)operation first. While expected to be very uncommon, a race condition may happen if two users at the same time perform this operation with the sameDesignDocument. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocumentexists.- Specified by:
insertDesignDocumentin interfaceBucketManager- Parameters:
designDocument- theDesignDocumentto insert.development- if it should be inserted into development or production (published).- Returns:
- the inserted
DesignDocumenton success.
-
upsertDesignDocument
Description copied from interface:BucketManagerUpserts (inserts or replaces) aDesignDocumentinto production with the default management timeout. If you want to add or update view definitions to an existing design document, you need to make sure you have all the views (including old ones) in the DesignDocument. UseBucketManager.getDesignDocument(String)to get the old list and add your new view to it before calling this method. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Specified by:
upsertDesignDocumentin interfaceBucketManager- Parameters:
designDocument- theDesignDocumentto upsert.- Returns:
- the upserted
DesignDocumenton success.
-
upsertDesignDocument
Description copied from interface:BucketManagerUpserts (inserts or replaces) aDesignDocumentinto production or development with the default management timeout. If you want to add or update view definitions to an existing design document, you need to make sure you have all the views (including old ones) in the DesignDocument. UseBucketManager.getDesignDocument(String)to get the old list and add your new view to it before calling this method. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Specified by:
upsertDesignDocumentin interfaceBucketManager- Parameters:
designDocument- theDesignDocumentto upsert.development- if theDesignDocumentshould be upserted into development or production.- Returns:
- the upserted
DesignDocumenton success.
-
removeDesignDocument
Description copied from interface:BucketManagerRemoves aDesignDocumentfrom production by its name with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocumentis not found.- Specified by:
removeDesignDocumentin interfaceBucketManager- Parameters:
name- the name of theDesignDocument.- Returns:
- true if succeeded, false otherwise.
-
removeDesignDocument
Description copied from interface:BucketManagerRemoves aDesignDocumentfrom production or development by its name with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocumentis not found.- Specified by:
removeDesignDocumentin interfaceBucketManager- Parameters:
name- the name of theDesignDocument.development- if theDesignDocumentshould be removed from development or production.- Returns:
- true if succeeded, false otherwise.
-
publishDesignDocument
Description copied from interface:BucketManagerPublishes aDesignDocumentfrom development into production with the default management timeout. Note that this method does not override a already existingDesignDocument(seeBucketManager.publishDesignDocument(String, boolean)) as an alternative. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocumentalready exists. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocumentis not found in development.- Specified by:
publishDesignDocumentin interfaceBucketManager- Parameters:
name- the name of theDesignDocumentto publish.- Returns:
- the published
DesignDocumenton success.
-
publishDesignDocument
Description copied from interface:BucketManagerPublishes aDesignDocumentfrom development into production with the default management timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocumentalready exists and override is set to false. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocumentis not found in development.- Specified by:
publishDesignDocumentin interfaceBucketManager- Parameters:
name- the name of theDesignDocumentto publish.overwrite- if an existingDesignDocumentshould be overridden.- Returns:
- the published
DesignDocumenton success.
-
info
Description copied from interface:BucketManagerReturns information about the connected bucket with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Specified by:
infoin interfaceBucketManager- Parameters:
timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- bucket information wrapped in a
BucketInfo.
-
flush
Description copied from interface:BucketManagerFlushes the bucket (removes all data) with a custom timeout. Note that flushing takes some time on the server to be performed properly, so do not set a too low timeout. Also, flush needs to be enabled on the bucket, otherwise an exception will be raised. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.FlushDisabledException: If flush is disabled. - com.couchbase.client.core.CouchbaseException: If the server response could not be parsed.- Specified by:
flushin interfaceBucketManager- Parameters:
timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- true if the bucket was flushed, an exception thrown if otherwise.
-
getDesignDocuments
Description copied from interface:BucketManagerLoads all publishedDesignDocuments with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Specified by:
getDesignDocumentsin interfaceBucketManager- Parameters:
timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- a potentially empty list containing published
DesignDocuments.
-
getDesignDocuments
public List<DesignDocument> getDesignDocuments(boolean development, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerLoads allDesignDocuments from either development or production with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Specified by:
getDesignDocumentsin interfaceBucketManager- Parameters:
development- ifDesignDocuments should be loaded from development or from production.timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- a potentially empty list containing published
DesignDocuments.
-
getDesignDocument
Description copied from interface:BucketManagerLoads a publishedDesignDocumentby its name with the a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocumentis not found.- Specified by:
getDesignDocumentin interfaceBucketManager- Parameters:
name- the name of theDesignDocument.timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- a
DesignDocumentif found.
-
getDesignDocument
public DesignDocument getDesignDocument(String name, boolean development, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerLoads aDesignDocuments by its name from either development or production with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocumentis not found.- Specified by:
getDesignDocumentin interfaceBucketManager- Parameters:
name- the name of theDesignDocument.development- ifDesignDocumentshould be loaded from development or from production.timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- a
DesignDocumentif found.
-
insertDesignDocument
public DesignDocument insertDesignDocument(DesignDocument designDocument, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerInserts aDesignDocumentinto production if it does not exist with a custom timeout. Note that inserting aDesignDocumentis not an atomic operation, but instead internally performs aBucketManager.getDesignDocument(String)operation first. While expected to be very uncommon, a race condition may happen if two users at the same time perform this operation with the sameDesignDocument. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocumentexists.- Specified by:
insertDesignDocumentin interfaceBucketManager- Parameters:
designDocument- theDesignDocumentto insert.timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- the inserted
DesignDocumenton success.
-
insertDesignDocument
public DesignDocument insertDesignDocument(DesignDocument designDocument, boolean development, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerInserts aDesignDocumentinto development or production if it does not exist with a custom timeout. Note that inserting aDesignDocumentis not an atomic operation, but instead internally performs aBucketManager.getDesignDocument(String)operation first. While expected to be very uncommon, a race condition may happen if two users at the same time perform this operation with the sameDesignDocument. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocumentexists.- Specified by:
insertDesignDocumentin interfaceBucketManager- Parameters:
designDocument- theDesignDocumentto insert.development- if it should be inserted into development or production (published).timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- the inserted
DesignDocumenton success.
-
upsertDesignDocument
public DesignDocument upsertDesignDocument(DesignDocument designDocument, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerUpserts (inserts or replaces) aDesignDocumentinto production with a custom timeout. If you want to add or update view definitions to an existing design document, you need to make sure you have all the views (including old ones) in the DesignDocument. UseBucketManager.getDesignDocument(String)to get the old list and add your new view to it before calling this method. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Specified by:
upsertDesignDocumentin interfaceBucketManager- Parameters:
designDocument- theDesignDocumentto upsert.timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- the upserted
DesignDocumenton success.
-
upsertDesignDocument
public DesignDocument upsertDesignDocument(DesignDocument designDocument, boolean development, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerUpserts (inserts or replaces) aDesignDocumentinto production or development with a custom timeout. If you want to add or update view definitions to an existing design document, you need to make sure you have all the views (including old ones) in the DesignDocument. UseBucketManager.getDesignDocument(String)to get the old list and add your new view to it before calling this method. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed.- Specified by:
upsertDesignDocumentin interfaceBucketManager- Parameters:
designDocument- theDesignDocumentto upsert.development- if theDesignDocumentshould be upserted into development or production.timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- the upserted
DesignDocumenton success.
-
removeDesignDocument
Description copied from interface:BucketManagerRemoves aDesignDocumentfrom production by its name with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocumentis not found.- Specified by:
removeDesignDocumentin interfaceBucketManager- Parameters:
name- the name of theDesignDocument.timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- true if succeeded, false otherwise.
-
removeDesignDocument
public Boolean removeDesignDocument(String name, boolean development, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerRemoves aDesignDocumentfrom production or development by its name with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocumentis not found.- Specified by:
removeDesignDocumentin interfaceBucketManager- Parameters:
name- the name of theDesignDocument.development- if theDesignDocumentshould be removed from development or production.timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- true if succeeded, false otherwise.
-
publishDesignDocument
Description copied from interface:BucketManagerPublishes aDesignDocumentfrom development into production with a custom timeout. Note that this method does not override a already existingDesignDocument(seeBucketManager.publishDesignDocument(String, boolean)) as an alternative. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocumentalready exists. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocumentis not found in development.- Specified by:
publishDesignDocumentin interfaceBucketManager- Parameters:
name- the name of theDesignDocumentto publish.timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- the published
DesignDocumenton success.
-
publishDesignDocument
public DesignDocument publishDesignDocument(String name, boolean overwrite, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerPublishes aDesignDocumentfrom development into production with a custom timeout. This method throws: - java.util.concurrent.TimeoutException: If the timeout is exceeded. - com.couchbase.client.java.error.DesignDocumentAlreadyExistsException: If theDesignDocumentalready exists and override is set to false. - com.couchbase.client.java.error.TranscodingException: If the server response could not be parsed. - com.couchbase.client.java.error.DesignDocumentDoesNotExistException: IfDesignDocumentis not found in development.- Specified by:
publishDesignDocumentin interfaceBucketManager- Parameters:
name- the name of theDesignDocumentto publish.overwrite- if an existingDesignDocumentshould be overridden.timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- the published
DesignDocumenton success.
-
listN1qlIndexes
Description copied from interface:BucketManagerList all N1QL GSI indexes that are registered for the current bucket, with the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Specified by:
listN1qlIndexesin interfaceBucketManager- Returns:
- a List containing each relevant
IndexInfo(can be empty if no index is defined for this bucket).
-
listN1qlIndexes
Description copied from interface:BucketManagerList all N1QL GSI indexes that are registered for the current bucket, with a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Specified by:
listN1qlIndexesin interfaceBucketManager- Parameters:
timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- a List containing each relevant
IndexInfo(can be empty if no index is defined for this bucket).
-
createN1qlPrimaryIndex
public boolean createN1qlPrimaryIndex(boolean ignoreIfExist, boolean defer)Description copied from interface:BucketManagerCreate a primary index for the current bucket, within the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Specified by:
createN1qlPrimaryIndexin interfaceBucketManager- Parameters:
ignoreIfExist- if a primary index already exists, an exception will be thrown unless this is set to true.defer- true to defer building of the index untilBucketManager.buildN1qlDeferredIndexes()is called (or a direct call to the corresponding query service API).- Returns:
- true if the index was effectively created, (even in deferred mode) or false if the index existed and ignoreIfExist is true.
-
createN1qlPrimaryIndex
public boolean createN1qlPrimaryIndex(boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerCreate a primary index for the current bucket, within a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Specified by:
createN1qlPrimaryIndexin interfaceBucketManager- Parameters:
ignoreIfExist- if a primary index already exists, an exception will be thrown unless this is set to true.defer- true to defer building of the index untilBucketManager.buildN1qlDeferredIndexes()is called (or a direct call to the corresponding query service API).timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- true if the index was effectively created, (even in deferred mode) or false if the index existed and ignoreIfExist is true.
-
createN1qlPrimaryIndex
Description copied from interface:BucketManagerCreate a custom-named primary index for the current bucket, within the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Specified by:
createN1qlPrimaryIndexin interfaceBucketManager- Parameters:
customName- the custom name for the primary index.ignoreIfExist- if a primary index already exists, an exception will be thrown unless this is set to true.defer- true to defer building of the index untilBucketManager.buildN1qlDeferredIndexes()is called (or a direct call to the corresponding query service API).- Returns:
- true if the index was effectively created, (even in deferred mode) or false if the index existed and ignoreIfExist is true.
-
createN1qlPrimaryIndex
public boolean createN1qlPrimaryIndex(String customName, boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerCreate a custom-named primary index for the current bucket, within a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Specified by:
createN1qlPrimaryIndexin interfaceBucketManager- Parameters:
customName- the custom name for the primary index.ignoreIfExist- if a primary index already exists, an exception will be thrown unless this is set to true.defer- true to defer building of the index untilBucketManager.buildN1qlDeferredIndexes()is called (or a direct call to the corresponding query service API).timeout- the custom timeout.timeUnit- the time unit for the custom timeout.- Returns:
- true if the index was effectively created, (even in deferred mode) or false if the index existed and ignoreIfExist is true.
-
createN1qlIndex
public boolean createN1qlIndex(String indexName, boolean ignoreIfExist, boolean defer, Object... fields)Description copied from interface:BucketManagerCreate a secondary index for the current bucket, with the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name. This method allows to define fields of the index as a vararg, for convenience (actually acceptingExpressionorString), but has the limitation that a WHERE clause cannot be set.- Specified by:
createN1qlIndexin interfaceBucketManager- Parameters:
indexName- the name of the index.ignoreIfExist- if a secondary index already exists with that name, an exception will be thrown unless this is set to true.defer- true to defer building of the index untilBucketManager.buildN1qlDeferredIndexes()is called (or a direct call to the corresponding query service API).fields- the JSON fields to index, in eitherExpressionorStringform.- Returns:
- true if the index was effectively created (even in deferred mode) or false if the index existed and ignoreIfExist is true.
- See Also:
BucketManager.createN1qlIndex(String, List, Expression, boolean, boolean)
-
createN1qlIndex
public boolean createN1qlIndex(String indexName, List<Object> fields, Expression whereClause, boolean ignoreIfExist, boolean defer)Description copied from interface:BucketManagerCreate a secondary index for the current bucket, with the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name. This method allows to define fields of the index as a List, as well as an additionalExpressionfor the WHERE clause of the index (which can be null).- Specified by:
createN1qlIndexin interfaceBucketManager- Parameters:
indexName- the name of the index.fields- the List of JSON fields to index, in eitherExpressionorStringform.whereClause- theExpressionto use in the WHERE clause of the index.ignoreIfExist- if a secondary index already exists with that name, an exception will be thrown unless this is set to true.defer- true to defer building of the index untilBucketManager.buildN1qlDeferredIndexes()is called (or a direct call to the corresponding query service API).- Returns:
- true if the index was effectively created (even in deferred mode) or false if the index existed and ignoreIfExist is true.
-
createN1qlIndex
public boolean createN1qlIndex(String indexName, List<Object> fields, Expression whereClause, boolean ignoreIfExist, boolean defer, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerCreate a secondary index for the current bucket, with a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name. This method allows to define fields of the index as a List, as well as an additionalExpressionfor the WHERE clause of the index (which can be null).- Specified by:
createN1qlIndexin interfaceBucketManager- Parameters:
indexName- the name of the index.fields- the List of JSON fields to index, in eitherExpressionorStringform.whereClause- theExpressionto use in the WHERE clause of the index.ignoreIfExist- if a secondary index already exists with that name, an exception will be thrown unless this is set to true.defer- true to defer building of the index untilBucketManager.buildN1qlDeferredIndexes()is called (or a direct call to the corresponding query service API).timeout- the custom timeout.timeUnit- the unit for the custom timeout.- Returns:
- true if the index was effectively created (even in deferred mode) or false if the index existed and ignoreIfExist is true.
-
dropN1qlPrimaryIndex
public boolean dropN1qlPrimaryIndex(boolean ignoreIfNotExist)Description copied from interface:BucketManagerDrop the default primary index (Index.PRIMARY_NAME) associated with the current bucket, within the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Specified by:
dropN1qlPrimaryIndexin interfaceBucketManager- Parameters:
ignoreIfNotExist- if true, attempting to drop on a bucket without any primary index won't cause an exception to be propagated.- Returns:
- true if the index was effectively dropped, false if it didn't exist and ignoreIfNotExist is set to true.
-
dropN1qlPrimaryIndex
Description copied from interface:BucketManagerDrop the default primary index (Index.PRIMARY_NAME) associated with the current bucket, within a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Specified by:
dropN1qlPrimaryIndexin interfaceBucketManager- Parameters:
ignoreIfNotExist- if true, attempting to drop on a bucket without any primary index won't cause an exception to be propagated.timeout- the custom timeout.timeUnit- the unit for the custom timeout.- Returns:
- true if the index was effectively dropped, false if it didn't exist and ignoreIfNotExist is set to true.
-
dropN1qlPrimaryIndex
Description copied from interface:BucketManagerDrop the given custom-named primary index associated with the current bucket, within the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Specified by:
dropN1qlPrimaryIndexin interfaceBucketManager- Parameters:
customName- the custom name for the primary index.ignoreIfNotExist- if true, attempting to drop on a bucket without any primary index won't cause an exception to be propagated.- Returns:
- true if the index was effectively dropped, false if it didn't exist and ignoreIfNotExist is set to true.
-
dropN1qlPrimaryIndex
public boolean dropN1qlPrimaryIndex(String customName, boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerDrop the given custom-named primary index associated with the current bucket, within a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Specified by:
dropN1qlPrimaryIndexin interfaceBucketManager- Parameters:
customName- the custom name for the primary index.ignoreIfNotExist- if true, attempting to drop on a bucket without any primary index won't cause an exception to be propagated.timeout- the custom timeout.timeUnit- the unit for the custom timeout.- Returns:
- true if the index was effectively dropped, false if it didn't exist and ignoreIfNotExist is set to true.
-
dropN1qlIndex
Description copied from interface:BucketManagerDrop the given secondary index associated with the current bucket, within the default management timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Specified by:
dropN1qlIndexin interfaceBucketManagerignoreIfNotExist- if true, attempting to drop on a bucket without the specified index won't cause an exception to be propagated.- Returns:
- true if the index was effectively dropped, false if it didn't exist and ignoreIfNotExist is set to true.
-
dropN1qlIndex
public boolean dropN1qlIndex(String name, boolean ignoreIfNotExist, long timeout, TimeUnit timeUnit)Description copied from interface:BucketManagerDrop the given secondary index associated with the current bucket, within a custom timeout. The index management API only deals with GSI type of indexes, which allows it to uniquely identify indexes by name.- Specified by:
dropN1qlIndexin interfaceBucketManagerignoreIfNotExist- if true, attempting to drop on a bucket without the specified index won't cause an exception to be propagated.timeout- the custom timeout.timeUnit- the unit for the custom timeout.- Returns:
- true if the index was effectively dropped, false if it didn't exist and ignoreIfNotExist is set to true.
-
buildN1qlDeferredIndexes
Description copied from interface:BucketManagerInstruct the query engine to trigger the build of indexes that have been deferred, within the default management timeout. This only considers GSI indexes, as the index management API only deals with this type of indexes. This process itself is asynchronous, meaning that the call will immediately return despite indexes still being in a "pending" or "building" state. This method will return a List of the names of indexes whose build has been triggered.- Specified by:
buildN1qlDeferredIndexesin interfaceBucketManager- Returns:
- a
Listof index names, the names of the indexes that have been triggered. - See Also:
to poll for a list of indexes to become online.
-
buildN1qlDeferredIndexes
Description copied from interface:BucketManagerInstruct the query engine to trigger the build of indexes that have been deferred, within a custom timeout. This only considers GSI indexes, as the index management API only deals with this type of indexes. This process itself is asynchronous, meaning that the call will immediately return despite indexes still being in a "pending" or "building" state. This method will return a List of the names of indexes whose build has been triggered.- Specified by:
buildN1qlDeferredIndexesin interfaceBucketManager- Parameters:
timeout- the custom timeout.timeUnit- the unit for the custom timeout.- Returns:
- a
Listof index names, the names of the indexes that have been triggered. - See Also:
to poll for a list of indexes to become online.
-
watchN1qlIndexes
public List<IndexInfo> watchN1qlIndexes(List<String> watchList, long watchTimeout, TimeUnit watchTimeUnit)Description copied from interface:BucketManagerWatches all given indexes (possibly including the primary one), polling the query service until they become "online" or the watchTimeout has expired. This only considers GSI indexes, as the index management API only deals with this type of indexes. Note: You can activate DEBUG level logs on the "DefaultAsyncBucketManager.INDEX_WATCH_LOG_NAME" logger to see various stages of the polling. You can also watch a primary index by using theIndex.PRIMARY_NAMEconstant.- Specified by:
watchN1qlIndexesin interfaceBucketManager- Parameters:
watchList- the names of the SECONDARY indexes to watch (can be empty).watchTimeout- the maximum duration for which to poll for the index to become online.watchTimeUnit- the time unit for the watchTimeout.- Returns:
- a
Listof theIndexInfofor the indexes that went online during the watch period. Can be empty if all indexes where online, no index to watch or no index became online within the watchTimeout timeframe.
-