.maxObjectSizeBytes(maxObjectSizeBytes) .url(url) .build();
@Override public void connect() throws IOException { StdHttpClient.Builder builder = new StdHttpClient.Builder(); if (dbUrl != null) { try { builder.url(dbUrl); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.getMessage()); } } if (userName != null) { builder.username(userName); } if (password != null) { builder.password(password); } HttpClient httpClient = builder.build(); couchInstance = new StdCouchDbInstance(httpClient); dbConnector = couchInstance.createConnector(dbName, false); }
@Override public void connect() throws IOException { StdHttpClient.Builder builder = new StdHttpClient.Builder(); if (dbUrl != null) { try { builder.url(dbUrl); } catch (MalformedURLException e) { throw new IllegalArgumentException(e.getMessage()); } } if (userName != null) { builder.username(userName); } if (password != null) { builder.password(password); } HttpClient httpClient = builder.build(); couchInstance = new StdCouchDbInstance(httpClient); dbConnector = couchInstance.createConnector(dbName, false); }
final HttpClient httpClient = new StdHttpClient.Builder() .url("http://" + params.getServer() + ":" + params.getPort()) .build();
final HttpClient httpClient = new StdHttpClient.Builder() .url("http://" + params.getServer() + ":" + params.getPort()) .build();
@Override public DataContext create(DataContextProperties properties, ResourceFactoryRegistry resourceFactoryRegistry) throws UnsupportedDataContextPropertiesException, ConnectionException { final StdHttpClient.Builder httpClientBuilder = new StdHttpClient.Builder(); final String url = properties.getUrl(); if (url != null && !url.isEmpty()) { try { httpClientBuilder.url(url); } catch (MalformedURLException e) { throw new IllegalArgumentException(url, e); } } else { httpClientBuilder.host(properties.getHostname()); httpClientBuilder.port(getInt(properties.getPort(), CouchDbDataContext.DEFAULT_PORT)); httpClientBuilder.enableSSL(getBoolean(properties.toMap().get("ssl"), false)); } httpClientBuilder.username(properties.getUsername()); httpClientBuilder.password(properties.getPassword()); final HttpClient httpClient = httpClientBuilder.build(); final SimpleTableDef[] tableDefs = properties.getTableDefs(); if (tableDefs != null && tableDefs.length > 0) { return new CouchDbDataContext(httpClient, tableDefs); } final String databaseNames = properties.getDatabaseName(); if (databaseNames != null && !databaseNames.isEmpty()) { return new CouchDbDataContext(new StdCouchDbInstance(httpClient), databaseNames.split(",")); } return new CouchDbDataContext(httpClient); }
public CouchDBDataStore(final String url, final String dbName) { try { httpClient = new StdHttpClient.Builder().url(url).build(); } catch (final MalformedURLException e) { throw new IllegalStateException(e); } stdCouchDbInstance = new StdCouchDbInstance(httpClient); db = new StdCouchDbConnector(dbName, stdCouchDbInstance); db.createDatabaseIfNotExists(); designDocument = new DesignDocument("_design/channels"); addView(designDocument, Views.CHANNEL); addView(designDocument, Views.UAID); addView(designDocument, Views.TOKEN); addView(designDocument, Views.UNACKS); addView(designDocument, Views.SERVER); if (!db.contains(designDocument.getId())) { db.create(designDocument); } }
public CouchDBDataStore(final String url, final String dbName) { try { httpClient = new StdHttpClient.Builder().url(url).build(); } catch (final MalformedURLException e) { throw new IllegalStateException(e); } stdCouchDbInstance = new StdCouchDbInstance(httpClient); db = new StdCouchDbConnector(dbName, stdCouchDbInstance); db.createDatabaseIfNotExists(); designDocument = new DesignDocument("_design/channels"); addView(designDocument, Views.CHANNEL); addView(designDocument, Views.UAID); addView(designDocument, Views.TOKEN); addView(designDocument, Views.UNACKS); addView(designDocument, Views.SERVER); if (!db.contains(designDocument.getId())) { db.create(designDocument); } }
public CouchDbDataContext(StdHttpClient.Builder httpClientBuilder, SimpleTableDef... tableDefs) { this(httpClientBuilder.build(), tableDefs); }
public CouchDbDataContext(StdHttpClient.Builder httpClientBuilder) { this(httpClientBuilder.build()); }
static void setup() { StdHttpClient.Builder builder = new StdHttpClient.Builder(); HttpClient httpClient = builder.build(); StdCouchDbInstance instance = new StdCouchDbInstance(httpClient); DbPath dbPath = new DbPath(TEST_DB); if (instance.checkIfDbExists((dbPath))) { instance.deleteDatabase(dbPath.getPath()); } connector = instance.createConnector(TEST_DB, true); }
private static CouchDbConnector couchDbConnector(CouchDbConfiguration configuration, StdHttpClient.Builder httpBuilder) { CouchDbInstance dbInstance = new StdCouchDbInstance(httpBuilder.build()); return dbInstance.createConnector(configuration.getDatabaseName(), true); }
private static CouchDbConnector couchDbConnector(CouchDbConfiguration configuration, StdHttpClient.Builder httpBuilder) { CouchDbInstance dbInstance = new StdCouchDbInstance(httpBuilder.build()); return dbInstance.createConnector(configuration.getDatabaseName(), true); }
static void teardown() { StdHttpClient.Builder builder = new StdHttpClient.Builder(); HttpClient httpClient = builder.build(); StdCouchDbInstance instance = new StdCouchDbInstance(httpClient); DbPath dbPath = new DbPath(TEST_DB); if (instance.checkIfDbExists((dbPath))) { instance.deleteDatabase(dbPath.getPath()); } } }