public class CouchDbClient extends CouchDbClientBase implements java.io.Closeable
This class is the main object to use to gain access to the APIs.
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.
CouchDbClientAndroid
Constructor and Description |
---|
CouchDbClient()
Constructs a new instance of this class, expects a configuration file named
couchdb.properties to be available in your application default classpath. |
CouchDbClient(CouchDbProperties properties)
Constructs a new instance of this class.
|
CouchDbClient(java.lang.String configFileName)
Constructs a new instance of this class.
|
CouchDbClient(java.lang.String dbName,
boolean createDbIfNotExist,
java.lang.String protocol,
java.lang.String host,
int port,
java.lang.String username,
java.lang.String password)
Constructs a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
shutdown()
Shuts down the connection manager used by this client instance.
|
batch, bulk, changes, contains, context, design, executeRequest, find, find, find, find, find, findAny, findDocs, getBaseUri, getDBUri, getGson, invokeUpdateHandler, post, remove, remove, replication, replicator, save, saveAttachment, saveAttachment, setGsonBuilder, syncDesignDocsWithDb, update, view
public CouchDbClient()
couchdb.properties
to be available in your application default classpath.public CouchDbClient(java.lang.String configFileName)
configFileName
- The configuration file name.public CouchDbClient(java.lang.String dbName, boolean createDbIfNotExist, java.lang.String protocol, java.lang.String host, int port, java.lang.String username, java.lang.String password)
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 addressport
- The database listening portusername
- The Username credentialpassword
- The Password credentialpublic CouchDbClient(CouchDbProperties properties)
properties
- An object containing configuration properties.CouchDbProperties
public void shutdown()
CouchDbClientBase
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
Copyright © 2011-2017. All Rights Reserved.