// Path: croquet-core/src/main/java/com/metrink/croquet/DataSourceFactory.java
// public class DataSourceFactory implements Serializable {
//     private static final long serialVersionUID = 1L;
// 
//     private static final Logger LOG = LoggerFactory.getLogger(DataSourceFactory.class);
// 
//     private final DatabaseSettings dbSettings;
//     private transient DataSource dataSource;
// 
//     /**
//      * Constructor which takes an initialized {@link DataSource}.
//      * @param dbSettings the {@link DatabaseSettings} to use to construct {@link DataSource}s.
//      */
//     public DataSourceFactory(final DatabaseSettings dbSettings) {
//         this.dbSettings = dbSettings;
//         this.dataSource = getDataSource();
//     }
// 
//     /**
//      * Gets a {@link DataSource} constructing a new one if needed.
//      * @return a {@link DataSource}.
//      */
//     public DataSource getDataSource() {
//         if(dataSource == null) {
//             LOG.info("Having to construct a new DataSource");
// 
//             dataSource = new DataSource();
// 
//             dataSource.setDriverClassName(dbSettings.getDriver());
//             dataSource.setUrl(dbSettings.getJdbcUrl());
//             dataSource.setUsername(dbSettings.getUser());
//             dataSource.setPassword(dbSettings.getPass());
// 
//             dataSource.setMaxActive(dbSettings.getMaxActive());
//             dataSource.setMaxIdle(dbSettings.getMaxIdle());
//             dataSource.setMinIdle(dbSettings.getMinIdle());
//             dataSource.setInitialSize(dbSettings.getInitialSize());
//             dataSource.setTestOnBorrow(dbSettings.getTestOnBorrow());
//             dataSource.setTestOnReturn(dbSettings.getTestOnReturn());
//             dataSource.setTestWhileIdle(dbSettings.getTestWhileIdle());
//             dataSource.setValidationQuery(dbSettings.getValidationQuery());
//             dataSource.setLogValidationErrors(dbSettings.getLogValidationErrors());
// 
//             // a catch-all for any other properties that are needed
//             dataSource.setDbProperties(dbSettings.getProperties());
//         }
// 
//         return dataSource;
//     }
// }


import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.metrink.croquet.DataSourceFactory;
import com.sop4j.dbutils.QueryRunner;
package com.metrink.croquet.hibernate;


/**
 * Guice module for binding QueryRunner provider.
 */
public class QueryRunnerModule extends AbstractModule {
    //private static final Logger LOG = LoggerFactory.getLogger(QueryRunnerModule.class);

    private final DataSourceFactory dataSourceFactory;

    /**
     * Constructor.
     * @param dataSourceFactory a factory to create {@link DataSource}s.
     */
    public QueryRunnerModule(final DataSourceFactory dataSourceFactory) {
        this.dataSourceFactory = dataSourceFactory;
    }

    @Override
    protected void configure() {
    }

    /**
     * Provider for {@link QueryRunner}.
     * @return a new {@link QueryRunner}.
     */
    @Provides
// Path: croquet-core/src/main/java/com/metrink/croquet/DataSourceFactory.java
// public class DataSourceFactory implements Serializable {
//     private static final long serialVersionUID = 1L;
// 
//     private static final Logger LOG = LoggerFactory.getLogger(DataSourceFactory.class);
// 
//     private final DatabaseSettings dbSettings;
//     private transient DataSource dataSource;
// 
//     /**
//      * Constructor which takes an initialized {@link DataSource}.
//      * @param dbSettings the {@link DatabaseSettings} to use to construct {@link DataSource}s.
//      */
//     public DataSourceFactory(final DatabaseSettings dbSettings) {
//         this.dbSettings = dbSettings;
//         this.dataSource = getDataSource();
//     }
// 
//     /**
//      * Gets a {@link DataSource} constructing a new one if needed.
//      * @return a {@link DataSource}.
//      */
//     public DataSource getDataSource() {
//         if(dataSource == null) {
//             LOG.info("Having to construct a new DataSource");
// 
//             dataSource = new DataSource();
// 
//             dataSource.setDriverClassName(dbSettings.getDriver());
//             dataSource.setUrl(dbSettings.getJdbcUrl());
//             dataSource.setUsername(dbSettings.getUser());
//             dataSource.setPassword(dbSettings.getPass());
// 
//             dataSource.setMaxActive(dbSettings.getMaxActive());
//             dataSource.setMaxIdle(dbSettings.getMaxIdle());
//             dataSource.setMinIdle(dbSettings.getMinIdle());
//             dataSource.setInitialSize(dbSettings.getInitialSize());
//             dataSource.setTestOnBorrow(dbSettings.getTestOnBorrow());
//             dataSource.setTestOnReturn(dbSettings.getTestOnReturn());
//             dataSource.setTestWhileIdle(dbSettings.getTestWhileIdle());
//             dataSource.setValidationQuery(dbSettings.getValidationQuery());
//             dataSource.setLogValidationErrors(dbSettings.getLogValidationErrors());
// 
//             // a catch-all for any other properties that are needed
//             dataSource.setDbProperties(dbSettings.getProperties());
//         }
// 
//         return dataSource;
//     }
// }


// Path: croquet-core/src/main/java/com/metrink/croquet/hibernate/QueryRunnerModule.java
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.metrink.croquet.DataSourceFactory;
import com.sop4j.dbutils.QueryRunner;

package com.metrink.croquet.hibernate;


/**
 * Guice module for binding QueryRunner provider.
 */
public class QueryRunnerModule extends AbstractModule {
    //private static final Logger LOG = LoggerFactory.getLogger(QueryRunnerModule.class);

    private final DataSourceFactory dataSourceFactory;

    /**
     * Constructor.
     * @param dataSourceFactory a factory to create {@link DataSource}s.
     */
    public QueryRunnerModule(final DataSourceFactory dataSourceFactory) {
        this.dataSourceFactory = dataSourceFactory;
    }

    @Override
    protected void configure() {
    }

    /**
     * Provider for {@link QueryRunner}.
     * @return a new {@link QueryRunner}.
     */
    @Provides
    public QueryRunner queryRunnerProvider() {