airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject airavata git commit: updating CPI s to have the gateway id - AIRAVATA-1607 AIRAVATA-1608
Date Wed, 04 Mar 2015 18:36:37 GMT
Repository: airavata
Updated Branches:
  refs/heads/master b1f0b00d3 -> 7c5f1c85a


updating CPI s to have the gateway id - AIRAVATA-1607 AIRAVATA-1608


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

Branch: refs/heads/master
Commit: 7c5f1c85a250d66332eecbdf77ee64c581cb554a
Parents: b1f0b00
Author: Chathuri Wimalasena <kamalasini@gmail.com>
Authored: Wed Mar 4 13:36:32 2015 -0500
Committer: Chathuri Wimalasena <kamalasini@gmail.com>
Committed: Wed Mar 4 13:36:32 2015 -0500

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   | 121 ++++++++++++++++---
 .../api/server/util/DataModelUtils.java         |   8 +-
 .../client/samples/CreateLaunchExperiment.java  |   4 +-
 .../appcatalog/cpi/ApplicationDeployment.java   |   4 +-
 .../appcatalog/cpi/ApplicationInterface.java    |   8 +-
 .../appcatalog/cpi/WorkflowCatalog.java         |   4 +-
 .../data/impl/ApplicationDeploymentImpl.java    |   4 +-
 .../data/impl/ApplicationInterfaceImpl.java     |   8 +-
 .../catalog/data/impl/WorkflowCatalogImpl.java  |   4 +-
 .../app/catalog/test/AppDeploymentTest.java     |  11 +-
 .../app/catalog/test/AppInterfaceTest.java      |  12 +-
 .../airavata/integration/SimpleEchoIT.java      |   4 +-
 .../SingleAppIntegrationTestBase.java           |   6 +-
 .../integration/tools/DocumentCreatorNew.java   |   5 +-
 .../airavata/messaging/client/TestReader.java   |   3 -
 .../orchestrator/util/DataModelUtils.java       |  10 +-
 .../registry/jpa/impl/ExperimentRegistry.java   |   5 +-
 .../registry/jpa/impl/LoggingRegistryImpl.java  |  35 ++++--
 .../registry/jpa/impl/ProjectRegistry.java      |   8 +-
 .../registry/jpa/impl/RegistryImpl.java         |   6 +-
 .../apache/airavata/registry/cpi/Registry.java  |   2 +-
 .../airavata/workflow/engine/WorkflowUtils.java |  10 +-
 22 files changed, 195 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/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 ff90bb2..32aa08b 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
@@ -126,7 +126,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 logger.error("Gateway id cannot be empty...");
                 throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             }
