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 2014/11/03 08:32:52 UTC
[37/50] [abbrv] git commit: adding service undeployment
adding service undeployment
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/828269f2
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/828269f2
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/828269f2
Branch: refs/heads/docker-grouping-merge
Commit: 828269f28a31a2a1a525988d2cdcc7a9f0a9fb4f
Parents: 0d726c8
Author: reka <rt...@gmail.com>
Authored: Fri Oct 31 18:13:42 2014 +0530
Committer: reka <rt...@gmail.com>
Committed: Fri Oct 31 18:13:42 2014 +0530
----------------------------------------------------------------------
.../autoscaler/api/AutoScalerServiceImpl.java | 11 ++++++++++-
.../autoscaler/registry/RegistryManager.java | 20 ++++++++++++++++++++
2 files changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/828269f2/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java
index d710bf7..8c4bf2e 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/api/AutoScalerServiceImpl.java
@@ -324,7 +324,7 @@ public class AutoScalerServiceImpl implements AutoScalerServiceInterface{
RegistryManager.getInstance().persistServiceGroup(servicegroup);
}
- public ServiceGroup getServiceGroup(String name){
+ public ServiceGroup getServiceGroup(String name) {
if(StringUtils.isEmpty(name)){
return null;
}
@@ -338,5 +338,14 @@ public class AutoScalerServiceImpl implements AutoScalerServiceInterface{
return false;
}
+ public void undeployServiceGroup(String name) throws AutoScalerException {
+ try {
+ RegistryManager.getInstance().removeServiceGroup(name);
+ } catch (Exception e) {
+ throw new AutoScalerException("Error occurred while removing the service groups", e);
+ }
+
+ }
+
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/828269f2/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
index ee8e411..0e1417e 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
@@ -368,6 +368,26 @@ public class RegistryManager {
return group;
}
+ public ServiceGroup removeServiceGroup(String name) throws Exception{
+ String resourcePath = AutoScalerConstants.AUTOSCALER_RESOURCE +
+ AutoScalerConstants.SERVICE_GROUP + "/" + name;
+ Object serializedObj = registryManager.retrieve(resourcePath);
+ ServiceGroup group = null;
+ if (serializedObj != null) {
+ Object dataObj = Deserializer.deserializeFromByteArray((byte[]) serializedObj);
+ if (dataObj instanceof ServiceGroup) {
+ group = (ServiceGroup) dataObj;
+ if(log.isDebugEnabled()) {
+ log.debug(group.toString());
+ }
+ } else {
+ return null;
+ }
+ }
+
+ return group;
+ }
+
public void removeAutoscalerPolicy(AutoscalePolicy autoscalePolicy) {
String resourcePath = AutoScalerConstants.AUTOSCALER_RESOURCE + AutoScalerConstants.AS_POLICY_RESOURCE + "/" + autoscalePolicy.getId();
this.delete(resourcePath);