You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2015/04/30 08:16:53 UTC

[04/12] stratos git commit: Formatting CLI code

Formatting CLI code


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

Branch: refs/heads/master
Commit: 8b895d93ed4d710f642fd1318e39f60a047c2bc1
Parents: e97d336
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Wed Apr 29 23:23:52 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Wed Apr 29 23:23:52 2015 +0530

----------------------------------------------------------------------
 .../src/main/assembly/src.xml                   |  32 +-
 .../java/org/apache/stratos/cli/CliTool.java    |  92 +++---
 .../java/org/apache/stratos/cli/Command.java    | 108 +++---
 .../org/apache/stratos/cli/CommandContext.java  | 140 ++++----
 .../stratos/cli/CommandLineApplication.java     | 330 ++++++++++---------
 .../apache/stratos/cli/CommandLineService.java  | 312 +++++++++---------
 .../apache/stratos/cli/GenericRestClient.java   |  32 +-
 .../main/java/org/apache/stratos/cli/Main.java  |   1 -
 .../java/org/apache/stratos/cli/RestClient.java |   2 +-
 .../stratos/cli/RestCommandLineService.java     | 128 +++----
 .../apache/stratos/cli/StratosApplication.java  |  68 ++--
 .../stratos/cli/StratosCommandContext.java      |  44 +--
 .../apache/stratos/cli/WebClientWrapper.java    |  34 +-
 .../cli/commands/ActivateTenantCommand.java     |  54 +--
 .../commands/AddApplicationPolicyCommand.java   |  34 +-
 .../commands/AddApplicationSignupCommand.java   |  34 +-
 .../commands/AddAutoscalingPolicyCommand.java   |  34 +-
 .../cli/commands/AddCartridgeCommand.java       |  38 +--
 .../cli/commands/AddCartridgeGroupCommand.java  |  32 +-
 .../commands/AddDeploymentPolicyCommand.java    |  38 +--
 .../cli/commands/AddDomainMappingsCommand.java  |  36 +-
 .../commands/AddKubernetesClusterCommand.java   |  32 +-
 .../cli/commands/AddKubernetesHostCommand.java  |  54 +--
 .../commands/AddNetworkPartitionCommand.java    |  35 +-
 .../stratos/cli/commands/AddTenantCommand.java  |  39 +--
 .../stratos/cli/commands/AddUserCommand.java    |  51 +--
 .../cli/commands/CreateApplicationCommand.java  |  38 +--
 .../cli/commands/DeactivateTenantCommand.java   |  58 ++--
 .../cli/commands/DeleteApplicationCommand.java  |  58 ++--
 .../DeleteApplicationSignupCommand.java         |  58 ++--
 .../DeleteAutoScalingPolicyCommand.java         |  58 ++--
 .../stratos/cli/commands/DeleteUserCommand.java |  58 ++--
 .../cli/commands/DeployApplicationCommand.java  |  40 +--
 .../commands/DescribeApplicationCommand.java    |  78 ++---
 .../DescribeApplicationPolicyCommand.java       |  32 +-
 .../DescribeApplicationRuntimeCommand.java      |  32 +-
 .../DescribeApplicationSignupCommand.java       |  78 ++---
 .../DescribeAutoScalingPolicyCommand.java       |  58 ++--
 .../cli/commands/DescribeCartridgeCommand.java  |  58 ++--
 .../commands/DescribeCartridgeGroupCommand.java |  78 ++---
 .../DescribeDeploymentPolicyCommand.java        |  58 ++--
 .../DescribeKubernetesClusterCommand.java       |  32 +-
 .../DescribeKubernetesMasterCommand.java        |  32 +-
 .../DescribeNetworkPartitionCommand.java        |  32 +-
 .../cli/commands/DescribeTenantCommand.java     |  33 +-
 .../stratos/cli/commands/ExitCommand.java       |  96 +++---
 .../stratos/cli/commands/HelpCommand.java       | 102 +++---
 .../stratos/cli/commands/InfoCommand.java       |  84 ++---
 .../ListApplicationPoliciesCommand.java         |  34 +-
 .../cli/commands/ListApplicationsCommand.java   |  32 +-
 .../commands/ListAutoscalePolicyCommand.java    |  32 +-
 .../commands/ListCartridgeGroupsCommand.java    |  84 ++---
 .../cli/commands/ListCartridgesCommand.java     |  84 ++---
 .../commands/ListDeploymentPoliciesCommand.java |  32 +-
 .../cli/commands/ListDomainMappingsCommand.java |  88 ++---
 .../commands/ListKubernetesClustersCommand.java |  84 ++---
 .../commands/ListKubernetesHostsCommand.java    |  56 ++--
 .../commands/ListNetworkPartitionCommand.java   |  32 +-
 .../ListPartialSearchTenantsCommand.java        |  38 +--
 .../stratos/cli/commands/ListTenants.java       |  34 +-
 .../apache/stratos/cli/commands/ListUsers.java  |  34 +-
 .../RemoveApplicationPolicyCommand.java         |  32 +-
 .../cli/commands/RemoveCartridgeCommand.java    |  58 ++--
 .../commands/RemoveCartridgeGroupCommand.java   |  32 +-
 .../commands/RemoveDeploymentPolicyCommand.java |  32 +-
 .../commands/RemoveDomainMappingsCommand.java   |  32 +-
 .../RemoveKubernetesClusterCommand.java         |  32 +-
 .../commands/RemoveKubernetesHostCommand.java   |  32 +-
 .../commands/RemoveNetworkPartitionCommand.java |  32 +-
 .../commands/SynchronizeArtifactsCommand.java   | 104 +++---
 .../commands/UndeployApplicationCommand.java    |  32 +-
 .../UpdateApplicationPolicyCommand.java         |  34 +-
 .../UpdateAutoscalingPolicyCommand.java         |  34 +-
 .../cli/commands/UpdateCartridgeCommand.java    |  34 +-
 .../commands/UpdateDeploymentPolicyCommand.java |  34 +-
 .../commands/UpdateKubernetesHostCommand.java   |  59 ++--
 .../commands/UpdateKubernetesMasterCommand.java |  51 +--
 .../commands/UpdateNetworkPartitionCommand.java |  34 +-
 .../cli/commands/UpdateTenantCommand.java       |  40 +--
 .../stratos/cli/commands/UpdateUserCommand.java |  48 +--
 .../stratos/cli/completer/CommandCompleter.java | 214 ++++++------
 .../cli/completer/StratosFileNameCompleter.java |  54 +--
 .../stratos/cli/exception/CommandException.java |  56 ++--
 .../stratos/cli/exception/ErrorWrapper.java     |  32 +-
 .../stratos/cli/exception/ExceptionMapper.java  |  32 +-
 .../apache/stratos/cli/utils/CliConstants.java  |  42 +--
 .../org/apache/stratos/cli/utils/CliUtils.java  | 176 +++++-----
 .../org/apache/stratos/cli/utils/RowMapper.java |  34 +-
 88 files changed, 2592 insertions(+), 2583 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/assembly/src.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/assembly/src.xml b/components/org.apache.stratos.cli/src/main/assembly/src.xml
index cfaa4da..3901d63 100644
--- a/components/org.apache.stratos.cli/src/main/assembly/src.xml
+++ b/components/org.apache.stratos.cli/src/main/assembly/src.xml
@@ -17,20 +17,20 @@
        under the License.
  -->
 <assembly
