stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [1/2] git commit: Fixing cli component merge issues
Date Thu, 30 Oct 2014 09:51:35 GMT
Repository: stratos
Updated Branches:
  refs/heads/docker-grouping-merge 15aea18e7 -> 1d817dbe8


Fixing cli component merge issues


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/917947a2
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/917947a2
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/917947a2

Branch: refs/heads/docker-grouping-merge
Commit: 917947a2bd92f5c7692927fd3090c45d14e5ee30
Parents: be88858
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Thu Oct 30 15:21:12 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Thu Oct 30 15:21:12 2014 +0530

----------------------------------------------------------------------
 .../java/org/apache/stratos/cli/Command.java    |  5 +---
 .../stratos/cli/RestCommandLineService.java     |  1 -
 .../apache/stratos/cli/StratosApplication.java  |  8 ++----
 .../cli/commands/ActivateTenantCommand.java     |  3 +-
 .../cli/commands/AddDomainMappingCommand.java   |  3 +-
 .../stratos/cli/commands/AddTenantCommand.java  | 30 +++++++++-----------
 .../cli/commands/DeactivateTenantCommand.java   |  3 +-
 .../cli/commands/DeleteTenantCommand.java       |  3 +-
 .../DescribeAutoScalingPolicyCommand.java       |  2 +-
 .../cli/commands/DescribeCartridgeCommand.java  |  2 +-
 .../DescribeDeploymentPolicyCommand.java        |  2 +-
 .../cli/commands/DescribePartitionCommand.java  |  3 +-
 .../stratos/cli/commands/ExitCommand.java       |  3 +-
 .../stratos/cli/commands/HelpCommand.java       |  3 +-
 .../stratos/cli/commands/InfoCommand.java       |  3 +-
 .../stratos/cli/commands/ListAllTenants.java    |  3 +-
 .../cli/commands/ListCartridgesCommand.java     |  3 +-
 .../cli/commands/ListDeployServiceCommand.java  |  3 +-
 .../stratos/cli/commands/ListMemberCommand.java | 14 ++++-----
 .../stratos/cli/commands/SyncCommand.java       |  3 +-
 .../UndeployCartridgeDefinitionCommand.java     |  3 +-
 .../UndeployServiceDefinitionCommand.java       |  3 +-
 .../cli/commands/UnsubscribeCommand.java        |  9 ++----
 .../src/main/resources/log4j.properties         |  2 +-
 24 files changed, 41 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Command.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Command.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Command.java
index 5f777ce..6516556 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Command.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Command.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.stratos.cli.exception.CommandException;
 
