Search in sources :

Example 1 with Extension

use of org.jboss.jca.common.api.metadata.common.Extension in project wildfly by wildfly.

the class RaOperationUtil method buildConnectionDefinitionObject.

public static ModifiableConnDef buildConnectionDefinitionObject(final OperationContext context, final ModelNode connDefModel, final String poolName, final boolean isXa, ExceptionSupplier<CredentialSource, Exception> recoveryCredentialSourceSupplier) throws OperationFailedException, ValidateException {
    Map<String, String> configProperties = new HashMap<String, String>(0);
    String className = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, connDefModel, CLASS_NAME);
    String jndiName = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, connDefModel, JNDINAME);
    boolean enabled = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, ENABLED);
    boolean connectable = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, CONNECTABLE);
    Boolean tracking = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, TRACKING);
    boolean useJavaContext = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, USE_JAVA_CONTEXT);
    boolean useCcm = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, USE_CCM);
    boolean sharable = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, SHARABLE);
    boolean enlistment = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, ENLISTMENT);
    final String mcp = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, connDefModel, MCP);
    final Boolean enlistmentTrace = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, ENLISTMENT_TRACE);
    int maxPoolSize = ModelNodeUtil.getIntIfSetOrGetDefault(context, connDefModel, MAX_POOL_SIZE);
    int minPoolSize = ModelNodeUtil.getIntIfSetOrGetDefault(context, connDefModel, MIN_POOL_SIZE);
    Integer initialPoolSize = ModelNodeUtil.getIntIfSetOrGetDefault(context, connDefModel, INITIAL_POOL_SIZE);
    boolean prefill = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, POOL_PREFILL);
    boolean fair = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, POOL_FAIR);
    boolean useStrictMin = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, POOL_USE_STRICT_MIN);
    String flushStrategyString = POOL_FLUSH_STRATEGY.resolveModelAttribute(context, connDefModel).asString();
    final FlushStrategy flushStrategy = FlushStrategy.forName(flushStrategyString);
    Boolean isSameRM = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, SAME_RM_OVERRIDE);
    boolean interlivng = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, INTERLEAVING);
    boolean padXid = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, PAD_XID);
    boolean wrapXaResource = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, WRAP_XA_RESOURCE);
    boolean noTxSeparatePool = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, NOTXSEPARATEPOOL);
    Integer allocationRetry = ModelNodeUtil.getIntIfSetOrGetDefault(context, connDefModel, ALLOCATION_RETRY);
    Long allocationRetryWaitMillis = ModelNodeUtil.getLongIfSetOrGetDefault(context, connDefModel, ALLOCATION_RETRY_WAIT_MILLIS);
    Long blockingTimeoutMillis = ModelNodeUtil.getLongIfSetOrGetDefault(context, connDefModel, BLOCKING_TIMEOUT_WAIT_MILLIS);
    Long idleTimeoutMinutes = ModelNodeUtil.getLongIfSetOrGetDefault(context, connDefModel, IDLETIMEOUTMINUTES);
    Integer xaResourceTimeout = ModelNodeUtil.getIntIfSetOrGetDefault(context, connDefModel, XA_RESOURCE_TIMEOUT);
    TimeOut timeOut = new TimeOutImpl(blockingTimeoutMillis, idleTimeoutMinutes, allocationRetry, allocationRetryWaitMillis, xaResourceTimeout);
    Extension incrementer = ModelNodeUtil.extractExtension(context, connDefModel, CAPACITY_INCREMENTER_CLASS, CAPACITY_INCREMENTER_PROPERTIES);
    Extension decrementer = ModelNodeUtil.extractExtension(context, connDefModel, CAPACITY_DECREMENTER_CLASS, CAPACITY_DECREMENTER_PROPERTIES);
    final Capacity capacity = new Capacity(incrementer, decrementer);
    Pool pool;
    if (isXa) {
        pool = new XaPoolImpl(minPoolSize, initialPoolSize, maxPoolSize, prefill, useStrictMin, flushStrategy, capacity, fair, isSameRM, interlivng, padXid, wrapXaResource, noTxSeparatePool);
    } else {
        pool = new PoolImpl(minPoolSize, initialPoolSize, maxPoolSize, prefill, useStrictMin, flushStrategy, capacity, fair);
    }
    String securityDomain = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, connDefModel, SECURITY_DOMAIN);
    String securityDomainAndApplication = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, connDefModel, SECURITY_DOMAIN_AND_APPLICATION);
    boolean elytronEnabled = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, ELYTRON_ENABLED);
    String authenticationContext = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, connDefModel, AUTHENTICATION_CONTEXT);
    String authenticationContextAndApplication = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, connDefModel, AUTHENTICATION_CONTEXT_AND_APPLICATION);
    boolean application = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, APPLICATION);
    Security security = null;
    if (securityDomain != null || securityDomainAndApplication != null || application) {
        security = new SecurityImpl(elytronEnabled ? authenticationContext : securityDomain, elytronEnabled ? authenticationContextAndApplication : securityDomainAndApplication, application, elytronEnabled);
    }
    Long backgroundValidationMillis = ModelNodeUtil.getLongIfSetOrGetDefault(context, connDefModel, BACKGROUNDVALIDATIONMILLIS);
    Boolean backgroundValidation = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, BACKGROUNDVALIDATION);
    boolean useFastFail = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, USE_FAST_FAIL);
    final Boolean validateOnMatch = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, VALIDATE_ON_MATCH);
    Validation validation = new ValidationImpl(validateOnMatch, backgroundValidation, backgroundValidationMillis, useFastFail);
    final String recoveryUsername = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, connDefModel, RECOVERY_USERNAME);
    final String recoveryPassword = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, connDefModel, RECOVERY_PASSWORD);
    final String recoverySecurityDomain = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, connDefModel, RECOVERY_SECURITY_DOMAIN);
    final boolean recoveryElytronEnabled = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, RECOVERY_ELYTRON_ENABLED);
    final String recoveryAuthenticationContext = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(context, connDefModel, RECOVERY_AUTHENTICATION_CONTEXT);
    Boolean noRecovery = ModelNodeUtil.getBooleanIfSetOrGetDefault(context, connDefModel, NO_RECOVERY);
    Recovery recovery = null;
    if ((recoveryUsername != null && (recoveryPassword != null || recoveryCredentialSourceSupplier != null)) || recoverySecurityDomain != null || noRecovery != null) {
        Credential credential = null;
        if ((recoveryUsername != null && (recoveryPassword != null || recoveryCredentialSourceSupplier != null)) || recoverySecurityDomain != null)
            credential = new CredentialImpl(recoveryUsername, recoveryPassword, recoveryElytronEnabled ? recoveryAuthenticationContext : recoverySecurityDomain, recoveryElytronEnabled, recoveryCredentialSourceSupplier);
        Extension recoverPlugin = ModelNodeUtil.extractExtension(context, connDefModel, RECOVERLUGIN_CLASSNAME, RECOVERLUGIN_PROPERTIES);
        if (noRecovery == null)
            noRecovery = Boolean.FALSE;
        recovery = new Recovery(credential, recoverPlugin, noRecovery);
    }
    ModifiableConnDef connectionDefinition = new ModifiableConnDef(configProperties, className, jndiName, poolName, enabled, useJavaContext, useCcm, pool, timeOut, validation, security, recovery, sharable, enlistment, connectable, tracking, mcp, enlistmentTrace);
    return connectionDefinition;
}
Also used : Validation(org.jboss.jca.common.api.metadata.common.Validation) Credential(org.jboss.as.connector.metadata.api.common.Credential) HashMap(java.util.HashMap) TimeOut(org.jboss.jca.common.api.metadata.common.TimeOut) XaPoolImpl(org.jboss.jca.common.metadata.common.XaPoolImpl) PoolImpl(org.jboss.jca.common.metadata.common.PoolImpl) WorkManagerSecurity(org.jboss.jca.common.api.metadata.resourceadapter.WorkManagerSecurity) Security(org.jboss.jca.common.api.metadata.common.Security) Recovery(org.jboss.jca.common.api.metadata.common.Recovery) ValidationImpl(org.jboss.jca.common.metadata.common.ValidationImpl) Extension(org.jboss.jca.common.api.metadata.common.Extension) SecurityImpl(org.jboss.as.connector.metadata.common.SecurityImpl) WorkManagerSecurityImpl(org.jboss.as.connector.metadata.resourceadapter.WorkManagerSecurityImpl) CredentialImpl(org.jboss.as.connector.metadata.common.CredentialImpl) Capacity(org.jboss.jca.common.api.metadata.common.Capacity) FlushStrategy(org.jboss.jca.common.api.metadata.common.FlushStrategy) XaPoolImpl(org.jboss.jca.common.metadata.common.XaPoolImpl) Pool(org.jboss.jca.common.api.metadata.common.Pool) TimeOutImpl(org.jboss.jca.common.metadata.common.TimeOutImpl)

