airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [06/11] airavata git commit: Add gateway-core dependency on profile-service-server
Date Tue, 07 Mar 2017 22:17:41 GMT
Add gateway-core dependency on profile-service-server


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

Branch: refs/heads/user-profile
Commit: 732abdeec5696d7923e0f3e0f7a8831a1db5d500
Parents: 4e58ef7
Author: Gourav Shenoy <shenoy.200@gmail.com>
Authored: Tue Mar 7 14:11:05 2017 -0500
Committer: Gourav Shenoy <shenoy.200@gmail.com>
Committed: Tue Mar 7 14:11:05 2017 -0500

----------------------------------------------------------------------
 .../profile-service-server/pom.xml              |  5 +++
 .../handlers/GatewayProfileServiceHandler.java  | 40 +++++++++++++++++---
 2 files changed, 40 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/732abdee/airavata-services/profile-service/profile-service-server/pom.xml
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-service-server/pom.xml b/airavata-services/profile-service/profile-service-server/pom.xml
index 1bf16b8..df2a7ec 100644
--- a/airavata-services/profile-service/profile-service-server/pom.xml
+++ b/airavata-services/profile-service/profile-service-server/pom.xml
@@ -25,6 +25,11 @@
             <artifactId>profile-user-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>profile-gateway-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
     
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/732abdee/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/GatewayProfileServiceHandler.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/GatewayProfileServiceHandler.java
b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/GatewayProfileServiceHandler.java
index ae87215..89aa978 100644
--- a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/GatewayProfileServiceHandler.java
+++ b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/GatewayProfileServiceHandler.java
@@ -20,11 +20,13 @@
 */
 package org.apache.airavata.service.profile.handlers;
 
+import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
 import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.service.profile.gateway.core.GwyResourceProfile;
+import org.apache.airavata.service.profile.gateway.core.impl.GwyResourceProfileImpl;
 import org.apache.airavata.service.profile.gateway.cpi.GatewayProfileService;
 import org.apache.airavata.service.profile.gateway.cpi.exception.GatewayProfileServiceException;
 import org.apache.airavata.service.profile.gateway.cpi.profile_gateway_cpiConstants;
-import org.apache.thrift.TException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -37,6 +39,8 @@ public class GatewayProfileServiceHandler implements GatewayProfileService.Iface
 
     private final static Logger logger = LoggerFactory.getLogger(GatewayProfileServiceHandler.class);
 
+    private final GwyResourceProfile gatewayProfile = new GwyResourceProfileImpl();
+
     @Override
     public String getAPIVersion() throws GatewayProfileServiceException {
         try {
@@ -45,13 +49,24 @@ public class GatewayProfileServiceHandler implements GatewayProfileService.Iface
             logger.error("Error getting API version, reason: " + ex.getMessage(), ex);
             GatewayProfileServiceException exception = new GatewayProfileServiceException();
             exception.setMessage("Error getting API version, reason: " + ex.getMessage());
-            throw ex;
+            throw exception;
         }
     }
 
     @Override
     public String addGateway(Gateway gateway) throws GatewayProfileServiceException {
-        return null;
+        try {
+            GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
+            gatewayResourceProfile.setGatewayID(gateway.getGatewayId());
+            String gatewayId = gatewayProfile.addGatewayResourceProfile(gatewayResourceProfile);
+            logger.debug("Airavata added gateway-profile with ID: " + gatewayId);
+            return gatewayId;
+        } catch (Exception ex) {
+            logger.error("Error adding gateway-profile, reason: " + ex.getMessage(), ex);
+            GatewayProfileServiceException exception = new GatewayProfileServiceException();
+            exception.setMessage("Error adding gateway-profile, reason: " + ex.getMessage());
+            throw exception;
+        }
     }
 
     @Override
@@ -66,7 +81,15 @@ public class GatewayProfileServiceHandler implements GatewayProfileService.Iface
 
     @Override
     public boolean deleteGateway(String gatewayId) throws GatewayProfileServiceException
{
-        return false;
+        try {
+            logger.debug("Deleting Airavata gateway-profile with ID: " + gatewayId);
+            return gatewayProfile.removeGatewayResourceProfile(gatewayId);
+        } catch (Exception ex) {
+            logger.error("Error deleting gateway-profile, reason: " + ex.getMessage(), ex);
+            GatewayProfileServiceException exception = new GatewayProfileServiceException();
+            exception.setMessage("Error deleting gateway-profile, reason: " + ex.getMessage());
+            throw exception;
+        }
     }
 
     @Override
@@ -76,6 +99,13 @@ public class GatewayProfileServiceHandler implements GatewayProfileService.Iface
 
     @Override
     public boolean isGatewayExist(String gatewayId) throws GatewayProfileServiceException
{
-        return false;
+        try {
+            return gatewayProfile.isGatewayResourceProfileExists(gatewayId);
+        } catch (Exception ex) {
+            logger.error("Error checking if gateway-profile exists, reason: " + ex.getMessage(),
ex);
+            GatewayProfileServiceException exception = new GatewayProfileServiceException();
+            exception.setMessage("Error checking if gateway-profile exists, reason: " + ex.getMessage());
+            throw exception;
+        }
     }
 }


Mime
View raw message