airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject git commit: updating app-catalog cpi to get all compute resource map - AIRAVATA-1335
Date Wed, 09 Jul 2014 20:25:31 GMT
Repository: airavata
Updated Branches:
  refs/heads/master fcbbc7e68 -> 53edab460


updating app-catalog cpi to get all compute resource map - AIRAVATA-1335


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

Branch: refs/heads/master
Commit: 53edab460fc63f4244f7e5b6c70fabe1980a4c92
Parents: fcbbc7e
Author: Chathuri Wimalasena <kamalasini@gmail.com>
Authored: Wed Jul 9 16:25:24 2014 -0400
Committer: Chathuri Wimalasena <kamalasini@gmail.com>
Committed: Wed Jul 9 16:25:24 2014 -0400

----------------------------------------------------------------------
 .../org/airavata/appcatalog/cpi/ComputeResource.java   |  6 +++---
 .../catalog/data/impl/ComputeResourceImpl.java         | 13 +++++++++++--
 .../airavata/app/catalog/test/ComputeResourceTest.java |  2 +-
 3 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/53edab46/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
index 9840d50..6efeb39 100644
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
+++ b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ComputeResource.java
@@ -97,11 +97,11 @@ public interface ComputeResource {
     List<ComputeResourceDescription> getAllComputeResourceList () throws AppCatalogException;
 
     /**
-     * This method will retrieve all the compute resource ids
-     * @return list of compute resource ids
+     * This method will retrieve all the compute resource id with it's name
+     * @return map of compute resource ids + name
      * @throws AppCatalogException
      */
-    List<String> getAllComputeResourceIdList () throws AppCatalogException;
+    Map<String, String> getAllComputeResourceIdList () throws AppCatalogException;
 
 
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/53edab46/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
index f0c57dc..add1168 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ComputeResourceImpl.java
@@ -21,6 +21,7 @@
 
 package org.apache.aiaravata.application.catalog.data.impl;
 
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -428,10 +429,18 @@ public class ComputeResourceImpl implements ComputeResource {
     }
 
     @Override
-    public List<String> getAllComputeResourceIdList() throws AppCatalogException {
+    public Map<String, String> getAllComputeResourceIdList() throws AppCatalogException
{
         try {
+            Map<String, String> computeResourceMap = new HashMap<String, String>();
             ComputeResourceResource resource = new ComputeResourceResource();
-            return resource.getAllIds();
+            List<Resource> allComputeResources = resource.getAll();
+            if (allComputeResources != null && !allComputeResources.isEmpty()){
+                for (Resource cm : allComputeResources){
+                    ComputeResourceResource cmr = (ComputeResourceResource)cm;
+                    computeResourceMap.put(cmr.getResourceId(), cmr.getHostName());
+                }
+            }
+            return computeResourceMap;
         }catch (Exception e){
             logger.error("Error while retrieving compute resource list...", e);
             throw new AppCatalogException(e);

http://git-wip-us.apache.org/repos/asf/airavata/blob/53edab46/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
index cf7ed30..e0ee1cf 100644
--- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
+++ b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
@@ -173,7 +173,7 @@ public class ComputeResourceTest {
             List<ComputeResourceDescription> allComputeResourceList = computeResource.getAllComputeResourceList();
             System.out.println("**********Size of all compute resources ************* : "
+  allComputeResourceList.size());
 
-            List<String> allComputeResourceIdList = computeResource.getAllComputeResourceIdList();
+            Map<String, String> allComputeResourceIdList = computeResource.getAllComputeResourceIdList();
             System.out.println("**********Size of all compute resources ids *************
: " +  allComputeResourceIdList.size());
 
 //            Map<String, String> globusfilters = new HashMap<String, String>();


Mime
View raw message