use of org.apache.aries.tx.control.jdbc.common.impl.DriverDataSource in project aries by apache.
the class JDBCConnectionProviderFactoryImpl method getProviderFor.
@Override
public AbstractJDBCConnectionProvider getProviderFor(Driver driver, Properties jdbcProperties, Map<String, Object> resourceProviderProperties) {
boolean xaEnabled = toBoolean(resourceProviderProperties, XA_ENLISTMENT_ENABLED, false);
boolean localEnabled = toBoolean(resourceProviderProperties, LOCAL_ENLISTMENT_ENABLED, true);
checkEnlistment(xaEnabled, localEnabled, false);
DataSource toUse = poolIfNecessary(resourceProviderProperties, new DriverDataSource(driver, jdbcProperties.getProperty(JDBC_URL), jdbcProperties));
return new JDBCConnectionProviderImpl(toUse, xaEnabled, localEnabled, getRecoveryId(resourceProviderProperties, xaEnabled));
}
use of org.apache.aries.tx.control.jdbc.common.impl.DriverDataSource in project aries by apache.
the class JDBCConnectionProviderFactoryImpl method getProviderFor.
@Override
public JDBCConnectionProviderImpl getProviderFor(DataSourceFactory dsf, Properties jdbcProperties, Map<String, Object> resourceProviderProperties) {
boolean xaEnabled = toBoolean(resourceProviderProperties, XA_ENLISTMENT_ENABLED, true);
boolean localEnabled = toBoolean(resourceProviderProperties, LOCAL_ENLISTMENT_ENABLED, true);
boolean useDriver = toBoolean(resourceProviderProperties, USE_DRIVER, false);
checkEnlistment(xaEnabled, localEnabled, !useDriver);
DataSource unpooled;
try {
if (useDriver) {
unpooled = new DriverDataSource(dsf.createDriver(null), jdbcProperties.getProperty(JDBC_URL), jdbcProperties);
} else if (xaEnabled) {
unpooled = new XADataSourceMapper(dsf.createXADataSource(jdbcProperties));
} else {
unpooled = dsf.createDataSource(jdbcProperties);
}
} catch (SQLException sqle) {
throw new TransactionException("Unable to create the JDBC resource provider", sqle);
}
DataSource toUse = poolIfNecessary(resourceProviderProperties, unpooled);
return new JDBCConnectionProviderImpl(toUse, xaEnabled, localEnabled, getRecoveryId(resourceProviderProperties, xaEnabled));
}
use of org.apache.aries.tx.control.jdbc.common.impl.DriverDataSource in project aries by apache.
the class JDBCConnectionProviderFactoryImpl method getProviderFor.
@Override
public AbstractJDBCConnectionProvider getProviderFor(Driver driver, Properties jdbcProperties, Map<String, Object> resourceProviderProperties) {
checkEnlistment(resourceProviderProperties);
DataSource toUse = poolIfNecessary(resourceProviderProperties, new DriverDataSource(driver, jdbcProperties.getProperty(JDBC_URL), jdbcProperties));
return new JDBCConnectionProviderImpl(toUse);
}
use of org.apache.aries.tx.control.jdbc.common.impl.DriverDataSource in project aries by apache.
the class JDBCConnectionProviderFactoryImpl method getProviderFor.
@Override
public AbstractJDBCConnectionProvider getProviderFor(DataSourceFactory dsf, Properties jdbcProperties, Map<String, Object> resourceProviderProperties) {
checkEnlistment(resourceProviderProperties);
DataSource unpooled;
try {
if (toBoolean(resourceProviderProperties, USE_DRIVER, false)) {
unpooled = new DriverDataSource(dsf.createDriver(null), jdbcProperties.getProperty(JDBC_URL), jdbcProperties);
} else {
unpooled = dsf.createDataSource(jdbcProperties);
}
} catch (SQLException sqle) {
throw new TransactionException("Unable to create the JDBC resource provider", sqle);
}
DataSource toUse = poolIfNecessary(resourceProviderProperties, unpooled);
return new JDBCConnectionProviderImpl(toUse);
}
Aggregations