class JdbcDriverServiceImpl implements JdbcDriverService, ApplicationContextAware {

    @Override
    public synchronized void setDriverMappingAndRegister(String driverClass, String path) throws Exception {
        ClassLoader classLoader = getClassLoaderAndVerifyDriverClassName(driverClass, path);

        //Unregister any existing driver
        String registeredUrl = getUrlByDriverClassName(driverClass);
        if (SYSTEM_CLASSLOADER_PATH.equals(registeredUrl)) {
            unRegisterByClassName(driverClass);
        } else {
            unRegisterByUrl(registeredUrl);
        }

        //Set new mappings
        driverClassToUrlMap.put(driverClass, path);
        classLoaderToUrlMap.put(classLoader, path);

        //Register new driver
        register(driverClass);

        //Save mapping to global proeprties list
        if (getPropertiesManagementService() != null) {
            String driverNameKey = String.format(SYSTEM_PROPERTIES_LIST_KEY_FORMAT, driverClass);
            getPropertiesManagementService().setProperty(driverNameKey, path);
        }
    }

}