use of org.jboss.hal.core.datasource.JdbcDriver in project console by hal.
the class DataSourceColumn method prepareWizard.
private void prepareWizard(boolean xa) {
Task<FlowContext> readDataSources = context -> crud.readChildren(DATA_SOURCE_SUBSYSTEM_TEMPLATE, xa ? XA_DATA_SOURCE : DATA_SOURCE).doOnSuccess(children -> {
List<DataSource> dataSources = children.stream().map(property -> new DataSource(property, xa)).collect(toList());
context.set(DATASOURCES, dataSources);
}).toCompletable();
List<Task<FlowContext>> tasks = new ArrayList<>();
tasks.add(readDataSources);
tasks.addAll(runningServers(environment, dispatcher, properties(PROFILE_NAME, statementContext.selectedProfile())));
tasks.add(new JdbcDriverTasks.ReadRuntime(environment, dispatcher));
tasks.add(new JdbcDriverTasks.CombineDriverResults());
series(new FlowContext(progress.get()), tasks).subscribe(new Outcome<FlowContext>() {
@Override
public void onError(FlowContext context, Throwable error) {
showWizard(Collections.emptyList(), Collections.emptyList(), xa);
}
@Override
public void onSuccess(FlowContext context) {
List<DataSource> dataSources = context.get(DATASOURCES);
List<JdbcDriver> drivers = context.get(JdbcDriverTasks.DRIVERS);
showWizard(dataSources, drivers, xa);
}
});
}
use of org.jboss.hal.core.datasource.JdbcDriver in project console by hal.
the class Context method custom.
void custom() {
dataSource = new DataSource(xa);
driver = new JdbcDriver();
xaProperties.clear();
}
use of org.jboss.hal.core.datasource.JdbcDriver in project console by hal.
the class DriverStep method onNext.
@Override
protected boolean onNext(Context context) {
boolean valid = form.save();
if (valid) {
JdbcDriver driver = form.getModel();
context.dataSource.setDriver(driver);
if (context.isCreated()) {
context.recordChange(DRIVER_NAME, driver.getName());
if (context.isXa()) {
context.recordChange(XA_DATASOURCE_CLASS, driver.get(DRIVER_XA_DATASOURCE_CLASS_NAME).asString());
} else {
context.recordChange(DRIVER_CLASS, driver.get(DRIVER_CLASS_NAME).asString());
}
}
}
return valid;
}
use of org.jboss.hal.core.datasource.JdbcDriver in project console by hal.
the class DriverStep method assignFromJdbcDriverOrTemplate.
@SuppressWarnings("unchecked")
private void assignFromJdbcDriverOrTemplate(String driverName, String propName) {
FormItem formItem = form.getFormItem(propName);
if (formItem != null) {
JdbcDriver driver = driversByName.get(driverName);
DataSourceTemplate template = this.wizard().getContext().template;
if (driver != null && driver.hasDefined(propName) && !driver.get(propName).asString().isEmpty()) {
// assign the value inside the driver
formItem.setModified(true);
formItem.setValue(driver.get(propName).asString());
} else if (template != null && template.getDriver() != null && template.getDriver().hasDefined(propName) && !template.getDriver().get(propName).asString().isEmpty()) {
// assign the value in the template
formItem.setModified(true);
formItem.setValue(this.wizard().getContext().template.getDriver().get(propName).asString());
}
// let the current value at it is now
}
}
Aggregations