Class CollectionManager
java.lang.Object
com.couchbase.client.java.manager.collection.CollectionManager
@Volatile public class CollectionManager extends Object
The
CollectionManager provides APIs to manage bucket collections and scopes.-
Constructor Summary
Constructors Constructor Description CollectionManager(AsyncCollectionManager asyncCollectionManager) -
Method Summary
Modifier and Type Method Description voidcreateCollection(CollectionSpec collectionSpec)Creates a collection if it does not already exist.voidcreateCollection(CollectionSpec collectionSpec, CreateCollectionOptions options)Creates a collection if it does not already exist.voidcreateScope(String scopeName)Creates a scope if it does not already exist.voidcreateScope(String scopeName, CreateScopeOptions options)Creates a scope if it does not already exist.voiddropCollection(CollectionSpec collectionSpec)Drops a collection if it exists.voiddropCollection(CollectionSpec collectionSpec, DropCollectionOptions options)Drops a collection if it exists.voiddropScope(String scopeName)Drops a scope if it exists.voiddropScope(String scopeName, DropScopeOptions options)Drops a scope if it exists.List<ScopeSpec>getAllScopes()Returns all scopes in this bucket.List<ScopeSpec>getAllScopes(GetAllScopesOptions options)Returns all scopes in this bucket.ScopeSpecgetScope(String scopeName)Returns the scope if it exists.ScopeSpecgetScope(String scopeName, GetScopeOptions options)Returns the scope if it exists.
-
Constructor Details
-
CollectionManager
-
-
Method Details
-
createCollection
Creates a collection if it does not already exist.- Parameters:
collectionSpec- the collection spec that contains the properties of the collection.- Throws:
CollectionExistsException- if the collection already existsScopeNotFoundException- if the specified scope does not exist.
-
createCollection
Creates a collection if it does not already exist.- Parameters:
collectionSpec- the collection spec that contains the properties of the collection.- Throws:
CollectionExistsException- if the collection already existsScopeNotFoundException- if the specified scope does not exist.
-
dropCollection
Drops a collection if it exists.- Parameters:
collectionSpec- the collection spec that contains the properties of the collection.- Throws:
CollectionNotFoundException- if the collection did not exist.ScopeNotFoundException- if the specified scope does not exist.
-
dropCollection
Drops a collection if it exists.- Parameters:
collectionSpec- the collection spec that contains the properties of the collection.- Throws:
CollectionNotFoundException- if the collection did not exist.ScopeNotFoundException- if the specified scope does not exist.
-
createScope
Creates a scope if it does not already exist.- Parameters:
scopeName- the name of the scope to create.- Throws:
ScopeExistsException- if the scope already exists.
-
createScope
Creates a scope if it does not already exist.- Parameters:
scopeName- the name of the scope to create.- Throws:
ScopeExistsException- if the scope already exists.
-
dropScope
Drops a scope if it exists.- Parameters:
scopeName- the name of the scope to drop.- Throws:
ScopeNotFoundException- if the scope did not exist.
-
dropScope
Drops a scope if it exists.- Parameters:
scopeName- the name of the scope to drop.- Throws:
ScopeNotFoundException- if the scope did not exist.
-
getScope
Returns the scope if it exists.- Parameters:
scopeName- the name of the scope.- Returns:
- information about the requested scope.
- Throws:
ScopeNotFoundException- if scope does not exist
-
getScope
Returns the scope if it exists.- Parameters:
scopeName- the name of the scope.- Returns:
- information about the requested scope.
- Throws:
ScopeNotFoundException- if scope does not exist
-
getAllScopes
Returns all scopes in this bucket.- Returns:
- a list of all scopes in this bucket.
-
getAllScopes
Returns all scopes in this bucket.- Returns:
- a list of all scopes in this bucket.
-