From d575751f35383caf2237058228220dfc7b00c002 Mon Sep 17 00:00:00 2001 From: Simon Graband Date: Fri, 23 Feb 2024 09:38:48 +0100 Subject: [PATCH 1/6] Provide conversion webhook for CRDs Webhook is called, whenever a CR is requested in a specific version. This allows for a better updating path, as old CRs are still useable. [conversion] Provide conversion java project: - A webhook that offers endpoints for the three CRD types - Is buildable as a runnable jar - Contains Mappers from all supported versions to a hub [common] Add Hub and previous version for all CRDs - The hub is a superset of all values of a CRD across all versions - Keep a copy of the old supported versions to transform back - This is useful, as this way the the old operator still works - Supported from these versions: - `AppDefintion.v1beta8` - `Session.v1beta6` - `Workspace.v1beta3` - To showcase the functionality update CRDs to new version: - Move status like fields to status: - `Session.v1beta7`: Move `url`, `lastActivity` and `error` fields from the spec to the status. - `Workspace.v1beta4`: Move the `error` field from the spec to the status. Also add the `error` field to `Workspace.v1beta3` as it was missing - Remove `timeout.strategy` from AppDefinition - `AppDefinition.v1beta9`: Removed `timeout.strategy` and `timeout.limit` is now just `timeout`. This was done, as there is only one Strategy left. [operator] Adjust operator so it works with the above changes. [service] Adjust service so it works with the above changes. [documentation] Add build command for `conversion-webhook` [.github] Add ci for `conversion-webhook` - Also fix publishing of new `next-version` (reusable typo) Contributed on behalf of STMicroelectronics Co-authored-by: Johannes Faltermeier --- .github/workflows/ci-conversion-webhook.yml | 34 ++ .github/workflows/ci-landing-page.yml | 2 +- .github/workflows/ci-monitor-theia.yml | 2 +- .github/workflows/ci-node-common.yml | 2 +- .github/workflows/ci-operator.yml | 2 +- .github/workflows/ci-service.yml | 2 +- .github/workflows/ci-try-now-page.yml | 2 +- .github/workflows/ci-wondershaper.yml | 2 +- CHANGELOG.md | 8 + dockerfiles/conversion-webhook/Dockerfile | 18 + documentation/Building.md | 6 + .../client/DefaultSessionResourceClient.java | 31 +- .../DefaultWorkspaceResourceClient.java | 20 +- .../resource/appdefinition/AppDefinition.java | 12 +- .../appdefinition/AppDefinitionSpec.java | 89 ++--- .../appdefinition/AppDefinitionStatus.java | 12 +- .../appdefinition/hub/AppDefinitionHub.java | 239 +++++++++++-- .../hub/AppDefinitionHubSpec.java | 315 ----------------- .../AppDefinitionV1beta8.java} | 22 +- .../AppDefinitionV1beta8Spec.java} | 66 ++-- ...AppDefinitionV1beta8SpecResourceList.java} | 8 +- .../AppDefinitionV1beta8Status.java} | 26 +- .../common/k8s/resource/session/Session.java | 12 +- .../k8s/resource/session/SessionSpec.java | 73 +--- .../k8s/resource/session/SessionStatus.java | 64 +++- .../k8s/resource/session/hub/SessionHub.java | 136 ++++++-- .../resource/session/hub/SessionHubSpec.java | 144 -------- .../session/hub/SessionHubStatus.java | 42 --- .../SessionV1beta6.java} | 21 +- .../SessionV1beta6Spec.java} | 51 +-- .../SessionV1beta6SpecResourceList.java} | 8 +- .../SessionV1beta6Status.java} | 25 +- .../k8s/resource/workspace/Workspace.java | 12 +- .../k8s/resource/workspace/WorkspaceSpec.java | 37 +- .../resource/workspace/WorkspaceStatus.java | 45 ++- .../resource/workspace/hub/WorkspaceHub.java | 153 +++++++-- .../workspace/hub/WorkspaceHubSpec.java | 78 ----- .../workspace/hub/WorkspaceHubStatus.java | 80 ----- .../WorkspaceV1beta3.java} | 22 +- .../WorkspaceV1beta3Spec.java} | 27 +- .../WorkspaceV1beta3SpecResourceList.java} | 8 +- .../WorkspaceV1beta3Status.java} | 33 +- ...c8.kubernetes.api.model.KubernetesResource | 6 +- .../.dockerignore | 5 + .../.gitignore | 41 +++ .../.mvn/wrapper/.gitignore | 1 + .../.mvn/wrapper/MavenWrapperDownloader.java | 98 ++++++ .../.mvn/wrapper/maven-wrapper.properties | 18 + .../README.md | 51 +++ .../Run Theia Cloud Conversion Hook.launch | 21 ++ .../org.eclipse.theia.cloud.conversion/mvnw | 316 ++++++++++++++++++ .../mvnw.cmd | 188 +++++++++++ .../pom.xml | 138 ++++++++ .../cloud/conversion/ConversionEndpoint.java | 94 ++++++ .../AppDefinitionV1beta8Mapper.java} | 36 +- .../AppDefinitionV1beta9Mapper.java | 37 ++ .../mappers/session/SessionV1beta6Mapper.java | 38 +++ .../mappers/session/SessionV1beta7Mapper.java | 37 ++ .../workspace/WorkspaceV1beta3Mapper.java | 37 ++ .../workspace/WorkspaceV1beta4Mapper.java | 37 ++ .../src/main/resources/application.properties | 2 + .../.gitignore | 2 + .../theia/cloud/operator/TheiaCloudImpl.java | 33 +- .../di/AbstractTheiaCloudOperatorModule.java | 7 - .../operator/handler/TimeoutStrategy.java | 54 --- .../handler/impl/AddedHandlerUtil.java | 2 +- .../handler/impl/LazySessionHandler.java | 21 +- .../monitor/MonitorActivityTrackerImpl.java | 9 +- .../eclipse/theia/cloud/service/K8sUtil.java | 7 +- .../cloud/service/TheiaCloudWebException.java | 24 +- .../workspace/WorkspaceResourceTests.java | 4 +- terraform/terraform.md | 2 +- 72 files changed, 2107 insertions(+), 1250 deletions(-) create mode 100644 .github/workflows/ci-conversion-webhook.yml create mode 100644 dockerfiles/conversion-webhook/Dockerfile delete mode 100644 java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/hub/AppDefinitionHubSpec.java rename java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/{v1beta7/AppDefinitionV1beta7.java => v1beta8/AppDefinitionV1beta8.java} (76%) rename java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/{v1beta7/AppDefinitionV1beta7Spec.java => v1beta8/AppDefinitionV1beta8Spec.java} (78%) rename java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/{v1beta7/AppDefinitionV1beta7SpecResourceList.java => v1beta8/AppDefinitionV1beta8SpecResourceList.java} (78%) rename java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/{v1beta7/AppDefinitionV1beta7Status.java => v1beta8/AppDefinitionV1beta8Status.java} (59%) delete mode 100644 java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/hub/SessionHubSpec.java delete mode 100644 java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/hub/SessionHubStatus.java rename java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/{v1beta5/SessionV1beta5.java => v1beta6/SessionV1beta6.java} (76%) rename java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/{v1beta5/SessionV1beta5Spec.java => v1beta6/SessionV1beta6Spec.java} (85%) rename java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/{v1beta5/SessionV1beta5SpecResourceList.java => v1beta6/SessionV1beta6SpecResourceList.java} (79%) rename java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/{v1beta5/SessionV1beta5Status.java => v1beta6/SessionV1beta6Status.java} (61%) delete mode 100644 java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/hub/WorkspaceHubSpec.java delete mode 100644 java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/hub/WorkspaceHubStatus.java rename java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/{v1beta2/WorkspaceV1beta2.java => v1beta3/WorkspaceV1beta3.java} (76%) rename java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/{v1beta2/WorkspaceV1beta2Spec.java => v1beta3/WorkspaceV1beta3Spec.java} (84%) rename java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/{v1beta2/WorkspaceV1beta2SpecResourceList.java => v1beta3/WorkspaceV1beta3SpecResourceList.java} (78%) rename java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/{v1beta2/WorkspaceV1beta2Status.java => v1beta3/WorkspaceV1beta3Status.java} (63%) create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/.dockerignore create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/.gitignore create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/.mvn/wrapper/.gitignore create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/.mvn/wrapper/MavenWrapperDownloader.java create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/.mvn/wrapper/maven-wrapper.properties create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/README.md create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/Run Theia Cloud Conversion Hook.launch create mode 100755 java/conversion/org.eclipse.theia.cloud.conversion/mvnw create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/mvnw.cmd create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/pom.xml create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/ConversionEndpoint.java rename java/{common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/hub/AppDefinitionHubStatus.java => conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/appdefinition/AppDefinitionV1beta8Mapper.java} (51%) create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/appdefinition/AppDefinitionV1beta9Mapper.java create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/session/SessionV1beta6Mapper.java create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/session/SessionV1beta7Mapper.java create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/workspace/WorkspaceV1beta3Mapper.java create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/workspace/WorkspaceV1beta4Mapper.java create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/src/main/resources/application.properties delete mode 100644 java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/handler/TimeoutStrategy.java diff --git a/.github/workflows/ci-conversion-webhook.yml b/.github/workflows/ci-conversion-webhook.yml new file mode 100644 index 00000000..b33e2abb --- /dev/null +++ b/.github/workflows/ci-conversion-webhook.yml @@ -0,0 +1,34 @@ +name: conversion-webhook CI + +on: + push: + branches: + - main + paths: + - "java/common/**" + - "java/conversion/**" + - "dockerfiles/conversion-webhook/**" + # Publish when a workflow has changed (this is needed to detect version updates) + - ".github/workflows/ci-conversion-webhook.yml" + - ".github/workflows/reusable-docker.yml" + pull_request: + branches: + - main + paths: + - "java/common/**" + - "java/conversion/**" + - "dockerfiles/conversion-webhook/**" + release: + types: + - published + +jobs: + call-reusable-docker-workflow: + uses: ./.github/workflows/reusable-docker.yml + with: + docker_org: theiacloud + docker_image: theia-cloud-conversion-webhook + docker_file: dockerfiles/conversion-webhook/Dockerfile + secrets: + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/ci-landing-page.yml b/.github/workflows/ci-landing-page.yml index 5a51c749..95155b75 100644 --- a/.github/workflows/ci-landing-page.yml +++ b/.github/workflows/ci-landing-page.yml @@ -10,7 +10,7 @@ on: - "dockerfiles/landing-page/**" # Publish when a workflow has changed (this is needed to detect version updates) - ".github/workflows/ci-landing-page.yml" - - ".github/workflows/reuseable-docker.yml" + - ".github/workflows/reusable-docker.yml" pull_request: branches: - main diff --git a/.github/workflows/ci-monitor-theia.yml b/.github/workflows/ci-monitor-theia.yml index 9d9cf2dc..2655c3f0 100644 --- a/.github/workflows/ci-monitor-theia.yml +++ b/.github/workflows/ci-monitor-theia.yml @@ -8,7 +8,7 @@ on: - "node/monitor-theia/**" # Publish when a workflow has changed (this is needed to detect version updates) - ".github/workflows/ci-monitor-theia.yml" - - ".github/workflows/reuseable-npm.yml" + - ".github/workflows/reusable-npm.yml" pull_request: branches: - main diff --git a/.github/workflows/ci-node-common.yml b/.github/workflows/ci-node-common.yml index ec331767..be0cddc8 100644 --- a/.github/workflows/ci-node-common.yml +++ b/.github/workflows/ci-node-common.yml @@ -8,7 +8,7 @@ on: - "node/common/**" # Publish when a workflow has changed (this is needed to detect version updates) - ".github/workflows/ci-node-common.yml" - - ".github/workflows/reuseable-npm.yml" + - ".github/workflows/reusable-npm.yml" pull_request: branches: - main diff --git a/.github/workflows/ci-operator.yml b/.github/workflows/ci-operator.yml index be25bb2f..d3809661 100644 --- a/.github/workflows/ci-operator.yml +++ b/.github/workflows/ci-operator.yml @@ -10,7 +10,7 @@ on: - "dockerfiles/operator/**" # Publish when a workflow has changed (this is needed to detect version updates) - ".github/workflows/ci-operator.yml" - - ".github/workflows/reuseable-docker.yml" + - ".github/workflows/reusable-docker.yml" pull_request: branches: - main diff --git a/.github/workflows/ci-service.yml b/.github/workflows/ci-service.yml index 36e4928b..1398420f 100644 --- a/.github/workflows/ci-service.yml +++ b/.github/workflows/ci-service.yml @@ -10,7 +10,7 @@ on: - "dockerfiles/service/**" # Publish when a workflow has changed (this is needed to detect version updates) - ".github/workflows/ci-service.yml" - - ".github/workflows/reuseable-docker.yml" + - ".github/workflows/reusable-docker.yml" pull_request: branches: - main diff --git a/.github/workflows/ci-try-now-page.yml b/.github/workflows/ci-try-now-page.yml index 4795ded7..59ce23ad 100644 --- a/.github/workflows/ci-try-now-page.yml +++ b/.github/workflows/ci-try-now-page.yml @@ -10,7 +10,7 @@ on: - "dockerfiles/try-now-page/**" # Publish when a workflow has changed (this is needed to detect version updates) - ".github/workflows/ci-try-now-page.yml" - - ".github/workflows/reuseable-docker.yml" + - ".github/workflows/reusable-docker.yml" pull_request: branches: - main diff --git a/.github/workflows/ci-wondershaper.yml b/.github/workflows/ci-wondershaper.yml index 91c9335a..2e4b1264 100644 --- a/.github/workflows/ci-wondershaper.yml +++ b/.github/workflows/ci-wondershaper.yml @@ -8,7 +8,7 @@ on: - "dockerfiles/wondershaper/**" # Publish when a workflow has changed (this is needed to detect version updates) - ".github/workflows/ci-wondershaper.yml" - - ".github/workflows/reuseable-docker.yml" + - ".github/workflows/reusable-docker.yml" pull_request: branches: - main diff --git a/CHANGELOG.md b/CHANGELOG.md index c124adea..b98231e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ - [.github/workflows] Improve version detection in workflows (do not build release commits, auto-detect version for demo publishing) [#280](https://github.com/eclipsesource/theia-cloud/pull/280) - contributed on behalf of STMicroelectronics - [node] Separate `monitor` package from other workspaces to fix bundling the extension [#280](https://github.com/eclipsesource/theia-cloud/pull/280) - contributed on behalf of STMicroelectronics +- [conversion] Provide java conversion webhook for CRD updates [#283](https://github.com/eclipsesource/theia-cloud/pull/283) | [#49](https://github.com/eclipsesource/theia-cloud-helm/pull/49) - contributed on behalf of STMicroelectronics +- [.github/workflows] Add ci for `conversion-webhook` and fix typo to build on version bumps [#283](https://github.com/eclipsesource/theia-cloud/pull/283) | [#49](https://github.com/eclipsesource/theia-cloud-helm/pull/49) - contributed on behalf of STMicroelectronics +- [common] Update CRs, keep previous version and offer Hub (used by conversion-webhook) [#283](https://github.com/eclipsesource/theia-cloud/pull/283) | [#49](https://github.com/eclipsesource/theia-cloud-helm/pull/49) - contributed on behalf of STMicroelectronics + - Move status like fields to status + - `Session.v1beta7`: Move `url`, `lastActivity` and `error` fields from the spec to the status. + - `Workspace.v1beta4`: Move the `error` field from the spec to the status. Also add the `error` field to `Workspace.v1beta3` as it was missing + - Remove `timeout.strategy` from AppDefinition + - `AppDefinition.v1beta9`: Removed `timeout.strategy` and `timeout.limit` is now just `timeout`. This was done, as there is only one Strategy left. ## [0.9.0] - 2024-01-23 diff --git a/dockerfiles/conversion-webhook/Dockerfile b/dockerfiles/conversion-webhook/Dockerfile new file mode 100644 index 00000000..fc280e99 --- /dev/null +++ b/dockerfiles/conversion-webhook/Dockerfile @@ -0,0 +1,18 @@ +FROM eclipse-temurin:17-jdk AS builder +RUN apt-get update && apt-get install -y maven +WORKDIR /conversion +COPY java/common ./common +COPY java/conversion ./conversion +RUN cd /conversion/common/maven-conf && \ + mvn clean install --no-transfer-progress && \ + cd /conversion/common/org.eclipse.theia.cloud.common && \ + mvn clean install --no-transfer-progress&& \ + cd /conversion/conversion/org.eclipse.theia.cloud.conversion && \ + mvn clean package -Dmaven.test.skip=true -Dquarkus.package.type=uber-jar --no-transfer-progress + +FROM eclipse-temurin:17-jre-alpine +WORKDIR /conversion +COPY --from=builder /conversion/conversion/org.eclipse.theia.cloud.conversion/target/conversion-webhook-0.10.0-SNAPSHOT-runner.jar . + +ENTRYPOINT java -jar ./conversion-webhook-0.10.0-SNAPSHOT-runner.jar +CMD [ "" ] \ No newline at end of file diff --git a/documentation/Building.md b/documentation/Building.md index 16aba868..f49e91e6 100644 --- a/documentation/Building.md +++ b/documentation/Building.md @@ -34,6 +34,12 @@ docker build -t theia-cloud-try-now-page -f dockerfiles/try-now-page/Dockerfile docker build -t theia-cloud-wondershaper -f dockerfiles/wondershaper/Dockerfile . ``` +## CRD conversion webhook + +```bash +docker build -t theia-cloud-conversion-webhook -f dockerfiles/conversion-webhook/Dockerfile . +``` + ## Demo applications ### Theia demo diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/client/DefaultSessionResourceClient.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/client/DefaultSessionResourceClient.java index 4f06b3cb..8ef3b49a 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/client/DefaultSessionResourceClient.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/client/DefaultSessionResourceClient.java @@ -41,7 +41,7 @@ public DefaultSessionResourceClient(NamespacedKubernetesClient client) { public Session create(String correlationId, SessionSpec spec) { Session session = new Session(); session.setSpec(spec); - spec.setLastActivity(Instant.now().toEpochMilli()); + session.getStatus().setLastActivity(Instant.now().toEpochMilli()); spec.setSessionSecret(UUID.randomUUID().toString()); ObjectMeta metadata = new ObjectMeta(); @@ -56,40 +56,39 @@ public Session create(String correlationId, SessionSpec spec) { public Session launch(String correlationId, SessionSpec spec, long timeout, TimeUnit unit) { // get or create session Session session = get(spec.getName()).orElseGet(() -> create(correlationId, spec)); - SessionSpec sessionSpec = session.getSpec(); + SessionStatus sessionStatus = session.getStatus(); // if session is available and has already an url or error, return that session - if (sessionSpec.hasUrl()) { + if (sessionStatus.hasUrl()) { return session; } - if (sessionSpec.hasError()) { + if (sessionStatus.hasError()) { delete(correlationId, spec.getName()); return session; } // wait for session url or error to be available try { - watchUntil((action, changedSession) -> isSessionComplete(correlationId, sessionSpec, changedSession), - timeout, unit); + watchUntil((action, changedSession) -> isSessionComplete(correlationId, session, changedSession), timeout, + unit); } catch (InterruptedException exception) { error(correlationId, "Timeout while waiting for URL for " + spec.getName(), exception); - sessionSpec.setError(TheiaCloudError.SESSION_LAUNCH_TIMEOUT); + sessionStatus.setError(TheiaCloudError.SESSION_LAUNCH_TIMEOUT); } return session; } - protected boolean isSessionComplete(String correlationId, SessionSpec sessionSpec, - Session changedSession) { - if (sessionSpec.getName().equals(changedSession.getSpec().getName())) { - if (changedSession.getSpec().hasUrl()) { + protected boolean isSessionComplete(String correlationId, Session session, Session changedSession) { + if (session.getSpec().getName().equals(changedSession.getSpec().getName())) { + if (changedSession.getStatus().hasUrl()) { info(correlationId, "Received URL for " + changedSession); - sessionSpec.setUrl(changedSession.getSpec().getUrl()); + session.getStatus().setUrl(changedSession.getStatus().getUrl()); return true; } - if (changedSession.getSpec().hasError()) { + if (changedSession.getStatus().hasError()) { info(correlationId, "Received Error for " + changedSession + ". Deleting session again."); - delete(correlationId, sessionSpec.getName()); - sessionSpec.setError(changedSession.getSpec().getError()); + delete(correlationId, session.getSpec().getName()); + session.getStatus().setError(changedSession.getStatus().getError()); return true; } } @@ -100,7 +99,7 @@ protected boolean isSessionComplete(String correlationId, SessionSpec sessionSpe public boolean reportActivity(String correlationId, String name) { return edit(correlationId, name, session -> { trace(correlationId, "Updating activity for session {" + name + "}"); - session.getSpec().setLastActivity(Instant.now().toEpochMilli()); + session.getStatus().setLastActivity(Instant.now().toEpochMilli()); }) != null; } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/client/DefaultWorkspaceResourceClient.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/client/DefaultWorkspaceResourceClient.java index 59f1d506..764567b9 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/client/DefaultWorkspaceResourceClient.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/client/DefaultWorkspaceResourceClient.java @@ -50,40 +50,40 @@ public Workspace create(String correlationId, WorkspaceSpec spec) { public Workspace launch(String correlationId, WorkspaceSpec spec, long timeout, TimeUnit unit) { Workspace workspace = get(spec.getName()).orElseGet(() -> create(correlationId, spec)); WorkspaceSpec workspaceSpec = workspace.getSpec(); + WorkspaceStatus workspaceStatus = workspace.getStatus(); if (workspaceSpec.hasStorage()) { return workspace; } - if (workspaceSpec.hasError()) { + if (workspaceStatus.hasError()) { delete(correlationId, spec.getName()); return workspace; } try { - watchUntil( - (action, changedWorkspace) -> isWorkspaceComplete(correlationId, workspaceSpec, changedWorkspace), + watchUntil((action, changedWorkspace) -> isWorkspaceComplete(correlationId, workspace, changedWorkspace), timeout, unit); } catch (InterruptedException exception) { error(correlationId, "Timeout while waiting for workspace storage " + workspaceSpec.getName() + ". Deleting workspace again.", exception); - workspaceSpec.setError(TheiaCloudError.WORKSPACE_LAUNCH_TIMEOUT); + workspaceStatus.setError(TheiaCloudError.WORKSPACE_LAUNCH_TIMEOUT); } return workspace; } - protected boolean isWorkspaceComplete(String correlationId, WorkspaceSpec createdWorkspace, + protected boolean isWorkspaceComplete(String correlationId, Workspace createdWorkspace, Workspace changedWorkspace) { - if (createdWorkspace.getName().equals(changedWorkspace.getSpec().getName())) { + if (createdWorkspace.getSpec().getName().equals(changedWorkspace.getSpec().getName())) { if (changedWorkspace.getSpec().hasStorage()) { info(correlationId, "Received URL for " + createdWorkspace); - createdWorkspace.setStorage(changedWorkspace.getSpec().getStorage()); + createdWorkspace.getSpec().setStorage(changedWorkspace.getSpec().getStorage()); return true; } - if (changedWorkspace.getSpec().hasError()) { + if (changedWorkspace.getStatus().hasError()) { info(correlationId, "Received Error for " + changedWorkspace + ". Deleting workspace again."); - delete(correlationId, createdWorkspace.getName()); - createdWorkspace.setError(changedWorkspace.getSpec().getError()); + delete(correlationId, createdWorkspace.getSpec().getName()); + createdWorkspace.getStatus().setError(changedWorkspace.getStatus().getError()); return true; } } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/AppDefinition.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/AppDefinition.java index 8e3831f7..7d145381 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/AppDefinition.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/AppDefinition.java @@ -27,7 +27,7 @@ import io.fabric8.kubernetes.model.annotation.Singular; import io.fabric8.kubernetes.model.annotation.Version; -@Version("v1beta8") +@Version("v1beta9") @Group("theia.cloud") @Kind("AppDefinition") @Singular("appdefinition") @@ -35,7 +35,7 @@ public class AppDefinition extends CustomResource implements Namespaced { private static final long serialVersionUID = 8749670583218521755L; - public static final String API = "theia.cloud/v1beta8"; + public static final String API = "theia.cloud/v1beta9"; public static final String KIND = "AppDefinition"; public static final String CRD_NAME = "appdefinitions.theia.cloud"; @@ -49,11 +49,11 @@ public AppDefinition() { } public AppDefinition(AppDefinitionHub fromHub) { - this.setMetadata(fromHub.getMetadata()); - this.spec = new AppDefinitionSpec(fromHub.getSpec()); - if (fromHub.getStatus() != null) { - this.status = new AppDefinitionStatus(fromHub.getStatus()); + if (fromHub.getMetadata().isPresent()) { + this.setMetadata(fromHub.getMetadata().get()); } + this.spec = new AppDefinitionSpec(fromHub); + this.status = new AppDefinitionStatus(fromHub); } } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/AppDefinitionSpec.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/AppDefinitionSpec.java index 43f32f9b..9ab3308e 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/AppDefinitionSpec.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/AppDefinitionSpec.java @@ -16,7 +16,7 @@ ********************************************************************************/ package org.eclipse.theia.cloud.common.k8s.resource.appdefinition; -import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub.AppDefinitionHubSpec; +import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub.AppDefinitionHub; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -52,7 +52,7 @@ public class AppDefinitionSpec { private Integer maxInstances; @JsonProperty("timeout") - private Timeout timeout; + private Integer timeout; @JsonProperty("requestsMemory") private String requestsMemory; @@ -84,40 +84,32 @@ public class AppDefinitionSpec { public AppDefinitionSpec() { } - public AppDefinitionSpec(AppDefinitionHubSpec fromHub) { - this.name = fromHub.getName(); - this.image = fromHub.getImage(); - this.imagePullPolicy = fromHub.getImagePullPolicy(); - this.pullSecret = fromHub.getPullSecret(); - this.uid = fromHub.getUid(); - this.port = fromHub.getPort(); - this.ingressname = fromHub.getIngressname(); - this.minInstances = fromHub.getMinInstances(); - this.maxInstances = fromHub.getMaxInstances(); - this.requestsMemory = fromHub.getRequestsMemory(); - this.requestsCpu = fromHub.getRequestsCpu(); - this.limitsMemory = fromHub.getLimitsMemory(); - this.limitsCpu = fromHub.getLimitsCpu(); - this.downlinkLimit = fromHub.getDownlinkLimit(); - this.uplinkLimit = fromHub.getUplinkLimit(); - this.mountPath = fromHub.getMountPath(); - - this.timeout = new Timeout(); - if (fromHub.getTimeout() != null) { - this.timeout.limit = fromHub.getTimeout().getLimit(); - this.timeout.strategy = fromHub.getTimeout().getStrategy(); - } + public AppDefinitionSpec(AppDefinitionHub fromHub) { + this.name = fromHub.getName().orElse(null); // required + this.image = fromHub.getImage().orElse(null); // required + this.imagePullPolicy = fromHub.getImagePullPolicy().orElse(null); + this.pullSecret = fromHub.getPullSecret().orElse(null); + this.uid = fromHub.getUid().orElse(0); // required + this.port = fromHub.getPort().orElse(0); // required + this.ingressname = fromHub.getIngressname().orElse(null); // required + this.minInstances = fromHub.getMinInstances().orElse(0); // required + this.maxInstances = fromHub.getMaxInstances().orElse(0); // required + this.requestsMemory = fromHub.getRequestsMemory().orElse(null); // required + this.requestsCpu = fromHub.getRequestsCpu().orElse(null); // required + this.limitsMemory = fromHub.getLimitsMemory().orElse(null); // required + this.limitsCpu = fromHub.getLimitsCpu().orElse(null); // required + this.downlinkLimit = fromHub.getDownlinkLimit().orElse(0); + this.uplinkLimit = fromHub.getUplinkLimit().orElse(0); + this.mountPath = fromHub.getMountPath().orElse(null); + + this.timeout = fromHub.getTimeoutLimit().orElse(0); this.monitor = new Monitor(); - if (fromHub.getMonitor() != null) { - this.monitor.port = fromHub.getMonitor().getPort(); + this.monitor.port = fromHub.getMonitorPort().orElse(0); - this.monitor.activityTracker = new Monitor.ActivityTracker(); - if (fromHub.getMonitor().getActivityTracker() != null) { - this.monitor.activityTracker.timeoutAfter = fromHub.getMonitor().getActivityTracker().getTimeoutAfter(); - this.monitor.activityTracker.notifyAfter = fromHub.getMonitor().getActivityTracker().getNotifyAfter(); - } - } + this.monitor.activityTracker = new Monitor.ActivityTracker(); + this.monitor.activityTracker.timeoutAfter = fromHub.getMonitorActivityTrackerTimeoutAfter().orElse(0); + this.monitor.activityTracker.notifyAfter = fromHub.getMonitorActivityTrackerNotifyAfter().orElse(0); } public String getName() { @@ -156,7 +148,7 @@ public Integer getMaxInstances() { return maxInstances; } - public Timeout getTimeout() { + public Integer getTimeout() { return timeout; } @@ -202,35 +194,6 @@ public String toString() { + uplinkLimit + ", mountPath=" + mountPath + "]"; } - public static class Timeout { - @JsonProperty("limit") - private int limit; - - @JsonProperty("strategy") - private String strategy; - - public Timeout() { - } - - public Timeout(String strategy, int limit) { - this.strategy = strategy; - this.limit = limit; - } - - public int getLimit() { - return limit; - } - - public String getStrategy() { - return strategy; - } - - @Override - public String toString() { - return "Timeout [limit=" + limit + ", strategy=" + strategy + "]"; - } - } - public static class Monitor { @JsonProperty("port") private int port; diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/AppDefinitionStatus.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/AppDefinitionStatus.java index 446791c6..cdbca82b 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/AppDefinitionStatus.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/AppDefinitionStatus.java @@ -16,7 +16,7 @@ package org.eclipse.theia.cloud.common.k8s.resource.appdefinition; import org.eclipse.theia.cloud.common.k8s.resource.ResourceStatus; -import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub.AppDefinitionHubStatus; +import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub.AppDefinitionHub; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -33,12 +33,12 @@ public class AppDefinitionStatus extends ResourceStatus { public AppDefinitionStatus() { } - public AppDefinitionStatus(AppDefinitionHubStatus fromHub) { - if (fromHub.getOperatorMessage() != null) { - this.setOperatorMessage(fromHub.getOperatorMessage()); + public AppDefinitionStatus(AppDefinitionHub fromHub) { + if (fromHub.getOperatorMessage().isPresent()) { + this.setOperatorMessage(fromHub.getOperatorMessage().get()); } - if (fromHub.getOperatorStatus() != null) { - this.setOperatorStatus(fromHub.getOperatorStatus()); + if (fromHub.getOperatorMessage().isPresent()) { + this.setOperatorStatus(fromHub.getOperatorStatus().get()); } } } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/hub/AppDefinitionHub.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/hub/AppDefinitionHub.java index 90eac1f2..2229d25c 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/hub/AppDefinitionHub.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/hub/AppDefinitionHub.java @@ -15,55 +15,238 @@ ********************************************************************************/ package org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub; +import java.util.Optional; +import java.util.OptionalInt; + import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.AppDefinition; import io.fabric8.kubernetes.api.model.ObjectMeta; public class AppDefinitionHub { - private ObjectMeta metadata = new ObjectMeta(); - private AppDefinitionHubSpec spec; - private AppDefinitionHubStatus status; + final Optional metadata; + final Optional name; + final Optional image; + final Optional imagePullPolicy; + final Optional pullSecret; + final OptionalInt uid; + final OptionalInt port; + final Optional ingressname; + final OptionalInt minInstances; + final OptionalInt maxInstances; + final Optional requestsMemory; + final Optional requestsCpu; + final Optional limitsMemory; + final Optional limitsCpu; + final OptionalInt downlinkLimit;// kilobits per second + final OptionalInt uplinkLimit;// kilobits per second + final Optional mountPath; + + final OptionalInt timeoutLimit; + @Deprecated + final Optional timeoutStrategy; + + final OptionalInt monitorPort; + final OptionalInt monitorActivityTrackerTimeoutAfter; + final OptionalInt monitorActivityTrackerNotifyAfter; + + final Optional operatorStatus; + final Optional operatorMessage; + + public AppDefinitionHub(AppDefinition toHub) { + this.metadata = Optional.ofNullable(toHub.getMetadata()); + this.name = Optional.ofNullable(toHub.getSpec().getName()); + this.image = Optional.ofNullable(toHub.getSpec().getImage()); + this.imagePullPolicy = Optional.ofNullable(toHub.getSpec().getImagePullPolicy()); + this.pullSecret = Optional.ofNullable(toHub.getSpec().getPullSecret()); + this.uid = OptionalInt.of(toHub.getSpec().getUid()); + this.port = OptionalInt.of(toHub.getSpec().getPort()); + this.ingressname = Optional.ofNullable(toHub.getSpec().getIngressname()); + this.minInstances = OptionalInt.of(toHub.getSpec().getMinInstances()); + this.maxInstances = OptionalInt.of(toHub.getSpec().getMaxInstances()); + this.requestsMemory = Optional.ofNullable(toHub.getSpec().getRequestsMemory()); + this.requestsCpu = Optional.ofNullable(toHub.getSpec().getRequestsCpu()); + this.limitsMemory = Optional.ofNullable(toHub.getSpec().getLimitsMemory()); + this.limitsCpu = Optional.ofNullable(toHub.getSpec().getLimitsCpu()); + this.downlinkLimit = OptionalInt.of(toHub.getSpec().getDownlinkLimit()); + this.uplinkLimit = OptionalInt.of(toHub.getSpec().getUplinkLimit()); + this.mountPath = Optional.ofNullable(toHub.getSpec().getMountPath()); + + this.timeoutLimit = OptionalInt.of(toHub.getSpec().getTimeout()); + this.timeoutStrategy = Optional.of("FIXEDTIME"); + + if (toHub.getSpec().getMonitor() != null) { + this.monitorPort = OptionalInt.of(toHub.getSpec().getMonitor().getPort()); + if (toHub.getSpec().getMonitor().getActivityTracker() != null) { + this.monitorActivityTrackerNotifyAfter = OptionalInt + .of(toHub.getSpec().getMonitor().getActivityTracker().getNotifyAfter()); + this.monitorActivityTrackerTimeoutAfter = OptionalInt + .of(toHub.getSpec().getMonitor().getActivityTracker().getNotifyAfter()); + } else { + this.monitorActivityTrackerNotifyAfter = OptionalInt.empty(); + this.monitorActivityTrackerTimeoutAfter = OptionalInt.empty(); + } + } else { + this.monitorPort = OptionalInt.empty(); + this.monitorActivityTrackerNotifyAfter = OptionalInt.empty(); + this.monitorActivityTrackerTimeoutAfter = OptionalInt.empty(); + } + + // Status is not a required field + if (toHub.getStatus() != null) { + this.operatorStatus = Optional.ofNullable(toHub.getStatus().getOperatorStatus()); + this.operatorMessage = Optional.ofNullable(toHub.getStatus().getOperatorMessage()); + } else { + this.operatorStatus = Optional.empty(); + this.operatorMessage = Optional.empty(); + } + } + + @SuppressWarnings("deprecation") + public AppDefinitionHub( + org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta8.AppDefinitionV1beta8 toHub) { + this.metadata = Optional.ofNullable(toHub.getMetadata()); + this.name = Optional.ofNullable(toHub.getSpec().getName()); + this.image = Optional.ofNullable(toHub.getSpec().getImage()); + this.imagePullPolicy = Optional.ofNullable(toHub.getSpec().getImagePullPolicy()); + this.pullSecret = Optional.ofNullable(toHub.getSpec().getPullSecret()); + this.uid = OptionalInt.of(toHub.getSpec().getUid()); + this.port = OptionalInt.of(toHub.getSpec().getPort()); + this.ingressname = Optional.ofNullable(toHub.getSpec().getIngressname()); + this.minInstances = OptionalInt.of(toHub.getSpec().getMinInstances()); + this.maxInstances = OptionalInt.of(toHub.getSpec().getMaxInstances()); + this.requestsMemory = Optional.ofNullable(toHub.getSpec().getRequestsMemory()); + this.requestsCpu = Optional.ofNullable(toHub.getSpec().getRequestsCpu()); + this.limitsMemory = Optional.ofNullable(toHub.getSpec().getLimitsMemory()); + this.limitsCpu = Optional.ofNullable(toHub.getSpec().getLimitsCpu()); + this.downlinkLimit = OptionalInt.of(toHub.getSpec().getDownlinkLimit()); + this.uplinkLimit = OptionalInt.of(toHub.getSpec().getUplinkLimit()); + this.mountPath = Optional.ofNullable(toHub.getSpec().getMountPath()); + + this.timeoutLimit = OptionalInt.of(toHub.getSpec().getTimeout().getLimit()); + this.timeoutStrategy = Optional.of(toHub.getSpec().getTimeout().getStrategy()); + + if (toHub.getSpec().getMonitor() != null) { + this.monitorPort = OptionalInt.of(toHub.getSpec().getMonitor().getPort()); + if (toHub.getSpec().getMonitor().getActivityTracker() != null) { + this.monitorActivityTrackerNotifyAfter = OptionalInt + .of(toHub.getSpec().getMonitor().getActivityTracker().getNotifyAfter()); + this.monitorActivityTrackerTimeoutAfter = OptionalInt + .of(toHub.getSpec().getMonitor().getActivityTracker().getNotifyAfter()); + } else { + this.monitorActivityTrackerNotifyAfter = OptionalInt.empty(); + this.monitorActivityTrackerTimeoutAfter = OptionalInt.empty(); + } + } else { + this.monitorPort = OptionalInt.empty(); + this.monitorActivityTrackerNotifyAfter = OptionalInt.empty(); + this.monitorActivityTrackerTimeoutAfter = OptionalInt.empty(); + } + + // Status is not a required field + if (toHub.getStatus() != null) { + this.operatorStatus = Optional.ofNullable(toHub.getStatus().getOperatorStatus()); + this.operatorMessage = Optional.ofNullable(toHub.getStatus().getOperatorMessage()); + } else { + this.operatorStatus = Optional.empty(); + this.operatorMessage = Optional.empty(); + } + } - public ObjectMeta getMetadata() { + public Optional getMetadata() { return metadata; } - public void setMetadata(ObjectMeta metadata) { - this.metadata = metadata; + public Optional getName() { + return name; } - public AppDefinitionHubSpec getSpec() { - return spec; + public Optional getImage() { + return image; } - public void setSpec(AppDefinitionHubSpec spec) { - this.spec = spec; + public Optional getImagePullPolicy() { + return imagePullPolicy; } - public AppDefinitionHubStatus getStatus() { - return status; + public Optional getPullSecret() { + return pullSecret; } - public void setStatus(AppDefinitionHubStatus status) { - this.status = status; + public OptionalInt getUid() { + return uid; } - public AppDefinitionHub(AppDefinition toHub) { - this.setMetadata(toHub.getMetadata()); - this.spec = new AppDefinitionHubSpec(toHub.getSpec()); - if (toHub.getStatus() != null) { - this.status = new AppDefinitionHubStatus(toHub.getStatus()); - } + public OptionalInt getPort() { + return port; } - @SuppressWarnings("deprecation") - public AppDefinitionHub( - org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta7.AppDefinitionV1beta7 toHub) { - this.setMetadata(toHub.getMetadata()); - this.spec = new AppDefinitionHubSpec(toHub.getSpec()); - if (toHub.getStatus() != null) { - this.status = new AppDefinitionHubStatus(toHub.getStatus()); - } + public Optional getIngressname() { + return ingressname; + } + + public OptionalInt getMinInstances() { + return minInstances; } + + public OptionalInt getMaxInstances() { + return maxInstances; + } + + public Optional getRequestsMemory() { + return requestsMemory; + } + + public Optional getRequestsCpu() { + return requestsCpu; + } + + public Optional getLimitsMemory() { + return limitsMemory; + } + + public Optional getLimitsCpu() { + return limitsCpu; + } + + public OptionalInt getDownlinkLimit() { + return downlinkLimit; + } + + public OptionalInt getUplinkLimit() { + return uplinkLimit; + } + + public Optional getMountPath() { + return mountPath; + } + + public OptionalInt getTimeoutLimit() { + return timeoutLimit; + } + + public Optional getTimeoutStrategy() { + return timeoutStrategy; + } + + public OptionalInt getMonitorPort() { + return monitorPort; + } + + public OptionalInt getMonitorActivityTrackerTimeoutAfter() { + return monitorActivityTrackerTimeoutAfter; + } + + public OptionalInt getMonitorActivityTrackerNotifyAfter() { + return monitorActivityTrackerNotifyAfter; + } + + public Optional getOperatorStatus() { + return operatorStatus; + } + + public Optional getOperatorMessage() { + return operatorMessage; + } + } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/hub/AppDefinitionHubSpec.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/hub/AppDefinitionHubSpec.java deleted file mode 100644 index 34f731b4..00000000 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/hub/AppDefinitionHubSpec.java +++ /dev/null @@ -1,315 +0,0 @@ -/******************************************************************************** - * Copyright (C) 2023 EclipseSource and others. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the Eclipse - * Public License v. 2.0 are satisfied: GNU General Public License, version 2 - * with the GNU Classpath Exception which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub; - -import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.AppDefinitionSpec; -import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta7.AppDefinitionV1beta7Spec; - -public class AppDefinitionHubSpec { - - private final String name; - - private final String image; - - private final String imagePullPolicy; - - private final String pullSecret; - - private final int uid; - - private final int port; - - private final String ingressname; - - private final int minInstances; - - private final Integer maxInstances; - - private final TimeoutHub timeout; - - private final String requestsMemory; - - private final String requestsCpu; - - private final String limitsMemory; - - private final String limitsCpu; - - private final int downlinkLimit;// kilobits per second - - private final int uplinkLimit;// kilobits per second - - private final String mountPath; - - private final MonitorHub monitor; - - public AppDefinitionHubSpec(AppDefinitionSpec toHub) { - this.name = toHub.getName(); - this.image = toHub.getImage(); - this.imagePullPolicy = toHub.getImagePullPolicy(); - this.pullSecret = toHub.getPullSecret(); - this.uid = toHub.getUid(); - this.port = toHub.getPort(); - this.ingressname = toHub.getIngressname(); - this.minInstances = toHub.getMinInstances(); - this.maxInstances = toHub.getMaxInstances(); - this.requestsMemory = toHub.getRequestsMemory(); - this.requestsCpu = toHub.getRequestsCpu(); - this.limitsMemory = toHub.getLimitsMemory(); - this.limitsCpu = toHub.getLimitsCpu(); - this.downlinkLimit = toHub.getDownlinkLimit(); - this.uplinkLimit = toHub.getUplinkLimit(); - this.mountPath = toHub.getMountPath(); - - if (toHub.getTimeout() != null) { - this.timeout = new TimeoutHub(// - toHub.getTimeout().getStrategy(), // - toHub.getTimeout().getLimit()); - } else { - this.timeout = new TimeoutHub(); - } - - if (toHub.getMonitor() != null) { - - MonitorHub.ActivityTrackerHub activityTracker; - if (toHub.getMonitor().getActivityTracker() != null) { - activityTracker = new MonitorHub.ActivityTrackerHub( - toHub.getMonitor().getActivityTracker().getTimeoutAfter(), - toHub.getMonitor().getActivityTracker().getNotifyAfter()); - } else { - activityTracker = new MonitorHub.ActivityTrackerHub(); - } - - this.monitor = new MonitorHub(activityTracker, toHub.getMonitor().getPort()); - } else { - this.monitor = new MonitorHub(); - } - } - - public AppDefinitionHubSpec(AppDefinitionV1beta7Spec toHub) { - this.name = toHub.getName(); - this.image = toHub.getImage(); - this.imagePullPolicy = toHub.getImagePullPolicy(); - this.pullSecret = toHub.getPullSecret(); - this.uid = toHub.getUid(); - this.port = toHub.getPort(); - this.ingressname = toHub.getIngressname(); - this.minInstances = toHub.getMinInstances(); - this.maxInstances = toHub.getMaxInstances(); - this.requestsMemory = toHub.getRequestsMemory(); - this.requestsCpu = toHub.getRequestsCpu(); - this.limitsMemory = toHub.getLimitsMemory(); - this.limitsCpu = toHub.getLimitsCpu(); - this.downlinkLimit = toHub.getDownlinkLimit(); - this.uplinkLimit = toHub.getUplinkLimit(); - this.mountPath = toHub.getMountPath(); - - if (toHub.getTimeout() != null) { - this.timeout = new TimeoutHub(// - toHub.getTimeout().getStrategy(), // - toHub.getTimeout().getLimit()); - } else { - this.timeout = new TimeoutHub(); - } - - if (toHub.getMonitor() != null) { - MonitorHub.ActivityTrackerHub activityTracker; - if (toHub.getMonitor().getActivityTracker() != null) { - activityTracker = new MonitorHub.ActivityTrackerHub( - toHub.getMonitor().getActivityTracker().getTimeoutAfter(), - toHub.getMonitor().getActivityTracker().getNotifyAfter()); - } else { - activityTracker = new MonitorHub.ActivityTrackerHub(); - } - - this.monitor = new MonitorHub(activityTracker, toHub.getMonitor().getPort()); - } else { - this.monitor = new MonitorHub(); - } - } - - public String getName() { - return name; - } - - public String getImage() { - return image; - } - - public String getImagePullPolicy() { - return imagePullPolicy; - } - - public String getPullSecret() { - return pullSecret; - } - - public int getUid() { - return uid; - } - - public int getPort() { - return port; - } - - public String getIngressname() { - return ingressname; - } - - public int getMinInstances() { - return minInstances; - } - - public Integer getMaxInstances() { - return maxInstances; - } - - public TimeoutHub getTimeout() { - return timeout; - } - - public String getRequestsMemory() { - return requestsMemory; - } - - public String getRequestsCpu() { - return requestsCpu; - } - - public String getLimitsMemory() { - return limitsMemory; - } - - public String getLimitsCpu() { - return limitsCpu; - } - - public int getDownlinkLimit() { - return downlinkLimit; - } - - public int getUplinkLimit() { - return uplinkLimit; - } - - public String getMountPath() { - return mountPath; - } - - public MonitorHub getMonitor() { - return monitor; - } - - @Override - public String toString() { - return "AppDefinitionHubSpec [name=" + name + ", image=" + image + ", imagePullPolicy=" + imagePullPolicy - + ", pullSecret=" + pullSecret + ", uid=" + uid + ", port=" + port + ", ingressname=" + ingressname - + ", minInstances=" + minInstances + ", maxInstances=" + maxInstances + ", timeout=" + timeout - + ", requestsMemory=" + requestsMemory + ", requestsCpu=" + requestsCpu + ", limitsMemory=" - + limitsMemory + ", limitsCpu=" + limitsCpu + ", downlinkLimit=" + downlinkLimit + ", uplinkLimit=" - + uplinkLimit + ", mountPath=" + mountPath + ", monitor=" + monitor + "]"; - } - - public static class TimeoutHub { - private final int limit; - - private final String strategy; - - public TimeoutHub(String strategy, int limit) { - this.strategy = strategy; - this.limit = limit; - } - - public TimeoutHub() { - this.strategy = "FIXEDTIME"; - this.limit = 60; - } - - public int getLimit() { - return limit; - } - - public String getStrategy() { - return strategy; - } - - @Override - public String toString() { - return "TimeoutHub [limit=" + limit + ", strategy=" + strategy + "]"; - } - - } - - public static class MonitorHub { - private final int port; - - private final ActivityTrackerHub activityTracker; - - public MonitorHub(ActivityTrackerHub activityTracker, int port) { - this.activityTracker = activityTracker; - this.port = port; - } - - public MonitorHub() { - this.activityTracker = new ActivityTrackerHub(); - this.port = 3000; - } - - public int getPort() { - return port; - } - - public ActivityTrackerHub getActivityTracker() { - return activityTracker; - } - - @Override - public String toString() { - return "MonitorHub [port=" + port + ", activityTracker=" + activityTracker + "]"; - } - - public static class ActivityTrackerHub { - private final int timeoutAfter; - - private final int notifyAfter; - - public ActivityTrackerHub(int timeoutAfter, int notifyAfter) { - this.timeoutAfter = timeoutAfter; - this.notifyAfter = notifyAfter; - } - - public ActivityTrackerHub() { - this.timeoutAfter = 60; - this.notifyAfter = 30; - } - - public int getTimeoutAfter() { - return timeoutAfter; - } - - public int getNotifyAfter() { - return notifyAfter; - } - - @Override - public String toString() { - return "ActivityTrackerHub [timeoutAfter=" + timeoutAfter + ", notifyAfter=" + notifyAfter + "]"; - } - - } - } - -} diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta7/AppDefinitionV1beta7.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta8/AppDefinitionV1beta8.java similarity index 76% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta7/AppDefinitionV1beta7.java rename to java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta8/AppDefinitionV1beta8.java index 8e691d69..154bf150 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta7/AppDefinitionV1beta7.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta8/AppDefinitionV1beta8.java @@ -14,7 +14,7 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta7; +package org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta8; import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub.AppDefinitionHub; import org.eclipse.theia.cloud.common.util.CustomResourceUtil; @@ -28,15 +28,16 @@ import io.fabric8.kubernetes.model.annotation.Version; @Deprecated -@Version("v1beta7") +@Version("v1beta8") @Group("theia.cloud") @Kind("AppDefinition") @Singular("appdefinition") @Plural("appdefinitions") -public class AppDefinitionV1beta7 extends CustomResource +public class AppDefinitionV1beta8 extends CustomResource implements Namespaced { - public static final String API = "theia.cloud/v1beta7"; + private static final long serialVersionUID = 8749670583218521755L; + public static final String API = "theia.cloud/v1beta8"; public static final String KIND = "AppDefinition"; public static final String CRD_NAME = "appdefinitions.theia.cloud"; @@ -45,15 +46,16 @@ public String toString() { return CustomResourceUtil.toString(this); } - public AppDefinitionV1beta7() { + public AppDefinitionV1beta8() { + } - public AppDefinitionV1beta7(AppDefinitionHub fromHub) { - this.setMetadata(fromHub.getMetadata()); - this.spec = new AppDefinitionV1beta7Spec(fromHub.getSpec()); - if (fromHub.getStatus() != null) { - this.status = new AppDefinitionV1beta7Status(fromHub.getStatus()); + public AppDefinitionV1beta8(AppDefinitionHub fromHub) { + if (fromHub.getMetadata().isPresent()) { + this.setMetadata(fromHub.getMetadata().get()); } + this.spec = new AppDefinitionV1beta8Spec(fromHub); + this.status = new AppDefinitionV1beta8Status(fromHub); } } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta7/AppDefinitionV1beta7Spec.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta8/AppDefinitionV1beta8Spec.java similarity index 78% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta7/AppDefinitionV1beta7Spec.java rename to java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta8/AppDefinitionV1beta8Spec.java index 0c90775c..0558707c 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta7/AppDefinitionV1beta7Spec.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta8/AppDefinitionV1beta8Spec.java @@ -14,15 +14,16 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta7; +package org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta8; -import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub.AppDefinitionHubSpec; +import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub.AppDefinitionHub; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +@Deprecated @JsonDeserialize() -public class AppDefinitionV1beta7Spec { +public class AppDefinitionV1beta8Spec { @JsonProperty("name") private String name; @@ -81,48 +82,37 @@ public class AppDefinitionV1beta7Spec { /** * Default constructor. */ - public AppDefinitionV1beta7Spec() { + public AppDefinitionV1beta8Spec() { } - /** - * Migration constructor. - * - * @param fromHub previous version - */ - public AppDefinitionV1beta7Spec(AppDefinitionHubSpec fromHub) { - this.name = fromHub.getName(); - this.image = fromHub.getImage(); - this.imagePullPolicy = fromHub.getImagePullPolicy(); - this.pullSecret = fromHub.getPullSecret(); - this.uid = fromHub.getUid(); - this.port = fromHub.getPort(); - this.ingressname = fromHub.getIngressname(); - this.minInstances = fromHub.getMinInstances(); - this.maxInstances = fromHub.getMaxInstances(); - this.requestsMemory = fromHub.getRequestsMemory(); - this.requestsCpu = fromHub.getRequestsCpu(); - this.limitsMemory = fromHub.getLimitsMemory(); - this.limitsCpu = fromHub.getLimitsCpu(); - this.downlinkLimit = fromHub.getDownlinkLimit(); - this.uplinkLimit = fromHub.getUplinkLimit(); - this.mountPath = fromHub.getMountPath(); + public AppDefinitionV1beta8Spec(AppDefinitionHub fromHub) { + this.name = fromHub.getName().orElse(null); + this.image = fromHub.getImage().orElse(null); + this.imagePullPolicy = fromHub.getImagePullPolicy().orElse(null); + this.pullSecret = fromHub.getPullSecret().orElse(null); + this.uid = fromHub.getUid().orElse(0); + this.port = fromHub.getPort().orElse(0); + this.ingressname = fromHub.getIngressname().orElse(null); + this.minInstances = fromHub.getMinInstances().orElse(0); + this.maxInstances = fromHub.getMaxInstances().orElse(0); + this.requestsMemory = fromHub.getRequestsMemory().orElse(null); + this.requestsCpu = fromHub.getRequestsCpu().orElse(null); + this.limitsMemory = fromHub.getLimitsMemory().orElse(null); + this.limitsCpu = fromHub.getLimitsCpu().orElse(null); + this.downlinkLimit = fromHub.getDownlinkLimit().orElse(0); + this.uplinkLimit = fromHub.getUplinkLimit().orElse(0); + this.mountPath = fromHub.getMountPath().orElse(null); this.timeout = new Timeout(); - if (fromHub.getTimeout() != null) { - this.timeout.limit = fromHub.getTimeout().getLimit(); - this.timeout.strategy = fromHub.getTimeout().getStrategy(); - } + this.timeout.limit = fromHub.getTimeoutLimit().orElse(0); + this.timeout.strategy = fromHub.getTimeoutStrategy().orElse(null); this.monitor = new Monitor(); - if (fromHub.getMonitor() != null) { - this.monitor.port = fromHub.getMonitor().getPort(); + this.monitor.port = fromHub.getMonitorPort().orElse(0); - this.monitor.activityTracker = new Monitor.ActivityTracker(); - if (fromHub.getMonitor().getActivityTracker() != null) { - this.monitor.activityTracker.timeoutAfter = fromHub.getMonitor().getActivityTracker().getTimeoutAfter(); - this.monitor.activityTracker.notifyAfter = fromHub.getMonitor().getActivityTracker().getNotifyAfter(); - } - } + this.monitor.activityTracker = new Monitor.ActivityTracker(); + this.monitor.activityTracker.timeoutAfter = fromHub.getMonitorActivityTrackerTimeoutAfter().orElse(0); + this.monitor.activityTracker.notifyAfter = fromHub.getMonitorActivityTrackerNotifyAfter().orElse(0); } public String getName() { diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta7/AppDefinitionV1beta7SpecResourceList.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta8/AppDefinitionV1beta8SpecResourceList.java similarity index 78% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta7/AppDefinitionV1beta7SpecResourceList.java rename to java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta8/AppDefinitionV1beta8SpecResourceList.java index 4750d6e9..31de55ee 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta7/AppDefinitionV1beta7SpecResourceList.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta8/AppDefinitionV1beta8SpecResourceList.java @@ -14,11 +14,13 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta7; +package org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta8; -import io.fabric8.kubernetes.client.CustomResourceList; +import io.fabric8.kubernetes.api.model.DefaultKubernetesResourceList; @Deprecated -public class AppDefinitionV1beta7SpecResourceList extends CustomResourceList { +public class AppDefinitionV1beta8SpecResourceList extends DefaultKubernetesResourceList { + + private static final long serialVersionUID = 722136158817065564L; } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta7/AppDefinitionV1beta7Status.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta8/AppDefinitionV1beta8Status.java similarity index 59% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta7/AppDefinitionV1beta7Status.java rename to java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta8/AppDefinitionV1beta8Status.java index 8da0a656..05d0a035 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta7/AppDefinitionV1beta7Status.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/v1beta8/AppDefinitionV1beta8Status.java @@ -13,25 +13,33 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta7; +package org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta8; import org.eclipse.theia.cloud.common.k8s.resource.ResourceStatus; -import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub.AppDefinitionHubStatus; +import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub.AppDefinitionHub; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @Deprecated @JsonDeserialize -public class AppDefinitionV1beta7Status extends ResourceStatus { - public AppDefinitionV1beta7Status() { +public class AppDefinitionV1beta8Status extends ResourceStatus { + // This class is empty as only the common properties of the super class are + // used. Already define a specific class to allow easier extension, properly + // type the resources and resource clients. + // It is planned to extend this later with AppDefinition specific status steps. + + /** + * Default constructor. + */ + public AppDefinitionV1beta8Status() { } - public AppDefinitionV1beta7Status(AppDefinitionHubStatus fromHub) { - if (fromHub.getOperatorMessage() != null) { - this.setOperatorMessage(fromHub.getOperatorMessage()); + public AppDefinitionV1beta8Status(AppDefinitionHub fromHub) { + if (fromHub.getOperatorMessage().isPresent()) { + this.setOperatorMessage(fromHub.getOperatorMessage().get()); } - if (fromHub.getOperatorStatus() != null) { - this.setOperatorStatus(fromHub.getOperatorStatus()); + if (fromHub.getOperatorStatus().isPresent()) { + this.setOperatorStatus(fromHub.getOperatorStatus().get()); } } } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/Session.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/Session.java index 122da408..f1bad8a0 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/Session.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/Session.java @@ -27,7 +27,7 @@ import io.fabric8.kubernetes.model.annotation.Singular; import io.fabric8.kubernetes.model.annotation.Version; -@Version("v1beta6") +@Version("v1beta7") @Group("theia.cloud") @Kind("Session") @Singular("session") @@ -35,7 +35,7 @@ public class Session extends CustomResource implements Namespaced { private static final long serialVersionUID = 4518092300237069237L; - public static final String API = "theia.cloud/v1beta6"; + public static final String API = "theia.cloud/v1beta7"; public static final String KIND = "Session"; public static final String CRD_NAME = "sessions.theia.cloud"; @@ -43,11 +43,11 @@ public Session() { } public Session(SessionHub fromHub) { - this.setMetadata(fromHub.getMetadata()); - this.spec = new SessionSpec(fromHub.getSpec()); - if (fromHub.getStatus() != null) { - this.status = new SessionStatus(fromHub.getStatus()); + if (fromHub.getMetadata().isPresent()) { + this.setMetadata(fromHub.getMetadata().get()); } + this.spec = new SessionSpec(fromHub); + this.status = new SessionStatus(fromHub); } @Override diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/SessionSpec.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/SessionSpec.java index 1177c365..e6ecf7dc 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/SessionSpec.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/SessionSpec.java @@ -20,8 +20,7 @@ import java.util.Map; import org.eclipse.theia.cloud.common.k8s.resource.UserScopedSpec; -import org.eclipse.theia.cloud.common.k8s.resource.session.hub.SessionHubSpec; -import org.eclipse.theia.cloud.common.util.TheiaCloudError; +import org.eclipse.theia.cloud.common.k8s.resource.session.hub.SessionHub; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -39,18 +38,9 @@ public class SessionSpec implements UserScopedSpec { @JsonProperty("user") private String user; - @JsonProperty("url") - private String url; - - @JsonProperty("error") - private String error; - @JsonProperty("workspace") private String workspace; - @JsonProperty("lastActivity") - private long lastActivity; - @JsonProperty("sessionSecret") private String sessionSecret; @@ -97,18 +87,15 @@ public SessionSpec(String name, String appDefinition, String user, String worksp this.envVarsFromSecrets = envVarsFromSecrets; } - public SessionSpec(SessionHubSpec fromHub) { - this.name = fromHub.getName(); - this.appDefinition = fromHub.getAppDefinition(); - this.user = fromHub.getUser(); - this.url = fromHub.getUrl(); - this.error = fromHub.getError(); - this.workspace = fromHub.getWorkspace(); - this.lastActivity = fromHub.getLastActivity(); - this.sessionSecret = fromHub.getSessionSecret(); - this.envVars = fromHub.getEnvVars(); - this.envVarsFromConfigMaps = fromHub.getEnvVarsFromConfigMaps(); - this.envVarsFromSecrets = fromHub.getEnvVarsFromSecrets(); + public SessionSpec(SessionHub fromHub) { + this.name = fromHub.getName().orElse(null); + this.appDefinition = fromHub.getAppDefinition().orElse(null); + this.user = fromHub.getUser().orElse(null); + this.workspace = fromHub.getWorkspace().orElse(null); + this.sessionSecret = fromHub.getSessionSecret().orElse(null); + this.envVars = fromHub.getEnvVars().orElse(null); + this.envVarsFromConfigMaps = fromHub.getEnvVarsFromConfigMaps().orElse(null); + this.envVarsFromSecrets = fromHub.getEnvVarsFromSecrets().orElse(null); } public String getName() { @@ -128,10 +115,6 @@ public String getUser() { return user; } - public String getUrl() { - return url; - } - public String getSessionSecret() { return sessionSecret; } @@ -140,38 +123,6 @@ public void setSessionSecret(String sessionSecret) { this.sessionSecret = sessionSecret; } - public void setUrl(String url) { - this.url = url; - } - - public boolean hasUrl() { - return getUrl() != null && !getUrl().isBlank(); - } - - public String getError() { - return error; - } - - public void setError(TheiaCloudError error) { - setError(error.asString()); - } - - public void setError(String error) { - this.error = error; - } - - public boolean hasError() { - return TheiaCloudError.isErrorString(getError()); - } - - public long getLastActivity() { - return lastActivity; - } - - public void setLastActivity(long lastActivity) { - this.lastActivity = lastActivity; - } - public String getWorkspace() { return workspace; } @@ -253,8 +204,8 @@ public boolean equals(Object obj) { @Override public String toString() { - return "SessionSpec [name=" + name + ", appDefinition=" + appDefinition + ", user=" + user + ", url=" + url - + ", error=" + error + ", workspace=" + workspace + ", lastActivity=" + lastActivity + "]"; + return "SessionSpec [name=" + name + ", appDefinition=" + appDefinition + ", user=" + user + ", workspace=" + + workspace + "]"; } public static boolean isEphemeral(String workspace) { diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/SessionStatus.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/SessionStatus.java index 462d13d6..9e98c86a 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/SessionStatus.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/SessionStatus.java @@ -16,8 +16,10 @@ package org.eclipse.theia.cloud.common.k8s.resource.session; import org.eclipse.theia.cloud.common.k8s.resource.ResourceStatus; -import org.eclipse.theia.cloud.common.k8s.resource.session.hub.SessionHubStatus; +import org.eclipse.theia.cloud.common.k8s.resource.session.hub.SessionHub; +import org.eclipse.theia.cloud.common.util.TheiaCloudError; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @JsonDeserialize @@ -30,15 +32,65 @@ public class SessionStatus extends ResourceStatus { /** * Default constructor. */ + + @JsonProperty("url") + private String url; + + @JsonProperty("error") + private String error; + + @JsonProperty("lastActivity") + private long lastActivity; + public SessionStatus() { } - public SessionStatus(SessionHubStatus fromHub) { - if (fromHub.getOperatorMessage() != null) { - this.setOperatorMessage(fromHub.getOperatorMessage()); + public SessionStatus(SessionHub fromHub) { + if (fromHub.getOperatorMessage().isPresent()) { + this.setOperatorMessage(fromHub.getOperatorMessage().get()); } - if (fromHub.getOperatorStatus() != null) { - this.setOperatorStatus(fromHub.getOperatorStatus()); + if (fromHub.getOperatorStatus().isPresent()) { + this.setOperatorStatus(fromHub.getOperatorStatus().get()); } + this.url = fromHub.getUrl().orElse(null); + this.error = fromHub.getError().orElse(null); + this.lastActivity = fromHub.getLastActivity().orElse(null); + } + + public String getUrl() { + return url; + } + + public boolean hasUrl() { + return getUrl() != null && !getUrl().isBlank(); + } + + public String getError() { + return error; + } + + public boolean hasError() { + return TheiaCloudError.isErrorString(getError()); } + + public long getLastActivity() { + return lastActivity; + } + + public void setUrl(String url) { + this.url = url; + } + + public void setError(TheiaCloudError error) { + setError(error.asString()); + } + + public void setError(String error) { + this.error = error; + } + + public void setLastActivity(long lastActivity) { + this.lastActivity = lastActivity; + } + } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/hub/SessionHub.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/hub/SessionHub.java index 1c72abfb..5a9c4da1 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/hub/SessionHub.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/hub/SessionHub.java @@ -15,55 +15,137 @@ ********************************************************************************/ package org.eclipse.theia.cloud.common.k8s.resource.session.hub; +import java.util.List; +import java.util.Map; +import java.util.Optional; + import org.eclipse.theia.cloud.common.k8s.resource.session.Session; import io.fabric8.kubernetes.api.model.ObjectMeta; public class SessionHub { - private ObjectMeta metadata = new ObjectMeta(); - private SessionHubSpec spec; - private SessionHubStatus status; + final Optional metadata; + final Optional name; + final Optional appDefinition; + final Optional user; + final Optional url; + final Optional error; + + final Optional workspace; + final Optional lastActivity; + final Optional sessionSecret; + final Optional> envVars; + final Optional> envVarsFromConfigMaps; + final Optional> envVarsFromSecrets; + + final Optional operatorStatus; + final Optional operatorMessage; + + public SessionHub(Session toHub) { + this.metadata = Optional.ofNullable(toHub.getMetadata()); + this.name = Optional.ofNullable(toHub.getSpec().getName()); + this.appDefinition = Optional.ofNullable(toHub.getSpec().getAppDefinition()); + this.user = Optional.ofNullable(toHub.getSpec().getUser()); + this.workspace = Optional.ofNullable(toHub.getSpec().getWorkspace()); + this.sessionSecret = Optional.ofNullable(toHub.getSpec().getSessionSecret()); + this.envVars = Optional.ofNullable(toHub.getSpec().getEnvVars()); + this.envVarsFromConfigMaps = Optional.ofNullable(toHub.getSpec().getEnvVarsFromConfigMaps()); + this.envVarsFromSecrets = Optional.ofNullable(toHub.getSpec().getEnvVarsFromSecrets()); + // Status is not a required field + if (toHub.getStatus() != null) { + this.lastActivity = Optional.ofNullable(toHub.getStatus().getLastActivity()); + this.url = Optional.ofNullable(toHub.getStatus().getUrl()); + this.error = Optional.ofNullable(toHub.getStatus().getError()); + this.operatorStatus = Optional.ofNullable(toHub.getStatus().getOperatorStatus()); + this.operatorMessage = Optional.ofNullable(toHub.getStatus().getOperatorMessage()); + } else { + this.lastActivity = Optional.empty(); + this.url = Optional.empty(); + this.error = Optional.empty(); + this.operatorStatus = Optional.empty(); + this.operatorMessage = Optional.empty(); + } + } + + @SuppressWarnings("deprecation") + public SessionHub(org.eclipse.theia.cloud.common.k8s.resource.session.v1beta6.SessionV1beta6 toHub) { + this.metadata = Optional.ofNullable(toHub.getMetadata()); + this.name = Optional.ofNullable(toHub.getSpec().getName()); + this.appDefinition = Optional.ofNullable(toHub.getSpec().getAppDefinition()); + this.user = Optional.ofNullable(toHub.getSpec().getUser()); + this.url = Optional.ofNullable(toHub.getSpec().getUrl()); + this.error = Optional.ofNullable(toHub.getSpec().getError()); + this.workspace = Optional.ofNullable(toHub.getSpec().getWorkspace()); + this.lastActivity = Optional.ofNullable(toHub.getSpec().getLastActivity()); + this.sessionSecret = Optional.ofNullable(toHub.getSpec().getName()); + this.envVars = Optional.ofNullable(toHub.getSpec().getEnvVars()); + this.envVarsFromConfigMaps = Optional.ofNullable(toHub.getSpec().getEnvVarsFromConfigMaps()); + this.envVarsFromSecrets = Optional.ofNullable(toHub.getSpec().getEnvVarsFromSecrets()); + // Status is not a required field + if (toHub.getStatus() != null) { + this.operatorStatus = Optional.ofNullable(toHub.getStatus().getOperatorStatus()); + this.operatorMessage = Optional.ofNullable(toHub.getStatus().getOperatorMessage()); + } else { + this.operatorStatus = Optional.empty(); + this.operatorMessage = Optional.empty(); + } + } - public ObjectMeta getMetadata() { + public Optional getMetadata() { return metadata; } - public void setMetadata(ObjectMeta metadata) { - this.metadata = metadata; + public Optional getName() { + return name; } - public SessionHubSpec getSpec() { - return spec; + public Optional getAppDefinition() { + return appDefinition; } - public void setSpec(SessionHubSpec spec) { - this.spec = spec; + public Optional getUser() { + return user; } - public SessionHubStatus getStatus() { - return status; + public Optional getUrl() { + return url; } - public void setStatus(SessionHubStatus status) { - this.status = status; + public Optional getError() { + return error; } - public SessionHub(Session toHub) { - this.setMetadata(toHub.getMetadata()); - this.spec = new SessionHubSpec(toHub.getSpec()); - if (toHub.getStatus() != null) { - this.status = new SessionHubStatus(toHub.getStatus()); - } + public Optional getWorkspace() { + return workspace; } - @SuppressWarnings("deprecation") - public SessionHub(org.eclipse.theia.cloud.common.k8s.resource.session.v1beta5.SessionV1beta5 toHub) { - this.setMetadata(toHub.getMetadata()); - this.spec = new SessionHubSpec(toHub.getSpec()); - if (toHub.getStatus() != null) { - this.status = new SessionHubStatus(toHub.getStatus()); - } + public Optional getLastActivity() { + return lastActivity; + } + + public Optional getSessionSecret() { + return sessionSecret; + } + + public Optional> getEnvVars() { + return envVars; + } + + public Optional> getEnvVarsFromConfigMaps() { + return envVarsFromConfigMaps; + } + + public Optional> getEnvVarsFromSecrets() { + return envVarsFromSecrets; + } + + public Optional getOperatorStatus() { + return operatorStatus; + } + + public Optional getOperatorMessage() { + return operatorMessage; } } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/hub/SessionHubSpec.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/hub/SessionHubSpec.java deleted file mode 100644 index da8602bf..00000000 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/hub/SessionHubSpec.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************** - * Copyright (C) 2023 EclipseSource and others. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the Eclipse - * Public License v. 2.0 are satisfied: GNU General Public License, version 2 - * with the GNU Classpath Exception which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.session.hub; - -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.theia.cloud.common.k8s.resource.session.SessionSpec; - -public class SessionHubSpec { - - private final String name; - private final String appDefinition; - private final String user; - private final String url; - private final String error; - private final String workspace; - private final long lastActivity; - private final String sessionSecret; - private final Map envVars; - private final List envVarsFromConfigMaps; - private final List envVarsFromSecrets; - - public SessionHubSpec(SessionSpec spec) { - this.name = spec.getName(); - this.appDefinition = spec.getAppDefinition(); - this.user = spec.getUser(); - this.url = spec.getUrl(); - this.error = spec.getError(); - this.workspace = spec.getWorkspace(); - this.lastActivity = spec.getLastActivity(); - this.sessionSecret = spec.getSessionSecret(); - if (spec.getEnvVars() != null) { - this.envVars = new LinkedHashMap<>(spec.getEnvVars()); - } else { - this.envVars = new LinkedHashMap<>(); - } - if (spec.getEnvVarsFromConfigMaps() != null) { - this.envVarsFromConfigMaps = new ArrayList<>(spec.getEnvVarsFromConfigMaps()); - } else { - this.envVarsFromConfigMaps = new ArrayList<>(); - } - if (spec.getEnvVarsFromSecrets() != null) { - this.envVarsFromSecrets = new ArrayList<>(spec.getEnvVarsFromSecrets()); - } else { - this.envVarsFromSecrets = new ArrayList<>(); - } - } - - @SuppressWarnings("deprecation") - public SessionHubSpec(org.eclipse.theia.cloud.common.k8s.resource.session.v1beta5.SessionV1beta5Spec spec) { - this.name = spec.getName(); - this.appDefinition = spec.getAppDefinition(); - this.user = spec.getUser(); - this.url = spec.getUrl(); - this.error = spec.getError(); - this.workspace = spec.getWorkspace(); - this.lastActivity = spec.getLastActivity(); - this.sessionSecret = spec.getSessionSecret(); - if (spec.getEnvVars() != null) { - this.envVars = new LinkedHashMap<>(spec.getEnvVars()); - } else { - this.envVars = new LinkedHashMap<>(); - } - if (spec.getEnvVarsFromConfigMaps() != null) { - this.envVarsFromConfigMaps = new ArrayList<>(spec.getEnvVarsFromConfigMaps()); - } else { - this.envVarsFromConfigMaps = new ArrayList<>(); - } - if (spec.getEnvVarsFromSecrets() != null) { - this.envVarsFromSecrets = new ArrayList<>(spec.getEnvVarsFromSecrets()); - } else { - this.envVarsFromSecrets = new ArrayList<>(); - } - } - - public String getName() { - return name; - } - - public String getAppDefinition() { - return appDefinition; - } - - public String getUser() { - return user; - } - - public String getUrl() { - return url; - } - - public String getError() { - return error; - } - - public String getWorkspace() { - return workspace; - } - - public long getLastActivity() { - return lastActivity; - } - - public String getSessionSecret() { - return sessionSecret; - } - - public Map getEnvVars() { - return envVars; - } - - public List getEnvVarsFromConfigMaps() { - return envVarsFromConfigMaps; - } - - public List getEnvVarsFromSecrets() { - return envVarsFromSecrets; - } - - @Override - public String toString() { - return "SessionHubSpec [name=" + name + ", appDefinition=" + appDefinition + ", user=" + user + ", url=" + url - + ", error=" + error + ", workspace=" + workspace + ", lastActivity=" + lastActivity - + ", sessionSecret=" + sessionSecret + ", envVars=" + envVars + ", envVarsFromConfigMaps=" - + envVarsFromConfigMaps + ", envVarsFromSecrets=" + envVarsFromSecrets + "]"; - } - -} diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/hub/SessionHubStatus.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/hub/SessionHubStatus.java deleted file mode 100644 index 25c763df..00000000 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/hub/SessionHubStatus.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************** - * Copyright (C) 2023 EclipseSource and others. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the Eclipse - * Public License v. 2.0 are satisfied: GNU General Public License, version 2 - * with the GNU Classpath Exception which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.session.hub; - -import org.eclipse.theia.cloud.common.k8s.resource.ResourceStatus; -import org.eclipse.theia.cloud.common.k8s.resource.session.SessionStatus; - -public class SessionHubStatus extends ResourceStatus { - - public SessionHubStatus(SessionStatus toHub) { - if (toHub.getOperatorMessage() != null) { - this.setOperatorMessage(toHub.getOperatorMessage()); - } - if (toHub.getOperatorStatus() != null) { - this.setOperatorStatus(toHub.getOperatorStatus()); - } - } - - @SuppressWarnings("deprecation") - public SessionHubStatus(org.eclipse.theia.cloud.common.k8s.resource.session.v1beta5.SessionV1beta5Status toHub) { - if (toHub.getOperatorMessage() != null) { - this.setOperatorMessage(toHub.getOperatorMessage()); - } - if (toHub.getOperatorStatus() != null) { - this.setOperatorStatus(toHub.getOperatorStatus()); - } - } - -} diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta5/SessionV1beta5.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta6/SessionV1beta6.java similarity index 76% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta5/SessionV1beta5.java rename to java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta6/SessionV1beta6.java index 1f8867b1..04e48d81 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta5/SessionV1beta5.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta6/SessionV1beta6.java @@ -14,7 +14,7 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.session.v1beta5; +package org.eclipse.theia.cloud.common.k8s.resource.session.v1beta6; import org.eclipse.theia.cloud.common.k8s.resource.session.hub.SessionHub; import org.eclipse.theia.cloud.common.util.CustomResourceUtil; @@ -28,26 +28,27 @@ import io.fabric8.kubernetes.model.annotation.Version; @Deprecated -@Version("v1beta5") +@Version("v1beta6") @Group("theia.cloud") @Kind("Session") @Singular("session") @Plural("sessions") -public class SessionV1beta5 extends CustomResource implements Namespaced { +public class SessionV1beta6 extends CustomResource implements Namespaced { - public static final String API = "theia.cloud/v1beta5"; + private static final long serialVersionUID = 4518092300237069237L; + public static final String API = "theia.cloud/v1beta6"; public static final String KIND = "Session"; public static final String CRD_NAME = "sessions.theia.cloud"; - public SessionV1beta5() { + public SessionV1beta6() { } - public SessionV1beta5(SessionHub fromHub) { - this.setMetadata(fromHub.getMetadata()); - this.spec = new SessionV1beta5Spec(fromHub.getSpec()); - if (fromHub.getStatus() != null) { - this.status = new SessionV1beta5Status(fromHub.getStatus()); + public SessionV1beta6(SessionHub fromHub) { + if (fromHub.getMetadata().isPresent()) { + this.setMetadata(fromHub.getMetadata().get()); } + this.spec = new SessionV1beta6Spec(fromHub); + this.status = new SessionV1beta6Status(fromHub); } @Override diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta5/SessionV1beta5Spec.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta6/SessionV1beta6Spec.java similarity index 85% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta5/SessionV1beta5Spec.java rename to java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta6/SessionV1beta6Spec.java index 2e29b3f3..1e1ac0c4 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta5/SessionV1beta5Spec.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta6/SessionV1beta6Spec.java @@ -14,13 +14,13 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.session.v1beta5; +package org.eclipse.theia.cloud.common.k8s.resource.session.v1beta6; import java.util.List; import java.util.Map; import org.eclipse.theia.cloud.common.k8s.resource.UserScopedSpec; -import org.eclipse.theia.cloud.common.k8s.resource.session.hub.SessionHubSpec; +import org.eclipse.theia.cloud.common.k8s.resource.session.hub.SessionHub; import org.eclipse.theia.cloud.common.util.TheiaCloudError; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -29,7 +29,7 @@ @Deprecated @JsonDeserialize() -public class SessionV1beta5Spec implements UserScopedSpec { +public class SessionV1beta6Spec implements UserScopedSpec { @JsonProperty("name") private String name; @@ -64,42 +64,31 @@ public class SessionV1beta5Spec implements UserScopedSpec { @JsonProperty("envVarsFromSecrets") private List envVarsFromSecrets; - public SessionV1beta5Spec() { + /** + * Default constructor. + */ + public SessionV1beta6Spec() { } - public SessionV1beta5Spec(SessionHubSpec fromHub) { - this.name = fromHub.getName(); - this.appDefinition = fromHub.getAppDefinition(); - this.user = fromHub.getUser(); - this.url = fromHub.getUrl(); - this.error = fromHub.getError(); - this.workspace = fromHub.getWorkspace(); - this.lastActivity = fromHub.getLastActivity(); - this.sessionSecret = fromHub.getSessionSecret(); - this.envVars = fromHub.getEnvVars(); - this.envVarsFromConfigMaps = fromHub.getEnvVarsFromConfigMaps(); - this.envVarsFromSecrets = fromHub.getEnvVarsFromSecrets(); - } - - public SessionV1beta5Spec(String name, String appDefinition, String user) { + public SessionV1beta6Spec(String name, String appDefinition, String user) { this(name, appDefinition, user, null); } - public SessionV1beta5Spec(String name, String appDefinition, String user, String workspace) { + public SessionV1beta6Spec(String name, String appDefinition, String user, String workspace) { this(name, appDefinition, user, workspace, Map.of(), List.of(), List.of()); } - public SessionV1beta5Spec(String name, String appDefinition, String user, String workspace, + public SessionV1beta6Spec(String name, String appDefinition, String user, String workspace, Map envVars) { this(name, appDefinition, user, workspace, envVars, List.of(), List.of()); } - public SessionV1beta5Spec(String name, String appDefinition, String user, String workspace, + public SessionV1beta6Spec(String name, String appDefinition, String user, String workspace, Map envVars, List envVarsFromConfigMaps) { this(name, appDefinition, user, workspace, envVars, envVarsFromConfigMaps, List.of()); } - public SessionV1beta5Spec(String name, String appDefinition, String user, String workspace, + public SessionV1beta6Spec(String name, String appDefinition, String user, String workspace, Map envVars, List envVarsFromConfigMaps, List envVarsFromSecrets) { this.name = name; this.appDefinition = appDefinition; @@ -110,6 +99,20 @@ public SessionV1beta5Spec(String name, String appDefinition, String user, String this.envVarsFromSecrets = envVarsFromSecrets; } + public SessionV1beta6Spec(SessionHub fromHub) { + this.name = fromHub.getName().orElse(null); + this.appDefinition = fromHub.getAppDefinition().orElse(null); + this.user = fromHub.getUser().orElse(null); + this.url = fromHub.getUrl().orElse(null); + this.error = fromHub.getError().orElse(null); + this.workspace = fromHub.getWorkspace().orElse(null); + this.lastActivity = fromHub.getLastActivity().orElse(null); + this.sessionSecret = fromHub.getSessionSecret().orElse(null); + this.envVars = fromHub.getEnvVars().orElse(null); + this.envVarsFromConfigMaps = fromHub.getEnvVarsFromConfigMaps().orElse(null); + this.envVarsFromSecrets = fromHub.getEnvVarsFromSecrets().orElse(null); + } + public String getName() { return name; } @@ -211,7 +214,7 @@ public boolean equals(Object obj) { return false; if (getClass() != obj.getClass()) return false; - SessionV1beta5Spec other = (SessionV1beta5Spec) obj; + SessionV1beta6Spec other = (SessionV1beta6Spec) obj; if (appDefinition == null) { if (other.appDefinition != null) return false; diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta5/SessionV1beta5SpecResourceList.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta6/SessionV1beta6SpecResourceList.java similarity index 79% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta5/SessionV1beta5SpecResourceList.java rename to java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta6/SessionV1beta6SpecResourceList.java index 16a9c8a7..07ca10d4 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta5/SessionV1beta5SpecResourceList.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta6/SessionV1beta6SpecResourceList.java @@ -14,11 +14,13 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.session.v1beta5; +package org.eclipse.theia.cloud.common.k8s.resource.session.v1beta6; -import io.fabric8.kubernetes.client.CustomResourceList; +import io.fabric8.kubernetes.api.model.DefaultKubernetesResourceList; @Deprecated -public class SessionV1beta5SpecResourceList extends CustomResourceList { +public class SessionV1beta6SpecResourceList extends DefaultKubernetesResourceList { + + private static final long serialVersionUID = -4808662679268313876L; } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta5/SessionV1beta5Status.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta6/SessionV1beta6Status.java similarity index 61% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta5/SessionV1beta5Status.java rename to java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta6/SessionV1beta6Status.java index fa1d2a25..4e10528c 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta5/SessionV1beta5Status.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/session/v1beta6/SessionV1beta6Status.java @@ -13,26 +13,33 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.session.v1beta5; +package org.eclipse.theia.cloud.common.k8s.resource.session.v1beta6; import org.eclipse.theia.cloud.common.k8s.resource.ResourceStatus; -import org.eclipse.theia.cloud.common.k8s.resource.session.hub.SessionHubStatus; +import org.eclipse.theia.cloud.common.k8s.resource.session.hub.SessionHub; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @Deprecated @JsonDeserialize -public class SessionV1beta5Status extends ResourceStatus { +public class SessionV1beta6Status extends ResourceStatus { + // This class is empty as only the common properties of the super class are + // used. Already define a specific class to allow easier extension, properly + // type the resources and resource clients. + // It is planned to extend this later with Session specific status steps. - public SessionV1beta5Status() { + /** + * Default constructor. + */ + public SessionV1beta6Status() { } - public SessionV1beta5Status(SessionHubStatus fromHub) { - if (fromHub.getOperatorMessage() != null) { - this.setOperatorMessage(fromHub.getOperatorMessage()); + public SessionV1beta6Status(SessionHub fromHub) { + if (fromHub.getOperatorMessage().isPresent()) { + this.setOperatorMessage(fromHub.getOperatorMessage().get()); } - if (fromHub.getOperatorStatus() != null) { - this.setOperatorStatus(fromHub.getOperatorStatus()); + if (fromHub.getOperatorStatus().isPresent()) { + this.setOperatorStatus(fromHub.getOperatorStatus().get()); } } } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/Workspace.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/Workspace.java index 67dc6cd6..ec7d7a17 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/Workspace.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/Workspace.java @@ -26,14 +26,14 @@ import io.fabric8.kubernetes.model.annotation.Singular; import io.fabric8.kubernetes.model.annotation.Version; -@Version("v1beta3") +@Version("v1beta4") @Group("theia.cloud") @Kind("Workspace") @Singular("workspace") @Plural("workspaces") public class Workspace extends CustomResource implements Namespaced { - public static final String API = "theia.cloud/v1beta3"; + public static final String API = "theia.cloud/v1beta4"; public static final String CRD_NAME = "workspaces.theia.cloud"; public static final String KIND = "Workspace"; @@ -43,11 +43,11 @@ public Workspace() { } public Workspace(WorkspaceHub fromHub) { - this.setMetadata(fromHub.getMetadata()); - this.spec = new WorkspaceSpec(fromHub.getSpec()); - if (fromHub.getStatus() != null) { - this.status = new WorkspaceStatus(fromHub.getStatus()); + if (fromHub.getMetadata().isPresent()) { + this.setMetadata(fromHub.getMetadata().get()); } + this.spec = new WorkspaceSpec(fromHub); + this.status = new WorkspaceStatus(fromHub); } @Override diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/WorkspaceSpec.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/WorkspaceSpec.java index dda07fe2..53775c75 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/WorkspaceSpec.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/WorkspaceSpec.java @@ -17,8 +17,7 @@ package org.eclipse.theia.cloud.common.k8s.resource.workspace; import org.eclipse.theia.cloud.common.k8s.resource.UserScopedSpec; -import org.eclipse.theia.cloud.common.k8s.resource.workspace.hub.WorkspaceHubSpec; -import org.eclipse.theia.cloud.common.util.TheiaCloudError; +import org.eclipse.theia.cloud.common.k8s.resource.workspace.hub.WorkspaceHub; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -41,9 +40,6 @@ public class WorkspaceSpec implements UserScopedSpec { @JsonProperty("storage") private String storage; - @JsonProperty("error") - private String error; - /** * Default constructor. */ @@ -57,13 +53,12 @@ public WorkspaceSpec(String name, String label, String appDefinition, String use this.label = label; } - public WorkspaceSpec(WorkspaceHubSpec spec) { - this.name = spec.getName(); - this.label = spec.getLabel(); - this.appDefinition = spec.getAppDefinition(); - this.user = spec.getUser(); - this.storage = spec.getStorage(); - this.error = spec.getError(); + public WorkspaceSpec(WorkspaceHub spec) { + this.name = spec.getName().orElse(null); // required + this.label = spec.getLabel().orElse(null); + this.appDefinition = spec.getAppDefinition().orElse(null); + this.user = spec.getUser().orElse(null); // required + this.storage = spec.getStorage().orElse(null); } public String getName() { @@ -103,30 +98,14 @@ public void setStorage(String storage) { this.storage = storage; } - public String getError() { - return error; - } - - public void setError(TheiaCloudError error) { - setError(error.asString()); - } - - public void setError(String error) { - this.error = error; - } - public boolean hasStorage() { return getStorage() != null && !getStorage().isBlank(); } - public boolean hasError() { - return TheiaCloudError.isErrorString(getError()); - } - @Override public String toString() { return "WorkspaceSpec [name=" + name + ", label=" + label + ", appDefinition=" + appDefinition + ", user=" - + user + ", storage=" + storage + ", error=" + error + "]"; + + user + ", storage=" + storage + "]"; } } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/WorkspaceStatus.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/WorkspaceStatus.java index 48077def..4b0c566e 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/WorkspaceStatus.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/WorkspaceStatus.java @@ -17,7 +17,8 @@ import org.eclipse.theia.cloud.common.k8s.resource.ResourceStatus; import org.eclipse.theia.cloud.common.k8s.resource.StatusStep; -import org.eclipse.theia.cloud.common.k8s.resource.workspace.hub.WorkspaceHubStatus; +import org.eclipse.theia.cloud.common.k8s.resource.workspace.hub.WorkspaceHub; +import org.eclipse.theia.cloud.common.util.TheiaCloudError; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -31,25 +32,33 @@ public class WorkspaceStatus extends ResourceStatus { @JsonProperty("volumeAttach") private StatusStep volumeAttach; + @JsonProperty("error") + private String error; + /** * Default constructor. */ public WorkspaceStatus() { } - public WorkspaceStatus(WorkspaceHubStatus fromHub) { - if (fromHub.getOperatorMessage() != null) { - this.setOperatorMessage(fromHub.getOperatorMessage()); + public WorkspaceStatus(WorkspaceHub fromHub) { + if (fromHub.getOperatorMessage().isPresent()) { + this.setOperatorMessage(fromHub.getOperatorMessage().get()); } - if (fromHub.getOperatorStatus() != null) { - this.setOperatorStatus(fromHub.getOperatorStatus()); + if (fromHub.getOperatorStatus().isPresent()) { + this.setOperatorStatus(fromHub.getOperatorStatus().get()); } - if (fromHub.getVolumeClaim() != null) { - this.setVolumeClaim(fromHub.getVolumeClaim()); + if (fromHub.getVolumeAttachMessage().isPresent() && fromHub.getVolumeAttachStatus().isPresent()) { + this.volumeAttach = new StatusStep(); + this.volumeAttach.setStatus(fromHub.getVolumeAttachStatus().get()); + this.volumeAttach.setMessage(fromHub.getVolumeAttachMessage().get()); } - if (fromHub.getVolumeAttach() != null) { - this.setVolumeClaim(fromHub.getVolumeAttach()); + if (fromHub.getVolumeClaimMessage().isPresent() && fromHub.getVolumeClaimStatus().isPresent()) { + this.volumeClaim = new StatusStep(); + this.volumeClaim.setStatus(fromHub.getVolumeClaimStatus().get()); + this.volumeClaim.setMessage(fromHub.getVolumeClaimMessage().get()); } + this.error = fromHub.getError().orElse(null); } public StatusStep getVolumeClaim() { @@ -67,4 +76,20 @@ public StatusStep getVolumeAttach() { public void setVolumeAttach(StatusStep volumeAttach) { this.volumeAttach = volumeAttach; } + + public String getError() { + return error; + } + + public void setError(TheiaCloudError error) { + setError(error.asString()); + } + + public void setError(String error) { + this.error = error; + } + + public boolean hasError() { + return TheiaCloudError.isErrorString(getError()); + } } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/hub/WorkspaceHub.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/hub/WorkspaceHub.java index 1c1fe83a..7aaf6291 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/hub/WorkspaceHub.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/hub/WorkspaceHub.java @@ -15,54 +15,153 @@ ********************************************************************************/ package org.eclipse.theia.cloud.common.k8s.resource.workspace.hub; +import java.util.Optional; + import org.eclipse.theia.cloud.common.k8s.resource.workspace.Workspace; import io.fabric8.kubernetes.api.model.ObjectMeta; public class WorkspaceHub { - private ObjectMeta metadata = new ObjectMeta(); - private WorkspaceHubSpec spec; - private WorkspaceHubStatus status; + final Optional metadata; + final Optional name; + final Optional label; + final Optional appDefinition; + final Optional user; + final Optional storage; + final Optional error; + + final Optional volumeClaimStatus; + final Optional volumeClaimMessage; + final Optional volumeAttachStatus; + final Optional volumeAttachMessage; + final Optional operatorStatus; + final Optional operatorMessage; + + public WorkspaceHub(Workspace toHub) { + this.metadata = Optional.ofNullable(toHub.getMetadata()); + this.name = Optional.ofNullable(toHub.getSpec().getName()); + this.label = Optional.ofNullable(toHub.getSpec().getLabel()); + this.appDefinition = Optional.ofNullable(toHub.getSpec().getAppDefinition()); + this.user = Optional.ofNullable(toHub.getSpec().getUser()); + this.storage = Optional.ofNullable(toHub.getSpec().getStorage()); + if (toHub.getStatus() != null) { + this.error = Optional.ofNullable(toHub.getStatus().getError()); + if (toHub.getStatus().getVolumeClaim() != null) { + this.volumeClaimStatus = Optional.ofNullable(toHub.getStatus().getVolumeClaim().getStatus()); + this.volumeClaimMessage = Optional.ofNullable(toHub.getStatus().getVolumeClaim().getMessage()); + } else { + this.volumeClaimStatus = Optional.empty(); + this.volumeClaimMessage = Optional.empty(); + } + if (toHub.getStatus().getVolumeAttach() != null) { + this.volumeAttachStatus = Optional.ofNullable(toHub.getStatus().getVolumeAttach().getStatus()); + this.volumeAttachMessage = Optional.ofNullable(toHub.getStatus().getVolumeAttach().getMessage()); + } else { + this.volumeAttachStatus = Optional.empty(); + this.volumeAttachMessage = Optional.empty(); + } + this.operatorStatus = Optional.ofNullable(toHub.getStatus().getOperatorStatus()); + this.operatorMessage = Optional.ofNullable(toHub.getStatus().getOperatorMessage()); + } else { + this.error = Optional.empty(); + this.volumeClaimStatus = Optional.empty(); + this.volumeClaimMessage = Optional.empty(); + this.volumeAttachStatus = Optional.empty(); + this.volumeAttachMessage = Optional.empty(); + this.operatorStatus = Optional.empty(); + this.operatorMessage = Optional.empty(); + + } + } + + @SuppressWarnings("deprecation") + public WorkspaceHub(org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta3.WorkspaceV1beta3 toHub) { + this.metadata = Optional.ofNullable(toHub.getMetadata()); + this.name = Optional.ofNullable(toHub.getSpec().getName()); + this.label = Optional.ofNullable(toHub.getSpec().getLabel()); + this.appDefinition = Optional.ofNullable(toHub.getSpec().getAppDefinition()); + this.user = Optional.ofNullable(toHub.getSpec().getUser()); + this.storage = Optional.ofNullable(toHub.getSpec().getStorage()); + this.error = Optional.ofNullable(toHub.getSpec().getError()); + if (toHub.getStatus() != null) { + if (toHub.getStatus().getVolumeClaim() != null) { + this.volumeClaimStatus = Optional.ofNullable(toHub.getStatus().getVolumeClaim().getStatus()); + this.volumeClaimMessage = Optional.ofNullable(toHub.getStatus().getVolumeClaim().getMessage()); + } else { + this.volumeClaimStatus = Optional.empty(); + this.volumeClaimMessage = Optional.empty(); + } + if (toHub.getStatus().getVolumeAttach() != null) { + this.volumeAttachStatus = Optional.ofNullable(toHub.getStatus().getVolumeAttach().getStatus()); + this.volumeAttachMessage = Optional.ofNullable(toHub.getStatus().getVolumeAttach().getMessage()); + } else { + this.volumeAttachStatus = Optional.empty(); + this.volumeAttachMessage = Optional.empty(); + } + this.operatorStatus = Optional.ofNullable(toHub.getStatus().getOperatorStatus()); + this.operatorMessage = Optional.ofNullable(toHub.getStatus().getOperatorMessage()); + } else { + this.volumeClaimStatus = Optional.empty(); + this.volumeClaimMessage = Optional.empty(); + this.volumeAttachStatus = Optional.empty(); + this.volumeAttachMessage = Optional.empty(); + this.operatorStatus = Optional.empty(); + this.operatorMessage = Optional.empty(); + + } + } - public ObjectMeta getMetadata() { + public Optional getMetadata() { return metadata; } - public void setMetadata(ObjectMeta metadata) { - this.metadata = metadata; + public Optional getName() { + return name; } - public WorkspaceHubSpec getSpec() { - return spec; + public Optional getLabel() { + return label; } - public void setSpec(WorkspaceHubSpec spec) { - this.spec = spec; + public Optional getAppDefinition() { + return appDefinition; } - public WorkspaceHubStatus getStatus() { - return status; + public Optional getUser() { + return user; } - public void setStatus(WorkspaceHubStatus status) { - this.status = status; + public Optional getStorage() { + return storage; } - public WorkspaceHub(Workspace toHub) { - this.setMetadata(toHub.getMetadata()); - this.spec = new WorkspaceHubSpec(toHub.getSpec()); - if (toHub.getStatus() != null) { - this.status = new WorkspaceHubStatus(toHub.getStatus()); - } + public Optional getError() { + return error; } - @SuppressWarnings("deprecation") - public WorkspaceHub(org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta2.WorkspaceV1beta2 toHub) { - this.setMetadata(toHub.getMetadata()); - this.spec = new WorkspaceHubSpec(toHub.getSpec()); - if (toHub.getStatus() != null) { - this.status = new WorkspaceHubStatus(toHub.getStatus()); - } + public Optional getVolumeClaimStatus() { + return volumeClaimStatus; + } + + public Optional getVolumeClaimMessage() { + return volumeClaimMessage; + } + + public Optional getVolumeAttachStatus() { + return volumeAttachStatus; } + + public Optional getVolumeAttachMessage() { + return volumeAttachMessage; + } + + public Optional getOperatorStatus() { + return operatorStatus; + } + + public Optional getOperatorMessage() { + return operatorMessage; + } + } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/hub/WorkspaceHubSpec.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/hub/WorkspaceHubSpec.java deleted file mode 100644 index 447e93f9..00000000 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/hub/WorkspaceHubSpec.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************** - * Copyright (C) 2023 EclipseSource and others. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the Eclipse - * Public License v. 2.0 are satisfied: GNU General Public License, version 2 - * with the GNU Classpath Exception which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.workspace.hub; - -import org.eclipse.theia.cloud.common.k8s.resource.workspace.WorkspaceSpec; - -public class WorkspaceHubSpec { - - private final String name; - private final String label; - private final String appDefinition; - private final String user; - private final String storage; - private final String error; - - public WorkspaceHubSpec(WorkspaceSpec spec) { - this.name = spec.getName(); - this.label = spec.getLabel(); - this.appDefinition = spec.getAppDefinition(); - this.user = spec.getUser(); - this.storage = spec.getStorage(); - this.error = spec.getError(); - } - - @SuppressWarnings("deprecation") - public WorkspaceHubSpec(org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta2.WorkspaceV1beta2Spec spec) { - this.name = spec.getName(); - this.label = spec.getLabel(); - this.appDefinition = spec.getAppDefinition(); - this.user = spec.getUser(); - this.storage = spec.getStorage(); - this.error = spec.getError(); - } - - public String getName() { - return name; - } - - public String getLabel() { - return label; - } - - public String getAppDefinition() { - return appDefinition; - } - - public String getUser() { - return user; - } - - public String getStorage() { - return storage; - } - - public String getError() { - return error; - } - - @Override - public String toString() { - return "WorkspaceHubSpec [name=" + name + ", label=" + label + ", appDefinition=" + appDefinition + ", user=" - + user + ", storage=" + storage + ", error=" + error + "]"; - } - -} diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/hub/WorkspaceHubStatus.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/hub/WorkspaceHubStatus.java deleted file mode 100644 index dad6355a..00000000 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/hub/WorkspaceHubStatus.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************** - * Copyright (C) 2023 EclipseSource and others. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the Eclipse - * Public License v. 2.0 are satisfied: GNU General Public License, version 2 - * with the GNU Classpath Exception which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.workspace.hub; - -import org.eclipse.theia.cloud.common.k8s.resource.ResourceStatus; -import org.eclipse.theia.cloud.common.k8s.resource.StatusStep; -import org.eclipse.theia.cloud.common.k8s.resource.workspace.WorkspaceStatus; - -public class WorkspaceHubStatus extends ResourceStatus { - - private final StatusStep volumeClaim; - private final StatusStep volumeAttach; - - public WorkspaceHubStatus(WorkspaceStatus toHub) { - if (toHub.getOperatorMessage() != null) { - this.setOperatorMessage(toHub.getOperatorMessage()); - } - if (toHub.getOperatorStatus() != null) { - this.setOperatorStatus(toHub.getOperatorStatus()); - } - if (toHub.getVolumeClaim() != null) { - this.volumeClaim = toHub.getVolumeClaim(); - } else { - this.volumeClaim = new StatusStep(); - } - if (toHub.getVolumeAttach() != null) { - this.volumeAttach = toHub.getVolumeAttach(); - } else { - this.volumeAttach = new StatusStep(); - } - } - - @SuppressWarnings("deprecation") - public WorkspaceHubStatus( - org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta2.WorkspaceV1beta2Status toHub) { - if (toHub.getOperatorMessage() != null) { - this.setOperatorMessage(toHub.getOperatorMessage()); - } - if (toHub.getOperatorStatus() != null) { - this.setOperatorStatus(toHub.getOperatorStatus()); - } - if (toHub.getVolumeClaim() != null) { - this.volumeClaim = toHub.getVolumeClaim(); - } else { - this.volumeClaim = new StatusStep(); - } - if (toHub.getVolumeAttach() != null) { - this.volumeAttach = toHub.getVolumeAttach(); - } else { - this.volumeAttach = new StatusStep(); - } - } - - public StatusStep getVolumeClaim() { - return volumeClaim; - } - - public StatusStep getVolumeAttach() { - return volumeAttach; - } - - @Override - public String toString() { - return "WorkspaceHubStatus [volumeClaim=" + volumeClaim + ", volumeAttach=" + volumeAttach + "]"; - } - -} diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta2/WorkspaceV1beta2.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta3/WorkspaceV1beta3.java similarity index 76% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta2/WorkspaceV1beta2.java rename to java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta3/WorkspaceV1beta3.java index 96727774..2e03c542 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta2/WorkspaceV1beta2.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta3/WorkspaceV1beta3.java @@ -13,7 +13,7 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta2; +package org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta3; import org.eclipse.theia.cloud.common.k8s.resource.workspace.hub.WorkspaceHub; import org.eclipse.theia.cloud.common.util.CustomResourceUtil; @@ -27,27 +27,29 @@ import io.fabric8.kubernetes.model.annotation.Version; @Deprecated -@Version("v1beta2") +@Version("v1beta3") @Group("theia.cloud") @Kind("Workspace") @Singular("workspace") @Plural("workspaces") -public class WorkspaceV1beta2 extends CustomResource +public class WorkspaceV1beta3 extends CustomResource implements Namespaced { - public static final String API = "theia.cloud/v1beta2"; + public static final String API = "theia.cloud/v1beta3"; public static final String CRD_NAME = "workspaces.theia.cloud"; public static final String KIND = "Workspace"; - public WorkspaceV1beta2() { + private static final long serialVersionUID = 6437279756051357397L; + + public WorkspaceV1beta3() { } - public WorkspaceV1beta2(WorkspaceHub fromHub) { - this.setMetadata(fromHub.getMetadata()); - this.spec = new WorkspaceV1beta2Spec(fromHub.getSpec()); - if (fromHub.getStatus() != null) { - this.status = new WorkspaceV1beta2Status(fromHub.getStatus()); + public WorkspaceV1beta3(WorkspaceHub fromHub) { + if (fromHub.getMetadata().isPresent()) { + this.setMetadata(fromHub.getMetadata().get()); } + this.spec = new WorkspaceV1beta3Spec(fromHub); + this.status = new WorkspaceV1beta3Status(fromHub); } @Override diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta2/WorkspaceV1beta2Spec.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta3/WorkspaceV1beta3Spec.java similarity index 84% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta2/WorkspaceV1beta2Spec.java rename to java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta3/WorkspaceV1beta3Spec.java index 86fa53e8..ff97ec18 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta2/WorkspaceV1beta2Spec.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta3/WorkspaceV1beta3Spec.java @@ -14,10 +14,10 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta2; +package org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta3; import org.eclipse.theia.cloud.common.k8s.resource.UserScopedSpec; -import org.eclipse.theia.cloud.common.k8s.resource.workspace.hub.WorkspaceHubSpec; +import org.eclipse.theia.cloud.common.k8s.resource.workspace.hub.WorkspaceHub; import org.eclipse.theia.cloud.common.util.TheiaCloudError; import com.fasterxml.jackson.annotation.JsonProperty; @@ -25,7 +25,7 @@ @Deprecated @JsonDeserialize() -public class WorkspaceV1beta2Spec implements UserScopedSpec { +public class WorkspaceV1beta3Spec implements UserScopedSpec { @JsonProperty("name") private String name; @@ -45,23 +45,26 @@ public class WorkspaceV1beta2Spec implements UserScopedSpec { @JsonProperty("error") private String error; - public WorkspaceV1beta2Spec() { + /** + * Default constructor. + */ + public WorkspaceV1beta3Spec() { } - public WorkspaceV1beta2Spec(String name, String label, String appDefinition, String user) { + public WorkspaceV1beta3Spec(String name, String label, String appDefinition, String user) { this.name = name; this.appDefinition = appDefinition; this.user = user; this.label = label; } - public WorkspaceV1beta2Spec(WorkspaceHubSpec spec) { - this.name = spec.getName(); - this.label = spec.getLabel(); - this.appDefinition = spec.getAppDefinition(); - this.user = spec.getUser(); - this.storage = spec.getStorage(); - this.error = spec.getError(); + public WorkspaceV1beta3Spec(WorkspaceHub spec) { + this.name = spec.getName().orElse(null); // required + this.label = spec.getLabel().orElse(null); + this.appDefinition = spec.getAppDefinition().orElse(null); + this.user = spec.getUser().orElse(null); // required + this.storage = spec.getStorage().orElse(null); + this.error = spec.getError().orElse(null); } public String getName() { diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta2/WorkspaceV1beta2SpecResourceList.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta3/WorkspaceV1beta3SpecResourceList.java similarity index 78% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta2/WorkspaceV1beta2SpecResourceList.java rename to java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta3/WorkspaceV1beta3SpecResourceList.java index 6741aff8..f58af158 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta2/WorkspaceV1beta2SpecResourceList.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta3/WorkspaceV1beta3SpecResourceList.java @@ -13,11 +13,13 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta2; +package org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta3; -import io.fabric8.kubernetes.client.CustomResourceList; +import io.fabric8.kubernetes.api.model.DefaultKubernetesResourceList; @Deprecated -public class WorkspaceV1beta2SpecResourceList extends CustomResourceList { +public class WorkspaceV1beta3SpecResourceList extends DefaultKubernetesResourceList { + + private static final long serialVersionUID = -1041641821546201565L; } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta2/WorkspaceV1beta2Status.java b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta3/WorkspaceV1beta3Status.java similarity index 63% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta2/WorkspaceV1beta2Status.java rename to java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta3/WorkspaceV1beta3Status.java index 3f87f7f3..388b6bc3 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta2/WorkspaceV1beta2Status.java +++ b/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/workspace/v1beta3/WorkspaceV1beta3Status.java @@ -13,18 +13,18 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta2; +package org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta3; import org.eclipse.theia.cloud.common.k8s.resource.ResourceStatus; import org.eclipse.theia.cloud.common.k8s.resource.StatusStep; -import org.eclipse.theia.cloud.common.k8s.resource.workspace.hub.WorkspaceHubStatus; +import org.eclipse.theia.cloud.common.k8s.resource.workspace.hub.WorkspaceHub; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @Deprecated @JsonDeserialize -public class WorkspaceV1beta2Status extends ResourceStatus { +public class WorkspaceV1beta3Status extends ResourceStatus { @JsonProperty("volumeClaim") private StatusStep volumeClaim; @@ -32,21 +32,28 @@ public class WorkspaceV1beta2Status extends ResourceStatus { @JsonProperty("volumeAttach") private StatusStep volumeAttach; - public WorkspaceV1beta2Status() { + /** + * Default constructor. + */ + public WorkspaceV1beta3Status() { } - public WorkspaceV1beta2Status(WorkspaceHubStatus fromHub) { - if (fromHub.getOperatorMessage() != null) { - this.setOperatorMessage(fromHub.getOperatorMessage()); + public WorkspaceV1beta3Status(WorkspaceHub fromHub) { + if (fromHub.getOperatorMessage().isPresent()) { + this.setOperatorMessage(fromHub.getOperatorMessage().get()); } - if (fromHub.getOperatorStatus() != null) { - this.setOperatorStatus(fromHub.getOperatorStatus()); + if (fromHub.getOperatorStatus().isPresent()) { + this.setOperatorStatus(fromHub.getOperatorStatus().get()); } - if (fromHub.getVolumeClaim() != null) { - this.setVolumeClaim(fromHub.getVolumeClaim()); + if (fromHub.getVolumeAttachMessage().isPresent() && fromHub.getVolumeAttachStatus().isPresent()) { + this.volumeAttach = new StatusStep(); + this.volumeAttach.setStatus(fromHub.getVolumeAttachStatus().get()); + this.volumeAttach.setMessage(fromHub.getVolumeAttachMessage().get()); } - if (fromHub.getVolumeAttach() != null) { - this.setVolumeClaim(fromHub.getVolumeAttach()); + if (fromHub.getVolumeClaimMessage().isPresent() && fromHub.getVolumeClaimStatus().isPresent()) { + this.volumeClaim = new StatusStep(); + this.volumeClaim.setStatus(fromHub.getVolumeClaimStatus().get()); + this.volumeClaim.setMessage(fromHub.getVolumeClaimMessage().get()); } } diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/resources/META-INF/services/io.fabric8.kubernetes.api.model.KubernetesResource b/java/common/org.eclipse.theia.cloud.common/src/main/resources/META-INF/services/io.fabric8.kubernetes.api.model.KubernetesResource index 29f430bf..30bd7c60 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/resources/META-INF/services/io.fabric8.kubernetes.api.model.KubernetesResource +++ b/java/common/org.eclipse.theia.cloud.common/src/main/resources/META-INF/services/io.fabric8.kubernetes.api.model.KubernetesResource @@ -1,6 +1,6 @@ org.eclipse.theia.cloud.common.k8s.resource.appdefinition.AppDefinition -org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta7.AppDefinitionV1beta7 +org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta8.AppDefinitionV1beta8 org.eclipse.theia.cloud.common.k8s.resource.session.Session -org.eclipse.theia.cloud.common.k8s.resource.session.v1beta5.SessionV1beta5 +org.eclipse.theia.cloud.common.k8s.resource.session.v1beta6.SessionV1beta6 org.eclipse.theia.cloud.common.k8s.resource.workspace.Workspace -org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta2.WorkspaceV1beta2 \ No newline at end of file +org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta3.WorkspaceV1beta3 \ No newline at end of file diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/.dockerignore b/java/conversion/org.eclipse.theia.cloud.conversion/.dockerignore new file mode 100644 index 00000000..94810d00 --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/.dockerignore @@ -0,0 +1,5 @@ +* +!target/*-runner +!target/*-runner.jar +!target/lib/* +!target/quarkus-app/* \ No newline at end of file diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/.gitignore b/java/conversion/org.eclipse.theia.cloud.conversion/.gitignore new file mode 100644 index 00000000..9a947ed9 --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/.gitignore @@ -0,0 +1,41 @@ +#Maven +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +release.properties + +# Eclipse +.project +.classpath +.settings/ +bin/ + +# IntelliJ +.idea +*.ipr +*.iml +*.iws + +# NetBeans +nb-configuration.xml + +# Visual Studio Code +.vscode +.factorypath + +# OSX +.DS_Store + +# Vim +*.swp +*.swo + +# patch +*.orig +*.rej + +# Local environment +.env +/.apt_generated/ +/.apt_generated_tests/ diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/.mvn/wrapper/.gitignore b/java/conversion/org.eclipse.theia.cloud.conversion/.mvn/wrapper/.gitignore new file mode 100644 index 00000000..e72f5e8b --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/.mvn/wrapper/.gitignore @@ -0,0 +1 @@ +maven-wrapper.jar diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/.mvn/wrapper/MavenWrapperDownloader.java b/java/conversion/org.eclipse.theia.cloud.conversion/.mvn/wrapper/MavenWrapperDownloader.java new file mode 100644 index 00000000..84d1e60d --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/.mvn/wrapper/MavenWrapperDownloader.java @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +import java.io.IOException; +import java.io.InputStream; +import java.net.Authenticator; +import java.net.PasswordAuthentication; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; + +public final class MavenWrapperDownloader +{ + private static final String WRAPPER_VERSION = "3.2.0"; + + private static final boolean VERBOSE = Boolean.parseBoolean( System.getenv( "MVNW_VERBOSE" ) ); + + public static void main( String[] args ) + { + log( "Apache Maven Wrapper Downloader " + WRAPPER_VERSION ); + + if ( args.length != 2 ) + { + System.err.println( " - ERROR wrapperUrl or wrapperJarPath parameter missing" ); + System.exit( 1 ); + } + + try + { + log( " - Downloader started" ); + final URL wrapperUrl = new URL( args[0] ); + final String jarPath = args[1].replace( "..", "" ); // Sanitize path + final Path wrapperJarPath = Paths.get( jarPath ).toAbsolutePath().normalize(); + downloadFileFromURL( wrapperUrl, wrapperJarPath ); + log( "Done" ); + } + catch ( IOException e ) + { + System.err.println( "- Error downloading: " + e.getMessage() ); + if ( VERBOSE ) + { + e.printStackTrace(); + } + System.exit( 1 ); + } + } + + private static void downloadFileFromURL( URL wrapperUrl, Path wrapperJarPath ) + throws IOException + { + log( " - Downloading to: " + wrapperJarPath ); + if ( System.getenv( "MVNW_USERNAME" ) != null && System.getenv( "MVNW_PASSWORD" ) != null ) + { + final String username = System.getenv( "MVNW_USERNAME" ); + final char[] password = System.getenv( "MVNW_PASSWORD" ).toCharArray(); + Authenticator.setDefault( new Authenticator() + { + @Override + protected PasswordAuthentication getPasswordAuthentication() + { + return new PasswordAuthentication( username, password ); + } + } ); + } + try ( InputStream inStream = wrapperUrl.openStream() ) + { + Files.copy( inStream, wrapperJarPath, StandardCopyOption.REPLACE_EXISTING ); + } + log( " - Downloader complete" ); + } + + private static void log( String msg ) + { + if ( VERBOSE ) + { + System.out.println( msg ); + } + } + +} diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/.mvn/wrapper/maven-wrapper.properties b/java/conversion/org.eclipse.theia.cloud.conversion/.mvn/wrapper/maven-wrapper.properties new file mode 100644 index 00000000..6d3a5665 --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/.mvn/wrapper/maven-wrapper.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/README.md b/java/conversion/org.eclipse.theia.cloud.conversion/README.md new file mode 100644 index 00000000..84a5bacd --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/README.md @@ -0,0 +1,51 @@ +# conversion-webhook + +This project uses Quarkus, the Supersonic Subatomic Java Framework. + +If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . + +## Running the application in dev mode + +You can run your application in dev mode that enables live coding using: +```shell script +./mvnw compile quarkus:dev +``` + +> **_NOTE:_** Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/. + +## Packaging and running the application + +The application can be packaged using: +```shell script +./mvnw package +``` +It produces the `quarkus-run.jar` file in the `target/quarkus-app/` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/quarkus-app/lib/` directory. + +The application is now runnable using `java -jar target/quarkus-app/quarkus-run.jar`. + +If you want to build an _über-jar_, execute the following command: +```shell script +./mvnw package -Dquarkus.package.type=uber-jar +``` + +The application, packaged as an _über-jar_, is now runnable using `java -jar target/*-runner.jar`. + +## Creating a native executable + +You can create a native executable using: +```shell script +./mvnw package -Pnative +``` + +Or, if you don't have GraalVM installed, you can run the native executable build in a container using: +```shell script +./mvnw package -Pnative -Dquarkus.native.container-build=true +``` + +You can then execute your native executable with: `./target/conversion-webhook-1.0.0-SNAPSHOT-runner` + +If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling. + +## Related Guides + diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/Run Theia Cloud Conversion Hook.launch b/java/conversion/org.eclipse.theia.cloud.conversion/Run Theia Cloud Conversion Hook.launch new file mode 100644 index 00000000..06e1f607 --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/Run Theia Cloud Conversion Hook.launch @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/mvnw b/java/conversion/org.eclipse.theia.cloud.conversion/mvnw new file mode 100755 index 00000000..8a8fb228 --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/mvnw @@ -0,0 +1,316 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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 +# +# https://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" || rm -f "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/mvnw.cmd b/java/conversion/org.eclipse.theia.cloud.conversion/mvnw.cmd new file mode 100644 index 00000000..1d8ab018 --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/mvnw.cmd @@ -0,0 +1,188 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/pom.xml b/java/conversion/org.eclipse.theia.cloud.conversion/pom.xml new file mode 100644 index 00000000..1aa52640 --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/pom.xml @@ -0,0 +1,138 @@ + + + 4.0.0 + conversion-webhook + + + org.eclipse.theia.cloud + conf + 0.10.0-SNAPSHOT + ../../common/maven-conf/ + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-arc + + + + io.quarkus + quarkus-resteasy-reactive-jackson + + + + io.fabric8 + kubernetes-client + ${kubernetes-client.version} + + + + org.eclipse.theia.cloud + common + 0.10.0-SNAPSHOT + + + + io.javaoperatorsdk + kubernetes-webhooks-framework-core + ${webhooks.framework.core.version} + + + + io.quarkus + quarkus-junit5 + test + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + build + generate-code + generate-code-tests + + + + + + maven-compiler-plugin + ${maven-compiler-plugin.version} + + 17 + 17 + + -parameters + + + + + maven-surefire-plugin + ${surefire-plugin.version} + + + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + maven-failsafe-plugin + ${surefire-plugin.version} + + + + integration-test + verify + + + + + ${project.build.directory}/${project.build.finalName}-runner + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + + native + + + native + + + + native + + + + diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/ConversionEndpoint.java b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/ConversionEndpoint.java new file mode 100644 index 00000000..dff4550f --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/ConversionEndpoint.java @@ -0,0 +1,94 @@ +/******************************************************************************** + * Copyright (C) 2023 EclipseSource and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + ********************************************************************************/ +package org.eclipse.theia.cloud.conversion; + +import org.eclipse.theia.cloud.conversion.mappers.appdefinition.AppDefinitionV1beta8Mapper; +import org.eclipse.theia.cloud.conversion.mappers.appdefinition.AppDefinitionV1beta9Mapper; +import org.eclipse.theia.cloud.conversion.mappers.session.SessionV1beta6Mapper; +import org.eclipse.theia.cloud.conversion.mappers.session.SessionV1beta7Mapper; +import org.eclipse.theia.cloud.conversion.mappers.workspace.WorkspaceV1beta3Mapper; +import org.eclipse.theia.cloud.conversion.mappers.workspace.WorkspaceV1beta4Mapper; + +import io.fabric8.kubernetes.api.model.HasMetadata; +import io.fabric8.kubernetes.api.model.apiextensions.v1.ConversionReview; +import io.javaoperatorsdk.webhook.conversion.ConversionController; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; + +@Path("/") +public class ConversionEndpoint { + + private final ConversionController appDefinitionController; + private final ConversionController workspaceController; + private final ConversionController sessionController; + + public ConversionEndpoint() { + this.appDefinitionController = new ConversionController(); + appDefinitionController.registerMapper(new AppDefinitionV1beta8Mapper()); + appDefinitionController.registerMapper(new AppDefinitionV1beta9Mapper()); + + this.workspaceController = new ConversionController(); + workspaceController.registerMapper(new WorkspaceV1beta3Mapper()); + workspaceController.registerMapper(new WorkspaceV1beta4Mapper()); + + this.sessionController = new ConversionController(); + sessionController.registerMapper(new SessionV1beta6Mapper()); + sessionController.registerMapper(new SessionV1beta7Mapper()); + } + + @POST + @Path("convert/appdefinition") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public ConversionReview convertAppDefinition(ConversionReview conversionReview) { + conversionReview.getRequest().getObjects().forEach(obj -> { + System.out.println("[" + conversionReview.getRequest().getUid() + "] Converting " + + ((HasMetadata) obj).getKind() + " (version: '" + ((HasMetadata) obj).getApiVersion() + + "') to version '" + conversionReview.getRequest().getDesiredAPIVersion() + "'"); + }); + return this.appDefinitionController.handle(conversionReview); + } + + @POST + @Path("convert/workspace") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public ConversionReview convertWorkspace(ConversionReview conversionReview) { + conversionReview.getRequest().getObjects().forEach(obj -> { + System.out.println("[" + conversionReview.getRequest().getUid() + "] Converting " + + ((HasMetadata) obj).getKind() + " (version: '" + ((HasMetadata) obj).getApiVersion() + + "') to version '" + conversionReview.getRequest().getDesiredAPIVersion() + "'"); + }); + return this.workspaceController.handle(conversionReview); + } + + @POST + @Path("convert/session") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public ConversionReview convertSession(ConversionReview conversionReview) { + conversionReview.getRequest().getObjects().forEach(obj -> { + System.out.println("[" + conversionReview.getRequest().getUid() + "] Converting " + + ((HasMetadata) obj).getKind() + " (version: '" + ((HasMetadata) obj).getApiVersion() + + "') to version '" + conversionReview.getRequest().getDesiredAPIVersion() + "'"); + }); + return this.sessionController.handle(conversionReview); + } + +} diff --git a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/hub/AppDefinitionHubStatus.java b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/appdefinition/AppDefinitionV1beta8Mapper.java similarity index 51% rename from java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/hub/AppDefinitionHubStatus.java rename to java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/appdefinition/AppDefinitionV1beta8Mapper.java index bc7f1819..c90d9abb 100644 --- a/java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/k8s/resource/appdefinition/hub/AppDefinitionHubStatus.java +++ b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/appdefinition/AppDefinitionV1beta8Mapper.java @@ -13,30 +13,26 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ -package org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub; +package org.eclipse.theia.cloud.conversion.mappers.appdefinition; -import org.eclipse.theia.cloud.common.k8s.resource.ResourceStatus; -import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.AppDefinitionStatus; +import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub.AppDefinitionHub; +import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta8.AppDefinitionV1beta8; -public class AppDefinitionHubStatus extends ResourceStatus { +import io.javaoperatorsdk.webhook.conversion.Mapper; +import io.javaoperatorsdk.webhook.conversion.TargetVersion; - public AppDefinitionHubStatus(AppDefinitionStatus toHub) { - if (toHub.getOperatorMessage() != null) { - this.setOperatorMessage(toHub.getOperatorMessage()); - } - if (toHub.getOperatorStatus() != null) { - this.setOperatorStatus(toHub.getOperatorStatus()); - } +@SuppressWarnings("deprecation") +@TargetVersion("v1beta8") +public class AppDefinitionV1beta8Mapper implements Mapper { + + @Override + public AppDefinitionHub toHub(AppDefinitionV1beta8 resource) { + return new AppDefinitionHub(resource); } - @SuppressWarnings("deprecation") - public AppDefinitionHubStatus( - org.eclipse.theia.cloud.common.k8s.resource.appdefinition.v1beta7.AppDefinitionV1beta7Status toHub) { - if (toHub.getOperatorMessage() != null) { - this.setOperatorMessage(toHub.getOperatorMessage()); - } - if (toHub.getOperatorStatus() != null) { - this.setOperatorStatus(toHub.getOperatorStatus()); - } + @Override + public AppDefinitionV1beta8 fromHub(AppDefinitionHub hub) { + return new AppDefinitionV1beta8(hub); } + } diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/appdefinition/AppDefinitionV1beta9Mapper.java b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/appdefinition/AppDefinitionV1beta9Mapper.java new file mode 100644 index 00000000..aa98f23d --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/appdefinition/AppDefinitionV1beta9Mapper.java @@ -0,0 +1,37 @@ +/******************************************************************************** + * Copyright (C) 2023 EclipseSource and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + ********************************************************************************/ +package org.eclipse.theia.cloud.conversion.mappers.appdefinition; + +import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.AppDefinition; +import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.hub.AppDefinitionHub; + +import io.javaoperatorsdk.webhook.conversion.Mapper; +import io.javaoperatorsdk.webhook.conversion.TargetVersion; + +@TargetVersion("v1beta9") +public class AppDefinitionV1beta9Mapper implements Mapper { + + @Override + public AppDefinitionHub toHub(AppDefinition resource) { + return new AppDefinitionHub(resource); + } + + @Override + public AppDefinition fromHub(AppDefinitionHub hub) { + return new AppDefinition(hub); + } + +} diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/session/SessionV1beta6Mapper.java b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/session/SessionV1beta6Mapper.java new file mode 100644 index 00000000..a7ac2aaf --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/session/SessionV1beta6Mapper.java @@ -0,0 +1,38 @@ +/******************************************************************************** + * Copyright (C) 2023 EclipseSource and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + ********************************************************************************/ +package org.eclipse.theia.cloud.conversion.mappers.session; + +import org.eclipse.theia.cloud.common.k8s.resource.session.hub.SessionHub; +import org.eclipse.theia.cloud.common.k8s.resource.session.v1beta6.SessionV1beta6; + +import io.javaoperatorsdk.webhook.conversion.Mapper; +import io.javaoperatorsdk.webhook.conversion.TargetVersion; + +@SuppressWarnings("deprecation") +@TargetVersion("v1beta6") +public class SessionV1beta6Mapper implements Mapper { + + @Override + public SessionHub toHub(SessionV1beta6 resource) { + return new SessionHub(resource); + } + + @Override + public SessionV1beta6 fromHub(SessionHub hub) { + return new SessionV1beta6(hub); + } + +} diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/session/SessionV1beta7Mapper.java b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/session/SessionV1beta7Mapper.java new file mode 100644 index 00000000..e4b7e6cf --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/session/SessionV1beta7Mapper.java @@ -0,0 +1,37 @@ +/******************************************************************************** + * Copyright (C) 2023 EclipseSource and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + ********************************************************************************/ +package org.eclipse.theia.cloud.conversion.mappers.session; + +import org.eclipse.theia.cloud.common.k8s.resource.session.Session; +import org.eclipse.theia.cloud.common.k8s.resource.session.hub.SessionHub; + +import io.javaoperatorsdk.webhook.conversion.Mapper; +import io.javaoperatorsdk.webhook.conversion.TargetVersion; + +@TargetVersion("v1beta7") +public class SessionV1beta7Mapper implements Mapper { + + @Override + public SessionHub toHub(Session resource) { + return new SessionHub(resource); + } + + @Override + public Session fromHub(SessionHub hub) { + return new Session(hub); + } + +} diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/workspace/WorkspaceV1beta3Mapper.java b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/workspace/WorkspaceV1beta3Mapper.java new file mode 100644 index 00000000..8da09dda --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/workspace/WorkspaceV1beta3Mapper.java @@ -0,0 +1,37 @@ +/******************************************************************************** + * Copyright (C) 2023 EclipseSource and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + ********************************************************************************/ +package org.eclipse.theia.cloud.conversion.mappers.workspace; + +import org.eclipse.theia.cloud.common.k8s.resource.workspace.hub.WorkspaceHub; +import org.eclipse.theia.cloud.common.k8s.resource.workspace.v1beta3.WorkspaceV1beta3; + +import io.javaoperatorsdk.webhook.conversion.Mapper; +import io.javaoperatorsdk.webhook.conversion.TargetVersion; + +@SuppressWarnings("deprecation") +@TargetVersion("v1beta3") +public class WorkspaceV1beta3Mapper implements Mapper { + + @Override + public WorkspaceHub toHub(WorkspaceV1beta3 resource) { + return new WorkspaceHub(resource); + } + + @Override + public WorkspaceV1beta3 fromHub(WorkspaceHub hub) { + return new WorkspaceV1beta3(hub); + } +} \ No newline at end of file diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/workspace/WorkspaceV1beta4Mapper.java b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/workspace/WorkspaceV1beta4Mapper.java new file mode 100644 index 00000000..cf8d84c3 --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/java/org/eclipse/theia/cloud/conversion/mappers/workspace/WorkspaceV1beta4Mapper.java @@ -0,0 +1,37 @@ +/******************************************************************************** + * Copyright (C) 2023 EclipseSource and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the Eclipse + * Public License v. 2.0 are satisfied: GNU General Public License, version 2 + * with the GNU Classpath Exception which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + ********************************************************************************/ +package org.eclipse.theia.cloud.conversion.mappers.workspace; + +import org.eclipse.theia.cloud.common.k8s.resource.workspace.Workspace; +import org.eclipse.theia.cloud.common.k8s.resource.workspace.hub.WorkspaceHub; + +import io.javaoperatorsdk.webhook.conversion.Mapper; +import io.javaoperatorsdk.webhook.conversion.TargetVersion; + +@TargetVersion("v1beta4") +public class WorkspaceV1beta4Mapper implements Mapper { + + @Override + public WorkspaceHub toHub(Workspace resource) { + return new WorkspaceHub(resource); + } + + @Override + public Workspace fromHub(WorkspaceHub hub) { + return new Workspace(hub); + } + +} diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/src/main/resources/application.properties b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/resources/application.properties new file mode 100644 index 00000000..a269f8d0 --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/src/main/resources/application.properties @@ -0,0 +1,2 @@ +quarkus.http.ssl.certificate.files=/etc/webhook/certs/tls.crt +quarkus.http.ssl.certificate.key-files=/etc/webhook/certs/tls.key \ No newline at end of file diff --git a/java/operator/org.eclipse.theia.cloud.operator/.gitignore b/java/operator/org.eclipse.theia.cloud.operator/.gitignore index 6f6ea3e4..98facedd 100644 --- a/java/operator/org.eclipse.theia.cloud.operator/.gitignore +++ b/java/operator/org.eclipse.theia.cloud.operator/.gitignore @@ -1,3 +1,5 @@ /target/ /.apt_generated/ /.apt_generated_tests/ + +.settings diff --git a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/TheiaCloudImpl.java b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/TheiaCloudImpl.java index 9e031692..3ed5ea0b 100644 --- a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/TheiaCloudImpl.java +++ b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/TheiaCloudImpl.java @@ -20,6 +20,7 @@ import static org.eclipse.theia.cloud.common.util.LogMessageUtil.generateCorrelationId; import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.LinkedHashSet; import java.util.Map; import java.util.Optional; @@ -33,12 +34,10 @@ import org.apache.logging.log4j.Logger; import org.eclipse.theia.cloud.common.k8s.client.TheiaCloudClient; import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.AppDefinition; -import org.eclipse.theia.cloud.common.k8s.resource.appdefinition.AppDefinitionSpec.Timeout; import org.eclipse.theia.cloud.common.k8s.resource.session.Session; import org.eclipse.theia.cloud.common.k8s.resource.workspace.Workspace; import org.eclipse.theia.cloud.operator.handler.AppDefinitionHandler; import org.eclipse.theia.cloud.operator.handler.SessionHandler; -import org.eclipse.theia.cloud.operator.handler.TimeoutStrategy; import org.eclipse.theia.cloud.operator.handler.WorkspaceHandler; import org.eclipse.theia.cloud.operator.monitor.MonitorActivityTracker; @@ -73,9 +72,6 @@ public class TheiaCloudImpl implements TheiaCloud { @Inject private SessionHandler sessionHandler; - @Inject - private Set timeoutStrategies; - @Inject private TheiaCloudArguments arguments; @@ -283,27 +279,26 @@ protected void lookForIdleWatches() { } protected boolean isSessionTimedOut(String correlationId, Instant now, Session session) { - Optional timeout = resourceClient.appDefinitions().get(session.getSpec().getAppDefinition()) + Optional timeout = resourceClient.appDefinitions().get(session.getSpec().getAppDefinition()) .map(appDef -> appDef.getSpec().getTimeout()); - if (timeout.isEmpty() || timeout.get().getLimit() <= 0) { + if (timeout.isEmpty() || timeout.get() <= 0) { LOGGER.trace(formatLogMessage(COR_ID_TIMEOUTPREFIX, correlationId, - "Session " + session.getSpec().getName() + " will not be stopped automatically [NoTimout].")); + "Session " + session.getSpec().getName() + " will not be stopped automatically [NoTimeout].")); return false; } - String strategyName = timeout.get().getStrategy(); - int limit = timeout.get().getLimit(); - Optional strategy = timeoutStrategies.stream() - .filter(registeredStrategy -> registeredStrategy.getName().equals(strategyName)).findAny(); - if (!strategy.isPresent()) { - LOGGER.warn(formatLogMessage(COR_ID_TIMEOUTPREFIX, correlationId, "No strategy configured.")); - } - if (strategy.isPresent() && strategy.get().evaluate(COR_ID_TIMEOUTPREFIX, session, now, limit)) { - LOGGER.trace(formatLogMessage(COR_ID_TIMEOUTPREFIX, correlationId, "Session " + session.getSpec().getName() - + " was stopped after " + limit + " minutes [" + strategyName + "].")); + int limit = timeout.get(); + String creationTimestamp = session.getMetadata().getCreationTimestamp(); + Instant parse = Instant.parse(creationTimestamp); + long minutesSinceCreation = ChronoUnit.MINUTES.between(parse, now); + LOGGER.trace(formatLogMessage(correlationId, "Checking " + session.getSpec().getName() + + ". minutesSinceLastActivity: " + minutesSinceCreation + ". limit: " + limit)); + if (minutesSinceCreation > limit) { + LOGGER.trace(formatLogMessage(COR_ID_TIMEOUTPREFIX, correlationId, + "Session " + session.getSpec().getName() + " was stopped after " + limit + " minutes.")); return true; } else { LOGGER.trace(formatLogMessage(COR_ID_TIMEOUTPREFIX, correlationId, "Session " + session.getSpec().getName() - + " will keep running until the limit of " + limit + " is hit [" + strategyName + "].")); + + " will keep running until the limit of " + limit + " is hit.")); } return false; } diff --git a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/di/AbstractTheiaCloudOperatorModule.java b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/di/AbstractTheiaCloudOperatorModule.java index e66fd16d..e07aa996 100644 --- a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/di/AbstractTheiaCloudOperatorModule.java +++ b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/di/AbstractTheiaCloudOperatorModule.java @@ -33,7 +33,6 @@ import org.eclipse.theia.cloud.operator.handler.PersistentVolumeCreator; import org.eclipse.theia.cloud.operator.handler.PersistentVolumeTemplateReplacements; import org.eclipse.theia.cloud.operator.handler.SessionHandler; -import org.eclipse.theia.cloud.operator.handler.TimeoutStrategy; import org.eclipse.theia.cloud.operator.handler.WorkspaceHandler; import org.eclipse.theia.cloud.operator.handler.impl.BandwidthLimiterImpl; import org.eclipse.theia.cloud.operator.handler.impl.DefaultDeploymentTemplateReplacements; @@ -69,8 +68,6 @@ protected void configure() { bind(MonitorActivityTracker.class).to(bindMonitorActivityTracker()).in(Singleton.class); bind(MonitorMessagingService.class).to(bindMonitorMessagingService()).in(Singleton.class); - - configure(MultiBinding.create(TimeoutStrategy.class), this::configureTimeoutStrategies); } protected void configure(final MultiBinding binding, final Consumer> configurator) { @@ -116,10 +113,6 @@ protected Class bindPersistentVo protected abstract Class bindSessionHandler(); - protected void configureTimeoutStrategies(final MultiBinding binding) { - binding.add(TimeoutStrategy.FixedTime.class); - } - @Provides @Singleton protected NamespacedKubernetesClient provideKubernetesClient() { diff --git a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/handler/TimeoutStrategy.java b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/handler/TimeoutStrategy.java deleted file mode 100644 index 63ec7f01..00000000 --- a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/handler/TimeoutStrategy.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************** - * Copyright (C) 2022 EclipseSource and others. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the Eclipse - * Public License v. 2.0 are satisfied: GNU General Public License, version 2 - * with the GNU Classpath Exception which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - ********************************************************************************/ -package org.eclipse.theia.cloud.operator.handler; - -import static org.eclipse.theia.cloud.common.util.LogMessageUtil.formatLogMessage; - -import java.time.Instant; -import java.time.temporal.ChronoUnit; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.eclipse.theia.cloud.common.k8s.resource.session.Session; - -public interface TimeoutStrategy { - - String getName(); - - boolean evaluate(String correlationId, Session session, Instant now, Integer limit); - - static class FixedTime implements TimeoutStrategy { - - private static final String FIXEDTIME = "FIXEDTIME"; - private static final Logger LOGGER = LogManager.getLogger(FixedTime.class); - - @Override - public String getName() { - return FIXEDTIME; - } - - @Override - public boolean evaluate(String correlationId, Session session, Instant now, Integer limit) { - String creationTimestamp = session.getMetadata().getCreationTimestamp(); - Instant parse = Instant.parse(creationTimestamp); - long minutesSinceCreation = ChronoUnit.MINUTES.between(parse, now); - LOGGER.trace(formatLogMessage(FIXEDTIME, correlationId, "Checking " + session.getSpec().getName() - + ". minutesSinceLastActivity: " + minutesSinceCreation + ". limit: " + limit)); - return minutesSinceCreation > limit; - } - - } -} diff --git a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/handler/impl/AddedHandlerUtil.java b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/handler/impl/AddedHandlerUtil.java index 43333734..6ca762b7 100644 --- a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/handler/impl/AddedHandlerUtil.java +++ b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/handler/impl/AddedHandlerUtil.java @@ -204,7 +204,7 @@ public static void updateSessionURLAsync(NamespacedKubernetesClient client, Sess client.resources(Session.class, SessionSpecResourceList.class).inNamespace(namespace) .withName(session.getMetadata().getName())// .edit(ws -> { - ws.getSpec().setUrl(url); + ws.getStatus().setUrl(url); return ws; }); LOGGER.info( diff --git a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/handler/impl/LazySessionHandler.java b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/handler/impl/LazySessionHandler.java index 564ed08c..ebd2dfbc 100644 --- a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/handler/impl/LazySessionHandler.java +++ b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/handler/impl/LazySessionHandler.java @@ -288,13 +288,12 @@ protected void syncSessionDataToWorkspace(Session session, String correlationId) } } - protected boolean hasMaxInstancesReached(AppDefinition appDefinition, Session session, - String correlationId) { + protected boolean hasMaxInstancesReached(AppDefinition appDefinition, Session session, String correlationId) { if (TheiaCloudK8sUtil.checkIfMaxInstancesReached(client.kubernetes(), client.namespace(), session.getSpec(), appDefinition.getSpec(), correlationId)) { LOGGER.info(formatMetric(correlationId, "Max instances reached for " + appDefinition.getSpec().getName())); client.sessions().edit(correlationId, session.getMetadata().getName(), - toEdit -> toEdit.getSpec().setError(TheiaCloudError.SESSION_SERVER_LIMIT_REACHED)); + toEdit -> toEdit.getStatus().setError(TheiaCloudError.SESSION_SERVER_LIMIT_REACHED)); return true; } return false; @@ -307,7 +306,7 @@ protected boolean hasMaxSessionsReached(Session session, String correlationId) { LOGGER.info(formatLogMessage(correlationId, "No sessions allowed for this user. Could not create session " + session.getSpec())); client.sessions().edit(correlationId, session.getMetadata().getName(), - ws -> ws.getSpec().setError(TheiaCloudError.SESSION_USER_NO_SESSIONS)); + ws -> ws.getStatus().setError(TheiaCloudError.SESSION_USER_NO_SESSIONS)); return true; } @@ -316,7 +315,7 @@ protected boolean hasMaxSessionsReached(Session session, String correlationId) { LOGGER.info(formatLogMessage(correlationId, "No more sessions allowed for this user, limit is " + arguments.getSessionsPerUser())); client.sessions().edit(correlationId, session.getMetadata().getName(), - toEdit -> toEdit.getSpec().setError(TheiaCloudError.SESSION_USER_LIMIT_REACHED)); + toEdit -> toEdit.getStatus().setError(TheiaCloudError.SESSION_USER_LIMIT_REACHED)); return true; } } @@ -356,8 +355,7 @@ protected Optional getStorageName(Session session, String correlationId) } protected Optional createAndApplyService(String correlationId, String sessionResourceName, - String sessionResourceUID, Session session, AppDefinitionSpec appDefinitionSpec, - boolean useOAuth2Proxy) { + String sessionResourceUID, Session session, AppDefinitionSpec appDefinitionSpec, boolean useOAuth2Proxy) { Map replacements = TheiaCloudServiceUtil.getServiceReplacements(client.namespace(), session, appDefinitionSpec); String templateYaml = useOAuth2Proxy ? AddedHandlerUtil.TEMPLATE_SERVICE_YAML @@ -387,8 +385,7 @@ protected void createAndApplyEmailConfigMap(String correlationId, String session return; } K8sUtil.loadAndCreateConfigMapWithOwnerReference(client.kubernetes(), client.namespace(), correlationId, - configMapYaml, Session.API, Session.KIND, sessionResourceName, sessionResourceUID, 0, - configmap -> { + configMapYaml, Session.API, Session.KIND, sessionResourceName, sessionResourceUID, 0, configmap -> { configmap.setData(Collections.singletonMap(AddedHandlerUtil.FILENAME_AUTHENTICATED_EMAILS_LIST, session.getSpec().getUser())); }); @@ -407,8 +404,7 @@ protected void createAndApplyProxyConfigMap(String correlationId, String session return; } K8sUtil.loadAndCreateConfigMapWithOwnerReference(client.kubernetes(), client.namespace(), correlationId, - configMapYaml, Session.API, Session.KIND, sessionResourceName, sessionResourceUID, 0, - configMap -> { + configMapYaml, Session.API, Session.KIND, sessionResourceName, sessionResourceUID, 0, configMap -> { String host = arguments.getInstancesHost() + ingressPathProvider.getPath(appDefinition, session); int port = appDefinition.getSpec().getPort(); AddedHandlerUtil.updateProxyConfigMap(client.kubernetes(), client.namespace(), configMap, host, @@ -431,8 +427,7 @@ protected void createAndApplyDeployment(String correlationId, String sessionReso return; } K8sUtil.loadAndCreateDeploymentWithOwnerReference(client.kubernetes(), client.namespace(), correlationId, - deploymentYaml, Session.API, Session.KIND, sessionResourceName, sessionResourceUID, 0, - deployment -> { + deploymentYaml, Session.API, Session.KIND, sessionResourceName, sessionResourceUID, 0, deployment -> { pvName.ifPresent(name -> addVolumeClaim(deployment, name, appDefinition.getSpec())); bandwidthLimiter.limit(deployment, appDefinition.getSpec().getDownlinkLimit(), appDefinition.getSpec().getUplinkLimit(), correlationId); diff --git a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/monitor/MonitorActivityTrackerImpl.java b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/monitor/MonitorActivityTrackerImpl.java index 80dab48d..137bf6b7 100644 --- a/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/monitor/MonitorActivityTrackerImpl.java +++ b/java/operator/org.eclipse.theia.cloud.operator/src/main/java/org/eclipse/theia/cloud/operator/monitor/MonitorActivityTrackerImpl.java @@ -78,8 +78,7 @@ protected void pingAllSessions() { Optional sessionIP = resourceClient.getClusterIPFromSessionName(session.getSpec().getName()); if (sessionIP.isPresent()) { String appDefinitionName = session.getSpec().getAppDefinition(); - Optional appDefinitionOptional = resourceClient.appDefinitions() - .get(appDefinitionName); + Optional appDefinitionOptional = resourceClient.appDefinitions().get(appDefinitionName); if (appDefinitionOptional.isPresent()) { AppDefinition appDefinition = appDefinitionOptional.get(); int timeoutAfter = appDefinition.getSpec().getMonitor().getActivityTracker().getTimeoutAfter(); @@ -120,7 +119,7 @@ protected void pingSession(Session session, String sessionURL, int port, int shu logInfo(sessionName, "REQUEST FAILED: " + "GET " + getActivityURL + ". Error: " + e); } - Date lastActivityDate = new Date(session.getSpec().getLastActivity()); + Date lastActivityDate = new Date(session.getStatus().getLastActivity()); Date currentDate = new Date(OffsetDateTime.now(ZoneOffset.UTC).toInstant().toEpochMilli()); long minutesPassed = getMinutesPassed(lastActivityDate, currentDate); @@ -152,10 +151,10 @@ protected void pingSession(Session session, String sessionURL, int port, int shu } protected void updateLastActivity(Session session, long reportedTimestamp) { - long currentTimestamp = session.getSpec().getLastActivity(); + long currentTimestamp = session.getStatus().getLastActivity(); if (currentTimestamp < reportedTimestamp) { logInfo(session.getSpec().getName(), "Update lastActivity in CR"); - session.getSpec().setLastActivity(reportedTimestamp); + session.getStatus().setLastActivity(reportedTimestamp); } } diff --git a/java/service/org.eclipse.theia.cloud.service/src/main/java/org/eclipse/theia/cloud/service/K8sUtil.java b/java/service/org.eclipse.theia.cloud.service/src/main/java/org/eclipse/theia/cloud/service/K8sUtil.java index 6ddf9230..453ac2a8 100644 --- a/java/service/org.eclipse.theia.cloud.service/src/main/java/org/eclipse/theia/cloud/service/K8sUtil.java +++ b/java/service/org.eclipse.theia.cloud.service/src/main/java/org/eclipse/theia/cloud/service/K8sUtil.java @@ -27,6 +27,7 @@ import org.eclipse.theia.cloud.common.k8s.client.TheiaCloudClient; import org.eclipse.theia.cloud.common.k8s.resource.session.Session; import org.eclipse.theia.cloud.common.k8s.resource.session.SessionSpec; +import org.eclipse.theia.cloud.common.k8s.resource.session.SessionStatus; import org.eclipse.theia.cloud.common.k8s.resource.workspace.Workspace; import org.eclipse.theia.cloud.common.k8s.resource.workspace.WorkspaceSpec; import org.eclipse.theia.cloud.common.util.CustomResourceUtil; @@ -93,9 +94,9 @@ public String launchWorkspaceSession(String correlationId, UserWorkspace workspa } private String launchSession(String correlationId, SessionSpec sessionSpec, int timeout) { - SessionSpec spec = CLIENT.sessions().launch(correlationId, sessionSpec, timeout).getSpec(); - TheiaCloudWebException.throwIfErroneous(spec); - return spec.getUrl(); + SessionStatus status = CLIENT.sessions().launch(correlationId, sessionSpec, timeout).getStatus(); + TheiaCloudWebException.throwIfErroneous(status); + return status.getUrl(); } private SessionSpec sessionSpecWithEnv(SessionSpec spec, EnvironmentVars env) { diff --git a/java/service/org.eclipse.theia.cloud.service/src/main/java/org/eclipse/theia/cloud/service/TheiaCloudWebException.java b/java/service/org.eclipse.theia.cloud.service/src/main/java/org/eclipse/theia/cloud/service/TheiaCloudWebException.java index 81d8092c..9a547dfc 100644 --- a/java/service/org.eclipse.theia.cloud.service/src/main/java/org/eclipse/theia/cloud/service/TheiaCloudWebException.java +++ b/java/service/org.eclipse.theia.cloud.service/src/main/java/org/eclipse/theia/cloud/service/TheiaCloudWebException.java @@ -16,9 +16,9 @@ package org.eclipse.theia.cloud.service; import org.eclipse.theia.cloud.common.k8s.resource.session.Session; -import org.eclipse.theia.cloud.common.k8s.resource.session.SessionSpec; +import org.eclipse.theia.cloud.common.k8s.resource.session.SessionStatus; import org.eclipse.theia.cloud.common.k8s.resource.workspace.Workspace; -import org.eclipse.theia.cloud.common.k8s.resource.workspace.WorkspaceSpec; +import org.eclipse.theia.cloud.common.k8s.resource.workspace.WorkspaceStatus; import org.eclipse.theia.cloud.common.util.TheiaCloudError; import jakarta.ws.rs.WebApplicationException; @@ -50,27 +50,27 @@ public TheiaCloudWebException(String error) { } public static Session throwIfErroneous(Session session) { - throwIfErroneous(session.getSpec()); + throwIfErroneous(session.getStatus()); return session; } - public static SessionSpec throwIfErroneous(SessionSpec spec) { - if (spec.hasError()) { - throw new TheiaCloudWebException(TheiaCloudError.fromString(spec.getError())); + public static SessionStatus throwIfErroneous(SessionStatus status) { + if (status.hasError()) { + throw new TheiaCloudWebException(TheiaCloudError.fromString(status.getError())); } - return spec; + return status; } public static Workspace throwIfErroneous(Workspace workspace) { - throwIfErroneous(workspace.getSpec()); + throwIfErroneous(workspace.getStatus()); return workspace; } - public static WorkspaceSpec throwIfErroneous(WorkspaceSpec spec) { - if (spec.hasError()) { - throw new TheiaCloudWebException(TheiaCloudError.fromString(spec.getError())); + public static WorkspaceStatus throwIfErroneous(WorkspaceStatus status) { + if (status.getError() != null) { + throw new TheiaCloudWebException(TheiaCloudError.fromString(status.getError())); } - return spec; + return status; } public static void throwIfError(String error) { diff --git a/java/service/org.eclipse.theia.cloud.service/src/test/java/org/eclipse/theia/cloud/service/workspace/WorkspaceResourceTests.java b/java/service/org.eclipse.theia.cloud.service/src/test/java/org/eclipse/theia/cloud/service/workspace/WorkspaceResourceTests.java index 4d259483..a8f7c917 100644 --- a/java/service/org.eclipse.theia.cloud.service/src/test/java/org/eclipse/theia/cloud/service/workspace/WorkspaceResourceTests.java +++ b/java/service/org.eclipse.theia.cloud.service/src/test/java/org/eclipse/theia/cloud/service/workspace/WorkspaceResourceTests.java @@ -32,6 +32,7 @@ import org.eclipse.theia.cloud.common.k8s.resource.workspace.Workspace; import org.eclipse.theia.cloud.common.k8s.resource.workspace.WorkspaceSpec; +import org.eclipse.theia.cloud.common.k8s.resource.workspace.WorkspaceStatus; import org.eclipse.theia.cloud.common.util.TheiaCloudError; import org.eclipse.theia.cloud.service.ApplicationProperties; import org.eclipse.theia.cloud.service.K8sUtil; @@ -289,7 +290,8 @@ void create_erroneousWorkspace_throwTheiaCloudWebException() { TEST_WORKSPACE); Workspace workspace = Mockito.mock(Workspace.class); WorkspaceSpec workspaceSpec = new WorkspaceSpec("abc", "def", APP_DEFINITION, TEST_USER); - workspaceSpec.setError("TestError"); + WorkspaceStatus workspaceStatus = new WorkspaceStatus(); + workspaceStatus.setError("TestError"); Mockito.when(workspace.getSpec()).thenReturn(workspaceSpec); Mockito.when(k8sUtil.createWorkspace(anyString(), argThat(new WorkspaceWithUser(TEST_USER)))) .thenReturn(workspace); diff --git a/terraform/terraform.md b/terraform/terraform.md index e628f6c0..20c29009 100644 --- a/terraform/terraform.md +++ b/terraform/terraform.md @@ -10,7 +10,7 @@ If you are unfamiliar with Terraform, you may want to have a look at their tutor ## Directory Structure -The `modules` directory contains our reuseable terraform modules for creating clusters, installing dependencies via helm, and configuring keycloak. The modules will be used by the actual terraform configurations available in the `configurations` directory. +The `modules` directory contains our reusable terraform modules for creating clusters, installing dependencies via helm, and configuring keycloak. The modules will be used by the actual terraform configurations available in the `configurations` directory. If you can't use Terraform, the `./modules/helm/main.tf` contains the information which helm charts are installed from which helm repository and you may extract the passed values. For an initial Keycloak realm configuration, you may check the values in `./modules/keycloak/main.tf`. From 844e377566534025df8e57e087968f57d4da67b0 Mon Sep 17 00:00:00 2001 From: Johannes Faltermeier Date: Wed, 28 Feb 2024 10:39:56 +0100 Subject: [PATCH 2/6] Provide conversion webhook for CRDs * add eclipse metadata to be consistent with other java components * open all projects in Theia IDE with Java once to update settings --- dockerfiles/conversion-webhook/.project | 11 + .../.settings/org.eclipse.m2e.core.prefs | 4 + .../org.eclipse.theia.cloud.common/.classpath | 9 +- .../.classpath | 68 +++ .../.gitignore | 3 - .../.project | 34 ++ .../org.eclipse.core.resources.prefs | 5 + .../.settings/org.eclipse.jdt.apt.core.prefs | 4 + .../.settings/org.eclipse.jdt.core.prefs | 576 ++++++++++++++++++ .../.settings/org.eclipse.jdt.ui.prefs | 127 ++++ .../.settings/org.eclipse.m2e.core.prefs | 4 + .../.classpath | 9 +- .../.settings/org.eclipse.jdt.core.prefs | 2 +- .../.classpath | 13 +- 14 files changed, 854 insertions(+), 15 deletions(-) create mode 100644 dockerfiles/conversion-webhook/.project create mode 100644 java/common/maven-conf/.settings/org.eclipse.m2e.core.prefs create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/.classpath create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/.project create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.core.resources.prefs create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.jdt.apt.core.prefs create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.jdt.core.prefs create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.jdt.ui.prefs create mode 100644 java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.m2e.core.prefs diff --git a/dockerfiles/conversion-webhook/.project b/dockerfiles/conversion-webhook/.project new file mode 100644 index 00000000..db935fca --- /dev/null +++ b/dockerfiles/conversion-webhook/.project @@ -0,0 +1,11 @@ + + + conversion-docker + + + + + + + + diff --git a/java/common/maven-conf/.settings/org.eclipse.m2e.core.prefs b/java/common/maven-conf/.settings/org.eclipse.m2e.core.prefs new file mode 100644 index 00000000..f897a7f1 --- /dev/null +++ b/java/common/maven-conf/.settings/org.eclipse.m2e.core.prefs @@ -0,0 +1,4 @@ +activeProfiles= +eclipse.preferences.version=1 +resolveWorkspaceProjects=true +version=1 diff --git a/java/common/org.eclipse.theia.cloud.common/.classpath b/java/common/org.eclipse.theia.cloud.common/.classpath index a4867212..ccadceaf 100644 --- a/java/common/org.eclipse.theia.cloud.common/.classpath +++ b/java/common/org.eclipse.theia.cloud.common/.classpath @@ -47,15 +47,18 @@ - + + + + + - + - diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/.classpath b/java/conversion/org.eclipse.theia.cloud.conversion/.classpath new file mode 100644 index 00000000..220d25c6 --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/.classpath @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/.gitignore b/java/conversion/org.eclipse.theia.cloud.conversion/.gitignore index 9a947ed9..473d3c03 100644 --- a/java/conversion/org.eclipse.theia.cloud.conversion/.gitignore +++ b/java/conversion/org.eclipse.theia.cloud.conversion/.gitignore @@ -6,9 +6,6 @@ pom.xml.versionsBackup release.properties # Eclipse -.project -.classpath -.settings/ bin/ # IntelliJ diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/.project b/java/conversion/org.eclipse.theia.cloud.conversion/.project new file mode 100644 index 00000000..a9da8902 --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/.project @@ -0,0 +1,34 @@ + + + conversion + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.m2e.core.maven2Builder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + + + 1665669047208 + + 30 + + org.eclipse.core.resources.regexFilterMatcher + node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ + + + + diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.core.resources.prefs b/java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..839d647e --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/main/resources=UTF-8 +encoding//src/test/java=UTF-8 +encoding/=UTF-8 diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.jdt.apt.core.prefs b/java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.jdt.apt.core.prefs new file mode 100644 index 00000000..dfa4f3ad --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.jdt.apt.core.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.apt.aptEnabled=true +org.eclipse.jdt.apt.genSrcDir=target/generated-sources/annotations +org.eclipse.jdt.apt.genTestSrcDir=target/generated-test-sources/test-annotations diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.jdt.core.prefs b/java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..a6daa80e --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,576 @@ +eclipse.preferences.version=1 +enableParallelJavaIndexSearch=true +org.eclipse.jdt.core.builder.annotationPath.allLocations=disabled +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter= +org.eclipse.jdt.core.circularClasspath=warning +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.camelCaseMatch=enabled +org.eclipse.jdt.core.codeComplete.deprecationCheck=disabled +org.eclipse.jdt.core.codeComplete.discouragedReferenceCheck=disabled +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.forbiddenReferenceCheck=enabled +org.eclipse.jdt.core.codeComplete.forceImplicitQualification=disabled +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.codeComplete.subwordMatch=disabled +org.eclipse.jdt.core.codeComplete.suggestStaticImports=enabled +org.eclipse.jdt.core.codeComplete.visibilityCheck=enabled +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=javax.annotation.Nonnull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=javax.annotation.ParametersAreNonnullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=javax.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.lambda.genericSignature=do not generate +org.eclipse.jdt.core.compiler.codegen.methodParameters=generate +org.eclipse.jdt.core.compiler.codegen.shareCommonFinallyBlocks=disabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=17 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.emulateJavacBug8031744=enabled +org.eclipse.jdt.core.compiler.generateClassFiles=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deadCodeInTrivialIfStatement=disabled +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingMethodWithoutSuperInvocation=ignore +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.tasks=warning +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore +org.eclipse.jdt.core.compiler.problem.uninternedIdentityComparison=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeArgumentsForMethodInvocation=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.processAnnotations=enabled +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=17 +org.eclipse.jdt.core.compiler.storeAnnotations=disabled +org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled +org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL +org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX +org.eclipse.jdt.core.computeJavaBuildOrder=ignore +org.eclipse.jdt.core.encoding=utf8 +org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 +org.eclipse.jdt.core.formatter.align_selector_in_method_invocation_on_expression_first_line=true +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false +org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package=49 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=0 +org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type=49 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assertion_message=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_arrow=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_switch_case_with_colon=16 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_record_components=16 +org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_switch_case_with_arrow=20 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_annotations=0 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_record_constructor=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_record_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.indent_tag_description=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_permitted_types=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_permitted_types=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_switch_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_switch_case_with_arrow_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=mixed +org.eclipse.jdt.core.formatter.tabulation.size=8 +org.eclipse.jdt.core.formatter.text_block_indentation=0 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_before_switch_case_arrow_operator=false +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter +org.eclipse.jdt.core.timeoutForParameterNameFromAttachedJavadoc=50 diff --git a/java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.jdt.ui.prefs b/java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000..d14cfb8e --- /dev/null +++ b/java/conversion/org.eclipse.theia.cloud.conversion/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,127 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=org.eclipse.jdt.ui.default.sun_profile +formatter_settings_version=21 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates=