airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject [04/16] airavata git commit: fixing bigred2 auth error
Date Tue, 11 Nov 2014 19:10:51 GMT
fixing bigred2 auth error


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/f712ec1e
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/f712ec1e
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/f712ec1e

Branch: refs/heads/gfac_appcatalog_int
Commit: f712ec1ee472852e23ca13f0643d346cd24a4f42
Parents: 86c2a9d
Author: lahiru <lginnaliadmin@149-160-141-123.dhcp-bl.indiana.edu>
Authored: Fri Nov 7 12:07:38 2014 -0500
Committer: lahiru <lginnaliadmin@149-160-141-123.dhcp-bl.indiana.edu>
Committed: Fri Nov 7 12:07:38 2014 -0500

----------------------------------------------------------------------
 .../org/apache/airavata/gfac/Constants.java     |  2 --
 .../handler/GSISSHDirectorySetupHandler.java    | 30 +++++++++++---------
 .../gfac/gsissh/handler/GSISSHInputHandler.java | 11 +++----
 .../gsissh/handler/GSISSHOutputHandler.java     | 10 ++-----
 .../gsissh/provider/impl/GSISSHProvider.java    | 13 +++++----
 .../gsissh/security/GSISecurityContext.java     |  2 --
 .../gfac/gsissh/util/GFACGSISSHUtils.java       |  2 +-
 .../impl/GSISSHProviderTestWithMyProxyAuth.java |  2 +-
 .../airavata/gfac/monitor/HPCMonitorID.java     | 15 +++-------
 .../impl/pull/qstat/ResourceConnection.java     |  9 ++++--
 .../ssh/handler/AdvancedSCPInputHandler.java    |  4 +--
 .../ssh/handler/AdvancedSCPOutputHandler.java   |  2 +-
 .../ssh/handler/SSHDirectorySetupHandler.java   |  6 ++--
 .../gfac/ssh/handler/SSHInputHandler.java       |  9 ++----
 .../gfac/ssh/handler/SSHOutputHandler.java      |  7 ++---
 .../gfac/ssh/provider/impl/SSHProvider.java     | 12 ++++----
 .../gfac/ssh/security/SSHSecurityContext.java   |  2 --
 .../airavata/gfac/ssh/util/GFACSSHUtils.java    |  6 ++--
 .../services/impl/BigRed2TestWithSSHAuth.java   |  2 +-
 .../impl/SSHProviderTestWithSSHAuth.java        |  2 +-
 20 files changed, 68 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Constants.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Constants.java
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Constants.java
index 69d4a4a..0e086f9 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Constants.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/Constants.java
@@ -74,6 +74,4 @@ public class Constants {
     public static final String NAME = "name";
     public static final String VALUE = "value";
 
-    public static final String SSH_SECURITY_CONTEXT = "ssh";
-    public static final String GSI_SECURITY_CONTEXT = "gsi";
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
index b87f99a..1f84490 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHDirectorySetupHandler.java
@@ -47,7 +47,8 @@ public class GSISSHDirectorySetupHandler extends AbstractRecoverableHandler
{
 
 	public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException
{
         try {
-            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
== null) {
+            String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
+            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                 GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
             }
         } catch (Exception e) {
@@ -64,19 +65,20 @@ public class GSISSHDirectorySetupHandler extends AbstractRecoverableHandler
{
         makeDirectory(jobExecutionContext);
 	}
 	private void makeDirectory(JobExecutionContext jobExecutionContext) throws GFacHandlerException
{
-		 Cluster cluster = null;
-		try {
-         cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
-        if (cluster == null) {
-        	 try {
-  				GFacUtils.saveErrorDetails(jobExecutionContext, "Security context is not set properly",
CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
-  			} catch (GFacException e1) {
-  				 log.error(e1.getLocalizedMessage());
-  			}
-            throw new GFacHandlerException("Security context is not set properly");
-        } else {
-            log.info("Successfully retrieved the Security Context");
-        }
+        Cluster cluster = null;
+        try {
+            String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
+            cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
+            if (cluster == null) {
+                try {
+                    GFacUtils.saveErrorDetails(jobExecutionContext, "Security context is
not set properly", CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.AIRAVATA_INTERNAL_ERROR);
+                } catch (GFacException e1) {
+                    log.error(e1.getLocalizedMessage());
+                }
+                throw new GFacHandlerException("Security context is not set properly");
+            } else {
+                log.info("Successfully retrieved the Security Context");
+            }
         ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
 
             String workingDirectory = app.getScratchWorkingDirectory();

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
index 5665b5b..01dc712 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHInputHandler.java
@@ -67,11 +67,12 @@ public class GSISSHInputHandler extends AbstractRecoverableHandler {
         Cluster cluster = null;
         
         try {
-        	if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
!= null) {
-                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
-            } else {
-                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
+            String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
+            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
+                GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
             }
+
+            cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
             if (cluster == null) {
                 throw new GFacException("Security context is not set properly");
             } else {
@@ -93,7 +94,7 @@ public class GSISSHInputHandler extends AbstractRecoverableHandler {
                     log.error("Previously stored data " + pluginData +" is wrong so we continue
the operations");
                 }
             }
-            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
== null) {
+            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                 try {
                     GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
                 } catch (ApplicationSettingsException e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
index ac9bf3c..eff0164 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/handler/GSISSHOutputHandler.java
@@ -67,6 +67,7 @@ public class GSISSHOutputHandler extends AbstractRecoverableHandler {
         int oldIndex = 0;
         List<String> oldFiles = new ArrayList<String>();
         StringBuffer data = new StringBuffer("|");
+        String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
         if (jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof
GsisshHostType) { // this is because we don't have the right jobexecution context
             // so attempting to get it from the registry
             if (Constants.PUSH.equals(((GsisshHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType()).getMonitorMode()))
{
@@ -98,8 +99,7 @@ public class GSISSHOutputHandler extends AbstractRecoverableHandler {
             }
         }
         try {
-            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
== null) {
-
+            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                 GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
             }
         }  catch (Exception e) {
@@ -119,11 +119,7 @@ public class GSISSHOutputHandler extends AbstractRecoverableHandler {
         Cluster cluster = null;
         
         try {
-            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
!= null) {
-                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
-            } else {
-                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
-            }
+            cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
             if (cluster == null) {
                 GFacUtils.saveErrorDetails(jobExecutionContext, "Security context is not
set properly", CorrectiveAction.CONTACT_SUPPORT, ErrorCategory.FILE_SYSTEM_FAILURE);
                 

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
index b5a325a..87e0fb4 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/provider/impl/GSISSHProvider.java
@@ -61,7 +61,8 @@ public class GSISSHProvider extends AbstractRecoverableProvider {
     public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException,
GFacException {
         super.initialize(jobExecutionContext);
         try {
-            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
== null) {
+            String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
+            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                 GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
             }
         } catch (ApplicationSettingsException e) {
@@ -84,8 +85,8 @@ public class GSISSHProvider extends AbstractRecoverableProvider {
         Cluster cluster = null;
         
         try {
-            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
!= null) {
-                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
+            if (jobExecutionContext.getSecurityContext(host.getHostAddress()) != null) {
+                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(host.getHostAddress())).getPbsCluster();
             }
             if (cluster == null) {
                 throw new GFacProviderException("Security context is not set properly");
@@ -213,10 +214,10 @@ public class GSISSHProvider extends AbstractRecoverableProvider {
         JobDetails jobDetails = jobExecutionContext.getJobDetails();
         try {
             Cluster cluster = null;
-            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
== null) {
+            if (jobExecutionContext.getSecurityContext(host.getHostAddress()) == null) {
                 GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
             }
-            cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
+            cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(host.getHostAddress())).getPbsCluster();
             if (cluster == null) {
                 throw new GFacProviderException("Security context is not set properly");
             } else {
@@ -298,7 +299,7 @@ public class GSISSHProvider extends AbstractRecoverableProvider {
             jobDetails.setJobDescription(jobDesc);
             jobDetails.setJobID(jobId);
             jobExecutionContext.setJobDetails(jobDetails);
-            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
== null) {
+            if (jobExecutionContext.getSecurityContext(host.getHostAddress()) == null) {
                 try {
                     GFACGSISSHUtils.addSecurityContext(jobExecutionContext);
                 } catch (ApplicationSettingsException e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/security/GSISecurityContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/security/GSISecurityContext.java
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/security/GSISecurityContext.java
index aee6b02..46e7acd 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/security/GSISecurityContext.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/security/GSISecurityContext.java
@@ -55,8 +55,6 @@ public class GSISecurityContext extends AbstractSecurityContext {
     /*
      * context name
      */
-    public static final String GSI_SECURITY_CONTEXT = "gsi";
-
 
     private Cluster pbsCluster = null;
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
index 2f9dbc3..58efb56 100644
--- a/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
+++ b/modules/gfac/gfac-gsissh/src/main/java/org/apache/airavata/gfac/gsissh/util/GFACGSISSHUtils.java
@@ -163,7 +163,7 @@ public class GFACGSISSHUtils {
             } catch (Exception e) {
                 throw new GFacException("An error occurred while creating GSI security context",
e);
             }
-            jobExecutionContext.addSecurityContext(Constants.GSI_SECURITY_CONTEXT+"-"+registeredHost.getType().getHostAddress(),
context);
+            jobExecutionContext.addSecurityContext(registeredHost.getType().getHostAddress(),
context);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
b/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
index 0774022..26ae1b9 100644
--- a/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
+++ b/modules/gfac/gfac-gsissh/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTestWithMyProxyAuth.java
@@ -184,7 +184,7 @@ public class GSISSHProviderTestWithMyProxyAuth {
 
         jobExecutionContext = new JobExecutionContext(gFacConfiguration, serv.getType().getName());
         // Adding security context
-        jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT, getSecurityContext(app));
+        jobExecutionContext.addSecurityContext(hostAddress, getSecurityContext(app));
         ApplicationContext applicationContext = new ApplicationContext();
         jobExecutionContext.setApplicationContext(applicationContext);
         applicationContext.setServiceDescription(serv);

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
index a4a131d..3a15d39 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java
@@ -62,21 +62,14 @@ public class HPCMonitorID extends MonitorID {
         this.authenticationInfo = authenticationInfo;
         if (this.authenticationInfo != null) {
             try {
-                SecurityContext securityContext = jobExecutionContext.getSecurityContext(Constants.GSI_SECURITY_CONTEXT);
+                String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
+                SecurityContext securityContext = jobExecutionContext.getSecurityContext(hostAddress);
                 ServerInfo serverInfo = null;
                 if (securityContext != null) {
                     serverInfo = (((GSISecurityContext) securityContext).getPbsCluster()).getServerInfo();
                 }
-                if(serverInfo == null) {
-                    securityContext = jobExecutionContext.getSecurityContext(Constants.SSH_SECURITY_CONTEXT);
-                    if(securityContext !=null){
-                        serverInfo = (((SSHSecurityContext) securityContext).getPbsCluster()).getServerInfo();
-                    }
-                }
-                if(serverInfo!=null) {
-                    if (serverInfo.getUserName() != null) {
-                        setUserName(serverInfo.getUserName());
-                    }
+                if (serverInfo.getUserName() != null) {
+                    setUserName(serverInfo.getUserName());
                 }
             } catch (GFacException e) {
                 e.printStackTrace();

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
index 73c05b7..121cc59 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
@@ -49,11 +49,13 @@ public class ResourceConnection {
     public ResourceConnection(HostMonitorData hostMonitorData,AuthenticationInfo authInfo)
throws SSHApiException {
         MonitorID monitorID = hostMonitorData.getMonitorIDs().get(0);
         try {
-            GSISecurityContext securityContext = (GSISecurityContext) monitorID.getJobExecutionContext().getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT);
+            GSISecurityContext securityContext = (GSISecurityContext)
+                    monitorID.getJobExecutionContext().getSecurityContext(monitorID.getHost().getType().getHostAddress());
             if(securityContext != null) {
                 cluster = (PBSCluster) securityContext.getPbsCluster();
             }else {
-                SSHSecurityContext sshSecurityContext = (SSHSecurityContext) monitorID.getJobExecutionContext().getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT);
+                SSHSecurityContext sshSecurityContext = (SSHSecurityContext)
+                        monitorID.getJobExecutionContext().getSecurityContext(monitorID.getHost().getType().getHostAddress());
                 cluster = (PBSCluster)sshSecurityContext.getPbsCluster();
             }
 
@@ -68,7 +70,8 @@ public class ResourceConnection {
     public ResourceConnection(HostMonitorData hostMonitorData) throws SSHApiException {
         MonitorID monitorID = hostMonitorData.getMonitorIDs().get(0);
         try {
-            GSISecurityContext securityContext = (GSISecurityContext) monitorID.getJobExecutionContext().getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT);
+            GSISecurityContext securityContext = (GSISecurityContext)
+                    monitorID.getJobExecutionContext().getSecurityContext(monitorID.getHost().getType().getHostAddress());
             cluster = (PBSCluster) securityContext.getPbsCluster();
 
             // we just use cluster configuration from the incoming request and construct
a new cluster because for monitoring

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
index 26d0c29..36a7c8d 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPInputHandler.java
@@ -158,12 +158,12 @@ public class AdvancedSCPInputHandler extends AbstractRecoverableHandler
{
                         URL file = new URL(paramValue);
                         String key = file.getUserInfo() + file.getHost() + DEFAULT_SSH_PORT;
                         GFACSSHUtils.prepareSecurityContext(jobExecutionContext, authenticationInfo,
file.getUserInfo(), file.getHost(), DEFAULT_SSH_PORT);
-                        pbsCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT+key)).getPbsCluster();
+                        pbsCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(key)).getPbsCluster();
                         paramValue = file.getPath();
                     } catch (MalformedURLException e) {
                         String key = this.userName + this.hostName + DEFAULT_SSH_PORT;
                         GFACSSHUtils.prepareSecurityContext(jobExecutionContext, authenticationInfo,
this.userName, this.hostName, DEFAULT_SSH_PORT);
-                        pbsCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT+key)).getPbsCluster();
+                        pbsCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(key)).getPbsCluster();
                         log.error(e.getLocalizedMessage(), e);
                     }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
index dfd84de..c0416f5 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/AdvancedSCPOutputHandler.java
@@ -127,7 +127,7 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
                 }
             }
             String key = GFACSSHUtils.prepareSecurityContext(jobExecutionContext, authenticationInfo,
this.userName, this.hostName, DEFAULT_SSH_PORT);
-            pbsCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT+key)).getPbsCluster();
+            pbsCluster = ((SSHSecurityContext)jobExecutionContext.getSecurityContext(key)).getPbsCluster();
             if(jobExecutionContext.getTaskData().getAdvancedOutputDataHandling() != null
&& !jobExecutionContext.getTaskData().getAdvancedOutputDataHandling().isPersistOutputData()){
             outputPath = outputPath + File.separator + jobExecutionContext.getExperimentID()
+ "-" + jobExecutionContext.getTaskData().getTaskID()
                     + File.separator;

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
index 0be6820..9dcdefe 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHDirectorySetupHandler.java
@@ -46,7 +46,8 @@ public class SSHDirectorySetupHandler extends AbstractHandler {
 
 	public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException
{
         try {
-            if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)
== null) {
+            String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
+            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                 GFACSSHUtils.addSecurityContext(jobExecutionContext);
             }
         } catch (Exception e) {
@@ -67,7 +68,8 @@ public class SSHDirectorySetupHandler extends AbstractHandler {
 	private void makeDirectory(JobExecutionContext jobExecutionContext) throws GFacHandlerException
{
 		Cluster cluster = null;
 		try{
-        cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
+            String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
+            cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
         if (cluster == null) {
             throw new GFacHandlerException("Security context is not set properly");
         } else {

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
index b26e035..c279378 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHInputHandler.java
@@ -66,13 +66,8 @@ public class SSHInputHandler extends AbstractHandler {
         Cluster cluster = null;
         
         try {
-        	cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
-            if (cluster == null) {
-                throw new GFacException("Security context is not set properly");
-            } else {
-                log.info("Successfully retrieved the Security Context");
-            }
-            if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)
== null) {
+            String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
+            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                 try {
                     GFACSSHUtils.addSecurityContext(jobExecutionContext);
                 } catch (ApplicationSettingsException e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
index 328ad32..0780084 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/handler/SSHOutputHandler.java
@@ -89,10 +89,9 @@ public class SSHOutputHandler extends AbstractHandler {
                 }
             }
         }
-
+        String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
         try {
-            if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)
== null) {
-
+            if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
                 GFACSSHUtils.addSecurityContext(jobExecutionContext);
             }
         } catch (Exception e) {
@@ -113,7 +112,7 @@ public class SSHOutputHandler extends AbstractHandler {
                 .getApplicationDeploymentDescription().getType();
         Cluster cluster = null;
         try {
-             cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
+             cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
             if (cluster == null) {
                 throw new GFacProviderException("Security context is not set properly");
             } else {

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
index 0527c78..8e46d1b 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/provider/impl/SSHProvider.java
@@ -76,7 +76,8 @@ public class SSHProvider extends AbstractProvider {
 
     public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException,
GFacException {
         super.initialize(jobExecutionContext);
-        if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)
== null) {
+        String hostAddress = jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress();
+        if (jobExecutionContext.getSecurityContext(hostAddress) == null) {
             try {
                 GFACSSHUtils.addSecurityContext(jobExecutionContext);
             } catch (ApplicationSettingsException e) {
@@ -88,7 +89,7 @@ public class SSHProvider extends AbstractProvider {
 
         if (!((SSHHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType()).getHpcResource())
{
             jobID = "SSH_" + jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress()
+ "_" + Calendar.getInstance().getTimeInMillis();
-            cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
+            cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(hostAddress)).getPbsCluster();
 
             ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
             String remoteFile = app.getStaticWorkingDirectory() + File.separatorChar + Constants.EXECUTABLE_NAME;
@@ -146,9 +147,10 @@ public class SSHProvider extends AbstractProvider {
                 JobDetails jobDetails = new JobDetails();
                 try {
                     Cluster cluster = null;
-                    if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)
!= null) {
-                        cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
+                    if (jobExecutionContext.getSecurityContext(host.getHostAddress()) ==
null) {
+                        GFACSSHUtils.addSecurityContext(jobExecutionContext);
                     }
+                    cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(host.getHostAddress())).getPbsCluster();
                     if (cluster == null) {
                         throw new GFacProviderException("Security context is not set properly");
                     } else {
@@ -205,7 +207,7 @@ public class SSHProvider extends AbstractProvider {
         if (!hpcType) {
             throw new NotImplementedException();
         } else {
-            Cluster cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
+            Cluster cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(host.getHostAddress())).getPbsCluster();
             if (cluster == null) {
                 throw new GFacProviderException("Security context is not set properly");
             } else {

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/SSHSecurityContext.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/SSHSecurityContext.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/SSHSecurityContext.java
index da05cdd..c406c41 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/SSHSecurityContext.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/SSHSecurityContext.java
@@ -37,8 +37,6 @@ import org.slf4j.LoggerFactory;
 public class SSHSecurityContext implements SecurityContext {
 	private static final Logger log = LoggerFactory.getLogger(SSHSecurityContext.class);
 
-	public static final String SSH_SECURITY_CONTEXT = "ssh";
-
 	private String username;
 	private String privateKeyLoc;
 	private String keyPass;

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
index ad2731a..c756026 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java
@@ -142,7 +142,7 @@ public class GFACSSHUtils {
                 e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
             }
             sshSecurityContext.setPbsCluster(pbsCluster);
-            jobExecutionContext.addSecurityContext(Constants.SSH_SECURITY_CONTEXT+"-"+registeredHost.getType().getHostAddress(),
sshSecurityContext);
+            jobExecutionContext.addSecurityContext(registeredHost.getType().getHostAddress(),
sshSecurityContext);
         }
     }
 
@@ -201,7 +201,7 @@ public class GFACSSHUtils {
                     }
                 }
                 sshSecurityContext.setPbsCluster(pbsCluster);
-                jobExecutionContext.addSecurityContext(Constants.SSH_SECURITY_CONTEXT+key,
sshSecurityContext);
+                jobExecutionContext.addSecurityContext(key, sshSecurityContext);
             } catch (Exception e) {
                 e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
             }
@@ -312,7 +312,7 @@ public class GFACSSHUtils {
         ServerInfo serverInfo = new ServerInfo(userName, hostName);
         String key = userName+hostName+port;
         SSHAuthWrapper sshAuthWrapper = new SSHAuthWrapper(serverInfo, authenticationInfo,
key);
-        if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT+key)
== null) {
+        if (jobExecutionContext.getSecurityContext(key) == null) {
             try {
                 GFACSSHUtils.addSecurityContext(jobExecutionContext, sshAuthWrapper);
             } catch (ApplicationSettingsException e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
index e84848c..3756426 100644
--- a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
+++ b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/BigRed2TestWithSSHAuth.java
@@ -183,7 +183,7 @@ public class BigRed2TestWithSSHAuth {
 
         jobExecutionContext = new JobExecutionContext(gFacConfiguration, serv.getType().getName());
         // Adding security context
-        jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, getSecurityContext(app));
+        jobExecutionContext.addSecurityContext(host.getType().getHostAddress(), getSecurityContext(app));
         ApplicationContext applicationContext = new ApplicationContext();
         jobExecutionContext.setApplicationContext(applicationContext);
         applicationContext.setServiceDescription(serv);

http://git-wip-us.apache.org/repos/asf/airavata/blob/f712ec1e/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
index 5cb1200..6f3286d 100644
--- a/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
+++ b/modules/gfac/gfac-ssh/src/test/java/org/apache/airavata/core/gfac/services/impl/SSHProviderTestWithSSHAuth.java
@@ -132,7 +132,7 @@ public class SSHProviderTestWithSSHAuth {
         jobExecutionContext.setApplicationContext(applicationContext);
 
         // Add security context
-        jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, getSecurityContext());
+        jobExecutionContext.addSecurityContext(host.getType().getHostAddress(), getSecurityContext());
         /*
         * Host
         */


Mime
View raw message