io.ebeaninternal.server.transaction.TransactionFactoryBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ebean Show documentation
Show all versions of ebean Show documentation
composite of common runtime dependencies for all platforms
package io.ebeaninternal.server.transaction;
import io.ebean.config.CurrentTenantProvider;
/**
* Helper to build and return the appropriate TransactionFactory.
*/
class TransactionFactoryBuilder {
/**
* Build and return based on multi-tenancy and read only DataSource.
*/
static TransactionFactory build(TransactionManager manager, DataSourceSupplier dataSourceSupplier, CurrentTenantProvider tenantProvider) {
boolean hasReadOnlyDataSource = dataSourceSupplier.getReadOnlyDataSource() != null;
if (tenantProvider == null) {
if (hasReadOnlyDataSource) {
return new TransactionFactoryBasicWithRead(manager, dataSourceSupplier);
} else {
return new TransactionFactoryBasic(manager, dataSourceSupplier);
}
} else {
if (hasReadOnlyDataSource) {
return new TransactionFactoryTenantWithRead(manager, dataSourceSupplier, tenantProvider);
} else {
return new TransactionFactoryTenant(manager, dataSourceSupplier, tenantProvider);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy