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-5574. Added new api for get manager, added flap in server configur… #3161

Open
wants to merge 15 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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 @@ -44,6 +44,8 @@ public class WebPropertyInfo {
private DBPPropertySource propertySource;
private boolean showProtected;

private Object[] validValues;

public WebPropertyInfo(WebSession session, DBPPropertyDescriptor property, DBPPropertySource propertySource) {
this.session = session;
this.property = property;
Expand Down Expand Up @@ -252,4 +254,8 @@ public List<String> getScopes() {
}
return null;
}

public void setValidValues(Object[] validValues) {
this.validValues = validValues;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public abstract class BaseWebAppConfiguration implements ServletAppConfiguration
protected final Map<String, Object> plugins;
protected String defaultUserTeam = DEFAULT_APP_ANONYMOUS_TEAM_NAME;
protected boolean resourceManagerEnabled;
protected boolean secretManagerEnabled;
protected boolean showReadOnlyConnectionInfo;
protected String[] enabledFeatures;
protected String[] disabledBetaFeatures;
Expand All @@ -42,6 +43,7 @@ public BaseWebAppConfiguration() {
this.enabledFeatures = null;
this.disabledBetaFeatures = new String[0];
this.showReadOnlyConnectionInfo = false;
this.secretManagerEnabled = false;
}

public BaseWebAppConfiguration(BaseWebAppConfiguration src) {
Expand All @@ -51,6 +53,7 @@ public BaseWebAppConfiguration(BaseWebAppConfiguration src) {
this.enabledFeatures = src.enabledFeatures;
this.disabledBetaFeatures = src.disabledBetaFeatures;
this.showReadOnlyConnectionInfo = src.showReadOnlyConnectionInfo;
this.secretManagerEnabled = src.secretManagerEnabled;
}

@Override
Expand Down Expand Up @@ -84,6 +87,11 @@ public boolean isResourceManagerEnabled() {
return resourceManagerEnabled;
}

@Override
public boolean isSecretManagerEnabled() {
return secretManagerEnabled;
}

@Override
public boolean isFeatureEnabled(String id) {
return ArrayUtils.contains(getEnabledFeatures(), id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

boolean isResourceManagerEnabled();

boolean isSecretManagerEnabled();

Check warning on line 43 in server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/ServletAppConfiguration.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/model/app/ServletAppConfiguration.java#L43

Missing a Javadoc comment.

boolean isFeaturesEnabled(String[] requiredFeatures);

boolean isFeatureEnabled(String id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ public void setResourceManagerEnabled(boolean resourceManagerEnabled) {
this.resourceManagerEnabled = resourceManagerEnabled;
}

public void setSecretManagerEnabled(boolean secretManagerEnabled) {
this.secretManagerEnabled = secretManagerEnabled;
}

public boolean isSupportsCustomConnections() {
return supportsCustomConnections;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class CBConstants {
public static final String PARAM_STATIC_CONTENT = "staticContent";
public static final String PARAM_RESOURCE_QUOTAS = "resourceQuotas";
public static final String PARAM_RESOURCE_MANAGER_ENABLED = "resourceManagerEnabled";
public static final String PARAM_SECRET_MANAGER_ENABLED = "secretManagerEnabled";
public static final String PARAM_SHOW_READ_ONLY_CONN_INFO = "showReadOnlyConnectionInfo";
public static final String PARAM_CONN_GRANT_ANON_ACCESS = "grantConnectionsAccessToAnonymousTeam";
public static final String PARAM_AUTH_PROVIDERS = "authConfiguration";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Export-Package: io.cloudbeaver,
io.cloudbeaver.model.config,
io.cloudbeaver.server,
io.cloudbeaver.service,
io.cloudbeaver.service.core,
io.cloudbeaver.service.session
Import-Package: org.slf4j
Automatic-Module-Name: io.cloudbeaver.server.ce
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import io.cloudbeaver.registry.WebDriverRegistry;
import io.cloudbeaver.registry.WebServiceRegistry;
import io.cloudbeaver.server.jetty.CBJettyServer;
import io.cloudbeaver.service.ConnectionController;
import io.cloudbeaver.service.ConnectionControllerCE;
import io.cloudbeaver.service.DBWServiceInitializer;
import io.cloudbeaver.service.DBWServiceServerConfigurator;
import io.cloudbeaver.service.session.CBSessionManager;
Expand Down Expand Up @@ -772,4 +774,9 @@ public Map<String, String> getInitActions() {
public WebServerConfig getWebServerConfig() {
return new CBWebServerConfig(this);
}

@Override
public ConnectionController getConnectionController() {
return new ConnectionControllerCE();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,11 @@ protected Map<String, Object> collectConfigurationProperties(
appConfigProperties,
CBConstants.PARAM_RESOURCE_MANAGER_ENABLED,
appConfig.isResourceManagerEnabled());
copyConfigValue(
oldAppConfig,
appConfigProperties,
CBConstants.PARAM_SECRET_MANAGER_ENABLED,
appConfig.isSecretManagerEnabled());
copyConfigValue(
oldAppConfig,
appConfigProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ type ServerConfig {
supportsCustomConnections: Boolean!
resourceManagerEnabled: Boolean!

secretManagerEnabled: Boolean! @since(version: "24.3.2")

publicCredentialsSaveEnabled: Boolean!
adminCredentialsSaveEnabled: Boolean!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.stream.Stream;

/**
* Web driver configuration
Expand Down Expand Up @@ -258,9 +259,18 @@ public WebPropertyInfo[] getMainProperties() {

@Property
public WebPropertyInfo[] getProviderProperties() {
return Arrays.stream(driver.getProviderPropertyDescriptors())
WebPropertyInfo[] additionalWebProperty = WebAppUtils.getWebApplication().getConnectionController().getExternalInfo(webSession);
WebPropertyInfo[] providerProperties = Arrays.stream(driver.getProviderPropertyDescriptors())
.map(p -> new WebPropertyInfo(webSession, p, null))
.toArray(WebPropertyInfo[]::new);

WebPropertyInfo[] combinedProperties = Stream.concat(
Arrays.stream(additionalWebProperty),
Arrays.stream(providerProperties)
).toArray(WebPropertyInfo[]::new);

return combinedProperties;

}

@Property
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ public boolean isResourceManagerEnabled() {
return application.getAppConfiguration().isResourceManagerEnabled();
}

@Property
public boolean isSecretManagerEnabled() {
return application.getAppConfiguration().isSecretManagerEnabled();
}

@Property
public String[] getEnabledFeatures() {
return application.getAppConfiguration().getEnabledFeatures();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.cloudbeaver.model.app.WebAppConfiguration;
import io.cloudbeaver.model.app.WebServerConfiguration;
import io.cloudbeaver.registry.WebDriverRegistry;
import io.cloudbeaver.service.ConnectionController;
import org.jkiss.code.NotNull;

import java.net.InetAddress;
Expand Down Expand Up @@ -50,6 +51,8 @@

String getLicenseStatus();

WebServerConfig getWebServerConfig();

Check warning on line 54 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/WebApplication.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/WebApplication.java:54:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

ConnectionController getConnectionController();

Check warning on line 56 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/WebApplication.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/WebApplication.java:56:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

Check warning on line 56 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/WebApplication.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/WebApplication.java#L56

Missing a Javadoc comment.

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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.service;

import io.cloudbeaver.DBWebException;
import io.cloudbeaver.WebObjectId;
import io.cloudbeaver.model.WebConnectionConfig;
import io.cloudbeaver.model.WebConnectionInfo;
import io.cloudbeaver.model.WebPropertyInfo;
import io.cloudbeaver.model.session.WebSession;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;

import java.util.Map;

public interface ConnectionController {

Check warning on line 30 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java:30:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)

Check warning on line 30 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java#L30

Missing a Javadoc comment.

WebConnectionInfo createConnection(

Check warning on line 32 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java:32:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

Check warning on line 32 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java#L32

Missing a Javadoc comment.
@NotNull WebSession webSession,
@Nullable @WebObjectId String projectId,
@NotNull WebConnectionConfig connectionConfig
) throws DBWebException;

WebConnectionInfo updateConnection(

Check warning on line 38 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java:38:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

Check warning on line 38 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java#L38

Missing a Javadoc comment.
@NotNull WebSession webSession,
@Nullable @WebObjectId String projectId,
@NotNull WebConnectionConfig connectionConfig) throws DBWebException;

boolean deleteConnection(

Check warning on line 43 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java:43:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

Check warning on line 43 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java#L43

Missing a Javadoc comment.
@NotNull WebSession webSession,
@Nullable @WebObjectId String projectId,
@NotNull String connectionId) throws DBWebException;

WebPropertyInfo[] getExternalInfo(WebSession webSession);

Check warning on line 48 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java

View workflow job for this annotation

GitHub Actions / Server / Lint

[checkstyle] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java:48:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

Check warning on line 48 in server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java

View check run for this annotation

Jenkins-CI-integration / CheckStyle Java Report

server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/service/ConnectionController.java#L48

Missing a Javadoc comment.
}
Loading
Loading