private ModifiableXaDataSource buildXaDataSource(XaDataSource xads) throws org.jboss.jca.common.api.validator.ValidateException { final DsXaPool xaPool; if (xads.getXaPool() == null) { xaPool = new DsXaPoolImpl(Defaults.MIN_POOL_SIZE, Defaults.INITIAL_POOL_SIZE, Defaults.MAX_POOL_SIZE, Defaults.PREFILL, Defaults.USE_STRICT_MIN, Defaults.FLUSH_STRATEGY, Defaults.IS_SAME_RM_OVERRIDE, Defaults.INTERLEAVING, Defaults.PAD_XID, Defaults.WRAP_XA_RESOURCE, Defaults.NO_TX_SEPARATE_POOL, Defaults.ALLOW_MULTIPLE_USERS, null, Defaults.FAIR, null); } else { final DsXaPool p = xads.getXaPool(); xaPool = new DsXaPoolImpl(getDef(p.getMinPoolSize(), Defaults.MIN_POOL_SIZE), getDef(p.getInitialPoolSize(), Defaults.INITIAL_POOL_SIZE), getDef(p.getMaxPoolSize(), Defaults.MAX_POOL_SIZE), getDef(p.isPrefill(), Defaults.PREFILL), getDef(p.isUseStrictMin(), Defaults.USE_STRICT_MIN), getDef(p.getFlushStrategy(), Defaults.FLUSH_STRATEGY), getDef(p.isSameRmOverride(), Defaults.IS_SAME_RM_OVERRIDE), getDef(p.isInterleaving(), Defaults.INTERLEAVING), getDef(p.isPadXid(), Defaults.PAD_XID) , getDef(p.isWrapXaResource(), Defaults.WRAP_XA_RESOURCE), getDef(p.isNoTxSeparatePool(), Defaults.NO_TX_SEPARATE_POOL), getDef(p.isAllowMultipleUsers(), Defaults.ALLOW_MULTIPLE_USERS), p.getCapacity(), getDef(p.isFair(), Defaults.FAIR), p.getConnectionListener()); } return new ModifiableXaDataSource(xads.getTransactionIsolation(), xads.getTimeOut(), xads.getSecurity(), xads.getStatement(), xads.getValidation(), xads.getUrlDelimiter(), xads.getUrlProperty(), xads.getUrlSelectorStrategyClassName(), xads.isUseJavaContext(), xads.getPoolName(), xads.isEnabled(), xads.getJndiName(), xads.isSpy(), xads.isUseCcm(), xads.isConnectable(), xads.isTracking(), xads.getMcp(), xads.isEnlistmentTrace(), xads.getXaDataSourceProperty(), xads.getXaDataSourceClass(), xads.getDriver(), xads.getNewConnectionSql(), xaPool, xads.getRecovery()); }
@Override protected ManagedConnectionFactory createMcf(XaDataSource arg0, String arg1, ClassLoader arg2) throws NotFoundException, DeployException { final XAManagedConnectionFactory xaManagedConnectionFactory = new XAManagedConnectionFactory(xaDataSourceConfig.getXaDataSourceProperty()); if (xaDataSourceConfig.getUrlDelimiter() != null) { xaManagedConnectionFactory.setURLDelimiter(xaDataSourceConfig.getUrlDelimiter()); } if (xaDataSourceConfig.getXaDataSourceClass() != null) { xaManagedConnectionFactory.setXADataSourceClass(xaDataSourceConfig.getXaDataSourceClass()); } if (xaDataSourceConfig.getUrlSelectorStrategyClassName() != null) { xaManagedConnectionFactory .setUrlSelectorStrategyClassName(xaDataSourceConfig.getUrlSelectorStrategyClassName()); } if (xaDataSourceConfig.getXaPool() != null && xaDataSourceConfig.getXaPool().isSameRmOverride() != null) { xaManagedConnectionFactory.setIsSameRMOverrideValue(xaDataSourceConfig.getXaPool().isSameRmOverride()); } if (xaDataSourceConfig.getNewConnectionSql() != null) { xaManagedConnectionFactory.setNewConnectionSQL(xaDataSourceConfig.getNewConnectionSql()); } if (xaDataSourceConfig.getUrlSelectorStrategyClassName() != null) { xaManagedConnectionFactory .setUrlSelectorStrategyClassName(xaDataSourceConfig.getUrlSelectorStrategyClassName()); } setMcfProperties(xaManagedConnectionFactory, xaDataSourceConfig, xaDataSourceConfig.getStatement()); return xaManagedConnectionFactory; }
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())) {
for (int i = 0; i < dataSources.getXaDataSource().size(); i++) { XaDataSource xads = (XaDataSource)dataSources.getXaDataSource().get(i); if (xads.isEnabled() && xads.getDriver() != null) { try { String jndiName = Util.cleanJndiName(xads.getJndiName(), xads.isUseJavaContext()); XaDataSourceService xds = new XaDataSourceService(jndiName, ContextNames.bindInfoFor(jndiName)); xds.getDataSourceConfigInjector().inject(buildXaDataSource(xads)); final String dsName = xads.getJndiName(); final PathAddress addr = getDataSourceAddress(dsName, deploymentUnit, true); installManagementModel(xads, deploymentUnit, addr); final Credential credential = xads.getRecovery() == null? null: xads.getRecovery().getCredential(); boolean useLegacySecurity = legacySecurityPresent && (isLegacySecurityRequired(xads.getSecurity()) || isLegacySecurityRequired(credential)); startDataSource(xds, jndiName, xads.getDriver(), serviceTarget, getRegistration(true, deploymentUnit), getResource(dsName, true, deploymentUnit), dsName, useLegacySecurity, true); throw ConnectorLogger.ROOT_LOGGER.exceptionDeployingDatasource(e, xads.getJndiName()); ConnectorLogger.DS_DEPLOYER_LOGGER.debugf("Ignoring %s", xads.getJndiName());
if (xads != null && xads.getXaDataSourceProperty() != null) for (Entry<String, String> xaConfigProperty : xads.getXaDataSourceProperty().entrySet()) if (xads != null && xads.getXaDataSourceClass() != null) xads.getXaDataSourceClass())); if (xads != null && xads.getUrlProperty() != null && !xads.getUrlProperty().trim().equals("")) .add(ConfigPropertyFactory.createConfigProperty(prototype, xads.getUrlProperty()));
String xaDSClsName = xaDataSourceConfig.getXaDataSourceClass(); if (xaDSClsName != null) { try { String driverName = xaDataSourceConfig.getDriver(); InstalledDriver installedDriver = driverRegistry.getValue().getInstalledDriver(driverName); if (installedDriver != null) {
private void handlePropertyAttribute(final String attributeName, final OperationContext context, final XaDataSource dataSource, final String propName) { if (attributeName.equals(ModelDescriptionConstants.VALUE)) { setStringIfNotNull(context, dataSource.getXaDataSourceProperty().get(propName)); } else { throw ConnectorLogger.ROOT_LOGGER.unknownAttribute(attributeName); } }
private void undeployXaDataSource(final XaDataSource ds, final DeploymentUnit deploymentUnit) { final PathAddress addr = getDataSourceAddress(ds.getJndiName(), deploymentUnit, true); XMLXaDataSourceRuntimeHandler.INSTANCE.unregisterDataSource(addr); }
String driverName = xaDataSourceConfig.getDriver(); InstalledDriver installedDriver = driverRegistry.getValue().getInstalledDriver(driverName); if (installedDriver != null) {
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_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(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.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());
@Override protected ManagedConnectionFactory createMcf(XaDataSource arg0, String arg1, ClassLoader arg2) throws NotFoundException, DeployException { final XAManagedConnectionFactory xaManagedConnectionFactory = new XAManagedConnectionFactory(xaDataSourceConfig.getXaDataSourceProperty()); if (xaDataSourceConfig.getUrlDelimiter() != null) { xaManagedConnectionFactory.setURLDelimiter(xaDataSourceConfig.getUrlDelimiter()); } if (xaDataSourceConfig.getXaDataSourceClass() != null) { xaManagedConnectionFactory.setXADataSourceClass(xaDataSourceConfig.getXaDataSourceClass()); } if (xaDataSourceConfig.getUrlSelectorStrategyClassName() != null) { xaManagedConnectionFactory .setUrlSelectorStrategyClassName(xaDataSourceConfig.getUrlSelectorStrategyClassName()); } if (xaDataSourceConfig.getXaPool() != null && xaDataSourceConfig.getXaPool().isSameRmOverride() != null) { xaManagedConnectionFactory.setIsSameRMOverrideValue(xaDataSourceConfig.getXaPool().isSameRmOverride()); } if (xaDataSourceConfig.getNewConnectionSql() != null) { xaManagedConnectionFactory.setNewConnectionSQL(xaDataSourceConfig.getNewConnectionSql()); } if (xaDataSourceConfig.getUrlSelectorStrategyClassName() != null) { xaManagedConnectionFactory .setUrlSelectorStrategyClassName(xaDataSourceConfig.getUrlSelectorStrategyClassName()); } setMcfProperties(xaManagedConnectionFactory, xaDataSourceConfig, xaDataSourceConfig.getStatement()); return xaManagedConnectionFactory; }
for (int i = 0; i < dataSources.getXaDataSource().size(); i++) { XaDataSource xads = (XaDataSource)dataSources.getXaDataSource().get(i); if (xads.isEnabled() && xads.getDriver() != null) { try { String jndiName = Util.cleanJndiName(xads.getJndiName(), xads.isUseJavaContext()); XaDataSourceService xds = new XaDataSourceService(jndiName, ContextNames.bindInfoFor(jndiName)); xds.getDataSourceConfigInjector().inject(buildXaDataSource(xads)); final String dsName = xads.getJndiName(); final PathAddress addr = getDataSourceAddress(dsName, deploymentUnit, true); installManagementModel(xads, deploymentUnit, addr); final Credential credential = xads.getRecovery() == null? null: xads.getRecovery().getCredential(); boolean useLegacySecurity = legacySecurityPresent && (isLegacySecurityRequired(xads.getSecurity()) || isLegacySecurityRequired(credential)); startDataSource(xds, jndiName, xads.getDriver(), serviceTarget, getRegistration(true, deploymentUnit), getResource(dsName, true, deploymentUnit), dsName, useLegacySecurity, true); throw ConnectorLogger.ROOT_LOGGER.exceptionDeployingDatasource(e, xads.getJndiName()); ConnectorLogger.DS_DEPLOYER_LOGGER.debugf("Ignoring %s", xads.getJndiName());
String xaDSClsName = xaDataSourceConfig.getXaDataSourceClass(); if (xaDSClsName != null) { try { String driverName = xaDataSourceConfig.getDriver(); InstalledDriver installedDriver = driverRegistry.getValue().getInstalledDriver(driverName); if (installedDriver != null) {
private void installManagementModel(final XaDataSource ds, final DeploymentUnit deploymentUnit, final PathAddress addr) { XMLXaDataSourceRuntimeHandler.INSTANCE.registerDataSource(addr, ds); final DeploymentResourceSupport deploymentResourceSupport = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT); deploymentResourceSupport.getDeploymentSubModel(DataSourcesExtension.SUBSYSTEM_NAME, addr.getLastElement()); if (ds.getXaDataSourceProperty() != null) { for (final Map.Entry<String, String> prop : ds.getXaDataSourceProperty().entrySet()) { PathAddress registration = PathAddress.pathAddress(addr.getLastElement(), PathElement.pathElement(XA_CONNECTION_PROPERTIES, prop.getKey())); deploymentResourceSupport.getDeploymentSubModel(DataSourcesExtension.SUBSYSTEM_NAME, registration); } } }
private void undeployXaDataSource(final XaDataSource ds, final DeploymentUnit deploymentUnit) { final PathAddress addr = getDataSourceAddress(ds.getJndiName(), deploymentUnit, true); XMLXaDataSourceRuntimeHandler.INSTANCE.unregisterDataSource(addr); }
private ModifiableXaDataSource buildXaDataSource(XaDataSource xads) throws org.jboss.jca.common.api.validator.ValidateException { final DsXaPool xaPool; if (xads.getXaPool() == null) { xaPool = new DsXaPoolImpl(Defaults.MIN_POOL_SIZE, Defaults.INITIAL_POOL_SIZE, Defaults.MAX_POOL_SIZE, Defaults.PREFILL, Defaults.USE_STRICT_MIN, Defaults.FLUSH_STRATEGY, Defaults.IS_SAME_RM_OVERRIDE, Defaults.INTERLEAVING, Defaults.PAD_XID, Defaults.WRAP_XA_RESOURCE, Defaults.NO_TX_SEPARATE_POOL, Defaults.ALLOW_MULTIPLE_USERS, null, Defaults.FAIR, null); } else { final DsXaPool p = xads.getXaPool(); xaPool = new DsXaPoolImpl(getDef(p.getMinPoolSize(), Defaults.MIN_POOL_SIZE), getDef(p.getInitialPoolSize(), Defaults.INITIAL_POOL_SIZE), getDef(p.getMaxPoolSize(), Defaults.MAX_POOL_SIZE), getDef(p.isPrefill(), Defaults.PREFILL), getDef(p.isUseStrictMin(), Defaults.USE_STRICT_MIN), getDef(p.getFlushStrategy(), Defaults.FLUSH_STRATEGY), getDef(p.isSameRmOverride(), Defaults.IS_SAME_RM_OVERRIDE), getDef(p.isInterleaving(), Defaults.INTERLEAVING), getDef(p.isPadXid(), Defaults.PAD_XID) , getDef(p.isWrapXaResource(), Defaults.WRAP_XA_RESOURCE), getDef(p.isNoTxSeparatePool(), Defaults.NO_TX_SEPARATE_POOL), getDef(p.isAllowMultipleUsers(), Defaults.ALLOW_MULTIPLE_USERS), p.getCapacity(), getDef(p.isFair(), Defaults.FAIR), p.getConnectionListener()); } return new ModifiableXaDataSource(xads.getTransactionIsolation(), xads.getTimeOut(), xads.getSecurity(), xads.getStatement(), xads.getValidation(), xads.getUrlDelimiter(), xads.getUrlProperty(), xads.getUrlSelectorStrategyClassName(), xads.isUseJavaContext(), xads.getPoolName(), xads.isEnabled(), xads.getJndiName(), xads.isSpy(), xads.isUseCcm(), xads.isConnectable(), xads.isTracking(), xads.getMcp(), xads.isEnlistmentTrace(), xads.getXaDataSourceProperty(), xads.getXaDataSourceClass(), xads.getDriver(), xads.getNewConnectionSql(), xaPool, xads.getRecovery()); }
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())) {
final MyXaMCF xaManagedConnectionFactory = new MyXaMCF(); if (xaDataSourceConfig.getUrlDelimiter() != null) { xaManagedConnectionFactory.setURLDelimiter(xaDataSourceConfig.getUrlDelimiter()); if (xaDataSourceConfig.getXaDataSourceClass() != null) { xaManagedConnectionFactory.setXADataSourceClass(xaDataSourceConfig.getXaDataSourceClass()); if (xaDataSourceConfig.getXaDataSourceProperty() != null) { xaManagedConnectionFactory.setXaProps(xaDataSourceConfig.getXaDataSourceProperty()); if (xaDataSourceConfig.getUrlSelectorStrategyClassName() != null) { xaManagedConnectionFactory .setUrlSelectorStrategyClassName(xaDataSourceConfig.getUrlSelectorStrategyClassName()); if (xaDataSourceConfig.getXaPool() != null && xaDataSourceConfig.getXaPool().isSameRmOverride() != null) { xaManagedConnectionFactory.setIsSameRMOverrideValue(xaDataSourceConfig.getXaPool().isSameRmOverride()); if (xaDataSourceConfig.getNewConnectionSql() != null) { xaManagedConnectionFactory.setNewConnectionSQL(xaDataSourceConfig.getNewConnectionSql()); if (xaDataSourceConfig.getUrlSelectorStrategyClassName() != null) { xaManagedConnectionFactory .setUrlSelectorStrategyClassName(xaDataSourceConfig.getUrlSelectorStrategyClassName()); setMcfProperties(xaManagedConnectionFactory, xaDataSourceConfig, xaDataSourceConfig.getStatement()); xaManagedConnectionFactory.setUserTransactionJndiName("java:comp/UserTransaction"); return xaManagedConnectionFactory;
private void handlePropertyAttribute(final String attributeName, final OperationContext context, final XaDataSource dataSource, final String propName) { if (attributeName.equals(ModelDescriptionConstants.VALUE)) { setStringIfNotNull(context, dataSource.getXaDataSourceProperty().get(propName)); } else { throw ConnectorLogger.ROOT_LOGGER.unknownAttribute(attributeName); } }
private void handlePropertyAttribute(final String attributeName, final OperationContext context, final XaDataSource dataSource, final String propName) { if (attributeName.equals(ModelDescriptionConstants.VALUE)) { setStringIfNotNull(context, dataSource.getXaDataSourceProperty().get(propName)); } else { throw ConnectorMessages.MESSAGES.unknownAttribute(attributeName); } }