Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
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;
Expand Down Expand Up @@ -260,6 +261,7 @@ protected void startServer() {
log.error(e);
return;
}
refreshDisabledDriversConfig();

configurationMode = CommonUtils.isEmpty(serverName);

Expand Down Expand Up @@ -541,7 +543,6 @@ protected Path loadServerConfiguration() throws DBException {
log.debug("Runtime configuration [" + runtimeConfigFile.getAbsolutePath() + "]");
parseConfiguration(runtimeConfigFile);
}

return path;
}

Expand Down Expand Up @@ -1338,4 +1339,16 @@ protected void sendConfigChangedEvent(SMCredentialsProvider credentialsProvider)
}
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]));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ protected synchronized void initialize() {

refreshApplicableDrivers();

refreshDisabledDriversConfig();

new WebSessionMonitorJob(this)
.scheduleMonitor();

Expand Down Expand Up @@ -293,18 +291,6 @@ public void refreshApplicableDrivers() {
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() {
Expand Down
Loading