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

com.undefinedlabs.scope.rules.sql.provider.ConnectionTrackingCheckerRegistry Maven / Gradle / Ivy

Go to download

Scope is a APM for tests to give engineering teams unprecedented visibility into their CI process to quickly identify, troubleshoot and fix failed builds. This artifact contains the classes to instrument the Java SQL package.

There is a newer version: 0.15.1-beta.2
Show newest version
package com.undefinedlabs.scope.rules.sql.provider;

import com.undefinedlabs.scope.rules.sql.provider.internal.NoopConnectionTrackingChecker;
import com.undefinedlabs.scope.rules.sql.provider.internal.h2.JdbcConnectionTrackingChecker;

import java.sql.Connection;
import java.util.HashMap;
import java.util.Map;

public enum ConnectionTrackingCheckerRegistry {

    INSTANCE;

    private static final ConnectionTrackingChecker NOOP_CHECKER = new NoopConnectionTrackingChecker();
    private static final Map CHECKERS = new HashMap<>();

    static {
        CHECKERS.put(JdbcConnectionTrackingChecker.JDBC_CONNECTION_CLASS_NAME, new JdbcConnectionTrackingChecker());
    }

    public ConnectionTrackingChecker getChecker(final Connection connection) {
        return connection != null ? getChecker(connection.getClass().getName()) : NOOP_CHECKER;
    }

    ConnectionTrackingChecker getChecker(final String connectionClassName) {
        return CHECKERS.get(connectionClassName) != null ? CHECKERS.get(connectionClassName) : NOOP_CHECKER;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy