Search in sources :

Example 6 with ReducedViewErrorContext

use of com.couchbase.client.core.error.context.ReducedViewErrorContext in project couchbase-jvm-clients by couchbase.

the class AsyncBucket method viewQuery.

public CompletableFuture<ViewResult> viewQuery(final String designDoc, final String viewName, final ViewOptions options) {
    notNull(options, "ViewOptions", () -> new ReducedViewErrorContext(designDoc, viewName, name));
    ViewOptions.Built opts = options.build();
    JsonSerializer serializer = opts.serializer() == null ? environment.jsonSerializer() : opts.serializer();
    return ViewAccessor.viewQueryAsync(core, viewRequest(designDoc, viewName, opts), serializer);
}
Also used : ViewOptions(com.couchbase.client.java.view.ViewOptions) ReducedViewErrorContext(com.couchbase.client.core.error.context.ReducedViewErrorContext) JsonSerializer(com.couchbase.client.java.codec.JsonSerializer)

Example 7 with ReducedViewErrorContext

use of com.couchbase.client.core.error.context.ReducedViewErrorContext in project couchbase-jvm-clients by couchbase.

the class AsyncViewIndexManager method getAllDesignDocuments.

/**
 * Returns all of the design documents in the specified namespace.
 *
 * @param namespace namespace to query
 * @param options additional optional arguments (timeout, retry, etc.)
 */
public CompletableFuture<List<DesignDocument>> getAllDesignDocuments(final DesignDocumentNamespace namespace, final GetAllDesignDocumentsOptions options) {
    notNull(namespace, "DesignDocumentNamespace", () -> new ReducedViewErrorContext(null, null, bucket));
    notNull(options, "GetAllDesignDocumentsOptions", () -> new ReducedViewErrorContext(null, null, bucket));
    return coreManager.getAllDesignDocuments(namespace == PRODUCTION, options.build()).thenApply(AsyncViewIndexManager::parseAllDesignDocuments);
}
Also used : ReducedViewErrorContext(com.couchbase.client.core.error.context.ReducedViewErrorContext)

Example 8 with ReducedViewErrorContext

use of com.couchbase.client.core.error.context.ReducedViewErrorContext in project couchbase-jvm-clients by couchbase.

the class AsyncViewIndexManager method getDesignDocument.

/**
 * Returns the named design document from the specified namespace.
 *
 * @param name name of the design document to retrieve
 * @param namespace namespace to look in
 * @param options additional optional arguments (timeout, retry, etc.)
 * @throws DesignDocumentNotFoundException if the namespace does not contain a document with the given name
 */
public CompletableFuture<DesignDocument> getDesignDocument(String name, DesignDocumentNamespace namespace, GetDesignDocumentOptions options) {
    notNullOrEmpty(name, "Name", () -> new ReducedViewErrorContext(null, null, bucket));
    notNull(namespace, "DesignDocumentNamespace", () -> new ReducedViewErrorContext(name, null, bucket));
    notNull(options, "GetDesignDocumentOptions", () -> new ReducedViewErrorContext(name, null, bucket));
    return coreManager.getDesignDocument(name, namespace == PRODUCTION, options.build()).thenApply(responseBytes -> parseDesignDocument(name, Mapper.decodeIntoTree(responseBytes)));
}
Also used : ReducedViewErrorContext(com.couchbase.client.core.error.context.ReducedViewErrorContext)

Example 9 with ReducedViewErrorContext

use of com.couchbase.client.core.error.context.ReducedViewErrorContext in project couchbase-jvm-clients by couchbase.

the class AsyncViewIndexManager method publishDesignDocument.

/**
 * Convenience method that gets a the document from the development namespace
 * and upserts it to the production namespace.
 *
 * @param name name of the development design document
 * @param options additional optional arguments (timeout, retry, etc.)
 * @throws DesignDocumentNotFoundException if the development namespace does not contain a document with the given name
 */
public CompletableFuture<Void> publishDesignDocument(final String name, final PublishDesignDocumentOptions options) {
    notNullOrEmpty(name, "Name", () -> new ReducedViewErrorContext(null, null, bucket));
    notNull(options, "PublishDesignDocumentOptions", () -> new ReducedViewErrorContext(name, null, bucket));
    return coreManager.publishDesignDocument(name, options.build());
}
Also used : ReducedViewErrorContext(com.couchbase.client.core.error.context.ReducedViewErrorContext)

Aggregations

ReducedViewErrorContext (com.couchbase.client.core.error.context.ReducedViewErrorContext)9 RequestSpan (com.couchbase.client.core.cnc.RequestSpan)2 JsonSerializer (com.couchbase.client.java.codec.JsonSerializer)2 ViewOptions (com.couchbase.client.java.view.ViewOptions)2 Core (com.couchbase.client.core.Core)1 Stability (com.couchbase.client.core.annotation.Stability)1 CbTracing (com.couchbase.client.core.cnc.CbTracing)1 TracingIdentifiers (com.couchbase.client.core.cnc.TracingIdentifiers)1 JsonNode (com.couchbase.client.core.deps.com.fasterxml.jackson.databind.JsonNode)1 ObjectNode (com.couchbase.client.core.deps.com.fasterxml.jackson.databind.node.ObjectNode)1 CoreCommonOptions (com.couchbase.client.core.endpoint.http.CoreCommonOptions)1 CoreHttpClient (com.couchbase.client.core.endpoint.http.CoreHttpClient)1 CoreHttpPath (com.couchbase.client.core.endpoint.http.CoreHttpPath)1 CoreHttpPath.path (com.couchbase.client.core.endpoint.http.CoreHttpPath.path)1 CoreHttpResponse (com.couchbase.client.core.endpoint.http.CoreHttpResponse)1 CouchbaseException (com.couchbase.client.core.error.CouchbaseException)1 DesignDocumentNotFoundException (com.couchbase.client.core.error.DesignDocumentNotFoundException)1 HttpStatusCodeException (com.couchbase.client.core.error.HttpStatusCodeException)1 InvalidArgumentException (com.couchbase.client.core.error.InvalidArgumentException)1 Mapper (com.couchbase.client.core.json.Mapper)1