Classes rename (CB prefix)

This commit is contained in:
serge-rider
2020-04-29 22:41:22 +03:00
parent c24d6565d0
commit 7f4a47bdcc
28 changed files with 117 additions and 123 deletions
@@ -8,7 +8,7 @@
<extension point="org.eclipse.core.runtime.applications" id="standalone" name="Cloudbeaver Web Application">
<application visible="true">
<run class="io.cloudbeaver.server.CloudbeaverApplication"/>
<run class="io.cloudbeaver.server.CBApplication"/>
</application>
</extension>
@@ -18,7 +18,7 @@ package io.cloudbeaver.model;
import io.cloudbeaver.WebServiceUtils;
import io.cloudbeaver.model.session.WebSession;
import io.cloudbeaver.server.CloudbeaverConstants;
import io.cloudbeaver.server.CBConstants;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.meta.Property;
@@ -90,7 +90,7 @@ public class WebConnectionInfo {
@Property
public String getConnectTime() {
return CloudbeaverConstants.ISO_DATE_FORMAT.format(dataSourceContainer.getConnectTime());
return CBConstants.ISO_DATE_FORMAT.format(dataSourceContainer.getConnectTime());
}
@Property
@@ -17,7 +17,7 @@
package io.cloudbeaver.model;
import io.cloudbeaver.WebAction;
import io.cloudbeaver.server.CloudbeaverPlatform;
import io.cloudbeaver.server.CBPlatform;
import io.cloudbeaver.server.registry.WebServiceDescriptor;
import io.cloudbeaver.server.registry.WebServiceRegistry;
import org.jkiss.dbeaver.model.meta.Property;
@@ -120,7 +120,7 @@ public class WebServerConfig {
@WebAction
public Map<String, Object> getProductConfiguration() {
return CloudbeaverPlatform.getInstance().getApplication().getProductConfiguration();
return CBPlatform.getInstance().getApplication().getProductConfiguration();
}
}
@@ -16,7 +16,7 @@
*/
package io.cloudbeaver.model;
import io.cloudbeaver.server.CloudbeaverConstants;
import io.cloudbeaver.server.CBConstants;
/**
* Web server message
@@ -46,7 +46,7 @@ public class WebServerMessage {
}
public String getTime() {
return CloudbeaverConstants.ISO_DATE_FORMAT.format(time);
return CBConstants.ISO_DATE_FORMAT.format(time);
}
public String getMessage() {
@@ -19,10 +19,9 @@ package io.cloudbeaver.model.session;
import io.cloudbeaver.DBWebException;
import io.cloudbeaver.WebServiceUtils;
import io.cloudbeaver.model.user.WebUser;
import io.cloudbeaver.server.CloudbeaverConstants;
import io.cloudbeaver.server.CloudbeaverPlatform;
import io.cloudbeaver.server.CBPlatform;
import io.cloudbeaver.server.CBConstants;
import io.cloudbeaver.model.*;
import io.cloudbeaver.service.sql.WebSQLProcessor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.jkiss.code.NotNull;
@@ -116,12 +115,12 @@ public class WebSession {
@Property
public String getCreateTime() {
return CloudbeaverConstants.ISO_DATE_FORMAT.format(createTime);
return CBConstants.ISO_DATE_FORMAT.format(createTime);
}
@Property
public String getLastAccessTime() {
return CloudbeaverConstants.ISO_DATE_FORMAT.format(lastAccessTime);
return CBConstants.ISO_DATE_FORMAT.format(lastAccessTime);
}
public long getLastAccessTimeMillis() {
@@ -377,7 +376,7 @@ public class WebSession {
public List<WebDatabaseDriverConfig> getDriverList(@Nullable String driverId) {
List<WebDatabaseDriverConfig> result = new ArrayList<>();
for (DBPDriver driver : CloudbeaverPlatform.getInstance().getApplicableDrivers()) {
for (DBPDriver driver : CBPlatform.getInstance().getApplicableDrivers()) {
if (driverId == null || driverId.equals(WebServiceUtils.makeDriverFullId(driver))) {
result.add(new WebDatabaseDriverConfig(this, driver));
}
@@ -17,7 +17,7 @@
package io.cloudbeaver.model.session;
import io.cloudbeaver.DBWebException;
import io.cloudbeaver.server.CloudbeaverPlatform;
import io.cloudbeaver.server.CBPlatform;
import io.cloudbeaver.model.WebConnectionConfig;
import io.cloudbeaver.model.WebConnectionInfo;
import org.jkiss.code.NotNull;
@@ -140,7 +140,7 @@ public class WebSessionManager {
}
public void expireIdleSessions() {
long maxSessionIdleTime = DBWorkbench.getPlatform(CloudbeaverPlatform.class).getApplication().getMaxSessionIdleTime();
long maxSessionIdleTime = DBWorkbench.getPlatform(CBPlatform.class).getApplication().getMaxSessionIdleTime();
List<WebSession> expiredList = new ArrayList<>();
synchronized (sessionMap) {
@@ -17,7 +17,7 @@
package io.cloudbeaver.server;
import com.google.gson.GsonBuilder;
import io.cloudbeaver.server.jetty.CloudbeaverJettyServer;
import io.cloudbeaver.server.jetty.CBJettyServer;
import org.eclipse.core.runtime.Platform;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.osgi.service.datalocation.Location;
@@ -44,28 +44,28 @@ import java.util.Properties;
/**
* This class controls all aspects of the application's execution
*/
public class CloudbeaverApplication extends BaseApplicationImpl {
public class CBApplication extends BaseApplicationImpl {
private static final Log log = Log.getLog(CloudbeaverApplication.class);
private static final Log log = Log.getLog(CBApplication.class);
public static final String APPLICATION_PLUGIN_ID = "io.cloudbeaver.server";
private int serverPort = CloudbeaverConstants.DEFAULT_SERVER_PORT;
private String serverName = CloudbeaverConstants.DEFAULT_SERVER_NAME;
private String contentRoot = CloudbeaverConstants.DEFAULT_CONTENT_ROOT;
private String rootURI = CloudbeaverConstants.DEFAULT_ROOT_URI;
private String servicesURI = CloudbeaverConstants.DEFAULT_SERVICES_URI;
private int serverPort = CBConstants.DEFAULT_SERVER_PORT;
private String serverName = CBConstants.DEFAULT_SERVER_NAME;
private String contentRoot = CBConstants.DEFAULT_CONTENT_ROOT;
private String rootURI = CBConstants.DEFAULT_ROOT_URI;
private String servicesURI = CBConstants.DEFAULT_SERVICES_URI;
private String workspaceLocation = CloudbeaverConstants.DEFAULT_WORKSPACE_LOCATION;
private String driversLocation = CloudbeaverConstants.DEFAULT_DRIVERS_LOCATION;
private String workspaceLocation = CBConstants.DEFAULT_WORKSPACE_LOCATION;
private String driversLocation = CBConstants.DEFAULT_DRIVERS_LOCATION;
private Map<String, Object> productConfiguration = new HashMap<>();
private long maxSessionIdleTime = CloudbeaverConstants.MAX_SESSION_IDLE_TIME;
private long maxSessionIdleTime = CBConstants.MAX_SESSION_IDLE_TIME;
private boolean develMode = false;
public CloudbeaverApplication() {
public CBApplication() {
}
public int getServerPort() {
@@ -101,8 +101,8 @@ public class CloudbeaverApplication extends BaseApplicationImpl {
*
* @return application or null if application wasn't started or was stopped.
*/
public static CloudbeaverApplication getInstance() {
return (CloudbeaverApplication) BaseApplicationImpl.getInstance();
public static CBApplication getInstance() {
return (CBApplication) BaseApplicationImpl.getInstance();
}
public Map<String, Object> getProductConfiguration() {
@@ -116,11 +116,11 @@ public class CloudbeaverApplication extends BaseApplicationImpl {
@Override
public Object start(IApplicationContext context) {
String configPath = CloudbeaverConstants.DEFAULT_CONFIG_FILE_PATH;
String configPath = CBConstants.DEFAULT_CONFIG_FILE_PATH;
String[] args = Platform.getCommandLineArgs();
for (int i = 0; i < args.length; i++) {
if (args[i].equals(CloudbeaverConstants.CLI_PARAM_WEB_CONFIG) & args.length > i + 1) {
if (args[i].equals(CBConstants.CLI_PARAM_WEB_CONFIG) & args.length > i + 1) {
configPath = args[i + 1];
break;
}
@@ -142,7 +142,7 @@ public class CloudbeaverApplication extends BaseApplicationImpl {
log.debug("Error setting workspace location to " + workspaceLocation, e);
}
CloudbeaverPlatform.setApplication(this);
CBPlatform.setApplication(this);
log.debug(GeneralUtils.getProductName() + " " + GeneralUtils.getProductVersion() + " is starting"); //$NON-NLS-1$
log.debug("\tOS: " + System.getProperty(StandardConstants.ENV_OS_NAME) + " " + System.getProperty(StandardConstants.ENV_OS_VERSION) + " (" + System.getProperty(StandardConstants.ENV_OS_ARCH) + ")");
@@ -192,7 +192,7 @@ public class CloudbeaverApplication extends BaseApplicationImpl {
}
private void parseConfiguration(Properties props) {
String homeFolder = System.getenv(CloudbeaverConstants.ENV_CB_HOME);
String homeFolder = System.getenv(CBConstants.ENV_CB_HOME);
if (CommonUtils.isEmpty(homeFolder)) {
homeFolder = System.getProperty("user.dir");
}
@@ -200,19 +200,19 @@ public class CloudbeaverApplication extends BaseApplicationImpl {
homeFolder = ".";
}
serverPort = CommonUtils.toInt(getConfigParameter(props, CloudbeaverConstants.PARAM_SERVER_PORT, String.valueOf(CloudbeaverConstants.DEFAULT_SERVER_PORT)));
serverName = getConfigParameter(props, CloudbeaverConstants.PARAM_SERVER_NAME, CloudbeaverConstants.DEFAULT_SERVER_NAME);
contentRoot = this.getRelativePath(getConfigParameter(props, CloudbeaverConstants.PARAM_CONTENT_ROOT, CloudbeaverConstants.DEFAULT_CONTENT_ROOT), homeFolder);
rootURI = getConfigParameter(props, CloudbeaverConstants.PARAM_ROOT_URI, CloudbeaverConstants.DEFAULT_ROOT_URI);
servicesURI = getConfigParameter(props, CloudbeaverConstants.PARAM_SERVICES_URI, CloudbeaverConstants.DEFAULT_SERVICES_URI);
driversLocation = this.getRelativePath(getConfigParameter(props, CloudbeaverConstants.PARAM_DRIVERS_LOCATION, CloudbeaverConstants.DEFAULT_DRIVERS_LOCATION), homeFolder);
workspaceLocation = this.getRelativePath(getConfigParameter(props, CloudbeaverConstants.PARAM_WORKSPACE_LOCATION, CloudbeaverConstants.DEFAULT_WORKSPACE_LOCATION), homeFolder);
serverPort = CommonUtils.toInt(getConfigParameter(props, CBConstants.PARAM_SERVER_PORT, String.valueOf(CBConstants.DEFAULT_SERVER_PORT)));
serverName = getConfigParameter(props, CBConstants.PARAM_SERVER_NAME, CBConstants.DEFAULT_SERVER_NAME);
contentRoot = this.getRelativePath(getConfigParameter(props, CBConstants.PARAM_CONTENT_ROOT, CBConstants.DEFAULT_CONTENT_ROOT), homeFolder);
rootURI = getConfigParameter(props, CBConstants.PARAM_ROOT_URI, CBConstants.DEFAULT_ROOT_URI);
servicesURI = getConfigParameter(props, CBConstants.PARAM_SERVICES_URI, CBConstants.DEFAULT_SERVICES_URI);
driversLocation = this.getRelativePath(getConfigParameter(props, CBConstants.PARAM_DRIVERS_LOCATION, CBConstants.DEFAULT_DRIVERS_LOCATION), homeFolder);
workspaceLocation = this.getRelativePath(getConfigParameter(props, CBConstants.PARAM_WORKSPACE_LOCATION, CBConstants.DEFAULT_WORKSPACE_LOCATION), homeFolder);
maxSessionIdleTime = getConfigParameter(props, CloudbeaverConstants.PARAM_SESSION_EXPIRE_PERIOD, CloudbeaverConstants.MAX_SESSION_IDLE_TIME);
maxSessionIdleTime = getConfigParameter(props, CBConstants.PARAM_SESSION_EXPIRE_PERIOD, CBConstants.MAX_SESSION_IDLE_TIME);
develMode = CommonUtils.toBoolean(getConfigParameter(props, CloudbeaverConstants.PARAM_DEVEL_MODE, "false"));
develMode = CommonUtils.toBoolean(getConfigParameter(props, CBConstants.PARAM_DEVEL_MODE, "false"));
String productConfigPath = this.getRelativePath(getConfigParameter(props, CloudbeaverConstants.PARAM_PRODUCT_CONFIGURATION, CloudbeaverConstants.DEFAULT_PRODUCT_CONFIGURATION), homeFolder);
String productConfigPath = this.getRelativePath(getConfigParameter(props, CBConstants.PARAM_PRODUCT_CONFIGURATION, CBConstants.DEFAULT_PRODUCT_CONFIGURATION), homeFolder);
if (!CommonUtils.isEmpty(productConfigPath)) {
File productConfigFile = new File(productConfigPath);
if (!productConfigFile.exists()) {
@@ -258,7 +258,7 @@ public class CloudbeaverApplication extends BaseApplicationImpl {
private void runWebServer() {
log.debug("Starting Jetty server (" + serverPort + ") ");
new CloudbeaverJettyServer().runServer();
new CBJettyServer().runServer();
}
@@ -24,7 +24,7 @@ import java.text.SimpleDateFormat;
/**
* Various constants
*/
public class CloudbeaverConstants {
public class CBConstants {
public static final DateFormat ISO_DATE_FORMAT = new SimpleDateFormat(DBConstants.DEFAULT_ISO_TIMESTAMP_FORMAT);
@@ -56,46 +56,46 @@ import java.util.ArrayList;
import java.util.List;
/**
* CloudbeaverPlatform
* CBPlatform
*/
public class CloudbeaverPlatform extends BasePlatformImpl {
public class CBPlatform extends BasePlatformImpl {
// The plug-in ID
public static final String PLUGIN_ID = "io.cloudbeaver.server"; //$NON-NLS-1$
private static final Log log = Log.getLog(CloudbeaverPlatform.class);
private static final Log log = Log.getLog(CBPlatform.class);
public static final String WORK_DATA_FOLDER_NAME = ".work-data";
static CloudbeaverPlatform instance;
static CBPlatform instance;
@Nullable
private static CloudbeaverApplication application = null;
private static CBApplication application = null;
private File tempFolder;
private QMControllerImpl queryManager;
private QMLogFileWriter qmLogWriter;
private DBACertificateStorage certificateStorage;
private CloudbeaverWorkspace workspace;
private CBWorkspace workspace;
private WebSessionManager sessionManager;
private final List<DBPDriver> applicableDrivers = new ArrayList<>();
public static CloudbeaverPlatform getInstance() {
public static CBPlatform getInstance() {
if (instance == null) {
synchronized (CloudbeaverPlatform.class) {
synchronized (CBPlatform.class) {
if (instance == null) {
// Initialize DBeaver Core
CloudbeaverPlatform.createInstance();
CBPlatform.createInstance();
}
}
}
return instance;
}
private static CloudbeaverPlatform createInstance() {
private static CBPlatform createInstance() {
log.debug("Initializing product: " + GeneralUtils.getProductTitle());
if (Platform.getProduct() != null) {
Bundle definingBundle = Platform.getProduct().getDefiningBundle();
@@ -107,12 +107,12 @@ public class CloudbeaverPlatform extends BasePlatformImpl {
}
try {
instance = new CloudbeaverPlatform();
instance = new CBPlatform();
instance.initialize();
return instance;
} catch (Throwable e) {
log.error("Error initializing CloudbeaverPlatform", e);
throw new IllegalStateException("Error initializing CloudbeaverPlatform", e);
log.error("Error initializing CBPlatform", e);
throw new IllegalStateException("Error initializing CBPlatform", e);
}
}
@@ -120,11 +120,11 @@ public class CloudbeaverPlatform extends BasePlatformImpl {
return WebPlatformActivator.getInstance().getPreferences();
}
private CloudbeaverPlatform() {
private CBPlatform() {
}
public static void setApplication(CloudbeaverApplication application) {
CloudbeaverPlatform.application = application;
public static void setApplication(CBApplication application) {
CBPlatform.application = application;
}
@Override
@@ -136,7 +136,7 @@ public class CloudbeaverPlatform extends BasePlatformImpl {
SecurityProviderUtils.registerSecurityProvider();
// Register properties adapter
this.workspace = new CloudbeaverWorkspace(this, ResourcesPlugin.getWorkspace());
this.workspace = new CBWorkspace(this, ResourcesPlugin.getWorkspace());
this.workspace.initializeProjects();
QMUtils.initApplication(this);
@@ -213,8 +213,8 @@ public class CloudbeaverPlatform extends BasePlatformImpl {
tempFolder = null;
}
CloudbeaverPlatform.application = null;
CloudbeaverPlatform.instance = null;
CBPlatform.application = null;
CBPlatform.instance = null;
System.gc();
log.debug("Shutdown completed in " + (System.currentTimeMillis() - startTime) + "ms");
}
@@ -228,12 +228,12 @@ public class CloudbeaverPlatform extends BasePlatformImpl {
@NotNull
@Override
public DBPResourceHandler getDefaultResourceHandler() {
return CloudbeaverResourceHandler.INSTANCE;
return CBResourceHandler.INSTANCE;
}
@NotNull
@Override
public CloudbeaverApplication getApplication() {
public CBApplication getApplication() {
return application;
}
@@ -308,7 +308,7 @@ public class CloudbeaverPlatform extends BasePlatformImpl {
public WebServerConfig getServerConfig() {
WebServerConfig config = new WebServerConfig(
CloudbeaverApplication.getInstance().getServerName(),
CBApplication.getInstance().getServerName(),
GeneralUtils.getProductVersion().toString()
);
config.setSupportsPredefinedConnections(true);
@@ -21,8 +21,8 @@ import org.jkiss.dbeaver.runtime.ui.console.ConsoleUserInterface;
/**
* The activator class controls the plug-in life cycle
*/
public class CloudbeaverPlatformUI extends ConsoleUserInterface {
public class CBPlatformUI extends ConsoleUserInterface {
public static final CloudbeaverPlatformUI INSTANCE = new CloudbeaverPlatformUI();
public static final CBPlatformUI INSTANCE = new CBPlatformUI();
}
@@ -31,9 +31,9 @@ import java.util.List;
/**
* Default resource handler
*/
public class CloudbeaverResourceHandler implements DBPResourceHandler {
public class CBResourceHandler implements DBPResourceHandler {
public static final CloudbeaverResourceHandler INSTANCE = new CloudbeaverResourceHandler();
public static final CBResourceHandler INSTANCE = new CBResourceHandler();
@Override
public int getFeatures(IResource resource) {
@@ -26,9 +26,9 @@ import org.jkiss.dbeaver.registry.BaseWorkspaceImpl;
*
* Basically just a wrapper around Eclipse workspace.
*/
public class CloudbeaverWorkspace extends BaseWorkspaceImpl {
public class CBWorkspace extends BaseWorkspaceImpl {
public CloudbeaverWorkspace(DBPPlatform platform, IWorkspace eclipseWorkspace) {
public CBWorkspace(DBPPlatform platform, IWorkspace eclipseWorkspace) {
super(platform, eclipseWorkspace);
}
@@ -97,8 +97,8 @@ public class WebPlatformActivator extends Plugin {
private void shutdownPlatform() {
try {
// Dispose core
if (CloudbeaverPlatform.instance != null) {
CloudbeaverPlatform.instance.dispose();
if (CBPlatform.instance != null) {
CBPlatform.instance.dispose();
}
} catch (Throwable e) {
e.printStackTrace();
@@ -31,9 +31,9 @@ public class WebPlatformAdapterFactory implements IAdapterFactory {
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
if (adaptableObject instanceof DBWorkbench) {
if (adapterType == DBPPlatform.class) {
return adapterType.cast(CloudbeaverPlatform.getInstance());
return adapterType.cast(CBPlatform.getInstance());
} else if (adapterType == DBPPlatformUI.class) {
return adapterType.cast(CloudbeaverPlatformUI.INSTANCE);
return adapterType.cast(CBPlatformUI.INSTANCE);
}
}
return null;
@@ -27,9 +27,9 @@ import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
class WebSessionMonitorJob extends AbstractJob {
private static final int MONITOR_INTERVAL = 10000; // once per 10 seconds
private final CloudbeaverPlatform platform;
private final CBPlatform platform;
WebSessionMonitorJob(CloudbeaverPlatform platform) {
WebSessionMonitorJob(CBPlatform platform) {
super("Web session monitor");
setUser(false);
setSystem(true);
@@ -5,21 +5,18 @@ import graphql.schema.DataFetchingEnvironment;
import graphql.schema.idl.RuntimeWiring;
import graphql.schema.idl.TypeRuntimeWiring;
import io.cloudbeaver.DBWebException;
import io.cloudbeaver.server.CBPlatform;
import io.cloudbeaver.service.DBWBindingContext;
import io.cloudbeaver.service.DBWServiceBinding;
import io.cloudbeaver.service.DBWServiceBindingGraphQL;
import io.cloudbeaver.DBWUtils;
import io.cloudbeaver.server.CloudbeaverPlatform;
import io.cloudbeaver.model.session.WebSessionManager;
import io.cloudbeaver.service.sql.WebSQLDataFilter;
import io.cloudbeaver.server.registry.WebServiceDescriptor;
import io.cloudbeaver.server.registry.WebServiceRegistry;
import io.cloudbeaver.service.sql.WebServiceBindingSQL;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.runtime.DBWorkbench;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
class GraphQLBindingContext implements DBWBindingContext {
@@ -34,8 +31,8 @@ class GraphQLBindingContext implements DBWBindingContext {
}
@Override
public CloudbeaverPlatform getPlatform() {
return DBWorkbench.getPlatform(CloudbeaverPlatform.class);
public CBPlatform getPlatform() {
return DBWorkbench.getPlatform(CBPlatform.class);
}
@Override
@@ -60,7 +57,7 @@ class GraphQLBindingContext implements DBWBindingContext {
RuntimeWiring buildRuntimeWiring() {
CloudbeaverPlatform webServiceMain = getPlatform();
CBPlatform webServiceMain = getPlatform();
sessionManager = webServiceMain.getSessionManager();
runtimeWiring = RuntimeWiring.newRuntimeWiring();
@@ -32,7 +32,7 @@ import graphql.schema.idl.SchemaParser;
import graphql.schema.idl.TypeDefinitionRegistry;
import io.cloudbeaver.DBWebException;
import io.cloudbeaver.WebServiceUtils;
import io.cloudbeaver.server.CloudbeaverApplication;
import io.cloudbeaver.server.CBApplication;
import io.cloudbeaver.server.registry.WebServiceRegistry;
import io.cloudbeaver.service.DBWServiceBindingGraphQL;
import org.jkiss.dbeaver.Log;
@@ -52,7 +52,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
public class GraphQLEndpoint extends HttpServlet {
@@ -119,7 +118,7 @@ public class GraphQLEndpoint extends HttpServlet {
}
private void setDevelHeaders(HttpServletRequest request, HttpServletResponse response) {
if (CloudbeaverApplication.getInstance().isDevelMode()) {
if (CBApplication.getInstance().isDevelMode()) {
// response.setHeader(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN, "*");
// response.setHeader(HEADER_ACCESS_CONTROL_ALLOW_HEADERS, "*");
// response.setHeader(HEADER_ACCESS_CONTROL_ALLOW_CREDENTIALS, "*");
@@ -200,7 +199,7 @@ public class GraphQLEndpoint extends HttpServlet {
if (path == null) {
path = request.getServletPath();
}
boolean develMode = CloudbeaverApplication.getInstance().isDevelMode();
boolean develMode = CBApplication.getInstance().isDevelMode();
if (path.contentEquals("/schema.json") && develMode) {
executeQuery(request, response, GraphQLConstants.SCHEMA_READ_QUERY, null, null);
@@ -14,11 +14,11 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
public class CloudbeaverImageServlet extends HttpServlet {
public class CBImageServlet extends HttpServlet {
private static final Log log = Log.getLog(CloudbeaverImageServlet.class);
private static final Log log = Log.getLog(CBImageServlet.class);
public CloudbeaverImageServlet() {
public CBImageServlet() {
}
@@ -1,7 +1,7 @@
package io.cloudbeaver.server.jetty;
import io.cloudbeaver.service.DBWServiceBindingServlet;
import io.cloudbeaver.server.CloudbeaverApplication;
import io.cloudbeaver.server.CBApplication;
import io.cloudbeaver.server.graphql.GraphQLEndpoint;
import io.cloudbeaver.server.registry.WebServiceRegistry;
import org.eclipse.jetty.server.ConnectionFactory;
@@ -22,16 +22,16 @@ import org.jkiss.dbeaver.utils.GeneralUtils;
import java.io.File;
import java.util.Arrays;
public class CloudbeaverJettyServer {
public class CBJettyServer {
private static final Log log = Log.getLog(CloudbeaverJettyServer.class);
private static final Log log = Log.getLog(CBJettyServer.class);
private static final String SESSION_CACHE_DIR = ".http-sessions";
public CloudbeaverJettyServer() {
public CBJettyServer() {
}
public void runServer() {
CloudbeaverApplication application = CloudbeaverApplication.getInstance();
CBApplication application = CBApplication.getInstance();
try {
Server server = new Server(application.getServerPort());
@@ -40,10 +40,10 @@ public class CloudbeaverJettyServer {
ServletContextHandler servletContextHandler = new ServletContextHandler(ServletContextHandler.SESSIONS);
servletContextHandler.setResourceBase(application.getContentRoot());
servletContextHandler.setContextPath(application.getRootURI());
servletContextHandler.addServlet(new ServletHolder("static", new CloudbeaverStaticServlet()), application.getRootURI());
servletContextHandler.addServlet(new ServletHolder("images", new CloudbeaverImageServlet()), application.getServicesURI() + "images/*");
servletContextHandler.addServlet(new ServletHolder("static", new CBStaticServlet()), application.getRootURI());
servletContextHandler.addServlet(new ServletHolder("images", new CBImageServlet()), application.getServicesURI() + "images/*");
servletContextHandler.addServlet(new ServletHolder("graphql", new GraphQLEndpoint()), application.getServicesURI() + "gql/*");
servletContextHandler.addEventListener(new CloudbeaverServerContextListener());
servletContextHandler.addEventListener(new CBServerContextListener());
// Add extensions from services
for (DBWServiceBindingServlet wsd : WebServiceRegistry.getInstance().getWebServices(DBWServiceBindingServlet.class)) {
@@ -16,13 +16,13 @@
*/
package io.cloudbeaver.server.jetty;
import io.cloudbeaver.server.CloudbeaverApplication;
import io.cloudbeaver.server.CBApplication;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.SessionCookieConfig;
public class CloudbeaverServerContextListener implements ServletContextListener {
public class CBServerContextListener implements ServletContextListener {
public static final String DBEAVER_SESSION_COOKIE_NAME = "DBEAVER_SESSION_ID";
@@ -33,7 +33,7 @@ public class CloudbeaverServerContextListener implements ServletContextListener
//scf.setDomain(domain);
//scf.setHttpOnly(httpOnly);
//scf.setMaxAge(maxAge);
scf.setPath(CloudbeaverApplication.getInstance().getRootURI());
scf.setPath(CBApplication.getInstance().getRootURI());
//scf.setSecure(isSecure);
scf.setName(DBEAVER_SESSION_COOKIE_NAME);
}
@@ -6,9 +6,9 @@ import org.eclipse.jetty.servlet.DefaultServlet;
import javax.servlet.annotation.WebServlet;
@WebServlet(urlPatterns = "/")
public class CloudbeaverStaticServlet extends DefaultServlet {
public class CBStaticServlet extends DefaultServlet {
public CloudbeaverStaticServlet() {
public CBStaticServlet() {
// super(makeResourceService());
super();
}
@@ -27,7 +27,7 @@ import java.util.Map;
/**
* The activator class controls the plug-in life cycle
*/
public class CloudbeaverLauncher {
public class CBLauncher {
public static DBPPlatform instantiatePlatform() throws Exception {
Map<String, String> props = new HashMap<>();
@@ -18,7 +18,7 @@ package io.cloudbeaver.service;
import graphql.schema.idl.RuntimeWiring;
import graphql.schema.idl.TypeRuntimeWiring;
import io.cloudbeaver.server.CloudbeaverPlatform;
import io.cloudbeaver.server.CBPlatform;
import io.cloudbeaver.model.session.WebSessionManager;
/**
@@ -26,7 +26,7 @@ import io.cloudbeaver.model.session.WebSessionManager;
*/
public interface DBWBindingContext {
CloudbeaverPlatform getPlatform();
CBPlatform getPlatform();
WebSessionManager getSessionManager();
@@ -16,8 +16,7 @@
*/
package io.cloudbeaver.service;
import io.cloudbeaver.server.CloudbeaverApplication;
import io.cloudbeaver.service.DBWServiceBinding;
import io.cloudbeaver.server.CBApplication;
import org.eclipse.jetty.servlet.ServletContextHandler;
/**
@@ -25,5 +24,5 @@ import org.eclipse.jetty.servlet.ServletContextHandler;
*/
public interface DBWServiceBindingServlet extends DBWServiceBinding {
void addServlets(CloudbeaverApplication application, ServletContextHandler servletContextHandler);
void addServlets(CBApplication application, ServletContextHandler servletContextHandler);
}
@@ -16,7 +16,7 @@
*/
package io.cloudbeaver.service.sql;
import io.cloudbeaver.server.CloudbeaverConstants;
import io.cloudbeaver.server.CBConstants;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.data.*;
import org.jkiss.dbeaver.model.exec.DBCException;
@@ -39,7 +39,7 @@ public class WebSQLUtils {
public static Object makeWebCellValue(DBRProgressMonitor monitor, DBSTypedObject type, Object cellValue) throws DBCException {
if (cellValue instanceof Date) {
return CloudbeaverConstants.ISO_DATE_FORMAT.format(cellValue);
return CBConstants.ISO_DATE_FORMAT.format(cellValue);
}
if (cellValue instanceof DBDValue) {
DBDValue dbValue = (DBDValue) cellValue;
@@ -16,7 +16,7 @@
*/
package io.cloudbeaver.service.data.transfer;
import io.cloudbeaver.server.CloudbeaverApplication;
import io.cloudbeaver.server.CBApplication;
import io.cloudbeaver.service.DBWBindingContext;
import io.cloudbeaver.service.DBWServiceBindingServlet;
import io.cloudbeaver.service.WebServiceBindingBase;
@@ -61,7 +61,7 @@ public class WebServiceBindingDataTransfer extends WebServiceBindingBase<DBWServ
}
@Override
public void addServlets(CloudbeaverApplication application, ServletContextHandler servletContextHandler) {
public void addServlets(CBApplication application, ServletContextHandler servletContextHandler) {
servletContextHandler.addServlet(
new ServletHolder("dataTransfer", new WebDataTransferServlet(application, getServiceImpl())),
application.getServicesURI() + "data/*");
@@ -1,8 +1,8 @@
package io.cloudbeaver.service.data.transfer.impl;
import io.cloudbeaver.DBWebException;
import io.cloudbeaver.server.CloudbeaverApplication;
import io.cloudbeaver.server.CloudbeaverPlatform;
import io.cloudbeaver.server.CBPlatform;
import io.cloudbeaver.server.CBApplication;
import io.cloudbeaver.model.session.WebSession;
import io.cloudbeaver.service.data.transfer.DBWServiceDataTransfer;
import org.jkiss.dbeaver.Log;
@@ -24,10 +24,10 @@ public class WebDataTransferServlet extends HttpServlet {
private static final Log log = Log.getLog(WebDataTransferServlet.class);
private final CloudbeaverApplication application;
private final CBApplication application;
private final DBWServiceDataTransfer dtManager;
public WebDataTransferServlet(CloudbeaverApplication application, DBWServiceDataTransfer dtManager) {
public WebDataTransferServlet(CBApplication application, DBWServiceDataTransfer dtManager) {
this.application = application;
this.dtManager = dtManager;
}
@@ -40,7 +40,7 @@ public class WebDataTransferServlet extends HttpServlet {
}
try {
WebSession webSession = CloudbeaverPlatform.getInstance().getSessionManager().tryGetWebSession(request.getSession());
WebSession webSession = CBPlatform.getInstance().getSessionManager().tryGetWebSession(request.getSession());
if (webSession == null) {
throw new DBWebException("No active session");
}
@@ -17,7 +17,7 @@
package io.cloudbeaver.service.data.transfer.impl;
import io.cloudbeaver.DBWebException;
import io.cloudbeaver.server.CloudbeaverPlatform;
import io.cloudbeaver.server.CBPlatform;
import io.cloudbeaver.model.WebAsyncTaskInfo;
import io.cloudbeaver.model.session.WebSession;
import io.cloudbeaver.service.sql.WebSQLContextInfo;
@@ -60,7 +60,7 @@ public class WebServiceDataTransfer implements DBWServiceDataTransfer {
private final File dataExportFolder;
public WebServiceDataTransfer() {
dataExportFolder = CloudbeaverPlatform.getInstance().getTempFolder(new VoidProgressMonitor(), "data-transfer");
dataExportFolder = CBPlatform.getInstance().getTempFolder(new VoidProgressMonitor(), "data-transfer");
ContentUtils.deleteFileRecursive(dataExportFolder);
if (!dataExportFolder.mkdirs()) {