Skip to content
This repository has been archived by the owner on Oct 13, 2020. It is now read-only.

Latest commit

 

History

History
60 lines (40 loc) · 1.54 KB

README.md

File metadata and controls

60 lines (40 loc) · 1.54 KB

Couchbase CAPI Server

This project implements an HTTP server capable of responding to Couchbase and CAPI requests.

Couchbase Requests supported:

  • /pools (GET)
  • /pools/default (GET)
  • /pools/default/buckets (GET)
  • /pools/default/buckets/{bucket} (GET)

CAPI Requests supported:

  • /{database} (HEAD, GET)
  • /{database}/{docid} (GET)
  • /{database}/_ensure_full_commit (POST)
  • /{database}/_revs_diff (POST)
  • /{database}/_bulk_docs (POST)

This project does not come with an actual implementation of the behaviors behind these actions. Instead two interfaces are exposed:

  • CouchbaseBehavior
  • CAPIBehavior

Users of this library will provide their own implemenations of these interfaces to deliver the desired behavior.

Building

This project is built using Maven.

mvn install 

Using

  • Implement your own CouchbaseBehavior
    public class MyCustomCouchbaseBehavior implements CouchbaseBehavior { ... }
  • Implement your own CAPIBehavior
    public class MyCustomCAPIBehavior implements CAPIBehavior { ... }
  • Create instances of #1 and #2
    CouchbaseBehavior couchbaseBehavior = new MyCustomCouchbaseBehavior();
    CAPIBehavior capiBehavior = new MyCustomCAPIBehavior();
  • Start a CAPIServer
    CAPIServer capiServer = new CAPIServer(capiBehavior, couchbaseBehavior);
    capiServer.start();

By default this will start a server bound to 0.0.0.0 on an ephemeral port. If you'd like to bind to a different interface or a particular port, there are alternate constructors available.