Repository: airavata
Updated Branches:
  refs/heads/develop 4cf37a695 -> 5cb06c945


Pass credential expception up and save meaning full error message


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

Branch: refs/heads/develop
Commit: 5cb06c945fe0afebb2c8cbf19d99b7b4e37d4750
Parents: 4cf37a6
Author: Shameera Rathnayaka <[email protected]>
Authored: Wed Dec 28 14:18:25 2016 -0500
Committer: Shameera Rathnayaka <[email protected]>
Committed: Wed Dec 28 14:18:39 2016 -0500

----------------------------------------------------------------------
 .../java/org/apache/airavata/gfac/core/GFacEngine.java  | 12 +++++++-----
 .../java/org/apache/airavata/gfac/impl/GFacWorker.java  |  4 +++-
 .../apache/airavata/gfac/server/GfacServerHandler.java  | 12 +++++++++---
 3 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/5cb06c94/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacEngine.java
----------------------------------------------------------------------
diff --git 
a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacEngine.java
 
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacEngine.java
index 81ea88e..c7ba287 100644
--- 
a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacEngine.java
+++ 
b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacEngine.java
@@ -19,18 +19,20 @@
  */
 package org.apache.airavata.gfac.core;
 
+import org.apache.airavata.credential.store.exception.CredentialStoreException;
 import org.apache.airavata.gfac.core.context.ProcessContext;
 
 public interface GFacEngine {
 
 
-       public ProcessContext populateProcessContext(String processId, String 
gatewayId, String tokenId) throws GFacException;
+       public ProcessContext populateProcessContext(String processId, String 
gatewayId, String tokenId)
+                       throws GFacException, CredentialStoreException;
 
-       public void executeProcess(ProcessContext processContext) throws 
GFacException ;
+       public void executeProcess(ProcessContext processContext) throws 
GFacException;
 
-    public void recoverProcess(ProcessContext processContext) throws 
GFacException;
+       public void recoverProcess(ProcessContext processContext) throws 
GFacException;
 
-       public void continueProcess(ProcessContext processContext, String 
taskId) throws GFacException ;
+       public void continueProcess(ProcessContext processContext, String 
taskId) throws GFacException;
 
-       public void cancelProcess(ProcessContext processContext) throws 
GFacException ;
+       public void cancelProcess(ProcessContext processContext) throws 
GFacException;
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/5cb06c94/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacWorker.java
----------------------------------------------------------------------
diff --git 
a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacWorker.java
 
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacWorker.java
index 8e0d8d4..db05db5 100644
--- 
a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacWorker.java
+++ 
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/GFacWorker.java
@@ -22,6 +22,7 @@
 package org.apache.airavata.gfac.impl;
 
 import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.credential.store.exception.CredentialStoreException;
 import org.apache.airavata.gfac.core.GFacEngine;
 import org.apache.airavata.gfac.core.GFacException;
 import org.apache.airavata.gfac.core.GFacUtils;
@@ -66,7 +67,8 @@ public class GFacWorker implements Runnable {
        /**
         * This constructor will be called when new or recovery request comes.
         */
-       public GFacWorker(String processId, String gatewayId, String tokenId) 
throws GFacException {
+       public GFacWorker(String processId, String gatewayId, String tokenId) 
throws GFacException,
+                       CredentialStoreException {
                this.processId = processId;
                this.gatewayId = gatewayId;
                this.tokenId = tokenId;

http://git-wip-us.apache.org/repos/asf/airavata/blob/5cb06c94/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
----------------------------------------------------------------------
diff --git 
a/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
 
b/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
index 881290a..aa2e95d 100644
--- 
a/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
+++ 
b/modules/gfac/gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
@@ -30,6 +30,7 @@ import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.common.utils.ThriftUtils;
 import org.apache.airavata.common.utils.ZkConstants;
 import org.apache.airavata.common.utils.listener.AbstractActivityListener;
+import org.apache.airavata.credential.store.exception.CredentialStoreException;
 import org.apache.airavata.gfac.core.GFacException;
 import org.apache.airavata.gfac.core.GFacUtils;
 import org.apache.airavata.gfac.cpi.GfacService;
@@ -161,15 +162,20 @@ public class GfacServerHandler implements 
GfacService.Iface {
         MDC.put(MDCConstants.GATEWAY_ID, gatewayId);
         MDC.put(MDCConstants.TOKEN_ID, tokenId);
         try {
-               executorService.execute(MDCUtil.wrapWithMDC(new 
GFacWorker(processId, gatewayId, tokenId)));
+            executorService.execute(MDCUtil.wrapWithMDC(new 
GFacWorker(processId, gatewayId, tokenId)));
         } catch (GFacException e) {
             log.error("Failed to submit process", e);
             throw new TException("Failed to submit process", e);
+        } catch (CredentialStoreException e) {
+            log.error("Failed to submit process due to credential issue, " +
+                    "make sure you are passing a valid credentials");
+            throw new TException("Failed to submit process due to credential 
issue, " +
+                    "make sure you are passing a valid credentials", e);
         } catch (Exception e) {
-               log.error("Error creating zookeeper nodes");
+            log.error("Error creating zookeeper nodes");
             throw new TException("Error creating zookeeper nodes", e);
         }
-           return true;
+        return true;
     }
 
     @Override

Reply via email to