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-1249
Date Thu, 22 May 2014 00:26:18 GMT
fixing AIRAVATA-1249


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

Branch: refs/heads/master
Commit: 6f1ed7f0659463dd2b0f76056aacd873bfa11f9b
Parents: 452419f
Author: Chathuri Wimalasena <kamalasini@gmail.com>
Authored: Wed May 21 20:26:08 2014 -0400
Committer: Chathuri Wimalasena <kamalasini@gmail.com>
Committed: Wed May 21 20:26:08 2014 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   |   76 +
 .../java/org/apache/airavata/api/Airavata.java  | 3314 ++++++++++++++++--
 .../src/main/resources/lib/Airavata.cpp         |  986 +++++-
 .../src/main/resources/lib/Airavata.h           |  348 +-
 .../resources/lib/Airavata_server.skeleton.cpp  |   12 +-
 .../resources/lib/Airavata/API/Airavata.php     |  888 ++++-
 .../client/samples/CreateLaunchExperiment.java  |   45 +-
 .../airavataAPI.thrift                          |   23 +-
 .../registry/jpa/impl/LoggingRegistryImpl.java  |    5 +
 .../registry/jpa/impl/ProjectRegistry.java      |   39 +-
 .../registry/jpa/impl/RegistryImpl.java         |   21 +
 .../persistance/registry/jpa/model/Project.java |   12 +
 .../jpa/resources/AbstractResource.java         |    1 +
 .../registry/jpa/resources/ProjectResource.java |   18 +-
 .../registry/jpa/resources/WorkerResource.java  |   25 +
 .../apache/airavata/registry/cpi/Registry.java  |   10 +
 .../airavata/registry/cpi/utils/Constants.java  |    2 +
 17 files changed, 5253 insertions(+), 572 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/6f1ed7f0/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 a21f6b9..bf0fed4 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
@@ -179,6 +179,82 @@ public class AiravataServerHandler implements Airavata.Iface {
         }
     }
 
+    public List<Project> searchProjectsByProjectName(String userName, String projectName)
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;
+        }
+        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;
+        }
+        try {
+            List<Project> projects = new ArrayList<Project>();
+            registry = RegistryFactory.getDefaultRegistry();
+            Map<String, String> filters = new HashMap<String, String>();
+            filters.put(Constants.FieldConstants.ProjectConstants.OWNER, userName);
+            filters.put(Constants.FieldConstants.ProjectConstants.PROJECT_NAME, projectName);
+            List<Object> results = registry.search(RegistryModelType.PROJECT, filters);
+            for (Object object : results) {
+                projects.add((Project)object);
+            }
+            return projects;
+        }catch (Exception e) {
+            logger.error("Error while retrieving projects", e);
+            AiravataSystemException exception = new AiravataSystemException();
+            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage("Error while retrieving projects. More info : " + e.getMessage());
+            throw exception;
+        }
+    }
+
+    public List<Project> searchProjectsByProjectDesc(String userName, String description)
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;
+        }
+        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;
+        }
+        try {
+            List<Project> projects = new ArrayList<Project>();
+            registry = RegistryFactory.getDefaultRegistry();
+            Map<String, String> filters = new HashMap<String, String>();
+            filters.put(Constants.FieldConstants.ProjectConstants.OWNER, userName);
+            filters.put(Constants.FieldConstants.ProjectConstants.DESCRIPTION, description);
+            List<Object> results = registry.search(RegistryModelType.PROJECT, filters);
+            for (Object object : results) {
+                projects.add((Project)object);
+            }
+            return projects;
+        }catch (Exception e) {
+            logger.error("Error while retrieving projects", e);
+            AiravataSystemException exception = new AiravataSystemException();
+            exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+            exception.setMessage("Error while retrieving projects. More info : " + e.getMessage());
+            throw exception;
+        }
+    }
+
     /**
      * Get all Experiments within a Project
      *


Mime
View raw message