airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject airavata git commit: changing get all ssh credentials per gateway method
Date Fri, 05 Feb 2016 16:33:33 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop d2501c332 -> fb75a2f7e


changing get all ssh credentials per gateway method


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

Branch: refs/heads/develop
Commit: fb75a2f7ea8beb53bd91e6bfee6b488e77869b3b
Parents: d2501c3
Author: Chathuri Wimalasena <chathuri@apache.org>
Authored: Fri Feb 5 11:35:31 2016 -0500
Committer: Chathuri Wimalasena <chathuri@apache.org>
Committed: Fri Feb 5 11:35:31 2016 -0500

----------------------------------------------------------------------
 .../airavata/api/server/AiravataAPIServer.java      |  2 +-
 .../api/server/handler/AiravataServerHandler.java   |  3 ++-
 .../store/server/CredentialStoreServerHandler.java  | 13 ++++---------
 .../credential/store/store/CredentialReader.java    |  3 +++
 .../store/store/impl/CredentialReaderImpl.java      | 16 ++++++++++++++++
 5 files changed, 26 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/fb75a2f7/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
index 09d4c3f..49ddec7 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
@@ -70,7 +70,7 @@ public class AiravataAPIServer implements IServer{
         try {
             RegistryInitUtil.initializeDB();
             AppCatalogInitUtil.initializeDB();
-            WorkflowCatalogInitUtil.initializeDB();
+//            WorkflowCatalogInitUtil.initializeDB();
             final String serverHost = ServerSettings.getSetting(Constants.API_SERVER_HOST,
null);
             if (!ServerSettings.isTLSEnabled()) {
                 final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_PORT,
"8930"));

http://git-wip-us.apache.org/repos/asf/airavata/blob/fb75a2f7/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 78e39d2..8bf0ee1 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -337,8 +337,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             if (csClient == null){
                 csClient = getCredentialStoreServiceClient();
             }
+            Map<String, String> allSSHKeysForGateway = csClient.getAllSSHKeysForGateway(gatewayId);
             logger.info("Airavata retrieved all SSH pub keys for gateway Id : " + gatewayId);
-            return csClient.getAllSSHKeysForGateway(gatewayId);
+            return allSSHKeysForGateway;
         }catch (Exception e){
             logger.error("Error occurred while retrieving SSH public keys for gateway : "
+ gatewayId , e);
             AiravataSystemException exception = new AiravataSystemException();

http://git-wip-us.apache.org/repos/asf/airavata/blob/fb75a2f7/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
index d789f64..86b4b64 100644
--- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServerHandler.java
@@ -233,19 +233,14 @@ public class CredentialStoreServerHandler implements CredentialStoreService.Ifac
     public Map<String, String> getAllSSHKeysForGateway(String gatewayId) throws org.apache.airavata.credential.store.exception.CredentialStoreException,
TException {
         Map<String, String> sshKeyMap = new HashMap<>();
         try {
-            List<Credential> allCredentials = credentialReader.getAllCredentials();
+            List<Credential> allCredentials = credentialReader.getAllCredentialsPerGateway(gatewayId);
             if (allCredentials != null && !allCredentials.isEmpty()){
                 for (Credential credential : allCredentials) {
                     if (credential instanceof org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential)
{
                         org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential
sshCredential = (org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) credential;
-                        String gateway = sshCredential.getGateway();
-                        if (gateway != null){
-                            if (gateway.equals(gatewayId)) {
-                                byte[] publicKey = sshCredential.getPublicKey();
-                                if (publicKey != null) {
-                                    sshKeyMap.put(sshCredential.getToken(), new String(publicKey));
-                                }
-                            }
+                        byte[] publicKey = sshCredential.getPublicKey();
+                        if (publicKey != null) {
+                            sshKeyMap.put(sshCredential.getToken(), new String(publicKey));
                         }
                     }
                 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/fb75a2f7/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
index fe54b8e..ab96be4 100644
--- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/CredentialReader.java
@@ -73,6 +73,9 @@ public interface CredentialReader {
      */
     public List<Credential> getAllCredentials() throws CredentialStoreException;
 
+    public List<Credential> getAllCredentialsPerGateway(String gatewayId) throws CredentialStoreException;
+
+    public List<Credential> getAllCredentialsPerUser(String userName) throws CredentialStoreException;
     /**
      * Updates the community user contact email address.
      *

http://git-wip-us.apache.org/repos/asf/airavata/blob/fb75a2f7/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java
index dc2fd60..a7dded3 100644
--- a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java
+++ b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/store/impl/CredentialReaderImpl.java
@@ -87,6 +87,22 @@ public class CredentialReaderImpl implements CredentialReader, Serializable
{
 
     }
 
+    @Override
+    public List<Credential> getAllCredentialsPerGateway(String gatewayId) throws CredentialStoreException
{
+        Connection connection = getConnection();
+
+        try {
+            return this.credentialsDAO.getCredentials(gatewayId, connection);
+        } finally {
+            DBUtil.cleanup(connection);
+        }
+    }
+
+    @Override
+    public List<Credential> getAllCredentialsPerUser(String userName) throws CredentialStoreException
{
+        return null;
+    }
+
     public String getPortalUser(String gatewayName, String tokenId) throws CredentialStoreException
{
 
         Connection connection = getConnection();


Mime
View raw message