Skip to content
Snippets Groups Projects
Commit 91dd9f89 authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

add exareme GLR into mining catalog

parent 4813a730
No related branches found
Tags 2.5.8
No related merge requests found
......@@ -40,6 +40,7 @@ server:
timeout: 2592000
workflow:
experimentUrl: http://dockerhost:8087/experiment
listMethodsUrl: http://dockerhost:8087/list-methods
miningMipUrl: http://dockerhost:8087/mining
miningExaremeUrl: http://hbps2.chuv.ch:9090/mining/query
......
# Configuration for the portal running inside a Docker container for development
connection:
url: "jdbc:postgresql://portaldb:5432/postgres"
username: "postgres"
password: "test"
security:
enabled: false
hbp:
client:
clientId: 996f97c5-a3ca-460e-b18b-00df3e2be89a
clientSecret: aD0Tueb3KkNkcZqZgQbNyDWgnM95IfZ0xPCQ_6Z9dQNHXY00RIrnAD_m7sNJh1oofYSX8aHkl72MkwI0K626Ug
accessTokenUri: https://services.humanbrainproject.eu/oidc/token
userAuthorizationUri: https://services.humanbrainproject.eu/oidc/authorize
tokenName: oauth_token
authenticationScheme: query
clientAuthenticationScheme: form
# use-current-uri: false # For both production and HBPS1 deployments
# pre-established-redirect-uri: https://mip.humanbrainproject.eu/services/login/hbp # For production deployment
# pre-established-redirect-uri: http://hbps1.chuv.ch/services/login/hbp # For HBPS1 deployment
resource:
userInfoUri: https://services.humanbrainproject.eu/oidc/userinfo
logging:
level:
org.springframework.security: DEBUG
spring:
resources:
chain:
enabled: true
server:
contextPath: /services
port: 8080
use-forward-headers: true
session:
timeout: 2592000
workflow:
listMethodsUrl: http://dockerhost:8087/list-methods
miningMipUrl: http://dockerhost:8087/mining
miningExaremeUrl: http://hbps2.chuv.ch:9090/mining/query
......@@ -18,25 +18,6 @@
<relativePath /> <!-- lookup parent from repository -->
</parent>
<profiles>
<profile>
<id>test</id>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<connection.driver_class>org.h2.Driver</connection.driver_class>
<connection.url>jdbc:h2:mem:test</connection.url>
<connection.username>root</connection.username>
<connection.password>root</connection.password>
<hibernate.dialect>org.hibernate.dialect.H2Dialect</hibernate.dialect>
<schema.deploy>true</schema.deploy>
<frontend.redirect>http://frontend/#/home</frontend.redirect>
<workflow.experimentUrl>http://hbps1.chuv.ch:8087/experiment</workflow.experimentUrl>
<workflow.listMethodsUrl>http://hbps1.chuv.ch:8087/list-methods</workflow.listMethodsUrl>
<flyway.url>${connection.url}</flyway.url>
<flyway.user>${connection.username}</flyway.user>
<flyway.password>${connection.password}</flyway.password>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
......@@ -48,9 +29,7 @@
<connection.password>iaezXODVLb1e70I</connection.password>
<hibernate.dialect>org.hibernate.dialect.PostgreSQL82Dialect</hibernate.dialect>
<schema.deploy>false</schema.deploy>
<frontend.redirect>https://mip.humanbrainproject.eu/#/home</frontend.redirect>
<workflow.experimentUrl>http://hbps1.chuv.ch:8087/experiment</workflow.experimentUrl>
<workflow.listMethodsUrl>http://hbps1.chuv.ch:8087/list-methods</workflow.listMethodsUrl>
<frontend.redirect>https://mip.humanbrainproject.eu/home</frontend.redirect>
<flyway.url>${connection.url}</flyway.url>
<flyway.user>${connection.username}</flyway.user>
<flyway.password>${connection.password}</flyway.password>
......@@ -68,10 +47,6 @@
<hibernate.dialect>org.hibernate.dialect.PostgreSQL82Dialect</hibernate.dialect>
<schema.deploy>false</schema.deploy>
<frontend.redirect>http://frontend/home</frontend.redirect>
<workflow.experimentUrl>http://dockerhost:8087/experiment</workflow.experimentUrl>
<workflow.listMethodsUrl>http://dockerhost:8087/list-methods</workflow.listMethodsUrl>
<workflow.miningMipUrl>http://dockerhost:8087/mining</workflow.miningMipUrl>
<workflow.miningExaremeUrl>http://dockerhost:8087/mining/query</workflow.miningExaremeUrl>
<flyway.url>${connection.url}</flyway.url>
<flyway.user>${connection.username}</flyway.user>
<flyway.password>${connection.password}</flyway.password>
......@@ -89,8 +64,6 @@
<hibernate.dialect>org.hibernate.dialect.PostgreSQL82Dialect</hibernate.dialect>
<schema.deploy>false</schema.deploy>
<frontend.redirect>http://hbps1.chuv.ch/home</frontend.redirect>
<workflow.experimentUrl>http://hbps1.chuv.ch:8087/experiment</workflow.experimentUrl>
<workflow.listMethodsUrl>http://hbps1.chuv.ch:8087/list-methods</workflow.listMethodsUrl>
<flyway.url>${connection.url}</flyway.url>
<flyway.user>${connection.username}</flyway.user>
<flyway.password>${connection.password}</flyway.password>
......@@ -189,7 +162,10 @@
<resources>
<resource>
<directory>src/main/resources</directory>
<includes><include>**/*.xml</include></includes>
<includes>
<include>**/*.xml</include>
<include>**/*.json</include>
</includes>
<excludes><exclude>**/*.csv</exclude></excludes>
<filtering>true</filtering>
</resource>
......
......@@ -4,15 +4,22 @@
package org.hbp.mip.controllers;
import com.google.gson.Gson;
import com.google.gson.JsonParser;
import io.swagger.annotations.*;
import org.hbp.mip.model.algorithm.Algorithm;
import org.hbp.mip.model.algorithm.Catalog;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
......@@ -23,6 +30,8 @@ import java.net.UnknownHostException;
@Api(value = "/mining", description = "Forward mining API")
public class MiningApi {
private static final String EXAREME_ALGO_JSON_FILE="data/exareme_algorithms.json";
@Value("#{'${workflow.listMethodsUrl:http://hbps1.chuv.ch:8087/list-methods}'}")
private String listMethodsUrl;
......@@ -47,7 +56,19 @@ public class MiningApi {
return new ResponseEntity<>(response.toString(), HttpStatus.valueOf(code));
}
return null;
Catalog catalog = new Gson().fromJson(response.toString(), Catalog.class);
for (Algorithm algo: catalog.getAlgorithms()) {
algo.setSource("ML");
}
InputStream is = MiningApi.class.getClassLoader().getResourceAsStream(EXAREME_ALGO_JSON_FILE);
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
Algorithm exaremeGLR = new Gson().fromJson(br, Algorithm.class);
exaremeGLR.setSource("exareme");
catalog.getAlgorithms().add(exaremeGLR);
return new ResponseEntity<>(new Gson().toJson(catalog), HttpStatus.valueOf(code));
}
private ResponseEntity<String> postMipMining(String query) throws Exception {
......
......@@ -33,6 +33,8 @@ public class Algorithm {
private Boolean disable;
private String source;
public String getCode() {
return code;
......@@ -105,4 +107,12 @@ public class Algorithm {
public void setDisable(Boolean disable) {
this.disable = disable;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment