public CouchDbConnector createConnector(String path, boolean createIfNotExists) { CouchDbConnector db = new StdCouchDbConnector(path, this, objectMapperFactory); if (createIfNotExists) db.createDatabaseIfNotExists(); return db; }
protected CouchDbRepositorySupport(Class<T> type, CouchDbConnector db, boolean createIfNotExists) { Assert.notNull(db, "CouchDbConnector may not be null"); Assert.notNull(type); this.db = db; this.type = type; if (createIfNotExists) { db.createDatabaseIfNotExists(); } stdDesignDocumentId = NameConventions.designDocName(type); } /**
private void removeDatabase() { HttpClient connection = couchDbConnector.getConnection(); RestTemplate restTemplate = new RestTemplate(connection); restTemplate.delete(couchDbConnector.path()); couchDbConnector.createDatabaseIfNotExists(); }
/** * Alternative constructor allowing a custom design document name (not linked to the type class name) * @param type repository type * @param db database connector * @param designDocName design document Id * @param createIfNotExists true if db should be created if it doesnt' exist */ protected CouchDbRepositorySupport(Class<T> type, CouchDbConnector db, String designDocName, boolean createIfNotExists) { Assert.notNull(db, "CouchDbConnector may not be null"); Assert.notNull(type); this.db = db; this.type = type; if (createIfNotExists) { db.createDatabaseIfNotExists(); } stdDesignDocumentId = NameConventions.designDocName(designDocName); }
private void removeDatabase() { HttpClient connection = couchDbConnector.getConnection(); RestTemplate restTemplate = new RestTemplate(connection); restTemplate.delete(couchDbConnector.path()); couchDbConnector.createDatabaseIfNotExists(); }
db.createDatabaseIfNotExists(); } catch (Exception e) { throw new GoraException("Error while initializing CouchDB store", e);