protected void setupParameters(Map parameters) { super.setupParameters(parameters); parameters.put(DBTYPE.key, DBTYPE); parameters.put(LOOSEBBOX.key, LOOSEBBOX); parameters.put(USE_SELECTIVITY.key, USE_SELECTIVITY); }
@Override protected boolean checkDBType(Map params) { return delegate.checkDBType(params); } }
@Override protected SQLDialect createSQLDialect(JDBCDataStore dataStore) { return delegate.createSQLDialect(dataStore); }
protected final boolean checkDBType(Map params, String dbtype) { String type; try { type = (String) DBTYPE.lookUp(params); if (dbtype.equals(type)) { return true; } return false; } catch (IOException e) { return false; } }
/** * Default implementation verifies the Map against the Param information. * * <p>It will ensure that: * * <ul> * <li>params is not null * <li>Everything is of the correct type (or upcovertable to the correct type without Error) * <li>Required Parameters are present * </ul> * * @param params * @return true if params is in agreement with getParametersInfo and checkDBType */ public boolean canProcess(Map params) { if (!DataUtilities.canProcess(params, getParametersInfo())) { return false; } return checkDBType(params); }
DBTYPE.description, DBTYPE.required, getDatabaseID())); parameters.put(HOST.key, HOST); parameters.put(PORT.key, PORT); parameters.put(BATCH_INSERT_SIZE.key, BATCH_INSERT_SIZE); parameters.put(MAXWAIT.key, MAXWAIT); if (getValidationQuery() != null) parameters.put(VALIDATECONN.key, VALIDATECONN); parameters.put(TEST_WHILE_IDLE.key, TEST_WHILE_IDLE); parameters.put(TIME_BETWEEN_EVICTOR_RUNS.key, TIME_BETWEEN_EVICTOR_RUNS);
BasicDataSource dataSource = createDataSource(params); setupParameters(testMap); if (testMap.containsKey(MAX_OPEN_PREPARED_STATEMENTS.key)) { Integer maxPreparedStatements =
dataSource.setDriverClassName(getDriverClassName()); dataSource.setUrl(getJDBCUrl(params)); if (validate != null && validate && getValidationQuery() != null) { dataSource.setTestOnBorrow(true); dataSource.setValidationQuery(getValidationQuery());
final SQLDialect dialect = createSQLDialect(dataStore); dataStore.setSQLDialect(dialect); dataStore.setDataSource(createDataSource(params, dialect)); return createDataStoreInternal(dataStore, params);
final SQLDialect dialect = createSQLDialect(dataStore); dataStore.setSQLDialect(dialect); dataStore.setDataSource(ds); } else { dataStore.setDataSource(createDataSource(params, dialect)); ? findCallbackFactory(callbackFactory) : JDBCCallbackFactory.NULL); JDBCDataStore result = createDataStoreInternal(dataStore, params); if (result.getDataSource() == null) { throw new IOException("JDBC Connection not available with provided parameters");
@Override protected String getDatabaseID() { return delegate.getDatabaseID(); }
@Override protected String getJDBCUrl(Map params) throws IOException { // jdbc url String host = null; Integer port = null; try { host = (String) HOST.lookUp(params); port = (Integer) PORT.lookUp(params); } catch (IOException ex) { // do nothing } String db = (String) DATABASE.lookUp(params); if (host == null && port == null && db != null) return "jdbc:" + getDatabaseID() + ":" + db; return super.getJDBCUrl(params); }
protected void setupJNDIEnvironment(JDBCDataStoreFactory jdbcDataStoreFactory) throws IOException { Map params = new HashMap(fixture); params.put("passwd", params.get("password")); dataSource = jdbcDataStoreFactory.createDataSource(params); MockInitialDirContextFactory.setDataSource(dataSource); System.setProperty( Context.INITIAL_CONTEXT_FACTORY, MockInitialDirContextFactory.class.getName()); try { GeoTools.clearInitialContext(); } catch (NamingException e) { throw new RuntimeException(e); } }
BasicDataSource dataSource = createDataSource(params); setupParameters(testMap); if(testMap.containsKey(MAX_OPEN_PREPARED_STATEMENTS.key)) { Integer maxPreparedStatements = (Integer) MAX_OPEN_PREPARED_STATEMENTS.lookUp(params);
dataSource.setDriverClassName(getDriverClassName()); dataSource.setUrl(getJDBCUrl(params)); if(validate != null && validate && getValidationQuery() != null) { dataSource.setTestOnBorrow(true); dataSource.setValidationQuery(getValidationQuery());
final SQLDialect dialect = createSQLDialect(dataStore); dataStore.setSQLDialect(dialect); dataStore.setDataSource(createDataSource(params, dialect)); return createDataStoreInternal(dataStore, params);
protected final boolean checkDBType(Map params, String dbtype) { String type; try { type = (String) DBTYPE.lookUp(params); if (dbtype.equals(type)) { return true; } return false; } catch (IOException e) { return false; } }
new Param(DBTYPE.key, DBTYPE.type, DBTYPE.description, DBTYPE.required, getDatabaseID())); parameters.put(HOST.key, HOST); parameters.put(PORT.key, PORT); parameters.put(FETCHSIZE.key, FETCHSIZE); parameters.put(MAXWAIT.key, MAXWAIT); if(getValidationQuery() != null) parameters.put(VALIDATECONN.key, VALIDATECONN);
/** * Builds up the JDBC url in a jdbc:<database>://<host>:<port>/<dbname> Override if you need a * different setup * * @param params * @return * @throws IOException */ protected String getJDBCUrl(Map params) throws IOException { // jdbc url String host = (String) HOST.lookUp(params); Integer port = (Integer) PORT.lookUp(params); String db = (String) DATABASE.lookUp(params); String url = "jdbc:" + getDatabaseID() + "://" + host; if (port != null) { url += ":" + port; } if (db != null) { url += "/" + db; } return url; }
/** * Builds up the JDBC url in a jdbc:<database>://<host>:<port>;DatabaseName=<dbname> */ @SuppressWarnings("unchecked") @Override protected String getJDBCUrl(Map params) throws IOException { String url = super.getJDBCUrl(params); String db = (String) DATABASE.lookUp(params); Boolean intsec = (Boolean) INTSEC.lookUp(params); if (db != null) { url = url.substring(0, url.lastIndexOf("/")) + (db != null ? ";DatabaseName="+db : ""); } if (intsec != null && intsec.booleanValue()) { url = url + ";integratedSecurity=true"; } return url; }