/** * Determines the connection URL to use for the specified {@code Dbms} by * first: * <ol> * <li>checking if the {@code CONNECTION_URL} property is set; * <li>otherwise, calculate it using the {@link DbmsType}. * </ol> * If the {@link DbmsType} can not be found by calling * {@link DatabaseUtil#dbmsTypeOf(DbmsHandlerComponent, Dbms)}, a * {@code SpeedmentException} will be thrown. * * @param dbmsHandlerComponent the dbms handler component instance * @param dbms the database manager * @return the connection URL to use * @throws SpeedmentException if the {@link DbmsType} couldn't be found */ public static String findConnectionUrl(DbmsHandlerComponent dbmsHandlerComponent, Dbms dbms) throws SpeedmentException { final DbmsType type = findDbmsType(dbmsHandlerComponent, dbms); return dbms.getConnectionUrl().orElseGet(() -> type.getConnectionUrlGenerator().from(dbms)); }
public StringProperty connectionUrlProperty() { return stringPropertyOf(CONNECTION_URL, () -> Dbms.super.getConnectionUrl().orElse(null)); }
/** * Determines the connection URL to use for the specified {@code Dbms} by * first: * <ol> * <li>checking if the {@code CONNECTION_URL} property is set; * <li>otherwise, calculate it using the {@link DbmsType}. * </ol> * If the {@link DbmsType} can not be found by calling * {@link DatabaseUtil#dbmsTypeOf(DbmsHandlerComponent, Dbms)}, a * {@code SpeedmentException} will be thrown. * * @param dbmsHandlerComponent the dbms handler component instance * @param dbms the database manager * @return the connection URL to use * @throws SpeedmentException if the {@link DbmsType} couldn't be found */ public static String findConnectionUrl(DbmsHandlerComponent dbmsHandlerComponent, Dbms dbms) throws SpeedmentException { final DbmsType type = findDbmsType(dbmsHandlerComponent, dbms); return dbms.getConnectionUrl().orElseGet(() -> type.getConnectionUrlGenerator().from(dbms)); }