Class CollectionManager
- java.lang.Object
-
- com.couchbase.client.java.manager.collection.CollectionManager
-
@Volatile public class CollectionManager extends Object
TheCollectionManager
provides APIs to manage bucket collections and scopes.
-
-
Constructor Summary
Constructors Constructor Description CollectionManager(AsyncCollectionManager asyncCollectionManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
collectionExists(CollectionSpec collectionSpec)
Checks if the given collection exists in this bucket.void
createCollection(CollectionSpec collectionSpec)
Creates a collection if it does not already exist.void
createScope(ScopeSpec scopeSpec)
Creates a scope if it does not already exist.void
dropCollection(CollectionSpec collectionSpec)
Drops a collection if it exists.void
dropScope(String scopeName)
Drops a scope if it exists.List<ScopeSpec>
getAllScopes()
Returns all scopes in this bucket.ScopeSpec
getScope(String scopeName)
Returns the scope if it exists.
-
-
-
Constructor Detail
-
CollectionManager
public CollectionManager(AsyncCollectionManager asyncCollectionManager)
-
-
Method Detail
-
createCollection
public void createCollection(CollectionSpec collectionSpec)
Creates a collection if it does not already exist.- Parameters:
collectionSpec
- the collection spec that contains the properties of the collection.
-
collectionExists
public boolean collectionExists(CollectionSpec collectionSpec)
Checks if the given collection exists in this bucket.- Parameters:
collectionSpec
- the collection spec that contains the properties of the collection.- Returns:
- true if it exists, false otherwise.
-
dropCollection
public void dropCollection(CollectionSpec collectionSpec)
Drops a collection if it exists.- Parameters:
collectionSpec
- the collection spec that contains the properties of the collection.
-
createScope
public void createScope(ScopeSpec scopeSpec)
Creates a scope if it does not already exist.- Parameters:
scopeSpec
- the scope spec that contains the properties of the scope.
-
dropScope
public void dropScope(String scopeName)
Drops a scope if it exists.- Parameters:
scopeName
- the name of the scope to drop.
-
getScope
public ScopeSpec getScope(String scopeName)
Returns the scope if it exists.- Parameters:
scopeName
- the name of the scope.- Returns:
- the
ScopeSpec
or an exception if it does not exist.
-
-