diff --git a/microservice-server/README.md b/microservice-server/README.md index 404d6e820c05d893527631e0f878cbd344b38113..9186f84c33f923abf89d616e8c77c6460a639b1e 100644 --- a/microservice-server/README.md +++ b/microservice-server/README.md @@ -40,19 +40,50 @@ Main class and launcher. ## ch.ethz.sis.microservices.util ## Utility classes. -# Configuration # +# Services description and configuration # + +The config.json configuration file currently has two sections: + port : The port where the web server starts. + services : A list of services. -The json configuration file currently have two sections. +To configure a service two parameters are mandatory: + className : Complete Java class name with packages. + url : URL for the service, since all services share the same web server port. +One parameter is optional: + parameters : Additional parameters for the service. + +``` config.json { "port" : 8080, - "services" : [] + "services" : [ + { + "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/" + } + } + ] } +``` + +## File Service Handlers - (ch.ethz.sis.microservices.server.services.store.FileInfoHandler, ch.ethz.sis.microservices.server.services.store.DownloadHandler) ## +All these handlers share the same configuration and input parameters. -The port used by the web server and a list of Services. +### Configuration ### -## ch.ethz.sis.microservices.server.services.store.FileInfoHandler ## +openbis-url : Server where is validated that the user sessionToken can retrieve the dataset. +datastore-url : Server where is validated that the user sessionToken can retrieve the file and that the file exists for the given dataset. +services-timeout : Timeout when making calls to openBIS or DSS. +allowedExternalDMSCode : Allowed External DMS code, with the current implementation only one EDMS is possible for the service. +allowedContentCopyPath : Allowed directory where dataset files should be present, trying to access outside of this directory giving relative paths will result in failure. +``` Part of config.json { "className" : "ch.ethz.sis.microservices.server.services.store.FileInfoHandler", "url" : "/file-information", @@ -63,10 +94,7 @@ The port used by the web server and a list of Services. "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", @@ -77,4 +105,27 @@ The port used by the web server and a list of Services. "allowedExternalDMSCode" : "ADMIN-BS-MBPR28.D.ETHZ.CH-E96954A7", "allowedContentCopyPath" : "/Users/localadmin/obis_data/" } -} \ No newline at end of file +} +``` + +### Input parameters ### + +The service only accepts GET requests, the GET request should contain 5 mandatory parameters. + +sessionToken : User session token +datasetPermId : Dataset perm id the file belongs to, if not found on the AS or DSS an exception is thrown. +externalDMSCode : Should match the configured allowedExternalDMSCode, if not an exception is thrown. +contentCopyPath : Content copy path to access, if not found either AS, DSS or file system an exception is thrown. +datasetPathToFile : File to access, if not found either on the DSS or file system an exception is thrown. + +### Output ch.ethz.sis.microservices.server.services.store.FileInfoHandler ### +The body of the response will contain a JSON map with information from the file. + +``` BODY +{ + "isFileAccessible" : "true" +} +``` + +### Output ch.ethz.sis.microservices.server.services.store.DownloadHandler ### +The body of the response will contain the raw content from the file. \ No newline at end of file