airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject [4/4] git commit: fixing AIRAVATA-1360
Date Mon, 18 Aug 2014 16:22:05 GMT
fixing AIRAVATA-1360


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

Branch: refs/heads/master
Commit: 3cab2d63a4c82a85795c8742442300e0247854bc
Parents: bb8e448
Author: Chathuri Wimalasena <kamalasini@gmail.com>
Authored: Mon Aug 18 12:21:55 2014 -0400
Committer: Chathuri Wimalasena <kamalasini@gmail.com>
Committed: Mon Aug 18 12:21:55 2014 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |   36 +
 .../java/org/apache/airavata/api/Airavata.java  | 6301 +++++++++++-------
 .../main/resources/lib/airavata/Airavata.cpp    |  945 ++-
 .../src/main/resources/lib/airavata/Airavata.h  |  159 +
 .../lib/airavata/Airavata_server.skeleton.cpp   |    5 +
 .../resources/lib/Airavata/API/Airavata.php     |  636 +-
 .../client/samples/CreateLaunchExperiment.java  |   16 +-
 .../samples/TestCreateLaunchExperiment.java     |   28 +-
 .../airavataAPI.thrift                          |    9 +
 .../registry/jpa/impl/ExperimentRegistry.java   |   21 +-
 .../registry/jpa/resources/WorkerResource.java  |   34 +
 11 files changed, 5274 insertions(+), 2916 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/3cab2d63/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 0edb752..32800cd 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
@@ -502,6 +502,42 @@ public class AiravataServerHandler implements Airavata.Iface, Watcher
{
         }
     }
 
+    @Override
+    public List<ExperimentSummary> searchExperimentsByStatus(String userName, ExperimentState
experimentState) throws InvalidRequestException, AiravataClientException, AiravataSystemException,
TException {
+        if (!validateString(userName)){
+            logger.error("Username cannot be empty. Please provide a valid user..");
+            AiravataSystemException exception = new AiravataSystemException();
+            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage("Username cannot be empty. Please provide a valid user..");
+            throw exception;
+        }
+        try {
+            if (!ResourceUtils.isUserExist(userName)){
+                logger.error("User does not exist in the system. Please provide a valid user..");
+                AiravataSystemException exception = new AiravataSystemException();
+                exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+                exception.setMessage("User does not exist in the system. Please provide a
valid user..");
+                throw exception;
+            }
+            List<ExperimentSummary> summaries = new ArrayList<ExperimentSummary>();
+            registry = RegistryFactory.getDefaultRegistry();
+            Map<String, String> filters = new HashMap<String, String>();
+            filters.put(Constants.FieldConstants.ExperimentConstants.USER_NAME, userName);
+            filters.put(Constants.FieldConstants.ExperimentConstants.EXPERIMENT_STATUS, experimentState.toString());
+            List<Object> results = registry.search(RegistryModelType.EXPERIMENT, filters);
+            for (Object object : results) {
+                summaries.add((ExperimentSummary) object);
+            }
+            return summaries;
+        }catch (Exception e) {
+            logger.error("Error while retrieving experiments", e);
+            AiravataSystemException exception = new AiravataSystemException();
+            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage("Error while retrieving experiments. More info : " + e.getMessage());
+            throw exception;
+        }
+    }
+
     /**
      * Get all Experiments within a Project
      *


Mime
View raw message