use of org.apache.openejb.resource.jdbc.managed.xa.ManagedXADataSource in project tomee by apache.
the class JTADataSourceWrapperFactory method create.
public CommonDataSource create() {
final TransactionManager transactionManager = OpenEJB.getTransactionManager();
CommonDataSource cds = findDelegate();
if (cds instanceof XADataSource) {
cds = new ManagedXADataSource(cds, transactionManager, SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class));
} else {
cds = new ManagedDataSource(DataSource.class.cast(cds), transactionManager, SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class));
}
if (logSql) {
cds = DataSourceFactory.makeItLogging(cds, logPackages);
}
return cds;
}
use of org.apache.openejb.resource.jdbc.managed.xa.ManagedXADataSource in project tomee by apache.
the class PoolDataSourceCreator method poolManagedWithRecovery.
@Override
public DataSource poolManagedWithRecovery(final String name, final XAResourceWrapper xaResourceWrapper, final String driver, final Properties properties) {
final TransactionManager transactionManager = new TransactionManagerWrapper(OpenEJB.getTransactionManager(), name, xaResourceWrapper);
final CommonDataSource ds = pool(name, driver, properties);
if (ds instanceof XADataSource) {
return new ManagedXADataSource(ds, transactionManager, SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class));
}
return new ManagedDataSource(DataSource.class.cast(ds), transactionManager, SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class));
}
use of org.apache.openejb.resource.jdbc.managed.xa.ManagedXADataSource in project tomee by apache.
the class BoneCPDataSourceCreator method pool.
@Override
public CommonDataSource pool(final String name, final String driver, final Properties properties) {
final BoneCPDataSource pool = createPool(properties);
if (pool.getDriverClass() == null) {
pool.setDriverClass(driver);
}
if (pool.getPoolName() == null) {
pool.setPoolName(name);
}
final String xa = String.class.cast(properties.remove("XaDataSource"));
if (xa != null) {
final XADataSource xaDs = XADataSourceResource.proxy(Thread.currentThread().getContextClassLoader(), xa);
pool.setDatasourceBean(new ManagedXADataSource(xaDs, OpenEJB.getTransactionManager(), SystemInstance.get().getComponent(TransactionSynchronizationRegistry.class)));
}
return pool;
}
Aggregations