Example 2 with Extension

use of org.jboss.jca.common.api.metadata.common.Extension in project wildfly by wildfly.

the class DataSourceModelNodeUtil method from.

static ModifiableDataSource from(final OperationContext operationContext, final ModelNode dataSourceNode, final String dsName, final ExceptionSupplier<CredentialSource, Exception> credentialSourceSupplier) throws OperationFailedException, ValidateException {
    final Map<String, String> connectionProperties = Collections.emptyMap();
    final String connectionUrl = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, CONNECTION_URL);
    final String driverClass = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, DRIVER_CLASS);
    final String dataSourceClass = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, DATASOURCE_CLASS);
    final String jndiName = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, JNDI_NAME);
    final String driver = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, DATASOURCE_DRIVER);
    final String newConnectionSql = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, NEW_CONNECTION_SQL);
    final String poolName = dsName;
    final String urlDelimiter = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, URL_DELIMITER);
    final String urlSelectorStrategyClassName = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, URL_SELECTOR_STRATEGY_CLASS_NAME);
    final boolean useJavaContext = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, USE_JAVA_CONTEXT);
    final boolean enabled = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, ENABLED);
    final boolean connectable = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, CONNECTABLE);
    final Boolean tracking = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, TRACKING);
    final Boolean enlistmentTrace = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, ENLISTMENT_TRACE);
    final String mcp = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, MCP);
    final boolean jta = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, JTA);
    final Integer maxPoolSize = ModelNodeUtil.getIntIfSetOrGetDefault(operationContext, dataSourceNode, MAX_POOL_SIZE);
    final Integer minPoolSize = ModelNodeUtil.getIntIfSetOrGetDefault(operationContext, dataSourceNode, MIN_POOL_SIZE);
    final Integer initialPoolSize = ModelNodeUtil.getIntIfSetOrGetDefault(operationContext, dataSourceNode, INITIAL_POOL_SIZE);
    final boolean prefill = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, POOL_PREFILL);
    final boolean fair = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, POOL_FAIR);
    final boolean useStrictMin = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, POOL_USE_STRICT_MIN);
    final String flushStrategyString = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, POOL_FLUSH_STRATEGY);
    // TODO relax case sensitivity
    final FlushStrategy flushStrategy = FlushStrategy.forName(flushStrategyString);
    final Boolean allowMultipleUsers = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, ALLOW_MULTIPLE_USERS);
    Extension incrementer = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, CAPACITY_INCREMENTER_CLASS, CAPACITY_INCREMENTER_PROPERTIES);
    Extension decrementer = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, CAPACITY_DECREMENTER_CLASS, CAPACITY_DECREMENTER_PROPERTIES);
    final Capacity capacity = new Capacity(incrementer, decrementer);
    final Extension connectionListener = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, CONNECTION_LISTENER_CLASS, CONNECTION_LISTENER_PROPERTIES);
    final DsPool pool = new DsPoolImpl(minPoolSize, initialPoolSize, maxPoolSize, prefill, useStrictMin, flushStrategy, allowMultipleUsers, capacity, fair, connectionListener);
    final String username = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, USERNAME);
    final String password = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, PASSWORD);
    final String securityDomain = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, SECURITY_DOMAIN);
    final boolean elytronEnabled = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, ELYTRON_ENABLED);
    final String authenticationContext = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, AUTHENTICATION_CONTEXT);
    final Extension reauthPlugin = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, REAUTH_PLUGIN_CLASSNAME, REAUTHPLUGIN_PROPERTIES);
    final DsSecurity security = new DsSecurityImpl(username, password, elytronEnabled ? authenticationContext : securityDomain, elytronEnabled, credentialSourceSupplier, reauthPlugin);
    final boolean sharePreparedStatements = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, SHARE_PREPARED_STATEMENTS);
    final Long preparedStatementsCacheSize = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, PREPARED_STATEMENTS_CACHE_SIZE);
    final String trackStatementsString = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, TRACK_STATEMENTS);
    final Statement.TrackStatementsEnum trackStatements = Statement.TrackStatementsEnum.valueOf(trackStatementsString.toUpperCase(Locale.ENGLISH));
    final Statement statement = new StatementImpl(sharePreparedStatements, preparedStatementsCacheSize, trackStatements);
    final Integer allocationRetry = ModelNodeUtil.getIntIfSetOrGetDefault(operationContext, dataSourceNode, ALLOCATION_RETRY);
    final Long allocationRetryWaitMillis = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, ALLOCATION_RETRY_WAIT_MILLIS);
    final Long blockingTimeoutMillis = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, BLOCKING_TIMEOUT_WAIT_MILLIS);
    final Long idleTimeoutMinutes = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, IDLETIMEOUTMINUTES);
    final Long queryTimeout = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, QUERY_TIMEOUT);
    final Integer xaResourceTimeout = ModelNodeUtil.getIntIfSetOrGetDefault(operationContext, dataSourceNode, XA_RESOURCE_TIMEOUT);
    final Long useTryLock = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, USE_TRY_LOCK);
    final boolean setTxQueryTimeout = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, SET_TX_QUERY_TIMEOUT);
    final TimeOut timeOut = new TimeOutImpl(blockingTimeoutMillis, idleTimeoutMinutes, allocationRetry, allocationRetryWaitMillis, xaResourceTimeout, setTxQueryTimeout, queryTimeout, useTryLock);
    final String transactionIsolationString = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, TRANSACTION_ISOLATION);
    TransactionIsolation transactionIsolation = null;
    if (transactionIsolationString != null) {
        // TODO relax case sensitivity
        transactionIsolation = TransactionIsolation.forName(transactionIsolationString);
        if (transactionIsolation == null) {
            transactionIsolation = TransactionIsolation.customLevel(transactionIsolationString);
        }
    }
    final String checkValidConnectionSql = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, CHECK_VALID_CONNECTION_SQL);
    final Extension exceptionSorter = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, EXCEPTION_SORTER_CLASSNAME, EXCEPTION_SORTER_PROPERTIES);
    final Extension staleConnectionChecker = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, STALE_CONNECTION_CHECKER_CLASSNAME, STALE_CONNECTION_CHECKER_PROPERTIES);
    final Extension validConnectionChecker = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, VALID_CONNECTION_CHECKER_CLASSNAME, VALID_CONNECTION_CHECKER_PROPERTIES);
    Long backgroundValidationMillis = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, BACKGROUNDVALIDATIONMILLIS);
    final Boolean backgroundValidation = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, BACKGROUNDVALIDATION);
    boolean useFastFail = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, USE_FAST_FAIL);
    final Boolean validateOnMatch = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, VALIDATE_ON_MATCH);
    final boolean spy = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, SPY);
    final boolean useCcm = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, USE_CCM);
    final Validation validation = new ValidationImpl(backgroundValidation, backgroundValidationMillis, useFastFail, validConnectionChecker, checkValidConnectionSql, validateOnMatch, staleConnectionChecker, exceptionSorter);
    return new ModifiableDataSource(connectionUrl, driverClass, dataSourceClass, driver, transactionIsolation, connectionProperties, timeOut, security, statement, validation, urlDelimiter, urlSelectorStrategyClassName, newConnectionSql, useJavaContext, poolName, enabled, jndiName, spy, useCcm, jta, connectable, tracking, mcp, enlistmentTrace, pool);
}
Also used : Validation(org.jboss.jca.common.api.metadata.ds.Validation) DsSecurity(org.jboss.as.connector.metadata.api.ds.DsSecurity) Statement(org.jboss.jca.common.api.metadata.ds.Statement) TimeOut(org.jboss.jca.common.api.metadata.ds.TimeOut) TransactionIsolation(org.jboss.jca.common.api.metadata.ds.TransactionIsolation) DsPool(org.jboss.jca.common.api.metadata.ds.DsPool) ValidationImpl(org.jboss.jca.common.metadata.ds.ValidationImpl) Extension(org.jboss.jca.common.api.metadata.common.Extension) Capacity(org.jboss.jca.common.api.metadata.common.Capacity) FlushStrategy(org.jboss.jca.common.api.metadata.common.FlushStrategy) DsSecurityImpl(org.jboss.as.connector.metadata.ds.DsSecurityImpl) StatementImpl(org.jboss.jca.common.metadata.ds.StatementImpl) DsPoolImpl(org.jboss.jca.common.metadata.ds.DsPoolImpl) TimeOutImpl(org.jboss.jca.common.metadata.ds.TimeOutImpl)

