Implementing API level changes

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

Branch: refs/heads/develop
Commit: b6548366daab592e260acbd3fb77001986866678
Parents: fcc44af
Author: Anuj Bhandar <bhandar.a...@gmail.com>
Authored: Mon Oct 10 18:33:41 2016 -0400
Committer: Anuj Bhandar <bhandar.a...@gmail.com>
Committed: Mon Oct 10 18:33:41 2016 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |    31 +
 .../java/org/apache/airavata/api/Airavata.java  | 12720 +++++++++--------
 .../credentialsummary/CredentialSummary.java    |   826 ++
 .../store/datamodel/CertificateCredential.java  |     2 +-
 .../store/datamodel/CommunityUser.java          |     2 +-
 .../store/datamodel/PasswordCredential.java     |     2 +-
 .../exception/CredentialStoreException.java     |     2 +-
 .../airavata-apis/airavata_api.thrift           |    20 +
 .../component-cpis/credential-store-cpi.thrift  |     7 +-
 .../credential_summary.thrift                   |    32 +
 .../resource_catalog_models.thrift              |     3 +-
 11 files changed, 7968 insertions(+), 5679 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/b6548366/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 61b9d83..658eb69 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
@@ -33,6 +33,7 @@ import 
org.apache.airavata.credential.store.client.CredentialStoreClientFactory;
 import org.apache.airavata.credential.store.cpi.CredentialStoreService;
 import org.apache.airavata.credential.store.datamodel.PasswordCredential;
 import org.apache.airavata.credential.store.datamodel.SSHCredential;
+import org.apache.airavata.credential.store.datamodel.SSHCredentialSummary;
 import org.apache.airavata.credential.store.exception.CredentialStoreException;
 import org.apache.airavata.messaging.core.MessageContext;
 import org.apache.airavata.messaging.core.MessagingFactory;
@@ -50,6 +51,7 @@ import 
org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescr
 import 
org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile;
 import 
org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference;
 import 
org.apache.airavata.model.appcatalog.userresourceprofile.UserStoragePreference;
+import 
org.apache.airavata.model.appcatalog.credentialsummary.CredentialSummary;
 import org.apache.airavata.model.application.io.InputDataObjectType;
 import org.apache.airavata.model.application.io.OutputDataObjectType;
 import org.apache.airavata.model.commons.airavata_commonsConstants;
@@ -486,6 +488,35 @@ public class AiravataServerHandler implements 
Airavata.Iface {
 
     @Override
     @SecurityCheck
+    public List<CredentialSummary> getAllGatewaySSHPubKeysSummary(AuthzToken 
authzToken, String gatewayId) throws InvalidRequestException, 
AiravataClientException, AiravataSystemException, TException {
+        try {
+            List<CredentialSummary> allCredentialSummaries =  new 
ArrayList<>();
+            if (csClient == null){
+                csClient = getCredentialStoreServiceClient();
+            }
+            List<SSHCredentialSummary> sshSummaryList = 
csClient.getAllGatewaySSHCredentialSummary(gatewayId);
+            for(SSHCredentialSummary key : sshSummaryList){
+                CredentialSummary summary = new CredentialSummary();
+                summary.setGatewayId(key.getGatewayId());
+                summary.setUsername(key.getUsername());
+                summary.setPublicKey(key.getPublicKey());
+                summary.setDescription(key.getDescription());
+                summary.setPersistedTime(key.getPersistedTime());
+                allCredentialSummaries.add(summary);
+            }
+            logger.debug("Airavata retrieved all SSH pub keys summaries for 
gateway Id : " + gatewayId);
+            return allCredentialSummaries;
+        }catch (Exception e){
+            logger.error("Error occurred while retrieving SSH public keys 
summaries for gateway : " + gatewayId , e);
+            AiravataSystemException exception = new AiravataSystemException();
+            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage("Error occurred while retrieving SSH public 
keys summaries for gateway : " + gatewayId + ". More info : " + e.getMessage());
+            throw exception;
+        }
+    }
+
+    @Override
+    @SecurityCheck
     public Map<String, String> getAllGatewayPWDCredentials(AuthzToken 
authzToken, String gatewayId) throws InvalidRequestException, 
AiravataClientException, AiravataSystemException, TException {
         try {
             if (csClient == null){

Reply via email to