CB-1922 Resource manager API - workspace API refactoring

This commit is contained in:
serge-rider
2022-04-21 18:44:27 +03:00
parent 74661503ec
commit 2780ccfd39
4 changed files with 24 additions and 34 deletions
@@ -16,10 +16,17 @@
*/
package io.cloudbeaver.model.app;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.Platform;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.app.DBPPlatform;
import org.jkiss.dbeaver.model.app.DBPWorkspace;
import org.jkiss.dbeaver.model.auth.SMCredentialsProvider;
import org.jkiss.dbeaver.model.rm.RMController;
import org.jkiss.dbeaver.registry.BaseApplicationImpl;
import org.jkiss.dbeaver.registry.EclipseWorkspaceImpl;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -27,7 +34,7 @@ import java.nio.file.Path;
/**
* Web application
*/
public abstract class BaseWebApplication extends BaseApplicationImpl {
public abstract class BaseWebApplication extends BaseApplicationImpl implements WebApplication {
public static final String DEFAULT_CONFIG_FILE_PATH = "/etc/cloudbeaver.conf";
public static final String CLI_PARAM_WEB_CONFIG = "-web-config";
@@ -35,6 +42,12 @@ public abstract class BaseWebApplication extends BaseApplicationImpl {
private static final Log log = Log.getLog(BaseWebApplication.class);
@NotNull
@Override
public DBPWorkspace createWorkspace(@NotNull DBPPlatform platform, @NotNull IWorkspace eclipseWorkspace) {
return new EclipseWorkspaceImpl(platform, eclipseWorkspace);
}
@Nullable
protected Path loadServerConfiguration() {
String configPath = DEFAULT_CONFIG_FILE_PATH;
@@ -76,4 +89,9 @@ public abstract class BaseWebApplication extends BaseApplicationImpl {
protected abstract void loadConfiguration(String configPath);
@Override
public RMController getResourceController(@NotNull SMCredentialsProvider credentialsProvider) {
throw new IllegalStateException("Not implemented");
}
}
@@ -21,6 +21,7 @@ import io.cloudbeaver.model.user.WebUser;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.app.DBPApplication;
import org.jkiss.dbeaver.model.auth.SMCredentialsProvider;
import org.jkiss.dbeaver.model.rm.RMController;
import org.jkiss.dbeaver.model.security.SMAdminController;
import org.jkiss.dbeaver.model.security.SMController;
@@ -43,4 +44,7 @@ public interface WebApplication extends DBPApplication {
SMController<WebUser, WebRole> getSecurityController(@NotNull SMCredentialsProvider credentialsProvider);
SMAdminController<WebUser, WebRole> getAdminSecurityController(@NotNull SMCredentialsProvider credentialsProvider);
RMController getResourceController(@NotNull SMCredentialsProvider credentialsProvider);
}
@@ -1,31 +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.model.resources;
import io.cloudbeaver.server.CBWorkspace;
import org.jkiss.dbeaver.model.auth.SMSessionContext;
import org.jkiss.dbeaver.registry.ProjectMetadata;
/**
* Web workspace
*/
public class WebProject extends ProjectMetadata {
public WebProject(CBWorkspace workspace, SMSessionContext authContext) {
super(workspace, workspace.getEclipseWorkspace().getRoot().getProject(), authContext);
}
}
@@ -23,7 +23,6 @@ import com.google.gson.stream.JsonWriter;
import io.cloudbeaver.WebServiceUtils;
import io.cloudbeaver.auth.provider.AuthProviderConfig;
import io.cloudbeaver.model.app.BaseWebApplication;
import io.cloudbeaver.model.app.WebApplication;
import io.cloudbeaver.model.session.WebAuthInfo;
import io.cloudbeaver.model.user.WebRole;
import io.cloudbeaver.model.user.WebUser;
@@ -80,7 +79,7 @@ import java.util.stream.Stream;
/**
* This class controls all aspects of the application's execution
*/
public class CBApplication extends BaseWebApplication implements WebApplication {
public class CBApplication extends BaseWebApplication {
private static final Log log = Log.getLog(CBApplication.class);