diff --git a/big_data_link_server/build.gradle b/big_data_link_server/build.gradle index f9cfccf07bc762819ba0a3758fc39d9992906d7b..87e67ac5ca9d3e3e19600639729fb895ea802665 100644 --- a/big_data_link_server/build.gradle +++ b/big_data_link_server/build.gradle @@ -5,23 +5,13 @@ repositories { ivy { ivyPattern "http://svnsis.ethz.ch/repos/cisd/ivy-repository/trunk/[organisation]/[module]/[revision]/ivy.xml" artifactPattern "http://svnsis.ethz.ch/repos/cisd/ivy-repository/trunk/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" - } + } } dependencies { - compile 'eclipse:jetty-all:9.4.30.v20200611', - 'lombok:lombok:1.18.12', - 'log4j:log4j-api:2.10.0', - 'log4j:log4j-core:2.10.0', - 'fasterxml:jackson-annotations:2.9.10', - 'fasterxml:jackson-core:2.9.10', - 'fasterxml:jackson-databind:2.9.10', - 'openbis:openbis-v3-api-batteries-included:S269' - - annotationProcessor 'lombok:lombok:1.18.12' + compile project(':microservice_server_template') } - mainClassName = "ch.ethz.sis.microservices.download.server.startup.Main" distZip { @@ -33,4 +23,4 @@ distZip { from './' include 'README.md' } -} \ No newline at end of file +} diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/api/configuration/Config.java b/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/api/configuration/Config.java deleted file mode 100644 index 0dbc2068f6c266d2447a75759f34d3b6ae2474c3..0000000000000000000000000000000000000000 --- a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/api/configuration/Config.java +++ /dev/null @@ -1,13 +0,0 @@ -package ch.ethz.sis.microservices.download.api.configuration; - -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class Config -{ - private int port; - - private ServiceConfig[] services; -} diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/api/configuration/ServiceConfig.java b/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/api/configuration/ServiceConfig.java deleted file mode 100644 index cf7545ef5b7d8c5695e759713540128a9594f8f0..0000000000000000000000000000000000000000 --- a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/api/configuration/ServiceConfig.java +++ /dev/null @@ -1,17 +0,0 @@ -package ch.ethz.sis.microservices.download.api.configuration; - -import java.util.HashMap; - -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -public class ServiceConfig -{ - private String className; - - private String url; - - private HashMap<String, String> parameters; -} diff --git a/gradle/settings.gradle b/gradle/settings.gradle index ff6f7a72a0135f8344b0935430f999d1ad0cfe6f..348b14f5ad7954318552954f9151fa8dd804aa7a 100644 --- a/gradle/settings.gradle +++ b/gradle/settings.gradle @@ -1,4 +1,5 @@ -includeFlat 'commonbase', 'common', 'openbis_api', 'openbis-common', 'authentication', 'dbmigration', 'openbis', - 'datastore_server', 'screening', 'deep_sequencing_unit', 'rtd_yeastx', - 'openbis_standard_technologies', 'installation', 'image_readers', 'ui-test', 'js-test', 'datamover', - 'plasmid', 'rtd_cina', 'openbis_oai_pmh', 'big_data_link_server', 'openbis_ng_ui' +includeFlat 'commonbase', 'common', 'openbis_api', 'openbis-common', 'authentication', 'dbmigration', 'openbis', + 'datastore_server', 'screening', 'deep_sequencing_unit', 'rtd_yeastx', + 'openbis_standard_technologies', 'installation', 'image_readers', 'ui-test', 'js-test', 'datamover', + 'plasmid', 'rtd_cina', 'openbis_oai_pmh', 'big_data_link_server', 'openbis_ng_ui', 'microservice_server_template' + diff --git a/microservice_server_template/.gitignore b/microservice_server_template/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e18173b1bb08e58b11fc2305f927e4f590e153bb --- /dev/null +++ b/microservice_server_template/.gitignore @@ -0,0 +1,5 @@ +/build/ +/bin/ +/.idea/ +*.iml +*.eml \ No newline at end of file diff --git a/big_data_link_server/README.md b/microservice_server_template/README.md similarity index 100% rename from big_data_link_server/README.md rename to microservice_server_template/README.md diff --git a/microservice_server_template/build.gradle b/microservice_server_template/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..1944a0de3fe4507c818c6fee486c52759f3dbe6e --- /dev/null +++ b/microservice_server_template/build.gradle @@ -0,0 +1,34 @@ +apply plugin: 'java' +apply plugin: 'application' + +repositories { + ivy { + ivyPattern "http://svnsis.ethz.ch/repos/cisd/ivy-repository/trunk/[organisation]/[module]/[revision]/ivy.xml" + artifactPattern "http://svnsis.ethz.ch/repos/cisd/ivy-repository/trunk/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" + } +} + +dependencies { + compile 'eclipse:jetty-all:9.4.30.v20200611', + 'lombok:lombok:1.18.12', + 'log4j:log4j-api:2.10.0', + 'log4j:log4j-core:2.10.0', + 'fasterxml:jackson-annotations:2.9.10', + 'fasterxml:jackson-core:2.9.10', + 'fasterxml:jackson-databind:2.9.10', + 'openbis:openbis-v3-api-batteries-included:S269' + + annotationProcessor 'lombok:lombok:1.18.12' +} + + +distZip { + into(project.name) { + from './conf' + include '*' + } + into(project.name) { + from './' + include 'README.md' + } +} diff --git a/microservice_server_template/conf/config.json b/microservice_server_template/conf/config.json new file mode 100644 index 0000000000000000000000000000000000000000..44f4444e74b4c2bac44e55f10ee11c2c28a26f4f --- /dev/null +++ b/microservice_server_template/conf/config.json @@ -0,0 +1,27 @@ +{ + "port" : 8080, + "services" : [ + { + "className" : "ch.ethz.sis.microservices.download.server.services.store.FileInfoHandler", + "url" : "/file-information", + "parameters" : { + "openbis-url" : "http://localhost:8888/openbis/openbis/rmi-application-server-v3", + "datastore-url" : "http://localhost:8889/datastore_server/rmi-data-store-server-v3", + "services-timeout" : "10000", + "allowedExternalDMSCode" : "ADMIN-BS-MBPR28.D.ETHZ.CH-E96954A7", + "allowedContentCopyPath" : "/Users/localadmin/obis_data/" + } + }, + { + "className" : "ch.ethz.sis.microservices.download.server.services.store.DownloadHandler", + "url" : "/download", + "parameters" : { + "openbis-url" : "http://localhost:8888/openbis/openbis/rmi-application-server-v3", + "datastore-url" : "http://localhost:8889/datastore_server/rmi-data-store-server-v3", + "services-timeout" : "10000", + "allowedExternalDMSCode" : "ADMIN-BS-MBPR28.D.ETHZ.CH-E96954A7", + "allowedContentCopyPath" : "/Users/localadmin/obis_data/" + } + } + ] +} \ No newline at end of file diff --git a/big_data_link_server/gradle/wrapper/gradle-wrapper.jar b/microservice_server_template/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from big_data_link_server/gradle/wrapper/gradle-wrapper.jar rename to microservice_server_template/gradle/wrapper/gradle-wrapper.jar diff --git a/big_data_link_server/gradle/wrapper/gradle-wrapper.properties b/microservice_server_template/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from big_data_link_server/gradle/wrapper/gradle-wrapper.properties rename to microservice_server_template/gradle/wrapper/gradle-wrapper.properties diff --git a/big_data_link_server/gradlew b/microservice_server_template/gradlew similarity index 100% rename from big_data_link_server/gradlew rename to microservice_server_template/gradlew diff --git a/big_data_link_server/gradlew.bat b/microservice_server_template/gradlew.bat similarity index 96% rename from big_data_link_server/gradlew.bat rename to microservice_server_template/gradlew.bat index e95643d6a2ca62258464e83c72f5156dc941c609..f9553162f122c71b34635112e717c3e733b5b212 100644 --- a/big_data_link_server/gradlew.bat +++ b/microservice_server_template/gradlew.bat @@ -1,84 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/api/configuration/Config.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/api/configuration/Config.java new file mode 100644 index 0000000000000000000000000000000000000000..0123944d68e09815263b40dbf515d3fd97abf81c --- /dev/null +++ b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/api/configuration/Config.java @@ -0,0 +1,29 @@ +/* + * Copyright 2016 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.ethz.sis.microservices.download.api.configuration; + +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +public class Config +{ + private int port; + + private ServiceConfig[] services; +} diff --git a/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/api/configuration/ServiceConfig.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/api/configuration/ServiceConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..43ecd63cf5da3f47a7008177595d65a663981300 --- /dev/null +++ b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/api/configuration/ServiceConfig.java @@ -0,0 +1,33 @@ +/* + * Copyright 2016 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.ethz.sis.microservices.download.api.configuration; + +import java.util.HashMap; + +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +public class ServiceConfig +{ + private String className; + + private String url; + + private HashMap<String, String> parameters; +} diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/json/JSONObjectMapper.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/json/JSONObjectMapper.java similarity index 100% rename from big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/json/JSONObjectMapper.java rename to microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/json/JSONObjectMapper.java diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/json/jackson/JacksonObjectMapper.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/json/jackson/JacksonObjectMapper.java similarity index 100% rename from big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/json/jackson/JacksonObjectMapper.java rename to microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/json/jackson/JacksonObjectMapper.java diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/logging/LogFactory.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/logging/LogFactory.java similarity index 100% rename from big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/logging/LogFactory.java rename to microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/logging/LogFactory.java diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/logging/LogFactoryFactory.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/logging/LogFactoryFactory.java similarity index 100% rename from big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/logging/LogFactoryFactory.java rename to microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/logging/LogFactoryFactory.java diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/logging/LogManager.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/logging/LogManager.java similarity index 100% rename from big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/logging/LogManager.java rename to microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/logging/LogManager.java diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/logging/Logger.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/logging/Logger.java similarity index 100% rename from big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/logging/Logger.java rename to microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/logging/Logger.java diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/logging/log4j/Log4J2LogFactory.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/logging/log4j/Log4J2LogFactory.java similarity index 100% rename from big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/logging/log4j/Log4J2LogFactory.java rename to microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/logging/log4j/Log4J2LogFactory.java diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/logging/log4j/Log4JLogger.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/logging/log4j/Log4JLogger.java similarity index 100% rename from big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/logging/log4j/Log4JLogger.java rename to microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/logging/log4j/Log4JLogger.java diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/services/Service.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/services/Service.java similarity index 100% rename from big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/services/Service.java rename to microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/services/Service.java diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/startup/HttpClient.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/startup/HttpClient.java similarity index 100% rename from big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/startup/HttpClient.java rename to microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/startup/HttpClient.java diff --git a/big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/startup/ServerLauncher.java b/microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/startup/ServerLauncher.java similarity index 100% rename from big_data_link_server/src/main/java/ch/ethz/sis/microservices/download/server/startup/ServerLauncher.java rename to microservice_server_template/src/main/java/ch/ethz/sis/microservices/download/server/startup/ServerLauncher.java