airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1515948 - in /airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac: external/GridFtp.java handler/GridFTPInputHandler.java
Date Tue, 20 Aug 2013 19:39:57 GMT
Author: lahiru
Date: Tue Aug 20 19:39:57 2013
New Revision: 1515948

URL: http://svn.apache.org/r1515948
Log:
fixing https://issues.apache.org/jira/browse/AIRAVATA-900.

Modified:
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/external/GridFtp.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/external/GridFtp.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/external/GridFtp.java?rev=1515948&r1=1515947&r2=1515948&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/external/GridFtp.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/external/GridFtp.java
Tue Aug 20 19:39:57 2013
@@ -36,6 +36,7 @@ import java.util.List;
 import java.util.Set;
 import java.util.Vector;
 
+import com.sun.tools.javac.util.Paths;
 import org.apache.airavata.gfac.GFacConfiguration;
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.ToolsException;
@@ -59,6 +60,8 @@ import org.ietf.jgss.GSSCredential;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.ws.rs.Path;
+
 /**
  * GridFTP tools
  */
@@ -160,7 +163,6 @@ public class GridFtp {
                 ftpClient.setType(Session.TYPE_IMAGE);
             }
 
-
             ftpClient.put(remoteFile, new DataSourceStream(io), new MarkerListener() {
                 public void markerArrived(Marker marker) {
                 }
@@ -203,7 +205,6 @@ public class GridFtp {
             destClient.authenticate(gsCredential);
             destClient.setDataChannelAuthentication(DataChannelAuthentication.SELF);
             makeFileTransferExternalConfigurations(srcClient, destClient);
-            
             log.debug("Uploading file");
             if (checkBinaryExtensions(remoteFile)) {
                 log.debug("Transfer mode is set to Binary for a file upload");
@@ -619,4 +620,15 @@ public class GridFtp {
 		}
 
 	}
+
+    public String gridFTPFileExist(URI inputDirectory,String fileName,GSSCredential gssCred)
throws ToolsException {
+        List<String> strings = listDir(inputDirectory, gssCred);
+        for(String fileExist:strings){
+            if(fileName.equals(fileExist)) {
+                fileName = "duplicate_" + fileName;
+                return fileName;
+            }
+        }
+        return fileName;
+    }
 }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java?rev=1515948&r1=1515947&r2=1515948&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
Tue Aug 20 19:39:57 2013
@@ -117,6 +117,8 @@ public class GridFTPInputHandler impleme
         for (String endpoint : gridFTPEndpointArray) {
             URI inputURI = GFacUtils.createGsiftpURI(endpoint, app.getInputDataDirectory());
             String fileName = new File(gridftpURL.getPath()).getName();
+            fileName = ftp.gridFTPFileExist(inputURI, fileName,gssCred);
+
             String destLocalPath = inputURI.getPath() + File.separator + fileName;
             //if user give a url just to refer an endpoint, not a web resource we are not
doing any transfer
             if (fileName != null && !"".equals(fileName)) {
@@ -168,4 +170,6 @@ public class GridFTPInputHandler impleme
     public void initProperties(Map<String, String> properties) throws GFacHandlerException,
GFacException {
 
     }
+
+
 }



Mime
View raw message