Example 3 with Extension

use of org.jboss.jca.common.api.metadata.common.Extension in project wildfly by wildfly.

the class DataSourceModelNodeUtil method xaFrom.

static ModifiableXaDataSource xaFrom(final OperationContext operationContext, final ModelNode dataSourceNode, final String dsName, final ExceptionSupplier<CredentialSource, Exception> credentialSourceSupplier, final ExceptionSupplier<CredentialSource, Exception> recoveryCredentialSourceSupplier) throws OperationFailedException, ValidateException {
    final Map<String, String> xaDataSourceProperty;
    xaDataSourceProperty = Collections.emptyMap();
    final String xaDataSourceClass = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, XA_DATASOURCE_CLASS);
    final String jndiName = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, JNDI_NAME);
    final String module = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, DATASOURCE_DRIVER);
    final String newConnectionSql = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, NEW_CONNECTION_SQL);
    final String poolName = dsName;
    final String urlDelimiter = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, URL_DELIMITER);
    final String urlSelectorStrategyClassName = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, URL_SELECTOR_STRATEGY_CLASS_NAME);
    final Boolean useJavaContext = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, USE_JAVA_CONTEXT);
    final Boolean enabled = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, ENABLED);
    final boolean connectable = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, CONNECTABLE);
    final Boolean tracking = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, TRACKING);
    final Boolean enlistmentTrace = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, ENLISTMENT_TRACE);
    final String mcp = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, MCP);
    final Integer maxPoolSize = ModelNodeUtil.getIntIfSetOrGetDefault(operationContext, dataSourceNode, MAX_POOL_SIZE);
    final Integer minPoolSize = ModelNodeUtil.getIntIfSetOrGetDefault(operationContext, dataSourceNode, MIN_POOL_SIZE);
    final Integer initialPoolSize = ModelNodeUtil.getIntIfSetOrGetDefault(operationContext, dataSourceNode, INITIAL_POOL_SIZE);
    final Boolean prefill = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, POOL_PREFILL);
    final Boolean fair = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, POOL_FAIR);
    final Boolean useStrictMin = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, POOL_USE_STRICT_MIN);
    final Boolean interleaving = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, INTERLEAVING);
    final Boolean noTxSeparatePool = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, NO_TX_SEPARATE_POOL);
    final Boolean padXid = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, PAD_XID);
    final Boolean isSameRmOverride = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, SAME_RM_OVERRIDE);
    final Boolean wrapXaDataSource = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, WRAP_XA_RESOURCE);
    final String flushStrategyString = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, POOL_FLUSH_STRATEGY);
    // TODO relax case sensitivity
    final FlushStrategy flushStrategy = FlushStrategy.forName(flushStrategyString);
    final Boolean allowMultipleUsers = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, ALLOW_MULTIPLE_USERS);
    Extension incrementer = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, CAPACITY_INCREMENTER_CLASS, CAPACITY_INCREMENTER_PROPERTIES);
    Extension decrementer = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, CAPACITY_DECREMENTER_CLASS, CAPACITY_DECREMENTER_PROPERTIES);
    final Capacity capacity = new Capacity(incrementer, decrementer);
    final Extension connectionListener = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, CONNECTION_LISTENER_CLASS, CONNECTION_LISTENER_PROPERTIES);
    final DsXaPool xaPool = new DsXaPoolImpl(minPoolSize, initialPoolSize, maxPoolSize, prefill, useStrictMin, flushStrategy, isSameRmOverride, interleaving, padXid, wrapXaDataSource, noTxSeparatePool, allowMultipleUsers, capacity, fair, connectionListener);
    final String username = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, USERNAME);
    final String password = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, PASSWORD);
    final String securityDomain = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, SECURITY_DOMAIN);
    final boolean elytronEnabled = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, ELYTRON_ENABLED);
    final String authenticationContext = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, AUTHENTICATION_CONTEXT);
    final Extension reauthPlugin = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, REAUTH_PLUGIN_CLASSNAME, REAUTHPLUGIN_PROPERTIES);
    final DsSecurity security = new DsSecurityImpl(username, password, elytronEnabled ? authenticationContext : securityDomain, elytronEnabled, credentialSourceSupplier, reauthPlugin);
    final Boolean sharePreparedStatements = dataSourceNode.hasDefined(SHARE_PREPARED_STATEMENTS.getName()) ? dataSourceNode.get(SHARE_PREPARED_STATEMENTS.getName()).asBoolean() : Defaults.SHARE_PREPARED_STATEMENTS;
    final Long preparedStatementsCacheSize = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, PREPARED_STATEMENTS_CACHE_SIZE);
    final String trackStatementsString = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, TRACK_STATEMENTS);
    final Statement.TrackStatementsEnum trackStatements = Statement.TrackStatementsEnum.valueOf(trackStatementsString.toUpperCase(Locale.ENGLISH));
    final Statement statement = new StatementImpl(sharePreparedStatements, preparedStatementsCacheSize, trackStatements);
    final Integer allocationRetry = ModelNodeUtil.getIntIfSetOrGetDefault(operationContext, dataSourceNode, ALLOCATION_RETRY);
    final Long allocationRetryWaitMillis = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, ALLOCATION_RETRY_WAIT_MILLIS);
    final Long blockingTimeoutMillis = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, BLOCKING_TIMEOUT_WAIT_MILLIS);
    final Long idleTimeoutMinutes = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, IDLETIMEOUTMINUTES);
    final Long queryTimeout = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, QUERY_TIMEOUT);
    final Integer xaResourceTimeout = ModelNodeUtil.getIntIfSetOrGetDefault(operationContext, dataSourceNode, XA_RESOURCE_TIMEOUT);
    final Long useTryLock = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, USE_TRY_LOCK);
    final Boolean setTxQueryTimeout = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, SET_TX_QUERY_TIMEOUT);
    final TimeOut timeOut = new TimeOutImpl(blockingTimeoutMillis, idleTimeoutMinutes, allocationRetry, allocationRetryWaitMillis, xaResourceTimeout, setTxQueryTimeout, queryTimeout, useTryLock);
    final String transactionIsolationString = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, TRANSACTION_ISOLATION);
    TransactionIsolation transactionIsolation = null;
    if (transactionIsolationString != null) {
        // TODO relax case sensitivity
        transactionIsolation = TransactionIsolation.forName(transactionIsolationString);
        if (transactionIsolation == null) {
            transactionIsolation = TransactionIsolation.customLevel(transactionIsolationString);
        }
    }
    final String checkValidConnectionSql = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, CHECK_VALID_CONNECTION_SQL);
    final Extension exceptionSorter = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, EXCEPTION_SORTER_CLASSNAME, EXCEPTION_SORTER_PROPERTIES);
    final Extension staleConnectionChecker = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, STALE_CONNECTION_CHECKER_CLASSNAME, STALE_CONNECTION_CHECKER_PROPERTIES);
    final Extension validConnectionChecker = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, VALID_CONNECTION_CHECKER_CLASSNAME, VALID_CONNECTION_CHECKER_PROPERTIES);
    Long backgroundValidationMillis = ModelNodeUtil.getLongIfSetOrGetDefault(operationContext, dataSourceNode, BACKGROUNDVALIDATIONMILLIS);
    final Boolean backgroundValidation = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, BACKGROUNDVALIDATION);
    boolean useFastFail = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, USE_FAST_FAIL);
    final Boolean validateOnMatch = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, VALIDATE_ON_MATCH);
    final Boolean spy = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, SPY);
    final Boolean useCcm = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, USE_CCM);
    final Validation validation = new ValidationImpl(backgroundValidation, backgroundValidationMillis, useFastFail, validConnectionChecker, checkValidConnectionSql, validateOnMatch, staleConnectionChecker, exceptionSorter);
    final String recoveryUsername = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, RECOVERY_USERNAME);
    final String recoveryPassword = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, RECOVERY_PASSWORD);
    final String recoverySecurityDomain = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, RECOVERY_SECURITY_DOMAIN);
    final boolean recoveryElytronEnabled = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, RECOVERY_ELYTRON_ENABLED);
    final String recoveryAuthenticationContext = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, RECOVERY_AUTHENTICATION_CONTEXT);
    Boolean noRecovery = ModelNodeUtil.getBooleanIfSetOrGetDefault(operationContext, dataSourceNode, NO_RECOVERY);
    final String urlProperty = ModelNodeUtil.getResolvedStringIfSetOrGetDefault(operationContext, dataSourceNode, URL_PROPERTY);
    Recovery recovery = null;
    if ((recoveryUsername != null && (recoveryPassword != null || recoveryCredentialSourceSupplier != null)) || recoverySecurityDomain != null || noRecovery != null) {
        Credential credential = null;
        if ((recoveryUsername != null && (recoveryPassword != null || recoveryCredentialSourceSupplier != null)) || recoverySecurityDomain != null)
            credential = new CredentialImpl(recoveryUsername, recoveryPassword, recoveryElytronEnabled ? recoveryAuthenticationContext : recoverySecurityDomain, elytronEnabled, recoveryCredentialSourceSupplier);
        Extension recoverPlugin = ModelNodeUtil.extractExtension(operationContext, dataSourceNode, RECOVER_PLUGIN_CLASSNAME, RECOVER_PLUGIN_PROPERTIES);
        if (noRecovery == null)
            noRecovery = Boolean.FALSE;
        recovery = new Recovery(credential, recoverPlugin, noRecovery);
    }
    return new ModifiableXaDataSource(transactionIsolation, timeOut, security, statement, validation, urlDelimiter, urlProperty, urlSelectorStrategyClassName, useJavaContext, poolName, enabled, jndiName, spy, useCcm, connectable, tracking, mcp, enlistmentTrace, xaDataSourceProperty, xaDataSourceClass, module, newConnectionSql, xaPool, recovery);
}
Also used : TimeOut(org.jboss.jca.common.api.metadata.ds.TimeOut) TransactionIsolation(org.jboss.jca.common.api.metadata.ds.TransactionIsolation) Recovery(org.jboss.jca.common.api.metadata.common.Recovery) ValidationImpl(org.jboss.jca.common.metadata.ds.ValidationImpl) Capacity(org.jboss.jca.common.api.metadata.common.Capacity) DsXaPool(org.jboss.jca.common.api.metadata.ds.DsXaPool) StatementImpl(org.jboss.jca.common.metadata.ds.StatementImpl) Validation(org.jboss.jca.common.api.metadata.ds.Validation) Credential(org.jboss.as.connector.metadata.api.common.Credential) DsSecurity(org.jboss.as.connector.metadata.api.ds.DsSecurity) Statement(org.jboss.jca.common.api.metadata.ds.Statement) Extension(org.jboss.jca.common.api.metadata.common.Extension) CredentialImpl(org.jboss.as.connector.metadata.common.CredentialImpl) FlushStrategy(org.jboss.jca.common.api.metadata.common.FlushStrategy) DsSecurityImpl(org.jboss.as.connector.metadata.ds.DsSecurityImpl) DsXaPoolImpl(org.jboss.jca.common.metadata.ds.DsXaPoolImpl) TimeOutImpl(org.jboss.jca.common.metadata.ds.TimeOutImpl)