-            return (String)registry.add(ParentDataType.GATEWAY, gateway);
+            return (String)registry.add(ParentDataType.GATEWAY, gateway, gateway.getGatewayId());
         } catch (RegistryException e) {
             logger.error("Error while adding gateway", e);
             AiravataSystemException exception = new AiravataSystemException();
@@ -258,7 +258,15 @@ public class AiravataServerHandler implements Airavata.Iface {
                 logger.error("Project name and owner cannot be empty...");
                 throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             }
-            return (String)registry.add(ParentDataType.PROJECT, project);
+            if (!validateString(gatewayId)){
+                logger.error("Gateway ID cannot be empty...");
+                throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+            }
+            if (!isGatewayExist(gatewayId)){
+                logger.error("Gateway does not exist.Please provide a valid gateway id...");
+                throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+            }
+            return (String)registry.add(ParentDataType.PROJECT, project, gatewayId);
         } catch (RegistryException e) {
             logger.error("Error while creating the project", e);
             AiravataSystemException exception = new AiravataSystemException();
@@ -349,6 +357,10 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage("Username cannot be empty. Please provide a valid user..");
             throw exception;
         }
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         List<Project> projects = new ArrayList<Project>();
         try {
             if (!ResourceUtils.isUserExist(userName)){
@@ -386,6 +398,10 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage("Username cannot be empty. Please provide a valid user..");
             throw exception;
         }
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             if (!ResourceUtils.isUserExist(userName)){
                 logger.error("User does not exist in the system. Please provide a valid user..");
@@ -424,6 +440,10 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage("Username cannot be empty. Please provide a valid user..");
             throw exception;
         }
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             if (!ResourceUtils.isUserExist(userName)){
                 logger.error("User does not exist in the system. Please provide a valid user..");
@@ -462,6 +482,10 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage("Username cannot be empty. Please provide a valid user..");
             throw exception;
         }
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             if (!ResourceUtils.isUserExist(userName)){
                 logger.error("User does not exist in the system. Please provide a valid user..");
@@ -500,6 +524,10 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage("Username cannot be empty. Please provide a valid user..");
             throw exception;
         }
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             if (!ResourceUtils.isUserExist(userName)){
                 logger.error("User does not exist in the system. Please provide a valid user..");
@@ -535,6 +563,10 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage("Username cannot be empty. Please provide a valid user..");
             throw exception;
         }
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             if (!ResourceUtils.isUserExist(userName)){
                 logger.error("User does not exist in the system. Please provide a valid user..");
@@ -571,6 +603,10 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage("Username cannot be empty. Please provide a valid user..");
             throw exception;
         }
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             if (!ResourceUtils.isUserExist(userName)){
                 logger.error("User does not exist in the system. Please provide a valid user..");
@@ -607,6 +643,10 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage("Username cannot be empty. Please provide a valid user..");
             throw exception;
         }
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             if (!ResourceUtils.isUserExist(userName)){
                 logger.error("User does not exist in the system. Please provide a valid user..");
@@ -692,6 +732,10 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage("Username cannot be empty. Please provide a valid user..");
             throw exception;
         }
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             if (!ResourceUtils.isUserExist(userName)){
                 logger.error("User does not exist in the system. Please provide a valid user..");
@@ -751,7 +795,11 @@ public class AiravataServerHandler implements Airavata.Iface {
                 exception.setMessage("Cannot create experiments with empty experiment name");
                 throw exception;
             }
-            String experimentId = (String)registry.add(ParentDataType.EXPERIMENT, experiment);
+            if (!isGatewayExist(gatewayId)){
+                logger.error("Gateway does not exist.Please provide a valid gateway id...");
+                throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+            }
+            String experimentId = (String)registry.add(ParentDataType.EXPERIMENT, experiment, gatewayId);
             if (ServerSettings.isRabbitMqPublishEnabled()){
                 gatewayId = ServerSettings.getDefaultUserGateway();
                 ExperimentStatusChangeEvent event = new ExperimentStatusChangeEvent(ExperimentState.CREATED,
@@ -1309,7 +1357,7 @@ public class AiravataServerHandler implements Airavata.Iface {
             if (existingExperiment.getErrors() != null ){
                 existingExperiment.getErrors().clear();
             }
-            return (String)registry.add(ParentDataType.EXPERIMENT, existingExperiment);
+            return (String)registry.add(ParentDataType.EXPERIMENT, existingExperiment, null);
         } catch (Exception e) {
             logger.errorId(existingExperimentID, "Error while cloning the experiment with existing configuration...", e);
             AiravataSystemException exception = new AiravataSystemException();
@@ -1355,9 +1403,13 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public String registerApplicationModule(String gatewayId, ApplicationModule applicationModule) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             appCatalog = AppCatalogFactory.getAppCatalog();
-            return appCatalog.getApplicationInterface().addApplicationModule(applicationModule);
+            return appCatalog.getApplicationInterface().addApplicationModule(applicationModule, gatewayId);
         } catch (AppCatalogException e) {
             logger.error("Error while adding application module...", e);
             AiravataSystemException exception = new AiravataSystemException();
@@ -1413,9 +1465,13 @@ public class AiravataServerHandler implements Airavata.Iface {
 
     @Override
     public List<ApplicationModule> getAllAppModules(String gatewayId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             appCatalog = AppCatalogFactory.getAppCatalog();
-            return appCatalog.getApplicationInterface().getAllApplicationModules();
+            return appCatalog.getApplicationInterface().getAllApplicationModules(gatewayId);
         } catch (AppCatalogException e) {
             logger.error("Error while retrieving all application modules...", e);
             AiravataSystemException exception = new AiravataSystemException();
@@ -1454,9 +1510,13 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public String registerApplicationDeployment(String gatewayId, ApplicationDeploymentDescription applicationDeployment) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             appCatalog = AppCatalogFactory.getAppCatalog();
-            return appCatalog.getApplicationDeployment().addApplicationDeployment(applicationDeployment);
+            return appCatalog.getApplicationDeployment().addApplicationDeployment(applicationDeployment, gatewayId);
         } catch (AppCatalogException e) {
             logger.error("Error while adding application deployment...", e);
             AiravataSystemException exception = new AiravataSystemException();
@@ -1540,9 +1600,13 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public List<ApplicationDeploymentDescription> getAllApplicationDeployments(String gatewayId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             appCatalog = AppCatalogFactory.getAppCatalog();
-            return appCatalog.getApplicationDeployment().getAllApplicationDeployements();
+            return appCatalog.getApplicationDeployment().getAllApplicationDeployements(gatewayId);
         } catch (AppCatalogException e) {
             logger.error("Error while retrieving application deployments...", e);
             AiravataSystemException exception = new AiravataSystemException();
@@ -1588,9 +1652,13 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public String registerApplicationInterface(String gatewayId, ApplicationInterfaceDescription applicationInterface) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             appCatalog = AppCatalogFactory.getAppCatalog();
-            return appCatalog.getApplicationInterface().addApplicationInterface(applicationInterface);
+            return appCatalog.getApplicationInterface().addApplicationInterface(applicationInterface, gatewayId);
         } catch (AppCatalogException e) {
             logger.error("Error while adding application interface...", e);
             AiravataSystemException exception = new AiravataSystemException();
@@ -1673,9 +1741,13 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public Map<String, String> getAllApplicationInterfaceNames(String gatewayId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             appCatalog = AppCatalogFactory.getAppCatalog();
-            List<ApplicationInterfaceDescription> allApplicationInterfaces = appCatalog.getApplicationInterface().getAllApplicationInterfaces();
+            List<ApplicationInterfaceDescription> allApplicationInterfaces = appCatalog.getApplicationInterface().getAllApplicationInterfaces(gatewayId);
             Map<String, String> allApplicationInterfacesMap = new HashMap<String, String>();
             if (allApplicationInterfaces != null && !allApplicationInterfaces.isEmpty()){
                 for (ApplicationInterfaceDescription interfaceDescription : allApplicationInterfaces){
@@ -1700,9 +1772,13 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public List<ApplicationInterfaceDescription> getAllApplicationInterfaces(String gatewayId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
         try {
             appCatalog = AppCatalogFactory.getAppCatalog();
-            return appCatalog.getApplicationInterface().getAllApplicationInterfaces();
+            return appCatalog.getApplicationInterface().getAllApplicationInterfaces(gatewayId);
         } catch (AppCatalogException e) {
             logger.error("Error while retrieving application interfaces...", e);
             AiravataSystemException exception = new AiravataSystemException();
@@ -2612,7 +2688,7 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public GatewayResourceProfile getGatewayResourceProfile(String gatewayID) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
-    	try {
+        try {
             appCatalog = AppCatalogFactory.getAppCatalog();
             GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
             return gatewayProfile.getGatewayProfile(gatewayID);
@@ -2635,7 +2711,7 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public boolean updateGatewayResourceProfile(String gatewayID, GatewayResourceProfile gatewayResourceProfile) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
-    	try {
+        try {
             appCatalog = AppCatalogFactory.getAppCatalog();
             GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
             gatewayProfile.updateGatewayResourceProfile(gatewayID, gatewayResourceProfile);
@@ -2658,7 +2734,7 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     @Override
     public boolean deleteGatewayResourceProfile(String gatewayID) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
-    	try {
+        try {
             appCatalog = AppCatalogFactory.getAppCatalog();
             GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
             gatewayProfile.removeGatewayResourceProfile(gatewayID);
@@ -2843,8 +2919,13 @@ public class AiravataServerHandler implements Airavata.Iface {
     @Override
 	public List<String> getAllWorkflows(String gatewayId) throws InvalidRequestException,
 			AiravataClientException, AiravataSystemException, TException {
-		try {
-			return getWorkflowCatalog().getAllWorkflows();
+
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
+        try {
+			return getWorkflowCatalog().getAllWorkflows(gatewayId);
 		} catch (AppCatalogException e) {
 			String msg = "Error in retrieving all workflow template Ids.";
 			logger.error(msg, e);
@@ -2888,8 +2969,12 @@ public class AiravataServerHandler implements Airavata.Iface {
 	public String registerWorkflow(String gatewayId, Workflow workflow)
 			throws InvalidRequestException, AiravataClientException,
 			AiravataSystemException, TException {
-		try {
-			return getWorkflowCatalog().registerWorkflow(workflow);
+        if (!isGatewayExist(gatewayId)){
+            logger.error("Gateway does not exist.Please provide a valid gateway id...");
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
+        try {
+			return getWorkflowCatalog().registerWorkflow(workflow, gatewayId);
 		} catch (AppCatalogException e) {
 			String msg = "Error in registering the workflow "+workflow.getName()+".";
 			logger.error(msg, e);

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DataModelUtils.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DataModelUtils.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DataModelUtils.java
index 3bb02c2..5f4db49 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DataModelUtils.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/util/DataModelUtils.java
@@ -21,18 +21,18 @@
 
 package org.apache.airavata.api.server.util;
 
-import java.sql.SQLException;
-import java.util.List;
-
 import org.airavata.appcatalog.cpi.AppCatalogException;
 import org.airavata.appcatalog.cpi.ApplicationInterface;
 import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.model.util.ExecutionType;
 import org.apache.airavata.model.workspace.experiment.Experiment;
 import org.apache.airavata.workflow.catalog.WorkflowCatalogFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.List;
+
 public class DataModelUtils {
     private static final Logger logger = LoggerFactory.getLogger(DataModelUtils.class);
 	public static ExecutionType getExecutionType(Experiment experiment) throws Exception{
@@ -43,7 +43,7 @@ public class DataModelUtils {
 			if (allApplicationInterfaceIds.contains(applicationId)){
 				return ExecutionType.SINGLE_APP;
 			} else {
-				List<String> allWorkflows = WorkflowCatalogFactory.getWorkflowCatalog().getAllWorkflows();
+				List<String> allWorkflows = WorkflowCatalogFactory.getWorkflowCatalog().getAllWorkflows(ServerSettings.getDefaultUserGateway());
 				if (allWorkflows.contains(applicationId)){
 					return ExecutionType.WORKFLOW;
 				}

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index 01f017a..eb1b833 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@ -54,13 +54,13 @@ public class CreateLaunchExperiment {
 	
     private final static Logger logger = LoggerFactory.getLogger(CreateLaunchExperiment.class);
     private static final String DEFAULT_USER = "default.registry.user";
-    private static final String DEFAULT_GATEWAY = "default.registry.gateway";
+    private static final String DEFAULT_GATEWAY = "php_reference_gateway";
     private static Airavata.Client airavataClient;
 
     private static String echoAppId = "Echo_f828a575-7f17-4149-9d45-abe2aa9c6109";
     private static String mpiAppId = "HelloMPI_720e159f-198f-4daa-96ca-9f5eafee92c9";
     private static String wrfAppId = "WRF_7ad5da38-c08b-417c-a9ea-da9298839762";
-    private static String amberAppId = "Amber_98ac2eec-b253-4c43-81dc-54d845f64337";
+    private static String amberAppId = "Amber_6321b79f-3891-4421-b6c0-e294043a302e";
     private static String gromacsAppId = "GROMACS_05622038-9edd-4cb1-824e-0b7cb993364b";
     private static String espressoAppId = "ESPRESSO_10cc2820-5d0b-4c63-9546-8a8b595593c1";
     private static String lammpsAppId = "LAMMPS_10893eb5-3840-438c-8446-d26c7ecb001f";

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationDeployment.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationDeployment.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationDeployment.java
index 2ea7963..b3dfcba 100644
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationDeployment.java
+++ b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationDeployment.java
@@ -30,7 +30,7 @@ public interface ApplicationDeployment {
      * @param deploymentDescription application deployment
      * @return unique id for application deployment
      */
-    String addApplicationDeployment (ApplicationDeploymentDescription deploymentDescription) throws AppCatalogException;
+    String addApplicationDeployment (ApplicationDeploymentDescription deploymentDescription, String gatewayId) throws AppCatalogException;
 
     /**
      * This method will update application deployment
@@ -53,7 +53,7 @@ public interface ApplicationDeployment {
      */
     List<ApplicationDeploymentDescription> getApplicationDeployements (Map<String, String> filters) throws AppCatalogException;
 
-    List<ApplicationDeploymentDescription> getAllApplicationDeployements () throws AppCatalogException;
+    List<ApplicationDeploymentDescription> getAllApplicationDeployements (String gatewayId) throws AppCatalogException;
 
     List<String> getAllApplicationDeployementIds () throws AppCatalogException;
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationInterface.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationInterface.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationInterface.java
index 76e99a3..6b5a42d 100644
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationInterface.java
+++ b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/ApplicationInterface.java
@@ -33,14 +33,14 @@ public interface ApplicationInterface {
      * @param applicationModule application module
      * @return unique module id
      */
-    String addApplicationModule (ApplicationModule applicationModule) throws AppCatalogException;
+    String addApplicationModule (ApplicationModule applicationModule, String gatewayId) throws AppCatalogException;
 
     /**
      * This method will add application interface description
      * @param applicationInterfaceDescription application interface
      * @return unique app interface id
      */
-    String addApplicationInterface(ApplicationInterfaceDescription applicationInterfaceDescription) throws AppCatalogException;
+    String addApplicationInterface(ApplicationInterfaceDescription applicationInterfaceDescription, String gatewayId) throws AppCatalogException;
 
     /**
      * This method will add an application module mapping
@@ -86,7 +86,7 @@ public interface ApplicationInterface {
      */
     List<ApplicationModule> getApplicationModules(Map<String, String> filters) throws AppCatalogException;
 
-    List<ApplicationModule> getAllApplicationModules() throws AppCatalogException;
+    List<ApplicationModule> getAllApplicationModules(String gatewayId) throws AppCatalogException;
 
     /**
      * This method will return a list of application interfaces according to given search criteria
@@ -99,7 +99,7 @@ public interface ApplicationInterface {
      * This method will return all the application interfaces
      * @return list of all the application interfaces
      */
-    List<ApplicationInterfaceDescription> getAllApplicationInterfaces() throws AppCatalogException;
+    List<ApplicationInterfaceDescription> getAllApplicationInterfaces(String gatewayId) throws AppCatalogException;
 
     List<String> getAllApplicationInterfaceIds() throws AppCatalogException;
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/WorkflowCatalog.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/WorkflowCatalog.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/WorkflowCatalog.java
index b3be2f8..538dc01 100644
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/WorkflowCatalog.java
+++ b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/WorkflowCatalog.java
@@ -25,13 +25,13 @@ import java.util.List;
 
 public interface WorkflowCatalog {
 
-    public List<String> getAllWorkflows() throws AppCatalogException;
+    public List<String> getAllWorkflows(String gatewayId) throws AppCatalogException;
 
     public org.apache.airavata.model.Workflow getWorkflow(String workflowTemplateId) throws AppCatalogException;
 
     public void deleteWorkflow(String workflowTemplateId) throws AppCatalogException;
 
-    public String registerWorkflow(org.apache.airavata.model.Workflow workflow) throws AppCatalogException;
+    public String registerWorkflow(org.apache.airavata.model.Workflow workflow, String gatewayId) throws AppCatalogException;
 
     public void updateWorkflow(String workflowTemplateId, org.apache.airavata.model.Workflow workflow) throws AppCatalogException;
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
index 5b90ca6..a383a05 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
@@ -41,7 +41,7 @@ public class ApplicationDeploymentImpl implements ApplicationDeployment {
     private final static Logger logger = LoggerFactory.getLogger(ApplicationDeploymentImpl.class);
 
     @Override
-    public String addApplicationDeployment(ApplicationDeploymentDescription deploymentDescription) throws AppCatalogException {
+    public String addApplicationDeployment(ApplicationDeploymentDescription deploymentDescription, String gatewayId) throws AppCatalogException {
         try {
             AppDeploymentResource deploymentResource = new AppDeploymentResource();
             ComputeResourceResource computeHostResource = new ComputeResourceResource();
@@ -360,7 +360,7 @@ public class ApplicationDeploymentImpl implements ApplicationDeployment {
     }
 
     @Override
-    public List<ApplicationDeploymentDescription> getAllApplicationDeployements() throws AppCatalogException {
+    public List<ApplicationDeploymentDescription> getAllApplicationDeployements(String gatewayId) throws AppCatalogException {
         List<ApplicationDeploymentDescription> deploymentDescriptions = new ArrayList<ApplicationDeploymentDescription>();
         try {
             AppDeploymentResource resource = new AppDeploymentResource();

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java
index 889aeb6..85b8b60 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java
@@ -43,7 +43,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface {
     private final static Logger logger = LoggerFactory.getLogger(ApplicationInterfaceImpl.class);
 
     @Override
-    public String addApplicationModule(ApplicationModule applicationModule) throws AppCatalogException {
+    public String addApplicationModule(ApplicationModule applicationModule, String gatewayId) throws AppCatalogException {
         try {
             AppModuleResource moduleResource = new AppModuleResource();
             moduleResource.setModuleName(applicationModule.getAppModuleName());
@@ -64,7 +64,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface {
     }
 
     @Override
-    public String addApplicationInterface(ApplicationInterfaceDescription applicationInterfaceDescription) throws AppCatalogException {
+    public String addApplicationInterface(ApplicationInterfaceDescription applicationInterfaceDescription, String gatewayId) throws AppCatalogException {
         try {
             AppInterfaceResource resource = new AppInterfaceResource();
             resource.setAppName(applicationInterfaceDescription.getApplicationName());
@@ -315,7 +315,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface {
     }
 
     @Override
-    public List<ApplicationModule> getAllApplicationModules() throws AppCatalogException {
+    public List<ApplicationModule> getAllApplicationModules(String gatewayId) throws AppCatalogException {
         List<ApplicationModule> applicationModules = new ArrayList<ApplicationModule>();
         try {
             AppModuleResource resource = new AppModuleResource();
@@ -352,7 +352,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface {
     }
 
     @Override
-    public List<ApplicationInterfaceDescription> getAllApplicationInterfaces() throws AppCatalogException {
+    public List<ApplicationInterfaceDescription> getAllApplicationInterfaces(String gatewayId) throws AppCatalogException {
         try {
             AppInterfaceResource resource = new AppInterfaceResource();
             List<Resource> resources = resource.getAll();

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/WorkflowCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/WorkflowCatalogImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/WorkflowCatalogImpl.java
index a57ac49..f51b051 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/WorkflowCatalogImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/WorkflowCatalogImpl.java
@@ -41,7 +41,7 @@ public class WorkflowCatalogImpl implements WorkflowCatalog {
     private final static Logger logger = LoggerFactory.getLogger(WorkflowCatalogImpl.class);
 
     @Override
-    public List<String> getAllWorkflows() throws AppCatalogException {
+    public List<String> getAllWorkflows(String gatewayId) throws AppCatalogException {
         List<String> workflowIds = new ArrayList<String>();
         try {
             WorkflowResource resource = new WorkflowResource();
@@ -77,7 +77,7 @@ public class WorkflowCatalogImpl implements WorkflowCatalog {
     }
 
     @Override
-    public String registerWorkflow(Workflow workflow) throws AppCatalogException {
+    public String registerWorkflow(Workflow workflow, String gatewayId) throws AppCatalogException {
         try {
             WorkflowResource resource = new WorkflowResource();
             resource.setWfTemplateId(AppCatalogUtils.getID(workflow.getName()));

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
index 1d45007..0040770 100644
--- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
+++ b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppDeploymentTest.java
@@ -22,14 +22,11 @@
 package org.apache.airavata.app.catalog.test;
 
 import org.airavata.appcatalog.cpi.*;
-import org.airavata.appcatalog.cpi.ApplicationDeployment;
-import org.airavata.appcatalog.cpi.ApplicationInterface;
-import org.airavata.appcatalog.cpi.ComputeResource;
 import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
-import org.apache.aiaravata.application.catalog.data.model.*;
 import org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
 import org.apache.airavata.app.catalog.test.util.Initialize;
 import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
 import org.apache.airavata.model.appcatalog.appdeployment.SetEnvPaths;
@@ -83,7 +80,7 @@ public class AppDeploymentTest {
         ApplicationModule module = new ApplicationModule();
         module.setAppModuleName("WRF");
         module.setAppModuleVersion("1.0.0");
-        String wrfModuleId = appInt.addApplicationModule(module);
+        String wrfModuleId = appInt.addApplicationModule(module, ServerSettings.getDefaultUserGateway());
 
         ApplicationDeploymentDescription description = new ApplicationDeploymentDescription();
         description.setAppModuleId(wrfModuleId);
@@ -106,7 +103,7 @@ public class AppDeploymentTest {
         appEvns.add(createSetEnvPath("name6", "val6"));
         description.setSetEnvironment(appEvns);
 
-        String appDepId = appDep.addApplicationDeployment(description);
+        String appDepId = appDep.addApplicationDeployment(description, ServerSettings.getDefaultUserGateway());
         ApplicationDeploymentDescription app = null;
         if (appDep.isAppDeploymentExists(appDepId)){
             app = appDep.getApplicationDeployement(appDepId);
@@ -134,7 +131,7 @@ public class AppDeploymentTest {
         List<String> allApplicationDeployementIds = appDep.getAllApplicationDeployementIds();
         System.out.println("******** Size of all App deployments ids *********** : " + allApplicationDeployementIds.size());
 
-        List<ApplicationDeploymentDescription> allApplicationDeployements = appDep.getAllApplicationDeployements();
+        List<ApplicationDeploymentDescription> allApplicationDeployements = appDep.getAllApplicationDeployements(ServerSettings.getDefaultUserGateway());
         System.out.println("******** Size of all App deployments *********** : " + allApplicationDeployements.size());
 
         assertTrue("App interface saved successfully", app != null);

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java
index e85732c..6ac4d81 100644
--- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java
+++ b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/AppInterfaceTest.java
@@ -27,7 +27,9 @@ import org.airavata.appcatalog.cpi.ApplicationInterface;
 import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
 import org.apache.aiaravata.application.catalog.data.resources.AbstractResource;
 import org.apache.airavata.app.catalog.test.util.Initialize;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
 import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
 import org.apache.airavata.model.appcatalog.appinterface.DataType;
@@ -96,7 +98,7 @@ public class AppInterfaceTest {
             description.setApplicationModules(modules);
             description.setApplicationInputs(inputs);
             description.setApplicationOutputs(outputs);
-            String appID = appInterface.addApplicationInterface(description);
+            String appID = appInterface.addApplicationInterface(description, ServerSettings.getDefaultUserGateway());
             System.out.println("********** application id ************* : " + appID);
             ApplicationInterfaceDescription ainterface = null;
             if (appInterface.isApplicationInterfaceExists(appID)){
@@ -141,7 +143,7 @@ public class AppInterfaceTest {
             List<ApplicationInterfaceDescription> apps = appInterface.getApplicationInterfaces(filters);
             System.out.println("********** Size og app interfaces ************* : " + apps.size());
 
-            List<ApplicationInterfaceDescription> appInts = appInterface.getAllApplicationInterfaces();
+            List<ApplicationInterfaceDescription> appInts = appInterface.getAllApplicationInterfaces(ServerSettings.getDefaultUserGateway());
             System.out.println("********** Size of all app interfaces ************* : " + appInts.size());
 
             List<String> appIntIds = appInterface.getAllApplicationInterfaceIds();
@@ -150,6 +152,8 @@ public class AppInterfaceTest {
             assertTrue("App interface saved successfully", ainterface != null);
         }catch (AppCatalogException e) {
             e.printStackTrace();
+        } catch (ApplicationSettingsException e) {
+            e.printStackTrace();
         }
 
     }
@@ -160,9 +164,11 @@ public class AppInterfaceTest {
             module.setAppModuleName(moduleName);
             module.setAppModuleVersion("1.0.0");
             module.setAppModuleDescription("WeatherForcast");
-            return appcatalog.getApplicationInterface().addApplicationModule(module);
+            return appcatalog.getApplicationInterface().addApplicationModule(module, ServerSettings.getDefaultUserGateway());
         } catch (AppCatalogException e) {
             logger.error(e.getMessage(), e);
+        } catch (ApplicationSettingsException e) {
+            e.printStackTrace();
         }
         return null;
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/integration-tests/src/test/java/org/apache/airavata/integration/SimpleEchoIT.java
----------------------------------------------------------------------
diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/SimpleEchoIT.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/SimpleEchoIT.java
index 0b94c43..20713f9 100644
--- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/SimpleEchoIT.java
+++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/SimpleEchoIT.java
@@ -21,6 +21,7 @@
 
 package org.apache.airavata.integration;
 
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.integration.tools.DocumentCreatorNew;
 import org.apache.airavata.model.appcatalog.appinterface.DataType;
 import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
@@ -77,8 +78,7 @@ public class SimpleEchoIT extends SingleAppIntegrationTestBase {
         exOut.add(output);
 
         Project project = ProjectModelUtil.createProject("project1", "admin", "test project");
-        String projectId = getClient().createProject("default", project);
-
+        String projectId = getClient().createProject("php_reference_gateway", project);
         Experiment simpleExperiment =
                 ExperimentModelUtil.createSimpleExperiment(projectId, "admin", "echoExperiment", appId, appId, exInputs);
         simpleExperiment.setExperimentOutputs(exOut);

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/integration-tests/src/test/java/org/apache/airavata/integration/SingleAppIntegrationTestBase.java
----------------------------------------------------------------------
diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/SingleAppIntegrationTestBase.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/SingleAppIntegrationTestBase.java
index a2f0b91..86786aa 100644
--- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/SingleAppIntegrationTestBase.java
+++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/SingleAppIntegrationTestBase.java
@@ -22,6 +22,8 @@ package org.apache.airavata.integration;
 
 import java.util.Date;
 
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.model.error.AiravataSystemException;
 import org.apache.airavata.model.error.ExperimentNotFoundException;
 import org.apache.airavata.model.error.InvalidRequestException;
@@ -36,8 +38,8 @@ import org.junit.Assert;
  */
 public class SingleAppIntegrationTestBase extends AbstractIntegrationTest {
 
-    protected String createExperiment(Experiment experiment) throws AiravataSystemException, InvalidRequestException, TException {
-        return getClient().createExperiment("default", experiment);
+    protected String createExperiment(Experiment experiment) throws AiravataSystemException, InvalidRequestException, TException, ApplicationSettingsException {
+        return getClient().createExperiment("php_reference_gateway", experiment);
     }
 
     protected void launchExperiment(String expId) throws ExperimentNotFoundException, AiravataSystemException, InvalidRequestException, TException {

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java
----------------------------------------------------------------------
diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java
index 281fc90..273efce 100644
--- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java
+++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java
@@ -50,7 +50,7 @@ import java.util.*;
 
 public class DocumentCreatorNew {
 
-    private static final String DEFAULT_GATEWAY = "default.registry.gateway";
+    private static final String DEFAULT_GATEWAY = "php_reference_gateway";
     private AppCatalog appcatalog = null;
     private String trestleshpcHostAddress = "trestles.sdsc.edu";
     private String lonestarHostAddress = "lonestar.tacc.utexas.edu";
@@ -133,7 +133,7 @@ public class DocumentCreatorNew {
         if (gatewayResourceProfile == null) {
             gatewayResourceProfile = new GatewayResourceProfile();
 //				gatewayResourceProfile.setGatewayID("default");
-            gatewayResourceProfile.setGatewayID("default");
+            gatewayResourceProfile.setGatewayID("php_reference_gateway");
             gatewayResourceProfile.setGatewayID(client.registerGatewayResourceProfile(gatewayResourceProfile));
         }
 //    	}
@@ -163,7 +163,6 @@ public class DocumentCreatorNew {
 
         ApplicationModule module = DocumentCreatorUtils.createApplicationModule("echo", "1.1", null);
         module.setAppModuleId(client.registerApplicationModule(DEFAULT_GATEWAY, module));
-        ;
 
         ApplicationDeploymentDescription deployment = DocumentCreatorUtils.createApplicationDeployment(host.getComputeResourceId(), module.getAppModuleId(), "/bin/echo", ApplicationParallelismType.SERIAL, "SSHEchoApplication");
         client.registerApplicationDeployment(DEFAULT_GATEWAY, deployment);

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/messaging/client/src/main/java/org/apache/airavata/messaging/client/TestReader.java
----------------------------------------------------------------------
diff --git a/modules/messaging/client/src/main/java/org/apache/airavata/messaging/client/TestReader.java b/modules/messaging/client/src/main/java/org/apache/airavata/messaging/client/TestReader.java
index eec87c8..cf4e7f4 100644
--- a/modules/messaging/client/src/main/java/org/apache/airavata/messaging/client/TestReader.java
+++ b/modules/messaging/client/src/main/java/org/apache/airavata/messaging/client/TestReader.java
@@ -5,9 +5,6 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Stream;
 
-/**
- * Created by chathuri on 2/20/15.
- */
 public class TestReader {
     public static void main(String[] args) throws IOException {
         String fileName = "/Users/chathuri/dev/airavata/docs/messaging_framework/gw111/results_350";

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
index f2ccbff..3243eb8 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/util/DataModelUtils.java
@@ -26,6 +26,8 @@ import java.util.List;
 import org.airavata.appcatalog.cpi.AppCatalogException;
 import org.airavata.appcatalog.cpi.ApplicationInterface;
 import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.model.util.ExecutionType;
 import org.apache.airavata.model.workspace.experiment.Experiment;
 import org.apache.airavata.workflow.catalog.WorkflowCatalogFactory;
@@ -43,14 +45,16 @@ public class DataModelUtils {
 			if (allApplicationInterfaceIds.contains(applicationId)){
 				return ExecutionType.SINGLE_APP;
 			} else {
-				List<String> allWorkflows = WorkflowCatalogFactory.getWorkflowCatalog().getAllWorkflows();
+				List<String> allWorkflows = WorkflowCatalogFactory.getWorkflowCatalog().getAllWorkflows(ServerSettings.getDefaultUserGateway());
 				if (allWorkflows.contains(applicationId)){
 					return ExecutionType.WORKFLOW;
 				}
 			}
 		} catch (AppCatalogException e) {
 			logger.error(e.getMessage(), e);
-		}
-		return ExecutionType.UNKNOWN;
+		} catch (ApplicationSettingsException e) {
+            logger.error(e.getMessage(), e);
+        }
+        return ExecutionType.UNKNOWN;
 	}
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
index 7575d6c..d2d99a0 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java
@@ -56,7 +56,7 @@ public class ExperimentRegistry {
 
     }
 
-    public String addExperiment(Experiment experiment) throws RegistryException {
+    public String addExperiment(Experiment experiment, String gatewayId) throws RegistryException {
         String experimentID;
         try {
             if (!ResourceUtils.isUserExist(experiment.getUserName())) {
@@ -68,7 +68,8 @@ public class ExperimentRegistry {
             experimentResource.setExpID(experimentID);
             experimentResource.setExpName(experiment.getName());
             experimentResource.setExecutionUser(experiment.getUserName());
-            experimentResource.setGateway(gatewayResource);
+            GatewayResource gateway = (GatewayResource)ResourceUtils.getGateway(gatewayId);
+            experimentResource.setGateway(gateway);
             experimentResource.setEnableEmailNotifications(experiment.isEnableEmailNotification());
             if (!workerResource.isProjectExists(experiment.getProjectID())) {
                 logger.error("Project does not exist in the system..");

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/LoggingRegistryImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/LoggingRegistryImpl.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/LoggingRegistryImpl.java
index 1420faa..a288884 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/LoggingRegistryImpl.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/LoggingRegistryImpl.java
@@ -30,47 +30,58 @@ import java.util.Map;
 public class LoggingRegistryImpl implements Registry {
     private final static Logger logger = LoggerFactory.getLogger(LoggingRegistryImpl.class);
 
-    public Object add(ChildDataType dataType, Object newObjectToAdd, Object dependentIdentifiers) throws RegistryException {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    @Override
+    public Object add(ParentDataType dataType, Object newObjectToAdd, String gatewayId) throws RegistryException {
+        return null;
     }
 
-    public Object add(ParentDataType dataType, Object newObjectToAdd) throws RegistryException {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    @Override
+    public Object add(ChildDataType dataType, Object newObjectToAdd, Object dependentIdentifiers) throws RegistryException {
+        return null;
     }
 
+    @Override
     public void update(RegistryModelType dataType, Object newObjectToUpdate, Object identifier) throws RegistryException {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
+    @Override
     public void update(RegistryModelType dataType, Object identifier, String fieldName, Object value) throws RegistryException {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
+    @Override
     public Object get(RegistryModelType dataType, Object identifier) throws RegistryException {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
+    @Override
     public List<Object> get(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
+    @Override
     public List<Object> search(RegistryModelType dataType, Map<String, String> filters) throws RegistryException {
         return null;
     }
 
+    @Override
     public Object getValue(RegistryModelType dataType, Object identifier, String field) throws RegistryException {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
+    @Override
     public List<String> getIds(RegistryModelType dataType, String fieldName, Object value) throws RegistryException {
-        return null;  //To change body of implemented methods use File | Settings | File Templates.
+        return null;
     }
 
+    @Override
     public void remove(RegistryModelType dataType, Object identifier) throws RegistryException {
-        //To change body of implemented methods use File | Settings | File Templates.
+
     }
 
+    @Override
     public boolean isExist(RegistryModelType dataType, Object identifier) throws RegistryException {
-        return false;  //To change body of implemented methods use File | Settings | File Templates.
+        return false;
     }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java
index 6765d9c..21980b2 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ProjectRegistry.java
@@ -25,6 +25,7 @@ import java.util.*;
 
 import org.apache.airavata.common.utils.AiravataUtils;
 import org.apache.airavata.model.workspace.Project;
+import org.apache.airavata.persistance.registry.jpa.Resource;
 import org.apache.airavata.persistance.registry.jpa.ResourceType;
 import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
 import org.apache.airavata.persistance.registry.jpa.resources.*;
@@ -52,7 +53,7 @@ public class ProjectRegistry {
         }
     }
 
-    public String addProject (Project project) throws RegistryException{
+    public String addProject (Project project, String gatewayId) throws RegistryException{
         String projectId;
         try {
             if (!ResourceUtils.isUserExist(project.getOwner())){
@@ -65,7 +66,8 @@ public class ProjectRegistry {
             projectResource.setName(project.getName());
             projectResource.setDescription(project.getDescription());
             projectResource.setCreationTime(AiravataUtils.getTime(project.getCreationTime()));
-            projectResource.setGateway(workerResource.getGateway());
+            GatewayResource gateway = (GatewayResource)ResourceUtils.getGateway(gatewayId);
+            projectResource.setGateway(gateway);
             WorkerResource worker = new WorkerResource(project.getOwner(), workerResource.getGateway());
             projectResource.setWorker(worker);
             projectResource.save();
@@ -107,7 +109,7 @@ public class ProjectRegistry {
             existingProject.setDescription(project.getDescription());
             existingProject.setName(project.getName());
             existingProject.setCreationTime(AiravataUtils.getTime(project.getCreationTime()));
-            existingProject.setGateway(gatewayResource);
+//            existingProject.setGateway(gatewayResource);
             UserResource user = (UserResource)ResourceUtils.getUser(project.getOwner());
             if (!gatewayResource.isExists(ResourceType.GATEWAY_WORKER, user.getUserName())){
                 workerResource = ResourceUtils.addGatewayWorker(gatewayResource, user);

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java
index d09c0e9..d2af1cd 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java
@@ -100,13 +100,13 @@ public class RegistryImpl implements Registry {
      * @return return the identifier to identify the object
      */
     @Override
-    public Object add(ParentDataType dataType, Object newObjectToAdd) throws RegistryException {
+    public Object add(ParentDataType dataType, Object newObjectToAdd, String gatewayId) throws RegistryException {
         try {
             switch (dataType) {
                 case PROJECT:
-                    return projectRegistry.addProject((Project)newObjectToAdd);
+                    return projectRegistry.addProject((Project)newObjectToAdd, gatewayId);
                 case EXPERIMENT:
-                    return experimentRegistry.addExperiment((Experiment) newObjectToAdd);
+                    return experimentRegistry.addExperiment((Experiment) newObjectToAdd, gatewayId);
                 case GATEWAY:
                     return gatewayRegistry.addGateway((Gateway)newObjectToAdd);
                 default:

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java
index ae71149..6d0ad4f 100644
--- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java
+++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java
@@ -36,7 +36,7 @@ public interface Registry {
      *                       etc
      * @return return the identifier to identify the object
      */
-    public Object add(ParentDataType dataType, Object newObjectToAdd) throws RegistryException ;
+    public Object add(ParentDataType dataType, Object newObjectToAdd, String gatewayId) throws RegistryException ;
 
     /**
      * This method is to add an object in to the registry

http://git-wip-us.apache.org/repos/asf/airavata/blob/7c5f1c85/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowUtils.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowUtils.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowUtils.java
index fb2a6fa..e975c58 100644
--- a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowUtils.java
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/WorkflowUtils.java
@@ -26,6 +26,8 @@ import java.util.List;
 import org.airavata.appcatalog.cpi.AppCatalogException;
 import org.airavata.appcatalog.cpi.ApplicationInterface;
 import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.model.util.ExecutionType;
 import org.apache.airavata.model.workspace.experiment.Experiment;
 import org.apache.airavata.workflow.catalog.WorkflowCatalogFactory;
@@ -42,14 +44,16 @@ public class WorkflowUtils {
 			if (allApplicationInterfaceIds.contains(applicationId)){
 				return ExecutionType.SINGLE_APP;
 			} else {
-				List<String> allWorkflows = WorkflowCatalogFactory.getWorkflowCatalog().getAllWorkflows();
+				List<String> allWorkflows = WorkflowCatalogFactory.getWorkflowCatalog().getAllWorkflows(ServerSettings.getDefaultUserGateway());
 				if (allWorkflows.contains(applicationId)){
 					return ExecutionType.WORKFLOW;
 				}
 			}
 		} catch (AppCatalogException e) {
             logger.error(e.getMessage(), e);
-		}
-		return ExecutionType.UNKNOWN;
+		} catch (ApplicationSettingsException e) {
+            logger.error(e.getMessage(), e);
+        }
+        return ExecutionType.UNKNOWN;
 	}
 }


Mime
View raw message