You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2017/04/05 19:10:47 UTC
[23/50] [abbrv] airavata git commit: Throw DuplicateEntryException in
addGateway(), when gateway exists.
Throw DuplicateEntryException in addGateway(), when gateway exists.
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2c16c71b
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2c16c71b
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2c16c71b
Branch: refs/heads/develop
Commit: 2c16c71b7b9fbda59a06fb48dad48162a21dfd52
Parents: 33388b4
Author: Gourav Shenoy <sh...@gmail.com>
Authored: Tue Apr 4 15:21:28 2017 -0400
Committer: Gourav Shenoy <sh...@gmail.com>
Committed: Tue Apr 4 15:21:28 2017 -0400
----------------------------------------------------------------------
.../api/service/handler/RegistryServerHandler.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/2c16c71b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
index d55626c..26b21b4 100644
--- a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
+++ b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
@@ -3543,7 +3543,19 @@ public class RegistryServerHandler implements RegistryService.Iface {
logger.error("Gateway id cannot be empty...");
throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
}
+ // check if gateway exists
+ if (isGatewayExist(gateway.getGatewayId())) {
+ throw new DuplicateEntryException("Gateway with gatewayId: " + gateway.getGatewayId() + ", already exists in ExperimentCatalog.");
+ }
+ // check if gatewayresourceprofile exists
+ if (appCatalog.getGatewayProfile().isGatewayResourceProfileExists(gateway.getGatewayId())) {
+ throw new DuplicateEntryException("GatewayResourceProfile with gatewayId: " + gateway.getGatewayId() + ", already exists in AppCatalog.");
+ }
+
+ // add gateway in experimentCatalog
String gatewayId = (String) experimentCatalog.add(ExpCatParentDataType.GATEWAY, gateway, gateway.getGatewayId());
+
+ // add gatewayresourceprofile in appCatalog
GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
gatewayResourceProfile.setGatewayID(gatewayId);
appCatalog.getGatewayProfile().addGatewayResourceProfile(gatewayResourceProfile);