Skip to content
Snippets Groups Projects
Commit b903356d authored by Fuentes Serna  Juan Mariano (ID SIS)'s avatar Fuentes Serna Juan Mariano (ID SIS)
Browse files

SSDM-6001 - Microservice, some refactoring + basic documentation

parent 759a1750
No related branches found
No related tags found
No related merge requests found
## MICROSERVICE SERVER ##
# Introduction #
This project holds is supposed to be used to developed Java micro services.
# Configuration #
A json file with the configuration should be given during the startup as an argument, if not given the default "config.json" will be loaded (mostly used for distribution) and if not found "./conf/config.json" is loaded (mostly used for development).
# Build #
./gradlew distZip
The build will be found at ./build/distributions/microservice-server.zip
# Startup #
Unzip the build and execute
./bin/microservice-server
# Main packages #
## ch.ethz.sis.microservices.api ##
Supposed to contain only immutable DTOs annotated with lombok's @Data.
## ch.ethz.sis.microservices.server.json ##
JSON object mapper interface and implementations.
## ch.ethz.sis.microservices.server.logging ##
Logging interface and implementation.
## ch.ethz.sis.microservices.server.services ##
Service interface and implementation.
## ch.ethz.sis.microservices.server.startup ##
Main class and launcher.
## ch.ethz.sis.microservices.util ##
Utility classes.
# Configuration #
The json configuration file currently have two sections.
{
"port" : 8080,
"services" : []
}
The port used by the web server and a list of Services.
## ch.ethz.sis.microservices.server.services.store.FileInfoHandler ##
{
"className" : "ch.ethz.sis.microservices.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/"
}
}
## ch.ethz.sis.microservices.server.services.store.DownloadHandler ##
{
"className" : "ch.ethz.sis.microservices.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
...@@ -25,7 +25,7 @@ dependencies { ...@@ -25,7 +25,7 @@ dependencies {
} }
mainClassName = "ch.ethz.sis.microservices.download.server.startup.Main" mainClassName = "ch.ethz.sis.microservices.server.startup.Main"
distZip { distZip {
into(project.name) { into(project.name) {
......
...@@ -27,7 +27,14 @@ public class Main ...@@ -27,7 +27,14 @@ public class Main
if (args.length < 1) if (args.length < 1)
{ {
configFile = new File("./conf/config.json"); configFile = new File("./conf/config.json");
logger.info("No arguments given, starting with default config file: " + (configFile.getAbsolutePath())); if(configFile.exists()) {
logger.info("No arguments given, starting with default config file: " + (configFile.getAbsolutePath()));
} else {
configFile = new File("./config.json");
if(configFile.exists()) {
logger.info("No arguments given, starting with default config file: " + (configFile.getAbsolutePath()));
}
}
} else } else
{ {
configFile = new File(args[0]); configFile = new File(args[0]);
......
package ch.ethz.sis.microservices.server.startup; package ch.ethz.sis.microservices.util;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
......
...@@ -5,7 +5,7 @@ import java.util.Map; ...@@ -5,7 +5,7 @@ import java.util.Map;
import ch.ethz.sis.microservices.server.logging.LogManager; import ch.ethz.sis.microservices.server.logging.LogManager;
import ch.ethz.sis.microservices.server.logging.log4j.Log4J2LogFactory; import ch.ethz.sis.microservices.server.logging.log4j.Log4J2LogFactory;
import ch.ethz.sis.microservices.server.startup.HttpClient; import ch.ethz.sis.microservices.util.HttpClient;
import ch.ethz.sis.openbis.generic.asapi.v3.IApplicationServerApi; import ch.ethz.sis.openbis.generic.asapi.v3.IApplicationServerApi;
import ch.systemsx.cisd.common.spring.HttpInvokerUtils; import ch.systemsx.cisd.common.spring.HttpInvokerUtils;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment