You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2014/09/25 14:36:07 UTC
git commit: checking for duplicate app id before converting in rest EP
Repository: stratos
Updated Branches:
refs/heads/4.0.0-grouping 8eb6ea5a1 -> 478ed8df4
checking for duplicate app id before converting in rest EP
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/478ed8df
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/478ed8df
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/478ed8df
Branch: refs/heads/4.0.0-grouping
Commit: 478ed8df4197501ae9665a1008193665f1c031a0
Parents: 8eb6ea5
Author: Isuru Haththotuwa <is...@apache.org>
Authored: Thu Sep 25 18:05:47 2014 +0530
Committer: Isuru Haththotuwa <is...@apache.org>
Committed: Thu Sep 25 18:05:47 2014 +0530
----------------------------------------------------------------------
.../rest/endpoint/services/ServiceUtils.java | 29 +++++++++-----------
1 file changed, 13 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/478ed8df/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
index d5744a4..7ccd082 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
@@ -264,27 +264,24 @@ public class ServiceUtils {
// }
// check if an application with same id already exists
-
+ // check if application with same appId / tenant already exists
+ CartridgeSubscriptionManager subscriptionMgr = new CartridgeSubscriptionManager();
+ int tenantId = ApplicationManagementUtil.getTenantId(ctxt);
+ String appId = compositeAppDefinition.getApplicationId();
+
+ try {
+ if (subscriptionMgr.getApplicationSubscription(appId, tenantId) != null) {
+ String msg = "Duplicate application appId: " + appId + " for tenant " + tenantId;
+ throw new RestAPIException(msg);
+ }
+ } catch (ApplicationSubscriptionException e1) {
+ throw new RestAPIException(e1);
+ }
ApplicationContext applicationContext = PojoConverter.convertApplicationBeanToApplicationContext(compositeAppDefinition);
applicationContext.setTenantId(ApplicationManagementUtil.getTenantId(ctxt));
applicationContext.setTenantDomain(tenantDomain);
applicationContext.setTeantAdminUsername(userName);
-
- // check if application with same appId / tenant already exists
- CartridgeSubscriptionManager subscriptionMgr = new CartridgeSubscriptionManager();
- int tenantId = ApplicationManagementUtil.getTenantId(ctxt);
- String appId = applicationContext.getApplicationId();
-
-
- try {
- if (subscriptionMgr.getApplicationSubscription(appId, tenantId) != null) {
- String msg = "Duplicate application appId: " + appId + " for tenant " + tenantId;
- throw new RestAPIException(msg);
- }
- } catch (ApplicationSubscriptionException e1) {
- throw new RestAPIException(e1);
- }
try {
CloudControllerServiceClient.getServiceClient().deployApplicationDefinition(applicationContext);