Skip to content

Commit

Permalink
Dbeaver/dbeaver vscode#22 split core plugins (#3102)
Browse files Browse the repository at this point in the history
* dbeaver/dbeaver-vscode#22 wip

* dbeaver/dbeaver-vscode#22 wip

* dbeaver/dbeaver-vscode#22 wip

* dbeaver/dbeaver-vscode#22 gql model fix

* dbeaver/dbeaver-vscode#22 missed class fix

* dbeaver/dbeaver-vscode#22 ce fixes

* dbeaver/dbeaver-vscode#22 fixes

* dbeaver/dbeaver-vscode#22 review fixes

---------

Co-authored-by: mr-anton-t <42037741+mr-anton-t@users.noreply.github.com>
Co-authored-by: Alexey <wrouds@gmail.com>
  • Loading branch information
3 people authored Dec 4, 2024
1 parent 7f1c9ce commit 0b5af36
Show file tree
Hide file tree
Showing 119 changed files with 903 additions and 700 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import io.cloudbeaver.service.security.SMUtils;
import io.cloudbeaver.service.sql.WebDataFormat;
import io.cloudbeaver.utils.CBModelConstants;
import io.cloudbeaver.utils.WebAppUtils;
import io.cloudbeaver.utils.ServletAppUtils;
import io.cloudbeaver.utils.WebCommonUtils;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
Expand Down Expand Up @@ -465,7 +465,8 @@ private boolean canViewReadOnlyConnections() {
if (isCanEdit()) {
return true;
}
BaseWebAppConfiguration appConfig = (BaseWebAppConfiguration) WebAppUtils.getWebApplication().getAppConfiguration();
BaseWebAppConfiguration appConfig = (BaseWebAppConfiguration) ServletAppUtils.getServletApplication()
.getAppConfiguration();
return appConfig.isShowReadOnlyConnectionInfo();

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
/**
* Abstract class that contains methods for loading configuration with gson.
*/
public abstract class BaseServerConfigurationController<T extends WebServerConfiguration>
implements WebServerConfigurationController<T> {
public abstract class BaseServerConfigurationController<T extends ServletServerConfiguration>
implements ServletServerConfigurationController<T> {
private static final Log log = Log.getLog(BaseServerConfigurationController.class);
@NotNull
private final Path homeDirectory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@
import java.util.Map;

/**
* Web application
* Servlet application
*/
public abstract class BaseWebApplication extends BaseApplicationImpl implements WebApplication {
public abstract class BaseServletApplication extends BaseApplicationImpl implements ServletApplication {

public static final String DEFAULT_CONFIG_FILE_PATH = "/etc/cloudbeaver.conf";
public static final String CUSTOM_CONFIG_FOLDER = "custom";
public static final String CLI_PARAM_WEB_CONFIG = "-web-config";
public static final String LOGBACK_FILE_NAME = "logback.xml";

private static final Log log = Log.getLog(BaseWebApplication.class);
private static final Log log = Log.getLog(BaseServletApplication.class);

private String instanceId;

Expand Down Expand Up @@ -252,7 +252,7 @@ public WSEventController getEventController() {
return null;
}

public abstract WebServerConfigurationController getServerConfigurationController();
public abstract ServletServerConfigurationController getServerConfigurationController();

@Override
public boolean isEnvironmentVariablesAccessible() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.LinkedHashMap;
import java.util.Map;

public abstract class BaseWebAppConfiguration implements WebAppConfiguration {
public abstract class BaseWebAppConfiguration implements ServletAppConfiguration {
public static final String DEFAULT_APP_ANONYMOUS_TEAM_NAME = "user";

protected final Map<String, Object> plugins;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.cloudbeaver.model.app;

import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;

import java.util.Map;

/**
* Application configuration
*/
public interface ServletAppConfiguration {
String getAnonymousUserTeam();

boolean isAnonymousAccessEnabled();

@Nullable
<T> T getResourceQuota(String quotaId);

String getDefaultUserTeam();

<T> T getPluginOption(@NotNull String pluginId, @NotNull String option);

Map<String, Object> getPluginConfig(@NotNull String pluginId, boolean create);

boolean isResourceManagerEnabled();

boolean isFeaturesEnabled(String[] requiredFeatures);

boolean isFeatureEnabled(String id);

@NotNull
default String[] getEnabledFeatures() {
return new String[0];
}

default boolean isSupportsCustomConnections() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@
/**
* Base interface for web application
*/
public interface WebApplication extends DBPApplication {
public interface ServletApplication extends DBPApplication {
boolean isConfigurationMode();

default boolean isInitializationMode() {
return false;
}
default boolean isInitializationMode() {
return false;
}

WebAppConfiguration getAppConfiguration();
ServletAppConfiguration getAppConfiguration();

WebServerConfiguration getServerConfiguration();
ServletServerConfiguration getServerConfiguration();

Path getDataDirectory(boolean create);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@
import io.cloudbeaver.auth.CBAuthConstants;
import org.jkiss.dbeaver.DBException;

import java.util.List;

public interface WebAuthApplication extends WebApplication {
WebAuthConfiguration getAuthConfiguration();
public interface ServletAuthApplication extends ServletApplication {
ServletAuthConfiguration getAuthConfiguration();

String getAuthServiceURL();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Application authentication configuration
*/
public interface WebAuthConfiguration {
public interface ServletAuthConfiguration {

String getDefaultAuthProvider();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* Web server configuration.
* Contains only server configuration properties.
*/
public interface WebServerConfiguration {
public interface ServletServerConfiguration {
boolean isDevelMode();

default String getRootURI() {
Expand All @@ -39,5 +39,4 @@ default String getRootURI() {
default Map<String, Object> getProductSettings() {
return Map.of();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* Server configuration controller.
* Works with app server configuration (loads, updates)
*/
public interface WebServerConfigurationController<T extends WebServerConfiguration> {
public interface ServletServerConfigurationController<T extends ServletServerConfiguration> {

/**
* Loads server configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,38 @@
package io.cloudbeaver.model.app;

import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.navigator.DBNBrowseSettings;
import org.jkiss.dbeaver.registry.DataSourceNavigatorSettings;

import java.util.Map;

/**
* Application configuration
*/
public interface WebAppConfiguration {
String getAnonymousUserTeam();
public interface WebAppConfiguration extends ServletAppConfiguration {
DataSourceNavigatorSettings.Preset PRESET_WEB = new DataSourceNavigatorSettings.Preset("web",
"Web",
"Default view");

boolean isAnonymousAccessEnabled();
DBNBrowseSettings getDefaultNavigatorSettings();

@Nullable
<T> T getResourceQuota(String quotaId);
boolean isPublicCredentialsSaveEnabled();

String getDefaultUserTeam();
boolean isAdminCredentialsSaveEnabled();

<T> T getPluginOption(@NotNull String pluginId, @NotNull String option);

Map<String, Object> getPluginConfig(@NotNull String pluginId, boolean create);

boolean isResourceManagerEnabled();
default String[] getDisabledBetaFeatures() {
return new String[0];
}

boolean isFeaturesEnabled(String[] requiredFeatures);
default String[] getEnabledAuthProviders() {
return new String[0];
}

boolean isFeatureEnabled(String id);
@NotNull
String[] getEnabledDrivers();

@NotNull
default String[] getEnabledFeatures() {
return new String[0];
}
String[] getDisabledDrivers();

default boolean isSupportsCustomConnections() {
return true;
}
Map<String, Object> getResourceQuotas();
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import com.google.gson.annotations.Expose;
import io.cloudbeaver.auth.provider.local.LocalAuthProviderConstants;
import io.cloudbeaver.model.app.BaseWebAppConfiguration;
import io.cloudbeaver.model.app.WebAuthConfiguration;
import io.cloudbeaver.model.app.WebAppConfiguration;
import io.cloudbeaver.model.app.ServletAuthConfiguration;
import io.cloudbeaver.registry.WebAuthProviderDescriptor;
import io.cloudbeaver.registry.WebAuthProviderRegistry;
import org.jkiss.code.NotNull;
Expand All @@ -36,9 +37,8 @@
/**
* Application configuration
*/
public class CBAppConfig extends BaseWebAppConfiguration implements WebAuthConfiguration {
public class CBAppConfig extends BaseWebAppConfiguration implements ServletAuthConfiguration, WebAppConfiguration {
private static final Log log = Log.getLog(CBAppConfig.class);
public static final DataSourceNavigatorSettings.Preset PRESET_WEB = new DataSourceNavigatorSettings.Preset("web", "Web", "Default view");

public static final DataSourceNavigatorSettings DEFAULT_VIEW_SETTINGS = PRESET_WEB.getSettings();
private final Set<SMAuthProviderCustomConfiguration> authConfigurations;
Expand All @@ -47,8 +47,6 @@ public class CBAppConfig extends BaseWebAppConfiguration implements WebAuthConfi
private final Map<String, SMAuthProviderCustomConfiguration> authConfiguration;

private boolean supportsCustomConnections;
private boolean supportsConnectionBrowser;
private boolean supportsUserWorkspaces;
private boolean enableReverseProxyAuth;
private boolean forwardProxy;
private boolean publicCredentialsSaveEnabled;
Expand Down Expand Up @@ -80,8 +78,6 @@ public CBAppConfig() {
this.anonymousUserRole = DEFAULT_APP_ANONYMOUS_TEAM_NAME;
this.anonymousUserTeam = DEFAULT_APP_ANONYMOUS_TEAM_NAME;
this.supportsCustomConnections = true;
this.supportsConnectionBrowser = false;
this.supportsUserWorkspaces = false;
this.publicCredentialsSaveEnabled = true;
this.adminCredentialsSaveEnabled = true;
this.redirectOnFederatedAuth = false;
Expand All @@ -106,8 +102,6 @@ public CBAppConfig(CBAppConfig src) {
this.anonymousUserRole = src.anonymousUserRole;
this.anonymousUserTeam = src.anonymousUserTeam;
this.supportsCustomConnections = src.supportsCustomConnections;
this.supportsConnectionBrowser = src.supportsConnectionBrowser;
this.supportsUserWorkspaces = src.supportsUserWorkspaces;
this.publicCredentialsSaveEnabled = src.publicCredentialsSaveEnabled;
this.adminCredentialsSaveEnabled = src.adminCredentialsSaveEnabled;
this.redirectOnFederatedAuth = src.redirectOnFederatedAuth;
Expand Down Expand Up @@ -148,14 +142,6 @@ public void setSupportsCustomConnections(boolean supportsCustomConnections) {
this.supportsCustomConnections = supportsCustomConnections;
}

public boolean isSupportsConnectionBrowser() {
return supportsConnectionBrowser;
}

public boolean isSupportsUserWorkspaces() {
return supportsUserWorkspaces;
}

public boolean isPublicCredentialsSaveEnabled() {
return publicCredentialsSaveEnabled;
}
Expand All @@ -176,6 +162,7 @@ public boolean isRedirectOnFederatedAuth() {
return redirectOnFederatedAuth;
}

@NotNull
public String[] getEnabledDrivers() {
return enabledDrivers;
}
Expand All @@ -184,6 +171,7 @@ public void setEnabledDrivers(String[] enabledDrivers) {
this.enabledDrivers = enabledDrivers;
}

@NotNull
public String[] getDisabledDrivers() {
return disabledDrivers;
}
Expand Down

This file was deleted.

Loading

0 comments on commit 0b5af36

Please sign in to comment.