-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dbeaver/dbeaver vscode#3 remove redundunt plugins (#2891)
* CB-5530 wip * dbeaver-vscode#3 cleanup servlets * dbeaver-vscode#3 endpoint fixes * dbeaver-vscode#3 resolve conflicts * dbeaver-vscode#3 fix conflict * dbeaver-vscode# jetty 12 conflict fixes * dbeaver-vscode#3 servlets filter --------- Co-authored-by: mr-anton-t <[email protected]>
- Loading branch information
1 parent
90acaaf
commit efb42d3
Showing
37 changed files
with
439 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
147 changes: 147 additions & 0 deletions
147
server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/server/BaseGQLPlatform.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* | ||
* 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.server; | ||
|
||
import io.cloudbeaver.DBWConstants; | ||
import org.eclipse.core.runtime.Plugin; | ||
import org.jkiss.code.NotNull; | ||
import org.jkiss.dbeaver.Log; | ||
import org.jkiss.dbeaver.model.DBConstants; | ||
import org.jkiss.dbeaver.model.app.DBACertificateStorage; | ||
import org.jkiss.dbeaver.model.app.DBPWorkspace; | ||
import org.jkiss.dbeaver.model.impl.app.DefaultCertificateStorage; | ||
import org.jkiss.dbeaver.model.qm.QMRegistry; | ||
import org.jkiss.dbeaver.model.qm.QMUtils; | ||
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; | ||
import org.jkiss.dbeaver.registry.BasePlatformImpl; | ||
import org.jkiss.dbeaver.registry.DataSourceProviderRegistry; | ||
import org.jkiss.dbeaver.runtime.SecurityProviderUtils; | ||
import org.jkiss.dbeaver.runtime.qm.QMLogFileWriter; | ||
import org.jkiss.dbeaver.runtime.qm.QMRegistryImpl; | ||
import org.jkiss.dbeaver.utils.ContentUtils; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
public abstract class BaseGQLPlatform extends BasePlatformImpl { | ||
private static final Log log = Log.getLog(BaseGQLPlatform.class); | ||
public static final String WORK_DATA_FOLDER_NAME = ".work-data"; | ||
|
||
private Path tempFolder; | ||
|
||
private QMRegistryImpl queryManager; | ||
private QMLogFileWriter qmLogWriter; | ||
private DBACertificateStorage certificateStorage; | ||
private WebGlobalWorkspace workspace; | ||
|
||
@Override | ||
protected synchronized void initialize() { | ||
// Register BC security provider | ||
SecurityProviderUtils.registerSecurityProvider(); | ||
|
||
// Register properties adapter | ||
this.workspace = new WebGlobalWorkspace(this); | ||
this.workspace.initializeProjects(); | ||
QMUtils.initApplication(this); | ||
|
||
this.queryManager = new QMRegistryImpl(); | ||
|
||
this.qmLogWriter = new QMLogFileWriter(); | ||
this.queryManager.registerMetaListener(qmLogWriter); | ||
|
||
this.certificateStorage = new DefaultCertificateStorage( | ||
WebPlatformActivator.getInstance() | ||
.getStateLocation() | ||
.toFile() | ||
.toPath() | ||
.resolve(DBConstants.CERTIFICATE_STORAGE_FOLDER)); | ||
super.initialize(); | ||
} | ||
|
||
@Override | ||
protected Plugin getProductPlugin() { | ||
return WebPlatformActivator.getInstance(); | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public DBACertificateStorage getCertificateStorage() { | ||
return certificateStorage; | ||
} | ||
|
||
@NotNull | ||
@Override | ||
public DBPWorkspace getWorkspace() { | ||
return workspace; | ||
} | ||
|
||
@NotNull | ||
public Path getTempFolder(@NotNull DBRProgressMonitor monitor, @NotNull String name) { | ||
if (tempFolder == null) { | ||
// Make temp folder | ||
monitor.subTask("Create temp folder"); | ||
tempFolder = workspace.getAbsolutePath().resolve(DBWConstants.WORK_DATA_FOLDER_NAME); | ||
} | ||
if (!Files.exists(tempFolder)) { | ||
try { | ||
Files.createDirectories(tempFolder); | ||
} catch (IOException e) { | ||
log.error("Can't create temp directory " + tempFolder, e); | ||
} | ||
} | ||
Path folder = tempFolder.resolve(name); | ||
if (!Files.exists(folder)) { | ||
try { | ||
Files.createDirectories(folder); | ||
} catch (IOException e) { | ||
log.error("Error creating temp folder '" + folder.toAbsolutePath() + "'", e); | ||
} | ||
} | ||
return folder; | ||
} | ||
|
||
@Override | ||
public synchronized void dispose() { | ||
super.dispose(); | ||
if (this.qmLogWriter != null) { | ||
this.queryManager.unregisterMetaListener(qmLogWriter); | ||
this.qmLogWriter.dispose(); | ||
this.qmLogWriter = null; | ||
} | ||
if (this.queryManager != null) { | ||
this.queryManager.dispose(); | ||
//queryManager = null; | ||
} | ||
DataSourceProviderRegistry.dispose(); | ||
|
||
// Remove temp folder | ||
if (tempFolder != null) { | ||
|
||
if (!ContentUtils.deleteFileRecursive(tempFolder.toFile())) { | ||
log.warn("Can't delete temp folder '" + tempFolder.toAbsolutePath() + "'"); | ||
} | ||
tempFolder = null; | ||
} | ||
} | ||
|
||
@NotNull | ||
public QMRegistry getQueryManager() { | ||
return queryManager; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/AppWebSessionManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* 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.server; | ||
|
||
import io.cloudbeaver.DBWebException; | ||
import io.cloudbeaver.model.session.BaseWebSession; | ||
import io.cloudbeaver.model.session.WebHeadlessSession; | ||
import io.cloudbeaver.model.session.WebSession; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import org.eclipse.jetty.server.Request; | ||
import org.eclipse.jetty.server.Session; | ||
import org.jkiss.code.NotNull; | ||
import org.jkiss.code.Nullable; | ||
import org.jkiss.dbeaver.DBException; | ||
|
||
import java.util.Collection; | ||
|
||
public interface AppWebSessionManager { | ||
BaseWebSession closeSession(@NotNull HttpServletRequest request); | ||
|
||
@NotNull | ||
WebSession getWebSession( | ||
@NotNull HttpServletRequest request, | ||
@NotNull HttpServletResponse response | ||
) throws DBWebException; | ||
|
||
@NotNull | ||
WebSession getWebSession( | ||
@NotNull HttpServletRequest request, | ||
@NotNull HttpServletResponse response, | ||
boolean errorOnNoFound | ||
) throws DBWebException; | ||
|
||
@Nullable | ||
BaseWebSession getSession(@NotNull String sessionId); | ||
|
||
@Nullable | ||
WebSession findWebSession(HttpServletRequest request); | ||
|
||
WebSession findWebSession(HttpServletRequest request, boolean errorOnNoFound) throws DBWebException; | ||
|
||
Collection<BaseWebSession> getAllActiveSessions(); | ||
|
||
WebSession getOrRestoreSession(Request httpRequest); | ||
|
||
WebHeadlessSession getHeadlessSession(Request request, Session session, boolean create) throws DBException; | ||
|
||
boolean touchSession(HttpServletRequest request, HttpServletResponse response) throws DBWebException; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.