diff --git a/pom.xml b/pom.xml
index 15a4ef0..07d5d95 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,6 +81,16 @@
commons-configuration
1.10
+
+
+ com.jcraft
+ jsch
+ 0.1.53
+
+
+
+
+
net.sf.opencsv
diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/rest/RestPoolManager.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/rest/RestPoolManager.java
index 4b336b7..b341933 100644
--- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/rest/RestPoolManager.java
+++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/rest/RestPoolManager.java
@@ -98,8 +98,13 @@ public class RestPoolManager implements PoolManager {
***REMOVED*** ***REMOVED*** ProxySelector.setDefault(new
***REMOVED*** ***REMOVED*** PropertiesBasedProxySelector("/home/ngalante/.proxy-settings"));
***REMOVED***
- ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab");
- SecurityTokenProvider.instance.set("3a23bfa4-4dfe-44fc-988f-194b91071dd2-843339462");
+***REMOVED*** ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab");
+***REMOVED*** SecurityTokenProvider.instance.set("3a23bfa4-4dfe-44fc-988f-194b91071dd2-843339462");
+
+ ScopeProvider.instance.set("/gcube/devNext");
+ SecurityTokenProvider.instance.set("708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548");
+
+
***REMOVED*** AuthorizationEntry entry = authorizationService().get("708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548");
***REMOVED*** System.out.println(entry.getContext());
@@ -107,7 +112,7 @@ public class RestPoolManager implements PoolManager {
RestPoolManager a = new RestPoolManager();
- a.stageAlgorithm("http:***REMOVED***data.d4science.org/cnFLNHYxR1ZDa1VNdEhrTUQyQlZjaWRBVVZlUHloUitHbWJQNStIS0N6Yz0");
+ a.stageAlgorithm("http:***REMOVED***data-d.d4science.org/TSt3cUpDTG1teUJMemxpcXplVXYzV1lBelVHTTdsYjlHbWJQNStIS0N6Yz0");
***REMOVED*** ***REMOVED***a.publishAlgorithm("http:***REMOVED***data.d4science.org/MnovRjZIdGV5WlB0WXE5NVNaZnRoRVg0SU8xZWpWQlFHbWJQNStIS0N6Yz0", "708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548","/gcube/devNext/NextNext");
***REMOVED*** ***REMOVED*** PoolManager aa = new DataminerPoolManager();
***REMOVED***
diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java
index efebf28..f98a270 100644
--- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java
+++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java
@@ -91,6 +91,9 @@ public class StagingJob extends DMPMJob {
if (b.checkMethod(a.getStagingHost(), SecurityTokenProvider.instance.get())
&& (b.algoExists(this.algorithm))) {
+ System.out.println("Interface check ok!");
+ System.out.println("Both the files exist at the correct path!");
+
this.svnUpdater.updateSVNRProtoAlgorithmList(this.algorithm, this.rProtoVREName,
this.algorithm.getFullname(), "Proto");
diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/CheckMethod.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/CheckMethod.java
index bec24e2..f7cc28f 100644
--- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/CheckMethod.java
+++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/CheckMethod.java
@@ -3,11 +3,23 @@ package org.gcube.dataanalysis.dataminer.poolmanager.util;
***REMOVED***
import java.io.File;
import java.io.FileWriter;
+import java.io.InputStream;
***REMOVED***
***REMOVED***
+import java.util.Vector;
+
+import javax.jms.ServerSession;
import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Algorithm;
+import com.jcraft.jsch.Channel;
+import com.jcraft.jsch.ChannelSftp;
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+import com.jcraft.jsch.SftpATTRS;
+import com.jcraft.jsch.SftpException;
+
public class CheckMethod {
public CheckMethod() {
@@ -70,27 +82,86 @@ public class CheckMethod {
- public boolean algoExists(Algorithm a){
+ public boolean algoExists(Algorithm a) throws Exception{
File file = new File("/home/gcube/wps_algorithms/algorithms/"+a.getName()+".jar");
File file2 = new File("/home/gcube/wps_algorithms/algorithms/"+a.getName()+"_interface.jar");
- if (file.exists()&&(file2.exists())){
+ System.out.println("First file is located to: "+file.getPath());
+ System.out.println("Second file is located to: "+file2.getPath());
+
+
+ if ((this.doesExist(file.getPath())) && (this.doesExist(file2.getPath()))){
return true;
***REMOVED***
else
- System.out.println("Algorithm"+a.getName()+".jar"+ " and "+a.getName()+"interface_.jar files are not present at the expected path");
+ System.out.println("Algorithm "+a.getName()+".jar"+ " and "+a.getName()+"_interface.jar files are not present at the expected path");
return false;
***REMOVED***
-
+
+
+
+
+ public boolean doesExist(String path) throws Exception {
+ JSch jsch = new JSch();
+ Session session = null;
+ Channel channel = null;
+ ChannelSftp c = null;
+ boolean success = false;
+
+ jsch.setKnownHosts("~/.ssh/known_hosts");
+ String privateKey = "~/.ssh/id_rsa";
+
+ jsch.addIdentity(privateKey);
+ System.out.println("Private Key Added.");
+
+ session = jsch.getSession("root", "dataminer1-devnext.d4science.org");
+ System.out.println("session created.");
+
+ java.util.Properties config = new java.util.Properties();
+ config.put("StrictHostKeyChecking", "no");
+
+ session.setConfig(config);
+ session.connect();
+
+ channel = session.openChannel("sftp");
+ channel.connect();
+ System.out.println("shell channel connected....");
+
+ c = (ChannelSftp) channel;
+
+ SftpATTRS is = null;
+ System.out.println(path);
+
+ try {
+ is = c.lstat(path);
+ success = true;
+ ***REMOVED*** catch (SftpException e) {
+ if (e.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) {
+ ***REMOVED*** file doesn't exist
+ success = false;
+ ***REMOVED***
+ ***REMOVED***success = true; ***REMOVED*** something else went wrong
+ ***REMOVED***
+ c.disconnect();
+ session.disconnect();
+ return success;
+
+***REMOVED***
+
public static void main(String[] args) throws Exception {
***REMOVED*** ServiceConfiguration a = new ServiceConfiguration();
***REMOVED*** System.out.println(a.getStagingHost());
CheckMethod a = new CheckMethod();
- if (!a.checkMethod("dataminer1-devnext.d4science.org", "708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548")){
- System.out.println("ciao");***REMOVED***
-
+***REMOVED*** if (a.checkMethod("dataminer1-devnext.d4science.org", "708e7eb8-11a7-4e9a-816b-c9ed7e7e99fe-98187548")){
+***REMOVED*** System.out.println("ciao");***REMOVED***
+***REMOVED***
+ if (a.doesExist("/home/gcube/wps_algorithms/algorithms/XMEANS_interface.jar")){
+ System.out.println("ciao");
+***REMOVED***
+
+
***REMOVED***
***REMOVED***