Example 4 with Extension

use of org.jboss.jca.common.api.metadata.common.Extension in project wildfly by wildfly.

the class DsXmlParser method parseDsSecurity.

/**
     * Parse security
     *
     * @param reader The reader
     * @return The result
     * @throws javax.xml.stream.XMLStreamException
     *          XMLStreamException
     * @throws org.jboss.jca.common.metadata.ParserException
     *          ParserException
     * @throws org.jboss.jca.common.api.validator.ValidateException
     *          ValidateException
     */
@Override
protected DsSecurity parseDsSecurity(XMLStreamReader reader) throws XMLStreamException, ParserException, ValidateException {
    String userName = null;
    String password = null;
    String securityDomain = null;
    boolean elytronEnabled = false;
    String authenticationContext = null;
    Extension reauthPlugin = null;
    while (reader.hasNext()) {
        switch(reader.nextTag()) {
            case END_ELEMENT:
                {
                    if (DataSource.Tag.forName(reader.getLocalName()) == DataSource.Tag.SECURITY) {
                        return new DsSecurityImpl(userName, password, elytronEnabled ? authenticationContext : securityDomain, elytronEnabled, null, reauthPlugin);
                    } else {
                        if (DsSecurity.Tag.forName(reader.getLocalName()) == DsSecurity.Tag.UNKNOWN) {
                            throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
                        }
                    }
                    break;
                }
            case START_ELEMENT:
                {
                    DsSecurity.Tag tag = DsSecurity.Tag.forName(reader.getLocalName());
                    switch(tag) {
                        case PASSWORD:
                            {
                                password = elementAsString(reader);
                                boolean resolved = false;
                                if (propertyReplacer != null && password != null && password.trim().length() != 0) {
                                    String resolvedPassword = propertyReplacer.replaceProperties(password);
                                    if (resolvedPassword != null) {
                                        password = resolvedPassword;
                                        resolved = true;
                                    }
                                }
                                // who learned to use that behavior, pass any unresolved password in to the PropertyResolver
                                if (!resolved && propertyResolver != null && password != null && password.trim().length() != 0) {
                                    String resolvedPassword = propertyResolver.resolve(password);
                                    if (resolvedPassword != null) {
                                        password = resolvedPassword;
                                    }
                                }
                                break;
                            }
                        case USER_NAME:
                            {
                                userName = elementAsString(reader);
                                break;
                            }
                        case SECURITY_DOMAIN:
                            {
                                securityDomain = elementAsString(reader);
                                break;
                            }
                        case ELYTRON_ENABLED:
                            {
                                Boolean value = elementAsBoolean(reader);
                                elytronEnabled = value == null ? true : value;
                                break;
                            }
                        case AUTHENTICATION_CONTEXT:
                            {
                                authenticationContext = elementAsString(reader);
                                break;
                            }
                        case REAUTH_PLUGIN:
                            {
                                reauthPlugin = parseExtension(reader, tag.getLocalName());
                                break;
                            }
                        default:
                            throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
                    }
                    break;
                }
        }
    }
    throw new ParserException(bundle.unexpectedEndOfDocument());
}
Also used : Extension(org.jboss.jca.common.api.metadata.common.Extension) ParserException(org.jboss.jca.common.metadata.ParserException) DsSecurityImpl(org.jboss.as.connector.metadata.ds.DsSecurityImpl)

