@Override public HttpClient getConnection() { return dbInstance.getConnection(); }
public StdCouchDbConnector(String databaseName, CouchDbInstance dbi, ObjectMapperFactory om) { Assert.hasText(databaseName, "DatabaseName may not be null or empty"); Assert.notNull(dbi, "CouchDbInstance may not be null"); Assert.notNull(om, "ObjectMapperFactory may not be null"); DbPath dbp = DbPath.fromString(databaseName); dbName = dbp.getDbName(); this.dbURI = URI.prototype(dbp.getPath()); this.dbInstance = dbi; this.objectMapper = om.createObjectMapper(this); this.jsonSerializer = new StreamingJsonSerializer(objectMapper); this.restTemplate = new RestTemplate(dbi.getConnection()); this.revisionHandler = new RevisionResponseHandler(objectMapper); this.docIdResponseHandler = new DocIdResponseHandler(objectMapper); this.queryExecutor = new DefaultQueryExecutor(this.restTemplate); collectionBulkExecutor = new BulkOperationCollectionBulkExecutor(dbURI, restTemplate, objectMapper) { @Override protected JsonSerializer getJsonSerializer() { return jsonSerializer; } }; localBulkBuffer = new DefaultLocalBulkBuffer() { @Override protected BulkExecutor getBulkExecutor() { return collectionBulkExecutor; } }; inputStreamBulkExecutor = new InputStreamWrapperBulkExecutor(dbURI, restTemplate, objectMapper); }