public class DefaultBucketManager extends Object implements BucketManager
| Modifier and Type | Method and Description |
|---|---|
AsyncBucketManager |
async()
Returns the underlying
AsyncBucketManager for asynchronous execution. |
static DefaultBucketManager |
create(CouchbaseEnvironment environment,
String bucket,
String password,
com.couchbase.client.core.ClusterFacade core) |
Boolean |
flush()
Flushes the bucket (removes all data) with the default management timeout.
|
Boolean |
flush(long timeout,
TimeUnit timeUnit)
Flushes the bucket (removes all data) with a custom timeout.
|
DesignDocument |
getDesignDocument(String name)
Loads a published
DesignDocument by its name with the default management timeout. |
DesignDocument |
getDesignDocument(String name,
boolean development)
Loads a
DesignDocument by its name from either development or production with the default management timeout. |
DesignDocument |
getDesignDocument(String name,
boolean development,
long timeout,
TimeUnit timeUnit)
Loads a
DesignDocuments by its name from either development or production with a custom timeout. |
DesignDocument |
getDesignDocument(String name,
long timeout,
TimeUnit timeUnit)
Loads a published
DesignDocument by its name with the a custom timeout. |
List<DesignDocument> |
getDesignDocuments()
Loads all published
DesignDocuments with the default management timeout. |
List<DesignDocument> |
getDesignDocuments(boolean development)
Loads all
DesignDocuments from either development or production with the default management timeout. |
List<DesignDocument> |
getDesignDocuments(boolean development,
long timeout,
TimeUnit timeUnit)
Loads all
DesignDocuments from either development or production with a custom timeout. |
List<DesignDocument> |
getDesignDocuments(long timeout,
TimeUnit timeUnit)
Loads all published
DesignDocuments with a custom timeout. |
BucketInfo |
info()
Returns information about the connected bucket with the default management timeout.
|
BucketInfo |
info(long timeout,
TimeUnit timeUnit)
Returns information about the connected bucket with a custom timeout.
|
DesignDocument |
insertDesignDocument(DesignDocument designDocument)
Inserts a
DesignDocument into production if it does not exist with the default management timeout. |
DesignDocument |
insertDesignDocument(DesignDocument designDocument,
boolean development)
Inserts a
DesignDocument into development or production if it does not exist with the default management timeout. |
DesignDocument |
insertDesignDocument(DesignDocument designDocument,
boolean development,
long timeout,
TimeUnit timeUnit)
Inserts a
DesignDocument into development or production if it does not exist with a custom timeout. |
DesignDocument |
insertDesignDocument(DesignDocument designDocument,
long timeout,
TimeUnit timeUnit)
Inserts a
DesignDocument into production if it does not exist with a custom timeout. |
DesignDocument |
publishDesignDocument(String name)
Publishes a
DesignDocument from development into production with the default management timeout. |
DesignDocument |
publishDesignDocument(String name,
boolean overwrite)
Publishes a
DesignDocument from development into production with the default management timeout. |
DesignDocument |
publishDesignDocument(String name,
boolean overwrite,
long timeout,
TimeUnit timeUnit)
Publishes a
DesignDocument from development into production with a custom timeout. |
DesignDocument |
publishDesignDocument(String name,
long timeout,
TimeUnit timeUnit)
Publishes a
DesignDocument from development into production with a custom timeout. |
Boolean |
removeDesignDocument(String name)
Removes a
DesignDocument from production by its name with the default management timeout. |
Boolean |
removeDesignDocument(String name,
boolean development)
Removes a
DesignDocument from production or development by its name with the default management timeout. |
Boolean |
removeDesignDocument(String name,
boolean development,
long timeout,
TimeUnit timeUnit)
Removes a
DesignDocument from production or development by its name with a custom timeout. |
Boolean |
removeDesignDocument(String name,
long timeout,
TimeUnit timeUnit)
Removes a
DesignDocument from production by its name with a custom timeout. |
DesignDocument |
upsertDesignDocument(DesignDocument designDocument)
Upserts (inserts or replaces) a
DesignDocument into production with the default management timeout. |
DesignDocument |
upsertDesignDocument(DesignDocument designDocument,
boolean development)
Upserts (inserts or replaces) a
DesignDocument into production or development with the default management timeout. |
DesignDocument |
upsertDesignDocument(DesignDocument designDocument,
boolean development,
long timeout,
TimeUnit timeUnit)
Upserts (inserts or replaces) a
DesignDocument into production or development with a custom timeout. |
DesignDocument |
upsertDesignDocument(DesignDocument designDocument,
long timeout,
TimeUnit timeUnit)
Upserts (inserts or replaces) a
DesignDocument into production with a custom timeout. |
public static DefaultBucketManager create(CouchbaseEnvironment environment, String bucket, String password, com.couchbase.client.core.ClusterFacade core)
public AsyncBucketManager async()
BucketManagerReturns the underlying AsyncBucketManager for asynchronous execution.
async in interface BucketManagerpublic BucketInfo info()
BucketManagerReturns information about the connected bucket with the default management timeout.
This method throws:
info in interface BucketManagerBucketInfo.public Boolean flush()
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:
flush in interface BucketManagerpublic List<DesignDocument> getDesignDocuments()
BucketManagerLoads all published DesignDocuments with the default management timeout.
This method throws:
getDesignDocuments in interface BucketManagerDesignDocuments.public List<DesignDocument> getDesignDocuments(boolean development)
BucketManagerLoads all DesignDocuments from either development or production with the default management timeout.
This method throws:
getDesignDocuments in interface BucketManagerdevelopment - if DesignDocuments should be loaded from development or from production.DesignDocuments.public DesignDocument getDesignDocument(String name)
BucketManagerLoads a published DesignDocument by its name with the default management timeout.
If the DesignDocument is not found, null is returned.
This method throws:
getDesignDocument in interface BucketManagername - the name of the DesignDocument.DesignDocument.public DesignDocument getDesignDocument(String name, boolean development)
BucketManagerLoads a DesignDocument by its name from either development or production with the default management timeout.
If the DesignDocument is not found, null is returned.
This method throws:
getDesignDocument in interface BucketManagername - the name of the DesignDocument.development - if DesignDocument should be loaded from development or from production.DesignDocument.public DesignDocument insertDesignDocument(DesignDocument designDocument)
BucketManagerInserts a DesignDocument into production if it does not exist with the default management timeout.
Note that inserting a DesignDocument is not an atomic operation, but instead internally performs a BucketManager.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 same DesignDocument.
This method throws:
DesignDocument exists.insertDesignDocument in interface BucketManagerdesignDocument - the DesignDocument to insert.DesignDocument on success.public DesignDocument insertDesignDocument(DesignDocument designDocument, boolean development)
BucketManagerInserts a DesignDocument into development or production if it does not exist with the default management timeout.
Note that inserting a DesignDocument is not an atomic operation, but instead internally performs a BucketManager.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 same DesignDocument.
This method throws:
DesignDocument exists.insertDesignDocument in interface BucketManagerdesignDocument - the DesignDocument to insert.development - if it should be inserted into development or production (published).DesignDocument on success.public DesignDocument upsertDesignDocument(DesignDocument designDocument)
BucketManagerUpserts (inserts or replaces) a DesignDocument into production with the default management timeout.
This method throws:
upsertDesignDocument in interface BucketManagerdesignDocument - the DesignDocument to upsert.DesignDocument on success.public DesignDocument upsertDesignDocument(DesignDocument designDocument, boolean development)
BucketManagerUpserts (inserts or replaces) a DesignDocument into production or development with the default management timeout.
This method throws:
upsertDesignDocument in interface BucketManagerdesignDocument - the DesignDocument to upsert.development - if the DesignDocument should be upserted into development or production.DesignDocument on success.public Boolean removeDesignDocument(String name)
BucketManagerRemoves a DesignDocument from production by its name with the default management timeout.
This method throws:
removeDesignDocument in interface BucketManagername - the name of the DesignDocument.public Boolean removeDesignDocument(String name, boolean development)
BucketManagerRemoves a DesignDocument from production or development by its name with the default management timeout.
This method throws:
removeDesignDocument in interface BucketManagername - the name of the DesignDocument.development - if the DesignDocument should be removed from development or production.public DesignDocument publishDesignDocument(String name)
BucketManagerPublishes a DesignDocument from development into production with the default management timeout.
Note that this method does not override a already existing DesignDocument (see BucketManager.publishDesignDocument(String, boolean)) as an alternative.
This method throws:
DesignDocument already exists.publishDesignDocument in interface BucketManagername - the name of the DesignDocument to publish.DesignDocument on success.public DesignDocument publishDesignDocument(String name, boolean overwrite)
BucketManagerPublishes a DesignDocument from development into production with the default management timeout.
This method throws:
DesignDocument already exists and override is set to false.publishDesignDocument in interface BucketManagername - the name of the DesignDocument to publish.overwrite - if an existing DesignDocument should be overridden.DesignDocument on success.public BucketInfo info(long timeout, TimeUnit timeUnit)
BucketManagerReturns information about the connected bucket with a custom timeout.
This method throws:
info in interface BucketManagertimeout - the custom timeout.timeUnit - the time unit for the custom timeout.BucketInfo.public Boolean flush(long timeout, TimeUnit timeUnit)
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:
flush in interface BucketManagertimeout - the custom timeout.timeUnit - the time unit for the custom timeout.public List<DesignDocument> getDesignDocuments(long timeout, TimeUnit timeUnit)
BucketManagerLoads all published DesignDocuments with a custom timeout.
This method throws:
getDesignDocuments in interface BucketManagertimeout - the custom timeout.timeUnit - the time unit for the custom timeout.DesignDocuments.public List<DesignDocument> getDesignDocuments(boolean development, long timeout, TimeUnit timeUnit)
BucketManagerLoads all DesignDocuments from either development or production with a custom timeout.
This method throws:
getDesignDocuments in interface BucketManagerdevelopment - if DesignDocuments should be loaded from development or from production.timeout - the custom timeout.timeUnit - the time unit for the custom timeout.DesignDocuments.public DesignDocument getDesignDocument(String name, long timeout, TimeUnit timeUnit)
BucketManagerLoads a published DesignDocument by its name with the a custom timeout.
If the DesignDocument is not found, null is returned.
This method throws:
getDesignDocument in interface BucketManagername - the name of the DesignDocument.timeout - the custom timeout.timeUnit - the time unit for the custom timeout.DesignDocument.public DesignDocument getDesignDocument(String name, boolean development, long timeout, TimeUnit timeUnit)
BucketManagerLoads a DesignDocuments by its name from either development or production with a custom timeout.
If the DesignDocument is not found, null is returned.
This method throws:
getDesignDocument in interface BucketManagername - the name of the DesignDocument.development - if DesignDocument should be loaded from development or from production.timeout - the custom timeout.timeUnit - the time unit for the custom timeout.DesignDocument.public DesignDocument insertDesignDocument(DesignDocument designDocument, long timeout, TimeUnit timeUnit)
BucketManagerInserts a DesignDocument into production if it does not exist with a custom timeout.
Note that inserting a DesignDocument is not an atomic operation, but instead internally performs a BucketManager.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 same DesignDocument.
This method throws:
DesignDocument exists.insertDesignDocument in interface BucketManagerdesignDocument - the DesignDocument to insert.timeout - the custom timeout.timeUnit - the time unit for the custom timeout.DesignDocument on success.public DesignDocument insertDesignDocument(DesignDocument designDocument, boolean development, long timeout, TimeUnit timeUnit)
BucketManagerInserts a DesignDocument into development or production if it does not exist with a custom timeout.
Note that inserting a DesignDocument is not an atomic operation, but instead internally performs a BucketManager.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 same DesignDocument.
This method throws:
DesignDocument exists.insertDesignDocument in interface BucketManagerdesignDocument - the DesignDocument to insert.development - if it should be inserted into development or production (published).timeout - the custom timeout.timeUnit - the time unit for the custom timeout.DesignDocument on success.public DesignDocument upsertDesignDocument(DesignDocument designDocument, long timeout, TimeUnit timeUnit)
BucketManagerUpserts (inserts or replaces) a DesignDocument into production with a custom timeout.
This method throws:
upsertDesignDocument in interface BucketManagerdesignDocument - the DesignDocument to upsert.timeout - the custom timeout.timeUnit - the time unit for the custom timeout.DesignDocument on success.public DesignDocument upsertDesignDocument(DesignDocument designDocument, boolean development, long timeout, TimeUnit timeUnit)
BucketManagerUpserts (inserts or replaces) a DesignDocument into production or development with a custom timeout.
This method throws:
upsertDesignDocument in interface BucketManagerdesignDocument - the DesignDocument to upsert.development - if the DesignDocument should be upserted into development or production.timeout - the custom timeout.timeUnit - the time unit for the custom timeout.DesignDocument on success.public Boolean removeDesignDocument(String name, long timeout, TimeUnit timeUnit)
BucketManagerRemoves a DesignDocument from production by its name with a custom timeout.
This method throws:
removeDesignDocument in interface BucketManagername - the name of the DesignDocument.timeout - the custom timeout.timeUnit - the time unit for the custom timeout.public Boolean removeDesignDocument(String name, boolean development, long timeout, TimeUnit timeUnit)
BucketManagerRemoves a DesignDocument from production or development by its name with a custom timeout.
This method throws:
removeDesignDocument in interface BucketManagername - the name of the DesignDocument.development - if the DesignDocument should be removed from development or production.timeout - the custom timeout.timeUnit - the time unit for the custom timeout.public DesignDocument publishDesignDocument(String name, long timeout, TimeUnit timeUnit)
BucketManagerPublishes a DesignDocument from development into production with a custom timeout.
Note that this method does not override a already existing DesignDocument (see BucketManager.publishDesignDocument(String, boolean)) as an alternative.
This method throws:
DesignDocument already exists.publishDesignDocument in interface BucketManagername - the name of the DesignDocument to publish.timeout - the custom timeout.timeUnit - the time unit for the custom timeout.DesignDocument on success.public DesignDocument publishDesignDocument(String name, boolean overwrite, long timeout, TimeUnit timeUnit)
BucketManagerPublishes a DesignDocument from development into production with a custom timeout.
This method throws:
DesignDocument already exists and override is set to false.publishDesignDocument in interface BucketManagername - the name of the DesignDocument to publish.overwrite - if an existing DesignDocument should be overridden.timeout - the custom timeout.timeUnit - the time unit for the custom timeout.DesignDocument on success.Copyright © 2014 Couchbase, Inc.