Class CouchDbClient

    • Constructor Detail

      • 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​(java.lang.String configFileName)
        Constructs a new instance of this class.
        Parameters:
        configFileName - The configuration file name.
      • CouchDbClient

        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)
        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:
        CouchDbProperties
    • Method Detail

      • createContext

        org.apache.http.protocol.HttpContext createContext()
        Specified by:
        createContext in class CouchDbClientBase
        Returns:
        HttpContext instance for HTTP request execution.
      • createConnectionManager

        private org.apache.http.impl.conn.PoolingHttpClientConnectionManager createConnectionManager​(CouchDbProperties props,
                                                                                                     org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> registry)
      • createRegistry

        private org.apache.http.config.Registry<org.apache.http.conn.socket.ConnectionSocketFactory> createRegistry​(CouchDbProperties props)
                                                                                                             throws java.security.KeyManagementException,
                                                                                                                    java.security.NoSuchAlgorithmException,
                                                                                                                    java.security.KeyStoreException
        Throws:
        java.security.KeyManagementException
        java.security.NoSuchAlgorithmException
        java.security.KeyStoreException
      • registerInterceptors

        private void registerInterceptors​(org.apache.http.impl.client.HttpClientBuilder clientBuilder)
        Adds request/response interceptors for logging and validation.
        Parameters:
        clientBuilder -
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException