boolean sharePreparedStatements = getBooleanIfSetOrGetDefault(dataSourceNode, USE_JAVA_CONTEXT, false);
Long preparedStatementsCacheSize = getLongIfSetOrGetDefault(dataSourceNode, PREPAREDSTATEMENTSCACHESIZE,
null);
TrackStatementsEnum trackStatements = dataSourceNode.hasDefined(TRACKSTATEMENTS) ? TrackStatementsEnum
.valueOf(dataSourceNode.get(TRACKSTATEMENTS).asString()) : TrackStatementsEnum.NOWARN;
Statement statement = new StatementImpl(sharePreparedStatements, preparedStatementsCacheSize,
trackStatements);
Integer allocationRetry = getIntIfSetOrGetDefault(dataSourceNode, ALLOCATION_RETRY, null);
Long allocationRetryWaitMillis = getLongIfSetOrGetDefault(dataSourceNode, ALLOCATION_RETRY_WAIT_MILLIS,
null);
Long blockingTimeoutMillis = getLongIfSetOrGetDefault(dataSourceNode, BLOCKING_TIMEOUT_WAIT_MILLIS, null);
Long idleTimeoutMinutes = getLongIfSetOrGetDefault(dataSourceNode, IDLETIMEOUTMINUTES, null);
Long queryTimeout = getLongIfSetOrGetDefault(dataSourceNode, QUERYTIMEOUT, null);
Integer xaResourceTimeout = getIntIfSetOrGetDefault(dataSourceNode, XA_RESOURCE_TIMEOUT, null);
Long useTryLock = getLongIfSetOrGetDefault(dataSourceNode, USETRYLOCK, null);
boolean setTxQuertTimeout = getBooleanIfSetOrGetDefault(dataSourceNode, SETTXQUERYTIMEOUT, false);
TimeOut timeOut = new TimeOutImpl(blockingTimeoutMillis, idleTimeoutMinutes, allocationRetry,
allocationRetryWaitMillis, xaResourceTimeout, setTxQuertTimeout, queryTimeout, useTryLock);
TransactionIsolation transactionIsolation = dataSourceNode.has(TRANSACTION_ISOLOATION) ? TransactionIsolation
.valueOf(dataSourceNode.get(TRANSACTION_ISOLOATION).asString()) : null;
String checkValidConnectionSql = getStringIfSetOrGetDefault(dataSourceNode, CHECKVALIDCONNECTIONSQL, null);
JdbcAdapterExtension exceptionSorter = extractJdbcAdapterExtension(dataSourceNode,
EXCEPTIONSORTERCLASSNAME, EXCEPTIONSORTER_PROPERTIES);
JdbcAdapterExtension staleConnectionChecker = extractJdbcAdapterExtension(dataSourceNode,
STALECONNECTIONCHECKERCLASSNAME, STALECONNECTIONCHECKER_PROPERTIES);
JdbcAdapterExtension validConnectionChecker = extractJdbcAdapterExtension(dataSourceNode,
VALIDCONNECTIONCHECKERCLASSNAME, VALIDCONNECTIONCHECKER_PROPERTIES);
Long backgroundValidationMinutes = getLongIfSetOrGetDefault(dataSourceNode, BACKGROUNDVALIDATIONMINUTES,
null);
boolean backgroundValidation = getBooleanIfSetOrGetDefault(dataSourceNode, BACKGROUNDVALIDATION, false);
boolean useFastFail = getBooleanIfSetOrGetDefault(dataSourceNode, USE_FAST_FAIL, false);
boolean validateOnMatch = getBooleanIfSetOrGetDefault(dataSourceNode, VALIDATEONMATCH, false);
boolean spy = getBooleanIfSetOrGetDefault(dataSourceNode, SPY, false);
Validation validation = new ValidationImpl(backgroundValidation, backgroundValidationMinutes, useFastFail,
validConnectionChecker, checkValidConnectionSql, validateOnMatch, staleConnectionChecker,
exceptionSorter);
DataSource ds = new DataSourceImpl(connectionUrl, driverClass, module, transactionIsolation,
connectionProperties, timeOut, security, statement, validation, urlDelimiter,
urlSelectorStrategyClassName, newConnectionSql, useJavaContext, poolName, enabled, jndiName, spy,
pool);
datasourceList.add(ds);
}
}
if (operation.hasDefined(XA_DATASOURCES)) {
for (ModelNode dataSourceNode : operation.get(XA_DATASOURCES).asList()) {
Map<String, String> xaDataSourceProperty = new HashMap<String, String>(dataSourceNode
.get(XADATASOURCEPROPERTIES).asList().size());
for (ModelNode property : dataSourceNode.get(XADATASOURCEPROPERTIES).asList()) {
xaDataSourceProperty.put(property.asProperty().getName(), property.asString());
}
String xaDataSourceClass = getStringIfSetOrGetDefault(dataSourceNode, XADATASOURCECLASS, null);
String jndiName = getStringIfSetOrGetDefault(dataSourceNode, JNDINAME, null);
String module = getStringIfSetOrGetDefault(dataSourceNode, MODULE, null);
String newConnectionSql = getStringIfSetOrGetDefault(dataSourceNode, NEW_CONNECTION_SQL, null);
String poolName = getStringIfSetOrGetDefault(dataSourceNode, POOLNAME, null);
String urlDelimiter = getStringIfSetOrGetDefault(dataSourceNode, URL_DELIMITER, null);
String urlSelectorStrategyClassName = getStringIfSetOrGetDefault(dataSourceNode,
URL_SELECTOR_STRATEGY_CLASS_NAME, null);
boolean useJavaContext = getBooleanIfSetOrGetDefault(dataSourceNode, USE_JAVA_CONTEXT, false);
boolean enabled = getBooleanIfSetOrGetDefault(dataSourceNode, ENABLED, false);
Integer maxPoolSize = getIntIfSetOrGetDefault(dataSourceNode, MAX_POOL_SIZE, null);
Integer minPoolSize = getIntIfSetOrGetDefault(dataSourceNode, MIN_POOL_SIZE, null);
boolean prefill = getBooleanIfSetOrGetDefault(dataSourceNode, POOL_PREFILL, false);
boolean useStrictMin = getBooleanIfSetOrGetDefault(dataSourceNode, POOL_USE_STRICT_MIN, false);
boolean interleaving = getBooleanIfSetOrGetDefault(dataSourceNode, INTERLIVING, false);
boolean noTxSeparatePool = getBooleanIfSetOrGetDefault(dataSourceNode, NOTXSEPARATEPOOL, false);
boolean padXid = getBooleanIfSetOrGetDefault(dataSourceNode, PAD_XID, false);
boolean isSameRmOverride = getBooleanIfSetOrGetDefault(dataSourceNode, SAME_RM_OVERRIDE, false);
boolean wrapXaDataSource = getBooleanIfSetOrGetDefault(dataSourceNode, WRAP_XA_DATASOURCE, false);
CommonXaPool xaPool = new CommonXaPoolImpl(minPoolSize, maxPoolSize, prefill, useStrictMin,
isSameRmOverride, interleaving, padXid, wrapXaDataSource, noTxSeparatePool);
String username = getStringIfSetOrGetDefault(dataSourceNode, USERNAME, null);
String password = getStringIfSetOrGetDefault(dataSourceNode, PASSWORD, null);
String securityDomain = getStringIfSetOrGetDefault(dataSourceNode, SECURITY_DOMAIN, null);
DsSecurity security = new DsSecurityImpl(username, password, securityDomain);
boolean sharePreparedStatements = dataSourceNode.has(SHAREPREPAREDSTATEMENTS) ? dataSourceNode.get(
SHAREPREPAREDSTATEMENTS).asBoolean() : false;
Long preparedStatementsCacheSize = dataSourceNode.get(PREPAREDSTATEMENTSCACHESIZE).asLong();
TrackStatementsEnum trackStatements = TrackStatementsEnum.valueOf(dataSourceNode.get(TRACKSTATEMENTS)
.asString());
Statement statement = new StatementImpl(sharePreparedStatements, preparedStatementsCacheSize,
trackStatements);
Integer allocationRetry = getIntIfSetOrGetDefault(dataSourceNode, ALLOCATION_RETRY, null);
Long allocationRetryWaitMillis = getLongIfSetOrGetDefault(dataSourceNode, ALLOCATION_RETRY_WAIT_MILLIS,
null);