/** * 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)); }
protected StringBinding defaultConnectionUrlProperty(T document, DbmsHandlerComponent dbmsHandlerComponent) { return Bindings.createStringBinding(() -> DatabaseUtil.findDbmsType(dbmsHandlerComponent, document).getConnectionUrlGenerator().from(document), document.typeNameProperty(), document.ipAddressProperty(), document.portProperty(), document.usernameProperty() ); } }
final String url = item.getConnectionUrlGenerator().from( TemporaryDbms.create( ui.projectProperty(),
/** * 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)); }
protected StringBinding defaultConnectionUrlProperty(DbmsHandlerComponent dbmsHandlerComponent) { return Bindings.createStringBinding(() -> DatabaseUtil.findDbmsType(dbmsHandlerComponent, this).getConnectionUrlGenerator().from(this), typeNameProperty(), ipAddressProperty(), portProperty(), usernameProperty() ); }
protected StringBinding defaultConnectionUrlProperty(T document, DbmsHandlerComponent dbmsHandlerComponent) { return Bindings.createStringBinding(() -> DatabaseUtil.findDbmsType(dbmsHandlerComponent, document).getConnectionUrlGenerator().from(document), document.typeNameProperty(), document.ipAddressProperty(), document.portProperty(), document.usernameProperty() ); } }