// Path: src/main/java/junit/rules/util/ObjectUtils.java
// public static <T> boolean nullSafeEquals(final T a, final T b) {
//     if (a == b) {
//         return true;
//     }
//     if (a == null || b == null) {
//         return false;
//     }
//     return a.equals(b);
// }
// 
// Path: src/main/java/junit/rules/util/StringUtils.java
// public static boolean hasLength(final String s) {
//     return s != null && s.length() > 0;
// }


import static junit.rules.util.ObjectUtils.nullSafeEquals;
import static junit.rules.util.StringUtils.hasLength;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Enumeration;
import javax.sql.DataSource;
/**
 * junit-rules: JUnit Rules Library
 *
 * Copyright (c) 2009-2011 by Alistair A. Israel.
 * This software is made available under the terms of the MIT License.
 *
 * Created May 5, 2011
 */
package junit.rules.jdbc.support;




/**
 * Poor man's implementation of Spring's DriverManager-backed {@link DataSource}.
 *
 * @author Alistair.Israel
 */
public class DriverManagerDataSource implements DataSource {

    private boolean needToRegisterDriver;

    private String jdbcDriver;

    private String jdbcUrl;

    private String jdbcUser;

    private String jdbcPassword;

    /**
     * @return the jdbcDriver
     */
    public final String getJdbcDriver() {
        return jdbcDriver;
    }

    /**
     * @param jdbcDriver
     *        the jdbcDriver to set
     */
    public final void setJdbcDriver(final String jdbcDriver) {
// Path: src/main/java/junit/rules/util/ObjectUtils.java
// public static <T> boolean nullSafeEquals(final T a, final T b) {
//     if (a == b) {
//         return true;
//     }
//     if (a == null || b == null) {
//         return false;
//     }
//     return a.equals(b);
// }
// 
// Path: src/main/java/junit/rules/util/StringUtils.java
// public static boolean hasLength(final String s) {
//     return s != null && s.length() > 0;
// }


// Path: src/main/java/junit/rules/jdbc/support/DriverManagerDataSource.java
import static junit.rules.util.ObjectUtils.nullSafeEquals;
import static junit.rules.util.StringUtils.hasLength;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Enumeration;
import javax.sql.DataSource;

/**
 * junit-rules: JUnit Rules Library
 *
 * Copyright (c) 2009-2011 by Alistair A. Israel.
 * This software is made available under the terms of the MIT License.
 *
 * Created May 5, 2011
 */
package junit.rules.jdbc.support;




/**
 * Poor man's implementation of Spring's DriverManager-backed {@link DataSource}.
 *
 * @author Alistair.Israel
 */
public class DriverManagerDataSource implements DataSource {

    private boolean needToRegisterDriver;

    private String jdbcDriver;

    private String jdbcUrl;

    private String jdbcUser;

    private String jdbcPassword;

    /**
     * @return the jdbcDriver
     */
    public final String getJdbcDriver() {
        return jdbcDriver;
    }

    /**
     * @param jdbcDriver
     *        the jdbcDriver to set
     */
    public final void setJdbcDriver(final String jdbcDriver) {
        if (!nullSafeEquals(this.jdbcDriver, jdbcDriver)) {