Search in sources :

Example 1 with XmlConfigParser

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;
}
Also used : XmlConfigParser(com.wplatform.ddal.config.parser.XmlConfigParser) Configuration(com.wplatform.ddal.config.Configuration) InputStream(java.io.InputStream) Database(com.wplatform.ddal.engine.Database)

Aggregations

Configuration (com.wplatform.ddal.config.Configuration)1 XmlConfigParser (com.wplatform.ddal.config.parser.XmlConfigParser)1 Database (com.wplatform.ddal.engine.Database)1 InputStream (java.io.InputStream)1