You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2014/07/07 16:09:54 UTC

git commit: implementing mission gateway profile cpi impl

Repository: airavata
Updated Branches:
  refs/heads/master a022bbade -> 25f4f5f01


implementing mission gateway profile cpi impl


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

Branch: refs/heads/master
Commit: 25f4f5f01fbf3e7eb2690d5ec2b06e2eab6d3cfc
Parents: a022bba
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Mon Jul 7 10:09:47 2014 -0400
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Mon Jul 7 10:09:47 2014 -0400

----------------------------------------------------------------------
 .../appcatalog/cpi/GwyResourceProfile.java      |  6 ++---
 .../data/impl/GwyResourceProfileImpl.java       | 24 +++++++++++++++++++-
 2 files changed, 25 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/25f4f5f0/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
index 95b8614..dd80762 100644
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
+++ b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
@@ -1,7 +1,5 @@
 package org.airavata.appcatalog.cpi;
 
-import org.apache.airavata.model.appcatalog.computeresource.DataMovementProtocol;
-import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol;
 import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
 import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
 
@@ -13,14 +11,14 @@ public interface GwyResourceProfile {
      * @param gatewayProfile gateway profile
      * @return gateway id
      */
-    String addGatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile gatewayProfile) throws AppCatalogException;
+    String addGatewayResourceProfile(GatewayResourceProfile gatewayProfile) throws AppCatalogException;
 
     /**
      * This method will update a gateway profile
      * @param gatewayId unique gateway id
      * @param updatedProfile updated profile
      */
-    void updateGatewayResourceProfile(String gatewayId, org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile updatedProfile) throws AppCatalogException;
+    void updateGatewayResourceProfile(String gatewayId, GatewayResourceProfile updatedProfile) throws AppCatalogException;
 
     /**
      *

http://git-wip-us.apache.org/repos/asf/airavata/blob/25f4f5f0/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
index 8410c3b..a8daec4 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
@@ -156,6 +156,21 @@ public class GwyResourceProfileImpl implements GwyResourceProfile {
      */
     @Override
     public ComputeResourcePreference getComputeResourcePreference(String gatewayId, String hostId) throws AppCatalogException {
+        try {
+            ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
+            List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
+            for (Resource resource : computePrefList){
+                ComputeHostPreferenceResource cmP = (ComputeHostPreferenceResource) resource;
+                if (cmP.getResourceId() != null && !cmP.getResourceId().equals("")){
+                    if (cmP.getResourceId().equals(hostId)){
+                        return AppCatalogThriftConversion.getComputeResourcePreference(cmP);
+                    }
+                }
+            }
+        }catch (Exception e) {
+            logger.error("Error while retrieving compute resource preference...", e);
+            throw new AppCatalogException(e);
+        }
         return null;
     }
 
@@ -165,6 +180,13 @@ public class GwyResourceProfileImpl implements GwyResourceProfile {
      */
     @Override
     public List<ComputeResourcePreference> getAllComputeResourcePreferences(String gatewayId) throws AppCatalogException {
-        return null;
+        try {
+            ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
+            List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
+            return AppCatalogThriftConversion.getComputeResourcePreferences(computePrefList);
+        }catch (Exception e) {
+            logger.error("Error while retrieving compute resource preference...", e);
+            throw new AppCatalogException(e);
+        }
     }
 }