// Path: rulette-mysql-provider/src/main/java/com/github/kislayverma/rulette/mysql/util/Utils.java
// public class Utils {
//     private static final String PROPERTY_MYSQL_DRIVER_CLASS = "driverClass";
//     private static final String PROPERTY_JDBC_URL = "jdbcUrl";
//     private static final String PROPERTY_USER_NAME = "username";
//     private static final String PROPERTY_PASSWORD = "password";
//     private static final String PROPERTY_MAX_POOL_SIZE = "maxPoolSize";
//     private static final String PROPERTY_CONN_TIMEOUT = "connectionTimeout";
// 
//     /**
//      * Read a properties file from the class path and return a Properties object
//      *
//      * @param fileName file to read
//      * @return Properties object loaded with properties from the given file
//      * @throws IOException on file reading error
//      */
//     public static Properties readProperties(String fileName) throws IOException {
//         File f = new File(fileName);
//         if (!f.canRead()) {
//             throw new IOException("Could not read the datasource file");
//         }
// 
//         URL url = f.toURI().toURL();
//         InputStream in = url.openStream();
//         Properties props = new Properties();
//         props.load(in);
// 
//         return props;
//     }
// 
//     /**
//      * This method build a {@link HikariConfig} object from the given properties file.
//      * @param fileName A property file containing the Hikari configurations
//      */
//     public static HikariConfig getHikariConfig(String fileName) throws IOException {
//         return getHikariConfig(Utils.readProperties(fileName));
//     }
// 
//     /**
//      * This method build a {@link HikariConfig} object from the given properties file.
//      * @param props An {@link Properties} object encapsulating Hikari properties
//      */
//     public static HikariConfig getHikariConfig(Properties props) {
//         HikariConfig hikariConfig = new HikariConfig();
//         hikariConfig.setDriverClassName(props.getProperty(PROPERTY_MYSQL_DRIVER_CLASS));
//         hikariConfig.setJdbcUrl(props.getProperty(PROPERTY_JDBC_URL));
//         hikariConfig.setUsername(props.getProperty(PROPERTY_USER_NAME));
//         hikariConfig.setPassword(props.getProperty(PROPERTY_PASSWORD));
//         hikariConfig.setMaximumPoolSize(Integer.parseInt(props.getProperty(PROPERTY_MAX_POOL_SIZE)));
//         hikariConfig.setConnectionTimeout(Long.parseLong(props.getProperty(PROPERTY_CONN_TIMEOUT)));
// 
//         return hikariConfig;
//     }
// 
//     public static void closeSqlArtifacts(ResultSet resultSet, Statement statement, Connection connection) {
//         try {
//             if (resultSet != null) {
//                 resultSet.close();
//             }
//             if (statement != null) {
//                 statement.close();
//             }
//             if (connection != null) {
//                 connection.close();
//             }
//         } catch (Exception e) {
//             throw new DataAccessException("Failed to close database connection", e);
//         }
//     }
// }


import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
import com.github.kislayverma.rulette.mysql.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
package com.github.kislayverma.rulette.mysql.dao;



/**
 * This class represents the underlying MySQL connection pool
 */
public class DataSource {
    private static final Logger LOGGER = LoggerFactory.getLogger(DataSource.class);

    private HikariDataSource hikariDatasource;

    public DataSource(String fileName) throws IOException, SQLException {
// Path: rulette-mysql-provider/src/main/java/com/github/kislayverma/rulette/mysql/util/Utils.java
// public class Utils {
//     private static final String PROPERTY_MYSQL_DRIVER_CLASS = "driverClass";
//     private static final String PROPERTY_JDBC_URL = "jdbcUrl";
//     private static final String PROPERTY_USER_NAME = "username";
//     private static final String PROPERTY_PASSWORD = "password";
//     private static final String PROPERTY_MAX_POOL_SIZE = "maxPoolSize";
//     private static final String PROPERTY_CONN_TIMEOUT = "connectionTimeout";
// 
//     /**
//      * Read a properties file from the class path and return a Properties object
//      *
//      * @param fileName file to read
//      * @return Properties object loaded with properties from the given file
//      * @throws IOException on file reading error
//      */
//     public static Properties readProperties(String fileName) throws IOException {
//         File f = new File(fileName);
//         if (!f.canRead()) {
//             throw new IOException("Could not read the datasource file");
//         }
// 
//         URL url = f.toURI().toURL();
//         InputStream in = url.openStream();
//         Properties props = new Properties();
//         props.load(in);
// 
//         return props;
//     }
// 
//     /**
//      * This method build a {@link HikariConfig} object from the given properties file.
//      * @param fileName A property file containing the Hikari configurations
//      */
//     public static HikariConfig getHikariConfig(String fileName) throws IOException {
//         return getHikariConfig(Utils.readProperties(fileName));
//     }
// 
//     /**
//      * This method build a {@link HikariConfig} object from the given properties file.
//      * @param props An {@link Properties} object encapsulating Hikari properties
//      */
//     public static HikariConfig getHikariConfig(Properties props) {
//         HikariConfig hikariConfig = new HikariConfig();
//         hikariConfig.setDriverClassName(props.getProperty(PROPERTY_MYSQL_DRIVER_CLASS));
//         hikariConfig.setJdbcUrl(props.getProperty(PROPERTY_JDBC_URL));
//         hikariConfig.setUsername(props.getProperty(PROPERTY_USER_NAME));
//         hikariConfig.setPassword(props.getProperty(PROPERTY_PASSWORD));
//         hikariConfig.setMaximumPoolSize(Integer.parseInt(props.getProperty(PROPERTY_MAX_POOL_SIZE)));
//         hikariConfig.setConnectionTimeout(Long.parseLong(props.getProperty(PROPERTY_CONN_TIMEOUT)));
// 
//         return hikariConfig;
//     }
// 
//     public static void closeSqlArtifacts(ResultSet resultSet, Statement statement, Connection connection) {
//         try {
//             if (resultSet != null) {
//                 resultSet.close();
//             }
//             if (statement != null) {
//                 statement.close();
//             }
//             if (connection != null) {
//                 connection.close();
//             }
//         } catch (Exception e) {
//             throw new DataAccessException("Failed to close database connection", e);
//         }
//     }
// }


// Path: rulette-mysql-provider/src/main/java/com/github/kislayverma/rulette/mysql/dao/DataSource.java
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;
import com.github.kislayverma.rulette.mysql.util.Utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;

package com.github.kislayverma.rulette.mysql.dao;



/**
 * This class represents the underlying MySQL connection pool
 */
public class DataSource {
    private static final Logger LOGGER = LoggerFactory.getLogger(DataSource.class);

    private HikariDataSource hikariDatasource;

    public DataSource(String fileName) throws IOException, SQLException {
        this(Utils.getHikariConfig(fileName));