use of org.jboss.jca.common.api.metadata.common.XaPool in project wildfly by wildfly.
the class XMLXaDataSourceRuntimeHandler method handleDatasourceAttribute.
private void handleDatasourceAttribute(final String attributeName, final OperationContext context, final XaDataSource dataSource) {
if (attributeName.equals(Constants.XA_DATASOURCE_CLASS.getName())) {
setStringIfNotNull(context, dataSource.getXaDataSourceClass());
} else if (attributeName.equals(Constants.JNDI_NAME.getName())) {
setStringIfNotNull(context, dataSource.getJndiName());
} else if (attributeName.equals(Constants.DATASOURCE_DRIVER.getName())) {
setStringIfNotNull(context, dataSource.getDriver());
} else if (attributeName.equals(Constants.NEW_CONNECTION_SQL.getName())) {
setStringIfNotNull(context, dataSource.getNewConnectionSql());
} else if (attributeName.equals(Constants.URL_DELIMITER.getName())) {
setStringIfNotNull(context, dataSource.getUrlDelimiter());
} else if (attributeName.equals(Constants.URL_PROPERTY.getName())) {
setStringIfNotNull(context, dataSource.getUrlProperty());
} else if (attributeName.equals(Constants.URL_SELECTOR_STRATEGY_CLASS_NAME.getName())) {
setStringIfNotNull(context, dataSource.getUrlSelectorStrategyClassName());
} else if (attributeName.equals(Constants.USE_JAVA_CONTEXT.getName())) {
setBooleanIfNotNull(context, dataSource.isUseJavaContext());
} else if (attributeName.equals(Constants.ENABLED.getName())) {
setBooleanIfNotNull(context, dataSource.isEnabled());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.MAX_POOL_SIZE.getName())) {
if (dataSource.getXaPool() == null) {
return;
}
setIntIfNotNull(context, dataSource.getXaPool().getMaxPoolSize());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.INITIAL_POOL_SIZE.getName())) {
if (dataSource.getXaPool() == null) {
return;
}
setIntIfNotNull(context, dataSource.getXaPool().getInitialPoolSize());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.MIN_POOL_SIZE.getName())) {
if (dataSource.getXaPool() == null) {
return;
}
setIntIfNotNull(context, dataSource.getXaPool().getMinPoolSize());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.POOL_PREFILL.getName())) {
if (dataSource.getXaPool() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getXaPool().isPrefill());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.POOL_FAIR.getName())) {
if (dataSource.getXaPool() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getXaPool().isFair());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.POOL_USE_STRICT_MIN.getName())) {
if (dataSource.getXaPool() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getXaPool().isUseStrictMin());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.POOL_FLUSH_STRATEGY.getName())) {
if (dataSource.getXaPool() == null) {
return;
}
if (dataSource.getXaPool().getFlushStrategy() == null) {
return;
}
setStringIfNotNull(context, dataSource.getXaPool().getFlushStrategy().getName());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.CAPACITY_INCREMENTER_CLASS.getName())) {
if (dataSource.getXaPool() == null || dataSource.getXaPool().getCapacity() == null || dataSource.getXaPool().getCapacity().getIncrementer() == null) {
return;
}
setStringIfNotNull(context, dataSource.getXaPool().getCapacity().getIncrementer().getClassName());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.CAPACITY_DECREMENTER_CLASS.getName())) {
if (dataSource.getXaPool() == null || dataSource.getXaPool().getCapacity() == null || dataSource.getXaPool().getCapacity().getDecrementer() == null) {
return;
}
setStringIfNotNull(context, dataSource.getXaPool().getCapacity().getDecrementer().getClassName());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.CAPACITY_INCREMENTER_PROPERTIES.getName())) {
XaPool pool = dataSource.getXaPool();
if (pool == null || pool.getCapacity() == null || pool.getCapacity().getIncrementer() == null)
return;
final Map<String, String> propertiesMap = pool.getCapacity().getIncrementer().getConfigPropertiesMap();
if (propertiesMap == null) {
return;
}
for (final Map.Entry<String, String> entry : propertiesMap.entrySet()) {
context.getResult().asPropertyList().add(new ModelNode().set(entry.getKey(), entry.getValue()).asProperty());
}
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.CAPACITY_DECREMENTER_PROPERTIES.getName())) {
XaPool pool = dataSource.getXaPool();
if (pool == null || pool.getCapacity() == null || pool.getCapacity().getDecrementer() == null)
return;
final Map<String, String> propertiesMap = pool.getCapacity().getDecrementer().getConfigPropertiesMap();
if (propertiesMap == null) {
return;
}
for (final Map.Entry<String, String> entry : propertiesMap.entrySet()) {
context.getResult().asPropertyList().add(new ModelNode().set(entry.getKey(), entry.getValue()).asProperty());
}
} else if (attributeName.equals(Constants.INTERLEAVING.getName())) {
if (dataSource.getXaPool() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getXaPool().isInterleaving());
} else if (attributeName.equals(Constants.NO_TX_SEPARATE_POOL.getName())) {
if (dataSource.getXaPool() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getXaPool().isNoTxSeparatePool());
} else if (attributeName.equals(Constants.PAD_XID.getName())) {
if (dataSource.getXaPool() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getXaPool().isPadXid());
} else if (attributeName.equals(Constants.SAME_RM_OVERRIDE.getName())) {
if (dataSource.getXaPool() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getXaPool().isSameRmOverride());
} else if (attributeName.equals(Constants.WRAP_XA_RESOURCE.getName())) {
if (dataSource.getXaPool() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getXaPool().isWrapXaResource());
} else if (attributeName.equals(Constants.PREPARED_STATEMENTS_CACHE_SIZE.getName())) {
if (dataSource.getStatement() == null) {
return;
}
setLongIfNotNull(context, dataSource.getStatement().getPreparedStatementsCacheSize());
} else if (attributeName.equals(Constants.SHARE_PREPARED_STATEMENTS.getName())) {
if (dataSource.getStatement() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getStatement().isSharePreparedStatements());
} else if (attributeName.equals(Constants.TRACK_STATEMENTS.getName())) {
if (dataSource.getStatement() == null) {
return;
}
if (dataSource.getStatement().getTrackStatements() == null) {
return;
}
setStringIfNotNull(context, dataSource.getStatement().getTrackStatements().name());
} else if (attributeName.equals(Constants.ALLOCATION_RETRY.getName())) {
if (dataSource.getTimeOut() == null) {
return;
}
setIntIfNotNull(context, dataSource.getTimeOut().getAllocationRetry());
} else if (attributeName.equals(Constants.ALLOCATION_RETRY_WAIT_MILLIS.getName())) {
if (dataSource.getTimeOut() == null) {
return;
}
setLongIfNotNull(context, dataSource.getTimeOut().getAllocationRetryWaitMillis());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.BLOCKING_TIMEOUT_WAIT_MILLIS.getName())) {
if (dataSource.getTimeOut() == null) {
return;
}
setLongIfNotNull(context, dataSource.getTimeOut().getBlockingTimeoutMillis());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.IDLETIMEOUTMINUTES.getName())) {
if (dataSource.getTimeOut() == null) {
return;
}
setLongIfNotNull(context, dataSource.getTimeOut().getIdleTimeoutMinutes());
} else if (attributeName.equals(Constants.XA_RESOURCE_TIMEOUT.getName())) {
if (dataSource.getTimeOut() == null) {
return;
}
setIntIfNotNull(context, dataSource.getTimeOut().getXaResourceTimeout());
} else if (attributeName.equals(Constants.RECOVERY_USERNAME.getName())) {
if (dataSource.getRecovery() == null) {
return;
}
if (dataSource.getRecovery().getCredential() == null) {
return;
}
setStringIfNotNull(context, dataSource.getRecovery().getCredential().getUserName());
} else if (attributeName.equals(Constants.RECOVERY_PASSWORD.getName())) {
// don't display the password
} else if (attributeName.equals(Constants.RECOVERY_SECURITY_DOMAIN.getName())) {
if (dataSource.getRecovery() == null) {
return;
}
if (dataSource.getRecovery().getCredential() == null) {
return;
}
// safe assertion because all parsers create jboss Credential
assert dataSource.getRecovery().getCredential() instanceof Credential;
if (((Credential) dataSource.getRecovery().getCredential()).isElytronEnabled()) {
return;
}
setStringIfNotNull(context, dataSource.getRecovery().getCredential().getSecurityDomain());
} else if (attributeName.equals(Constants.RECOVERY_ELYTRON_ENABLED.getName())) {
if (dataSource.getRecovery() == null) {
return;
}
if (dataSource.getRecovery().getCredential() == null) {
return;
}
// safe assertion because all parsers create jboss Credential
assert dataSource.getRecovery().getCredential() instanceof Credential;
if (!((Credential) dataSource.getRecovery().getCredential()).isElytronEnabled()) {
return;
}
setBooleanIfNotNull(context, ((Credential) dataSource.getRecovery().getCredential()).isElytronEnabled());
} else if (attributeName.equals(Constants.RECOVERY_CREDENTIAL_REFERENCE.getName())) {
// don't give out the credential-reference
} else if (attributeName.equals(Constants.RECOVERY_AUTHENTICATION_CONTEXT.getName())) {
if (dataSource.getRecovery() == null) {
return;
}
if (dataSource.getRecovery().getCredential() == null) {
return;
}
// safe assertion because all parsers create jboss Credential
assert dataSource.getRecovery().getCredential() instanceof Credential;
if (!((Credential) dataSource.getRecovery().getCredential()).isElytronEnabled()) {
return;
}
setStringIfNotNull(context, dataSource.getRecovery().getCredential().getSecurityDomain());
} else if (attributeName.equals(Constants.RECOVER_PLUGIN_CLASSNAME.getName())) {
if (dataSource.getRecovery() == null) {
return;
}
if (dataSource.getRecovery().getRecoverPlugin() == null) {
return;
}
setStringIfNotNull(context, dataSource.getRecovery().getRecoverPlugin().getClassName());
} else if (attributeName.equals(Constants.RECOVER_PLUGIN_PROPERTIES.getName())) {
if (dataSource.getRecovery() == null) {
return;
}
if (dataSource.getRecovery().getRecoverPlugin() == null) {
return;
}
final Map<String, String> propertiesMap = dataSource.getRecovery().getRecoverPlugin().getConfigPropertiesMap();
if (propertiesMap == null) {
return;
}
for (final Map.Entry<String, String> entry : propertiesMap.entrySet()) {
context.getResult().asPropertyList().add(new ModelNode().set(entry.getKey(), entry.getValue()).asProperty());
}
} else if (attributeName.equals(Constants.NO_RECOVERY.getName())) {
if (dataSource.getRecovery() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getRecovery().getNoRecovery());
} else if (attributeName.equals(Constants.CHECK_VALID_CONNECTION_SQL.getName())) {
if (dataSource.getValidation() == null) {
return;
}
setStringIfNotNull(context, dataSource.getValidation().getCheckValidConnectionSql());
} else if (attributeName.equals(Constants.EXCEPTION_SORTER_CLASSNAME.getName())) {
if (dataSource.getValidation() == null) {
return;
}
if (dataSource.getValidation().getExceptionSorter() == null) {
return;
}
setStringIfNotNull(context, dataSource.getValidation().getExceptionSorter().getClassName());
} else if (attributeName.equals(Constants.EXCEPTION_SORTER_PROPERTIES.getName())) {
if (dataSource.getValidation() == null) {
return;
}
if (dataSource.getValidation().getExceptionSorter() == null) {
return;
}
final Map<String, String> propertiesMap = dataSource.getValidation().getExceptionSorter().getConfigPropertiesMap();
if (propertiesMap == null) {
return;
}
for (final Map.Entry<String, String> entry : propertiesMap.entrySet()) {
context.getResult().asPropertyList().add(new ModelNode().set(entry.getKey(), entry.getValue()).asProperty());
}
} else if (attributeName.equals(Constants.STALE_CONNECTION_CHECKER_CLASSNAME.getName())) {
if (dataSource.getValidation() == null) {
return;
}
if (dataSource.getValidation().getStaleConnectionChecker() == null) {
return;
}
setStringIfNotNull(context, dataSource.getValidation().getStaleConnectionChecker().getClassName());
} else if (attributeName.equals(Constants.STALE_CONNECTION_CHECKER_PROPERTIES.getName())) {
if (dataSource.getValidation() == null) {
return;
}
if (dataSource.getValidation().getStaleConnectionChecker() == null) {
return;
}
final Map<String, String> propertiesMap = dataSource.getValidation().getStaleConnectionChecker().getConfigPropertiesMap();
if (propertiesMap == null) {
return;
}
for (final Map.Entry<String, String> entry : propertiesMap.entrySet()) {
context.getResult().asPropertyList().add(new ModelNode().set(entry.getKey(), entry.getValue()).asProperty());
}
} else if (attributeName.equals(Constants.VALID_CONNECTION_CHECKER_CLASSNAME.getName())) {
if (dataSource.getValidation() == null) {
return;
}
if (dataSource.getValidation().getValidConnectionChecker() == null) {
return;
}
setStringIfNotNull(context, dataSource.getValidation().getValidConnectionChecker().getClassName());
} else if (attributeName.equals(Constants.VALID_CONNECTION_CHECKER_PROPERTIES.getName())) {
if (dataSource.getValidation() == null) {
return;
}
if (dataSource.getValidation().getValidConnectionChecker() == null) {
return;
}
final Map<String, String> propertiesMap = dataSource.getValidation().getValidConnectionChecker().getConfigPropertiesMap();
if (propertiesMap == null) {
return;
}
for (final Map.Entry<String, String> entry : propertiesMap.entrySet()) {
context.getResult().asPropertyList().add(new ModelNode().set(entry.getKey(), entry.getValue()).asProperty());
}
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.BACKGROUNDVALIDATIONMILLIS.getName())) {
if (dataSource.getValidation() == null) {
return;
}
setLongIfNotNull(context, dataSource.getValidation().getBackgroundValidationMillis());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.BACKGROUNDVALIDATION.getName())) {
if (dataSource.getValidation() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getValidation().isBackgroundValidation());
} else if (attributeName.equals(org.jboss.as.connector.subsystems.common.pool.Constants.USE_FAST_FAIL.getName())) {
if (dataSource.getValidation() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getValidation().isUseFastFail());
} else if (attributeName.equals(Constants.VALIDATE_ON_MATCH.getName())) {
if (dataSource.getValidation() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getValidation().isValidateOnMatch());
} else if (attributeName.equals(Constants.USERNAME.getName())) {
if (dataSource.getSecurity() == null) {
return;
}
setStringIfNotNull(context, dataSource.getSecurity().getUserName());
} else if (attributeName.equals(Constants.PASSWORD.getName())) {
// don't give out the password
} else if (attributeName.equals(Constants.CREDENTIAL_REFERENCE.getName())) {
// don't give out the credential-reference
} else if (attributeName.equals(Constants.SECURITY_DOMAIN.getName())) {
if (dataSource.getSecurity() == null) {
return;
}
// this is a safe assert because DsXmlParser will always create a wildfly DsSecurity metadata
assert dataSource.getSecurity() instanceof DsSecurity;
if (((DsSecurity) dataSource.getSecurity()).isElytronEnabled()) {
return;
}
setStringIfNotNull(context, dataSource.getSecurity().getSecurityDomain());
} else if (attributeName.equals(Constants.ELYTRON_ENABLED.getName())) {
if (dataSource.getSecurity() == null) {
return;
}
// this is a safe assert because DsXmlParser will always create a wildfly DsSecurity metadata
assert dataSource.getSecurity() instanceof DsSecurity;
if (!((DsSecurity) dataSource.getSecurity()).isElytronEnabled()) {
return;
}
setBooleanIfNotNull(context, ((DsSecurity) dataSource.getSecurity()).isElytronEnabled());
} else if (attributeName.equals(Constants.AUTHENTICATION_CONTEXT.getName())) {
if (dataSource.getSecurity() == null) {
return;
}
// this is a safe assert because DsXmlParser will always create a wildfly DsSecurity metadata
assert dataSource.getSecurity() instanceof DsSecurity;
if (!((DsSecurity) dataSource.getSecurity()).isElytronEnabled()) {
return;
}
setStringIfNotNull(context, dataSource.getSecurity().getSecurityDomain());
} else if (attributeName.equals(Constants.REAUTH_PLUGIN_CLASSNAME.getName())) {
if (dataSource.getSecurity() == null) {
return;
}
if (dataSource.getSecurity().getReauthPlugin() == null) {
return;
}
setStringIfNotNull(context, dataSource.getSecurity().getReauthPlugin().getClassName());
} else if (attributeName.equals(Constants.REAUTHPLUGIN_PROPERTIES.getName())) {
if (dataSource.getSecurity() == null) {
return;
}
if (dataSource.getSecurity().getReauthPlugin() == null) {
return;
}
final Map<String, String> propertiesMap = dataSource.getSecurity().getReauthPlugin().getConfigPropertiesMap();
if (propertiesMap == null) {
return;
}
for (final Map.Entry<String, String> entry : propertiesMap.entrySet()) {
context.getResult().asPropertyList().add(new ModelNode().set(entry.getKey(), entry.getValue()).asProperty());
}
} else if (attributeName.equals(Constants.QUERY_TIMEOUT.getName())) {
if (dataSource.getTimeOut() == null) {
return;
}
setLongIfNotNull(context, dataSource.getTimeOut().getQueryTimeout());
} else if (attributeName.equals(Constants.USE_TRY_LOCK.getName())) {
if (dataSource.getTimeOut() == null) {
return;
}
setLongIfNotNull(context, dataSource.getTimeOut().getUseTryLock());
} else if (attributeName.equals(Constants.SET_TX_QUERY_TIMEOUT.getName())) {
if (dataSource.getTimeOut() == null) {
return;
}
setBooleanIfNotNull(context, dataSource.getTimeOut().isSetTxQueryTimeout());
} else if (attributeName.equals(Constants.TRANSACTION_ISOLATION.getName())) {
if (dataSource.getTransactionIsolation() == null) {
return;
}
setStringIfNotNull(context, dataSource.getTransactionIsolation().name());
} else if (attributeName.equals(Constants.SPY.getName())) {
setBooleanIfNotNull(context, dataSource.isSpy());
} else if (attributeName.equals(Constants.USE_CCM.getName())) {
setBooleanIfNotNull(context, dataSource.isUseCcm());
} else if (attributeName.equals(Constants.JTA.getName())) {
setBooleanIfNotNull(context, true);
} else if (attributeName.equals(Constants.ALLOW_MULTIPLE_USERS.getName())) {
XaPool pool = dataSource.getXaPool();
if (!(pool instanceof DsXaPool)) {
return;
}
setBooleanIfNotNull(context, ((DsXaPool) pool).isAllowMultipleUsers());
} else if (attributeName.equals(Constants.CONNECTION_LISTENER_CLASS.getName())) {
XaPool pool = dataSource.getXaPool();
if (!(pool instanceof DsXaPool) || ((DsXaPool) pool).getConnectionListener() == null) {
return;
}
setStringIfNotNull(context, ((DsXaPool) pool).getConnectionListener().getClassName());
} else if (attributeName.equals(Constants.CONNECTION_LISTENER_PROPERTIES.getName())) {
XaPool pool = dataSource.getXaPool();
if (!(pool instanceof DsXaPool) || ((DsXaPool) pool).getConnectionListener() == null) {
return;
}
final Map<String, String> propertiesMap = ((DsXaPool) pool).getConnectionListener().getConfigPropertiesMap();
if (propertiesMap == null) {
return;
}
for (final Map.Entry<String, String> entry : propertiesMap.entrySet()) {
context.getResult().asPropertyList().add(new ModelNode().set(entry.getKey(), entry.getValue()).asProperty());
}
} else if (attributeName.equals(Constants.CONNECTABLE.getName())) {
// Just set to false
context.getResult().set(false);
} else if (attributeName.equals(Constants.STATISTICS_ENABLED.getName())) {
// Just set to false
context.getResult().set(false);
} else if (attributeName.equals(Constants.TRACKING.getName())) {
// Just return w/o setting a result
return;
} else if (attributeName.equals(Constants.MCP.getName())) {
// Just return w/o setting a result
return;
} else if (attributeName.equals(Constants.ENLISTMENT_TRACE.getName())) {
// Just return w/o setting a result
return;
} else {
throw ConnectorLogger.ROOT_LOGGER.unknownAttribute(attributeName);
}
}
use of org.jboss.jca.common.api.metadata.common.XaPool in project wildfly by wildfly.
the class IronJacamarResourceCreator method addConnectionDefinition.
private void addConnectionDefinition(final Resource parent, ConnectionDefinition connDef) {
final Resource connDefResource = new IronJacamarResource.IronJacamarRuntimeResource();
final ModelNode model = connDefResource.getModel();
setAttribute(model, Constants.JNDINAME, connDef.getJndiName());
if (connDef.getConfigProperties() != null) {
for (Map.Entry<String, String> config : connDef.getConfigProperties().entrySet()) {
addConfigProperties(connDefResource, config.getKey(), config.getValue());
}
}
setAttribute(model, CLASS_NAME, connDef.getClassName());
setAttribute(model, JNDINAME, connDef.getJndiName());
setAttribute(model, USE_JAVA_CONTEXT, connDef.isUseJavaContext());
setAttribute(model, ENABLED, connDef.isEnabled());
setAttribute(model, CONNECTABLE, connDef.isConnectable());
if (connDef.isTracking() != null) {
setAttribute(model, TRACKING, connDef.isTracking());
}
setAttribute(model, USE_CCM, connDef.isUseCcm());
setAttribute(model, SHARABLE, connDef.isSharable());
setAttribute(model, ENLISTMENT, connDef.isEnlistment());
final Pool pool = connDef.getPool();
if (pool != null) {
setAttribute(model, MAX_POOL_SIZE, pool.getMaxPoolSize());
setAttribute(model, MIN_POOL_SIZE, pool.getMinPoolSize());
setAttribute(model, INITIAL_POOL_SIZE, pool.getInitialPoolSize());
if (pool.getCapacity() != null) {
if (pool.getCapacity().getIncrementer() != null) {
setAttribute(model, CAPACITY_INCREMENTER_CLASS, pool.getCapacity().getIncrementer().getClassName());
if (pool.getCapacity().getIncrementer().getConfigPropertiesMap() != null) {
for (Map.Entry<String, String> config : pool.getCapacity().getIncrementer().getConfigPropertiesMap().entrySet()) {
model.get(CAPACITY_INCREMENTER_PROPERTIES.getName(), config.getKey()).set(config.getValue());
}
}
}
if (pool.getCapacity().getDecrementer() != null) {
setAttribute(model, CAPACITY_DECREMENTER_CLASS, pool.getCapacity().getDecrementer().getClassName());
if (pool.getCapacity().getDecrementer().getConfigPropertiesMap() != null) {
for (Map.Entry<String, String> config : pool.getCapacity().getDecrementer().getConfigPropertiesMap().entrySet()) {
model.get(CAPACITY_DECREMENTER_PROPERTIES.getName(), config.getKey()).set(config.getValue());
}
}
}
}
setAttribute(model, POOL_USE_STRICT_MIN, pool.isUseStrictMin());
if (pool.getFlushStrategy() != null)
setAttribute(model, POOL_FLUSH_STRATEGY, pool.getFlushStrategy().name());
setAttribute(model, POOL_PREFILL, pool.isPrefill());
setAttribute(model, POOL_FAIR, pool.isFair());
if (connDef.isXa()) {
assert connDef.getPool() instanceof XaPool;
XaPool xaPool = (XaPool) connDef.getPool();
setAttribute(model, WRAP_XA_RESOURCE, xaPool.isWrapXaResource());
setAttribute(model, SAME_RM_OVERRIDE, xaPool.isSameRmOverride());
setAttribute(model, PAD_XID, xaPool.isPadXid());
setAttribute(model, INTERLEAVING, xaPool.isInterleaving());
setAttribute(model, NOTXSEPARATEPOOL, xaPool.isNoTxSeparatePool());
}
}
final Security security = connDef.getSecurity();
if (security != null) {
setAttribute(model, APPLICATION, security.isApplication());
if (security instanceof org.jboss.as.connector.metadata.api.common.Security && ((org.jboss.as.connector.metadata.api.common.Security) security).isElytronEnabled()) {
setAttribute(model, ELYTRON_ENABLED, true);
setAttribute(model, AUTHENTICATION_CONTEXT, security.getSecurityDomain());
setAttribute(model, AUTHENTICATION_CONTEXT_AND_APPLICATION, security.getSecurityDomainAndApplication());
} else {
setAttribute(model, SECURITY_DOMAIN, security.getSecurityDomain());
setAttribute(model, SECURITY_DOMAIN_AND_APPLICATION, security.getSecurityDomainAndApplication());
}
}
final TimeOut timeOut = connDef.getTimeOut();
if (timeOut != null) {
setAttribute(model, ALLOCATION_RETRY, timeOut.getAllocationRetry());
setAttribute(model, ALLOCATION_RETRY_WAIT_MILLIS, timeOut.getAllocationRetryWaitMillis());
setAttribute(model, BLOCKING_TIMEOUT_WAIT_MILLIS, timeOut.getBlockingTimeoutMillis());
setAttribute(model, IDLETIMEOUTMINUTES, timeOut.getIdleTimeoutMinutes());
setAttribute(model, XA_RESOURCE_TIMEOUT, timeOut.getXaResourceTimeout());
}
final Validation validation = connDef.getValidation();
if (validation != null) {
setAttribute(model, BACKGROUNDVALIDATIONMILLIS, validation.getBackgroundValidationMillis());
setAttribute(model, BACKGROUNDVALIDATION, validation.isBackgroundValidation());
setAttribute(model, USE_FAST_FAIL, validation.isUseFastFail());
setAttribute(model, VALIDATE_ON_MATCH, validation.isValidateOnMatch());
}
final Recovery recovery = connDef.getRecovery();
if (recovery != null) {
setAttribute(model, NO_RECOVERY, recovery.getNoRecovery());
final Extension recoverPlugin = recovery.getRecoverPlugin();
if (recoverPlugin != null) {
setAttribute(model, RECOVERLUGIN_CLASSNAME, recoverPlugin.getClassName());
if (recoverPlugin.getConfigPropertiesMap() != null) {
for (Map.Entry<String, String> config : recoverPlugin.getConfigPropertiesMap().entrySet()) {
model.get(RECOVERLUGIN_PROPERTIES.getName(), config.getKey()).set(config.getValue());
}
}
}
final Credential recoveryCredential = recovery.getCredential();
if (recoveryCredential != null) {
setAttribute(model, RECOVERY_PASSWORD, recoveryCredential.getPassword());
if (recoveryCredential instanceof org.jboss.as.connector.metadata.api.common.Credential && ((org.jboss.as.connector.metadata.api.common.Credential) recoveryCredential).isElytronEnabled()) {
setAttribute(model, RECOVERY_ELYTRON_ENABLED, true);
setAttribute(model, RECOVERY_AUTHENTICATION_CONTEXT, recoveryCredential.getSecurityDomain());
} else {
setAttribute(model, RECOVERY_SECURITY_DOMAIN, recoveryCredential.getSecurityDomain());
}
setAttribute(model, RECOVERY_USERNAME, recoveryCredential.getUserName());
}
}
final Resource statsResource = new IronJacamarResource.IronJacamarRuntimeResource();
connDefResource.registerChild(PathElement.pathElement(Constants.STATISTICS_NAME, "local"), statsResource);
final PathElement element = PathElement.pathElement(Constants.CONNECTIONDEFINITIONS_NAME, connDef.getJndiName());
parent.registerChild(element, connDefResource);
}
Aggregations