From 425342b7ff2ce3676f98a4e3a4138b7d475f2d54 Mon Sep 17 00:00:00 2001 From: G8XSU <3442979+G8XSU@users.noreply.github.com> Date: Mon, 30 Sep 2024 12:33:40 +0900 Subject: [PATCH] Refactor/Prepare for Multi-language support. Hopefully we add rust support for vss-server in near future. --- .../{build-and-deploy.yml => build-and-deploy-java.yml} | 3 ++- java/.env | 1 + Dockerfile => java/Dockerfile | 0 {app => java/app}/build.gradle | 8 ++++++++ {app => java/app}/src/main/java/org/vss/KVStore.java | 0 .../app}/src/main/java/org/vss/VSSApplication.java | 0 .../app}/src/main/java/org/vss/api/AbstractVssApi.java | 0 .../app}/src/main/java/org/vss/api/DeleteObjectApi.java | 0 .../app}/src/main/java/org/vss/api/GetObjectApi.java | 0 .../src/main/java/org/vss/api/ListKeyVersionsApi.java | 0 .../app}/src/main/java/org/vss/api/PutObjectsApi.java | 0 .../app}/src/main/java/org/vss/api/VssApiEndpoint.java | 0 .../app}/src/main/java/org/vss/auth/AuthResponse.java | 0 .../app}/src/main/java/org/vss/auth/Authorizer.java | 0 .../app}/src/main/java/org/vss/auth/NoopAuthorizer.java | 0 .../src/main/java/org/vss/exception/AuthException.java | 0 .../main/java/org/vss/exception/ConflictException.java | 0 .../main/java/org/vss/exception/NoSuchKeyException.java | 0 .../app}/src/main/java/org/vss/guice/BaseModule.java | 0 .../java/org/vss/impl/postgres/PostgresBackendImpl.java | 0 .../java/org/vss/impl/postgres/sql/v0_create_vss_db.sql | 0 .../app}/src/main/resources/application.properties | 0 .../test/java/org/vss/AbstractKVStoreIntegrationTest.java | 0 .../src/test/java/org/vss/api/DeleteObjectApiTest.java | 0 .../app}/src/test/java/org/vss/api/GetObjectApiTest.java | 0 .../src/test/java/org/vss/api/ListKeyVersionsApiTest.java | 0 .../app}/src/test/java/org/vss/api/PutObjectsApiTest.java | 0 .../impl/postgres/PostgresBackendImplIntegrationTest.java | 0 docker-compose.yml => java/docker-compose.yml | 0 settings.gradle => java/settings.gradle | 0 {app/src/main/proto => proto}/vss.proto | 0 31 files changed, 11 insertions(+), 1 deletion(-) rename .github/workflows/{build-and-deploy.yml => build-and-deploy-java.yml} (93%) create mode 100644 java/.env rename Dockerfile => java/Dockerfile (100%) rename {app => java/app}/build.gradle (97%) rename {app => java/app}/src/main/java/org/vss/KVStore.java (100%) rename {app => java/app}/src/main/java/org/vss/VSSApplication.java (100%) rename {app => java/app}/src/main/java/org/vss/api/AbstractVssApi.java (100%) rename {app => java/app}/src/main/java/org/vss/api/DeleteObjectApi.java (100%) rename {app => java/app}/src/main/java/org/vss/api/GetObjectApi.java (100%) rename {app => java/app}/src/main/java/org/vss/api/ListKeyVersionsApi.java (100%) rename {app => java/app}/src/main/java/org/vss/api/PutObjectsApi.java (100%) rename {app => java/app}/src/main/java/org/vss/api/VssApiEndpoint.java (100%) rename {app => java/app}/src/main/java/org/vss/auth/AuthResponse.java (100%) rename {app => java/app}/src/main/java/org/vss/auth/Authorizer.java (100%) rename {app => java/app}/src/main/java/org/vss/auth/NoopAuthorizer.java (100%) rename {app => java/app}/src/main/java/org/vss/exception/AuthException.java (100%) rename {app => java/app}/src/main/java/org/vss/exception/ConflictException.java (100%) rename {app => java/app}/src/main/java/org/vss/exception/NoSuchKeyException.java (100%) rename {app => java/app}/src/main/java/org/vss/guice/BaseModule.java (100%) rename {app => java/app}/src/main/java/org/vss/impl/postgres/PostgresBackendImpl.java (100%) rename {app => java/app}/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql (100%) rename {app => java/app}/src/main/resources/application.properties (100%) rename {app => java/app}/src/test/java/org/vss/AbstractKVStoreIntegrationTest.java (100%) rename {app => java/app}/src/test/java/org/vss/api/DeleteObjectApiTest.java (100%) rename {app => java/app}/src/test/java/org/vss/api/GetObjectApiTest.java (100%) rename {app => java/app}/src/test/java/org/vss/api/ListKeyVersionsApiTest.java (100%) rename {app => java/app}/src/test/java/org/vss/api/PutObjectsApiTest.java (100%) rename {app => java/app}/src/test/java/org/vss/impl/postgres/PostgresBackendImplIntegrationTest.java (100%) rename docker-compose.yml => java/docker-compose.yml (100%) rename settings.gradle => java/settings.gradle (100%) rename {app/src/main/proto => proto}/vss.proto (100%) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy-java.yml similarity index 93% rename from .github/workflows/build-and-deploy.yml rename to .github/workflows/build-and-deploy-java.yml index 6fadc6f..8b06734 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy-java.yml @@ -46,7 +46,7 @@ jobs: - name: Create database table run: | - psql -h localhost -U postgres -d postgres -f ./app/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql + psql -h localhost -U postgres -d postgres -f ./java/app/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql env: PGPASSWORD: YOU_MUST_CHANGE_THIS_PASSWORD @@ -56,6 +56,7 @@ jobs: java -version gradle --version + cd java gradle wrapper --gradle-version 8.1.1 ./gradlew --version ./gradlew build diff --git a/java/.env b/java/.env new file mode 100644 index 0000000..e0a40aa --- /dev/null +++ b/java/.env @@ -0,0 +1 @@ +COMPOSE_PROJECT_NAME=vss-server-java diff --git a/Dockerfile b/java/Dockerfile similarity index 100% rename from Dockerfile rename to java/Dockerfile diff --git a/app/build.gradle b/java/app/build.gradle similarity index 97% rename from app/build.gradle rename to java/app/build.gradle index 80c4fbc..9980e95 100644 --- a/app/build.gradle +++ b/java/app/build.gradle @@ -21,6 +21,14 @@ repositories { mavenCentral() } +sourceSets { + main { + proto { + srcDir '../../proto' + } + } +} + idea { module { generatedSourceDirs.add(file("build/generated/proto/main")) diff --git a/app/src/main/java/org/vss/KVStore.java b/java/app/src/main/java/org/vss/KVStore.java similarity index 100% rename from app/src/main/java/org/vss/KVStore.java rename to java/app/src/main/java/org/vss/KVStore.java diff --git a/app/src/main/java/org/vss/VSSApplication.java b/java/app/src/main/java/org/vss/VSSApplication.java similarity index 100% rename from app/src/main/java/org/vss/VSSApplication.java rename to java/app/src/main/java/org/vss/VSSApplication.java diff --git a/app/src/main/java/org/vss/api/AbstractVssApi.java b/java/app/src/main/java/org/vss/api/AbstractVssApi.java similarity index 100% rename from app/src/main/java/org/vss/api/AbstractVssApi.java rename to java/app/src/main/java/org/vss/api/AbstractVssApi.java diff --git a/app/src/main/java/org/vss/api/DeleteObjectApi.java b/java/app/src/main/java/org/vss/api/DeleteObjectApi.java similarity index 100% rename from app/src/main/java/org/vss/api/DeleteObjectApi.java rename to java/app/src/main/java/org/vss/api/DeleteObjectApi.java diff --git a/app/src/main/java/org/vss/api/GetObjectApi.java b/java/app/src/main/java/org/vss/api/GetObjectApi.java similarity index 100% rename from app/src/main/java/org/vss/api/GetObjectApi.java rename to java/app/src/main/java/org/vss/api/GetObjectApi.java diff --git a/app/src/main/java/org/vss/api/ListKeyVersionsApi.java b/java/app/src/main/java/org/vss/api/ListKeyVersionsApi.java similarity index 100% rename from app/src/main/java/org/vss/api/ListKeyVersionsApi.java rename to java/app/src/main/java/org/vss/api/ListKeyVersionsApi.java diff --git a/app/src/main/java/org/vss/api/PutObjectsApi.java b/java/app/src/main/java/org/vss/api/PutObjectsApi.java similarity index 100% rename from app/src/main/java/org/vss/api/PutObjectsApi.java rename to java/app/src/main/java/org/vss/api/PutObjectsApi.java diff --git a/app/src/main/java/org/vss/api/VssApiEndpoint.java b/java/app/src/main/java/org/vss/api/VssApiEndpoint.java similarity index 100% rename from app/src/main/java/org/vss/api/VssApiEndpoint.java rename to java/app/src/main/java/org/vss/api/VssApiEndpoint.java diff --git a/app/src/main/java/org/vss/auth/AuthResponse.java b/java/app/src/main/java/org/vss/auth/AuthResponse.java similarity index 100% rename from app/src/main/java/org/vss/auth/AuthResponse.java rename to java/app/src/main/java/org/vss/auth/AuthResponse.java diff --git a/app/src/main/java/org/vss/auth/Authorizer.java b/java/app/src/main/java/org/vss/auth/Authorizer.java similarity index 100% rename from app/src/main/java/org/vss/auth/Authorizer.java rename to java/app/src/main/java/org/vss/auth/Authorizer.java diff --git a/app/src/main/java/org/vss/auth/NoopAuthorizer.java b/java/app/src/main/java/org/vss/auth/NoopAuthorizer.java similarity index 100% rename from app/src/main/java/org/vss/auth/NoopAuthorizer.java rename to java/app/src/main/java/org/vss/auth/NoopAuthorizer.java diff --git a/app/src/main/java/org/vss/exception/AuthException.java b/java/app/src/main/java/org/vss/exception/AuthException.java similarity index 100% rename from app/src/main/java/org/vss/exception/AuthException.java rename to java/app/src/main/java/org/vss/exception/AuthException.java diff --git a/app/src/main/java/org/vss/exception/ConflictException.java b/java/app/src/main/java/org/vss/exception/ConflictException.java similarity index 100% rename from app/src/main/java/org/vss/exception/ConflictException.java rename to java/app/src/main/java/org/vss/exception/ConflictException.java diff --git a/app/src/main/java/org/vss/exception/NoSuchKeyException.java b/java/app/src/main/java/org/vss/exception/NoSuchKeyException.java similarity index 100% rename from app/src/main/java/org/vss/exception/NoSuchKeyException.java rename to java/app/src/main/java/org/vss/exception/NoSuchKeyException.java diff --git a/app/src/main/java/org/vss/guice/BaseModule.java b/java/app/src/main/java/org/vss/guice/BaseModule.java similarity index 100% rename from app/src/main/java/org/vss/guice/BaseModule.java rename to java/app/src/main/java/org/vss/guice/BaseModule.java diff --git a/app/src/main/java/org/vss/impl/postgres/PostgresBackendImpl.java b/java/app/src/main/java/org/vss/impl/postgres/PostgresBackendImpl.java similarity index 100% rename from app/src/main/java/org/vss/impl/postgres/PostgresBackendImpl.java rename to java/app/src/main/java/org/vss/impl/postgres/PostgresBackendImpl.java diff --git a/app/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql b/java/app/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql similarity index 100% rename from app/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql rename to java/app/src/main/java/org/vss/impl/postgres/sql/v0_create_vss_db.sql diff --git a/app/src/main/resources/application.properties b/java/app/src/main/resources/application.properties similarity index 100% rename from app/src/main/resources/application.properties rename to java/app/src/main/resources/application.properties diff --git a/app/src/test/java/org/vss/AbstractKVStoreIntegrationTest.java b/java/app/src/test/java/org/vss/AbstractKVStoreIntegrationTest.java similarity index 100% rename from app/src/test/java/org/vss/AbstractKVStoreIntegrationTest.java rename to java/app/src/test/java/org/vss/AbstractKVStoreIntegrationTest.java diff --git a/app/src/test/java/org/vss/api/DeleteObjectApiTest.java b/java/app/src/test/java/org/vss/api/DeleteObjectApiTest.java similarity index 100% rename from app/src/test/java/org/vss/api/DeleteObjectApiTest.java rename to java/app/src/test/java/org/vss/api/DeleteObjectApiTest.java diff --git a/app/src/test/java/org/vss/api/GetObjectApiTest.java b/java/app/src/test/java/org/vss/api/GetObjectApiTest.java similarity index 100% rename from app/src/test/java/org/vss/api/GetObjectApiTest.java rename to java/app/src/test/java/org/vss/api/GetObjectApiTest.java diff --git a/app/src/test/java/org/vss/api/ListKeyVersionsApiTest.java b/java/app/src/test/java/org/vss/api/ListKeyVersionsApiTest.java similarity index 100% rename from app/src/test/java/org/vss/api/ListKeyVersionsApiTest.java rename to java/app/src/test/java/org/vss/api/ListKeyVersionsApiTest.java diff --git a/app/src/test/java/org/vss/api/PutObjectsApiTest.java b/java/app/src/test/java/org/vss/api/PutObjectsApiTest.java similarity index 100% rename from app/src/test/java/org/vss/api/PutObjectsApiTest.java rename to java/app/src/test/java/org/vss/api/PutObjectsApiTest.java diff --git a/app/src/test/java/org/vss/impl/postgres/PostgresBackendImplIntegrationTest.java b/java/app/src/test/java/org/vss/impl/postgres/PostgresBackendImplIntegrationTest.java similarity index 100% rename from app/src/test/java/org/vss/impl/postgres/PostgresBackendImplIntegrationTest.java rename to java/app/src/test/java/org/vss/impl/postgres/PostgresBackendImplIntegrationTest.java diff --git a/docker-compose.yml b/java/docker-compose.yml similarity index 100% rename from docker-compose.yml rename to java/docker-compose.yml diff --git a/settings.gradle b/java/settings.gradle similarity index 100% rename from settings.gradle rename to java/settings.gradle diff --git a/app/src/main/proto/vss.proto b/proto/vss.proto similarity index 100% rename from app/src/main/proto/vss.proto rename to proto/vss.proto