Class CouchDbClient

All Implemented Interfaces:
Closeable, AutoCloseable

public class CouchDbClient extends CouchDbClientBase implements Closeable
Presents a client to CouchDB database server.

This class is the main object to use to gain access to the APIs.

Usage Example:

Create a new client instance:

 CouchDbClient dbClient = new CouchDbClient();
 

Start using the API by the client:

Documents CRUD APIs is accessed by the client directly, eg.: dbClient.find(Foo.class, "doc-id")

View APIs dbClient.view()

Change Notifications dbClient.changes()

Replication dbClient.replication() and dbClient.replicator()

DB server dbClient.context()

Design documents dbClient.design()

At the end of a client usage; it's useful to call: shutdown() to ensure proper release of resources.

Since:
0.0.2
See Also:
  • Constructor Details

    • CouchDbClient

      public CouchDbClient()
      Constructs a new instance of this class, expects a configuration file named couchdb.properties to be available in your application default classpath.
    • CouchDbClient

      public CouchDbClient(String configFileName)
      Constructs a new instance of this class.
      Parameters:
      configFileName - The configuration file name.
    • CouchDbClient

      public CouchDbClient(String dbName, boolean createDbIfNotExist, String protocol, String host, int port, String username, String password)
      Constructs a new instance of this class.
      Parameters:
      dbName - The database name.
      createDbIfNotExist - To create a new database if it does not already exist.
      protocol - The protocol to use (i.e http or https)
      host - The database host address
      port - The database listening port
      username - The Username credential
      password - The Password credential
    • CouchDbClient

      public CouchDbClient(CouchDbProperties properties)
      Constructs a new instance of this class.
      Parameters:
      properties - An object containing configuration properties.
      See Also:
  • Method Details