Package com.couchbase.client.java
Class Cluster
- java.lang.Object
-
- com.couchbase.client.java.Cluster
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description AnalyticsIndexManager
analyticsIndexes()
Provides access to the Analytics index management services.AnalyticsResult
analyticsQuery(String statement)
Performs an analytics query with defaultAnalyticsOptions
.AnalyticsResult
analyticsQuery(String statement, AnalyticsOptions options)
Performs an analytics query with customAnalyticsOptions
.AsyncCluster
async()
Provides access to the underlyingAsyncCluster
.Bucket
bucket(String name)
Opens aBucket
with the given name.BucketManager
buckets()
Provides access to the bucket management services.static Cluster
connect(String connectionString, ClusterOptions options)
Connect to a Couchbase cluster with customAuthenticator
.static Cluster
connect(String connectionString, String username, String password)
Connect to a Couchbase cluster with a username and a password as credentials.Core
core()
Provides access to the underlyingCore
.DiagnosticsResult
diagnostics()
Returns aDiagnosticsResult
, reflecting the SDK's current view of all its existing connections to the cluster.DiagnosticsResult
diagnostics(DiagnosticsOptions options)
Returns aDiagnosticsResult
, reflecting the SDK's current view of all its existing connections to the cluster.void
disconnect()
Performs a non-reversible disconnect of thisCluster
.void
disconnect(Duration timeout)
Performs a non-reversible disconnect of thisCluster
.ClusterEnvironment
environment()
Provides access to the configuredClusterEnvironment
for this cluster.QueryResult
query(String statement)
Performs a N1QL query with defaultQueryOptions
.QueryResult
query(String statement, QueryOptions options)
Performs a N1QL query with customQueryOptions
.QueryIndexManager
queryIndexes()
Provides access to the N1QL index management services.ReactiveCluster
reactive()
Provides access to the relatedReactiveCluster
.SearchIndexManager
searchIndexes()
Provides access to the Full Text Search index management services.SearchResult
searchQuery(String indexName, SearchQuery query)
Performs a Full Text Search (FTS) query with defaultSearchOptions
.SearchResult
searchQuery(String indexName, SearchQuery query, SearchOptions options)
Performs a Full Text Search (FTS) query with customSearchOptions
.UserManager
users()
Provides access to the user management services.
-
-
-
Method Detail
-
connect
public static Cluster connect(String connectionString, String username, String password)
Connect to a Couchbase cluster with a username and a password as credentials.- Parameters:
connectionString
- connection string used to locate the Couchbase cluster.username
- the name of the user with appropriate permissions on the cluster.password
- the password of the user with appropriate permissions on the cluster.- Returns:
- if properly connected, returns a
Cluster
.
-
connect
public static Cluster connect(String connectionString, ClusterOptions options)
Connect to a Couchbase cluster with customAuthenticator
.- Parameters:
connectionString
- connection string used to locate the Couchbase cluster.options
- custom options when creating the cluster.- Returns:
- if properly connected, returns a
Cluster
.
-
async
public AsyncCluster async()
Provides access to the underlyingAsyncCluster
.
-
reactive
public ReactiveCluster reactive()
Provides access to the relatedReactiveCluster
.
-
core
@Volatile public Core core()
Provides access to the underlyingCore
.This is advanced API, use with care!
-
users
@Volatile public UserManager users()
Provides access to the user management services.
-
buckets
@Volatile public BucketManager buckets()
Provides access to the bucket management services.
-
analyticsIndexes
@Volatile public AnalyticsIndexManager analyticsIndexes()
Provides access to the Analytics index management services.
-
queryIndexes
@Volatile public QueryIndexManager queryIndexes()
Provides access to the N1QL index management services.
-
searchIndexes
@Volatile public SearchIndexManager searchIndexes()
Provides access to the Full Text Search index management services.
-
environment
public ClusterEnvironment environment()
Provides access to the configuredClusterEnvironment
for this cluster.
-
query
public QueryResult query(String statement)
Performs a N1QL query with defaultQueryOptions
.- Parameters:
statement
- the N1QL query statement as a raw string.- Returns:
- the
QueryResult
once the response arrives successfully.
-
query
public QueryResult query(String statement, QueryOptions options)
Performs a N1QL query with customQueryOptions
.- Parameters:
statement
- the N1QL query statement as a raw string.options
- the custom options for this query.- Returns:
- the
QueryResult
once the response arrives successfully.
-
analyticsQuery
public AnalyticsResult analyticsQuery(String statement)
Performs an analytics query with defaultAnalyticsOptions
.- Parameters:
statement
- the query statement as a raw string.- Returns:
- the
AnalyticsResult
once the response arrives successfully.
-
analyticsQuery
public AnalyticsResult analyticsQuery(String statement, AnalyticsOptions options)
Performs an analytics query with customAnalyticsOptions
.- Parameters:
statement
- the query statement as a raw string.options
- the custom options for this query.- Returns:
- the
AnalyticsResult
once the response arrives successfully.
-
searchQuery
public SearchResult searchQuery(String indexName, SearchQuery query)
Performs a Full Text Search (FTS) query with defaultSearchOptions
.- Parameters:
query
- the query, in the form of aSearchQuery
- Returns:
- the
SearchRequest
once the response arrives successfully.
-
searchQuery
public SearchResult searchQuery(String indexName, SearchQuery query, SearchOptions options)
Performs a Full Text Search (FTS) query with customSearchOptions
.- Parameters:
query
- the query, in the form of aSearchQuery
options
- the custom options for this query.- Returns:
- the
SearchRequest
once the response arrives successfully.
-
bucket
public Bucket bucket(String name)
Opens aBucket
with the given name.- Parameters:
name
- the name of the bucket to open.- Returns:
- a
Bucket
once opened.
-
disconnect
public void disconnect()
Performs a non-reversible disconnect of thisCluster
.
-
disconnect
public void disconnect(Duration timeout)
Performs a non-reversible disconnect of thisCluster
.- Parameters:
timeout
- overriding the default disconnect timeout if needed.
-
diagnostics
@Volatile public DiagnosticsResult diagnostics(DiagnosticsOptions options)
Returns aDiagnosticsResult
, reflecting the SDK's current view of all its existing connections to the cluster.- Parameters:
options
- options on the generation of the report- Returns:
- a
DiagnosticsResult
-
diagnostics
@Volatile public DiagnosticsResult diagnostics()
Returns aDiagnosticsResult
, reflecting the SDK's current view of all its existing connections to the cluster.- Returns:
- a
DiagnosticsResult
-
-