Skip to content

Commit

Permalink
Merge branch 'devel' into CB-5084-column-dnd-blob
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgeniaBzzz authored Jul 10, 2024
2 parents 8fc68af + f88eb86 commit 20bc67a
Show file tree
Hide file tree
Showing 283 changed files with 1,885 additions and 1,285 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ You can see live demo of CloudBeaver here: https://demo.cloudbeaver.io

## Changelog

### 24.1.2. 2024-07-08
- Added the ability to change the default commit mode for each connection separately;
- Added additional notifications about restricted operations;
- Improved application behavior when closing a connection - open editors won't be closed on disconnect;
- Added the "Keep alive" setting for Db2 LUW and IMB i, Apache Kyuubi, Clickhouse, Firebird and Trino;
- Fixed the dollar-quoted string parsing in the SQL editor for PostgreSQL;
- Many minor bug fixes, enhancements, and improvements have been made.

### 24.1.1. 2024-06-24
- Unauthorized access vulnerability was fixed;
- French language support was added (thanks to @matthieukhl);
Expand Down
4 changes: 3 additions & 1 deletion osgi-app.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ testBundlePaths=\
dbeaver/test;\
cloudbeaver/server/test;
additionalModuleRoots=\
opt;
opt;
optionalFeatureRepositories=\
dbeaver/product/repositories
4 changes: 2 additions & 2 deletions server/bundles/io.cloudbeaver.model/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
Bundle-Vendor: DBeaver Corp
Bundle-Name: Cloudbeaver Web Model
Bundle-SymbolicName: io.cloudbeaver.model;singleton:=true
Bundle-Version: 1.0.56.qualifier
Bundle-Release-Date: 20240708
Bundle-Version: 1.0.57.qualifier
Bundle-Release-Date: 20240722
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Expand Down
2 changes: 1 addition & 1 deletion server/bundles/io.cloudbeaver.model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<relativePath>../</relativePath>
</parent>
<artifactId>io.cloudbeaver.model</artifactId>
<version>1.0.56-SNAPSHOT</version>
<version>1.0.57-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,20 @@ public RMProject[] listAllSharedProjects() throws DBException {
return new RMProject[0];
}
var projects = new ArrayList<RMProject>();
var allPaths = Files.list(sharedProjectsPath).collect(Collectors.toList());
for (Path path : allPaths) {
var projectPerms = getProjectPermissions(
makeProjectIdFromPath(path, RMProjectType.SHARED),
RMProjectType.SHARED
);
var rmProject = makeProjectFromPath(path, projectPerms, RMProjectType.SHARED, false);
projects.add(rmProject);
try (Stream<Path> list = Files.list(sharedProjectsPath)) {
var allPaths = list.toList();
for (Path path : allPaths) {
var projectPerms = getProjectPermissions(
makeProjectIdFromPath(path, RMProjectType.SHARED),
RMProjectType.SHARED
);
var rmProject = makeProjectFromPath(path, projectPerms, RMProjectType.SHARED, false);
projects.add(rmProject);
}
return projects.stream()
.filter(Objects::nonNull)
.toArray(RMProject[]::new);
}
return projects.stream()
.filter(Objects::nonNull)
.toArray(RMProject[]::new);
} catch (IOException e) {
throw new DBException("Error reading shared projects", e);
}
Expand Down Expand Up @@ -581,7 +583,7 @@ public String createResource(
@NotNull String resourcePath,
boolean isFolder
) throws DBException {
try (var projectLock = lockController.lockProject(projectId, "createResource")) {
try (var ignoredLock = lockController.lockProject(projectId, "createResource")) {
validateResourcePath(resourcePath);
Path targetPath = getTargetPath(projectId, resourcePath);
if (Files.exists(targetPath)) {
Expand Down Expand Up @@ -613,7 +615,7 @@ public String moveResource(
@NotNull String oldResourcePath,
@NotNull String newResourcePath
) throws DBException {
try (var projectLock = lockController.lockProject(projectId, "moveResource")) {
try (var ignoredLock = lockController.lockProject(projectId, "moveResource")) {
var normalizedOldResourcePath = CommonUtils.normalizeResourcePath(oldResourcePath);
var normalizedNewResourcePath = CommonUtils.normalizeResourcePath(newResourcePath);
if (log.isDebugEnabled()) {
Expand Down Expand Up @@ -679,7 +681,7 @@ private void movePropertiesRecursive(

@Override
public void deleteResource(@NotNull String projectId, @NotNull String resourcePath, boolean recursive) throws DBException {
try (var projectLock = lockController.lockProject(projectId, "deleteResource")) {
try (var ignoredLock = lockController.lockProject(projectId, "deleteResource")) {
if (log.isDebugEnabled()) {
log.debug("Removing resource from '" + resourcePath + "' in project '" + projectId + "'" + (recursive ? " recursive" : ""));
}
Expand Down Expand Up @@ -768,7 +770,7 @@ public String setResourceContents(
@NotNull byte[] data,
boolean forceOverwrite
) throws DBException {
try (var lock = lockController.lockProject(projectId, "setResourceContents")) {
try (var ignoredLock = lockController.lockProject(projectId, "setResourceContents")) {
validateResourcePath(resourcePath);
Number fileSizeLimit = WebAppUtils.getWebApplication()
.getAppConfiguration()
Expand Down Expand Up @@ -822,7 +824,7 @@ public String setResourceProperty(
@NotNull String propertyName,
@Nullable Object propertyValue
) throws DBException {
try (var projectLock = lockController.lockProject(projectId, "resourcePropertyUpdate")) {
try (var ignoredLock = lockController.lockProject(projectId, "resourcePropertyUpdate")) {
validateResourcePath(resourcePath);
BaseWebProjectImpl webProject = getWebProject(projectId, false);
doFileWriteOperation(projectId, webProject.getMetadataFilePath(),
Expand All @@ -836,6 +838,27 @@ public String setResourceProperty(
}
}

@NotNull
@Override
public String setResourceProperties(
@NotNull String projectId,
@NotNull String resourcePath,
@NotNull Map<String, Object> properties
) throws DBException {
try (var ignoredLock = lockController.lockProject(projectId, "resourcePropertyUpdate")) {
validateResourcePath(resourcePath);
BaseWebProjectImpl webProject = getWebProject(projectId, false);
doFileWriteOperation(projectId, webProject.getMetadataFilePath(),
() -> {
log.debug("Updating resource '" + resourcePath + "' properties in project '" + projectId + "'");
webProject.setResourceProperties(resourcePath, properties);
return null;
}
);
return DEFAULT_CHANGE_ID;
}
}

private void validateResourcePath(String resourcePath) throws DBException {
var fullPath = Paths.get(resourcePath);
for (Path path : fullPath) {
Expand Down Expand Up @@ -1089,7 +1112,7 @@ private RMResource makeResourceFromPath(
);
}
if (readProperties) {
final BaseProjectImpl project = (BaseProjectImpl) getWebProject(projectId, true);
final BaseProjectImpl project = getWebProject(projectId, true);
final String resourcePath = getProjectRelativePath(projectId, path);
final Map<String, Object> properties = project.getResourceProperties(resourcePath);

Expand Down Expand Up @@ -1134,7 +1157,7 @@ private void fireRmResourceDeleteEvent(@NotNull String projectId, @NotNull Strin
);
}

private void fireRmProjectAddEvent(@NotNull RMProject project) throws DBException {
private void fireRmProjectAddEvent(@NotNull RMProject project) {
RMEventManager.fireEvent(
new RMEvent(
RMEvent.Action.RESOURCE_ADD,
Expand Down
4 changes: 2 additions & 2 deletions server/bundles/io.cloudbeaver.product.ce/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
Bundle-Vendor: DBeaver Corp
Bundle-Name: Cloudbeaver Community Product
Bundle-SymbolicName: io.cloudbeaver.product.ce;singleton:=true
Bundle-Version: 24.1.2.qualifier
Bundle-Release-Date: 20240708
Bundle-Version: 24.1.3.qualifier
Bundle-Release-Date: 20240722
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Expand Down
2 changes: 1 addition & 1 deletion server/bundles/io.cloudbeaver.product.ce/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<relativePath>../</relativePath>
</parent>
<artifactId>io.cloudbeaver.product.ce</artifactId>
<version>24.1.2-SNAPSHOT</version>
<version>24.1.3-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Base JDBC drivers
Bundle-SymbolicName: io.cloudbeaver.resources.drivers.base;singleton:=true
Bundle-Version: 1.0.101.qualifier
Bundle-Release-Date: 20240708
Bundle-Version: 1.0.102.qualifier
Bundle-Release-Date: 20240722
Bundle-Vendor: DBeaver Corp
Bundle-ActivationPolicy: lazy
Automatic-Module-Name: io.cloudbeaver.resources.drivers.base
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<relativePath>../</relativePath>
</parent>
<artifactId>io.cloudbeaver.resources.drivers.base</artifactId>
<version>1.0.101-SNAPSHOT</version>
<version>1.0.102-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
4 changes: 2 additions & 2 deletions server/bundles/io.cloudbeaver.server/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
Bundle-Vendor: DBeaver Corp
Bundle-Name: Cloudbeaver Web Server
Bundle-SymbolicName: io.cloudbeaver.server;singleton:=true
Bundle-Version: 24.1.2.qualifier
Bundle-Release-Date: 20240708
Bundle-Version: 24.1.3.qualifier
Bundle-Release-Date: 20240722
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Bundle-Activator: io.cloudbeaver.server.CBPlatformActivator
Expand Down
2 changes: 1 addition & 1 deletion server/bundles/io.cloudbeaver.server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<relativePath>../</relativePath>
</parent>
<artifactId>io.cloudbeaver.server</artifactId>
<version>24.1.2-SNAPSHOT</version>
<version>24.1.3-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import io.cloudbeaver.registry.WebAuthProviderRegistry;
import io.cloudbeaver.server.CBAppConfig;
import io.cloudbeaver.server.CBApplication;
import io.cloudbeaver.server.CBPlatform;
import io.cloudbeaver.utils.WebAppUtils;
import io.cloudbeaver.utils.WebCommonUtils;
import io.cloudbeaver.utils.WebDataSourceUtils;
Expand Down Expand Up @@ -57,6 +58,7 @@

import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;

/**
* Various constants
Expand Down Expand Up @@ -351,4 +353,13 @@ public static List<WebAuthProviderDescriptor> getEnabledAuthProviders() {
return result;
}

/**
* Returns set of applicable ids of drivers.
*/
@NotNull
public static Set<String> getApplicableDriversIds() {
return CBPlatform.getInstance().getApplicableDrivers().stream()
.map(DBPDriver::getId)
.collect(Collectors.toSet());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.jkiss.dbeaver.model.app.DBACertificateStorage;
import org.jkiss.dbeaver.model.app.DBPWorkspace;
import org.jkiss.dbeaver.model.connection.DBPDataSourceProviderDescriptor;
import org.jkiss.dbeaver.model.connection.DBPDataSourceProviderRegistry;
import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.connection.DBPDriverLibrary;
import org.jkiss.dbeaver.model.impl.app.DefaultCertificateStorage;
Expand All @@ -56,7 +55,8 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -199,12 +199,6 @@ public List<DBPDriver> getApplicableDrivers() {
return applicableDrivers;
}

@NotNull
@Override
public DBPDataSourceProviderRegistry getDataSourceProviderRegistry() {
return DataSourceProviderRegistry.getInstance();
}

@NotNull
public QMRegistry getQueryManager() {
return queryManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ protected void readProductConfiguration(Map<String, Object> serverConfig, Gson g
try (Reader reader = new InputStreamReader(new FileInputStream(rtConfig), StandardCharsets.UTF_8)) {
var runtimeProductSettings = JSONUtils.parseMap(gson, reader);
var productSettings = serverConfiguration.getProductSettings();
productSettings.putAll(runtimeProductSettings);
Map<String, Object> flattenConfig = WebAppUtils.flattenMap(productSettings);
runtimeProductSettings.putAll(productSettings);
Map<String, Object> flattenConfig = WebAppUtils.flattenMap(runtimeProductSettings);
productSettings.clear();
productSettings.putAll(flattenConfig);
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,7 @@
import org.jkiss.dbeaver.utils.RuntimeUtils;
import org.jkiss.utils.CommonUtils;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -128,9 +125,9 @@ public List<WebConnectionInfo> getUserConnections(
if (projectIds != null) {
stream = stream.filter(c -> projectIds.contains(c.getProjectId()));
}
List<DBPDriver> applicableDrivers = CBPlatform.getInstance().getApplicableDrivers();
return stream.filter(c -> applicableDrivers.contains(c.getDataSourceContainer().getDriver()))
.collect(Collectors.toList());
Set<String> applicableDrivers = WebServiceUtils.getApplicableDriversIds();
return stream.filter(c -> applicableDrivers.contains(c.getDataSourceContainer().getDriver().getId()))
.toList();
}

@Deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import io.cloudbeaver.model.rm.DBNAbstractResourceManagerNode;
import io.cloudbeaver.model.rm.DBNResourceManagerResource;
import io.cloudbeaver.model.session.WebSession;
import io.cloudbeaver.server.CBPlatform;
import io.cloudbeaver.service.navigator.DBWServiceNavigator;
import io.cloudbeaver.service.navigator.WebCatalog;
import io.cloudbeaver.service.navigator.WebNavigatorNodeInfo;
Expand All @@ -38,7 +37,6 @@
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.*;
import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.edit.DBECommandContext;
import org.jkiss.dbeaver.model.edit.DBEObjectMaker;
import org.jkiss.dbeaver.model.edit.DBEObjectRenamer;
Expand Down Expand Up @@ -85,7 +83,7 @@ public List<WebNavigatorNodeInfo> getNavigatorNodeChildren(
DBNNode[] nodeChildren;
boolean isRootPath = CommonUtils.isEmpty(parentPath) || "/".equals(parentPath) || ROOT_DATABASES.equals(parentPath);
DBNModel navigatorModel = session.getNavigatorModel();
List<DBPDriver> applicableDrivers = CBPlatform.getInstance().getApplicableDrivers();
Set<String> applicableDrivers = WebServiceUtils.getApplicableDriversIds();
if (isRootPath) {
DBNRoot rootNode = navigatorModel.getRoot();
nodeChildren = DBNUtils.getNodeChildrenFiltered(monitor, rootNode, true);
Expand All @@ -97,8 +95,8 @@ public List<WebNavigatorNodeInfo> getNavigatorNodeChildren(
if (!parentNode.hasChildren(false)) {
return EMPTY_NODE_LIST;
}
if (parentNode instanceof DBNProject) {
parentNode = ((DBNProject) parentNode).getDatabases();
if (parentNode instanceof DBNProject projectNode) {
parentNode = projectNode.getDatabases();
}
nodeChildren = DBNUtils.getNodeChildrenFiltered(monitor, parentNode, false);
}
Expand All @@ -109,15 +107,16 @@ public List<WebNavigatorNodeInfo> getNavigatorNodeChildren(
Set<String> nodeIds = new HashSet<>(); // filter duplicate node ids

for (DBNNode node : nodeChildren) {
if (node instanceof DBNDatabaseFolder && CommonUtils.isEmpty(((DBNDatabaseFolder) node).getMeta().getChildren(null))) {
if (node instanceof DBNDatabaseFolder folderNode && CommonUtils.isEmpty(folderNode.getMeta().getChildren(null))) {
// Skip empty folders. Folder may become empty if their nested elements are provided by UI plugins.
continue;
}
if (!CommonUtils.toBoolean(onlyFolders) || node instanceof DBNContainer) {
// Skip connections which are not supported in CB
if (node instanceof DBNDataSource) {
DBPDataSourceContainer container = ((DBNDataSource) node).getDataSourceContainer();
if (!applicableDrivers.contains(container.getDriver())) {
if (node instanceof DBNDataSource dataSourceNode) {
DBPDataSourceContainer container = dataSourceNode.getDataSourceContainer();
// compare by id because driver object can be recreated if it was custom or disabled
if (!applicableDrivers.contains(container.getDriver().getId())) {
continue;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
Bundle-Vendor: DBeaver Corp
Bundle-Name: Cloudbeaver Web Service - Administration
Bundle-SymbolicName: io.cloudbeaver.service.admin;singleton:=true
Bundle-Version: 1.0.100.qualifier
Bundle-Release-Date: 20240708
Bundle-Version: 1.0.101.qualifier
Bundle-Release-Date: 20240722
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Expand Down
Loading

0 comments on commit 20bc67a

Please sign in to comment.