subsystem.get(OP).set(ADD);
subsystem.get(OP_ADDR).set(address);
list.add(subsystem);
DataSources dataSources = null;
try {
String localName = null;
switch (Namespace.forUri(reader.getNamespaceURI())) {
case DATASOURCES_1_0: {
localName = reader.getLocalName();
Element element = Element.forName(reader.getLocalName());
log.tracef("%s -> %s", localName, element);
switch (element) {
case SUBSYSTEM: {
DsParser parser = new DsParser();
dataSources = parser.parse(reader);
// Parse what is left after the datasources element
parseForDrivers(reader, address, list);
break;
}
}
}
}
} catch (Exception e) {
throw new XMLStreamException(e);
}
if (dataSources != null) {
ModelNode datasourcesNode = subsystem.get(DATASOURCES);
for (DataSource ds : dataSources.getDataSource()) {
ModelNode dsModel = new ModelNode();
for (Entry<String, String> entry : ds.getConnectionProperties().entrySet()) {
dsModel.get(CONNECTION_PROPERTIES, entry.getKey()).set(entry.getValue());
}
setIfNotNull(dsModel, CONNECTION_URL, ds.getConnectionUrl());
setIfNotNull(dsModel, DRIVER_CLASS, ds.getDriverClass());
setIfNotNull(dsModel, JNDINAME, ds.getJndiName());
setIfNotNull(dsModel, MODULE, ds.getModule());
setIfNotNull(dsModel, NEW_CONNECTION_SQL, ds.getNewConnectionSql());
setIfNotNull(dsModel, POOLNAME, ds.getPoolName());
setIfNotNull(dsModel, URL_DELIMITER, ds.getUrlDelimiter());
setIfNotNull(dsModel, URL_SELECTOR_STRATEGY_CLASS_NAME, ds.getUrlSelectorStrategyClassName());
setIfNotNull(dsModel, USE_JAVA_CONTEXT, ds.isUseJavaContext());
setIfNotNull(dsModel, ENABLED, ds.isEnabled());
CommonPool pool = ds.getPool();
if (pool != null) {
setIfNotNull(dsModel, MAX_POOL_SIZE, pool.getMaxPoolSize());
setIfNotNull(dsModel, MIN_POOL_SIZE, pool.getMinPoolSize());
setIfNotNull(dsModel, POOL_PREFILL, pool.isPrefill());
setIfNotNull(dsModel, POOL_USE_STRICT_MIN, pool.isUseStrictMin());
}
DsSecurity security = ds.getSecurity();
if (security != null) {
setIfNotNull(dsModel, USERNAME, security.getUserName());
setIfNotNull(dsModel, PASSWORD, security.getPassword());
setIfNotNull(dsModel, SECURITY_DOMAIN, security.getSecurityDomain());
}
Statement statement = ds.getStatement();
if (statement != null) {
setIfNotNull(dsModel, PREPAREDSTATEMENTSCACHESIZE, statement.getPreparedStatementsCacheSize());
setIfNotNull(dsModel, SHAREPREPAREDSTATEMENTS, statement.isSharePreparedStatements());
if (statement.getTrackStatements() != null) {
setIfNotNull(dsModel, TRACKSTATEMENTS, statement.getTrackStatements().name());
}
}
TimeOut timeout = ds.getTimeOut();
if (timeout != null) {
setIfNotNull(dsModel, ALLOCATION_RETRY, timeout.getAllocationRetry());
setIfNotNull(dsModel, ALLOCATION_RETRY_WAIT_MILLIS, timeout.getAllocationRetryWaitMillis());
setIfNotNull(dsModel, BLOCKING_TIMEOUT_WAIT_MILLIS, timeout.getBlockingTimeoutMillis());
setIfNotNull(dsModel, IDLETIMEOUTMINUTES, timeout.getIdleTimeoutMinutes());
setIfNotNull(dsModel, QUERYTIMEOUT, timeout.getQueryTimeout());
setIfNotNull(dsModel, USETRYLOCK, timeout.getUseTryLock());
setIfNotNull(dsModel, SETTXQUERYTIMEOUT, timeout.isSetTxQueryTimeout());
}
if (ds.getTransactionIsolation() != null) {
setIfNotNull(dsModel, TRANSACTION_ISOLOATION, ds.getTransactionIsolation().name());
}
if (ds.isSpy()) {
setIfNotNull(dsModel, SPY, ds.isSpy());
}
Validation validation = ds.getValidation();
if (validation != null) {
setIfNotNull(dsModel, CHECKVALIDCONNECTIONSQL, validation.getCheckValidConnectionSql());
setIfNotNull(dsModel, EXCEPTIONSORTERCLASSNAME, EXCEPTIONSORTER_PROPERTIES,
validation.getExceptionSorter());
setIfNotNull(dsModel, STALECONNECTIONCHECKERCLASSNAME, STALECONNECTIONCHECKER_PROPERTIES,
validation.getStaleConnectionChecker());
setIfNotNull(dsModel, VALIDCONNECTIONCHECKERCLASSNAME, VALIDCONNECTIONCHECKER_PROPERTIES,
validation.getValidConnectionChecker());
setIfNotNull(dsModel, BACKGROUNDVALIDATIONMINUTES, validation.getBackgroundValidationMinutes());
setIfNotNull(dsModel, BACKGROUNDVALIDATION, validation.isBackgroundValidation());
setIfNotNull(dsModel, USE_FAST_FAIL, validation.isUseFastFail());
setIfNotNull(dsModel, VALIDATEONMATCH, validation.isValidateOnMatch());
}
datasourcesNode.add(dsModel);
}
ModelNode XAdatasourcesNode = subsystem.get(DATASOURCES);
for (XaDataSource xads : dataSources.getXaDataSource()) {
ModelNode xadsModel = new ModelNode();
for (Entry<String, String> entry : xads.getXaDataSourceProperty().entrySet()) {
xadsModel.get(XADATASOURCEPROPERTIES, entry.getKey()).set(entry.getValue());
}
setIfNotNull(xadsModel, XADATASOURCECLASS, xads.getXaDataSourceClass());