diff --git a/pom.xml b/pom.xml
index 64a6e98..435d208 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/service/StagingJob.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java
index 621ead8..d2a7804 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 ***REMOVED***
if (b.checkMethod(a.getStagingHost(), SecurityTokenProvider.instance.get())
&& (b.algoExists(this.algorithm))) ***REMOVED***
+ 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 285cf93..bb96f34 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;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
+import java.io.InputStream;
import java.io.InputStreamReader;
***REMOVED***
+import java.util.Vector;
+
+import javax.jms.ServerSession;
***REMOVED***
+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 ***REMOVED***
public CheckMethod() ***REMOVED***
@@ -70,27 +82,86 @@ public class CheckMethod ***REMOVED***
- public boolean algoExists(Algorithm a)***REMOVED***
+ public boolean algoExists(Algorithm a) throws Exception***REMOVED***
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()))***REMOVED***
+ 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())))***REMOVED***
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 ***REMOVED***
+ 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 ***REMOVED***
+ is = c.lstat(path);
+ success = true;
+ ***REMOVED*** catch (SftpException e) ***REMOVED***
+ if (e.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) ***REMOVED***
+ ***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***
***REMOVED*** ServiceConfiguration a = new ServiceConfiguration();
***REMOVED*** System.out.println(a.getStagingHost());
CheckMethod a = new CheckMethod();
- if (!a.checkMethod("dataminer1-devnext.d4science.org", "***REMOVED***"))***REMOVED***
- System.out.println("ciao");***REMOVED***
-
+***REMOVED*** if (a.checkMethod("dataminer1-devnext.d4science.org", "***REMOVED***"))***REMOVED***
+***REMOVED*** System.out.println("ciao");***REMOVED***
+***REMOVED***
+ if (a.doesExist("/home/gcube/wps_algorithms/algorithms/XMEANS_interface.jar"))***REMOVED***
+ System.out.println("ciao");
+***REMOVED***
+
+
***REMOVED***
***REMOVED***