-	xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
-	<id>bin</id>
-	<formats>
-		<format>jar</format>
-	</formats>
-	<includeBaseDirectory>false</includeBaseDirectory>
-	<dependencySets>
-		<dependencySet>
-			<outputDirectory>/</outputDirectory>
-			<useProjectArtifact>true</useProjectArtifact>
-			<unpack>true</unpack>
-			<scope>runtime</scope>
-		</dependencySet>
-	</dependencySets>
+        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+    <id>bin</id>
+    <formats>
+        <format>jar</format>
+    </formats>
+    <includeBaseDirectory>false</includeBaseDirectory>
+    <dependencySets>
+        <dependencySet>
+            <outputDirectory>/</outputDirectory>
+            <useProjectArtifact>true</useProjectArtifact>
+            <unpack>true</unpack>
+            <scope>runtime</scope>
+        </dependencySet>
+    </dependencySets>
 </assembly>

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CliTool.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CliTool.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CliTool.java
index 2175abf..52a99ea 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CliTool.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CliTool.java
@@ -1,20 +1,20 @@
 /**
- *  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.
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
 
@@ -30,37 +30,37 @@ import org.slf4j.LoggerFactory;
  */
 public class CliTool {
 
-	private static final Logger log = LoggerFactory.getLogger(CliTool.class);
+    private static final Logger log = LoggerFactory.getLogger(CliTool.class);
 
-	/**
-	 * Here is the place all the command line inputs get processed
-	 * 
-	 * @param arguments
-	 *            passed to CLI tool.
-	 */
-	void handleConsoleInputs(String[] arguments) {
-		if (log.isInfoEnabled()) {
-			log.info("Stratos CLI started...");
-		}
-		StratosApplication application = new StratosApplication(arguments);
-		application.start(arguments);
-	}
+    /**
+     * Here is the place all the command line inputs get processed
+     *
+     * @param arguments
+     *            passed to CLI tool.
+     */
+    void handleConsoleInputs(String[] arguments) {
+        if (log.isInfoEnabled()) {
+            log.info("Stratos CLI started...");
+        }
+        StratosApplication application = new StratosApplication(arguments);
+        application.start(arguments);
+    }
 
-	void createConfigDirectory() {
-		File stratosFile = new File(System.getProperty("user.home"), STRATOS_DIR);
-		if (stratosFile.exists()) {
-			if (log.isInfoEnabled()) {
-				log.info("Using directory: {}", stratosFile.getPath());
-			}
-		} else {
-			if (stratosFile.mkdir()) {
-				if (log.isInfoEnabled()) {
-					log.info("Created directory: {}", stratosFile.getPath());
-				}
-			} else if (log.isWarnEnabled()) {
-				log.warn("Failed to created directory: {}", stratosFile.getPath());
-			}
-		}
-	}
+    void createConfigDirectory() {
+        File stratosFile = new File(System.getProperty("user.home"), STRATOS_DIR);
+        if (stratosFile.exists()) {
+            if (log.isInfoEnabled()) {
+                log.info("Using directory: {}", stratosFile.getPath());
+            }
+        } else {
+            if (stratosFile.mkdir()) {
+                if (log.isInfoEnabled()) {
+                    log.info("Created directory: {}", stratosFile.getPath());
+                }
+            } else if (log.isWarnEnabled()) {
+                log.warn("Failed to created directory: {}", stratosFile.getPath());
+            }
+        }
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/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 f84f452..4877090 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
@@ -1,20 +1,20 @@
 /**
- *  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.
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
 
@@ -24,47 +24,47 @@ import org.apache.stratos.cli.exception.CommandException;
 
 public interface Command<T extends CommandContext> {
 
-	/**
-	 * @return The name of the command
-	 */
-	String getName();
+    /**
+     * @return The name of the command
+     */
+    String getName();
 
-	/**
-	 * Information about the command
-	 * 
-	 * @return The description of the command
-	 */
-	String getDescription();
+    /**
+     * Information about the command
+     *
+     * @return The description of the command
+     */
+    String getDescription();
 
-	/**
-	 * This should return the syntax required for the command.
-	 * 
-	 * Used to display help.
-	 * 
-	 * @return The syntax for this command
-	 */
-	String getArgumentSyntax();
+    /**
+     * This should return the syntax required for the command.
+     *
+     * Used to display help.
+     *
+     * @return The syntax for this command
+     */
+    String getArgumentSyntax();
 
-	/**
-	 * The options accepted by the command
-	 * 
-	 * @return The Options for the commands
-	 */
-	Options getOptions();
+    /**
+     * The options accepted by the command
+     *
+     * @return The Options for the commands
+     */
+    Options getOptions();
 
-	/**
-	 * Executing the commands. Returns a code
-	 * 
-	 * @param context
-	 *            The context assoicated with the Command Line Application
-	 * @param args
-	 *            The arguments for the command
-	 * @param alreadyParsedOpts
-	 *            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(T context, String[] args, Option[] alreadyParsedOpts) throws CommandException;
+    /**
+     * Executing the commands. Returns a code
+     *
+     * @param context
+     *            The context assoicated with the Command Line Application
+     * @param args
+     *            The arguments for the command
+     * @param alreadyParsedOpts
+     *            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(T context, String[] args, Option[] alreadyParsedOpts) throws CommandException;
 
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandContext.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandContext.java
index cf677c4..01ad547 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandContext.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandContext.java
@@ -1,20 +1,20 @@
 /**
- *  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.
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
 
@@ -24,65 +24,65 @@ import java.util.Observable;
 
 public class CommandContext extends Observable {
 
-	/**
-	 * Properties for the context.
-	 */
-	private Map<String, Object> properties;
+    /**
+     * Properties for the context.
+     */
+    private Map<String, Object> properties;
 
-	/**
-	 * The application
-	 */
-	private final CommandLineApplication<? extends CommandContext> application;
+    /**
+     * The application
+     */
+    private final CommandLineApplication<? extends CommandContext> application;
 
-	public CommandContext(CommandLineApplication<? extends CommandContext> application) {
-		properties = new HashMap<String, Object>();
-		this.application = application;
-	}
+    public CommandContext(CommandLineApplication<? extends CommandContext> application) {
+        properties = new HashMap<String, Object>();
+        this.application = application;
+    }
 
-	public final CommandLineApplication<? extends CommandContext> getApplication() {
-		return application;
-	}
+    public final CommandLineApplication<? extends CommandContext> getApplication() {
+        return application;
+    }
 
-	/**
-	 * Set property in the context
-	 * 
-	 * @param key
-	 *            The key
-	 * @param o
-	 *            The value for the key
-	 * @return The previous value or null
-	 */
-	public Object put(String key, Object o) {
-		Object previous = properties.put(key, o);
-		setChanged();
-		notifyObservers();
-		return previous;
-	}
+    /**
+     * Set property in the context
+     *
+     * @param key
+     *            The key
+     * @param o
+     *            The value for the key
+     * @return The previous value or null
+     */
+    public Object put(String key, Object o) {
+        Object previous = properties.put(key, o);
+        setChanged();
+        notifyObservers();
+        return previous;
+    }
 
-	/**
-	 * Get property value from the context
-	 * 
-	 * @param key
-	 *            The key
-	 * @return The value
-	 */
-	public Object getObject(String key) {
-		return properties.get(key);
-	}
+    /**
+     * Get property value from the context
+     *
+     * @param key
+     *            The key
+     * @return The value
+     */
+    public Object getObject(String key) {
+        return properties.get(key);
+    }
 
-	/**
-	 * Get the string value, or null
-	 * 
-	 * @param key
-	 *            The key
-	 * @return The string value, or null.
-	 */
-	public String getString(String key) {
-		Object o = getObject(key);
-		if (o instanceof String) {
-			return (String) o;
-		}
-		return null;
-	}
+    /**
+     * Get the string value, or null
+     *
+     * @param key
+     *            The key
+     * @return The string value, or null.
+     */
+    public String getString(String key) {
+        Object o = getObject(key);
+        if (o instanceof String) {
+            return (String) o;
+        }
+        return null;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java
index 44abad7..142f42f 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineApplication.java
@@ -1,20 +1,20 @@
 /**
- *  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.
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
 
@@ -30,13 +30,13 @@ import java.io.IOException;
 
 public abstract class CommandLineApplication<T extends CommandContext> {
 
-	private static final Logger log = LoggerFactory.getLogger(CommandLineApplication.class);
+    private static final Logger log = LoggerFactory.getLogger(CommandLineApplication.class);
 
-	protected ConsoleReader reader;
-	protected FileHistory history;
+    protected ConsoleReader reader;
+    protected FileHistory history;
     protected String username;
 
-	public CommandLineApplication(String[] args) {
+    public CommandLineApplication(String[] args) {
         if (args != null && args.length > 1) {
             username = args[1];
         }
@@ -44,22 +44,22 @@ public abstract class CommandLineApplication<T extends CommandContext> {
     }
 
     /**
-	 * Creates new jline ConsoleReader.
-	 * 
-	 * @return a jline ConsoleReader instance
-	 */
-	protected ConsoleReader createConsoleReader() {
-		ConsoleReader consoleReader = null;
-		try {
-			consoleReader = new ConsoleReader();
-			consoleReader.setPrompt(getPrompt());
-			history = new FileHistory(getHistoryFile(username));
-			consoleReader.setHistory(history);
-		} catch (IOException e) {
-			throw new IllegalStateException("Cannot create jline console reader", e);
-		}
-		return consoleReader;
-	}
+     * Creates new jline ConsoleReader.
+     *
+     * @return a jline ConsoleReader instance
+     */
+    protected ConsoleReader createConsoleReader() {
+        ConsoleReader consoleReader = null;
+        try {
+            consoleReader = new ConsoleReader();
+            consoleReader.setPrompt(getPrompt());
+            history = new FileHistory(getHistoryFile(username));
+            consoleReader.setHistory(history);
+        } catch (IOException e) {
+            throw new IllegalStateException("Cannot create jline console reader", e);
+        }
+        return consoleReader;
+    }
 
     protected ConsoleReader createConsoleReaderWhithoutArgs(String enteredUserName) {
         ConsoleReader consoleReader = null;
@@ -75,133 +75,135 @@ public abstract class CommandLineApplication<T extends CommandContext> {
         return consoleReader;
     }
 
-	public ConsoleReader getConsoleReader() {
-		return reader;
-	}
-
-	protected abstract String getPrompt();
-
-	/**
-	 * Get the history file for the Console Reader.
-	 * 
-	 * @return File for storing history
-	 */
-	protected abstract File getHistoryFile(String username);
-
-	public final void start(String[] args) {
-		Thread shutdownHookThread = new Thread("CLI Shutdown Hook") {
-			@Override
-			public void run() {
-				performDestroy();
-			}
-		};
-		Runtime.getRuntime().addShutdownHook(shutdownHookThread);
-		int returnCode = run(args);
-		if (log.isDebugEnabled()) {
-			log.debug("Exiting with error code {}", returnCode);
-		}
-		System.exit(returnCode);
-	}
-
-	protected abstract int run(String[] args);
-
-	protected void promptLoop() {
-		String line = null;
-		boolean exit = false;
-
-		try {
-			while (!exit && (reader != null && ((line = reader.readLine()) != null))) {
-				if ("".equals(line)) {
-					continue;
-				}
-				if (StringUtils.isNotBlank(line)) {
-					execute(line);
-					exit = CliConstants.EXIT_ACTION.equals(line.trim());
-				}
-			}
-		} catch (IOException e) {
-			throw new IllegalStateException("Error in reading line", e);
-		}
-	}
-
-	private int execute(String line) {
-		try {
-			if (log.isDebugEnabled()) {
-				log.debug("Executing command line: \"{}\"", line);
-			}
-			int returnCode = executeCommand(line);
-			if (log.isDebugEnabled()) {
-				log.debug("Command line executed \"{}\". Return code: {}", line, returnCode);
-			}
-			return returnCode;
-		} catch (RuntimeException e) {
-			if (log.isErrorEnabled()) {
-				log.error("Error executing command line: " + line, e);
-			}
-			return 1;
-		}
-	}
-
-	protected abstract int executeCommand(String line);
-
-	private void performDestroy() {
-		if (log.isDebugEnabled()) {
-			log.debug("Shutting down application... Invoking destroy methods");
-		}
-		if (history != null) {
-			try {
-				history.flush();
-			} catch (IOException e) {
-				if (log.isErrorEnabled()) {
-					log.error("Error flushing history.", e);
-				}
-			}
-		}
-		destroy();
-	}
-
-	/**
-	 * May override to perform action before destroying
-	 */
-	protected void destroy() {
-	};
-
-	public String getInput(String prompt) {
-		return getInput(prompt, null);
-	}
-
-	public String getInput(String prompt, Character mask) {
-		String line = null;
-		try {
-			reader.setPrompt(prompt + ": ");
-			while ((line = reader.readLine(mask)) != null) {
-				if ("".equals(line)) {
-					continue;
-				}
-				return line;
-			}
-		} catch (IOException e) {
-			throw new IllegalStateException("Error in reading line", e);
-		} finally {
-			reader.setPrompt(CliConstants.STRATOS_SHELL_PROMPT);
-		}
-		return line;
-	}
-	
-	/**
-	 * @return {@code true if user confirmed}
-	 */
-	public boolean getConfirmation(String prompt) {
-		prompt = prompt + " [yes/no]";
-
-		String input = "";
-		int tries = 0;
-		do {
-			tries++;
-			input = getInput(prompt);
-		} while (!"y".equals(input) && !"yes".equals(input) && !"n".equals(input) && !"no".equals(input) && tries < 3);
-
-		return "y".equals(input) || "yes".equals(input);
-	}
+    public ConsoleReader getConsoleReader() {
+        return reader;
+    }
+
+    protected abstract String getPrompt();
+
+    /**
+     * Get the history file for the Console Reader.
+     *
+     * @return File for storing history
+     */
+    protected abstract File getHistoryFile(String username);
+
+    public final void start(String[] args) {
+        Thread shutdownHookThread = new Thread("CLI Shutdown Hook") {
+            @Override
+            public void run() {
+                performDestroy();
+            }
+        };
+        Runtime.getRuntime().addShutdownHook(shutdownHookThread);
+        int returnCode = run(args);
+        if (log.isDebugEnabled()) {
+            log.debug("Exiting with error code {}", returnCode);
+        }
+        System.exit(returnCode);
+    }
+
+    protected abstract int run(String[] args);
+
+    protected void promptLoop() {
+        String line = null;
+        boolean exit = false;
+
+        try {
+            while (!exit && (reader != null && ((line = reader.readLine()) != null))) {
+                if ("".equals(line)) {
+                    continue;
+                }
+                if (StringUtils.isNotBlank(line)) {
+                    execute(line);
+                    exit = CliConstants.EXIT_ACTION.equals(line.trim());
+                }
+            }
+        } catch (IOException e) {
+            throw new IllegalStateException("Error in reading line", e);
+        }
+    }
+
+    private int execute(String line) {
+        try {
+            if (log.isDebugEnabled()) {
+                log.debug("Executing command line: \"{}\"", line);
+            }
+            int returnCode = executeCommand(line);
+            if (log.isDebugEnabled()) {
+                log.debug("Command line executed \"{}\". Return code: {}", line, returnCode);
+            }
+            return returnCode;
+        } catch (RuntimeException e) {
+            if (log.isErrorEnabled()) {
+                log.error("Error executing command line: " + line, e);
+            }
+            return 1;
+        }
+    }
+
+    protected abstract int executeCommand(String line);
+
+    private void performDestroy() {
+        if (log.isDebugEnabled()) {
+            log.debug("Shutting down application... Invoking destroy methods");
+        }
+        if (history != null) {
+            try {
+                history.flush();
+            } catch (IOException e) {
+                if (log.isErrorEnabled()) {
+                    log.error("Error flushing history.", e);
+                }
+            }
+        }
+        destroy();
+    }
+
+    /**
+     * May override to perform action before destroying
+     */
+    protected void destroy() {
+    }
+
+    ;
+
+    public String getInput(String prompt) {
+        return getInput(prompt, null);
+    }
+
+    public String getInput(String prompt, Character mask) {
+        String line = null;
+        try {
+            reader.setPrompt(prompt + ": ");
+            while ((line = reader.readLine(mask)) != null) {
+                if ("".equals(line)) {
+                    continue;
+                }
+                return line;
+            }
+        } catch (IOException e) {
+            throw new IllegalStateException("Error in reading line", e);
+        } finally {
+            reader.setPrompt(CliConstants.STRATOS_SHELL_PROMPT);
+        }
+        return line;
+    }
+
+    /**
+     * @return {@code true if user confirmed}
+     */
+    public boolean getConfirmation(String prompt) {
+        prompt = prompt + " [yes/no]";
+
+        String input = "";
+        int tries = 0;
+        do {
+            tries++;
+            input = getInput(prompt);
+        } while (!"y".equals(input) && !"yes".equals(input) && !"n".equals(input) && !"no".equals(input) && tries < 3);
+
+        return "y".equals(input) || "yes".equals(input);
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java
index fcdaf79..e6c86f2 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/CommandLineService.java
@@ -1,20 +1,20 @@
 /**
- *  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.
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
 
@@ -40,27 +40,27 @@ import java.util.HashMap;
 
 public class CommandLineService {
 
-	private static final Logger log = LoggerFactory.getLogger(CommandLineService.class);
+    private static final Logger log = LoggerFactory.getLogger(CommandLineService.class);
+
+    private ApplicationManagementServiceStub stub;
 
-	private ApplicationManagementServiceStub stub;
+    private CommandLineService() {
+    }
 
-	private CommandLineService() {
-	}
+    private static class SingletonHolder {
+        private final static CommandLineService INSTANCE = new CommandLineService();
+    }
 
-	private static class SingletonHolder {
-		private final static CommandLineService INSTANCE = new CommandLineService();
-	}
+    public static CommandLineService getInstance() {
+        return SingletonHolder.INSTANCE;
+    }
 
-	public static CommandLineService getInstance() {
-		return SingletonHolder.INSTANCE;
-	}
-	
-	private void initializeApplicationManagementStub(String serverURL, String username, String password) throws AxisFault {
-		HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
+    private void initializeApplicationManagementStub(String serverURL, String username, String password) throws AxisFault {
+        HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
         authenticator.setUsername(username);
         authenticator.setPassword(password);
         authenticator.setPreemptiveAuthentication(true);
-		
+
         ApplicationManagementServiceStub stub;
         ConfigurationContext configurationContext = null;
         try {
@@ -83,62 +83,62 @@ public class CommandLineService {
         this.stub = stub;
     }
 
-	public boolean login(String serverURL, String username, String password, boolean validateLogin) throws CommandException {
-		try {
-			// Following code will avoid validating certificate
-			SSLContext sc;
-			// Get SSL context
-			sc = SSLContext.getInstance("SSL");
-			// Create empty HostnameVerifier
-			HostnameVerifier hv = new HostnameVerifier() {
-				public boolean verify(String urlHostName, SSLSession session) {
-					return true;
-				}
-			};
-			// Create a trust manager that does not validate certificate
-			// chains
-			TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() {
-				public java.security.cert.X509Certificate[] getAcceptedIssuers() {
-					return null;
-				}
+    public boolean login(String serverURL, String username, String password, boolean validateLogin) throws CommandException {
+        try {
+            // Following code will avoid validating certificate
+            SSLContext sc;
+            // Get SSL context
+            sc = SSLContext.getInstance("SSL");
+            // Create empty HostnameVerifier
+            HostnameVerifier hv = new HostnameVerifier() {
+                public boolean verify(String urlHostName, SSLSession session) {
+                    return true;
+                }
+            };
+            // Create a trust manager that does not validate certificate
+            // chains
+            TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
+                public java.security.cert.X509Certificate[] getAcceptedIssuers() {
+                    return null;
+                }
+
+                public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
+                }
 
-				public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) {
-				}
+                public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
+                }
+            }};
+            sc.init(null, trustAllCerts, new java.security.SecureRandom());
+            SSLContext.setDefault(sc);
+            HttpsURLConnection.setDefaultHostnameVerifier(hv);
+        } catch (Exception e) {
+            throw new RuntimeException("Error while authentication process!", e);
+        }
 
-				public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) {
-				}
-			} };
-			sc.init(null, trustAllCerts, new java.security.SecureRandom());
-			SSLContext.setDefault(sc);
-			HttpsURLConnection.setDefaultHostnameVerifier(hv);
-		} catch (Exception e) {
-			throw new RuntimeException("Error while authentication process!", e);
-		}
+        // Initialize Service Stub
+        try {
+            initializeApplicationManagementStub(serverURL, username, password);
+        } catch (AxisFault e) {
+            System.out.println("Error connecting to the back-end");
+            throw new CommandException(e);
+        }
 
-		// Initialize Service Stub
-		try {
-			initializeApplicationManagementStub(serverURL, username, password);
-		} catch (AxisFault e) {
-			System.out.println("Error connecting to the back-end");
-			throw new CommandException(e);
-		}
-		
-		try {
-			if (validateLogin) {
-				String tenantDomain = stub.getTenantDomain();
-				if (log.isDebugEnabled()) {
-					log.debug("Tenant Domain {}", tenantDomain);
-				}
-				return (tenantDomain != null);
-			} else {
-				// Just return true as we don't need to validate
-				return true;
-			}
-		} catch (RemoteException e) {
-			System.out.println("Authentication failed!");
-			throw new CommandException(e);
-		}
-	}
+        try {
+            if (validateLogin) {
+                String tenantDomain = stub.getTenantDomain();
+                if (log.isDebugEnabled()) {
+                    log.debug("Tenant Domain {}", tenantDomain);
+                }
+                return (tenantDomain != null);
+            } else {
+                // Just return true as we don't need to validate
+                return true;
+            }
+        } catch (RemoteException e) {
+            System.out.println("Authentication failed!");
+            throw new CommandException(e);
+        }
+    }
 
 //	public void listSubscribedCartridges(final boolean full) throws CommandException {
 //		try {
@@ -240,7 +240,7 @@ public class CommandLineService {
 //			handleException(e);
 //		}
 //	}
-	
+
 //	public void listAvailablePolicies() throws CommandException {
 //		try {
 //			PolicyDefinition[] policies = stub.getPolicyDefinitions();
@@ -320,64 +320,64 @@ public class CommandLineService {
 //        }
 //	}
 
-	public void unsubscribe(String alias) throws CommandException {
-		try {
-			stub.unsubscribe(alias);
-			System.out.println("You have successfully unsubscribed " + alias);
+    public void unsubscribe(String alias) throws CommandException {
+        try {
+            stub.unsubscribe(alias);
+            System.out.println("You have successfully unsubscribed " + alias);
         } catch (ApplicationManagementServiceADCExceptionException e) {
-        	handleException("cannot.unsubscribe", e);
+            handleException("cannot.unsubscribe", e);
         } catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
-			handleException("notsubscribed.error", e, alias);
+            handleException("notsubscribed.error", e, alias);
+        } catch (RemoteException e) {
+            handleException(e);
+        }
+    }
+
+    public void sync(String alias) throws CommandException {
+        try {
+            System.out.format("Synchronizing repository for alias: %s%n", alias);
+            stub.synchronizeRepository(alias);
+        } catch (ApplicationManagementServiceADCExceptionException e) {
+            handleException("cannot.syncrepo", e);
         } catch (RemoteException e) {
-        	handleException(e);
+            handleException(e);
+        } catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
+            handleException("notsubscribed.error", e, alias);
         }
-	}
+    }
 
-	public void sync(String alias) throws CommandException {
-		try {
-			System.out.format("Synchronizing repository for alias: %s%n", alias);
-			stub.synchronizeRepository(alias);
-		} catch (ApplicationManagementServiceADCExceptionException e) {
-			handleException("cannot.syncrepo", e);
-		} catch (RemoteException e) {
-			handleException(e);
-		} catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
-			handleException("notsubscribed.error", e, alias);
-		}
-	}
+    public String addDomainMapping(String domain, String alias) throws CommandException {
+        try {
+            return stub.addDomainMapping(domain, alias);
+        } catch (ApplicationManagementServiceADCExceptionException e) {
+            handleException("cannot.mapdomain", e);
+        } catch (RemoteException e) {
+            handleException(e);
+        } catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
+            handleException("notsubscribed.error", e, alias);
+        } catch (ApplicationManagementServiceDomainMappingExistsExceptionException e) {
+            handleException("domainmapping.exists.error", e, domain, alias);
+        }
+        return null;
+    }
 
-	public String addDomainMapping(String domain, String alias) throws CommandException {
-		try {
-			return stub.addDomainMapping(domain, alias);
-		} catch (ApplicationManagementServiceADCExceptionException e) {
-			handleException("cannot.mapdomain", e);
-		} catch (RemoteException e) {
-			handleException(e);
-		} catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
-			handleException("notsubscribed.error", e, alias);
-		} catch (ApplicationManagementServiceDomainMappingExistsExceptionException e) {
-			handleException("domainmapping.exists.error", e, domain, alias);
-		}
-		return null;
-	}
+    public void removeDomainMapping(String alias) throws CommandException {
+        try {
+            stub.removeDomainMapping(alias);
+            System.out.format("Domain mapping removed for alias: %s.%n", alias);
+        } catch (ApplicationManagementServiceADCExceptionException e) {
+            handleException("cannot.removedomain", e);
+        } catch (RemoteException e) {
+            handleException(e);
+        } catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
+            handleException("notsubscribed.error", e, alias);
+        }
+    }
 
-	public void removeDomainMapping(String alias) throws CommandException {
-		try {
-			stub.removeDomainMapping(alias);
-			System.out.format("Domain mapping removed for alias: %s.%n", alias);
-		} catch (ApplicationManagementServiceADCExceptionException e) {
-			handleException("cannot.removedomain", e);
-		} catch (RemoteException e) {
-			handleException(e);
-		} catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
-			handleException("notsubscribed.error", e, alias);
-		}
-	}
+    public void subscribe(String cartridgeType, String alias, String policy, String externalRepoURL,
+                          boolean privateRepo, String username, String password, String dataCartridgeType, String dataCartridgeAlias)
+            throws CommandException {
 
-	public void subscribe(String cartridgeType, String alias, String policy, String externalRepoURL,
-			boolean privateRepo, String username, String password, String dataCartridgeType, String dataCartridgeAlias)
-			throws CommandException {
-		
 //		SubscriptionInfo subcriptionConnectInfo = null;
 //		if (StringUtils.isNotBlank(dataCartridgeType) && StringUtils.isNotBlank(dataCartridgeAlias)) {
 //			System.out.format("Subscribing to data cartridge %s with alias %s.%n", dataCartridgeType,
@@ -476,7 +476,7 @@ public class CommandLineService {
 //		} catch (ApplicationManagementServiceNotSubscribedExceptionException e) {
 //			handleException("notsubscribed.error", e, alias);
 //		}
-	}
+    }
 
 //	private String getAccessURLs(Cartridge cartridge) {
 //		String[] accessURLs = cartridge.getAccessURLs();
@@ -495,28 +495,28 @@ public class CommandLineService {
 //		return urlBuilder.toString();
 //	}
 
-	private void handleException(Exception e) throws CommandException {
-		if (log.isDebugEnabled()) {
-			log.debug("Displaying message from Exception {}\n{}", e.getClass(), e.getMessage());
-		}
-		// TODO: Fix handling error message.
-		// Sometimes the Axis2 stub throws only the RemoteException (an
-		// AxisFault)
-		// So, other exceptions won't come here.
-		String message = e.getMessage();
-		if (message == null || (message != null && message.contains("Exception"))) {
-			message = "Error executing command!";
-		}
-		log.error(message);
-		System.out.println(message);
-		throw new CommandException(message, e);
-	}
-    
+    private void handleException(Exception e) throws CommandException {
+        if (log.isDebugEnabled()) {
+            log.debug("Displaying message from Exception {}\n{}", e.getClass(), e.getMessage());
+        }
+        // TODO: Fix handling error message.
+        // Sometimes the Axis2 stub throws only the RemoteException (an
+        // AxisFault)
+        // So, other exceptions won't come here.
+        String message = e.getMessage();
+        if (message == null || (message != null && message.contains("Exception"))) {
+            message = "Error executing command!";
+        }
+        log.error(message);
+        System.out.println(message);
+        throw new CommandException(message, e);
+    }
+
     private void handleException(String key, Exception e, Object... args) throws CommandException {
-    	if (log.isDebugEnabled()) {
-    		log.debug("Displaying message for {}. Exception thrown is {}", key, e.getClass());
-    	}
-    	String message = CliUtils.getMessage(key, args);
+        if (log.isDebugEnabled()) {
+            log.debug("Displaying message for {}. Exception thrown is {}", key, e.getClass());
+        }
+        String message = CliUtils.getMessage(key, args);
         log.error(message);
         System.out.println(message);
         throw new CommandException(message, e);

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/GenericRestClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/GenericRestClient.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/GenericRestClient.java
index 0c87c19..497c863 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/GenericRestClient.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/GenericRestClient.java
@@ -1,20 +1,20 @@
 /**
- *  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.
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Main.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Main.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Main.java
index d14ee07..887c1f7 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Main.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/Main.java
@@ -25,7 +25,6 @@ package org.apache.stratos.cli;
 public class Main {
     /**
      * Main executable method used to call from CLI.
-     *
      */
     public static void main(final String[] args) {
         CliTool cliTool = new CliTool();

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/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 c022804..439544b 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
@@ -42,7 +42,7 @@ import java.lang.reflect.Type;
  * 1. doPost, doPut, doGet, doDelete
  * 2. deployEntity, updateEntity, getEntity, listEntity, deleteEntity
  * 3. executePost, executePut, executeGet, executeDelete
- *
+ * <p/>
  * All the status code handling happens at category #2
  */
 public class RestClient implements GenericRestClient {

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/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 8e891b2..7112fa1 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
@@ -1,20 +1,20 @@
 /**
- *  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.
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
 
@@ -85,7 +85,7 @@ public class RestCommandLineService {
     private static final String ENDPOINT_DEPLOY_APPLICATION = API_CONTEXT + "/applications/{applicationId}/deploy/{applicationPolicyId}";
     private static final String ENDPOINT_DEPLOY_NETWORK_PARTITION = API_CONTEXT + "/networkPartitions";
 
-    private static final String ENDPOINT_UNDEPLOY_KUBERNETES_CLUSTER= API_CONTEXT + "/kubernetesClusters/{id}";
+    private static final String ENDPOINT_UNDEPLOY_KUBERNETES_CLUSTER = API_CONTEXT + "/kubernetesClusters/{id}";
     private static final String ENDPOINT_UNDEPLOY_KUBERNETES_HOST = API_CONTEXT + "/kubernetesClusters/{kubernetesClusterId}/hosts/{id}";
     private static final String ENDPOINT_UNDEPLOY_SERVICE_GROUP = API_CONTEXT + "/cartridgeGroups/{id}";
     private static final String ENDPOINT_UNDEPLOY_APPLICATION = API_CONTEXT + "/applications/{id}/undeploy";
@@ -315,10 +315,10 @@ public class RestCommandLineService {
         try {
             Type listType = new TypeToken<ArrayList<CartridgeBean>>() {
             }.getType();
-            List<CartridgeBean> cartridgeList = (List<CartridgeBean>) restClient.listEntity(ENDPOINT_LIST_CARTRIDGES_BY_FILTER.replace("{filter}",filter),
+            List<CartridgeBean> cartridgeList = (List<CartridgeBean>) restClient.listEntity(ENDPOINT_LIST_CARTRIDGES_BY_FILTER.replace("{filter}", filter),
                     listType, "cartridges");
 
-            System.out.println("Test:"+ENDPOINT_LIST_CARTRIDGES_BY_FILTER.replace("{filter}",filter));
+            System.out.println("Test:" + ENDPOINT_LIST_CARTRIDGES_BY_FILTER.replace("{filter}", filter));
 
             if ((cartridgeList == null) || (cartridgeList.size() == 0)) {
                 System.out.println("No cartridges found");
@@ -371,7 +371,7 @@ public class RestCommandLineService {
                 public String[] getData(GroupBean cartridgeGroup) {
                     String[] data = new String[3];
                     data[0] = cartridgeGroup.getName();
-                    data[1] = cartridgeGroup.getCartridges()==null ? "" :String.valueOf(cartridgeGroup.getCartridges().size());
+                    data[1] = cartridgeGroup.getCartridges() == null ? "" : String.valueOf(cartridgeGroup.getCartridges().size());
                     data[2] = cartridgeGroup.getGroups() == null ? "0" : String.valueOf(cartridgeGroup.getGroups().size());
                     return data;
                 }
@@ -386,6 +386,7 @@ public class RestCommandLineService {
             printError(message, e);
         }
     }
+
     /**
      * Describe a cartridge
      * @param cartridgeType Type of the cartridge
@@ -400,8 +401,8 @@ public class RestCommandLineService {
                     listType, "cartridges");
 
             CartridgeBean cartridge = null;
-            for(CartridgeBean item : cartridgeList) {
-                if(item.getType().equals(cartridgeType)) {
+            for (CartridgeBean item : cartridgeList) {
+                if (item.getType().equals(cartridgeType)) {
                     cartridge = item;
                     break;
                 }
@@ -423,7 +424,7 @@ public class RestCommandLineService {
             System.out.println("Multi-Tenant: " + cartridge.isMultiTenant());
             System.out.println("Hostname: " + cartridge.getHost());
 
-            if(cartridge.getIaasProvider() != null) {
+            if (cartridge.getIaasProvider() != null) {
                 RowMapper<IaasProviderBean> cartridgeMapper = new RowMapper<IaasProviderBean>() {
                     public String[] getData(IaasProviderBean row) {
                         String[] data = new String[4];
@@ -517,8 +518,8 @@ public class RestCommandLineService {
                     listType, "tenant");
 
             TenantInfoBean tenant = null;
-            for(TenantInfoBean item : tenantList) {
-                if(item.getTenantDomain().equals(domainName)) {
+            for (TenantInfoBean item : tenantList) {
+                if (item.getTenantDomain().equals(domainName)) {
                     tenant = item;
                     break;
                 }
@@ -553,7 +554,7 @@ public class RestCommandLineService {
         try {
             Type listType = new TypeToken<ArrayList<TenantInfoBean>>() {
             }.getType();
-            List<TenantInfoBean> tenantList = (List<TenantInfoBean>) restClient.listEntity(ENDPOINT_LIST_TENANTS_BY_PARTIAL_DOMAIN.replace("{tenantDomain}",partialDomain),
+            List<TenantInfoBean> tenantList = (List<TenantInfoBean>) restClient.listEntity(ENDPOINT_LIST_TENANTS_BY_PARTIAL_DOMAIN.replace("{tenantDomain}", partialDomain),
                     listType, "tenants");
 
             if ((tenantList == null) || (tenantList.size() == 0)) {
@@ -595,7 +596,7 @@ public class RestCommandLineService {
      * @param email email
      * @throws CommandException
      */
-    public void updateTenant(int id,String admin, String firstName, String lastName, String password, String domain, String email)
+    public void updateTenant(int id, String admin, String firstName, String lastName, String password, String domain, String email)
             throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
@@ -620,10 +621,10 @@ public class RestCommandLineService {
             if (responseCode < 200 || responseCode >= 300) {
                 CliUtils.printError(response);
             } else {
-                System.out.println("Tenant updated successfully: "+domain);
+                System.out.println("Tenant updated successfully: " + domain);
             }
         } catch (Exception e) {
-            String message = "Could not update tenant: "+domain;
+            String message = "Could not update tenant: " + domain;
             printError(message, e);
         } finally {
             httpClient.getConnectionManager().shutdown();
@@ -712,10 +713,10 @@ public class RestCommandLineService {
             if (responseCode < 200 || responseCode >= 300) {
                 CliUtils.printError(response);
             } else {
-                System.out.println("User updated successfully: "+userName);
+                System.out.println("User updated successfully: " + userName);
             }
         } catch (Exception e) {
-            String message = "Could not update user: "+userName;
+            String message = "Could not update user: " + userName;
             printError(message, e);
         } finally {
             httpClient.getConnectionManager().shutdown();
@@ -803,7 +804,7 @@ public class RestCommandLineService {
             Gson gson = gsonBuilder.create();
 
             if (responseCode.equals(CliConstants.RESPONSE_OK)) {
-                System.out.println("You have successfully deactivated the tenant: " + tenantDomain );
+                System.out.println("You have successfully deactivated the tenant: " + tenantDomain);
                 return;
             } else {
                 String resultString = CliUtils.getHttpResponseString(response);
@@ -859,7 +860,7 @@ public class RestCommandLineService {
         try {
             Type listType = new TypeToken<ArrayList<TenantInfoBean>>() {
             }.getType();
-            List<TenantInfoBean> tenantInfoList = (List<TenantInfoBean>)restClient.listEntity(ENDPOINT_LIST_TENANTS,
+            List<TenantInfoBean> tenantInfoList = (List<TenantInfoBean>) restClient.listEntity(ENDPOINT_LIST_TENANTS,
                     listType, "tenants");
 
             if ((tenantInfoList == null) || (tenantInfoList.size() == 0)) {
@@ -1001,7 +1002,7 @@ public class RestCommandLineService {
             array = list.toArray(array);
 
             System.out.println("Applications found:");
-            CliUtils.printTable(array, rowMapper, "Application ID","Alias", "Status");
+            CliUtils.printTable(array, rowMapper, "Application ID", "Alias", "Status");
         } catch (Exception e) {
             String message = "Could not list applications";
             printError(message, e);
@@ -1119,7 +1120,7 @@ public class RestCommandLineService {
      * @param entityBody Kubernetes Cluster definition
      * @throws CommandException
      */
-    public void addKubernetesCluster(String entityBody) throws CommandException{
+    public void addKubernetesCluster(String entityBody) throws CommandException {
         restClient.deployEntity(ENDPOINT_DEPLOY_KUBERNETES_CLUSTER, entityBody, "kubernetes cluster");
     }
 
@@ -1127,7 +1128,7 @@ public class RestCommandLineService {
      * List Kubernetes Clusters
      * @throws CommandException
      */
-    public void listKubernetesClusters() throws CommandException{
+    public void listKubernetesClusters() throws CommandException {
         try {
             Type listType = new TypeToken<ArrayList<KubernetesClusterBean>>() {
             }.getType();
@@ -1161,7 +1162,7 @@ public class RestCommandLineService {
      * @param clusterId cluster id
      * @throws CommandException
      */
-    public void undeployKubernetesCluster(String clusterId) throws CommandException{
+    public void undeployKubernetesCluster(String clusterId) throws CommandException {
         restClient.undeployEntity(ENDPOINT_UNDEPLOY_KUBERNETES_CLUSTER, "kubernetes cluster", clusterId);
     }
 
@@ -1203,7 +1204,7 @@ public class RestCommandLineService {
      * @param clusterId cluster id
      * @throws CommandException
      */
-    public void listKubernetesHosts(String clusterId) throws CommandException{
+    public void listKubernetesHosts(String clusterId) throws CommandException {
         try {
             Type listType = new TypeToken<ArrayList<KubernetesHostBean>>() {
             }.getType();
@@ -1297,7 +1298,7 @@ public class RestCommandLineService {
      * @param resourceFileContent domain mapping definition
      * @throws CommandException
      */
-    public void addDomainMappings(String applicationId, String resourceFileContent) throws CommandException{
+    public void addDomainMappings(String applicationId, String resourceFileContent) throws CommandException {
         String endpoint = ENDPOINT_DOMAIN_MAPPINGS.replace("{applicationId}", applicationId);
         restClient.deployEntity(endpoint, resourceFileContent, "domain mappings");
     }
@@ -1307,7 +1308,7 @@ public class RestCommandLineService {
      * @param applicationId application id
      * @throws CommandException
      */
-    public void listDomainMappings(String applicationId) throws CommandException{
+    public void listDomainMappings(String applicationId) throws CommandException {
         try {
             Type listType = new TypeToken<ArrayList<DomainMappingBean>>() {
             }.getType();
@@ -1343,7 +1344,7 @@ public class RestCommandLineService {
      * @param applicationId application id
      * @throws CommandException
      */
-    public void removeDomainMappings(String applicationId) throws CommandException{
+    public void removeDomainMappings(String applicationId) throws CommandException {
         String endpoint = ENDPOINT_DOMAIN_MAPPINGS.replace("{applicationId}", applicationId);
         restClient.undeployEntity(endpoint, "domain mappings", applicationId);
     }
@@ -1354,7 +1355,7 @@ public class RestCommandLineService {
      * @param hostId host id
      * @throws CommandException
      */
-    public void undeployKubernetesHost(String clusterId, String hostId) throws CommandException{
+    public void undeployKubernetesHost(String clusterId, String hostId) throws CommandException {
         restClient.undeployEntity(ENDPOINT_UNDEPLOY_KUBERNETES_HOST.replace("{kubernetesClusterId}", clusterId), "kubernetes host", hostId);
     }
 
@@ -1364,7 +1365,7 @@ public class RestCommandLineService {
      * @param clusterId cluster id
      * @throws CommandException
      */
-    public void updateKubernetesMaster(String entityBody, String clusterId) throws CommandException{
+    public void updateKubernetesMaster(String entityBody, String clusterId) throws CommandException {
         System.out.println(ENDPOINT_UPDATE_KUBERNETES_MASTER.replace("{kubernetesClusterId}", clusterId));
         restClient.updateEntity(ENDPOINT_UPDATE_KUBERNETES_MASTER.replace("{kubernetesClusterId}", clusterId), entityBody, "kubernetes master");
     }
@@ -1376,7 +1377,7 @@ public class RestCommandLineService {
      * @param hostId host id
      * @throws CommandException
      */
-    public void updateKubernetesHost(String entityBody, String clusterId, String hostId) throws CommandException{
+    public void updateKubernetesHost(String entityBody, String clusterId, String hostId) throws CommandException {
         System.out.println((ENDPOINT_UPDATE_KUBERNETES_HOST.replace("{kubernetesClusterId}", clusterId)).replace("{minionId}", hostId));
         restClient.updateEntity((ENDPOINT_UPDATE_KUBERNETES_HOST.replace("{kubernetesClusterId}", clusterId)).replace("{minionId}", hostId), entityBody, "kubernetes host");
     }
@@ -1415,7 +1416,7 @@ public class RestCommandLineService {
      * @param entityBody cartridge group definition
      * @throws CommandException
      */
-    public void addCartridgeGroup(String entityBody) throws CommandException{
+    public void addCartridgeGroup(String entityBody) throws CommandException {
         restClient.deployEntity(ENDPOINT_DEPLOY_SERVICE_GROUP, entityBody, "cartridge group");
     }
 
@@ -1424,7 +1425,7 @@ public class RestCommandLineService {
      * @param groupDefinitionName cartridge group name
      * @throws CommandException
      */
-    public void undeployServiceGroup (String groupDefinitionName) throws CommandException {
+    public void undeployServiceGroup(String groupDefinitionName) throws CommandException {
         restClient.undeployEntity(ENDPOINT_UNDEPLOY_SERVICE_GROUP, "cartridge group", groupDefinitionName);
     }
 
@@ -1433,7 +1434,7 @@ public class RestCommandLineService {
      * @param groupDefinitionName cartridge group name
      * @throws CommandException
      */
-    public void describeServiceGroup (String groupDefinitionName) throws CommandException{
+    public void describeServiceGroup(String groupDefinitionName) throws CommandException {
         try {
             GroupBean bean = (GroupBean) restClient.listEntity(ENDPOINT_LIST_SERVICE_GROUP.replace("{groupDefinitionName}", groupDefinitionName),
                     GroupBean.class, "serviceGroup");
@@ -1456,7 +1457,7 @@ public class RestCommandLineService {
      * @param entityBody application definition
      * @throws CommandException
      */
-    public void addApplication (String entityBody) throws CommandException{
+    public void addApplication(String entityBody) throws CommandException {
         restClient.deployEntity(ENDPOINT_ADD_APPLICATION, entityBody, "application");
     }
 
@@ -1466,10 +1467,10 @@ public class RestCommandLineService {
      * @param applicationPolicyId application policy id
      * @throws CommandException
      */
-    public void deployApplication (String applicationId,String applicationPolicyId) throws CommandException{
+    public void deployApplication(String applicationId, String applicationPolicyId) throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            String url=(ENDPOINT_DEPLOY_APPLICATION.replace("{applicationId}", applicationId)).replace("{applicationPolicyId}",applicationPolicyId);
+            String url = (ENDPOINT_DEPLOY_APPLICATION.replace("{applicationId}", applicationId)).replace("{applicationPolicyId}", applicationPolicyId);
             HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL()
                     + url, "");
 
@@ -1505,7 +1506,7 @@ public class RestCommandLineService {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
             HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL()
-                    + ENDPOINT_UNDEPLOY_APPLICATION.replace("{id}",applicationId), "");
+                    + ENDPOINT_UNDEPLOY_APPLICATION.replace("{id}", applicationId), "");
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -1534,7 +1535,7 @@ public class RestCommandLineService {
      * @throws CommandException
      * This method helps to remove applications
      */
-    public void deleteApplication (String applicationId) throws CommandException{
+    public void deleteApplication(String applicationId) throws CommandException {
         restClient.deleteEntity(ENDPOINT_REMOVE_APPLICATION.replace("{appId}", applicationId), applicationId,
                 "application");
     }
@@ -1544,7 +1545,7 @@ public class RestCommandLineService {
      * @param autoscalingPolicyId  autoscaling policy id
      * @throws CommandException
      */
-    public void deleteAutoSclaingPolicy(String autoscalingPolicyId) throws CommandException{
+    public void deleteAutoSclaingPolicy(String autoscalingPolicyId) throws CommandException {
         restClient.deleteEntity(ENDPOINT_REMOVE_AUTOSCALINGPOLICY.replace("{policyId}", autoscalingPolicyId), autoscalingPolicyId,
                 "Auto-scaling policy");
     }
@@ -1554,7 +1555,7 @@ public class RestCommandLineService {
      * @param applicationId application id
      * @throws CommandException
      */
-    public void describeApplication (String applicationId) throws CommandException{
+    public void describeApplication(String applicationId) throws CommandException {
         try {
             ApplicationBean application = (ApplicationBean) restClient
                     .getEntity(ENDPOINT_GET_APPLICATION, ApplicationBean.class, "{appId}", applicationId,
@@ -1578,7 +1579,7 @@ public class RestCommandLineService {
      * @param applicationId application id
      * @throws CommandException
      */
-    public void describeApplicationRuntime (String applicationId) throws CommandException{
+    public void describeApplicationRuntime(String applicationId) throws CommandException {
         try {
             ApplicationBean application = (ApplicationBean) restClient
                     .getEntity(ENDPOINT_GET_APPLICATION_RUNTIME, ApplicationBean.class, "{applicationId}", applicationId,
@@ -1603,7 +1604,7 @@ public class RestCommandLineService {
      * @param entityBody application signup definition
      * @throws CommandException
      */
-    public void addApplicationSignup (String entityBody, String applicationId) throws CommandException{
+    public void addApplicationSignup(String entityBody, String applicationId) throws CommandException {
         restClient.deployEntity(ENDPOINT_APPLICATION_SIGNUP.replace("{applicationId}", applicationId), entityBody, "application signup");
     }
 
@@ -1612,7 +1613,7 @@ public class RestCommandLineService {
      * @param applicationId application id
      * @throws CommandException
      */
-    public void describeApplicationSignup (String applicationId) throws CommandException{
+    public void describeApplicationSignup(String applicationId) throws CommandException {
         try {
             ApplicationSignUpBean bean = (ApplicationSignUpBean) restClient.listEntity(ENDPOINT_APPLICATION_SIGNUP.replace("{applicationId}", applicationId),
                     ApplicationSignUpBean.class, "applicationSignup");
@@ -1635,7 +1636,7 @@ public class RestCommandLineService {
      * @param applicationId application id
      * @throws CommandException
      */
-    public void deleteApplicationSignup (String applicationId) throws CommandException{
+    public void deleteApplicationSignup(String applicationId) throws CommandException {
         restClient.deleteEntity(ENDPOINT_APPLICATION_SIGNUP.replace("{applicationId}", applicationId), applicationId,
                 "application signup");
     }
@@ -1681,7 +1682,7 @@ public class RestCommandLineService {
      * @param networkPartitionId application id
      * @throws CommandException
      */
-    public void removeNetworkPartition (String networkPartitionId) throws CommandException{
+    public void removeNetworkPartition(String networkPartitionId) throws CommandException {
         restClient.deleteEntity(ENDPOINT_REMOVE_NETWORK_PARTITION.replace("{id}", networkPartitionId), networkPartitionId,
                 "network-partition");
     }
@@ -1706,7 +1707,8 @@ public class RestCommandLineService {
                 public String[] getData(NetworkPartitionBean partition) {
                     String[] data = new String[2];
                     data[0] = partition.getId();
-                    data[1] = String.valueOf(partition.getPartitions().size());;
+                    data[1] = String.valueOf(partition.getPartitions().size());
+                    ;
                     return data;
                 }
             };
@@ -1787,7 +1789,7 @@ public class RestCommandLineService {
      * @param deploymentPolicyId deployment policy definition
      * @throws CommandException
      */
-    public void deleteDeploymentPolicy(String deploymentPolicyId) throws CommandException{
+    public void deleteDeploymentPolicy(String deploymentPolicyId) throws CommandException {
         restClient.deleteEntity(ENDPOINT_REMOVE_DEPLOYMENT_POLICY.replace("{policyId}", deploymentPolicyId), deploymentPolicyId,
                 "deployment policy");
     }
@@ -1860,7 +1862,7 @@ public class RestCommandLineService {
             array = list.toArray(array);
 
             System.out.println("Application policies found:");
-            CliUtils.printTable(array, rowMapper, "ID", "No of network partitions","algorithm");
+            CliUtils.printTable(array, rowMapper, "ID", "No of network partitions", "algorithm");
         } catch (Exception e) {
             String message = "Could not list application policies";
             printError(message, e);
@@ -1872,7 +1874,7 @@ public class RestCommandLineService {
      * param applicationPolicyId application policy id
      * @throws CommandException
      */
-    public void deleteApplicationPolicy(String applicationPolicyId) throws CommandException{
+    public void deleteApplicationPolicy(String applicationPolicyId) throws CommandException {
         restClient.deleteEntity(ENDPOINT_REMOVE_APPLICATION_POLICY.replace("{policyId}", applicationPolicyId), applicationPolicyId,
                 "application policy");
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/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 188b5bd..9472a5c 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
@@ -1,20 +1,20 @@
 /**
- *  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.
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
 
@@ -201,13 +201,13 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
         command = new RemoveDomainMappingsCommand();
         commands.put(command.getName(), command);
 
-        command=new DeleteAutoScalingPolicyCommand();
+        command = new DeleteAutoScalingPolicyCommand();
         commands.put(command.getName(), command);
 
-        command=new AddNetworkPartitionCommand();
+        command = new AddNetworkPartitionCommand();
         commands.put(command.getName(), command);
 
-        command=new RemoveNetworkPartitionCommand();
+        command = new RemoveNetworkPartitionCommand();
         commands.put(command.getName(), command);
 
         command = new ListNetworkPartitionCommand();
@@ -223,16 +223,16 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
         commands.put(command.getName(), command);
 
         command = new DescribeTenantCommand();
-        commands.put(command.getName(),command);
+        commands.put(command.getName(), command);
 
         command = new ListPartialSearchTenantsCommand();
-        commands.put(command.getName(),command);
+        commands.put(command.getName(), command);
 
         command = new DescribeApplicationSignupCommand();
-        commands.put(command.getName(),command);
+        commands.put(command.getName(), command);
 
         command = new DeleteApplicationSignupCommand();
-        commands.put(command.getName(),command);
+        commands.put(command.getName(), command);
 
         command = new AddDeploymentPolicyCommand();
         commands.put(command.getName(), command);
@@ -271,25 +271,25 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
         commands.put(command.getName(), command);
 
         command = new DescribeApplicationSignupCommand();
-        commands.put(command.getName(),command);
+        commands.put(command.getName(), command);
 
         command = new DeleteApplicationSignupCommand();
-        commands.put(command.getName(),command);
+        commands.put(command.getName(), command);
 
         command = new AddApplicationPolicyCommand();
-        commands.put(command.getName(),command);
+        commands.put(command.getName(), command);
 
         command = new ListApplicationPoliciesCommand();
-        commands.put(command.getName(),command);
+        commands.put(command.getName(), command);
 
         command = new DescribeApplicationPolicyCommand();
-        commands.put(command.getName(),command);
+        commands.put(command.getName(), command);
 
         command = new RemoveApplicationPolicyCommand();
-        commands.put(command.getName(),command);
+        commands.put(command.getName(), command);
 
         command = new UpdateApplicationPolicyCommand();
-        commands.put(command.getName(),command);
+        commands.put(command.getName(), command);
 
         if (logger.isDebugEnabled()) {
             logger.debug("Created {} commands for the application. {}", commands.size(), commands.keySet());
@@ -343,7 +343,7 @@ 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.
+                // This is because the parser trips over unrecognised options.
                 Options allCommandOptions = new Options();
                 for (Command<StratosCommandContext> command : commands.values()) {
                     Options commandOptions = command.getOptions();
@@ -522,7 +522,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, new Option[0]);
         } catch (CommandException e) {
             if (logger.isErrorEnabled()) {
                 logger.error("Error executing command: " + action, e);
@@ -564,12 +564,12 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
         int slashCount = StringUtils.countMatches(stratosURL, "/");
         int colonCount = StringUtils.countMatches(stratosURL, ":");
 
-        UrlValidator urlValidator = new UrlValidator(new String[] { "https" },UrlValidator.ALLOW_LOCAL_URLS);
+        UrlValidator urlValidator = new UrlValidator(new String[]{"https"}, UrlValidator.ALLOW_LOCAL_URLS);
 
         // port must be provided, so colonCount must be 2
         // context path must not be provided, so slashCount must not be >3
 
-        if (!urlValidator.isValid(stratosURL) || colonCount != 2 || slashCount >3) {
+        if (!urlValidator.isValid(stratosURL) || colonCount != 2 || slashCount > 3) {
             if (logger.isDebugEnabled()) {
                 logger.debug("Stratos Controller URL {} is not valid", stratosURL);
             }

http://git-wip-us.apache.org/repos/asf/stratos/blob/8b895d93/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosCommandContext.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosCommandContext.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosCommandContext.java
index 8a8459c..0c9c364 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosCommandContext.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/StratosCommandContext.java
@@ -1,31 +1,31 @@
 /**
- *  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.
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
 
 public class StratosCommandContext extends CommandContext {
 
-	public StratosCommandContext(StratosApplication application) {
-		super(application);
-	}
+    public StratosCommandContext(StratosApplication application) {
+        super(application);
+    }
 
-	public StratosApplication getStratosApplication() {
-		return (StratosApplication) getApplication();
-	}
+    public StratosApplication getStratosApplication() {
+        return (StratosApplication) getApplication();
+    }
 
 }