Example 5 with Extension

use of org.jboss.jca.common.api.metadata.common.Extension 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 = (Security) connDef.getSecurity();
    if (security != null) {
        setAttribute(model, APPLICATION, security.isApplication());
        if (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 = (Credential) recovery.getCredential();
        if (recoveryCredential != null) {
            setAttribute(model, RECOVERY_PASSWORD, recoveryCredential.getPassword());
            if (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);
}
Also used : Validation(org.jboss.jca.common.api.metadata.common.Validation) XaPool(org.jboss.jca.common.api.metadata.common.XaPool) Credential(org.jboss.as.connector.metadata.api.common.Credential) TimeOut(org.jboss.jca.common.api.metadata.common.TimeOut) Resource(org.jboss.as.controller.registry.Resource) WorkManagerSecurity(org.jboss.as.connector.metadata.api.resourceadapter.WorkManagerSecurity) Security(org.jboss.as.connector.metadata.api.common.Security) Recovery(org.jboss.jca.common.api.metadata.common.Recovery) Extension(org.jboss.jca.common.api.metadata.common.Extension) PathElement(org.jboss.as.controller.PathElement) XaPool(org.jboss.jca.common.api.metadata.common.XaPool) Pool(org.jboss.jca.common.api.metadata.common.Pool) ModelNode(org.jboss.dmr.ModelNode) Map(java.util.Map)

Aggregations

Extension (org.jboss.jca.common.api.metadata.common.Extension)5 Credential (org.jboss.as.connector.metadata.api.common.Credential)3 DsSecurityImpl (org.jboss.as.connector.metadata.ds.DsSecurityImpl)3 Capacity (org.jboss.jca.common.api.metadata.common.Capacity)3 FlushStrategy (org.jboss.jca.common.api.metadata.common.FlushStrategy)3 Recovery (org.jboss.jca.common.api.metadata.common.Recovery)3 DsSecurity (org.jboss.as.connector.metadata.api.ds.DsSecurity)2 CredentialImpl (org.jboss.as.connector.metadata.common.CredentialImpl)2 Pool (org.jboss.jca.common.api.metadata.common.Pool)2 TimeOut (org.jboss.jca.common.api.metadata.common.TimeOut)2 Validation (org.jboss.jca.common.api.metadata.common.Validation)2 Statement (org.jboss.jca.common.api.metadata.ds.Statement)2 TimeOut (org.jboss.jca.common.api.metadata.ds.TimeOut)2 TransactionIsolation (org.jboss.jca.common.api.metadata.ds.TransactionIsolation)2 Validation (org.jboss.jca.common.api.metadata.ds.Validation)2 StatementImpl (org.jboss.jca.common.metadata.ds.StatementImpl)2 TimeOutImpl (org.jboss.jca.common.metadata.ds.TimeOutImpl)2 ValidationImpl (org.jboss.jca.common.metadata.ds.ValidationImpl)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1