You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ma...@apache.org on 2014/11/03 12:22:33 UTC
git commit: Add deploy-application, undeploy-application,
deploy-service-group and undeploy-service-group commands to CLI
Repository: stratos
Updated Branches:
refs/heads/docker-grouping-merge 8d1b5ff21 -> 8159b5cc3
Add deploy-application, undeploy-application, deploy-service-group and undeploy-service-group commands to CLI
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/8159b5cc
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/8159b5cc
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/8159b5cc
Branch: refs/heads/docker-grouping-merge
Commit: 8159b5cc38bcf7779aa3881ed7c92833dade8c21
Parents: 8d1b5ff
Author: Manula Thantriwatte <ma...@apache.org>
Authored: Mon Nov 3 11:21:12 2014 +0000
Committer: Manula Thantriwatte <ma...@apache.org>
Committed: Mon Nov 3 11:21:12 2014 +0000
----------------------------------------------------------------------
.../java/org/apache/stratos/cli/RestClient.java | 1 +
.../stratos/cli/RestCommandLineService.java | 24 ++++
.../apache/stratos/cli/StratosApplication.java | 12 ++
.../cli/commands/DeployApplicationCommand.java | 111 +++++++++++++++++++
.../commands/DeployKubernetesGroupCommand.java | 1 +
.../commands/DeployKubernetesHostCommand.java | 1 +
.../cli/commands/DeployServiceGroupCommand.java | 111 +++++++++++++++++++
.../commands/UndeployApplicationCommand.java | 76 +++++++++++++
.../commands/UndeployServiceGroupCommand.java | 76 +++++++++++++
9 files changed, 413 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/8159b5cc/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java
index a2560eb..0c549eb 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestClient.java
@@ -290,6 +290,7 @@ public class RestClient implements GenericRestClient {
private int executeDelete(String serviceEndpoint, String identifier) throws IOException {
DefaultHttpClient httpClient = new DefaultHttpClient();
try {
+ System.out.println(getBaseURL() + serviceEndpoint.replace("{id}", identifier));
HttpResponse response = doDelete(httpClient, getBaseURL() + serviceEndpoint.replace("{id}", identifier));
int responseCode = response.getStatusLine().getStatusCode();
http://git-wip-us.apache.org/repos/asf/stratos/blob/8159b5cc/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
index 64df59e..e52e659 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
@@ -86,9 +86,13 @@ public class RestCommandLineService {
private static final String ENDPOINT_DEPLOY_SERVICE = "/stratos/admin/service/definition";
private static final String ENDPOINT_DEPLOY_KUBERNETES_GROUP = "/stratos/admin/kubernetes/deploy/group";
private static final String ENDPOINT_DEPLOY_KUBERNETES_HOST = "/stratos/admin/kubernetes/deploy/host";
+ private static final String ENDPOINT_DEPLOY_SERVICE_GROUP = "/stratos/admin/group/definition";
+ private static final String ENDPOINT_DEPLOY_APPLICATION = "/stratos/admin/application/definition";
private static final String ENDPOINT_UNDEPLOY_KUBERNETES_GROUP = "/stratos/admin/kubernetes/group/{id}";
private static final String ENDPOINT_UNDEPLOY_KUBERNETES_HOST = "/stratos/admin/kubernetes/host/{id}";
+ private static final String ENDPOINT_UNDEPLOY_SERVICE_GROUP = "/stratos/admin/group/definition/{id}";
+ private static final String ENDPOINT_UNDEPLOY_APPLICATION = "/stratos/admin/application/definition/{id}";
private static final String ENDPOINT_LIST_PARTITIONS = "/stratos/admin/partition";
private static final String ENDPOINT_LIST_AUTOSCALING_POLICIES = "/stratos/admin/policy/autoscale";
@@ -1807,4 +1811,24 @@ public class RestCommandLineService {
String url = ENDPOINT_UPDATE_SUBSCRIPTION_PROPERTIES.replace("{alias}", alias);
restClient.updateEntity(url, subscriptionJson, "subscription alias: "+alias);
}
+
+ // This method helps to deploy service groups
+ public void deployServiceGroup (String entityBody) {
+ restClient.deployEntity(ENDPOINT_DEPLOY_SERVICE_GROUP, entityBody, "service group");
+ }
+
+ // This method helps to undeploy service groups
+ public void undeployServiceGroup (String groupDefinitionName) throws CommandException {
+ restClient.undeployEntity(ENDPOINT_UNDEPLOY_SERVICE_GROUP, "service group", groupDefinitionName);
+ }
+
+ // This method helps to deploy applications
+ public void deployApplication (String entityBody) {
+ restClient.deployEntity(ENDPOINT_DEPLOY_APPLICATION, entityBody, "application");
+ }
+
+ // This method helps to undeploy applications
+ public void undeployApplication(String id) throws CommandException {
+ restClient.undeployEntity(ENDPOINT_UNDEPLOY_APPLICATION, "application", id);
+ }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/8159b5cc/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
index 3b1c55a..9fc783b 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosApplication.java
@@ -213,6 +213,18 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
command = new UpdateDeploymentPolicyCommand();
commands.put(command.getName(), command);
+ command = new DeployServiceGroupCommand();
+ commands.put(command.getName(), command);
+
+ command = new UndeployServiceGroupCommand();
+ commands.put(command.getName(), command);
+
+ command = new DeployApplicationCommand();
+ commands.put(command.getName(), command);
+
+ command = new UndeployApplicationCommand();
+ commands.put(command.getName(), command);
+
if (logger.isDebugEnabled()) {
logger.debug("Created {} commands for the application. {}", commands.size(), commands.keySet());
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/8159b5cc/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java
new file mode 100644
index 0000000..25e9567
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.cli.commands;
+
+import org.apache.commons.cli.*;
+import org.apache.stratos.cli.Command;
+import org.apache.stratos.cli.RestCommandLineService;
+import org.apache.stratos.cli.StratosCommandContext;
+import org.apache.stratos.cli.exception.CommandException;
+import org.apache.stratos.cli.utils.CliConstants;
+import org.apache.stratos.cli.utils.CliUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.io.IOException;
+
+/**
+ * Deploy application command.
+ */
+public class DeployApplicationCommand implements Command<StratosCommandContext> {
+
+ private static final Logger logger = LoggerFactory.getLogger(DeployApplicationCommand.class);
+
+ private Options options;
+
+ public DeployApplicationCommand() {
+ options = new Options();
+ Option option = new Option(CliConstants.RESOURCE_PATH, CliConstants.RESOURCE_PATH_LONG_OPTION, true,
+ "Application resource path");
+ option.setArgName("resource path");
+ options.addOption(option);
+ }
+
+ @Override
+ public String getName() {
+ return "deploy-application";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Deploy application";
+ }
+
+ @Override
+ public String getArgumentSyntax() {
+ return null;
+ }
+
+ @Override
+ public Options getOptions() {
+ return options;
+ }
+
+ @Override
+ public int execute(StratosCommandContext context, String[] args) throws CommandException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Executing command: ", getName());
+ }
+
+ if ((args == null) || (args.length <= 0)) {
+ context.getStratosApplication().printUsage(getName());
+ return CliConstants.COMMAND_FAILED;
+ }
+
+ try {
+ CommandLineParser parser = new GnuParser();
+ CommandLine commandLine = parser.parse(options, args);
+ if (commandLine.hasOption(CliConstants.RESOURCE_PATH)) {
+ String resourcePath = commandLine.getOptionValue(CliConstants.RESOURCE_PATH);
+ if (resourcePath == null) {
+ System.out.println("usage: " + getName() + " [-" + CliConstants.RESOURCE_PATH + " " + CliConstants.RESOURCE_PATH_LONG_OPTION + "]");
+ return CliConstants.COMMAND_FAILED;
+ }
+ String resourceFileContent = CliUtils.readResource(resourcePath);
+ RestCommandLineService.getInstance().deployApplication(resourceFileContent);
+ return CliConstants.COMMAND_SUCCESSFULL;
+ } else {
+ System.out.println("usage: " + getName() + " [-" + CliConstants.RESOURCE_PATH + " " + CliConstants.RESOURCE_PATH_LONG_OPTION + "]");
+ return CliConstants.COMMAND_FAILED;
+ }
+ } catch (ParseException e) {
+ logger.error("Error parsing arguments", e);
+ System.out.println(e.getMessage());
+ return CliConstants.COMMAND_FAILED;
+ } catch (IOException e) {
+ System.out.println("Invalid resource path");
+ return CliConstants.COMMAND_FAILED;
+ } catch (Exception e) {
+ String message = "Unknown error occurred: " + e.getMessage();
+ System.out.println(message);
+ logger.error(message, e);
+ return CliConstants.COMMAND_FAILED;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/8159b5cc/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployKubernetesGroupCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployKubernetesGroupCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployKubernetesGroupCommand.java
index 1f73bd3..d7f7912 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployKubernetesGroupCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployKubernetesGroupCommand.java
@@ -44,6 +44,7 @@ public class DeployKubernetesGroupCommand implements Command<StratosCommandConte
options = new Options();
Option option = new Option(CliConstants.RESOURCE_PATH, CliConstants.RESOURCE_PATH_LONG_OPTION, true,
"Kubernetes group resource path");
+ option.setArgName("resource path");
options.addOption(option);
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/8159b5cc/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployKubernetesHostCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployKubernetesHostCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployKubernetesHostCommand.java
index a107a94..a9c9f74 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployKubernetesHostCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployKubernetesHostCommand.java
@@ -44,6 +44,7 @@ public class DeployKubernetesHostCommand implements Command<StratosCommandContex
options = new Options();
Option option = new Option(CliConstants.RESOURCE_PATH, CliConstants.RESOURCE_PATH_LONG_OPTION, true,
"Kubernetes host resource path");
+ option.setArgName("resource path");
options.addOption(option);
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/8159b5cc/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployServiceGroupCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployServiceGroupCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployServiceGroupCommand.java
new file mode 100644
index 0000000..c59da2e
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployServiceGroupCommand.java
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.cli.commands;
+
+import org.apache.commons.cli.*;
+import org.apache.stratos.cli.Command;
+import org.apache.stratos.cli.RestCommandLineService;
+import org.apache.stratos.cli.StratosCommandContext;
+import org.apache.stratos.cli.exception.CommandException;
+import org.apache.stratos.cli.utils.CliConstants;
+import org.apache.stratos.cli.utils.CliUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.io.IOException;
+
+/**
+ * Deploy service group command.
+ */
+public class DeployServiceGroupCommand implements Command<StratosCommandContext> {
+
+ private static final Logger logger = LoggerFactory.getLogger(DeployServiceGroupCommand.class);
+
+ private Options options;
+
+ public DeployServiceGroupCommand() {
+ options = new Options();
+ Option option = new Option(CliConstants.RESOURCE_PATH, CliConstants.RESOURCE_PATH_LONG_OPTION, true,
+ "Service group resource path");
+ option.setArgName("resource path");
+ options.addOption(option);
+ }
+
+ @Override
+ public String getName() {
+ return "deploy-service-group";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Deploy service group";
+ }
+
+ @Override
+ public String getArgumentSyntax() {
+ return null;
+ }
+
+ @Override
+ public Options getOptions() {
+ return options;
+ }
+
+ @Override
+ public int execute(StratosCommandContext context, String[] args) throws CommandException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Executing command: ", getName());
+ }
+
+ if ((args == null) || (args.length <= 0)) {
+ context.getStratosApplication().printUsage(getName());
+ return CliConstants.COMMAND_FAILED;
+ }
+
+ try {
+ CommandLineParser parser = new GnuParser();
+ CommandLine commandLine = parser.parse(options, args);
+ if (commandLine.hasOption(CliConstants.RESOURCE_PATH)) {
+ String resourcePath = commandLine.getOptionValue(CliConstants.RESOURCE_PATH);
+ if (resourcePath == null) {
+ System.out.println("usage: " + getName() + " [-" + CliConstants.RESOURCE_PATH + " " + CliConstants.RESOURCE_PATH_LONG_OPTION + "]");
+ return CliConstants.COMMAND_FAILED;
+ }
+ String resourceFileContent = CliUtils.readResource(resourcePath);
+ RestCommandLineService.getInstance().deployServiceGroup(resourceFileContent);
+ return CliConstants.COMMAND_SUCCESSFULL;
+ } else {
+ System.out.println("usage: " + getName() + " [-" + CliConstants.RESOURCE_PATH + " " + CliConstants.RESOURCE_PATH_LONG_OPTION + "]");
+ return CliConstants.COMMAND_FAILED;
+ }
+ } catch (ParseException e) {
+ logger.error("Error parsing arguments", e);
+ System.out.println(e.getMessage());
+ return CliConstants.COMMAND_FAILED;
+ } catch (IOException e) {
+ System.out.println("Invalid resource path");
+ return CliConstants.COMMAND_FAILED;
+ } catch (Exception e) {
+ String message = "Unknown error occurred: " + e.getMessage();
+ System.out.println(message);
+ logger.error(message, e);
+ return CliConstants.COMMAND_FAILED;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/8159b5cc/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployApplicationCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployApplicationCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployApplicationCommand.java
new file mode 100644
index 0000000..0fba797
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployApplicationCommand.java
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.cli.commands;
+
+import org.apache.commons.cli.Options;
+import org.apache.stratos.cli.Command;
+import org.apache.stratos.cli.RestCommandLineService;
+import org.apache.stratos.cli.StratosCommandContext;
+import org.apache.stratos.cli.exception.CommandException;
+import org.apache.stratos.cli.utils.CliConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Un-deploy application command.
+ */
+public class UndeployApplicationCommand implements Command<StratosCommandContext> {
+
+ private static final Logger logger = LoggerFactory.getLogger(UndeployApplicationCommand.class);
+
+ public UndeployApplicationCommand() {
+ }
+
+ @Override
+ public String getName() {
+ return "undeploy-application";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Undeploy application";
+ }
+
+ @Override
+ public String getArgumentSyntax() {
+ return "[application-id]";
+ }
+
+ @Override
+ public Options getOptions() {
+ return null;
+ }
+
+ @Override
+ public int execute(StratosCommandContext context, String[] args) throws CommandException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Executing command: ", getName());
+ }
+
+ if ((args == null) || (args.length <= 0)) {
+ context.getStratosApplication().printUsage(getName());
+ return CliConstants.COMMAND_FAILED;
+ }
+
+ String applicationId = args[0];
+ RestCommandLineService.getInstance().undeployApplication(applicationId);
+ return CliConstants.COMMAND_SUCCESSFULL;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/8159b5cc/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployServiceGroupCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployServiceGroupCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployServiceGroupCommand.java
new file mode 100644
index 0000000..5b39124
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployServiceGroupCommand.java
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.cli.commands;
+
+import org.apache.commons.cli.Options;
+import org.apache.stratos.cli.Command;
+import org.apache.stratos.cli.RestCommandLineService;
+import org.apache.stratos.cli.StratosCommandContext;
+import org.apache.stratos.cli.exception.CommandException;
+import org.apache.stratos.cli.utils.CliConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Un-deploy service group command.
+ */
+public class UndeployServiceGroupCommand implements Command<StratosCommandContext> {
+
+ private static final Logger logger = LoggerFactory.getLogger(UndeployServiceGroupCommand.class);
+
+ public UndeployServiceGroupCommand() {
+ }
+
+ @Override
+ public String getName() {
+ return "undeploy-service-group";
+ }
+
+ @Override
+ public String getDescription() {
+ return "Undeploy service group";
+ }
+
+ @Override
+ public String getArgumentSyntax() {
+ return "[service-group-name]";
+ }
+
+ @Override
+ public Options getOptions() {
+ return null;
+ }
+
+ @Override
+ public int execute(StratosCommandContext context, String[] args) throws CommandException {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Executing command: ", getName());
+ }
+
+ if ((args == null) || (args.length <= 0)) {
+ context.getStratosApplication().printUsage(getName());
+ return CliConstants.COMMAND_FAILED;
+ }
+
+ String serviceGroupName = args[0];
+ RestCommandLineService.getInstance().undeployServiceGroup(serviceGroupName);
+ return CliConstants.COMMAND_SUCCESSFULL;
+ }
+}