airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1443650 - in /airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac: context/ handler/ provider/
Date Thu, 07 Feb 2013 18:43:45 GMT
Author: lahiru
Date: Thu Feb  7 18:43:44 2013
New Revision: 1443650

URL: http://svn.apache.org/r1443650
Log:
makesure we dn't do myproxy authentication for all the gridftp transfers.

Modified:
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GramProvider.java

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java?rev=1443650&r1=1443649&r2=1443650&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
Thu Feb  7 18:43:44 2013
@@ -40,6 +40,7 @@ public class JobExecutionContext extends
 
     private GFacNotifier notifier;
 
+    private SecurityContext securityContext;
     // Keep track of the current path of the message. Before hitting provider its in-path.
     // After provider its out-path.
     private boolean inPath = true;
@@ -156,4 +157,12 @@ public class JobExecutionContext extends
     public void setOutPath(){
         this.inPath = false;
     }
+
+    public SecurityContext getSecurityContext() {
+        return securityContext;
+    }
+
+    public void setSecurityContext(SecurityContext securityContext) {
+        this.securityContext = securityContext;
+    }
 }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java?rev=1443650&r1=1443649&r2=1443650&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
Thu Feb  7 18:43:44 2013
@@ -51,8 +51,13 @@ public class GramDirectorySetupHandler i
         GridFtp ftp = new GridFtp();
 
         try {
-            GSISecurityContext gssContext = new GSISecurityContext(jobExecutionContext.getGFacConfiguration());
-            GSSCredential gssCred = gssContext.getGssCredentails();
+            if (jobExecutionContext.getSecurityContext() == null ||
+                    !(jobExecutionContext.getSecurityContext() instanceof GSISecurityContext))
+            {
+                GSISecurityContext gssContext = new GSISecurityContext(jobExecutionContext.getGFacConfiguration());
+                jobExecutionContext.setSecurityContext(gssContext);
+            }
+            GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.getSecurityContext()).getGssCredentails();
             String[] hostgridFTP = host.getGridFTPEndPointArray();
             if (hostgridFTP == null || hostgridFTP.length == 0) {
                 hostgridFTP = new String[]{host.getHostAddress()};

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=1443650&r1=1443649&r2=1443650&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
Thu Feb  7 18:43:44 2013
@@ -47,15 +47,16 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Set;
 
-public class GridFTPInputHandler implements GFacHandler{
+public class GridFTPInputHandler implements GFacHandler {
     private static final Logger log = LoggerFactory.getLogger(AppDescriptorCheckHandler.class);
+
     public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException
{
         log.info("Invoking GridFTPInputHandler ...");
-         MessageContext inputNew = new MessageContext();
+        MessageContext inputNew = new MessageContext();
         try {
             MessageContext input = jobExecutionContext.getInMessageContext();
             Set<String> parameters = input.getParameters().keySet();
-            for (String paramName:parameters) {
+            for (String paramName : parameters) {
                 ActualParameter actualParameter = (ActualParameter) input.getParameters().get(paramName);
                 String paramValue = MappingFactory.toString(actualParameter);
                 //TODO: Review this with type
@@ -77,15 +78,20 @@ public class GridFTPInputHandler impleme
         }
         jobExecutionContext.setInMessageContext(inputNew);
     }
-     private static String stageInputFiles(JobExecutionContext jobExecutionContext, String
paramValue) throws URISyntaxException, SecurityException, ToolsException, IOException {
+
+    private static String stageInputFiles(JobExecutionContext jobExecutionContext, String
paramValue) throws URISyntaxException, SecurityException, ToolsException, IOException {
         URI gridftpURL;
         gridftpURL = new URI(paramValue);
         GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
         ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
         GridFtp ftp = new GridFtp();
         URI destURI = null;
-        GSISecurityContext gssContext = new GSISecurityContext(jobExecutionContext.getGFacConfiguration());
-        GSSCredential gssCred = gssContext.getGssCredentails();
+        if (jobExecutionContext.getSecurityContext() == null ||
+                !(jobExecutionContext.getSecurityContext() instanceof GSISecurityContext))
{
+            GSISecurityContext gssContext = new GSISecurityContext(jobExecutionContext.getGFacConfiguration());
+            jobExecutionContext.setSecurityContext(gssContext);
+        }
+        GSSCredential gssCred = ((GSISecurityContext) jobExecutionContext.getSecurityContext()).getGssCredentails();
 
         for (String endpoint : host.getGridFTPEndPointArray()) {
             URI inputURI = GFacUtils.createGsiftpURI(endpoint, app.getInputDataDirectory());

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java?rev=1443650&r1=1443649&r2=1443650&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
Thu Feb  7 18:43:44 2013
@@ -52,9 +52,13 @@ public class GridFTPOutputHandler implem
         File localStdErrFile = null;
         Map<String, ActualParameter> stringMap = null;
         try {
-            GSISecurityContext gssContext = new GSISecurityContext(jobExecutionContext.getGFacConfiguration());
-            GSSCredential gssCred = gssContext.getGssCredentails();
-
+            if (jobExecutionContext.getSecurityContext() == null ||
+                    !(jobExecutionContext.getSecurityContext() instanceof GSISecurityContext))
+            {
+                GSISecurityContext gssContext = new GSISecurityContext(jobExecutionContext.getGFacConfiguration());
+                jobExecutionContext.setSecurityContext(gssContext);
+            }
+            GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.getSecurityContext()).getGssCredentails();
             String[] hostgridFTP = host.getGridFTPEndPointArray();
             if (hostgridFTP == null || hostgridFTP.length == 0) {
                 hostgridFTP = new String[]{host.getHostAddress()};
@@ -177,13 +181,13 @@ public class GridFTPOutputHandler implem
             GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
             GridFtp ftp = new GridFtp();
 
-            GSISecurityContext gssContext = new GSISecurityContext(jobExecutionContext.getGFacConfiguration());
-            GSSCredential gssCred = null;
-            try {
-                gssCred = gssContext.getGssCredentails();
-            } catch (SecurityException e) {
-                e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+            if (jobExecutionContext.getSecurityContext() == null ||
+                    !(jobExecutionContext.getSecurityContext() instanceof GSISecurityContext))
+            {
+                GSISecurityContext gssContext = new GSISecurityContext(jobExecutionContext.getGFacConfiguration());
+                jobExecutionContext.setSecurityContext(gssContext);
             }
+            GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.getSecurityContext()).getGssCredentails();
             try {
                 if ("URI".equals(actualParameter.getType().getType().toString())) {
                     for (String endpoint : host.getGridFTPEndPointArray()) {

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GramProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GramProvider.java?rev=1443650&r1=1443649&r2=1443650&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GramProvider.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GramProvider.java
Thu Feb  7 18:43:44 2013
@@ -59,8 +59,13 @@ public class GramProvider implements GFa
             /*
             * Set Security
             */
-            GSISecurityContext gssContext = new GSISecurityContext(jobExecutionContext.getGFacConfiguration());
-            GSSCredential gssCred = gssContext.getGssCredentails();
+            if (jobExecutionContext.getSecurityContext() == null ||
+                    !(jobExecutionContext.getSecurityContext() instanceof GSISecurityContext))
+            {
+                GSISecurityContext gssContext = new GSISecurityContext(jobExecutionContext.getGFacConfiguration());
+                jobExecutionContext.setSecurityContext(gssContext);
+            }
+            GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.getSecurityContext()).getGssCredentails();
             job.setCredentials(gssCred);
             // We do not support multiple gatekeepers in XBaya GUI, so we simply pick the
0th element in the array
             String gateKeeper = host.getGlobusGateKeeperEndPointArray(0);



Mime
View raw message