use of com.hortonworks.registries.storage.impl.jdbc.connection.HikariCPConnectionBuilder in project registry by hortonworks.
the class QueryExecutorFactory method getHikariCPConnnectionBuilder.
private static HikariCPConnectionBuilder getHikariCPConnnectionBuilder(Map<String, Object> dbProperties) {
Util.validateJDBCProperties(dbProperties, Lists.newArrayList("dataSourceClassName", "dataSource.url"));
String dataSourceClassName = (String) dbProperties.get("dataSourceClassName");
LOG.info("data source class: [{}]", dataSourceClassName);
String jdbcUrl = (String) dbProperties.get("dataSource.url");
LOG.info("dataSource.url is: [{}] ", jdbcUrl);
Properties properties = new Properties();
properties.putAll(dbProperties);
HikariConfig hikariConfig = new HikariConfig(properties);
return new HikariCPConnectionBuilder(hikariConfig);
}
use of com.hortonworks.registries.storage.impl.jdbc.connection.HikariCPConnectionBuilder in project registry by hortonworks.
the class DbFileStorageTest method setUp.
@Before
public void setUp() throws Exception {
connectionBuilder = new HikariCPConnectionBuilder(HikariBasicConfig.getH2HikariConfig());
MySqlExecutor queryExecutor = new MySqlExecutor(new ExecutionConfig(-1), connectionBuilder);
StorageManager jdbcStorageManager = new JdbcStorageManager(queryExecutor);
transactionManager = (TransactionManager) jdbcStorageManager;
jdbcStorageManager.registerStorables(StorageUtils.getStorableEntities());
dbFileStorage = new DbFileStorage();
dbFileStorage.setStorageManager(jdbcStorageManager);
runScript("create_fileblob.sql");
}
use of com.hortonworks.registries.storage.impl.jdbc.connection.HikariCPConnectionBuilder in project registry by hortonworks.
the class TransactionTest method setUp.
@Before
public void setUp() throws Exception {
connectionBuilder = new HikariCPConnectionBuilder(HikariBasicConfig.getH2HikariConfig());
MySqlExecutor queryExecutor = new MySqlExecutor(new ExecutionConfig(-1), connectionBuilder);
StorageManager jdbcStorageManager = new JdbcStorageManager(queryExecutor);
transactionManager = (TransactionManager) jdbcStorageManager;
jdbcStorageManager.registerStorables(StorageUtils.getStorableEntities());
dbFileStorage = new DbFileStorage();
dbFileStorage.setStorageManager(jdbcStorageManager);
runScript("create_fileblob.sql");
}
use of com.hortonworks.registries.storage.impl.jdbc.connection.HikariCPConnectionBuilder in project registry by hortonworks.
the class QueryExecutorFactory method get.
public static QueryExecutor get(String type, Map<String, Object> dbProperties) {
HikariCPConnectionBuilder connectionBuilder = getHikariCPConnnectionBuilder(dbProperties);
ExecutionConfig executionConfig = getExecutionConfig(dbProperties);
QueryExecutor queryExecutor = null;
switch(type) {
case "mysql":
queryExecutor = new MySqlExecutor(executionConfig, connectionBuilder);
break;
case "postgresql":
queryExecutor = new PostgresqlExecutor(executionConfig, connectionBuilder);
break;
case "oracle":
queryExecutor = new OracleExecutor(executionConfig, connectionBuilder);
break;
default:
throw new IllegalArgumentException("Unsupported storage provider type: " + type);
}
return queryExecutor;
}
Aggregations