Class TeamCityJdbcDrivers
- java.lang.Object
-
- jetbrains.buildServer.serverSide.db.jdbcLoader.TeamCityJdbcDrivers
-
- All Implemented Interfaces:
JdbcDrivers
public class TeamCityJdbcDrivers extends Object implements JdbcDrivers
Loaded JDBC drivers. Holds a list of explicitly loaded JDBC drivers, and can provide one by conenction URL or connection URL and concrete class.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finalize()
Driver
findDefaultDriver(DatabaseType dbType)
Provides with the default driver for the specified database type.Driver
findDriver(String connectionString)
Looks for a situable driver (one that accepts the given url, seeDriver.acceptsURL(String)
).ClassLoader
getClassLoader()
The classloader provided via constructor.Driver
getDriver(String connectionString)
Looks for a situable driver (one that accepts the given url, seeDriver.acceptsURL(String)
).Driver
getDriver(String connectionString, String className)
Looks for the specified JDBC driver, checks the given URL and returns this driver if all OK.File
getDriverLocation(Driver driver)
Returns location of jar file containing specified JDBC driver.Collection<Driver>
getDrivers()
void
unregisterAll()
Check whether there is a JDBC driver suitable for the given URL.
-
-
-
Method Detail
-
getClassLoader
@NotNull public ClassLoader getClassLoader()
The classloader provided via constructor.- Specified by:
getClassLoader
in interfaceJdbcDrivers
- Returns:
- class loader.
-
findDefaultDriver
@Nullable public Driver findDefaultDriver(@NotNull DatabaseType dbType)
Provides with the default driver for the specified database type.- Specified by:
findDefaultDriver
in interfaceJdbcDrivers
- Parameters:
dbType
- type of the database.- Returns:
- the driver, or null if no applicable drivers.
-
getDriver
@NotNull public Driver getDriver(@NotNull String connectionString) throws NoSuitableJdbcDrivers
Looks for a situable driver (one that accepts the given url, seeDriver.acceptsURL(String)
). Or raises an exception if no suitable drivers.- Specified by:
getDriver
in interfaceJdbcDrivers
- Parameters:
connectionString
- url to check for.- Returns:
- found suitable driver.
- Throws:
NoSuitableJdbcDrivers
- when no suitable JDBC drivers found.
-
findDriver
@Nullable public Driver findDriver(@NotNull String connectionString)
Looks for a situable driver (one that accepts the given url, seeDriver.acceptsURL(String)
).- Specified by:
findDriver
in interfaceJdbcDrivers
- Parameters:
connectionString
- url to check for.- Returns:
- found suitable driver, or null if not found.
-
getDriver
@NotNull public Driver getDriver(@NotNull String connectionString, @NotNull String className) throws NoSuitableJdbcDrivers
Looks for the specified JDBC driver, checks the given URL and returns this driver if all OK.- Specified by:
getDriver
in interfaceJdbcDrivers
- Parameters:
connectionString
- url to check for.className
- driver class name.- Returns:
- found suitable driver.
- Throws:
NoSuitableJdbcDrivers
- when no such class found or the specified driver doesn't accept the given URL.
-
unregisterAll
public void unregisterAll()
Check whether there is a JDBC driver suitable for the given URL.- Specified by:
unregisterAll
in interfaceJdbcDrivers
- Parameters:
url
- url to check for.- See Also:
getDriver(String)
-
getDriverLocation
@Nullable public File getDriverLocation(@NotNull Driver driver)
Description copied from interface:JdbcDrivers
Returns location of jar file containing specified JDBC driver.- Specified by:
getDriverLocation
in interfaceJdbcDrivers
- Returns:
- location of jar file on disk, or null if location cannot be determined for some reason.
-
getDrivers
@NotNull public Collection<Driver> getDrivers()
-
-