You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/05/18 15:03:48 UTC
[2/2] stratos git commit: Fixed deactivating non-exist tenant in cli
Fixed deactivating non-exist tenant in cli
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/0fc12f88
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/0fc12f88
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/0fc12f88
Branch: refs/heads/master
Commit: 0fc12f8813395f37204a0dfe26113dcdc431d7b5
Parents: 5baf9bc
Author: Pubudu Gunatilaka <pu...@gmail.com>
Authored: Mon May 18 13:45:15 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Mon May 18 18:32:24 2015 +0530
----------------------------------------------------------------------
.../rest/endpoint/api/StratosApiV41Utils.java | 36 +++++++++++---------
1 file changed, 20 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/0fc12f88/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
index ce5b591..fc88963 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
@@ -3171,7 +3171,27 @@ public class StratosApiV41Utils {
int tenantId;
try {
tenantId = tenantManager.getTenantId(tenantDomain);
+ if (tenantId != -1) {
+ try {
+ TenantMgtUtil.deactivateTenant(tenantDomain, tenantManager, tenantId);
+ } catch (Exception e) {
+ String msg = "Error in deactivating Tenant :" + tenantDomain;
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
+ }
+ //Notify tenant deactivation all listeners
+ try {
+ TenantMgtUtil.triggerTenantDeactivation(tenantId);
+ } catch (StratosException e) {
+ String msg = "Error in notifying tenant deactivate.";
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
+ }
+ } else {
+ String msg = "The tenant with domain name: " + tenantDomain + " does not exist.";
+ throw new RestAPIException(msg);
+ }
} catch (UserStoreException e) {
String msg = "Error in retrieving the tenant id for the tenant domain: " +
tenantDomain + ".";
@@ -3180,22 +3200,6 @@ public class StratosApiV41Utils {
}
- try {
- TenantMgtUtil.deactivateTenant(tenantDomain, tenantManager, tenantId);
- } catch (Exception e) {
- String msg = "Error in deactivating Tenant :" + tenantDomain;
- log.error(msg, e);
- throw new RestAPIException(msg, e);
- }
-
- //Notify tenant deactivation all listeners
- try {
- TenantMgtUtil.triggerTenantDeactivation(tenantId);
- } catch (StratosException e) {
- String msg = "Error in notifying tenant deactivate.";
- log.error(msg, e);
- throw new RestAPIException(msg, e);
- }
}