You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ra...@apache.org on 2014/05/26 22:31:09 UTC

git commit: Added valiation of experimentid. AIRAVATA-1222

Repository: airavata
Updated Branches:
  refs/heads/master 1a8a19f5e -> 6ff2f694b


Added valiation of experimentid. AIRAVATA-1222

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

Branch: refs/heads/master
Commit: 6ff2f694be712d266c399329e023317a87b0ec6a
Parents: 1a8a19f
Author: raminder <ra...@apache.org>
Authored: Mon May 26 16:30:56 2014 -0400
Committer: raminder <ra...@apache.org>
Committed: Mon May 26 16:30:56 2014 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   | 27 +++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/6ff2f694/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 cb92217..e31faf1 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
@@ -682,6 +682,18 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public boolean validateExperiment(String airavataExperimentId) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, TException {
+    	 registry = RegistryFactory.getDefaultRegistry();
+     	try {
+ 			if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)){
+ 			    throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
+ 			}
+ 		} catch (RegistryException e1) {
+ 			  logger.error("Error while retrieving projects", e1);
+ 	            AiravataSystemException exception = new AiravataSystemException();
+ 	            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ 	            exception.setMessage("Error while retrieving projects. More info : " + e1.getMessage());
+ 	            throw exception;
+ 		}
 
         if (getOrchestratorClient().validateExperiment(airavataExperimentId)) {
             return true;
@@ -824,7 +836,20 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public void launchExperiment(String airavataExperimentId, String airavataCredStoreToken) throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException, AiravataSystemException, LaunchValidationException, TException {
-        final OrchestratorService.Client orchestratorClient = getOrchestratorClient();
+    	 registry = RegistryFactory.getDefaultRegistry();
+    	try {
+			if (!registry.isExist(RegistryModelType.EXPERIMENT, airavataExperimentId)){
+			    throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
+			}
+		} catch (RegistryException e1) {
+			  logger.error("Error while retrieving projects", e1);
+	            AiravataSystemException exception = new AiravataSystemException();
+	            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+	            exception.setMessage("Error while retrieving projects. More info : " + e1.getMessage());
+	            throw exception;
+		}
+
+    	final OrchestratorService.Client orchestratorClient = getOrchestratorClient();
         final String expID = airavataExperimentId;
         synchronized (this) {
             if (orchestratorClient.validateExperiment(expID)) {