if( props.containsKey("couchdb.replication.password") ) {
couchReplicationPassword = props.getProperty("couchdb.replication.password");
}
// Create Couch Server from properties
CouchFactory factory = new CouchFactory();
try {
couchClient = factory.getClient(props);
} catch(Exception e) {
logger.error("Unable to get Couch Server",e);
throw new ServletException("Unable to get Couch Server",e);
}
// Create database
try {
if( props.containsKey("couchdb.dbUrl") ) {
couchDb = factory.getDb(couchClient, props.getProperty("couchdb.dbUrl"));
} else if( props.containsKey("couchdb.dbName") ) {
couchDb = couchClient.getDatabase(props.getProperty("couchdb.dbName"));
} else {
throw new Exception("dbUrl or dbName must be provided");
}