Merge pull request #932 from dbeaver/rm_projects

Rm projects
This commit is contained in:
Serge Rider
2022-06-28 22:55:10 +02:00
committed by GitHub
21 changed files with 20 additions and 310 deletions
@@ -1,20 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Vendor: %Bundle-Vendor
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: io.cloudbeaver.connect.provider.sample;singleton:=true
Bundle-Version: 1.0.55.qualifier
Bundle-Release-Date: 20220627
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Require-Bundle: org.eclipse.core.runtime,
org.apache.commons.logging,
org.eclipse.core.resources,
io.cloudbeaver.server,
com.google.gson,
org.jkiss.bundle.graphql.java,
org.jkiss.dbeaver.model,
org.jkiss.dbeaver.model.sql
Bundle-Localization: OSGI-INF/l10n/bundle
Automatic-Module-Name: io.cloudbeaver.connect.provider.sample
@@ -1,2 +0,0 @@
Bundle-Vendor = DBeaver Corp
Bundle-Name = Cloudbeaver - Connections configuration - Sample
@@ -1,6 +0,0 @@
source.. = src/
output.. = target/classes/
bin.includes = .,\
META-INF/,\
OSGI-INF/,\
plugin.xml
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension point="org.jkiss.dbeaver.dataSourceStorage">
<storage id="sample" name="Sample configuration storage" description="Preconfigured sample connection set" class="io.cloudbeaver.connect.provider.sample.SampleDataSourceConfigurationStorage">
</storage>
</extension>
</plugin>
@@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.cloudbeaver</groupId>
<artifactId>bundles</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>io.cloudbeaver.connect.provider.sample</artifactId>
<version>1.0.55-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
@@ -1,83 +0,0 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2022 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.connect.provider.sample;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBPDataSourceConfigurationStorage;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.app.DBPDataSourceRegistry;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* Sample configuration storage.
* Is the main source of data in web application
*/
public class SampleDataSourceConfigurationStorage implements DBPDataSourceConfigurationStorage {
private static final Log log = Log.getLog(SampleDataSourceConfigurationStorage.class);
public static final String SAMPLE_CONFIG_NAME = "provided-connections.json";
@Override
public String getStorageId() {
return "Sample";
}
@Override
public boolean isValid() {
return false;
}
@Override
public boolean isDefault() {
return false;
}
@Override
public String getStatus() {
return "Valid";
}
@Override
public List<? extends DBPDataSourceContainer> loadDataSources(DBPDataSourceRegistry registry, Map<String, Object> options) throws DBException {
Path metadataFolder = registry.getProject().getMetadataFolder(false);
if (Files.exists(metadataFolder)) {
Path sampleConfigFile = metadataFolder.resolve(SAMPLE_CONFIG_NAME);
if (Files.exists(sampleConfigFile)) {
log.debug("Loading provided connections from [" + sampleConfigFile.toAbsolutePath() + "]");
List<? extends DBPDataSourceContainer> dsList = registry.loadDataSourcesFromFile(this, sampleConfigFile);
// for (DBPDataSourceContainer ds : dsList) {
// log.debug("\tProvided connection: " + ds.getName());
// }
return dsList;
}
}
return Collections.emptyList();
}
@Override
public String getConfigurationFileSuffix() {
return "-sample";
}
}
@@ -39,7 +39,6 @@ import java.nio.file.Path;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;
/**
@@ -56,7 +55,6 @@ public class LocalResourceController implements RMController {
private static final String PROJECT_PREFIX_USER = "u_";
public static final String DEFAULT_CHANGE_ID = "0";
private final List<RMEventListener> listeners = new CopyOnWriteArrayList<>();
private final SMCredentialsProvider credentialsProvider;
private final Path rootPath;
@@ -131,7 +129,7 @@ public class LocalResourceController implements RMController {
}
@Override
public void createProject(@NotNull RMProject project) throws DBException {
public RMProject createProject(@NotNull String id, @NotNull String name, @NotNull String description) throws DBException {
throw new DBCFeatureNotSupportedException();
}
@@ -145,6 +143,21 @@ public class LocalResourceController implements RMController {
return makeProjectFromId(projectId);
}
@Override
public String getProjectsDataSources(@NotNull String projectId) throws DBException {
throw new DBCFeatureNotSupportedException();
}
@Override
public void saveProjectDataSources(@NotNull String projectId, @NotNull String configuration) throws DBException {
throw new DBCFeatureNotSupportedException();
}
@Override
public void deleteProjectDataSources(@NotNull String projectId, @NotNull String[] dataSourceIds) throws DBException {
throw new DBCFeatureNotSupportedException();
}
@NotNull
@Override
public RMResource[] listResources(
@@ -219,7 +232,7 @@ public class LocalResourceController implements RMController {
} catch (IOException e) {
throw new DBException("Error deleting resource '" + resourcePath + "'", e);
}
fireEvent(
RMEventManager.fireEvent(
new RMEvent(RMEvent.Action.RESOURCE_DELETE,
makeProjectFromId(projectId),
rmResourcePath
@@ -288,26 +301,6 @@ public class LocalResourceController implements RMController {
}
}
@Override
public void addRMEventListener(RMEventListener listener) {
this.listeners.add(listener);
}
@Override
public void removeRMEventListener(RMEventListener listener) {
this.listeners.remove(listener);
}
private void fireEvent(RMEvent event) {
for (var listener : listeners) {
try {
listener.handleRMEvent(event);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}
@NotNull
private Path getTargetPath(@NotNull String projectId, @NotNull String resourcePath) throws DBException {
Path projectPath = getProjectPath(projectId);
@@ -50,7 +50,6 @@ import org.jkiss.dbeaver.registry.DataSourceDescriptor;
import org.jkiss.dbeaver.registry.DataSourceProviderRegistry;
import org.jkiss.dbeaver.registry.network.NetworkHandlerDescriptor;
import org.jkiss.dbeaver.registry.network.NetworkHandlerRegistry;
import org.jkiss.dbeaver.runtime.DBWorkbench;
import org.jkiss.dbeaver.runtime.jobs.ConnectionTestJob;
import org.jkiss.dbeaver.utils.RuntimeUtils;
import org.jkiss.utils.CommonUtils;
@@ -473,7 +472,7 @@ public class WebServiceCore implements DBWServiceCore {
WebServiceUtils.updateHandlerConfig(configuration, nhConfig);
configuration.setSavePassword(true);
configuration.setEnabled(true);
tunnel.initializeHandler(monitor, DBWorkbench.getPlatform(), configuration, connectionConfig);
tunnel.initializeHandler(monitor, configuration, connectionConfig);
monitor.worked(1);
// Get info
Object implementation = tunnel.getImplementation();
@@ -50,7 +50,7 @@ public class ConnectionSearcher implements DBRRunnableWithProgress {
this.webSession = webSession;
this.hostNames = hostNames;
CBPlatform platform = CBPlatform.getInstance();
this.tempRegistry = new DataSourceRegistry(platform, platform.getWorkspace().getActiveProject());
this.tempRegistry = new DataSourceRegistry(platform.getWorkspace().getActiveProject());
this.availableDrivers.addAll(CBPlatform.getInstance().getApplicableDrivers());
}
@@ -81,7 +81,7 @@ public class DBNResourceManagerRoot extends DBNNode implements DBPHiddenObject,
}
List<DBNResourceManagerProject> projectNodes = new ArrayList<>();
resourceController = ((WebSession) session).getRmController();
resourceController.addRMEventListener(this);
RMEventManager.addEventListener(this);
for (RMProject project : resourceController.listAccessibleProjects()) {
projectNodes.add(new DBNResourceManagerProject(this, project));
}
-1
View File
@@ -24,7 +24,6 @@
<module>io.cloudbeaver.service.security</module>
<module>io.cloudbeaver.resources.drivers.base</module>
<module>io.cloudbeaver.connect.provider.sample</module>
<module>io.cloudbeaver.product.ce</module>
</modules>
@@ -19,7 +19,6 @@
</license>
<includes id="io.cloudbeaver.server.feature" version="0.0.0"/>
<includes id="io.cloudbeaver.sample.feature" version="0.0.0"/>
<includes id="io.cloudbeaver.ce.drivers.feature" version="0.0.0"/>
<plugin id="io.cloudbeaver.product.ce" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
@@ -1,2 +0,0 @@
bin.includes = feature.xml,\
feature.properties
@@ -1,4 +0,0 @@
featureName=Cloudbeaver - Samples
providerName=DBeaver Corp
description=Cloudbeaver samples feature
copyright=\u00A9 DBeaver Corp, 2022
@@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="io.cloudbeaver.sample.feature"
label="%featureName"
version="1.0.55.qualifier"
provider-name="%providerName">
<description>
%description
</description>
<copyright>
%copyright
</copyright>
<license url="%licenseURL">
%license
</license>
<plugin id="io.cloudbeaver.connect.provider.sample" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
</feature>
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.cloudbeaver</groupId>
<artifactId>features</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<artifactId>io.cloudbeaver.sample.feature</artifactId>
<version>1.0.55-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
</project>
-2
View File
@@ -18,8 +18,6 @@
<module>io.cloudbeaver.server.feature</module>
<module>io.cloudbeaver.ce.drivers.feature</module>
<module>io.cloudbeaver.sample.feature</module>
<module>io.cloudbeaver.product.ce.feature</module>
</modules>
-1
View File
@@ -14,7 +14,6 @@
<modules>
<module>web-server</module>
<module>provided-sample</module>
</modules>
</project>
@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="Cloudbeaver Provided Sample" uid="io.cloudbeaver.provided.sample.product" id="io.cloudbeaver.provided.sample.product" application="io.cloudbeaver.server.standalone" version="22.1.1.qualifier" useFeatures="true" includeLaunchers="false">
<configIni use="default">
</configIni>
<features>
<feature id="io.cloudbeaver.server.feature"/>
<feature id="io.cloudbeaver.sample.feature"/>
<feature id="io.cloudbeaver.ce.drivers.feature"/>
</features>
<configurations>
<plugin id="org.eclipse.osgi" autoStart="true" startLevel="-1" />
<plugin id="org.apache.felix.scr" autoStart="true" startLevel="1"/>
<plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="4" />
</configurations>
</product>
-74
View File
@@ -1,74 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.cloudbeaver</groupId>
<artifactId>cloudbeaver</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../../</relativePath>
</parent>
<version>22.1.1-SNAPSHOT</version>
<artifactId>provided-sample</artifactId>
<packaging>eclipse-repository</packaging>
<name>Cloudbeaver Provided Sample Product</name>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<environments>
<environment>
<os>all</os>
<ws>all</ws>
<arch>all</arch>
</environment>
</environments>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-director-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<products>
<product>
<id>io.cloudbeaver.provided.sample.product</id>
<archiveFileName>cloudbeaver-provided-sample-${dbeaver-version}</archiveFileName>
</product>
</products>
</configuration>
<executions>
<execution>
<id>materialize-products</id>
<goals>
<goal>materialize-products</goal>
</goals>
</execution>
<execution>
<id>archive-products</id>
<goals>
<!--<goal>archive-products</goal>-->
</goals>
</execution>
</executions>
</plugin>
<!-- Disable P2 repository generation -->
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-repository-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<createArtifactRepository>false</createArtifactRepository>
<skipArchive>true</skipArchive>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -104,7 +104,6 @@
<setEntry value="org.slf4j.api@default:default"/>
</setAttribute>
<setAttribute key="selected_workspace_bundles">
<setEntry value="io.cloudbeaver.connect.provider.sample@default:default"/>
<setEntry value="io.cloudbeaver.model@default:default"/>
<setEntry value="io.cloudbeaver.product.ce@default:default"/>
<setEntry value="io.cloudbeaver.resources.drivers.base@default:default"/>