All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.agroal.pool.DataSourceProvider Maven / Gradle / Ivy

There is a newer version: 2.5
Show newest version
// Copyright (C) 2017 Red Hat, Inc. and individual contributors as indicated by the @author tags.
// You may not use this file except in compliance with the Apache License, Version 2.0.

package io.agroal.pool;

import io.agroal.api.AgroalDataSource;
import io.agroal.api.AgroalDataSourceListener;
import io.agroal.api.AgroalDataSourceProvider;
import io.agroal.api.configuration.AgroalDataSourceConfiguration;

import static io.agroal.api.configuration.AgroalDataSourceConfiguration.DataSourceImplementation.AGROAL;
import static io.agroal.api.configuration.AgroalDataSourceConfiguration.DataSourceImplementation.AGROAL_POOLLESS;

/**
 * @author Luis Barreiro
 */
public final class DataSourceProvider implements AgroalDataSourceProvider {

    @Override
    public AgroalDataSource getDataSource(AgroalDataSourceConfiguration config, AgroalDataSourceListener... listeners) {
        return config.dataSourceImplementation() == AGROAL || config.dataSourceImplementation() == AGROAL_POOLLESS ? new DataSource( config, listeners ) : null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy