airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject git commit: removing unnecessary static map in scp input/output hadnlers
Date Wed, 08 Oct 2014 18:50:11 GMT
Repository: airavata
Updated Branches:
  refs/heads/master 532233f7b -> cc8722249


removing unnecessary static map in scp input/output hadnlers


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

Branch: refs/heads/master
Commit: cc8722249c26a73741e757c424278ca698a27183
Parents: 532233f
Author: lahiru <lahiru@apache.org>
Authored: Wed Oct 8 14:50:06 2014 -0400
Committer: lahiru <lahiru@apache.org>
Committed: Wed Oct 8 14:50:06 2014 -0400

----------------------------------------------------------------------
 .../gfac/ssh/handler/AdvancedSCPInputHandler.java        |  5 ++++-
 .../gfac/ssh/handler/AdvancedSCPOutputHandler.java       | 11 +++++++++--
 .../org/apache/airavata/gfac/ssh/util/GFACSSHUtils.java  | 11 ++++++++---
 3 files changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/cc872224/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 667d7b3..ce296da 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
@@ -31,6 +31,7 @@ import org.apache.airavata.gfac.core.handler.AbstractHandler;
 import org.apache.airavata.gfac.core.handler.AbstractRecoverableHandler;
 import org.apache.airavata.gfac.core.handler.GFacHandlerException;
 import org.apache.airavata.gfac.core.utils.GFacUtils;
+import org.apache.airavata.gfac.ssh.context.SSHAuthWrapper;
 import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
 import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
 import org.apache.airavata.gsi.ssh.api.Cluster;
@@ -129,7 +130,9 @@ public class AdvancedSCPInputHandler extends AbstractRecoverableHandler
{
                 authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath,
this.privateKeyPath,
                         this.passPhrase);
             }
-            jobExecutionContext.setProperty(ADVANCED_SSH_AUTH,authenticationInfo);
+            ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName);
+            String key = this.userName + this.hostName;
+            jobExecutionContext.setProperty(ADVANCED_SSH_AUTH,new SSHAuthWrapper(serverInfo,authenticationInfo,key));
             if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)
== null) {
                 try {
                     GFACSSHUtils.addSecurityContext(jobExecutionContext);

http://git-wip-us.apache.org/repos/asf/airavata/blob/cc872224/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 c147fd2..ad2131e 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
@@ -28,10 +28,12 @@ import org.apache.airavata.gfac.core.context.JobExecutionContext;
 import org.apache.airavata.gfac.core.handler.AbstractHandler;
 import org.apache.airavata.gfac.core.handler.GFacHandlerException;
 import org.apache.airavata.gfac.core.utils.GFacUtils;
+import org.apache.airavata.gfac.ssh.context.SSHAuthWrapper;
 import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
 import org.apache.airavata.gfac.ssh.util.GFACSSHUtils;
 import org.apache.airavata.gsi.ssh.api.Cluster;
 import org.apache.airavata.gsi.ssh.api.SSHApiException;
+import org.apache.airavata.gsi.ssh.api.ServerInfo;
 import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo;
 import org.apache.airavata.gsi.ssh.impl.PBSCluster;
 import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPasswordAuthenticationInfo;
@@ -84,7 +86,9 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
     private String hostName;
 
     private String outputPath;
-    
+
+    public static final String ADVANCED_SSH_AUTH = "advanced.ssh.auth";
+
 
     public void initProperties(Properties properties) throws GFacHandlerException {
         password = (String)properties.get("password");
@@ -98,7 +102,7 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
 
     @Override
     public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException
{
-    	  Cluster pbsCluster = null;
+    	Cluster pbsCluster = null;
         AuthenticationInfo authenticationInfo = null;
         if (password != null) {
             authenticationInfo = new DefaultPasswordAuthenticationInfo(this.password);
@@ -106,6 +110,9 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
             authenticationInfo = new DefaultPublicKeyFileAuthentication(this.publicKeyPath,
this.privateKeyPath,
                     this.passPhrase);
         }
+        ServerInfo serverInfo = new ServerInfo(this.userName, this.hostName);
+        String key = this.userName + this.hostName;
+        jobExecutionContext.setProperty(ADVANCED_SSH_AUTH,new SSHAuthWrapper(serverInfo,authenticationInfo,key));
         try {
             if (jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)
== null) {
                 try {

http://git-wip-us.apache.org/repos/asf/airavata/blob/cc872224/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 ec309a0..7ee5d6a 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
@@ -33,6 +33,7 @@ import org.apache.airavata.gfac.RequestData;
 import org.apache.airavata.gfac.core.context.JobExecutionContext;
 import org.apache.airavata.gfac.core.context.MessageContext;
 import org.apache.airavata.gfac.core.utils.GFacUtils;
+import org.apache.airavata.gfac.ssh.context.SSHAuthWrapper;
 import org.apache.airavata.gfac.ssh.security.SSHSecurityContext;
 import org.apache.airavata.gfac.ssh.security.TokenizedSSHAuthInfo;
 import org.apache.airavata.gsi.ssh.api.Cluster;
@@ -76,7 +77,7 @@ public class GFACSSHUtils {
             requestData.setTokenId(credentialStoreToken);
 
             ServerInfo serverInfo = new ServerInfo(null, registeredHost.getType().getHostAddress());
-            AuthenticationInfo info = (AuthenticationInfo) jobExecutionContext.getProperty(ADVANCED_SSH_AUTH);
+            SSHAuthWrapper sshAuth = (SSHAuthWrapper) jobExecutionContext.getProperty(ADVANCED_SSH_AUTH);
 
             Cluster pbsCluster = null;
             try {
@@ -94,6 +95,9 @@ public class GFACSSHUtils {
 
                 String key = credentials.getPortalUserName() + registeredHost.getType().getHostAddress()
+
                         serverInfo.getPort();
+                if(sshAuth!=null){
+                    key=sshAuth.getKey();
+                }
                 boolean recreate = false;
                 synchronized (clusters) {
                     if (clusters.containsKey(key) && clusters.get(key).size() <
maxClusterCount) {
@@ -121,10 +125,11 @@ public class GFACSSHUtils {
                         recreate = true;
                     }
                     if (recreate) {
-                        if (info != null) {
-                            pbsCluster = new PBSCluster(serverInfo, info,
+                        if (sshAuth != null) {
+                            pbsCluster = new PBSCluster(sshAuth.getServerInfo(), sshAuth.getAuthenticationInfo(),
                                     CommonUtils.getPBSJobManager(installedParentPath));
                             jobExecutionContext.setProperty(ADVANCED_SSH_AUTH,null); // some
other provider might fail
+                            key = sshAuth.getKey();
                         } else {
                             pbsCluster = new PBSCluster(serverInfo, tokenizedSSHAuthInfo,
                                     CommonUtils.getPBSJobManager(installedParentPath));


Mime
View raw message