use of org.apache.openjpa.lib.jdbc.DecoratingDataSource in project oozie by apache.
the class JPAService method getBasicDataSource.
private BasicDataSource getBasicDataSource() {
// Get the BasicDataSource object; it could be wrapped in a DecoratingDataSource
// It might also not be a BasicDataSource if the user configured something different
BasicDataSource basicDataSource = null;
final OpenJPAEntityManagerFactorySPI spi = (OpenJPAEntityManagerFactorySPI) factory;
final Object connectionFactory = spi.getConfiguration().getConnectionFactory();
if (connectionFactory instanceof DecoratingDataSource) {
final DecoratingDataSource decoratingDataSource = (DecoratingDataSource) connectionFactory;
basicDataSource = (BasicDataSource) decoratingDataSource.getInnermostDelegate();
} else if (connectionFactory instanceof BasicDataSource) {
basicDataSource = (BasicDataSource) connectionFactory;
}
return basicDataSource;
}
Aggregations