public class MyDataSourceFactory implements DataSourceFactory {
@Override
public DataSource getDataSource(DataNodeDescriptor nd) throws Exception {
DataSourceInfo info = nd.getDataSourceDescriptor();
// use the configuration in the DataSourceInfo and/or supplement it
// your own values
...
// Create a DataSource
Driver driver = (Driver)objectFactory.getJavaClass(driverClass).newInstance();
return DataSourceBuilder
.url(url)
.driver(driver)
.userName(username)
.password(password)
.pool(minConnections, maxConnections)
.maxQueueWaitTime(maxQueueWaitTime)
.validationQuery(validationQuery)
.build();
}
}
1条答案
按热度按时间70gysomp1#
可以通过封装在模块中的属性来实现:
或者,对于Modeler中的每个DataNode,您可以设置一个自定义的“DataSource Factory”,将其指向您自己的Java类,如下所示: