use of com.wplatform.ddal.config.parser.XmlConfigParser in project jdbc-shards by wplatform.
the class JdbcDataSource method init.
public synchronized void init() {
if (inited) {
return;
}
if (StringUtils.isNullOrEmpty(this.configLocation)) {
throw new IllegalArgumentException("Property configLocation must not be null");
}
InputStream source = Utils.getResourceAsStream(configLocation);
if (source == null) {
throw new IllegalArgumentException("Can't load the configLocation resource " + configLocation);
}
XmlConfigParser parser = new XmlConfigParser(source);
Configuration configuration = parser.parse();
configuration.setProperty(SetTypes.MODE, this.dbType);
if (this.maxMemoryRows > -1) {
configuration.setProperty(SetTypes.MAX_MEMORY_ROWS, this.maxMemoryRows);
}
if (this.maxOperationMemory > -1) {
configuration.setProperty(SetTypes.MAX_OPERATION_MEMORY, this.maxOperationMemory);
}
if (this.dataSourceProvider != null) {
configuration.setDataSourceProvider(this.dataSourceProvider);
}
this.database = new Database(configuration);
inited = true;
}
Aggregations