GlobalSettings gs
,AtlasProperties atlasProperties
) throws Exception {
// Create couch client
CouchClient couchClient = null;
{
Properties couchClientProps = new Properties();
couchClientProps.put("couchdb.server", atlasProperties.getCouchDbUrl().toExternalForm());
couchClientProps.put("couchdb.user", atlasProperties.getCouchDbAdminUser());
couchClientProps.put("couchdb.password", atlasProperties.getCouchDbAdminPassword());
CouchFactory couchFactory = new CouchFactory();
couchClient = couchFactory.getClient(couchClientProps);
}
// Get _user database from Couch Client
CouchDb couchDb = null;
{
String dbName = "_users";
if( false == couchClient.databaseExists(dbName) ) {
throw new Exception("Unable to access _users database");
}
couchDb = couchClient.getDatabase(dbName);
}
DocumentUpdateProcess updateProcess = new DocumentUpdateProcess(couchDb);
DocumentUpdateListener l = new UpdateProgress(gs);
updateProcess.setListener(l);