123 lines
4.1 KiB
Java
123 lines
4.1 KiB
Java
package org.gcube.dataanalysis.dataminer.poolmanager.rest;
|
|
|
|
import java.io.File;
|
|
***REMOVED***
|
|
import java.net.MalformedURLException;
|
|
***REMOVED***
|
|
import java.net.UnknownHostException;
|
|
|
|
import javax.ws.rs.GET;
|
|
import javax.ws.rs.Path;
|
|
import javax.ws.rs.Produces;
|
|
import javax.ws.rs.QueryParam;
|
|
|
|
***REMOVED***
|
|
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
|
|
import org.gcube.dataanalysis.dataminer.poolmanager.process.AddAlgorithmCommand;
|
|
import org.gcube.dataanalysis.dataminer.poolmanager.service.DataminerPoolManager;
|
|
import org.gcube.dataanalysis.dataminerpoolmanager.AlgorithmPackageParserTest;
|
|
***REMOVED***
|
|
***REMOVED***
|
|
|
|
@Path("/")
|
|
public class RestPoolManager implements PoolManager {
|
|
|
|
private static final Logger LOGGER = LoggerFactory.getLogger(RestPoolManager.class);
|
|
|
|
private PoolManager service = new DataminerPoolManager();
|
|
|
|
@GET
|
|
@Path("/add")
|
|
@Produces("text/plain")
|
|
public String addAlgorithmToVRE(@QueryParam("algorithm") String algorithm, @QueryParam("vre") String vre,
|
|
@QueryParam("name") String name, @QueryParam("description") String description,
|
|
@QueryParam("category") String category, @QueryParam("algorithmType") String algorithmType,
|
|
@QueryParam("skipJava") String skipJava) throws IOException, InterruptedException {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
LOGGER.debug("Adding algorithm =" + algorithm + " to VRE =" + vre);
|
|
Algorithm algo = service.extractAlgorithm(algorithm);
|
|
|
|
if (algo.getCategory() == null) {
|
|
algo.setCategory(category);
|
|
***REMOVED*** else
|
|
category = algo.getCategory();
|
|
System.out.println("category is: " + category);
|
|
|
|
if (algo.getAlgorithmType() == null) {
|
|
algo.setAlgorithmType(algorithmType);
|
|
***REMOVED*** else
|
|
algorithmType = algo.getCategory();
|
|
System.out.println("algorithmType is: " + algorithmType);
|
|
|
|
if (algo.getSkipJava() == null) {
|
|
algo.setSkipJava(skipJava);
|
|
***REMOVED*** else
|
|
skipJava = algo.getSkipJava();
|
|
System.out.println("skipJava is: " + skipJava);
|
|
|
|
if (algo.getName() == null) {
|
|
algo.setCategory(name);
|
|
***REMOVED*** else
|
|
name = algo.getName();
|
|
System.out.println("name is: " + name);
|
|
|
|
if (algo.getDescription() == null) {
|
|
algo.setDescription(description);
|
|
;
|
|
***REMOVED*** else
|
|
description = algo.getDescription();
|
|
System.out.println("description is: " + description);
|
|
|
|
return service.addAlgorithmToVRE(algo, vre);
|
|
|
|
***REMOVED***
|
|
|
|
@GET
|
|
@Path("/log")
|
|
@Produces("text/plain")
|
|
public String getLogById(@QueryParam("logUrl") String logUrl) throws IOException {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
LOGGER.debug("Returning Log =" + logUrl);
|
|
return service.getScriptFromURL(service.getURLfromWorkerLog(logUrl));
|
|
***REMOVED***
|
|
|
|
@Override
|
|
public Algorithm extractAlgorithm(String url) throws IOException {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
return null;
|
|
***REMOVED***
|
|
|
|
public static void main(String[] args) throws IOException, InterruptedException {
|
|
RestPoolManager a = new RestPoolManager();
|
|
***REMOVED*** System.out.println(System.getProperty("user.home")+File.separator+"/gcube/dataminer-pool-manager");
|
|
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
|
a.addAlgorithmToVRE("http:***REMOVED***data.d4science.org/am84enRYYkZ3dGRjZk9qTytQTndqaFpTOFJtT3RQeGhHbWJQNStIS0N6Yz0",
|
|
"/gcube/devNext/NextNext", null, null, "ICHTHYOP_MODEL", "transducerers", "N");
|
|
***REMOVED*** System.out.println(a.getLogById("dadcb059-69e5-48c3-aa58-3b290ae0419d"));
|
|
***REMOVED***
|
|
|
|
@Override
|
|
public void getLogId(Algorithm algo, String vre) {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
|
|
***REMOVED***
|
|
|
|
@Override
|
|
public String getScriptFromURL(URL logId) throws IOException {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
return null;
|
|
***REMOVED***
|
|
|
|
@Override
|
|
public String addAlgorithmToVRE(Algorithm algo, String vre) throws IOException, InterruptedException {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
return null;
|
|
***REMOVED***
|
|
|
|
@Override
|
|
public URL getURLfromWorkerLog(String logUrl) throws MalformedURLException, UnknownHostException {
|
|
***REMOVED*** TODO Auto-generated method stub
|
|
return null;
|
|
***REMOVED***
|
|
|
|
***REMOVED*** |