Refactor list-service-group to describe-service-group
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/46edc50d Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/46edc50d Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/46edc50d Branch: refs/heads/docker-grouping-merge Commit: 46edc50db508981c8d9cc78243ad8f5f047f9c47 Parents: dc0edc9 Author: Manula Thantriwatte <[email protected]> Authored: Fri Nov 7 10:14:49 2014 +0000 Committer: Manula Thantriwatte <[email protected]> Committed: Fri Nov 7 10:14:49 2014 +0000 ---------------------------------------------------------------------- .../stratos/cli/RestCommandLineService.java | 2 +- .../apache/stratos/cli/StratosApplication.java | 2 +- .../commands/DescribeServiceGroupCommand.java | 67 ++++++++++++++++++++ .../cli/commands/ListServiceGroupCommand.java | 67 -------------------- 4 files changed, 69 insertions(+), 69 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/46edc50d/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 0699979..3011a8c 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 @@ -1824,7 +1824,7 @@ public class RestCommandLineService { restClient.undeployEntity(ENDPOINT_UNDEPLOY_SERVICE_GROUP, "service group", groupDefinitionName); } - public void listServiceGroup (String groupDefinitionName) { + public void describeServiceGroup (String groupDefinitionName) { try { ServiceGroupDefinition list = (ServiceGroupDefinition) restClient.listEntity(ENDPOINT_LIST_SERVICE_GROUP.replace("{groupDefinitionName}", groupDefinitionName), ServiceGroupDefinition.class, "serviceGroup"); http://git-wip-us.apache.org/repos/asf/stratos/blob/46edc50d/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 fc7d99b..dedd6c6 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 @@ -216,7 +216,7 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon command = new DeployServiceGroupCommand(); commands.put(command.getName(), command); - command = new ListServiceGroupCommand(); + command = new DescribeServiceGroupCommand(); commands.put(command.getName(), command); command = new UndeployServiceGroupCommand(); http://git-wip-us.apache.org/repos/asf/stratos/blob/46edc50d/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeServiceGroupCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeServiceGroupCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeServiceGroupCommand.java new file mode 100644 index 0000000..81e3ad4 --- /dev/null +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeServiceGroupCommand.java @@ -0,0 +1,67 @@ +/** + * 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; + +public class DescribeServiceGroupCommand implements Command<StratosCommandContext> { + + private static final Logger logger = LoggerFactory.getLogger(DescribeServiceGroupCommand.class); + + public DescribeServiceGroupCommand() { + } + + public String getName() { + return "describe-service-group"; + } + + public String getDescription() { + return "Describe service groups"; + } + + public String getArgumentSyntax() { + return "[group-definition-name]"; + } + + 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; + } else { + String groupId = args[0]; + RestCommandLineService.getInstance().describeServiceGroup(groupId); + return CliConstants.COMMAND_SUCCESSFULL; + } + } + + public Options getOptions() { + return null; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/46edc50d/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListServiceGroupCommand.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListServiceGroupCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListServiceGroupCommand.java deleted file mode 100644 index 4af8bd1..0000000 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListServiceGroupCommand.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * 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; - -public class ListServiceGroupCommand implements Command<StratosCommandContext> { - - private static final Logger logger = LoggerFactory.getLogger(ListServiceGroupCommand.class); - - public ListServiceGroupCommand() { - } - - public String getName() { - return "list-service-group"; - } - - public String getDescription() { - return "List service groups"; - } - - public String getArgumentSyntax() { - return "[group-definition-name]"; - } - - 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; - } else { - String groupId = args[0]; - RestCommandLineService.getInstance().listServiceGroup(groupId); - return CliConstants.COMMAND_SUCCESSFULL; - } - } - - public Options getOptions() { - return null; - } -}
