Compare commits

..
2 Commits
Author SHA1 Message Date
Ainur a7ed44ad8e Cb 3470 hotfix (#1781)
* CB-3470 sql query fix
2023-06-22 16:24:41 +03:00
Ainur 7419629423 CB-3470 fix sql query for auth subject (#1776) 2023-06-22 13:08:35 +03:00
4242 changed files with 71327 additions and 117077 deletions
-56
View File
@@ -1,56 +0,0 @@
name: Backend Build
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows you to reuse workflows by referencing their YAML files
workflow_call:
jobs:
build-backend:
name: Backend
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
cache: maven
- uses: stCarolas/setup-maven@v5
with:
maven-version: 3.9.0
- name: Give permissions
run: |
sudo chmod 777 ../
shell: bash
- name: Determine branches
id: determine-branch
run: |
echo "pr_branch=${{ github.head_ref }}" >> $GITHUB_ENV
echo "base_branch=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
- name: Clone dbeaver/dbeaver
id: clone-repo
run: |
git clone -b ${{ env.pr_branch }} https://github.com/dbeaver/dbeaver.git ../dbeaver || git clone -b ${{ env.base_branch }} https://github.com/dbeaver/dbeaver.git ../dbeaver
- name: Run build script
run: ./build-backend.sh
shell: bash
working-directory: ./deploy
- name: Archive build artifacts
uses: actions/upload-artifact@v4
with:
name: backend-build-artifacts
path: deploy/cloudbeaver
if-no-files-found: error
-40
View File
@@ -1,40 +0,0 @@
name: Backend Lint
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows you to reuse workflows by referencing their YAML files
workflow_call:
inputs:
skip_cache:
required: false
type: string
jobs:
lint:
name: Backend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout checkstyle config repository
uses: actions/checkout@v4
with:
repository: dbeaver/dbeaver
path: dbeaver-config
- name: Copy checkstyle config
run: cp dbeaver-config/dbeaver-checkstyle-config.xml ./dbeaver-checkstyle-config.xml
- name: Remove checkstyle config directory
run: rm -rf dbeaver-config
- uses: dbelyaev/action-checkstyle@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
filter_mode: diff_context
checkstyle_config: ./dbeaver-checkstyle-config.xml
fail_on_error: true
@@ -0,0 +1,17 @@
name: "Commit Message Validation"
on:
pull_request:
branches:
- devel
types:
- opened
- synchronize
- reopened
- edited
- ready_for_review
- labeled
jobs:
validate-commit-message:
uses: dbeaver/dbeaver/.github/workflows/reused-commit-msgs-validator.yml@devel
-57
View File
@@ -1,57 +0,0 @@
name: Cleanup checks
on:
pull_request:
types: [closed]
jobs:
delete-caches:
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
# delete-docker-image:
# name: Delete Docker Image
# if: github.event.pull_request.merged == true
# runs-on: ubuntu-latest
# steps:
# - name: Check out the repository
# uses: actions/checkout@v4
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Determine Docker Image Tag
# run: |
# REPO_NAME=$(basename ${{ github.repository }})
# IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/$REPO_NAME
# BRANCH_NAME=${{ github.event.pull_request.head.ref }}
# TAG_NAME=$(echo $BRANCH_NAME | sed 's/[^a-zA-Z0-9._-]/-/g')
# echo "image=$IMAGE_NAME:$TAG_NAME" >> $GITHUB_ENV
# - name: Log in to GitHub Container Registry
# run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
# - name: Delete Docker Image
# run: |
# docker rmi ${{ env.image }}
# echo "Deleted image: ${{ env.image }}"
-56
View File
@@ -1,56 +0,0 @@
name: Check
on:
push:
branches:
- devel
pull_request:
branches:
- devel
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
skip_cache:
description: "Skip cache restoration"
required: false
default: "false"
jobs:
call-backend-build:
name: Build
uses: ./.github/workflows/backend-build.yml
call-frontend-build:
name: Build
uses: ./.github/workflows/frontend-build.yml
with:
skip_cache: ${{ github.event.inputs.skip_cache }}
call-frontend-lint:
name: Lint
needs: call-frontend-build
uses: ./.github/workflows/frontend-lint.yml
call-backend-lint:
name: Lint
uses: ./.github/workflows/backend-lint.yml
# call-frontend-tests:
# name: Frontend Unit Tests
# needs: call-frontend-build
# runs-on: ubuntu-latest
# steps:
# - name: Check if tests passed
# if: ${{ needs.call-frontend-build.outputs.test-status != 'success' }}
# run: |
# echo "Tests failed"
# exit 1
# - name: Continue if tests passed
# if: ${{ needs.call-frontend-build.outputs.test-status == 'success' }}
# run: echo "Tests passed"
# call-docker-build-and-push:
# name: Run
# needs: [call-backend-build, call-frontend-build]
# uses: ./.github/workflows/docker-build-and-push.yml
@@ -1,93 +0,0 @@
name: Build and Push Docker Image
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows you to reuse workflows by referencing their YAML files
workflow_call:
jobs:
build-and-push-docker:
name: Build and Push Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download backend artifacts
uses: actions/download-artifact@v4
with:
name: backend-build-artifacts
path: deploy/cloudbeaver/
- name: Download frontend artifacts
uses: actions/download-artifact@v4
with:
name: frontend-build-artifacts
path: deploy/cloudbeaver/web
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run custom Docker build script
run: ./make-docker-container.sh
shell: bash
working-directory: ./deploy/docker
- name: Tag Docker Image
run: |
REPO_NAME=$(basename ${{ github.repository }})
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/$REPO_NAME
BRANCH_NAME=${{ github.head_ref || github.ref_name }}
TAG_NAME=$(echo $BRANCH_NAME | sed 's/[^a-zA-Z0-9._-]/-/g')
docker tag dbeaver/cloudbeaver:dev $IMAGE_NAME:$TAG_NAME
echo "image=$IMAGE_NAME:$TAG_NAME" >> $GITHUB_ENV
# - name: Install Docker Credential Helper
# run: |
# sudo apt-get update
# sudo apt-get install -y gnupg2 pass
# curl -fsSL https://github.com/docker/docker-credential-helpers/releases/download/v0.6.4/docker-credential-pass-v0.6.4-amd64.tar.gz -o docker-credential-pass.tar.gz
# tar xzvf docker-credential-pass.tar.gz
# sudo mv docker-credential-pass /usr/local/bin/docker-credential-pass
# sudo chmod +x /usr/local/bin/docker-credential-pass
# - name: Configure Docker to use Credential Helper
# run: |
# mkdir -p ~/.docker
# echo '{"credsStore":"pass"}' > ~/.docker/config.json
# - name: Initialize Password Store
# run: |
# gpg --batch --gen-key <<EOF
# %no-protection
# Key-Type: default
# Subkey-Type: default
# Name-Real: Docker Credential Helper
# Expire-Date: 0
# %commit
# EOF
# pass init "$(gpg --list-keys --with-colons | grep '^pub' | cut -d: -f5)"
- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
- name: Push Docker Image
run: docker push ${{ env.image }}
# - name: Comment on Pull Request
# if: github.event_name == 'pull_request'
# uses: actions/github-script@v6
# with:
# github-token: ${{ secrets.PAT }}
# script: |
# const tag = process.env.TAG_NAME;
# const commentBody = `The Docker image has been built and pushed to Docker Hub.\n\nYou can pull the image using the following command:\n\`\`\`\ndocker pull dbeaver/cloudbeaver:${tag}\n\`\`\``;
# github.rest.issues.createComment({
# owner: context.repo.owner,
# repo: context.repo.repo,
# issue_number: context.issue.number,
# body: commentBody
# });
-91
View File
@@ -1,91 +0,0 @@
name: Frontend Build
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows you to reuse workflows by referencing their YAML files
workflow_call:
outputs:
build-status:
description: "Build status"
value: ${{ jobs.frontend-build.outputs.build-status }}
test-status:
description: "Test status"
value: ${{ jobs.frontend-build.outputs.test-status }}
inputs:
skip_cache:
required: false
type: string
jobs:
frontend-build:
name: Frontend
runs-on: ubuntu-latest
outputs:
build-status: ${{ steps.build.outcome }}
test-status: ${{ steps.test.outcome }}
defaults:
run:
working-directory: ./webapp
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: yarn
cache-dependency-path: webapp/yarn.lock
- name: restore node_modules
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-node_modules-${{ hashFiles('webapp/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: restore typescript cache
uses: actions/cache@v4
with:
path: "**/packages/*/dist"
key: ${{ runner.os }}-dist-${{ hashFiles('webapp/yarn.lock') }}
restore-keys: |
${{ runner.os }}-dist-
- name: yarn clean
if: env.skip_cache == 'true'
uses: borales/actions-yarn@v5
with:
dir: webapp
cmd: clean
- name: yarn install --frozen-lockfile
uses: borales/actions-yarn@v5
with:
dir: webapp
cmd: install
- name: build
id: build
uses: borales/actions-yarn@v5
with:
dir: webapp/packages/product-default
cmd: bundle
- name: test
id: test
uses: borales/actions-yarn@v5
with:
dir: webapp
cmd: test
- name: Archive build artifacts
uses: actions/upload-artifact@v4
with:
name: frontend-build-artifacts
path: webapp/packages/product-default/lib
if-no-files-found: error
-45
View File
@@ -1,45 +0,0 @@
name: Frontend Lint
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows you to reuse workflows by referencing their YAML files
workflow_call:
jobs:
lint:
name: Frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: yarn
cache-dependency-path: webapp/yarn.lock
- name: restore node_modules
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-node_modules-${{ hashFiles('webapp/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: yarn install --frozen-lockfile
uses: borales/actions-yarn@v5
with:
dir: webapp
cmd: install
- name: Lint
uses: reviewdog/action-eslint@v1
with:
reporter: github-pr-review
filter_mode: file
workdir: webapp
fail_on_error: true
eslint_flags: "--ext .ts,.tsx"
+32
View File
@@ -0,0 +1,32 @@
name: Run Jest Tests
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "devel" branch
pull_request:
branches: [ "devel" ]
paths:
- 'webapp/**' # monitor for the frontend changes
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
run-jest-tests:
# The type of runner that the job will run on
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./webapp
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- run: npm install yarn -g
- run: yarn
- run: yarn lerna bootstrap
- run: yarn lerna run test
+1 -5
View File
@@ -26,7 +26,7 @@ dist/
*.iml
/idea/
.idea/
## Mac OS
.DS_Store
@@ -40,10 +40,6 @@ server/test/io.cloudbeaver.test.platform/workspace/.data/
.classpath
.settings/
## Eclipse PDE
*.product.launch
workspace-dev-ce/
deploy/cloudbeaver
server/**/target
apps/**/target
+2 -2
View File
@@ -15,10 +15,10 @@
"streetsidesoftware.code-spell-checker",
"streetsidesoftware.code-spell-checker-russian",
"syler.sass-indented",
"VisualStudioExptTeam.intellicode-api-usage-examples",
"VisualStudioExptTeam.vscodeintellicode",
"yzhang.markdown-all-in-one",
"GraphQL.vscode-graphql-syntax",
"mrmlnc.vscode-json5",
"esbenp.prettier-vscode"
"mrmlnc.vscode-json5"
]
}
+70 -61
View File
@@ -4,73 +4,82 @@
{
"type": "chrome",
"request": "launch",
"name": "CloudBeaver CE",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}/..",
"outFiles": [
"${workspaceFolder}/../cloudbeaver/packages/**/dist/**/*.{js,jsx}"
],
"smartStep": true,
"sourceMaps": true,
"disableNetworkCache": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"]
"name": "Debug CE",
"url": "http://127.0.0.1:3100",
"webRoot": "${workspaceFolder}/webapp/packages/product-default"
},
{
"type": "java",
"name": "CloudBeaver CE Server",
"name": "CloudBeaver CE",
"cwd": "${workspaceFolder}/../opt/cbce",
"request": "launch",
"mainClass": "org.jkiss.dbeaver.launcher.DBeaverLauncher",
"args": [
"-product",
"io.cloudbeaver.product.ce.product",
"-configuration",
"file:${workspaceFolder}/../dbeaver-workspace/products/CloudbeaverServer.product/",
"-dev",
"file:${workspaceFolder}/../dbeaver-workspace/products/CloudbeaverServer.product/dev.properties",
"-nl",
"en",
"-web-config",
"conf/cloudbeaver.conf",
"-registryMultiLanguage"
"mainClass": "org.eclipse.equinox.launcher.Main",
"classPaths": [
"${env:DBEAVER_DEVEL_ECLIPSE_PATH}/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar"
],
// "windows": {
// "args": ["-os", "win32", "-ws", "win32", "-arch", "x86_64"]
// },
// "osx": {
// "args": ["-os", "macosx", "-ws", "cocoa", "-arch", "aarch64"]
// },
"vmArgs": [
"-XX:+IgnoreUnrecognizedVMOptions",
"-Xms64m",
"-Xmx1024m",
"-Declipse.pde.launch=true",
"-XstartOnFirstThread",
"-Dfile.encoding=UTF-8",
"--add-modules=ALL-SYSTEM",
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens=java.base/java.net=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/java.nio.charset=ALL-UNNAMED",
"--add-opens=java.base/java.text=ALL-UNNAMED",
"--add-opens=java.base/java.time=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED",
"--add-opens=java.base/jdk.internal.vm=ALL-UNNAMED",
"--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.base/sun.security.ssl=ALL-UNNAMED",
"--add-opens=java.base/sun.security.action=ALL-UNNAMED",
"--add-opens=java.base/sun.security.util=ALL-UNNAMED",
"--add-opens=java.security.jgss/sun.security.jgss=ALL-UNNAMED",
"--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED",
"--add-opens=java.sql/java.sql=ALL-UNNAMED"
]
"windows": {
"type": "java",
"name": "CloudBeaver CE",
"request": "launch",
"mainClass": "org.eclipse.equinox.launcher.Main",
"args": [
"-product",
"io.cloudbeaver.product.ce.product",
"-configuration",
"file:${env:DBEAVER_DEVEL_ECLIPSE_WORKSPACE_PATH}/.metadata/.plugins/org.eclipse.pde.core/CloudbeaverServer.product/",
"-dev",
"file:${env:DBEAVER_DEVEL_ECLIPSE_WORKSPACE_PATH}/.metadata/.plugins/org.eclipse.pde.core/CloudbeaverServer.product/dev.properties",
"-os",
"win32",
"-ws",
"win32",
"-arch",
"x86_64",
"-nl",
"en",
"-showsplash",
"-web-config",
"conf/cloudbeaver.conf"
],
"vmArgs": [
"-XX:+IgnoreUnrecognizedVMOptions",
"--add-modules=ALL-SYSTEM",
"-Xms64m",
"-Xmx1024m",
"-Declipse.pde.launch=true"
]
},
"osx": {
"type": "java",
"name": "CloudBeaver CE",
"request": "launch",
"mainClass": "org.eclipse.equinox.launcher.Main",
"args": [
"-product",
"io.cloudbeaver.product.ce.product",
"-configuration",
"file:${env:DBEAVER_DEVEL_ECLIPSE_WORKSPACE_PATH}/.metadata/.plugins/org.eclipse.pde.core/CloudbeaverServer.product/",
"-dev",
"file:${env:DBEAVER_DEVEL_ECLIPSE_WORKSPACE_PATH}/.metadata/.plugins/org.eclipse.pde.core/CloudbeaverServer.product/dev.properties",
"-os",
"macosx",
"-ws",
"cocoa",
"-arch",
"aarch64",
"-nl",
"en_US",
"-showsplash"
],
"vmArgs": [
"-XX:+IgnoreUnrecognizedVMOptions",
"--add-modules=ALL-SYSTEM",
"-Xms64m",
"-Xmx1024m",
"-Declipse.pde.launch=true",
"-XstartOnFirstThread"
]
}
}
]
}
+5 -3
View File
@@ -1,15 +1,17 @@
{
"license": {
"scope": "typescript,typescriptreact,javascript,javascriptreact,css,scss",
"scope": "typescript,typescriptreact,javascript,javascriptreact",
"prefix": "license",
"body": [
"/*",
" * CloudBeaver - Cloud Database Manager",
" * Copyright (C) 2020-2024 DBeaver Corp and others",
" * Copyright (C) 2020-2023 DBeaver Corp and others",
" *",
" * Licensed under the Apache License, Version 2.0.",
" * you may not use this file except in compliance with the License.",
" */"
" */",
"",
""
]
}
}
+1 -2
View File
@@ -1,7 +1,6 @@
{
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.linkedEditing": true,
"task.autoDetect": "off",
@@ -9,7 +8,6 @@
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx16G -Xms100m -Xlog:disable",
"java.compile.nullAnalysis.mode": "automatic",
"typescript.preferences.useAliasesForRenames": false,
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.preferences.includePackageJsonAutoImports": "on",
"typescript.preferences.quoteStyle": "single",
@@ -22,6 +20,7 @@
"typescript",
"typescriptreact"
],
"eslint.packageManager": "yarn",
"eslint.workingDirectories": ["webapp"],
"editor.defaultFormatter": "esbenp.prettier-vscode",
+39 -68
View File
@@ -13,53 +13,47 @@
},
"tasks": [
{
"label": "Run Tests CE",
"label": "Generate dev proprties for CBCE",
"type": "shell",
"command": "yarn",
"group": "test",
"args": ["test"]
},
{
"label": "Run DevServer CE",
"group": "build",
"isBackground": true,
"type": "shell",
"command": "yarn",
"args": ["dev"],
"command": "mvn",
"args": [
"package",
"-q",
"exec:java",
"-Dexec.args=-productFile ${workspaceFolder}/server/product/web-server/CloudbeaverServer.product -projectsFolder ${workspaceFolder}/../ -eclipse ${env:DBEAVER_DEVEL_ECLIPSE_PATH} -output ${env:DBEAVER_DEVEL_ECLIPSE_WORKSPACE_PATH}/.metadata/.plugins/org.eclipse.pde.core/CloudbeaverServer.product"
],
"options": {
"env": {
"server": "${input:stage.ce}"
},
"cwd": "${workspaceFolder}/webapp/packages/product-default"
"cwd": "${workspaceFolder}/../dbeaver-packaging/tools/eclipse-plugins-resolver"
}
},
{
"label": "Generate Eclipse PDE CloudBeaver",
"label": "Run Tests",
"type": "shell",
"osx": {
"command": "./generate_workspace.sh"
},
"windows": {
"command": "./generate_workspace.cmd"
},
"command": "yarn",
"group": "test",
"args": ["lerna", "run", "test", "--no-bail", "--stream", "--"]
},
{
"label": "Run DevServer CE",
"type": "shell",
"command": "yarn",
"args": [
"dev",
"--",
"--env",
"server=${input:stage.ce}",
"--host",
"0.0.0.0"
],
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/../cloudbeaver"
},
"presentation": {
"reveal": "silent",
"close": true,
"clear": false
"cwd": "${workspaceFolder}/webapp/packages/product-default"
}
},
{
"label": "Build CE",
"type": "shell",
"windows": {
"command": "./build.bat"
},
"osx": {
"command": "./build.sh"
},
"command": "./build-sqlite.bat",
"options": {
"cwd": "${workspaceFolder}/deploy"
},
@@ -68,45 +62,22 @@
"isDefault": true
}
},
{
"label": "Run Backend CE",
"type": "shell",
"windows": {
"command": "./run-server.bat"
},
"osx": {
"command": "./run-server.sh"
},
"options": {
"cwd": "${workspaceFolder}/deploy/cloudbeaver"
}
},
{
"label": "Yarn Install",
"type": "shell",
"command": "yarn install",
"args": [],
"presentation": {
"reveal": "silent",
"close": true,
"clear": false
}
"command": "yarn",
"args": []
},
{
"label": "Update TS references CE",
"label": "Lerna Bootstrap",
"type": "shell",
"command": "yarn run update-ts-references",
"options": {
"cwd": "${workspaceFolder}/webapp"
}
"command": "yarn",
"args": ["lerna", "bootstrap"]
},
{
"label": "Clean CE",
"type": "shell",
"command": "yarn clean",
"options": {
"cwd": "${workspaceFolder}/webapp"
}
"label": "Bootstrap",
"dependsOrder": "sequence",
"dependsOn": ["Yarn Install", "Lerna Bootstrap"]
}
],
"inputs": [
@@ -114,8 +85,8 @@
"type": "pickString",
"id": "stage.ce",
"description": "CE Stage servers",
"default": "http://localhost:8978/",
"options": ["http://localhost:8978/"]
"default": "http://127.0.0.1:8978/",
"options": ["http://127.0.0.1:8978/"]
}
]
}
+30 -53
View File
@@ -1,16 +1,13 @@
<img src="https://github.com/dbeaver/cloudbeaver/wiki/images/cloudbeaver-logo.png" align="right" width="250"/>
# CloudBeaver Community
Cloud Database Manager - Community Edition.
CloudBeaver is a web server that provides a rich web interface. The server itself is a Java application, and the web part is written in TypeScript and React.
It is free to use and open-source (licensed under [Apache 2](https://github.com/dbeaver/cloudbeaver/blob/devel/LICENSE) license).
See our [WIKI](https://github.com/dbeaver/cloudbeaver/wiki) for more details.
<img src="https://github.com/dbeaver/cloudbeaver/wiki/images/cloudbeaver-logo.png" width="250"/>
<img src="https://github.com/dbeaver/cloudbeaver/wiki/images/connection-creation-demo.png" width="400"/>
<img src="https://github.com/dbeaver/cloudbeaver/wiki/images/gis-demo.png" width="400"/>
<img src="https://github.com/dbeaver/cloudbeaver/wiki/images/data-transfer-demo.png" width="400"/>
<img src="https://github.com/dbeaver/cloudbeaver/wiki/images/sql-editor-demo.png" width="400"/>
Cloud Database Manager - Community Edition.
CloudBeaver is a web server which provides rich web interface. Server itself is a Java application, web part is written on TypeScript and React.
It is free to use and open-source (licensed under [Apache 2](https://github.com/dbeaver/cloudbeaver/blob/devel/LICENSE) license).
See out [WIKI](https://github.com/dbeaver/cloudbeaver/wiki) for more details.
![](https://github.com/dbeaver/cloudbeaver/wiki/images/demo_screenshot_1.png)
## Run in Docker
@@ -19,56 +16,36 @@ See our [WIKI](https://github.com/dbeaver/cloudbeaver/wiki) for more details.
## Demo server
You can see a live demo of CloudBeaver here: https://demo.cloudbeaver.io
You can see live demo of CloudBeaver here: https://demo.cloudbeaver.io
[Database access instructions](https://github.com/dbeaver/cloudbeaver/wiki/Demo-Server)
## Changelog
### 24.2.2. 2024-10-07
- Schemas were added to the SQL autocompletion for PostgreSQL, H2, and SQL Server;
- CloudBeaver can now correctly display negative dates for MySQL database;
- A search option was added for preferences in the Administration part;
- Keyboard navigation has been enhanced. You can now use the arrow keys to move through navigator tree elements and the tab key to switch between editors tabs;
- Sample SQLite database was removed.
### CloudBeaver 23.1.0 - 2023-06-05
### 24.2.1. 2024-09-23
- Chinese localization has been improved (thanks to [cashlifei](https://github.com/cashlifei));
- Environment variables configuration has been improved - now you can configure more variables on the initial stage of the Docker setup;
- SQL Server driver has been updated to version 12.8.0.
Changes since 23.0.0
### 24.2.0. 2024-09-02
### Changes since 24.1.0:
- General:
- French language support was added (thanks to [matthieukhl](https://github.com/matthieukhl))
- Added the ability to close editor tabs with the middle mouse button
- Added right-click support to open the context menu in the Metadata Editor
- The list of forbidden characters for naming and renaming resource manager files has been updated, and now it includes the following characters: / : " \ ' <> | ? *
- Application cookies security was improved
- Authentication:
- Improved LDAP authentication: added the ability to filter users via service account parameters and ability to specify custom unique user identifiers
- Data Editor:
- Added additional notifications about the restricted operations
- Enhanced IPv6 and DateTime32 data representation for Clickhouse
- Data editing was fixed for DuckDB
- Data viewer:
- New grouping panel menu was added in the Data Viewer. This panel extracts unique values from the database column for count. Users can drag and drop the column to the grouping panel and get the results immediately. Sorting, filtering and exporting of the results are available on the Grouping panel.
- SQL Editor:
- SQL Editor auto-completion was enhanced to get column, table, and function names faster
- Fixed the dollar-quoted string parsing in the SQL Editor for PostgreSQL
- Improved display of the long error messages in the SQL Editor and Log viewer
- Changed the save script icon to a floppy disk for better recognition
- Improved application behavior when closing a connection - open editors won't be closed on disconnect
- Administration:
- Redesigned administration navigation panel - now it is more compact and clear
- Added the ability to change the default commit mode for each connection separately
- Added the ability to configure the server property rootURI parameter (thanks to [arioko](https://github.com/arioko))
- Databases:
- Added the "Keep alive" setting for Db2 LUW and IMB i, Apache Kyuubi, Clickhouse, Firebird, and Trino
- Updated Firebird driver to version 5.0.4
- DDL generation for Oracle Tablespaces was added (thanks to [pandya09](https://github.com/pandya09))
- We improved the performance of the SQL-editor - as a result, handling scripts with up to 10 000 lines does not present any challenges;
- In the SQL-editor, pressing Tab/Space followed by Enter now causes the cursor to move to a new line;
- In the SQL editor, when the cursor goes back on the query, the previous hints are displayed;
- Error when running SQL with semicolon has been fixed.
- Connections:
- If there is an error in saving the data, the tab for the chosen connection dialog will stay open to allow corrections;
- The URL-configuration for PostgreSQL now correctly displays only a single database.
- Driver management:
- The CE version now offers the updated sqlite-jdbc driver, version 3.41.2;
- CloudBeaver has the option to connect to H2 database version 2;
- The internal CloudBeaver database is upgraded to the newest H2 version 2 to avoid vulnerability issues. The database will be safely upgraded automatically for the servers with default configurations. You can perform this upgrade manually if you have a custom configuration for this database in your infrastructure.
- Connections:
- Option to increase the maximum size of text files displayed in the value panel (using the sqlTextPreviewMaxLength parameter) has been added;
- Support for custom logging configuration has been added. An external configuration file can be used instead of the default configuration.
## Contribution
As a community-driven open-source project, we warmly welcome contributions through GitHub pull requests.
[We are happy to reward](https://dbeaver.com/help-dbeaver/) our most active contributors every major sprint.
The most significant contribution to our code for the major release 24.2.0 was made by:
1. [matthieukhl](https://github.com/matthieukhl)
### Old CloudBeaver releases
You can find information about earlier releases on the CloudBeaver wiki https://github.com/dbeaver/cloudbeaver/wiki/Releases.
+7 -8
View File
@@ -5,14 +5,13 @@
Use this section to tell people about which versions of your project are
currently being supported with security updates.
| Version | Supported |
| ------- | --------- |
| 22.x | yes |
| 23.x | yes |
| 24.x | yes |
| Version | Supported |
| ------- | ------------------|
| 21.x | yes |
| 22.0 | yes |
## Reporting a Vulnerability
Please report (suspected) security vulnerabilities to devops@dbeaver.com.
You will receive a response from us within 48 hours.
If the issue is confirmed, we will release a patch as soon as possible, depending on complexity, but historically, within a few days.
Please report (suspected) security vulnerabilities to devops@dbeaver.com.
You will receive a response from us within 48 hours.
If the issue is confirmed, we will release a patch as soon as possible depending on complexity but historically within a few days.
+1 -1
View File
@@ -17,7 +17,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.1.214</version>
<version>1.4.199</version>
</dependency>
</dependencies>
<build>
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,4 +0,0 @@
{
"folders": {},
"connections": {}
}
-104
View File
@@ -1,104 +0,0 @@
{
server: {
serverPort: "${CLOUDBEAVER_SERVICE_PORT:8978}",
workspaceLocation: "${CLOUDBEAVER_WORKSPACE_LOCATION:workspace}",
contentRoot: "web",
driversLocation: "drivers",
sslConfigurationPath:"${CLOUDBEAVER_SSL_CONF_PATH:workspace/.data/ssl-config.xml}",
rootURI: "${CLOUDBEAVER_ROOT_URI:/}",
serviceURI: "/api/",
productSettings: {
# Global properties
core.theming.theme: 'light',
core.localization.localization: 'en',
plugin.sql-editor.autoSave: true,
plugin.sql-editor.disabled: false,
# max size of the file that can be uploaded to the editor (in kilobytes)
plugin.sql-editor.maxFileSize: 10240,
plugin.log-viewer.disabled: false,
plugin.log-viewer.logBatchSize: 1000,
plugin.log-viewer.maxLogRecords: 2000,
sql.proposals.insert.table.alias: PLAIN
},
expireSessionAfterPeriod: "${CLOUDBEAVER_EXPIRE_SESSION_AFTER_PERIOD:1800000}",
develMode: "${CLOUDBEAVER_DEVEL_MODE:false}",
enableSecurityManager: false,
sm: {
enableBruteForceProtection: "${CLOUDBEAVER_BRUTE_FORCE_PROTECTION_ENABLED:true}",
maxFailedLogin: "${CLOUDBEAVER_MAX_FAILED_LOGINS:10}",
minimumLoginTimeout: "${CLOUDBEAVER_MINIMUM_LOGIN_TIMEOUT:1}",
blockLoginPeriod: "${CLOUDBEAVER_BLOCK_PERIOD:300}",
passwordPolicy: {
minLength: "${CLOUDBEAVER_POLICY_MIN_LENGTH:8}",
requireMixedCase: "${CLOUDBEAVER_POLICY_REQUIRE_MIXED_CASE:true}",
minNumberCount: "${CLOUDBEAVER_POLICY_MIN_NUMBER_COUNT:1}",
minSymbolCount: "${CLOUDBEAVER_POLICY_MIN_SYMBOL_COUNT:0}"
}
},
database: {
driver: "${CLOUDBEAVER_DB_DRIVER:h2_embedded_v2}",
url: "${CLOUDBEAVER_DB_URL:jdbc:h2:${workspace}/.data/cb.h2v2.dat}",
schema: "${CLOUDBEAVER_DB_SCHEMA:''}",
user: "${CLOUDBEAVER_DB_USER:''}",
password: "${CLOUDBEAVER_DB_PASSWORD:''}",
initialDataConfiguration: "${CLOUDBEAVER_DB_INITIAL_DATA:conf/initial-data.conf}",
pool: {
minIdleConnections: "${CLOUDBEAVER_DB_MIN_IDLE_CONNECTIONS:4}",
maxIdleConnections: "${CLOUDBEAVER_DB_MAX_IDLE_CONNECTIONS:10}",
maxConnections: "${CLOUDBEAVER_DB_MAX_CONNECTIONS:100}",
validationQuery: "${CLOUDBEAVER_DB_VALIDATION_QUERY:SELECT 1}"
},
backupEnabled: "${CLOUDBEAVER_DB_BACKUP_ENABLED:true}"
}
},
app: {
anonymousAccessEnabled: "${CLOUDBEAVER_APP_ANONYMOUS_ACCESS_ENABLED:true}",
anonymousUserRole: user,
defaultUserTeam: "${CLOUDBEAVER_APP_DEFAULT_USER_TEAM:user}",
grantConnectionsAccessToAnonymousTeam: "${CLOUDBEAVER_APP_GRANT_CONNECTIONS_ACCESS_TO_ANONYMOUS_TEAM:false}",
supportsCustomConnections: "${CLOUDBEAVER_APP_SUPPORTS_CUSTOM_CONNECTIONS:false}",
showReadOnlyConnectionInfo: "${CLOUDBEAVER_APP_READ_ONLY_CONNECTION_INFO:false}",
systemVariablesResolvingEnabled: "${CLOUDBEAVER_SYSTEM_VARIABLES_RESOLVING_ENABLED:false}",
forwardProxy: "${CLOUDBEAVER_APP_FORWARD_PROXY:false}",
publicCredentialsSaveEnabled: "${CLOUDBEAVER_APP_PUBLIC_CREDENTIALS_SAVE_ENABLED:true}",
adminCredentialsSaveEnabled: "${CLOUDBEAVER_APP_ADMIN_CREDENTIALS_SAVE_ENABLED:true}",
resourceManagerEnabled: "${CLOUDBEAVER_APP_RESOURCE_MANAGER_ENABLED:true}",
resourceQuotas: {
dataExportFileSizeLimit: "${CLOUDBEAVER_RESOURCE_QUOTA_DATA_EXPORT_FILE_SIZE_LIMIT:10000000}",
resourceManagerFileSizeLimit: "${CLOUDBEAVER_RESOURCE_QUOTA_RESOURCE_MANAGER_FILE_SIZE_LIMIT:500000}",
sqlMaxRunningQueries: "${CLOUDBEAVER_RESOURCE_QUOTA_SQL_MAX_RUNNING_QUERIES:100}",
sqlResultSetRowsLimit: "${CLOUDBEAVER_RESOURCE_QUOTA_SQL_RESULT_SET_ROWS_LIMIT:100000}",
sqlTextPreviewMaxLength: "${CLOUDBEAVER_RESOURCE_QUOTA_SQL_TEXT_PREVIEW_MAX_LENGTH:4096}",
sqlBinaryPreviewMaxLength: "${CLOUDBEAVER_RESOURCE_QUOTA_SQL_BINARY_PREVIEW_MAX_LENGTH:261120}"
},
enabledAuthProviders: [
"local"
],
disabledDrivers: [
"sqlite:sqlite_jdbc",
"h2:h2_embedded",
"h2:h2_embedded_v2",
"clickhouse:yandex_clickhouse"
],
disabledBetaFeatures: [
]
}
}
+3 -3
View File
@@ -2,14 +2,14 @@
teams: [
{
subjectId: "admin",
teamName: "Admin",
name: "Admin",
description: "Administrative access. Has all permissions.",
permissions: [ "admin" ]
},
{
subjectId: "user",
teamName: "User",
description: "All users, including anonymous.",
name: "User",
description: "Standard user",
permissions: [ ]
}
]
+34
View File
@@ -0,0 +1,34 @@
// Product configuration. Customized web application behavior
// It is in JSONC format
{
// Global properties
core: {
// User defaults
user: {
defaultTheme: "light",
defaultLanguage: "en"
},
app: {
// Log viewer config
logViewer: {
refreshTimeout: 3000,
logBatchSize: 1000,
maxLogRecords: 2000,
maxFailedRequests: 3
}
},
authentication: {
primaryAuthProvider: 'local'
}
},
// Notifications config
core_events: {
notificationsPool: 5
},
plugin_data_spreadsheet_new: {
hidden: false
},
plugin_data_export: {
disabled: false
}
}
@@ -0,0 +1,24 @@
{
"folders": {},
"connections": {
"postgresql-template-1": {
"provider": "postgresql",
"driver": "postgres-jdbc",
"name": "PostgreSQL (Template)",
"save-password": false,
"show-system-objects": false,
"read-only": true,
"template": true,
"configuration": {
"host": "localhost",
"port": "5432",
"database": "postgres",
"url": "jdbc:postgresql://localhost:5432/postgres",
"type": "dev",
"provider-properties": {
"@dbeaver-show-non-default-db@": "false"
}
}
}
}
}
@@ -0,0 +1,69 @@
{
server: {
serverPort: 8978,
workspaceLocation: "workspace",
contentRoot: "web",
driversLocation: "drivers",
rootURI: "/",
serviceURI: "/api/",
productConfiguration: "conf/product.conf",
expireSessionAfterPeriod: 1800000,
develMode: false,
enableSecurityManager: false,
database: {
driver="h2_embedded_v2",
url: "jdbc:h2:${workspace}/.data/cb.h2v2.dat",
initialDataConfiguration: "conf/initial-data.conf",
pool: {
minIdleConnections: 4,
maxIdleConnections: 10,
maxConnections: 100,
validationQuery: "SELECT 1"
}
}
},
app: {
anonymousAccessEnabled: true,
anonymousUserRole: "user",
grantConnectionsAccessToAnonymousTeam: false,
supportsCustomConnections: false,
showReadOnlyConnectionInfo: false,
forwardProxy: false,
publicCredentialsSaveEnabled: true,
adminCredentialsSaveEnabled: true,
resourceManagerEnabled: true,
resourceQuotas: {
dataExportFileSizeLimit: 10000000,
resourceManagerFileSizeLimit: 500000,
sqlMaxRunningQueries: 100,
sqlResultSetRowsLimit: 100000,
sqlResultSetMemoryLimit: 2000000,
sqlTextPreviewMaxLength: 4096,
sqlBinaryPreviewMaxLength: 261120
},
enabledAuthProviders: [
"local"
],
disabledDrivers: [
"sqlite:sqlite_jdbc",
"h2:h2_embedded",
"h2:h2_embedded_v2",
"clickhouse:yandex_clickhouse"
]
}
}
+3
View File
@@ -0,0 +1,3 @@
### Sample databases
Provides access to locally deployed SQLite sample database
@@ -0,0 +1,39 @@
{
"folders": {},
"connections": {
"sqlite_xerial-sample-database": {
"provider": "generic",
"driver": "sqlite_jdbc",
"name": "SQLite - Chinook (Sample)",
"save-password": true,
"navigator-show-only-entities": false,
"navigator-hide-folders": false,
"read-only": false,
"template": false,
"configuration": {
"database": "${application.path}/../samples/db/Chinook.sqlitedb",
"type": "dev",
"auth-model": "native"
}
},
"postgresql-template-1": {
"provider": "postgresql",
"driver": "postgres-jdbc",
"name": "PostgreSQL (Template)",
"save-password": false,
"show-system-objects": false,
"read-only": true,
"template": true,
"configuration": {
"host": "localhost",
"port": "5432",
"database": "postgres",
"url": "jdbc:postgresql://localhost:5432/postgres",
"type": "dev",
"provider-properties": {
"@dbeaver-show-non-default-db@": "false"
}
}
}
}
}
@@ -0,0 +1,4 @@
{
"folders": {},
"connections": {}
}
@@ -0,0 +1,68 @@
{
server: {
serverPort: 8978,
workspaceLocation: "workspace",
contentRoot: "web",
driversLocation: "drivers",
rootURI: "/",
serviceURI: "/api/",
productConfiguration: "conf/product.conf",
expireSessionAfterPeriod: 1800000,
develMode: false,
enableSecurityManager: false,
database: {
driver="h2_embedded_v2",
url: "jdbc:h2:${workspace}/.data/cb.h2v2.dat",
initialDataConfiguration: "conf/initial-data.conf",
pool: {
minIdleConnections: 4,
maxIdleConnections: 10,
maxConnections: 100,
validationQuery: "SELECT 1"
}
}
},
app: {
anonymousAccessEnabled: true,
anonymousUserRole: "user",
grantConnectionsAccessToAnonymousTeam: false,
supportsCustomConnections: false,
showReadOnlyConnectionInfo: false,
forwardProxy: false,
publicCredentialsSaveEnabled: true,
adminCredentialsSaveEnabled: true,
resourceManagerEnabled: true,
resourceQuotas: {
dataExportFileSizeLimit: 10000000,
resourceManagerFileSizeLimit: 500000,
sqlMaxRunningQueries: 100,
sqlResultSetRowsLimit: 100000,
sqlResultSetMemoryLimit: 2000000,
sqlTextPreviewMaxLength: 4096,
sqlBinaryPreviewMaxLength: 261120
},
enabledAuthProviders: [
"local"
],
disabledDrivers: [
"h2:h2_embedded",
"h2:h2_embedded_v2",
"clickhouse:yandex_clickhouse"
]
}
}
Binary file not shown.
+6
View File
@@ -0,0 +1,6 @@
Chinook Database - Version 1.3
Script: Chinook_Sqlite.sql
Description: Creates and populates the Chinook database.
DB Server: Sqlite
Author: Luis Rocha
License: http://www.codeplex.com/ChinookDatabase/license
-44
View File
@@ -1,44 +0,0 @@
#!/bin/bash
set -Eeo pipefail
set +u
echo "Clone and build Cloudbeaver"
rm -rf ./drivers
rm -rf ./cloudbeaver
mkdir ./cloudbeaver
mkdir ./cloudbeaver/server
mkdir ./cloudbeaver/conf
mkdir ./cloudbeaver/workspace
echo "Pull cloudbeaver platform"
cd ../..
echo "Pull dbeaver platform"
[ ! -d dbeaver ] && git clone --depth 1 https://github.com/dbeaver/dbeaver.git
[ ! -d dbeaver-common ] && git clone --depth 1 https://github.com/dbeaver/dbeaver-common.git
cd cloudbeaver/deploy
echo "Build CloudBeaver server"
cd ../server/product/aggregate
mvn clean verify $MAVEN_COMMON_OPTS -Dheadless-platform
if [[ "$?" -ne 0 ]] ; then
echo 'Could not perform package'; exit $rc
fi
cd ../../../deploy
echo "Copy server packages"
cp -rp ../server/product/web-server/target/products/io.cloudbeaver.product/all/all/all/* ./cloudbeaver/server
cp -p ./scripts/* ./cloudbeaver
mkdir cloudbeaver/samples
cp -rp ../config/core/* cloudbeaver/conf
cp -rp ../config/GlobalConfiguration/.dbeaver/data-sources.json cloudbeaver/conf/initial-data-sources.conf
mv drivers cloudbeaver
echo "End of backend build"
-31
View File
@@ -1,31 +0,0 @@
#!/bin/bash
set -Eeuo pipefail
echo "Build static content"
mkdir ./cloudbeaver/web
cd ../../cloudbeaver/webapp
yarn
cd ./packages/product-default
yarn run bundle
if [[ "$?" -ne 0 ]] ; then
echo 'Application build failed'; exit $rc
fi
cd ../../
yarn test
if [[ "$?" -ne 0 ]] ; then
echo 'Frontend tests failed'; exit $rc
fi
cd ../deploy
echo "Copy static content"
cp -rp ../webapp/packages/product-default/lib/* cloudbeaver/web
echo "Cloudbeaver is ready. Run run-server.sh in cloudbeaver folder to start the server."
+1
View File
@@ -0,0 +1 @@
@call build.bat ..\config\sample-databases\SQLiteConfiguration ..\config\sample-databases\db
+1
View File
@@ -0,0 +1 @@
./build.sh '../config/sample-databases/SQLiteConfiguration' '../config/sample-databases/db'
+12 -4
View File
@@ -1,6 +1,11 @@
@echo off
rem command line arguments
SET CONFIGURATION_PATH=%1
SET SAMPLE_DATABASE_PATH=%2
IF "%CONFIGURATION_PATH%"=="" SET CONFIGURATION_PATH="..\config\sample-databases\DefaultConfiguration"
echo "Configuration path=%CONFIGURATION_PATH%"
echo Clone and build Cloudbeaver
@@ -19,7 +24,6 @@ cd ..\..
echo Pull dbeaver platform
IF NOT EXIST dbeaver git clone https://github.com/dbeaver/dbeaver.git
IF NOT EXIST dbeaver-common git clone https://github.com/dbeaver/dbeaver-common.git
cd cloudbeaver\deploy
echo Build cloudbeaver server
@@ -35,9 +39,13 @@ xcopy /E /Q ..\server\product\web-server\target\products\io.cloudbeaver.product\
copy scripts\* cloudbeaver >NUL
mkdir cloudbeaver\samples
IF NOT "%SAMPLE_DATABASE_PATH%"=="" (
mkdir cloudbeaver\samples\db
xcopy /E /Q %SAMPLE_DATABASE_PATH% cloudbeaver\samples\db >NUL
)
copy ..\config\core\* cloudbeaver\conf >NUL
copy ..\config\DefaultConfiguration\GlobalConfiguration\.dbeaver\data-sources.json cloudbeaver\conf\initial-data-sources.conf >NUL
copy %CONFIGURATION_PATH%\GlobalConfiguration\.dbeaver\data-sources.json cloudbeaver\conf\initial-data-sources.conf >NUL
copy %CONFIGURATION_PATH%\*.conf cloudbeaver\conf >NUL
move drivers cloudbeaver >NUL
@@ -49,7 +57,7 @@ cd ..\cloudbeaver\webapp
call yarn
call yarn lerna bootstrap
call yarn lerna run bundle --no-bail --stream --scope=@cloudbeaver/product-default &::-- -- --env source-map
call yarn lerna run build --no-bail --stream --scope=@cloudbeaver/product-default &::-- -- --env source-map
cd ..\deploy
+68 -2
View File
@@ -1,5 +1,71 @@
#!/bin/bash
set -Eeuo pipefail
source build-backend.sh
source build-frontend.sh
#command line arguments
CONFIGURATION_PATH=${1-"../config/sample-databases/DefaultConfiguration"}
SAMPLE_DATABASE_PATH=${2-""}
echo "Clone and build Cloudbeaver"
rm -rf ./drivers
rm -rf ./cloudbeaver
mkdir ./cloudbeaver
mkdir ./cloudbeaver/server
mkdir ./cloudbeaver/conf
mkdir ./cloudbeaver/workspace
mkdir ./cloudbeaver/web
echo "Pull cloudbeaver platform"
cd ../..
echo "Pull dbeaver platform"
[ ! -d dbeaver ] && git clone https://github.com/dbeaver/dbeaver.git
cd cloudbeaver/deploy
echo "Build CloudBeaver server"
cd ../server/product/aggregate
mvn clean verify -U -Dheadless-platform
if [[ "$?" -ne 0 ]] ; then
echo 'Could not perform package'; exit $rc
fi
cd ../../../deploy
echo "Copy server packages"
cp -rp ../server/product/web-server/target/products/io.cloudbeaver.product/all/all/all/* ./cloudbeaver/server
cp -p ./scripts/* ./cloudbeaver
mkdir cloudbeaver/samples
if [[ ! -z "${SAMPLE_DATABASE_PATH}" ]]; then
mkdir cloudbeaver/samples/db
cp -rp "${SAMPLE_DATABASE_PATH}" cloudbeaver/samples/
fi
cp -rp ../config/core/* cloudbeaver/conf
cp -rp "${CONFIGURATION_PATH}"/GlobalConfiguration/.dbeaver/data-sources.json cloudbeaver/conf/initial-data-sources.conf
cp -p "${CONFIGURATION_PATH}"/*.conf cloudbeaver/conf/
mv drivers cloudbeaver
echo "Build static content"
cd ../
cd ../cloudbeaver/webapp
yarn
yarn lerna run bootstrap
yarn lerna run build --no-bail --stream --scope=@cloudbeaver/product-default #-- -- --env source-map
if [[ "$?" -ne 0 ]] ; then
echo 'Application build failed'; exit $rc
fi
cd ../deploy
echo "Copy static content"
cp -rp ../webapp/packages/product-default/lib/* cloudbeaver/web
echo "Cloudbeaver is ready. Run run-server.bat in cloudbeaver folder to start the server."
+8
View File
@@ -0,0 +1,8 @@
FROM eclipse-temurin:17.0.4.1_1-jre-focal
COPY cloudbeaver /opt/cloudbeaver
EXPOSE 8978
WORKDIR /opt/cloudbeaver/
ENTRYPOINT ["./run-server.sh"]
-47
View File
@@ -1,47 +0,0 @@
FROM ubuntu:24.04
MAINTAINER DBeaver Corp, devops@dbeaver.com
ENV DEBIAN_FRONTEND=noninteractive
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
# curl required for historical reasons, see https://github.com/adoptium/containers/issues/255
curl \
wget \
# java.lang.UnsatisfiedLinkError: libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
# java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
# https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077
fontconfig \
# utilities for keeping Ubuntu and OpenJDK CA certificates in sync
# https://github.com/adoptium/containers/issues/293
ca-certificates p11-kit \
# jlink --strip-debug on 13+ needs objcopy: https://github.com/docker-library/openjdk/issues/351
# Error: java.io.IOException: Cannot run program "objcopy": error=2, No such file or directory
binutils \
tzdata \
# locales ensures proper character encoding and locale-specific behaviors using en_US.UTF-8
locales \
nano \
; \
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen; \
locale-gen en_US.UTF-8; \
rm -rf /var/lib/apt/lists/*
ENV LANG=en_US.UTF-8
ENV JAVA_HOME=/opt/java/openjdk
COPY --from=eclipse-temurin:17 $JAVA_HOME $JAVA_HOME
ENV PATH="${JAVA_HOME}/bin:${PATH}"
RUN set -eux; \
# https://github.com/docker-library/openjdk/issues/331#issuecomment-498834472
find "$JAVA_HOME/lib" -name '*.so' -exec dirname '{}' ';' | sort -u > /etc/ld.so.conf.d/docker-openjdk.conf; \
ldconfig; \
# https://github.com/docker-library/openjdk/issues/212#issuecomment-420979840
# https://openjdk.java.net/jeps/341
java -Xshare:dump;
### Patch java security
COPY java.security* ${JAVA_HOME}/conf/security/java.security
-13
View File
@@ -1,13 +0,0 @@
FROM dbeaver/base-java
MAINTAINER DBeaver Corp, devops@dbeaver.com
RUN apt-get update; \
apt-get upgrade -y;
COPY cloudbeaver /opt/cloudbeaver
EXPOSE 8978
RUN find /opt/cloudbeaver -type d -exec chmod 775 {} \;
WORKDIR /opt/cloudbeaver/
ENTRYPOINT ["./run-server.sh"]
+1 -1
View File
@@ -1,3 +1,3 @@
cd ..
docker build -t dbeaver/cloudbeaver:dev . --file ./docker/cloudbeaver-ce/Dockerfile
docker build -t dbeaver/cloudbeaver:dev . --file ./docker/Dockerfile
+2 -36
View File
@@ -1,5 +1,5 @@
@echo off
for /f %%a in ('dir /B /S server\plugins\org.jkiss.dbeaver.launcher*.jar') do SET launcherJar="%%a"
for /f %%a in ('dir /B /S server\plugins\org.eclipse.equinox.launcher*.jar') do SET launcherJar="%%a"
echo "Starting Cloudbeaver Server"
@@ -10,38 +10,4 @@ IF NOT EXIST workspace\.metadata (
)
)
SET VMARGS_OPTS = ""
If Not Defined JAVA_OPTS (
SET VMARGS_OPTS = "-Xmx2048M"
)
java %JAVA_OPTS% ^
-Dfile.encoding=UTF-8 ^
--add-modules=ALL-SYSTEM ^
--add-opens=java.base/java.io=ALL-UNNAMED ^
--add-opens=java.base/java.lang=ALL-UNNAMED ^
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED ^
--add-opens=java.base/java.net=ALL-UNNAMED ^
--add-opens=java.base/java.nio=ALL-UNNAMED ^
--add-opens=java.base/java.nio.charset=ALL-UNNAMED ^
--add-opens=java.base/java.text=ALL-UNNAMED ^
--add-opens=java.base/java.time=ALL-UNNAMED ^
--add-opens=java.base/java.util=ALL-UNNAMED ^
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED ^
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED ^
--add-opens=java.base/jdk.internal.vm=ALL-UNNAMED ^
--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED ^
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED ^
--add-opens=java.base/sun.security.ssl=ALL-UNNAMED ^
--add-opens=java.base/sun.security.action=ALL-UNNAMED ^
--add-opens=java.base/sun.security.util=ALL-UNNAMED ^
--add-opens=java.security.jgss/sun.security.jgss=ALL-UNNAMED ^
--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED ^
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED ^
--add-opens=java.sql/java.sql=ALL-UNNAMED ^
-jar %launcherJar% ^
-product io.cloudbeaver.product.ce.product ^
-data %workspacePath% ^
-web-config conf/cloudbeaver.conf ^
-nl en ^
-registryMultiLanguage
java %JAVA_OPTS% --add-modules=ALL-SYSTEM --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/jdk.internal.vm=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/sun.security.ssl=ALL-UNNAMED --add-opens=java.base/sun.security.action=ALL-UNNAMED --add-opens=java.base/sun.security.util=ALL-UNNAMED -jar %launcherJar% -product io.cloudbeaver.product.ce.product -web-config conf/cloudbeaver.conf -nl en -registryMultiLanguage
+3 -34
View File
@@ -1,40 +1,9 @@
#!/bin/bash
launcherJar=( server/plugins/org.jkiss.dbeaver.launcher*.jar )
launcherJar=( server/plugins/org.eclipse.equinox.launcher*.jar )
echo "Starting Cloudbeaver Server"
[ ! -d "workspace/.metadata" ] && mkdir -p workspace/.metadata \
&& mkdir -p workspace/GlobalConfiguration/.dbeaver \
&& [ ! -f "workspace/GlobalConfiguration/.dbeaver/data-sources.json" ] \
&& cp conf/initial-data-sources.conf workspace/GlobalConfiguration/.dbeaver/data-sources.json
[ ! -d "workspace/.metadata" ] && mkdir -p workspace/.metadata && mkdir -p workspace/GlobalConfiguration/.dbeaver && [ ! -f "workspace/GlobalConfiguration/.dbeaver/data-sources.json" ] && cp conf/initial-data-sources.conf workspace/GlobalConfiguration/.dbeaver/data-sources.json
exec java ${JAVA_OPTS} \
-Dfile.encoding=UTF-8 \
--add-modules=ALL-SYSTEM \
--add-opens=java.base/java.io=ALL-UNNAMED \
--add-opens=java.base/java.lang=ALL-UNNAMED \
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens=java.base/java.net=ALL-UNNAMED \
--add-opens=java.base/java.nio=ALL-UNNAMED \
--add-opens=java.base/java.nio.charset=ALL-UNNAMED \
--add-opens=java.base/java.text=ALL-UNNAMED \
--add-opens=java.base/java.time=ALL-UNNAMED \
--add-opens=java.base/java.util=ALL-UNNAMED \
--add-opens=java.base/java.util.concurrent=ALL-UNNAMED \
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED \
--add-opens=java.base/jdk.internal.vm=ALL-UNNAMED \
--add-opens=java.base/jdk.internal.misc=ALL-UNNAMED \
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens=java.base/sun.security.ssl=ALL-UNNAMED \
--add-opens=java.base/sun.security.action=ALL-UNNAMED \
--add-opens=java.base/sun.security.util=ALL-UNNAMED \
--add-opens=java.security.jgss/sun.security.jgss=ALL-UNNAMED \
--add-opens=java.security.jgss/sun.security.krb5=ALL-UNNAMED \
--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED \
--add-opens=java.sql/java.sql=ALL-UNNAMED \
-jar ${launcherJar} \
-product io.cloudbeaver.product.ce.product \
-web-config conf/cloudbeaver.conf \
-nl en \
-registryMultiLanguage
java ${JAVA_OPTS} --add-modules=ALL-SYSTEM --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/jdk.internal.vm=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/sun.security.ssl=ALL-UNNAMED --add-opens=java.base/sun.security.action=ALL-UNNAMED --add-opens=java.base/sun.security.util=ALL-UNNAMED -jar ${launcherJar} -product io.cloudbeaver.product.ce.product -web-config conf/cloudbeaver.conf -nl en -registryMultiLanguage
+10
View File
@@ -0,0 +1,10 @@
[program:cloudbeaver]
directory=/opt/cloudbeaver/
command=/opt/cloudbeaver/run-server.sh
stopasgroup=true
killasgroup=true
stopsignal=INT
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/cloudbeaver-server.log
-3
View File
@@ -1,3 +0,0 @@
SET mypath=%~dp0
.\..\idea-rcp-launch-config-generator\runGenerator.cmd -f %mypath%
-1
View File
@@ -1 +0,0 @@
./../idea-rcp-launch-config-generator/runGenerator.sh -f "$PWD"
+1
View File
@@ -1,3 +1,4 @@
{
"projects": ["../dbeaver", "../cloudbeaver/server"],
"targetPlatform": "./org.jkiss.cloudbeaver.tp.target"
}
+2 -2
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?>
<target name="org.jkiss.cloudbeaver.tp">
<target name="org.jkiss.tp.cloudbeaver">
<locations>
<location path="../dbeaver-workspace/dependencies/plugins" type="Directory"/>
<location path="${env_var:DBEAVER_DEVEL_ECLIPSE_PATH}/plugins" type="Directory"/>
</locations>
</target>
-33
View File
@@ -1,33 +0,0 @@
workspaceName=cloudbeaver-ce
featuresPaths=\
dbeaver/features;\
cloudbeaver/server/features;
bundlesPaths=\
dbeaver-common/modules;\
dbeaver/plugins;\
cloudbeaver/server/bundles;
testLibraries=\
org.junit;\
org.mockito.mockito-core;\
junit-jupiter-api;\
org.opentest4j
repositories=\
https://p2.dev.dbeaver.com/eclipse-repo/;\
https://download.eclipse.org/releases/${eclipse-version}/;
testBundles=\
org.junit;\
org.mockito.mockito-core;\
junit-jupiter-api;\
org.opentest4j
productsPaths=\
dbeaver/product/community/DBeaver.product;\
cloudbeaver/server/product/web-server/CloudbeaverServer.product:../../opt/cloudbeaver;
ideaConfigurationFilesPaths=\
dbeaver/.ide/.idea;
testBundlePaths=\
dbeaver/test;\
cloudbeaver/server/test;
additionalModuleRoots=\
opt;
optionalFeatureRepositories=\
dbeaver/product/repositories
-2
View File
@@ -1,2 +0,0 @@
dbeaver-common
dbeaver
-9
View File
@@ -1,9 +0,0 @@
projects:
schema:
include: ./**/*.graphqls
schema: "gql.ce"
extensions:
endpoints:
Default GraphQL Endpoint:
url: http://localhost:8080/api/gql
introspect: false
@@ -1,49 +1,41 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Vendor: DBeaver Corp
Bundle-Name: Cloudbeaver Web Model
Bundle-Vendor: %Bundle-Vendor
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: io.cloudbeaver.model;singleton:=true
Bundle-Version: 1.0.63.qualifier
Bundle-Release-Date: 20241021
Bundle-RequiredExecutionEnvironment: JavaSE-17
Bundle-Version: 1.0.31.qualifier
Bundle-Release-Date: 20230626
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Require-Bundle: org.jkiss.dbeaver.data.gis;visibility:=reexport,
Require-Bundle: org.jkiss.dbeaver.data.gis;visibility:=reexport,
org.jkiss.dbeaver.model;visibility:=reexport,
org.jkiss.dbeaver.model.sm;visibility:=reexport,
org.jkiss.dbeaver.model.event;visibility:=reexport,
org.jkiss.dbeaver.model.nio;visibility:=reexport,
org.jkiss.dbeaver.registry;visibility:=reexport,
org.jkiss.dbeaver.net.ssh,
org.jkiss.bundle.graphql.java;visibility:=reexport,
org.jkiss.bundle.apache.dbcp,
com.google.gson;visibility:=reexport,
jakarta.servlet-api;bundle-version:="6.0.0";visibility:=reexport
jakarta.servlet-api;visibility:=reexport
Export-Package: io.cloudbeaver,
io.cloudbeaver.auth,
io.cloudbeaver.auth.provider,
io.cloudbeaver.auth.provider.fa,
io.cloudbeaver.auth.provider.local,
io.cloudbeaver.auth.provisioning,
io.cloudbeaver.websocket,
io.cloudbeaver.model,
io.cloudbeaver.model.app,
io.cloudbeaver.model.config,
io.cloudbeaver.model.fs,
io.cloudbeaver.model.log,
io.cloudbeaver.model.rm,
io.cloudbeaver.model.rm.local,
io.cloudbeaver.model.rm.lock,
io.cloudbeaver.model.session,
io.cloudbeaver.model.user,
io.cloudbeaver.model.utils,
io.cloudbeaver.registry,
io.cloudbeaver.server,
io.cloudbeaver.service,
io.cloudbeaver.service.admin,
io.cloudbeaver.service.security,
io.cloudbeaver.service.sql,
io.cloudbeaver.test,
io.cloudbeaver.utils,
io.cloudbeaver.utils.file
Automatic-Module-Name: io.cloudbeaver.model
@@ -0,0 +1,2 @@
Bundle-Vendor = DBeaver Corp
Bundle-Name = Cloudbeaver Web Model
@@ -3,4 +3,5 @@ output.. = target/classes/
bin.includes = .,\
META-INF/,\
plugin.xml,\
schema/
schema/,\
OSGI-INF/
@@ -19,9 +19,4 @@
</metaParameters>
</extension>
<extension point="com.dbeaver.secretController">
<controller id="void-secret" class="io.cloudbeaver.model.app.VoidSecretController"
label="Default secret controller" description="Default void secret controller"/>
</extension>
</plugin>
+1 -1
View File
@@ -10,7 +10,7 @@
<relativePath>../</relativePath>
</parent>
<artifactId>io.cloudbeaver.model</artifactId>
<version>1.0.63-SNAPSHOT</version>
<version>1.0.31-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
@@ -14,6 +14,11 @@
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="propertyGroup"/>
</sequence>
</complexType>
</element>
<element name="driver">
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -16,20 +16,22 @@
*/
package io.cloudbeaver;
import io.cloudbeaver.model.rm.RMUtils;
import org.eclipse.core.resources.IProject;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.app.DBPWorkspace;
import org.jkiss.dbeaver.model.auth.SMSessionContext;
import org.jkiss.dbeaver.model.impl.app.BaseProjectImpl;
import org.jkiss.dbeaver.model.rm.RMController;
import org.jkiss.dbeaver.model.rm.RMControllerProvider;
import org.jkiss.dbeaver.model.rm.RMProject;
import org.jkiss.dbeaver.registry.BaseProjectImpl;
import org.jkiss.utils.CommonUtils;
import org.jkiss.utils.Pair;
import java.nio.file.Path;
import java.util.Collection;
public abstract class BaseWebProjectImpl extends BaseProjectImpl implements RMControllerProvider {
public class BaseWebProjectImpl extends BaseProjectImpl {
@NotNull
private final RMProject project;
@@ -37,6 +39,7 @@ public abstract class BaseWebProjectImpl extends BaseProjectImpl implements RMCo
@NotNull
private final Path path;
@NotNull
protected final DataSourceFilter dataSourceFilter;
private final RMController resourceController;
public BaseWebProjectImpl(
@@ -44,12 +47,13 @@ public abstract class BaseWebProjectImpl extends BaseProjectImpl implements RMCo
@NotNull RMController resourceController,
@NotNull SMSessionContext sessionContext,
@NotNull RMProject project,
@NotNull Path path
@NotNull DataSourceFilter dataSourceFilter
) {
super(workspace, sessionContext);
this.resourceController = resourceController;
this.path = path;
this.path = RMUtils.getProjectPath(project);
this.project = project;
this.dataSourceFilter = dataSourceFilter;
}
@NotNull
@@ -57,12 +61,6 @@ public abstract class BaseWebProjectImpl extends BaseProjectImpl implements RMCo
return resourceController;
}
@NotNull
@Override
public RMProject getRMProject() {
return project;
}
@Override
public boolean isVirtual() {
return true;
@@ -86,6 +84,12 @@ public abstract class BaseWebProjectImpl extends BaseProjectImpl implements RMCo
return path;
}
@Nullable
@Override
public IProject getEclipseProject() {
return null;
}
@Override
public boolean isOpen() {
return true;
@@ -101,6 +105,11 @@ public abstract class BaseWebProjectImpl extends BaseProjectImpl implements RMCo
return false;
}
@NotNull
public RMProject getRmProject() {
return this.project;
}
/**
* Method for Bulk Update of resources properties paths
*
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -17,27 +17,26 @@
package io.cloudbeaver;
import org.jkiss.dbeaver.model.access.DBAPermissionRealm;
import org.jkiss.dbeaver.model.rm.RMConstants;
/**
* General constants
*/
public interface DBWConstants {
public class DBWConstants {
String PERMISSION_ADMIN = DBAPermissionRealm.PERMISSION_ADMIN;
public static final String PERMISSION_ADMIN = DBAPermissionRealm.PERMISSION_ADMIN;
String PERMISSION_CONFIGURATION_MANAGER = RMConstants.PERMISSION_CONFIGURATION_MANAGER;
String PERMISSION_PRIVATE_PROJECT_ACCESS = "private-project-access";
String PERMISSION_SECRET_MANAGER = "secret-manager";
public static final String PERMISSION_CONFIGURATION_MANAGER = "configuration-manager";
public static final String PERMISSION_PRIVATE_PROJECT_ACCESS = "private-project-access";
public static final String PERMISSION_EDIT_STRUCTURE = "edit-meta";
public static final String PERMISSION_EDIT_DATA = "edit-data";
String PERMISSION_EDIT_STRUCTURE = "edit-meta";
String PERMISSION_EDIT_DATA = "edit-data";
public static final String STATE_ATTR_SIGN_IN_STATE = "state.signin";
String STATE_ATTR_SIGN_IN_STATE = "state.signin";
String WORK_DATA_FOLDER_NAME = ".work-data";
public static final String USER_PROJECTS_FOLDER = "user-projects";
public static final String SHARED_PROJECTS_FOLDER = "shared-projects";
enum SignInState {
public enum SignInState {
GLOBAL,
EMBEDDED
}
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -21,7 +21,7 @@ import graphql.ErrorType;
import graphql.GraphQLError;
import graphql.language.SourceLocation;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.sql.SQLState;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.utils.GeneralUtils;
import org.jkiss.utils.CommonUtils;
@@ -38,7 +38,6 @@ public class DBWebException extends DBException implements GraphQLError {
public static final String ERROR_CODE_SESSION_EXPIRED = "sessionExpired";
public static final String ERROR_CODE_ACCESS_DENIED = "accessDenied";
public static final String ERROR_CODE_SERVER_NOT_INITIALIZED = "serverNotInitialized";
public static final String ERROR_CODE_LICENSE_DENIED = "licenseRequired";
public static final String ERROR_CODE_IDENT_REQUIRED = "identRequired";
public static final String ERROR_CODE_AUTH_REQUIRED = "authRequired";
@@ -66,8 +65,12 @@ public class DBWebException extends DBException implements GraphQLError {
this.webErrorCode = errorCode;
}
public DBWebException(Throwable cause) {
super(null, cause);
public DBWebException(Throwable cause, DBPDataSource dataSource) {
super(cause, dataSource);
}
public DBWebException(String message, Throwable cause, DBPDataSource dataSource) {
super(makeMessage(message, cause), cause, dataSource);
}
public String getWebErrorCode() {
@@ -125,14 +128,14 @@ public class DBWebException extends DBException implements GraphQLError {
//stString = stString.substring(divPos + 1).trim();
}
extensions.put("stackTrace", stString.trim());
int errorCode = SQLState.getCodeFromException(this);
int errorCode = getErrorCode();
if (errorCode != ERROR_CODE_NONE) {
extensions.put("errorCode", errorCode);
}
if (!CommonUtils.isEmpty(webErrorCode)) {
extensions.put("webErrorCode", webErrorCode);
}
String databaseState = SQLState.getStateFromException(this);
String databaseState = getDatabaseState();
if (databaseState != null) {
extensions.put("databaseState", databaseState);
}
@@ -141,18 +144,14 @@ public class DBWebException extends DBException implements GraphQLError {
}
private static String makeMessage(String message, Throwable cause) {
if (cause == null) {
if (CommonUtils.isEmpty(message)) {
return "Unknown internal error";
} else {
return message;
}
}
if (CommonUtils.isEmpty(message)) {
if (cause.getMessage() != null) {
return cause.getMessage();
if (cause != null) {
if (cause.getMessage() != null) {
return cause.getMessage();
}
return cause.getClass().getName();
}
return cause.getClass().getName();
return "Unknown internal error";
}
if (CommonUtils.equalObjects(message, cause.getMessage())) {
return message;
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -29,7 +29,6 @@ import org.jkiss.dbeaver.model.app.DBPProject;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.net.DBWNetworkProfile;
import org.jkiss.dbeaver.model.preferences.DBPPreferenceStore;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.secret.DBSSecretController;
import org.jkiss.dbeaver.model.struct.DBSObjectFilter;
@@ -52,7 +51,6 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
this.dataSourceFilter = filter;
}
@NotNull
@Override
public DBPProject getProject() {
return dataSourceRegistry.getProject();
@@ -60,7 +58,7 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
@Nullable
@Override
public DBPDataSourceContainer getDataSource(@NotNull String id) {
public DBPDataSourceContainer getDataSource(String id) {
DBPDataSourceContainer dataSource = dataSourceRegistry.getDataSource(id);
if (dataSource == null || dataSourceFilter != null && !dataSourceFilter.filter(dataSource)) {
return null;
@@ -70,7 +68,7 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
@Nullable
@Override
public DBPDataSourceContainer getDataSource(@NotNull DBPDataSource dataSource) {
public DBPDataSourceContainer getDataSource(DBPDataSource dataSource) {
if (dataSourceFilter != null && !dataSourceFilter.filter(dataSource.getContainer())) {
return null;
}
@@ -109,13 +107,13 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
@NotNull
@Override
public DBPDataSourceContainer createDataSource(@NotNull DBPDriver driver, @NotNull DBPConnectionConfiguration connConfig) {
public DBPDataSourceContainer createDataSource(DBPDriver driver, DBPConnectionConfiguration connConfig) {
return dataSourceRegistry.createDataSource(driver, connConfig);
}
@NotNull
@Override
public DBPDataSourceContainer createDataSource(@NotNull DBPDataSourceContainer source) {
public DBPDataSourceContainer createDataSource(DBPDataSourceContainer source) {
return dataSourceRegistry.createDataSource(source);
}
@@ -166,20 +164,18 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
return dataSourceRegistry.getRootFolders();
}
@Nullable
@Override
public DBPDataSourceFolder getFolder(@NotNull String path) {
public DBPDataSourceFolder getFolder(String path) {
return dataSourceRegistry.getFolder(path);
}
@NotNull
@Override
public DBPDataSourceFolder addFolder(@Nullable DBPDataSourceFolder parent, @NotNull String name) {
public DBPDataSourceFolder addFolder(DBPDataSourceFolder parent, String name) {
return dataSourceRegistry.addFolder(parent, name);
}
@Override
public void removeFolder(@NotNull DBPDataSourceFolder folder, boolean dropContents) {
public void removeFolder(DBPDataSourceFolder folder, boolean dropContents) {
dataSourceRegistry.removeFolder(folder, dropContents);
}
@@ -201,19 +197,19 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
}
@Override
public void updateSavedFilter(@NotNull DBSObjectFilter filter) {
public void updateSavedFilter(DBSObjectFilter filter) {
dataSourceRegistry.updateSavedFilter(filter);
}
@Override
public void removeSavedFilter(@NotNull String filterName) {
public void removeSavedFilter(String filterName) {
dataSourceRegistry.removeSavedFilter(filterName);
}
@Nullable
@Override
public DBWNetworkProfile getNetworkProfile(@Nullable String source, @NotNull String name) {
return dataSourceRegistry.getNetworkProfile(source, name);
public DBWNetworkProfile getNetworkProfile(String name) {
return dataSourceRegistry.getNetworkProfile(name);
}
@NotNull
@@ -223,18 +219,18 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
}
@Override
public void updateNetworkProfile(@NotNull DBWNetworkProfile profile) {
public void updateNetworkProfile(DBWNetworkProfile profile) {
dataSourceRegistry.updateNetworkProfile(profile);
}
@Override
public void removeNetworkProfile(@NotNull DBWNetworkProfile profile) {
public void removeNetworkProfile(DBWNetworkProfile profile) {
dataSourceRegistry.removeNetworkProfile(profile);
}
@Nullable
@Override
public DBAAuthProfile getAuthProfile(@NotNull String id) {
public DBAAuthProfile getAuthProfile(String id) {
return dataSourceRegistry.getAuthProfile(id);
}
@@ -251,17 +247,12 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
}
@Override
public void updateAuthProfile(@NotNull DBAAuthProfile profile) {
public void updateAuthProfile(DBAAuthProfile profile) {
dataSourceRegistry.updateAuthProfile(profile);
}
@Override
public void setAuthProfiles(@NotNull Collection<DBAAuthProfile> profiles) {
dataSourceRegistry.setAuthProfiles(profiles);
}
@Override
public void removeAuthProfile(@NotNull DBAAuthProfile profile) {
public void removeAuthProfile(DBAAuthProfile profile) {
dataSourceRegistry.removeAuthProfile(profile);
}
@@ -280,7 +271,6 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
dataSourceRegistry.refreshConfig(dataSourceIds);
}
@Nullable
@Override
public Throwable getLastError() {
return dataSourceRegistry.getLastError();
@@ -297,7 +287,7 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
}
@Override
public void notifyDataSourceListeners(@NotNull DBPEvent event) {
public void notifyDataSourceListeners(DBPEvent event) {
dataSourceRegistry.notifyDataSourceListeners(event);
}
@@ -317,18 +307,11 @@ public class WebDataSourceRegistryProxy implements DBPDataSourceRegistry, DataSo
dataSourceRegistry.setAuthCredentialsProvider(authCredentialsProvider);
}
@NotNull
@Override
public Set<DBPDataSourceFolder> getTemporaryFolders() {
return dataSourceRegistry.getTemporaryFolders();
}
@NotNull
@Override
public DBPPreferenceStore getPreferenceStore() {
return dataSourceRegistry.getPreferenceStore();
}
@Override
public boolean loadDataSources(
@NotNull List<DBPDataSourceConfigurationStorage> storages,
@@ -1,38 +0,0 @@
/*
* 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;
import io.cloudbeaver.model.session.WebHeadlessSession;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.rm.RMProject;
import org.jkiss.dbeaver.model.rm.RMUtils;
public class WebHeadlessSessionProjectImpl extends WebProjectImpl {
public WebHeadlessSessionProjectImpl(
@NotNull WebHeadlessSession session,
@NotNull RMProject project
) {
super(
session.getWorkspace(),
session.getUserContext().getRmController(),
session.getSessionContext(),
project,
session.getUserContext().getPreferenceStore(),
RMUtils.getProjectPath(project)
);
}
}
@@ -1,28 +0,0 @@
/*
* 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;
import org.jkiss.dbeaver.model.DBPPage;
import org.jkiss.dbeaver.model.data.json.JSONUtils;
import java.util.Map;
public class WebPage extends DBPPage {
public WebPage(Map<String, Object> params) {
super(JSONUtils.getInteger(params, "offset"), JSONUtils.getInteger(params, "limit"));
}
}
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -17,39 +17,29 @@
package io.cloudbeaver;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.app.DBPDataSourceRegistry;
import org.jkiss.dbeaver.model.app.DBPWorkspace;
import org.jkiss.dbeaver.model.auth.SMSessionContext;
import org.jkiss.dbeaver.model.preferences.DBPPreferenceStore;
import org.jkiss.dbeaver.model.rm.RMController;
import org.jkiss.dbeaver.model.rm.RMProject;
import org.jkiss.dbeaver.model.task.DBTTaskManager;
import org.jkiss.dbeaver.registry.rm.DataSourceRegistryRM;
import org.jkiss.dbeaver.runtime.DBWorkbench;
import java.nio.file.Path;
public abstract class WebProjectImpl extends BaseWebProjectImpl {
public class WebProjectImpl extends BaseWebProjectImpl {
private static final Log log = Log.getLog(WebProjectImpl.class);
@NotNull
protected final DBPPreferenceStore preferenceStore;
public WebProjectImpl(
@NotNull DBPWorkspace workspace,
@NotNull RMController resourceController,
@NotNull SMSessionContext sessionContext,
@NotNull RMProject project,
@NotNull DBPPreferenceStore preferenceStore,
@NotNull Path path
@NotNull DataSourceFilter dataSourceFilter
) {
super(workspace, resourceController, sessionContext, project, path);
this.preferenceStore = preferenceStore;
super(workspace, resourceController, sessionContext, project, dataSourceFilter);
}
@Nullable
@Override
public Object getProjectProperty(String propName) {
try {
@@ -61,7 +51,7 @@ public abstract class WebProjectImpl extends BaseWebProjectImpl {
}
@Override
public void setProjectProperty(@NotNull String propName, @Nullable Object propValue) {
public void setProjectProperty(String propName, Object propValue) {
try {
getResourceController().setProjectProperty(getId(), propName, propValue);
} catch (DBException e) {
@@ -74,24 +64,13 @@ public abstract class WebProjectImpl extends BaseWebProjectImpl {
return DBWorkbench.isDistributed();
}
@NotNull
@Override
public DBTTaskManager getTaskManager() {
throw new IllegalStateException("Task manager not supported");
}
@NotNull
@Override
protected DBPDataSourceRegistry createDataSourceRegistry() {
return new WebDataSourceRegistryProxy(
new DataSourceRegistryRM(this, getResourceController(), preferenceStore),
getDataSourceFilter()
new DataSourceRegistryRM(this, getResourceController()),
dataSourceFilter
);
}
@NotNull
public DataSourceFilter getDataSourceFilter() {
return (ds) -> true;
}
}
@@ -1,118 +0,0 @@
/*
* 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;
import io.cloudbeaver.model.session.WebSession;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.DBPEvent;
import org.jkiss.dbeaver.model.rm.RMProject;
import org.jkiss.dbeaver.model.security.SMObjectType;
import org.jkiss.dbeaver.model.security.user.SMObjectPermissions;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
/**
* Global project.
* Connections there can be not accessible.
*/
public class WebSessionGlobalProjectImpl extends WebSessionProjectImpl {
private static final Log log = Log.getLog(WebSessionGlobalProjectImpl.class);
private Set<String> accessibleConnectionIds = Collections.emptySet();
public WebSessionGlobalProjectImpl(@NotNull WebSession webSession, @NotNull RMProject project) {
super(webSession, project);
}
/**
* Update info about accessible connections from a database.
*/
public synchronized void refreshAccessibleConnectionIds() {
this.accessibleConnectionIds = readAccessibleConnectionIds();
}
@NotNull
private Set<String> readAccessibleConnectionIds() {
try {
return webSession.getSecurityController()
.getAllAvailableObjectsPermissions(SMObjectType.datasource)
.stream()
.map(SMObjectPermissions::getObjectId)
.collect(Collectors.toSet());
} catch (DBException e) {
webSession.addSessionError(e);
log.error("Error reading connection grants", e);
return Collections.emptySet();
}
}
/**
* Checks if connection is accessible for current user.
*/
public boolean isDataSourceAccessible(@NotNull DBPDataSourceContainer dataSource) {
return dataSource.isExternallyProvided() ||
dataSource.isTemporary() ||
webSession.hasPermission(DBWConstants.PERMISSION_ADMIN) ||
accessibleConnectionIds.contains(dataSource.getId());
}
/**
* Adds a connection if it became accessible.
* The method is processed when connection permissions were updated.
*/
public synchronized void addAccessibleConnectionToCache(@NotNull String dsId) {
if (!getRMProject().isGlobal()) {
return;
}
this.accessibleConnectionIds.add(dsId);
var registry = getDataSourceRegistry();
var dataSource = registry.getDataSource(dsId);
if (dataSource != null) {
addConnection(dataSource);
// reflect changes is navigator model
registry.notifyDataSourceListeners(new DBPEvent(DBPEvent.Action.OBJECT_ADD, dataSource, true));
}
}
/**
* Removes a connection if it became not accessible.
* The method is processed when connection permissions were updated.
*/
public synchronized void removeAccessibleConnectionFromCache(@NotNull String dsId) {
if (!getRMProject().isGlobal()) {
return;
}
var registry = getDataSourceRegistry();
var dataSource = registry.getDataSource(dsId);
if (dataSource != null) {
this.accessibleConnectionIds.remove(dsId);
removeConnection(dataSource);
// reflect changes is navigator model
registry.notifyDataSourceListeners(new DBPEvent(DBPEvent.Action.OBJECT_REMOVE, dataSource));
dataSource.dispose();
}
}
@NotNull
public DataSourceFilter getDataSourceFilter() {
return this::isDataSourceAccessible;
}
}
@@ -1,233 +0,0 @@
/*
* 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;
import io.cloudbeaver.model.WebConnectionInfo;
import io.cloudbeaver.model.session.WebSession;
import io.cloudbeaver.utils.WebDataSourceUtils;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.app.DBPDataSourceRegistry;
import org.jkiss.dbeaver.model.app.DBPDataSourceRegistryCache;
import org.jkiss.dbeaver.model.navigator.DBNModel;
import org.jkiss.dbeaver.model.rm.RMProject;
import org.jkiss.dbeaver.model.rm.RMUtils;
import org.jkiss.dbeaver.model.websocket.event.WSEventType;
import org.jkiss.dbeaver.registry.DataSourceDescriptor;
import org.jkiss.dbeaver.runtime.jobs.DisconnectJob;
import java.nio.file.Path;
import java.util.*;
import java.util.stream.Collectors;
public class WebSessionProjectImpl extends WebProjectImpl {
private static final Log log = Log.getLog(WebSessionProjectImpl.class);
protected final WebSession webSession;
private final Map<String, WebConnectionInfo> connections = new HashMap<>();
private boolean registryIsLoaded = false;
public WebSessionProjectImpl(
@NotNull WebSession webSession,
@NotNull RMProject project
) {
super(
webSession.getWorkspace(),
webSession.getRmController(),
webSession.getSessionContext(),
project,
webSession.getUserPreferenceStore(),
RMUtils.getProjectPath(project)
);
this.webSession = webSession;
}
public WebSessionProjectImpl(
@NotNull WebSession webSession,
@NotNull RMProject project,
@NotNull Path path
) {
super(
webSession.getWorkspace(),
webSession.getRmController(),
webSession.getSessionContext(),
project,
webSession.getUserPreferenceStore(),
path
);
this.webSession = webSession;
}
@Nullable
@Override
public DBNModel getNavigatorModel() {
return webSession.getNavigatorModel();
}
@NotNull
@Override
protected DBPDataSourceRegistry createDataSourceRegistry() {
DBPDataSourceRegistry dataSourceRegistry = super.createDataSourceRegistry();
dataSourceRegistry.setAuthCredentialsProvider(webSession);
return dataSourceRegistry;
}
private synchronized void addDataSourcesToCache() {
if (registryIsLoaded) {
return;
}
getDataSourceRegistry().getDataSources().forEach(this::addConnection);
Throwable lastError = getDataSourceRegistry().getLastError();
if (lastError != null) {
webSession.addSessionError(lastError);
log.error("Error refreshing connections from project '" + getId() + "'", lastError);
}
registryIsLoaded = true;
}
@Override
public void dispose() {
super.dispose();
Map<String, WebConnectionInfo> conCopy;
synchronized (this.connections) {
conCopy = new HashMap<>(this.connections);
this.connections.clear();
}
for (WebConnectionInfo connectionInfo : conCopy.values()) {
if (connectionInfo.isConnected()) {
new DisconnectJob(connectionInfo.getDataSourceContainer()).schedule();
}
}
}
/**
* Returns web connection info from cache (if exists).
*/
@Nullable
public WebConnectionInfo findWebConnectionInfo(@NotNull String connectionId) {
synchronized (connections) {
return connections.get(connectionId);
}
}
/**
* Returns web connection info from cache, adds it to cache if not present.
* Throws exception if connection is not found.
*/
@NotNull
public WebConnectionInfo getWebConnectionInfo(@NotNull String connectionId) throws DBWebException {
WebConnectionInfo connectionInfo = findWebConnectionInfo(connectionId);
if (connectionInfo != null) {
return connectionInfo;
}
DBPDataSourceContainer dataSource = getDataSourceRegistry().getDataSource(connectionId);
if (dataSource != null) {
return addConnection(dataSource);
}
throw new DBWebException("Connection '%s' not found".formatted(connectionId));
}
/**
* Adds connection to project cache.
*/
@NotNull
public synchronized WebConnectionInfo addConnection(@NotNull DBPDataSourceContainer dataSourceContainer) {
WebConnectionInfo connection = new WebConnectionInfo(webSession, dataSourceContainer);
synchronized (connections) {
connections.put(dataSourceContainer.getId(), connection);
}
return connection;
}
/**
* Removes connection from project cache.
*/
public void removeConnection(@NotNull DBPDataSourceContainer dataSourceContainer) {
WebConnectionInfo webConnectionInfo = connections.get(dataSourceContainer.getId());
if (webConnectionInfo != null) {
webConnectionInfo.clearCache();
synchronized (connections) {
connections.remove(dataSourceContainer.getId());
}
}
}
/**
* Loads connection from registry if they are not loaded.
*
* @return connections from cache.
*/
public List<WebConnectionInfo> getConnections() {
if (!registryIsLoaded) {
addDataSourcesToCache();
registryIsLoaded = true;
}
synchronized (connections) {
return new ArrayList<>(connections.values());
}
}
/**
* updates data sources based on event in web session
*
* @param dataSourceIds list of updated connections
* @param type type of event
*/
public synchronized boolean updateProjectDataSources(@NotNull List<String> dataSourceIds, @NotNull WSEventType type) {
var sendDataSourceUpdatedEvent = false;
DBPDataSourceRegistry registry = getDataSourceRegistry();
// save old connections
var oldDataSources = dataSourceIds.stream()
.map(registry::getDataSource)
.filter(Objects::nonNull)
.collect(Collectors.toMap(
DBPDataSourceContainer::getId,
ds -> new DataSourceDescriptor((DataSourceDescriptor) ds, ds.getRegistry())
));
if (type == WSEventType.DATASOURCE_CREATED || type == WSEventType.DATASOURCE_UPDATED) {
registry.refreshConfig(dataSourceIds);
}
for (String dsId : dataSourceIds) {
DataSourceDescriptor ds = (DataSourceDescriptor) registry.getDataSource(dsId);
if (ds == null) {
continue;
}
switch (type) {
case DATASOURCE_CREATED -> {
addConnection(ds);
sendDataSourceUpdatedEvent = true;
}
case DATASOURCE_UPDATED -> // if settings were changed we need to send event
sendDataSourceUpdatedEvent |= !ds.equalSettings(oldDataSources.get(dsId));
case DATASOURCE_DELETED -> {
WebDataSourceUtils.disconnectDataSource(webSession, ds);
if (registry instanceof DBPDataSourceRegistryCache dsrc) {
dsrc.removeDataSourceFromList(ds);
}
removeConnection(ds);
sendDataSourceUpdatedEvent = true;
}
default -> {
}
}
}
return sendDataSourceUpdatedEvent;
}
}
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -25,7 +25,6 @@ public interface CBAuthConstants {
String CB_AUTH_ID_REQUEST_PARAM = "authId";
String CB_AUTO_LOGIN_REQUEST_PARAM = "autoLogin";
String CB_REDIRECT_URL_REQUEST_PARAM = "redirectUrl";
String CB_FORCE_SESSIONS_LOGOUT = "forceSessionsLogout";
// Default max idle time (10 minutes)
long MAX_SESSION_IDLE_TIME = 10 * 60 * 1000;
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -19,7 +19,6 @@ package io.cloudbeaver.auth;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.security.SMAuthProviderCustomConfiguration;
import java.util.Map;
@@ -32,7 +31,7 @@ public interface SMAuthProviderAssigner {
@NotNull
SMAutoAssign detectAutoAssignments(
@NotNull DBRProgressMonitor monitor,
@NotNull SMAuthProviderCustomConfiguration providerConfig,
@NotNull Map<String, Object> providerConfig,
@NotNull Map<String, Object> authParameters
) throws DBException;
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -26,7 +26,6 @@ import org.jkiss.dbeaver.model.DBPObject;
import org.jkiss.dbeaver.model.auth.SMAuthProvider;
import org.jkiss.dbeaver.model.auth.SMSession;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.security.SMAuthProviderCustomConfiguration;
import java.util.Map;
@@ -42,7 +41,7 @@ public interface SMAuthProviderExternal<AUTH_SESSION extends SMSession> extends
@NotNull
default Map<String, Object> authExternalUser(
@NotNull DBRProgressMonitor monitor,
@Nullable SMAuthProviderCustomConfiguration providerConfig, // Auth provider configuration (e.g. 3rd party auth server address)
@NotNull Map<String, Object> providerConfig, // Auth provider configuration (e.g. 3rd party auth server address)
@NotNull Map<String, Object> authParameters // Passed auth parameters (e.g. user name or password)
) throws DBException {
return authParameters;
@@ -52,7 +51,7 @@ public interface SMAuthProviderExternal<AUTH_SESSION extends SMSession> extends
@NotNull
DBWUserIdentity getUserIdentity(
@NotNull DBRProgressMonitor monitor,
@Nullable SMAuthProviderCustomConfiguration customConfiguration,
@NotNull Map<String, Object> providerConfig,
@NotNull Map<String, Object> authParameters) throws DBException;
/**
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -19,7 +19,6 @@ package io.cloudbeaver.auth;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.security.SMAuthProviderCustomConfiguration;
import java.util.Map;
@@ -27,28 +26,21 @@ import java.util.Map;
* Federated auth provider.
* Provides links to external auth resource
*/
public interface SMAuthProviderFederated extends SMSignOutLinkProvider {
public interface SMAuthProviderFederated {
/**
* Returns new identifying credentials which can be used to find/create user in database
*/
@NotNull
String getSignInLink(String id, @NotNull Map<String, Object> providerConfig) throws DBException;
@Override
default String getUserSignOutLink(
@NotNull SMAuthProviderCustomConfiguration providerConfig,
@NotNull Map<String, Object> userCredentials
) throws DBException {
return getCommonSignOutLink(providerConfig.getId(), providerConfig.getParameters());
}
@NotNull
String getSignOutLink(String id, @NotNull Map<String, Object> providerConfig) throws DBException;
@Nullable
String getMetadataLink(String id, @NotNull Map<String, Object> providerConfig) throws DBException;
@Nullable
String getAcsLink(String id, @NotNull Map<String, Object> providerConfig) throws DBException;
@Nullable
String getEntityIdLink(String id, @NotNull Map<String, Object> providerConfig) throws DBException;
@Nullable
default String getRedirectLink(String id, @NotNull Map<String, Object> providerConfig) throws DBException {
return null;
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,25 +0,0 @@
/*
* 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.auth;
import org.jkiss.code.NotNull;
import java.util.Map;
public interface SMBruteForceProtected {
Object getInputUsername(@NotNull Map<String, Object> cred);
}
@@ -1,37 +0,0 @@
/*
* 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.auth;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.security.SMAuthProviderCustomConfiguration;
import java.util.Map;
public interface SMSignOutLinkProvider {
/**
* @return a common link for logout, not related with the user context
*/
@NotNull
String getCommonSignOutLink(String id, @NotNull Map<String, Object> providerConfig) throws DBException;
String getUserSignOutLink(
@NotNull SMAuthProviderCustomConfiguration providerConfig,
@NotNull Map<String, Object> userCredentials
) throws DBException;
}
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,79 +0,0 @@
/*
* 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.auth.provider.fa;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.auth.*;
import java.time.LocalDateTime;
import java.util.Map;
public abstract class AbstractSessionExternal implements SMSessionExternal {
@NotNull
protected final Map<String, Object> authParameters;
@NotNull
protected final SMSession parentSession;
@NotNull
protected final SMAuthSpace space;
protected AbstractSessionExternal(
@NotNull SMSession parentSession,
@NotNull SMAuthSpace space,
@NotNull Map<String, Object> authParameters
) {
this.parentSession = parentSession;
this.space = space;
this.authParameters = authParameters;
}
@NotNull
@Override
public SMAuthSpace getSessionSpace() {
return space;
}
@NotNull
@Override
public SMSessionContext getSessionContext() {
return this.parentSession.getSessionContext();
}
@Nullable
@Override
public SMSessionPrincipal getSessionPrincipal() {
return parentSession.getSessionPrincipal();
}
@NotNull
@Override
public LocalDateTime getSessionStart() {
return parentSession.getSessionStart();
}
@Override
public void close() {
// do nothing
}
@Override
public Map<String, Object> getAuthParameters() {
return authParameters;
}
}
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,38 +0,0 @@
/*
* 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.auth.provisioning;
import io.cloudbeaver.model.session.WebSession;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.security.SMAuthProviderCustomConfiguration;
import org.jkiss.dbeaver.model.security.user.SMUserProvisioning;
import java.util.List;
public interface SMProvisioner {
@NotNull
List<SMUserProvisioning> listExternalUsers(
@NotNull WebSession webSession,
@NotNull SMAuthProviderCustomConfiguration customConfiguration,
@NotNull SMProvisioningFilter filter
) throws DBException;
default boolean isAuthRoleProvided(SMAuthProviderCustomConfiguration configuration) {
return false;
}
}
@@ -1,28 +0,0 @@
package io.cloudbeaver.auth.provisioning;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.data.json.JSONUtils;
import java.util.Map;
public class SMProvisioningFilter {
@Nullable
private final Integer offset;
@Nullable
private final Integer limit;
public SMProvisioningFilter(Map<String, Object> params) {
this.offset = JSONUtils.getInteger(params, "offset");
this.limit = JSONUtils.getInteger(params, "limit");
}
@Nullable
public Integer getOffset() {
return offset;
}
@Nullable
public Integer getLimit() {
return limit;
}
}
@@ -1,30 +0,0 @@
package io.cloudbeaver.model;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.DBPDataSourceHandler;
import org.jkiss.dbeaver.model.connection.DBPDriver;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
public abstract class BaseDatasourceAccessCheckHandler implements DBPDataSourceHandler {
@Override
public void beforeConnect(
DBRProgressMonitor monitor,
@NotNull DBPDataSourceContainer dataSourceContainer
) throws DBException {
if (isDriverDisabled(dataSourceContainer.getDriver())) {
throw new DBException("Driver disabled");
}
}
@Override
public void beforeDisconnect(
DBRProgressMonitor monitor,
@NotNull DBPDataSourceContainer dataSourceContainer
) throws DBException {
}
protected abstract boolean isDriverDisabled(DBPDriver driver);
}
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -24,11 +24,11 @@ import io.cloudbeaver.service.sql.WebDataFormat;
import io.cloudbeaver.utils.CBModelConstants;
import io.cloudbeaver.utils.WebAppUtils;
import io.cloudbeaver.utils.WebCommonUtils;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.*;
import org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionManager;
import org.jkiss.dbeaver.model.DBConstants;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.DBPDataSourceFolder;
import org.jkiss.dbeaver.model.app.DBPProject;
import org.jkiss.dbeaver.model.connection.DBPAuthModelDescriptor;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
@@ -39,9 +39,7 @@ import org.jkiss.dbeaver.model.navigator.DBNBrowseSettings;
import org.jkiss.dbeaver.model.navigator.DBNDataSource;
import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor;
import org.jkiss.dbeaver.model.preferences.DBPPropertySource;
import org.jkiss.dbeaver.model.rm.RMConstants;
import org.jkiss.dbeaver.model.rm.RMProjectPermission;
import org.jkiss.dbeaver.model.runtime.DBRRunnableParametrized;
import org.jkiss.dbeaver.runtime.DBWorkbench;
import org.jkiss.utils.CommonUtils;
@@ -54,19 +52,7 @@ import java.util.stream.Collectors;
*/
public class WebConnectionInfo {
private static final Log log = Log.getLog(WebConnectionInfo.class);
public static final String SECURED_VALUE = "********";
private static final String FEATURE_HAS_TOOLS = "hasTools";
private static final String FEATURE_CONNECTED = "connected";
private static final String FEATURE_VIRTUAL = "virtual";
private static final String FEATURE_TEMPORARY = "temporary";
private static final String FEATURE_READ_ONLY = "readOnly";
private static final String FEATURE_PROVIDED = "provided";
private static final String FEATURE_MANAGEABLE = "manageable";
private static final String TOOL_SESSION_MANAGER = "sessionManager";
private static final String SECURED_VALUE = "********";
private final WebSession session;
private final DBPDataSourceContainer dataSourceContainer;
private WebServerError connectError;
@@ -77,7 +63,6 @@ public class WebConnectionInfo {
private transient Map<String, Object> savedAuthProperties;
private transient List<WebNetworkHandlerConfigInput> savedNetworkCredentials;
private transient List<DBRRunnableParametrized<WebConnectionInfo>> closeListeners = null;
public WebConnectionInfo(WebSession session, DBPDataSourceContainer ds) {
this.session = session;
@@ -254,25 +239,22 @@ public class WebConnectionInfo {
List<String> features = new ArrayList<>();
if (dataSourceContainer.isConnected()) {
features.add(FEATURE_CONNECTED);
if (!getTools().isEmpty()) {
features.add(FEATURE_HAS_TOOLS);
}
features.add("connected");
}
if (dataSourceContainer.isHidden()) {
features.add(FEATURE_VIRTUAL);
features.add("virtual");
}
if (dataSourceContainer.isTemporary()) {
features.add(FEATURE_TEMPORARY);
features.add("temporary");
}
if (dataSourceContainer.isConnectionReadOnly()) {
features.add(FEATURE_READ_ONLY);
features.add("readOnly");
}
if (dataSourceContainer.isProvided()) {
features.add(FEATURE_PROVIDED);
features.add("provided");
}
if (dataSourceContainer.isManageable()) {
features.add(FEATURE_MANAGEABLE);
features.add("manageable");
}
return features.toArray(new String[0]);
@@ -340,8 +322,9 @@ public class WebConnectionInfo {
return new WebPropertyInfo[0];
}
// Fill user provided credentials
// Fill session and user provided credentials
DBPConnectionConfiguration configWithAuth = new DBPConnectionConfiguration(dataSourceContainer.getConnectionConfiguration());
session.provideAuthParameters(session.getProgressMonitor(), dataSourceContainer, configWithAuth);
// show all properties if it is a manual connection
Predicate<DBPPropertyDescriptor> predicate = CommonUtils.isEmpty(getRequiredAuth())
@@ -379,33 +362,9 @@ public class WebConnectionInfo {
this.savedNetworkCredentials = networkCredentials;
}
public void clearCache() {
public void clearSavedCredentials() {
this.savedAuthProperties = null;
this.savedNetworkCredentials = null;
this.fireCloseListeners();
}
public void fireCloseListeners() {
if (closeListeners != null) {
for (DBRRunnableParametrized<WebConnectionInfo> listener : closeListeners) {
try {
listener.run(this);
} catch (Exception e) {
log.debug(e);
}
}
closeListeners = null;
}
}
@Property
public Map<String, String> getMainPropertyValues() {
Map<String, String> mainProperties = new LinkedHashMap<>();
mainProperties.put(DBConstants.PROP_HOST, getHost());
mainProperties.put(DBConstants.PROP_PORT, getPort());
mainProperties.put(DBConstants.PROP_DATABASE, getDatabaseName());
mainProperties.put(DBConstants.PROP_SERVER, getServerName());
return mainProperties;
}
@Property
@@ -445,10 +404,10 @@ public class WebConnectionInfo {
private boolean hasProjectPermission(RMProjectPermission projectPermission) {
DBPProject project = dataSourceContainer.getProject();
if (!(project instanceof WebProjectImpl webProject)) {
if (!(project instanceof WebProjectImpl)) {
return false;
}
return SMUtils.hasProjectPermission(session, webProject.getRMProject(), projectPermission);
return SMUtils.hasProjectPermission(session, ((WebProjectImpl) project).getRmProject(), projectPermission);
}
private boolean canViewReadOnlyConnections() {
@@ -459,48 +418,4 @@ public class WebConnectionInfo {
return appConfig.isShowReadOnlyConnectionInfo();
}
public void addCloseListener(DBRRunnableParametrized<WebConnectionInfo> listener) {
if (closeListeners == null) {
closeListeners = new ArrayList<>();
}
closeListeners.add(listener);
}
@Property
public int getKeepAliveInterval() {
return dataSourceContainer.getConnectionConfiguration().getKeepAliveInterval();
}
@Property
public boolean isAutocommit() {
Boolean isAutoCommit = dataSourceContainer.getConnectionConfiguration().getBootstrap().getDefaultAutoCommit();
if (isAutoCommit == null) {
return true;
}
return isAutoCommit;
}
@Property
public List<WebSecretInfo> getSharedSecrets() throws DBException {
return dataSourceContainer.listSharedCredentials()
.stream()
.map(WebSecretInfo::new)
.collect(Collectors.toList());
}
@NotNull
@Property
public List<String> getTools() {
if (!session.hasPermission(RMConstants.PERMISSION_DATABASE_DEVELOPER)) {
return List.of();
}
List<String> tools = new ArrayList<>();
// checks inside that datasource is not null in container, and it is adaptable to session manager class
if (DBUtils.getAdapter(DBAServerSessionManager.class, dataSourceContainer) != null) {
tools.add(TOOL_SESSION_MANAGER);
}
return tools;
}
}
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -20,11 +20,8 @@ import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.net.DBWHandlerConfiguration;
import org.jkiss.dbeaver.model.net.DBWHandlerType;
import org.jkiss.dbeaver.model.net.ssh.SSHConstants;
import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor;
import org.jkiss.dbeaver.registry.RegistryConstants;
import org.jkiss.utils.CommonUtils;
import java.util.LinkedHashMap;
import java.util.Map;
/**
@@ -55,7 +52,6 @@ public class WebNetworkHandlerConfig {
return configuration.isEnabled();
}
@Deprecated
public SSHConstants.AuthType getAuthType() {
return CommonUtils.valueOf(SSHConstants.AuthType.class, configuration.getStringProperty(SSHConstants.PROP_AUTH_TYPE), SSHConstants.AuthType.PASSWORD);
}
@@ -68,7 +64,7 @@ public class WebNetworkHandlerConfig {
return CommonUtils.isEmpty(configuration.getPassword()) ? null : "";
}
@Deprecated // use secure properties
public String getKey() {
return CommonUtils.isEmpty(configuration.getSecureProperty(SSHConstants.PROP_KEY_VALUE)) ? null : "";
}
@@ -82,16 +78,4 @@ public class WebNetworkHandlerConfig {
return configuration.getProperties();
}
@NotNull
public Map<String, String> getSecureProperties() {
Map<String, String> secureProperties = new LinkedHashMap<>(configuration.getSecureProperties());
DBPPropertyDescriptor[] descriptor = configuration.getHandlerDescriptor().getHandlerProperties();
for (DBPPropertyDescriptor p : descriptor) {
if (p.hasFeature(RegistryConstants.ATTR_PASSWORD)) {
secureProperties.computeIfPresent(p.getId(), (k, v) -> CommonUtils.isEmpty(v) ? null : WebConnectionInfo.SECURED_VALUE);
}
}
return secureProperties;
}
}
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -20,7 +20,6 @@ import org.jkiss.dbeaver.model.data.json.JSONUtils;
import org.jkiss.dbeaver.model.net.DBWHandlerType;
import org.jkiss.utils.CommonUtils;
import java.util.LinkedHashMap;
import java.util.Map;
/**
@@ -62,7 +61,6 @@ public class WebNetworkHandlerConfigInput {
return JSONUtils.getString(cfg, "password");
}
@Deprecated // use secured properties
public String getKey() {
return JSONUtils.getString(cfg, "key");
}
@@ -79,16 +77,4 @@ public class WebNetworkHandlerConfigInput {
return JSONUtils.getObjectOrNull(cfg, "properties");
}
public Map<String, String> getSecureProperties() {
var secureProperties = JSONUtils.getObjectOrNull(cfg, "secureProperties");
if (secureProperties == null) {
return null;
}
var result = new LinkedHashMap<String, String>();
for (Map.Entry<String, Object> property : secureProperties.entrySet()) {
result.put(property.getKey(), CommonUtils.toString(property.getValue()));
}
return result;
}
}
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -27,6 +27,7 @@ import org.jkiss.dbeaver.model.rm.RMResourceType;
import org.jkiss.utils.ArrayUtils;
import java.util.ArrayList;
import java.util.Collections;
public class WebProjectInfo {
private final WebSession session;
@@ -53,13 +54,11 @@ public class WebProjectInfo {
}
@Property
public boolean isGlobal() {
return project.getRMProject().isGlobal();
}
public boolean isGlobal() { return project.getRmProject().isGlobal(); }
@Property
public boolean isShared() {
return project.getRMProject().isShared();
return project.getRmProject().isShared();
}
@Property
@@ -74,7 +73,7 @@ public class WebProjectInfo {
@Property
public boolean isCanEditDataSources() {
if (project.getRMProject().getType() == RMProjectType.USER && !customPrivateConnectionsEnabled) {
if (project.getRmProject().getType() == RMProjectType.USER && !customPrivateConnectionsEnabled) {
return false;
}
return hasDataSourcePermission(RMProjectPermission.DATA_SOURCES_EDIT);
@@ -96,12 +95,12 @@ public class WebProjectInfo {
}
private boolean hasDataSourcePermission(RMProjectPermission permission) {
return SMUtils.hasProjectPermission(session, project.getRMProject(), permission);
return SMUtils.hasProjectPermission(session, project.getRmProject(), permission);
}
@Property
public RMResourceType[] getResourceTypes() {
RMResourceType[] resourceTypes = project.getRMProject().getResourceTypes();
RMResourceType[] resourceTypes = project.getRmProject().getResourceTypes();
if(resourceTypes == null) {
return ArrayUtils.toArray(RMResourceType.class, new ArrayList<>());
@@ -1,6 +1,6 @@
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2024 DBeaver Corp and others
* Copyright (C) 2010-2023 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.
@@ -18,7 +18,6 @@ package io.cloudbeaver.model;
import io.cloudbeaver.model.session.WebSession;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.*;
import org.jkiss.dbeaver.model.connection.DBPDriverConfigurationType;
@@ -28,7 +27,6 @@ import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.meta.PropertyLength;
import org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor;
import org.jkiss.dbeaver.model.preferences.DBPPropertySource;
import org.jkiss.dbeaver.registry.settings.ProductSettingDescriptor;
import org.jkiss.dbeaver.runtime.properties.ObjectPropertyDescriptor;
import org.jkiss.utils.CommonUtils;
@@ -90,11 +88,6 @@ public class WebPropertyInfo {
}
}
@Property
public String getHint() {
return property.getHint();
}
@Property
public int getOrder() {
return property instanceof ObjectPropertyDescriptor ? ((ObjectPropertyDescriptor) property).getOrderNumber() : -1;
@@ -123,8 +116,7 @@ public class WebPropertyInfo {
@Property
public Object getDefaultValue() throws DBException {
var defaultValue = property.getDefaultValue();
return defaultValue == null ? getValue() : defaultValue;
return property.getDefaultValue();
}
@Property
@@ -175,11 +167,6 @@ public class WebPropertyInfo {
return new String[0];
}
@Property
public boolean isRequired() {
return property.isRequired();
}
public boolean hasFeature(@NotNull String feature) {
return property.hasFeature(feature);
}
@@ -244,12 +231,4 @@ public class WebPropertyInfo {
return CommonUtils.toString(value);
}
@Nullable
@Property
public List<String> getScopes() {
if (property instanceof ProductSettingDescriptor productSettingDescriptor) {
return productSettingDescriptor.getScopes();
}
return null;
}
}
@@ -1,38 +0,0 @@
/*
* 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.model;
import org.jkiss.dbeaver.model.meta.Property;
import org.jkiss.dbeaver.model.secret.DBSSecretValue;
public class WebSecretInfo {
private final DBSSecretValue secretValue;
public WebSecretInfo(DBSSecretValue secretValue) {
this.secretValue = secretValue;
}
@Property
public String getDisplayName() {
return secretValue.getDisplayName();
}
@Property
public String getSecretId() {
return secretValue.getUniqueId();
}
}

Some files were not shown because too many files have changed in this diff Show More