@@ -59,12 +58,10 @@ public interface Command<T extends CommandContext> {
 	 *            The context assoicated with the Command Line Application
 	 * @param args
 	 *            The arguments for the command
-	 * @param already_parsed_opts
-	 *            Options parsed by any parent parsers.
 	 * @return The status code
 	 * @throws org.apache.stratos.cli.exception.CommandException
 	 *             if any errors occur when executing the command
 	 */
-	int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException;
+	int execute(T context, String[] args) throws CommandException;
 
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/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 a2d4702..64df59e 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
@@ -785,7 +785,6 @@ public class RestCommandLineService {
         DefaultHttpClient httpClient = new DefaultHttpClient();
 
         CartridgeInfoBean cartridgeInfoBean = new CartridgeInfoBean();
-
         GsonBuilder gsonBuilder = new GsonBuilder();
         Gson gson = gsonBuilder.create();
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/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 9fcaf9b..a528e61 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
@@ -249,8 +249,6 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
 
 		// Command action
 		String action = null;
-		// Command action options
-		Option[] actionOptions = null;
 
 		String usernameInput = null;
 		String passwordInput = null;
@@ -268,7 +266,6 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
 			CommandLine commandLine;
 			try {
 				// Must add all options. Otherwise actions cannot be performed directly by command line.
-				// This is because the parser trips over unrecognised options.
 				Options allCommandOptions = new Options();
 				for (Command<StratosCommandContext> command : commands.values()) {
 					Options commandOptions = command.getOptions();
@@ -287,7 +284,6 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
 				
 				commandLine = parser.parse(options, args, true);
 				remainingArgs = commandLine.getArgs();
-				actionOptions = commandLine.getOptions();
 				if (remainingArgs != null && remainingArgs.length > 0) {
 					// Get command action
 					action = remainingArgs[0];
@@ -353,7 +349,7 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
 				if (logger.isDebugEnabled()) {
 					logger.debug("Executing Action: {} {}", action, Arrays.asList(actionArgs));
 				}
-				int returnCode = command.execute(context, actionArgs, actionOptions);
+				int returnCode = command.execute(context, actionArgs);
 				if (logger.isDebugEnabled()) {
 					logger.debug("Exiting with error code {} after executing action {}", returnCode, action);
 				}
@@ -449,7 +445,7 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
 			return CliConstants.COMMAND_FAILED;
 		}
 		try {
-			return command.execute(context, actionArgs, new Option[0]);
+			return command.execute(context, actionArgs);
 		} catch (CommandException e) {
 			if (logger.isErrorEnabled()) {
 				logger.error("Error executing command: " + action, e);

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ActivateTenantCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ActivateTenantCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ActivateTenantCommand.java
index ea050f4..4f4ca3b 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ActivateTenantCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ActivateTenantCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.stratos.cli.Command;
 import org.apache.stratos.cli.RestCommandLineService;
@@ -52,7 +51,7 @@ public class ActivateTenantCommand implements Command<StratosCommandContext>
{
     }
 
     @Override
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddDomainMappingCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddDomainMappingCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddDomainMappingCommand.java
index d6ccfa3..773e64f 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddDomainMappingCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddDomainMappingCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -52,7 +51,7 @@ public class AddDomainMappingCommand implements Command<StratosCommandContext>
{
 	}
 
 	@Override
-	public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+	public int execute(StratosCommandContext context, String[] args) throws CommandException
{
 		if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddTenantCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddTenantCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddTenantCommand.java
index 23c6017..3b9b218 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddTenantCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/AddTenantCommand.java
@@ -29,8 +29,6 @@ import org.slf4j.LoggerFactory;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.Option;
 
-import static org.apache.stratos.cli.utils.CommandLineUtils.mergeOptionArrays;
-
 public class AddTenantCommand implements Command<StratosCommandContext> {
 
     private static final Logger logger = LoggerFactory.getLogger(AddTenantCommand.class);
@@ -89,7 +87,7 @@ public class AddTenantCommand implements Command<StratosCommandContext>
{
         return null;
     }
 
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
             logger.debug("Executing {} command...", getName());
         }
@@ -107,48 +105,46 @@ public class AddTenantCommand implements Command<StratosCommandContext>
{
 
             try {
                 commandLine = parser.parse(options, args);
-                //merge newly discovered options with previously discovered ones.
-                Options opts = mergeOptionArrays(already_parsed_opts, commandLine.getOptions());
 
                 if (logger.isDebugEnabled()) {
                     logger.debug("Add tenant");
                 }
 
-                if (opts.hasOption(CliConstants.USERNAME_OPTION)) {
+                if (commandLine.hasOption(CliConstants.USERNAME_OPTION)) {
                     if (logger.isTraceEnabled()) {
                         logger.trace("Username option is passed");
                     }
-                    admin = opts.getOption(CliConstants.USERNAME_OPTION).getValue();
+                    admin = commandLine.getOptionValue(CliConstants.USERNAME_OPTION);
                 }
-                if (opts.hasOption(CliConstants.FIRST_NAME_OPTION)) {
+                if (commandLine.hasOption(CliConstants.FIRST_NAME_OPTION)) {
                     if (logger.isTraceEnabled()) {
                         logger.trace("First name option is passed");
                     }
-                    firstName = opts.getOption(CliConstants.FIRST_NAME_OPTION).getValue();
+                    firstName = commandLine.getOptionValue(CliConstants.FIRST_NAME_OPTION);
                 }
-                if (opts.hasOption(CliConstants.LAST_NAME_OPTION)) {
+                if (commandLine.hasOption(CliConstants.LAST_NAME_OPTION)) {
                     if (logger.isTraceEnabled()) {
                         logger.trace("Last name option is passed");
                     }
-                    lastaName = opts.getOption(CliConstants.LAST_NAME_OPTION).getValue();
+                    lastaName = commandLine.getOptionValue(CliConstants.LAST_NAME_OPTION);
                 }
-                if (opts.hasOption(CliConstants.PASSWORD_OPTION)) {
+                if (commandLine.hasOption(CliConstants.PASSWORD_OPTION)) {
                     if (logger.isTraceEnabled()) {
                         logger.trace("Password option is passed");
                     }
-                    password = opts.getOption(CliConstants.PASSWORD_OPTION).getValue();
+                    password = commandLine.getOptionValue(CliConstants.PASSWORD_OPTION);
                 }
-                if (opts.hasOption(CliConstants.DOMAIN_NAME_OPTION)) {
+                if (commandLine.hasOption(CliConstants.DOMAIN_NAME_OPTION)) {
                     if (logger.isTraceEnabled()) {
                         logger.trace("Domain name option is passed");
                     }
-                    domain = opts.getOption(CliConstants.DOMAIN_NAME_OPTION).getValue();
+                    domain = commandLine.getOptionValue(CliConstants.DOMAIN_NAME_OPTION);
                 }
-                if (opts.hasOption(CliConstants.EMAIL_OPTION)) {
+                if (commandLine.hasOption(CliConstants.EMAIL_OPTION)) {
                     if (logger.isTraceEnabled()) {
                         logger.trace("Email option is passed");
                     }
-                    email = opts.getOption(CliConstants.EMAIL_OPTION).getValue();
+                    email = commandLine.getOptionValue(CliConstants.EMAIL_OPTION);
 
                 }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeactivateTenantCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeactivateTenantCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeactivateTenantCommand.java
index a82fd1e..ee9e15a 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeactivateTenantCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeactivateTenantCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.stratos.cli.Command;
 import org.apache.stratos.cli.RestCommandLineService;
@@ -52,7 +51,7 @@ public class DeactivateTenantCommand implements Command<StratosCommandContext>
{
     }
 
     @Override
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeleteTenantCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeleteTenantCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeleteTenantCommand.java
index eebedd9..3c0b3f5 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeleteTenantCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeleteTenantCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.stratos.cli.Command;
 import org.apache.stratos.cli.RestCommandLineService;
@@ -52,7 +51,7 @@ public class DeleteTenantCommand implements Command<StratosCommandContext>
{
     }
 
     @Override
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeAutoScalingPolicyCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeAutoScalingPolicyCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeAutoScalingPolicyCommand.java
index efe04bf..a7e6945 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeAutoScalingPolicyCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeAutoScalingPolicyCommand.java
@@ -51,7 +51,7 @@ public class DescribeAutoScalingPolicyCommand implements Command<StratosCommandC
     }
 
     @Override
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeCartridgeCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeCartridgeCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeCartridgeCommand.java
index 066c2e1..cb4608e 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeCartridgeCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeCartridgeCommand.java
@@ -51,7 +51,7 @@ public class DescribeCartridgeCommand implements Command<StratosCommandContext>
     }
 
     @Override
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeDeploymentPolicyCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeDeploymentPolicyCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeDeploymentPolicyCommand.java
index 811027d..3fe22ef 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeDeploymentPolicyCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeDeploymentPolicyCommand.java
@@ -51,7 +51,7 @@ public class DescribeDeploymentPolicyCommand implements Command<StratosCommandCo
     }
 
     @Override
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribePartitionCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribePartitionCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribePartitionCommand.java
index aa0ce81..3709f4d 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribePartitionCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribePartitionCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.stratos.cli.Command;
 import org.apache.stratos.cli.RestCommandLineService;
@@ -52,7 +51,7 @@ public class DescribePartitionCommand implements Command<StratosCommandContext>
     }
 
     @Override
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java
index a437d65..4605113 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ExitCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
     import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -50,7 +49,7 @@ public class ExitCommand implements Command<StratosCommandContext>
{
 	}
 
 	@Override
-	public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+	public int execute(StratosCommandContext context, String[] args) throws CommandException
{
 		// Nothing to execute here. This is a special command.
 		if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/HelpCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/HelpCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/HelpCommand.java
index 8c1ed13..2257f11 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/HelpCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/HelpCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -50,7 +49,7 @@ public class HelpCommand implements Command<StratosCommandContext>
{
 	}
 
 	@Override
-	public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+	public int execute(StratosCommandContext context, String[] args) throws CommandException
{
 		if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/InfoCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/InfoCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/InfoCommand.java
index dde7a12..a15e215 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/InfoCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/InfoCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -51,7 +50,7 @@ public class InfoCommand implements Command<StratosCommandContext>
{
 	}
 
 	@Override
-	public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+	public int execute(StratosCommandContext context, String[] args) throws CommandException
{
 		if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListAllTenants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListAllTenants.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListAllTenants.java
index 9f60ccd..1540c7c 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListAllTenants.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListAllTenants.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.stratos.cli.Command;
 import org.apache.stratos.cli.RestCommandLineService;
@@ -47,7 +46,7 @@ public class ListAllTenants implements Command<StratosCommandContext>
{
         return null;
     }
 
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
             logger.debug("Executing {} command...", getName());
         }

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgesCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgesCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgesCommand.java
index 9208c20..3492d76 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgesCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListCartridgesCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.stratos.cli.RestCommandLineService;
 import org.slf4j.Logger;
@@ -47,7 +46,7 @@ public class ListCartridgesCommand implements Command<StratosCommandContext>
{
 		return null;
 	}
 
-	public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+	public int execute(StratosCommandContext context, String[] args) throws CommandException
{
 		if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListDeployServiceCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListDeployServiceCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListDeployServiceCommand.java
index d1d2c7d..a45ac02 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListDeployServiceCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListDeployServiceCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.stratos.cli.Command;
 import org.apache.stratos.cli.RestCommandLineService;
@@ -47,7 +46,7 @@ public class ListDeployServiceCommand implements Command<StratosCommandContext>
         return null;
     }
 
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
             logger.debug("Executing {} command...", getName());
         }

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListMemberCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListMemberCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListMemberCommand.java
index 7aa07a0..cbdf039 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListMemberCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListMemberCommand.java
@@ -27,8 +27,6 @@ import org.apache.stratos.cli.utils.CliConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.stratos.cli.utils.CommandLineUtils.mergeOptionArrays;
-
 public class ListMemberCommand implements Command<StratosCommandContext> {
     private static final Logger logger = LoggerFactory.getLogger(ListMemberCommand.class);
 
@@ -80,7 +78,7 @@ public class ListMemberCommand implements Command<StratosCommandContext>
{
     }
 
     @Override
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}
@@ -92,23 +90,21 @@ public class ListMemberCommand implements Command<StratosCommandContext>
{
 			CommandLine commandLine;
 			try {
 				commandLine = parser.parse(options, args);
-				//merge newly discovered options with previously discovered ones.
-				Options opts = mergeOptionArrays(already_parsed_opts, commandLine.getOptions());
 				if (logger.isDebugEnabled()) {
 					logger.debug("Subscribing to {} cartridge with alias {}", type, alias);
 				}
 
-                if (opts.hasOption(CliConstants.CARTRIDGE_TYPE_OPTION)) {
+                if (commandLine.hasOption(CliConstants.CARTRIDGE_TYPE_OPTION)) {
                     if (logger.isTraceEnabled()) {
                         logger.trace("Autoscaling policy option is passed");
                     }
-                    type = opts.getOption(CliConstants.CARTRIDGE_TYPE_OPTION).getValue();
+                    type = commandLine.getOptionValue(CliConstants.CARTRIDGE_TYPE_OPTION);
                 }
-                if (opts.hasOption(CliConstants.ALIAS_OPTION)) {
+                if (commandLine.hasOption(CliConstants.ALIAS_OPTION)) {
                     if (logger.isTraceEnabled()) {
                         logger.trace("Deployment policy option is passed");
                     }
-                    alias = opts.getOption(CliConstants.ALIAS_OPTION).getValue();
+                    alias = commandLine.getOptionValue(CliConstants.ALIAS_OPTION);
                 }
 
                 if (type == null) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SyncCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SyncCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SyncCommand.java
index 760e6fd..017bf15 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SyncCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/SyncCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.stratos.cli.Command;
 import org.apache.stratos.cli.RestCommandLineService;
@@ -51,7 +50,7 @@ public class SyncCommand implements Command<StratosCommandContext>
{
 	}
 
 	@Override
-	public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+	public int execute(StratosCommandContext context, String[] args) throws CommandException
{
 		if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployCartridgeDefinitionCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployCartridgeDefinitionCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployCartridgeDefinitionCommand.java
index b22bf5b..9af7b36 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployCartridgeDefinitionCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployCartridgeDefinitionCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.stratos.cli.Command;
 import org.apache.stratos.cli.RestCommandLineService;
@@ -52,7 +51,7 @@ public class UndeployCartridgeDefinitionCommand implements Command<StratosComman
     }
 
     @Override
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployServiceDefinitionCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployServiceDefinitionCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployServiceDefinitionCommand.java
index c634335..37e1a76 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployServiceDefinitionCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UndeployServiceDefinitionCommand.java
@@ -18,7 +18,6 @@
  */
 package org.apache.stratos.cli.commands;
 
-import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.stratos.cli.Command;
 import org.apache.stratos.cli.RestCommandLineService;
@@ -52,7 +51,7 @@ public class UndeployServiceDefinitionCommand implements Command<StratosCommandC
     }
 
     @Override
-    public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+    public int execute(StratosCommandContext context, String[] args) throws CommandException
{
         if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UnsubscribeCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UnsubscribeCommand.java
b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UnsubscribeCommand.java
index ff4967a..c56db7d 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UnsubscribeCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/UnsubscribeCommand.java
@@ -32,8 +32,6 @@ import org.apache.stratos.cli.StratosCommandContext;
 import org.apache.stratos.cli.exception.CommandException;
 import org.apache.stratos.cli.utils.CliConstants;
 
-import static org.apache.stratos.cli.utils.CommandLineUtils.mergeOptionArrays;
-
 public class UnsubscribeCommand implements Command<StratosCommandContext> {
 
 	private static final Logger logger = LoggerFactory.getLogger(UnsubscribeCommand.class);
@@ -73,7 +71,7 @@ public class UnsubscribeCommand implements Command<StratosCommandContext>
{
 	}
 
 	@Override
-	public int execute(StratosCommandContext context, String[] args, Option[] already_parsed_opts)
throws CommandException {
+	public int execute(StratosCommandContext context, String[] args) throws CommandException
{
 		if (logger.isDebugEnabled()) {
 			logger.debug("Executing {} command...", getName());
 		}
@@ -86,9 +84,6 @@ public class UnsubscribeCommand implements Command<StratosCommandContext>
{
 			try {
 				commandLine = parser.parse(options, args);
 				remainingArgs = commandLine.getArgs();
-				//merge newly discovered options with previously discovered ones.
-				Options opts = mergeOptionArrays(already_parsed_opts, commandLine.getOptions());
-
 				if (remainingArgs != null && remainingArgs.length == 1) {
 					// Get alias
 					alias = remainingArgs[0];
@@ -100,7 +95,7 @@ public class UnsubscribeCommand implements Command<StratosCommandContext>
{
 					return CliConstants.COMMAND_FAILED;
 				}
 
-				if (opts.hasOption(CliConstants.FORCE_OPTION)) {
+				if (commandLine.hasOption(CliConstants.FORCE_OPTION)) {
 					if (logger.isTraceEnabled()) {
 						logger.trace("Force option is passed");
 					}

http://git-wip-us.apache.org/repos/asf/stratos/blob/917947a2/components/org.apache.stratos.cli/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/resources/log4j.properties b/components/org.apache.stratos.cli/src/main/resources/log4j.properties
index 15304ee..5826f68 100644
--- a/components/org.apache.stratos.cli/src/main/resources/log4j.properties
+++ b/components/org.apache.stratos.cli/src/main/resources/log4j.properties
@@ -33,4 +33,4 @@ log4j.appender.file.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS}
%-5p %c
 
 #Loggers
 log4j.rootLogger=info, file
-log4j.logger.org.wso2.carbon.adc.mgt.cli=DEBUG
+log4j.logger.org.wso2.carbon.adc.mgt.cli=INFO


Mime
View raw message