Repository: stratos Updated Branches: refs/heads/master 7c35cc64b -> 38c05a5af
Revert "fix for STRATOS-851" This reverts commit 8cbf8a922ed4fcab8b72253097eced07eed65388. Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/38c05a5a Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/38c05a5a Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/38c05a5a Branch: refs/heads/master Commit: 38c05a5afbaeb36716a24f1e907a74a67e79f9ef Parents: 7c35cc6 Author: Udara Liyanage <[email protected]> Authored: Thu Oct 2 12:12:21 2014 +0530 Committer: Udara Liyanage <[email protected]> Committed: Thu Oct 2 12:12:21 2014 +0530 ---------------------------------------------------------------------- .../manager/CartridgeSubscriptionManager.java | 5 -- .../rest/endpoint/services/ServiceUtils.java | 74 ++------------------ 2 files changed, 7 insertions(+), 72 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/38c05a5a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java index 35311ba..539c983 100644 --- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java +++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java @@ -608,9 +608,4 @@ public class CartridgeSubscriptionManager { DataInsertionAndRetrievalManager dataInsertionAndRetrievalManager = new DataInsertionAndRetrievalManager(); return dataInsertionAndRetrievalManager.getCartridgeSubscriptions(tenantId, cartridgeType); } - - public Collection<CartridgeSubscription> getCartridgeSubscriptionsForType (String cartridgeType) { - - return new DataInsertionAndRetrievalManager().getCartridgeSubscriptions(cartridgeType); - } } http://git-wip-us.apache.org/repos/asf/stratos/blob/38c05a5a/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 7957979..a40286a 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 @@ -127,77 +127,17 @@ public class ServiceUtils { CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient(); if (cloudControllerServiceClient != null) { - - CartridgeInfo cartridgeInfo = null; try { - cartridgeInfo = cloudControllerServiceClient.getCartridgeInfo(cartridgeType); - + cloudControllerServiceClient.unDeployCartridgeDefinition(cartridgeType); } catch (RemoteException e) { - log.error("Error in getting Cartridge details for type " + cartridgeType); - throw new RestAPIException(e); - - } catch (CloudControllerServiceUnregisteredCartridgeExceptionException e) { - log.error("Error in getting Cartridge details for type " + cartridgeType); - throw new RestAPIException(e); - } - - if (cartridgeInfo == null) { - String errorMsg = "Cartridge information not found for type " + cartridgeType; - log.error(errorMsg); - throw new RestAPIException(errorMsg); - } - - // check if the service is multi tenant. - if (cartridgeInfo.getMultiTenant()) { - // check if there are any deployed MT services. If so, should not allow to undeploy - try { - Service service = serviceDeploymentManager.getService(cartridgeType); - if (service != null) { - // not allowed to undeploy! - String errorMsg = "Multi tenant Service already exists for " + cartridgeType + ", cannot undeploy"; - log.error(errorMsg); - throw new RestAPIException(errorMsg); - } else { - // can undeploy - undeployCartridgeDefinition(cloudControllerServiceClient, cartridgeType); - } - - } catch (ADCException e) { - log.error("Error in getting MT Service details for type " + cartridgeType); - throw new RestAPIException(e); - } - - } else { - // if not multi tenant, check if there are any existing Subscriptions - Collection<CartridgeSubscription> cartridgeSubscriptions = - cartridgeSubsciptionManager.getCartridgeSubscriptionsForType(cartridgeType); - if (cartridgeSubscriptions != null && !cartridgeSubscriptions.isEmpty()) { - // not allowed to undeploy! - String errorMsg = "Subscription exists for " + cartridgeType + ", cannot undeploy"; - log.error(errorMsg); - throw new RestAPIException(errorMsg); - } else { - // can undeploy - undeployCartridgeDefinition(cloudControllerServiceClient, cartridgeType); - } + log.error(e.getMessage(), e); + throw new RestAPIException(e.getMessage(), e); + } catch (CloudControllerServiceInvalidCartridgeTypeExceptionException e) { + String msg = e.getFaultMessage().getInvalidCartridgeTypeException().getMessage(); + log.error(msg, e); + throw new RestAPIException(msg, e); } - } - } - - private static void undeployCartridgeDefinition (CloudControllerServiceClient cloudControllerServiceClient, - String cartridgeType) throws RestAPIException { - try { - cloudControllerServiceClient.unDeployCartridgeDefinition(cartridgeType); - - } catch (RemoteException e) { - log.error(e.getMessage(), e); - throw new RestAPIException(e.getMessage(), e); - - } catch (CloudControllerServiceInvalidCartridgeTypeExceptionException e) { - String msg = e.getFaultMessage().getInvalidCartridgeTypeException().getMessage(); - log.error(msg, e); - throw new RestAPIException(msg, e); } }
