You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2012/05/15 20:42:26 UTC

svn commit: r1338821 - /incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java

Author: lahiru
Date: Tue May 15 18:42:26 2012
New Revision: 1338821

URL: http://svn.apache.org/viewvc?rev=1338821&view=rev
Log:
fixing output Staging support.

Modified:
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java?rev=1338821&r1=1338820&r2=1338821&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java Tue May 15 18:42:26 2012
@@ -25,6 +25,7 @@ import java.io.*;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.Iterator;
 import java.util.Map;
 
@@ -288,11 +289,11 @@ public class GramProvider extends Abstra
                     // If users has given an output DAta poth we download the output files in to that directory, this will be apath in the machine where GFac is installed
                     if(WorkflowContextHeaderBuilder.getCurrentContextHeader()
                             .getWorkflowOutputDataHandling() != null){
-                        WorkflowOutputDataHandlingDocument.WorkflowOutputDataHandling workflowOutputDataHandling = WorkflowContextHeaderBuilder.getCurrentContextHeader()
-                                .getWorkflowOutputDataHandling();
-                        if(workflowOutputDataHandling.getApplicationOutputDataHandlingArray() != null){
+                        WorkflowOutputDataHandlingDocument.WorkflowOutputDataHandling workflowOutputDataHandling =
+                                WorkflowContextHeaderBuilder.getCurrentContextHeader().getWorkflowOutputDataHandling();
+                        if(workflowOutputDataHandling.getApplicationOutputDataHandlingArray().length != 0){
                             String outputDataDirectory = workflowOutputDataHandling.getApplicationOutputDataHandlingArray()[0].getOutputDataDirectory();
-                            if(outputDataDirectory != null && "".equals(outputDataDirectory)){
+                            if(outputDataDirectory != null && !"".equals(outputDataDirectory)){
                                 stageOutputFiles(invocationContext,outputDataDirectory);
                             }
                         }
@@ -392,17 +393,15 @@ public class GramProvider extends Abstra
                     .getValue(paramName);
             //TODO: Review this with type
             if ("URI".equals(actualParameter.getType().getType().toString())) {
-                URI gridftpURL;
                 try {
                     GlobusHostType host = (GlobusHostType) invocationContext.getExecutionDescription().getHost().getType();
-                    ApplicationDeploymentDescriptionType app = invocationContext.getExecutionDescription().getApp().getType();
                     GridFtp ftp = new GridFtp();
                     gssContext = (GSISecurityContext) invocationContext.getSecurityContext(MYPROXY_SECURITY_CONTEXT);
                     GSSCredential gssCred = gssContext.getGssCredentails();
                     for (String endpoint : host.getGridFTPEndPointArray()) {
                         URI srcURI = GfacUtils.createGsiftpURI(endpoint, paramValue);
                         String fileName = new File(srcURI.getPath()).getName();
-                        File outputFile = File.createTempFile(outputFileStagingPath, fileName);
+                        File outputFile = new File(outputFileStagingPath + File.separator + fileName);
                         ftp.readRemoteFile(srcURI,
                                 gssCred, outputFile);
                         ((URIParameterType) actualParameter.getType()).setValue(outputFileStagingPath + File.separator + fileName);
@@ -413,8 +412,6 @@ public class GramProvider extends Abstra
                     throw new ProviderException(e.getMessage(), e);
                 } catch (SecurityException e) {
                     throw new ProviderException(e.getMessage(), e);
-                } catch (IOException e) {
-                    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
                 }
             }
             outputNew.add(paramName, actualParameter);