144 lines
3.9 KiB
Java
144 lines
3.9 KiB
Java
package org.gcube.dataanalysis.dataminer.poolmanager.rest;
|
|
|
|
***REMOVED***
|
|
import java.net.MalformedURLException;
|
|
import java.net.ProxySelector;
|
|
***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.service.DataminerPoolManager;
|
|
import org.gcube.dataanalysis.dataminer.poolmanager.util.PropertiesBasedProxySelector;
|
|
***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();
|
|
|
|
if (algo.getAlgorithmType() == null){
|
|
algo.setAlgorithmType(algorithmType);
|
|
***REMOVED*** else algorithmType = algo.getCategory();
|
|
|
|
if (algo.getSkipJava() == null){
|
|
algo.setSkipJava(skipJava);
|
|
***REMOVED*** else skipJava = algo.getSkipJava();
|
|
|
|
if (algo.getName() == null){
|
|
algo.setCategory(name);
|
|
***REMOVED*** else name = algo.getName();
|
|
|
|
if (algo.getDescription() == null){
|
|
algo.setDescription(description);;
|
|
***REMOVED*** else description = algo.getDescription();
|
|
|
|
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");
|
|
|
|
|
|
***REMOVED***ProxySelector.setDefault(new PropertiesBasedProxySelector("/home/ngalante/.proxy-settings"));
|
|
|
|
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
|
a.addAlgorithmToVRE(
|
|
"http:***REMOVED***data.d4science.org/S2h1RHZGd0JpWnBjZk9qTytQTndqcDRLVHNrQUt6QjhHbWJQNStIS0N6Yz0",
|
|
"/gcube/devNext/NextNext",
|
|
null, null, "test", "transducerers", "N");
|
|
|
|
***REMOVED***System.out.println(a.getLogById("34ac474d-b9df-4929-87e1-2a0ae26cf898"));
|
|
***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*** |