removing add and delete method for SSHCredentialSummary, serverhandler 
implemented got get method


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

Branch: refs/heads/develop
Commit: efed2956fb93443575da73db0128ba1b3a18416d
Parents: 3170fef
Author: Anuj Bhandar <bhandar.a...@gmail.com>
Authored: Mon Oct 10 16:34:38 2016 -0400
Committer: Anuj Bhandar <bhandar.a...@gmail.com>
Committed: Mon Oct 10 16:34:58 2016 -0400

----------------------------------------------------------------------
 .../impl/ssh/SSHCredentialSummary.java          |  101 -
 .../server/CredentialStoreServerHandler.java    |   25 +
 .../store/cpi/CredentialStoreService.java       | 4216 +++++-------------
 3 files changed, 1110 insertions(+), 3232 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/efed2956/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialSummary.java
----------------------------------------------------------------------
diff --git 
a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialSummary.java
 
b/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialSummary.java
deleted file mode 100644
index f838eaa..0000000
--- 
a/modules/credential-store/credential-store-service/src/main/java/org/apache/airavata/credential/store/credential/impl/ssh/SSHCredentialSummary.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.credential.store.credential.impl.ssh;
-
-import org.apache.airavata.credential.store.credential.Credential;
-
-import java.io.Serializable;
-
-/**
- * An SSH Credential Summary class which is an extension of Airavata Credential
- */
-public class SSHCredentialSummary extends Credential implements Serializable {
-
-    /**
-        *
-        */
-       private static final long serialVersionUID = 1235236447420198981L;
-
-    private byte[] publicKey;
-    private String gateway;
-    private String username;
-    private String token;
-    private String description;
-
-    @Override
-    public String getToken() {
-        return token;
-    }
-
-    @Override
-    public void setToken(String token) {
-        this.token = token;
-    }
-
-
-
-    public String getUsername() {
-        return username;
-    }
-
-    public void setUsername(String username) {
-        this.username = username;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-
-    public SSHCredentialSummary() {
-    }
-
-    public SSHCredentialSummary(byte[] publicKey, String token, String 
gateway, String username) {
-        this.publicKey = publicKey;
-        this.gateway = gateway;
-        this.username = username;
-        this.token = token;
-        this.setPortalUserName(username);
-    }
-
-
-    public byte[] getPublicKey() {
-        return publicKey;
-    }
-
-    public void setPublicKey(byte[] pubKey) {
-        this.publicKey = pubKey;
-    }
-
-       public String getGateway() {
-               return gateway;
-       }
-
-       public void setGateway(String gateway) {
-               this.gateway = gateway;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/efed2956/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 0f1ac93..b7d52ce 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
@@ -30,6 +30,7 @@ import 
org.apache.airavata.credential.store.credential.Credential;
 import org.apache.airavata.credential.store.datamodel.CertificateCredential;
 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.store.CredentialStoreException;
 import 
org.apache.airavata.credential.store.store.impl.CertificateCredentialWriter;
 import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
@@ -187,6 +188,30 @@ public class CredentialStoreServerHandler implements 
CredentialStoreService.Ifac
     }
 
     @Override
+    public SSHCredentialSummary getSSHCredentialSummary(String tokenId, String 
gatewayId) throws 
org.apache.airavata.credential.store.exception.CredentialStoreException, 
TException {
+        try {
+            Credential credential = credentialReader.getCredential(gatewayId, 
tokenId);
+            if (credential instanceof 
org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) {
+                
org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential 
credential1 = 
(org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential) 
credential;
+                SSHCredentialSummary sshCredentialSummary = new 
SSHCredentialSummary();
+                
sshCredentialSummary.setUsername(credential1.getPortalUserName());
+                sshCredentialSummary.setGatewayId(credential1.getGateway());
+                sshCredentialSummary.setPublicKey(new 
String(credential1.getPublicKey()));
+                sshCredentialSummary.setToken(credential1.getToken());
+                
sshCredentialSummary.setPersistedTime(credential1.getCertificateRequestedTime().getTime());
+                return sshCredentialSummary;
+            } else {
+                log.info("Could not find SSH credential for token - " + 
tokenId + " and "
+                        + "gateway id - " + gatewayId);
+                return null;
+            }
+        } catch (CredentialStoreException e) {
+            log.error("Error occurred while retrieving SSH credential Summary 
for token - " +  tokenId + " and gateway id - " + gatewayId, e);
+            throw new 
org.apache.airavata.credential.store.exception.CredentialStoreException("Error 
occurred while retrieving SSH credential Summary for token - " +  tokenId + " 
and gateway id - " + gatewayId);
+        }
+    }
+
+    @Override
     public CertificateCredential getCertificateCredential(String tokenId, 
String gatewayId) throws 
org.apache.airavata.credential.store.exception.CredentialStoreException, 
TException {
         try {
             Credential credential = credentialReader.getCredential(gatewayId, 
tokenId);

Reply via email to