CB-4816 refresh disabled drivers after loading runtime config (#2455)

* CB-4816 refresh disabled drivers after loading runtime config

* CB-4816 refresh drivers config only when starting server
This commit is contained in:
Ainur
2024-03-07 09:29:02 +00:00
committed by GitHub
parent 56cd55e62f
commit 4bae903d74
2 changed files with 14 additions and 15 deletions
@@ -48,6 +48,7 @@ import org.jkiss.dbeaver.model.app.DBPApplication;
import org.jkiss.dbeaver.model.app.DBPPlatform;
import org.jkiss.dbeaver.model.auth.AuthInfo;
import org.jkiss.dbeaver.model.auth.SMCredentialsProvider;
import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.data.json.JSONUtils;
import org.jkiss.dbeaver.model.navigator.DBNBrowseSettings;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
@@ -260,6 +261,7 @@ public abstract class CBApplication extends BaseWebApplication implements WebAut
log.error(e);
return;
}
refreshDisabledDriversConfig();
configurationMode = CommonUtils.isEmpty(serverName);
@@ -541,7 +543,6 @@ public abstract class CBApplication extends BaseWebApplication implements WebAut
log.debug("Runtime configuration [" + runtimeConfigFile.getAbsolutePath() + "]");
parseConfiguration(runtimeConfigFile);
}
return path;
}
@@ -1338,4 +1339,16 @@ public abstract class CBApplication extends BaseWebApplication implements WebAut
}
eventController.addEvent(new WSServerConfigurationChangedEvent(sessionId, null));
}
private void refreshDisabledDriversConfig() {
CBAppConfig config = getAppConfiguration();
Set<String> disabledDrivers = new LinkedHashSet<>(Arrays.asList(config.getDisabledDrivers()));
for (DBPDriver driver : CBPlatform.getInstance().getApplicableDrivers()) {
if (!driver.isEmbedded() || config.isDriverForceEnabled(driver.getFullId())) {
continue;
}
disabledDrivers.add(driver.getFullId());
}
config.setDisabledDrivers(disabledDrivers.toArray(new String[0]));
}
}
@@ -119,8 +119,6 @@ public class CBPlatform extends BasePlatformImpl {
refreshApplicableDrivers();
refreshDisabledDriversConfig();
new WebSessionMonitorJob(this)
.scheduleMonitor();
@@ -293,18 +291,6 @@ public class CBPlatform extends BasePlatformImpl {
log.info("Available drivers: " + applicableDrivers.stream().map(DBPDriver::getFullName).collect(Collectors.joining(",")));
}
private void refreshDisabledDriversConfig() {
CBAppConfig config = application.getAppConfiguration();
Set<String> disabledDrivers = new LinkedHashSet<>(Arrays.asList(config.getDisabledDrivers()));
for (DBPDriver driver : applicableDrivers) {
if (!driver.isEmbedded() || config.isDriverForceEnabled(driver.getFullId())) {
continue;
}
disabledDrivers.add(driver.getFullId());
}
config.setDisabledDrivers(disabledDrivers.toArray(new String[0]));
}
@NotNull
@Override
public DBFileController createFileController() {