Repository: stratos Updated Branches: refs/heads/master 059b2da3e -> 7a46e4af7
Added method to remove Application SignUps and used it when undeploying the application Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/4ae51e3e Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/4ae51e3e Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/4ae51e3e Branch: refs/heads/master Commit: 4ae51e3e8f3ce8a2d034e5f5d339aeda0e3655e2 Parents: d7e0b4e Author: Vishanth <[email protected]> Authored: Thu Jan 29 12:13:58 2015 +0530 Committer: Vishanth <[email protected]> Committed: Thu Jan 29 12:13:58 2015 +0530 ---------------------------------------------------------------------- .../services/impl/AutoscalerServiceImpl.java | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/4ae51e3e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java index 1ce9072..84d0d6a 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoscalerServiceImpl.java @@ -337,6 +337,28 @@ public class AutoscalerServiceImpl implements AutoscalerService { } } + private void removeApplicationSignUp(ApplicationContext applicationContext){ + try { + if (log.isInfoEnabled()) { + log.info(String.format("Removing application signup: [application-id] %s", + applicationContext.getApplicationId())); + } + + StratosManagerServiceClient serviceClient = StratosManagerServiceClient.getInstance(); + + ApplicationSignUp applicationSignUp[] = serviceClient.getApplicationSignUps(applicationContext.getApplicationId()); + for(ApplicationSignUp appSignUp : applicationSignUp) + { + serviceClient.removeApplicationSignUp(appSignUp.getApplicationId(), appSignUp.getTenantId()); + } + + }catch(Exception e){ + String message = "Could not remove application signup(s)"; + log.error(message, e); + throw new RuntimeException(message, e); + } + } + /** * Encrypt artifact repository passwords. * @param applicationSignUp @@ -429,6 +451,9 @@ public class AutoscalerServiceImpl implements AutoscalerService { throw new RuntimeException(message); } + // Remove Application SignUp(s) in stratos manager + removeApplicationSignUp(application); + ApplicationBuilder.handleApplicationUndeployed(applicationId); ApplicationContext applicationContext = AutoscalerContext.getInstance().getApplicationContext(applicationId);
