You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/02/20 17:30:00 UTC

[1/9] stratos git commit: Fixed CLI command for deactivate tenant

Repository: stratos
Updated Branches:
  refs/heads/4.1.0-beta-deployment-policy-fix 134f79e3a -> 69f09a3cb


Fixed CLI command for deactivate tenant


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

Branch: refs/heads/4.1.0-beta-deployment-policy-fix
Commit: 82dcd5279adc9229e9644f58d63c5729f3d77ec8
Parents: 25118b9
Author: Dinithi <di...@wso2.com>
Authored: Thu Feb 19 12:56:44 2015 +0530
Committer: Dinithi <di...@wso2.com>
Committed: Thu Feb 19 12:56:44 2015 +0530

----------------------------------------------------------------------
 .../src/main/java/org/apache/stratos/cli/RestClient.java       | 2 +-
 .../java/org/apache/stratos/cli/RestCommandLineService.java    | 6 +++---
 .../org/apache/stratos/rest/endpoint/api/StratosApiV41.java    | 1 +
 3 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/82dcd527/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 7014380..404c0fa 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
@@ -187,7 +187,7 @@ public class RestClient implements GenericRestClient {
             int responseCode = executePut(serviceEndpoint, entityBody);
             if (responseCode == 404) {
                 System.out.println(String.format("%s not found", StringUtils.capitalize(entityName)));
-            } else if (responseCode == 201) {
+            } else if (responseCode >= 200 && responseCode <300) {
                 System.out.println(String.format("Successfully updated %s", entityName));
             }
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/82dcd527/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 426be17..ff22e12 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
@@ -560,8 +560,8 @@ public class RestCommandLineService {
     public void deactivateTenant(String tenantDomain) throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL()
-                    + ENDPOINT_DEACTIVATE_TENANT + "/" + tenantDomain, "");
+            HttpResponse response = restClient.doPut(httpClient, restClient.getBaseURL()
+                    + ENDPOINT_DEACTIVATE_TENANT.replace("{tenantDomain}", tenantDomain),"");
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -569,7 +569,7 @@ public class RestCommandLineService {
             Gson gson = gsonBuilder.create();
 
             if (responseCode.equals(CliConstants.RESPONSE_OK)) {
-                System.out.println("You have succesfully deactivated " + tenantDomain + " tenant");
+                System.out.println("You have successfully deactivated " + tenantDomain + " tenant");
                 return;
             } else {
                 String resultString = CliUtils.getHttpResponseString(response);

http://git-wip-us.apache.org/repos/asf/stratos/blob/82dcd527/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
index 1b847f5..f8ee031 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
@@ -1434,6 +1434,7 @@ public class StratosApiV41 extends AbstractApi {
     @PUT
     @Path("/tenants/deactivate/{tenantDomain}")
     @Consumes("application/json")
+    @Produces("application/json")
     @AuthorizationAction("/permission/protected/manage/deactivateTenant")
     @SuperTenantService(true)
     public Response deactivateTenant(@PathParam("tenantDomain") String tenantDomain) throws RestAPIException {


[5/9] stratos git commit: CLI commands added to list deployment policies and describe deployment policy.

Posted by im...@apache.org.
CLI commands added to list deployment policies and describe deployment policy.


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

Branch: refs/heads/4.1.0-beta-deployment-policy-fix
Commit: bc4d70d76c293243be356c1044b2c198cfd06708
Parents: 0a9c850
Author: Dinithi <di...@wso2.com>
Authored: Thu Feb 19 16:26:27 2015 +0530
Committer: Dinithi <di...@wso2.com>
Committed: Thu Feb 19 16:26:27 2015 +0530

----------------------------------------------------------------------
 .../stratos/cli/RestCommandLineService.java     | 54 +++++++++++++---
 .../apache/stratos/cli/StratosApplication.java  |  6 ++
 .../DescribeDeploymentPolicyCommand.java        |  6 +-
 .../commands/ListDeploymentPoliciesCommand.java | 65 ++++++++++++++++++++
 4 files changed, 120 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/bc4d70d7/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 c48cc83..d2f8f52 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
@@ -110,7 +110,7 @@ public class RestCommandLineService {
 
     private static final String ENDPOINT_GET_APPLICATION = API_CONTEXT + "/applications/{appId}";
     private static final String ENDPOINT_GET_AUTOSCALING_POLICY = API_CONTEXT + "/autoscalingPolicies/{id}";
-    private static final String ENDPOINT_GET_DEPLOYMENT_POLICY = API_CONTEXT + "/applications/{applicationId}/deploymentPolicy";
+    private static final String ENDPOINT_GET_DEPLOYMENT_POLICY = API_CONTEXT + "/deploymentPolicies/{deploymentPolicyId}";
     private static final String ENDPOINT_GET_CARTRIDGE = API_CONTEXT + "/cartridges/{cartridgeType}";
     private static final String ENDPOINT_GET_CARTRIDGE_OF_TENANT = API_CONTEXT + "/subscriptions/{id}/cartridges";
     private static final String ENDPOINT_GET_KUBERNETES_GROUP = API_CONTEXT + "/kubernetesCluster/{kubernetesClusterId}";
@@ -561,7 +561,7 @@ public class RestCommandLineService {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
             HttpResponse response = restClient.doPut(httpClient, restClient.getBaseURL()
-                    + ENDPOINT_DEACTIVATE_TENANT.replace("{tenantDomain}", tenantDomain),"");
+                    + ENDPOINT_DEACTIVATE_TENANT.replace("{tenantDomain}", tenantDomain), "");
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -593,7 +593,7 @@ public class RestCommandLineService {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
             HttpResponse response = restClient.doPut(httpClient, restClient.getBaseURL()
-                    + ENDPOINT_ACTIVATE_TENANT .replace("{tenantDomain}", tenantDomain), "");
+                    + ENDPOINT_ACTIVATE_TENANT.replace("{tenantDomain}", tenantDomain), "");
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -812,20 +812,20 @@ public class RestCommandLineService {
      * Describe deployment policy
      * @throws CommandException
      */
-    public void describeDeploymentPolicy(String applicationId) throws CommandException {
+    public void describeDeploymentPolicy(String deploymentPolicyId) throws CommandException {
         try {
             DeploymentPolicyBean policy = (DeploymentPolicyBean) restClient.getEntity(ENDPOINT_GET_DEPLOYMENT_POLICY,
-                    DeploymentPolicyBean.class, "{applicationId}", applicationId, "deployment policy");
+                    DeploymentPolicyBean.class, "{deploymentPolicyId}", deploymentPolicyId, "deployment policy");
 
             if (policy == null) {
-                System.out.println("Deployment policy not found: " + applicationId);
+                System.out.println("Deployment policy not found: " + deploymentPolicyId);
                 return;
             }
 
-            System.out.println("Deployment policy: " + applicationId);
+            System.out.println("Deployment policy: " + deploymentPolicyId);
             System.out.println(getGson().toJson(policy));
         } catch (Exception e) {
-            String message = "Error in describing deployment policy: " + applicationId;
+            String message = "Error in describing deployment policy: " + deploymentPolicyId;
             printError(message, e);
         }
     }
@@ -1384,4 +1384,42 @@ public class RestCommandLineService {
         restClient.deleteEntity(ENDPOINT_REMOVE_DEPLOYMENT_POLICY.replace("{policyId}", policyId), policyId,
                 "deployment policy");
     }
+
+    /**
+     * List deployment policies
+     * @throws CommandException
+     */
+    public void listDeploymentPolicies() throws CommandException {
+        try {
+            Type listType = new TypeToken<ArrayList<DeploymentPolicyBean>>() {
+            }.getType();
+            List<DeploymentPolicyBean> list = (List<DeploymentPolicyBean>) restClient.listEntity(ENDPOINT_LIST_DEPLOYMENT_POLICIES,
+                    listType, "deployment policies");
+
+            if ((list == null) || (list == null) || (list.size() == 0)) {
+                System.out.println("No deployment policies found");
+                return;
+            }
+
+            RowMapper<DeploymentPolicyBean> rowMapper = new RowMapper<DeploymentPolicyBean>() {
+
+                public String[] getData(DeploymentPolicyBean policy) {
+                    String[] data = new String[2];
+                    data[0] = policy.getId();
+                    data[1] = String.valueOf(policy.getNetworkPartition().size());
+                    return data;
+                }
+            };
+
+            DeploymentPolicyBean[] array = new DeploymentPolicyBean[list.size()];
+            array = list.toArray(array);
+
+            System.out.println("Deployment policies found:");
+            CliUtils.printTable(array, rowMapper, "ID", "Accessibility");
+        } catch (Exception e) {
+            String message = "Could not list deployment policies";
+            printError(message, e);
+        }
+    }
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/bc4d70d7/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 410162a..f5b45f9 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
@@ -234,6 +234,12 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
         command = new DescribeNetworkPartitionCommand();
         commands.put(command.getName(), command);
 
+        command = new ListDeploymentPoliciesCommand();
+        commands.put(command.getName(), command);
+
+        command = new DescribeDeploymentPolicyCommand();
+        commands.put(command.getName(), command);
+
         if (logger.isDebugEnabled()) {
             logger.debug("Created {} commands for the application. {}", commands.size(), commands.keySet());
         }

http://git-wip-us.apache.org/repos/asf/stratos/blob/bc4d70d7/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 017bd0c..3995a85 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
@@ -56,11 +56,11 @@ public class DescribeDeploymentPolicyCommand implements Command<StratosCommandCo
 			logger.debug("Executing {} command...", getName());
 		}
 		if (args != null && args.length == 1) {
-			String applicationId = args[0];
+			String deploymentPolicyId = args[0];
 			if (logger.isDebugEnabled()) {
-				logger.debug("Getting deployment policy {}", applicationId);
+				logger.debug("Getting deployment policy {}", deploymentPolicyId);
 			}
-			 RestCommandLineService.getInstance().describeDeploymentPolicy(applicationId);
+			 RestCommandLineService.getInstance().describeDeploymentPolicy(deploymentPolicyId);
 			return CliConstants.COMMAND_SUCCESSFULL;
 		} else {
 			context.getStratosApplication().printUsage(getName());

http://git-wip-us.apache.org/repos/asf/stratos/blob/bc4d70d7/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListDeploymentPoliciesCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListDeploymentPoliciesCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListDeploymentPoliciesCommand.java
new file mode 100644
index 0000000..a9cb6fb
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/ListDeploymentPoliciesCommand.java
@@ -0,0 +1,65 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+
+ *  http://www.apache.org/licenses/LICENSE-2.0
+
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.stratos.cli.commands;
+
+import org.apache.commons.cli.Options;
+import org.apache.stratos.cli.Command;
+import org.apache.stratos.cli.RestCommandLineService;
+import org.apache.stratos.cli.StratosCommandContext;
+import org.apache.stratos.cli.exception.CommandException;
+import org.apache.stratos.cli.utils.CliConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ListDeploymentPoliciesCommand implements Command<StratosCommandContext> {
+    private static final Logger logger = LoggerFactory.getLogger(ListDeploymentPoliciesCommand.class);
+
+    public ListDeploymentPoliciesCommand() {
+    }
+
+    public String getName() {
+        return "list-deployment-policies";
+    }
+
+    public String getDescription() {
+        return "List available deployment policies";
+    }
+
+    public String getArgumentSyntax() {
+        return null;
+    }
+
+    public int execute(StratosCommandContext context, String[] args) throws CommandException {
+        if (logger.isDebugEnabled()) {
+            logger.debug("Executing {} command...", getName());
+        }
+        if (args == null || args.length == 0) {
+            RestCommandLineService.getInstance().listDeploymentPolicies();
+            return CliConstants.COMMAND_SUCCESSFULL;
+        } else {
+            context.getStratosApplication().printUsage(getName());
+            return CliConstants.COMMAND_FAILED;
+        }
+    }
+
+    public Options getOptions() {
+        return null;
+    }
+}


[7/9] stratos git commit: Merge branch '4.1.0-beta-deployment-policy-fix' of https://github.com/apache/stratos into 4.1.0-beta-deployment-policy-fix

Posted by im...@apache.org.
Merge branch '4.1.0-beta-deployment-policy-fix' of https://github.com/apache/stratos into 4.1.0-beta-deployment-policy-fix


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

Branch: refs/heads/4.1.0-beta-deployment-policy-fix
Commit: c76f02409fbdb7cba8bc1f64394b150e160c810f
Parents: bfae6bb 134f79e
Author: Dinithi <di...@wso2.com>
Authored: Fri Feb 20 14:10:29 2015 +0530
Committer: Dinithi <di...@wso2.com>
Committed: Fri Feb 20 14:10:29 2015 +0530

----------------------------------------------------------------------

----------------------------------------------------------------------



[4/9] stratos git commit: Merge branch '4.1.0-beta-deployment-policy-fix' of https://github.com/apache/stratos into 4.1.0-beta-deployment-policy-fix

Posted by im...@apache.org.
Merge branch '4.1.0-beta-deployment-policy-fix' of https://github.com/apache/stratos into 4.1.0-beta-deployment-policy-fix


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

Branch: refs/heads/4.1.0-beta-deployment-policy-fix
Commit: 0a9c85000263ab06adffa558f55932af1ca4c699
Parents: acd7787 672fb4a
Author: Dinithi <di...@wso2.com>
Authored: Thu Feb 19 16:23:32 2015 +0530
Committer: Dinithi <di...@wso2.com>
Committed: Thu Feb 19 16:23:32 2015 +0530

----------------------------------------------------------------------
 .../autoscaler/registry/RegistryManager.java    | 136 -------------------
 .../services/impl/AutoscalerServiceImpl.java    |  42 ------
 .../autoscaler/util/AutoscalerConstants.java    |   1 -
 .../impl/CloudControllerServiceImpl.java        |   3 +
 .../impl/CloudControllerServiceUtil.java        |  25 ++++
 5 files changed, 28 insertions(+), 179 deletions(-)
----------------------------------------------------------------------



[2/9] stratos git commit: Fixed CLI command for activate-tenant

Posted by im...@apache.org.
Fixed CLI command for activate-tenant


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

Branch: refs/heads/4.1.0-beta-deployment-policy-fix
Commit: edb4dd30cbf91662ed413028ba75e4b85446c3a5
Parents: 82dcd52
Author: Dinithi <di...@wso2.com>
Authored: Thu Feb 19 13:23:35 2015 +0530
Committer: Dinithi <di...@wso2.com>
Committed: Thu Feb 19 13:23:35 2015 +0530

----------------------------------------------------------------------
 .../java/org/apache/stratos/cli/RestCommandLineService.java    | 6 +++---
 .../org/apache/stratos/rest/endpoint/api/StratosApiV41.java    | 1 +
 2 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/edb4dd30/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 ff22e12..c48cc83 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
@@ -592,8 +592,8 @@ public class RestCommandLineService {
     public void activateTenant(String tenantDomain) throws CommandException {
         DefaultHttpClient httpClient = new DefaultHttpClient();
         try {
-            HttpResponse response = restClient.doPost(httpClient, restClient.getBaseURL()
-                    + ENDPOINT_ACTIVATE_TENANT + "/" + tenantDomain, "");
+            HttpResponse response = restClient.doPut(httpClient, restClient.getBaseURL()
+                    + ENDPOINT_ACTIVATE_TENANT .replace("{tenantDomain}", tenantDomain), "");
 
             String responseCode = "" + response.getStatusLine().getStatusCode();
 
@@ -601,7 +601,7 @@ public class RestCommandLineService {
             Gson gson = gsonBuilder.create();
 
             if (responseCode.equals(CliConstants.RESPONSE_OK)) {
-                System.out.println("You have succesfully activated " + tenantDomain + " tenant");
+                System.out.println("You have successfully activated " + tenantDomain + " tenant");
                 return;
             } else {
                 String resultString = CliUtils.getHttpResponseString(response);

http://git-wip-us.apache.org/repos/asf/stratos/blob/edb4dd30/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
index f8ee031..bd913b5 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
@@ -1388,6 +1388,7 @@ public class StratosApiV41 extends AbstractApi {
     @PUT
     @Path("/tenants/activate/{tenantDomain}")
     @Consumes("application/json")
+    @Produces("application/json")
     @AuthorizationAction("/permission/protected/manage/activateTenant")
     @SuperTenantService(true)
     public Response activateTenant(@PathParam("tenantDomain") String tenantDomain) throws RestAPIException {


[8/9] stratos git commit: CLI commands added to describea kubernetes cluter and to get the master of a kubernetes cluster.

Posted by im...@apache.org.
CLI commands added to describea  kubernetes cluter and to get the master of a kubernetes cluster.


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

Branch: refs/heads/4.1.0-beta-deployment-policy-fix
Commit: 73d58e60c01158f575351c60416f305d6bc9284e
Parents: c76f024
Author: Dinithi <di...@wso2.com>
Authored: Fri Feb 20 14:15:12 2015 +0530
Committer: Dinithi <di...@wso2.com>
Committed: Fri Feb 20 14:15:12 2015 +0530

----------------------------------------------------------------------
 .../stratos/cli/RestCommandLineService.java     | 63 +++++++++++++++--
 .../apache/stratos/cli/StratosApplication.java  |  6 ++
 .../DescribeKubernetesClusterCommand.java       | 71 +++++++++++++++++++
 .../DescribeKubernetesMasterCommand.java        | 72 ++++++++++++++++++++
 4 files changed, 207 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/73d58e60/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 d2f8f52..609620c 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
@@ -44,6 +44,7 @@ import org.apache.stratos.common.beans.cartridge.CartridgeBean;
 import org.apache.stratos.common.beans.cartridge.IaasProviderBean;
 import org.apache.stratos.common.beans.kubernetes.KubernetesClusterBean;
 import org.apache.stratos.common.beans.kubernetes.KubernetesHostBean;
+import org.apache.stratos.common.beans.kubernetes.KubernetesMasterBean;
 import org.apache.stratos.common.beans.partition.NetworkPartitionBean;
 import org.apache.stratos.common.beans.policy.autoscale.AutoscalePolicyBean;
 import org.apache.stratos.common.beans.policy.deployment.DeploymentPolicyBean;
@@ -114,8 +115,8 @@ public class RestCommandLineService {
     private static final String ENDPOINT_GET_CARTRIDGE = API_CONTEXT + "/cartridges/{cartridgeType}";
     private static final String ENDPOINT_GET_CARTRIDGE_OF_TENANT = API_CONTEXT + "/subscriptions/{id}/cartridges";
     private static final String ENDPOINT_GET_KUBERNETES_GROUP = API_CONTEXT + "/kubernetesCluster/{kubernetesClusterId}";
-    private static final String ENDPOINT_GET_KUBERNETES_MASTER = API_CONTEXT + "/kubernetesCluster/{kubernetesClusterId}/master";
-    private static final String ENDPOINT_GET_KUBERNETES_HOST = API_CONTEXT + "/kubernetesCluster/{kubernetesClusterId}/hosts";
+    private static final String ENDPOINT_GET_KUBERNETES_MASTER = API_CONTEXT + "/kubernetesClusters/{kubernetesClusterId}/master";
+    private static final String ENDPOINT_GET_KUBERNETES_HOST_CLUSTER = API_CONTEXT + "/kubernetesClusters/{kubernetesClusterId}";
     private static final String ENDPOINT_GET_NETWORK_PARTITION = API_CONTEXT + "/networkPartitions/{networkPartitionId}";
 
     private static final String ENDPOINT_UPDATE_KUBERNETES_MASTER = API_CONTEXT + "/kubernetesClusters/{kubernetesClusterId}/master";
@@ -866,7 +867,7 @@ public class RestCommandLineService {
      */
     public void listKubernetesClusters() {
         try {
-            Type listType = new TypeToken<ArrayList<KubernetesHostBean>>() {
+            Type listType = new TypeToken<ArrayList<KubernetesClusterBean>>() {
             }.getType();
             List<KubernetesClusterBean> list = (List<KubernetesClusterBean>) restClient.
                     listEntity(ENDPOINT_LIST_KUBERNETES_CLUSTERS, listType, "kubernetes cluster");
@@ -917,8 +918,8 @@ public class RestCommandLineService {
             GsonBuilder gsonBuilder = new GsonBuilder();
             Gson gson = gsonBuilder.create();
 
-            if (responseCode.equals(CliConstants.RESPONSE_OK)) {
-                System.out.println("You have succesfully deployed host to Kubernetes cluster: " + clusterId);
+            if (responseCode.equals(CliConstants.RESPONSE_OK) || responseCode.equals(CliConstants.RESPONSE_CREATED)) {
+                System.out.println("You have successfully deployed host to Kubernetes cluster: " + clusterId);
                 return;
             } else {
                 String resultString = CliUtils.getHttpResponseString(response);
@@ -970,6 +971,58 @@ public class RestCommandLineService {
     }
 
     /**
+     * Get the master of a Kubernetes Cluster
+     * @param clusterId
+     * @throws CommandException
+     */
+    public void getKubernetesMaster(final String clusterId) throws CommandException {
+        try {
+            Type listType = new TypeToken<KubernetesMasterBean>() {
+            }.getType();
+            KubernetesMasterBean master = (KubernetesMasterBean) restClient
+                    .getEntity(ENDPOINT_GET_KUBERNETES_MASTER, KubernetesMasterBean.class, "{kubernetesClusterId}", clusterId,
+                            "network partition");
+
+            if (master == null) {
+                System.out.println("Kubernetes master not found in: " + clusterId);
+                return;
+            }
+
+            System.out.println("Cluster: " + clusterId);
+            System.out.println(getGson().toJson(master));
+        } catch (Exception e) {
+            String message = "Could not get the master of " + clusterId;
+            printError(message, e);
+        }
+    }
+
+    /**
+     * Describe a Kubernetes cluster
+     * @param clusterId
+     * @throws CommandException
+     */
+    public void describeKubernetesCluster(final String clusterId) throws CommandException {
+        try {
+            Type listType = new TypeToken<KubernetesClusterBean>() {
+            }.getType();
+            KubernetesClusterBean cluster = (KubernetesClusterBean) restClient
+                    .getEntity(ENDPOINT_GET_KUBERNETES_HOST_CLUSTER, KubernetesClusterBean.class, "{kubernetesClusterId}", clusterId,
+                            "kubernetes cluster");
+
+            if (cluster == null) {
+                System.out.println("Kubernetes cluster not found: " + clusterId);
+                return;
+            }
+
+            System.out.println("Kubernetes cluster: " + clusterId);
+            System.out.println(getGson().toJson(cluster));
+        } catch (Exception e) {
+            String message = "Could not describe kubernetes cluster: " + clusterId;
+            printError(message, e);
+        }
+    }
+
+    /**
      * Add Domain mappings
      * @throws CommandException
      */

http://git-wip-us.apache.org/repos/asf/stratos/blob/73d58e60/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 f5b45f9..3c3914e 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
@@ -240,6 +240,12 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
         command = new DescribeDeploymentPolicyCommand();
         commands.put(command.getName(), command);
 
+        command = new DescribeKubernetesMasterCommand();
+        commands.put(command.getName(), command);
+
+        command = new DescribeKubernetesClusterCommand();
+        commands.put(command.getName(), command);
+
         if (logger.isDebugEnabled()) {
             logger.debug("Created {} commands for the application. {}", commands.size(), commands.keySet());
         }

http://git-wip-us.apache.org/repos/asf/stratos/blob/73d58e60/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeKubernetesClusterCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeKubernetesClusterCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeKubernetesClusterCommand.java
new file mode 100644
index 0000000..8ac4923
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeKubernetesClusterCommand.java
@@ -0,0 +1,71 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+
+ *  http://www.apache.org/licenses/LICENSE-2.0
+
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.stratos.cli.commands;
+
+import org.apache.commons.cli.Options;
+import org.apache.stratos.cli.Command;
+import org.apache.stratos.cli.RestCommandLineService;
+import org.apache.stratos.cli.StratosCommandContext;
+import org.apache.stratos.cli.exception.CommandException;
+import org.apache.stratos.cli.utils.CliConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DescribeKubernetesClusterCommand implements Command<StratosCommandContext> {
+    private static final Logger logger = LoggerFactory.getLogger(DescribeKubernetesClusterCommand.class);
+
+    @Override
+    public String getName() {
+        return "describe-kubernetes-cluster";
+    }
+
+    @Override
+    public String getDescription() {
+        return "Describing a kubernetes cluster";
+    }
+
+    @Override
+    public String getArgumentSyntax() {
+        return "[cluster-id]";
+    }
+
+    @Override
+    public Options getOptions() {
+        return null;
+    }
+
+    @Override
+    public int execute(StratosCommandContext context, String[] args) throws CommandException {
+        if (logger.isDebugEnabled()) {
+            logger.debug("Executing {} command...", getName());
+        }
+        if (args != null && args.length == 1) {
+            String id = args[0];
+            if (logger.isDebugEnabled()) {
+                logger.debug("Getting Kubernetes cluster info {}", id);
+            }
+            RestCommandLineService.getInstance().describeKubernetesCluster(id);
+            return CliConstants.COMMAND_SUCCESSFULL;
+        } else {
+            context.getStratosApplication().printUsage(getName());
+            return CliConstants.COMMAND_FAILED;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/stratos/blob/73d58e60/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeKubernetesMasterCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeKubernetesMasterCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeKubernetesMasterCommand.java
new file mode 100644
index 0000000..9b423ea
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeKubernetesMasterCommand.java
@@ -0,0 +1,72 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+
+ *  http://www.apache.org/licenses/LICENSE-2.0
+
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.stratos.cli.commands;
+
+import org.apache.commons.cli.Options;
+import org.apache.stratos.cli.Command;
+import org.apache.stratos.cli.RestCommandLineService;
+import org.apache.stratos.cli.StratosCommandContext;
+import org.apache.stratos.cli.exception.CommandException;
+import org.apache.stratos.cli.utils.CliConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DescribeKubernetesMasterCommand implements Command<StratosCommandContext> {
+
+    private static final Logger logger = LoggerFactory.getLogger(DescribeKubernetesMasterCommand.class);
+
+    @Override
+    public String getName() {
+        return "describe-kubernetes-master";
+    }
+
+    @Override
+    public String getDescription() {
+        return "Describing the Kubernetes master";
+    }
+
+    @Override
+    public String getArgumentSyntax() {
+        return "[cluster-id]";
+    }
+
+    @Override
+    public Options getOptions() {
+        return null;
+    }
+
+    @Override
+    public int execute(StratosCommandContext context, String[] args) throws CommandException {
+        if (logger.isDebugEnabled()) {
+            logger.debug("Executing {} command...", getName());
+        }
+        if (args != null && args.length == 1) {
+            String id = args[0];
+            if (logger.isDebugEnabled()) {
+                logger.debug("Getting Kubernetes master info {}", id);
+            }
+            RestCommandLineService.getInstance().getKubernetesMaster(id);
+            return CliConstants.COMMAND_SUCCESSFULL;
+        } else {
+            context.getStratosApplication().printUsage(getName());
+            return CliConstants.COMMAND_FAILED;
+        }
+    }
+}


[3/9] stratos git commit: Merge branch '4.1.0-beta-deployment-policy-fix' of https://github.com/apache/stratos into 4.1.0-beta-deployment-policy-fix

Posted by im...@apache.org.
Merge branch '4.1.0-beta-deployment-policy-fix' of https://github.com/apache/stratos into 4.1.0-beta-deployment-policy-fix


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

Branch: refs/heads/4.1.0-beta-deployment-policy-fix
Commit: acd7787729642e82eacf1601fa503c6e2107cc60
Parents: edb4dd3 15f7a10
Author: Dinithi <di...@wso2.com>
Authored: Thu Feb 19 13:24:28 2015 +0530
Committer: Dinithi <di...@wso2.com>
Committed: Thu Feb 19 13:24:28 2015 +0530

----------------------------------------------------------------------
 .../parser/DefaultApplicationParser.java        |   6 +-
 .../applications/pojo/GroupContext.java         |   6 +-
 .../client/CloudControllerClient.java           | 146 +----
 .../InvalidApplicationPolicyException.java      |  47 ++
 .../monitor/cluster/ClusterMonitor.java         |  80 ++-
 .../monitor/component/ApplicationMonitor.java   |  49 +-
 .../autoscaler/pojo/policy/PolicyManager.java   |  51 +-
 .../policy/deployment/ApplicationPolicy.java    |  10 +-
 .../partition/network/NetworkPartition.java     |   9 -
 .../autoscaler/registry/RegistryManager.java    |  11 +
 .../autoscaler/rule/RuleTasksDelegator.java     |  13 +-
 .../services/impl/AutoscalerServiceImpl.java    | 166 +++---
 .../autoscaler/util/AutoscalerConstants.java    |   3 +-
 .../util/AutoscalerObjectConverter.java         |  47 ++
 .../context/CloudControllerContext.java         |   5 +
 .../services/CloudControllerService.java        |   6 +
 .../impl/CloudControllerServiceImpl.java        |  14 +-
 .../src/main/resources/META-INF/component.xml   |   4 +
 .../beans/application/GroupReferenceBean.java   |  11 +-
 .../beans/partition/NetworkPartitionBean.java   |   9 -
 .../client/CloudControllerServiceClient.java    |  48 +-
 .../rest/endpoint/api/StratosApiV41.java        |  51 +-
 .../rest/endpoint/api/StratosApiV41Utils.java   |  39 +-
 .../util/converter/ObjectConverter.java         |  68 ++-
 .../artifacts/network-partition.json            |   1 -
 .../src/main/resources/AutoscalerService.wsdl   | 172 +++---
 .../main/resources/CloudControllerService.wsdl  | 561 ++++++++++---------
 27 files changed, 928 insertions(+), 705 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/acd77877/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41.java
----------------------------------------------------------------------


[6/9] stratos git commit: Merge branch '4.1.0-beta-deployment-policy-fix' of https://github.com/apache/stratos into 4.1.0-beta-deployment-policy-fix

Posted by im...@apache.org.
Merge branch '4.1.0-beta-deployment-policy-fix' of https://github.com/apache/stratos into 4.1.0-beta-deployment-policy-fix


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

Branch: refs/heads/4.1.0-beta-deployment-policy-fix
Commit: bfae6bb8ce58cb26cca7198e2a379a740f2396b6
Parents: bc4d70d 85547a6
Author: Dinithi <di...@wso2.com>
Authored: Fri Feb 20 11:57:59 2015 +0530
Committer: Dinithi <di...@wso2.com>
Committed: Fri Feb 20 11:57:59 2015 +0530

----------------------------------------------------------------------
 .../org/apache/stratos/autoscaler/pojo/policy/PolicyManager.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------



[9/9] stratos git commit: CLI command added to DescribeApplicationRuntime. Fixed issues in DeleteApplicationCommand.

Posted by im...@apache.org.
CLI command added to DescribeApplicationRuntime.
Fixed issues in DeleteApplicationCommand.


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

Branch: refs/heads/4.1.0-beta-deployment-policy-fix
Commit: 69f09a3cbf1e69451fa643bfbe0dc52cb383e907
Parents: 73d58e6
Author: Dinithi <di...@wso2.com>
Authored: Fri Feb 20 17:16:55 2015 +0530
Committer: Dinithi <di...@wso2.com>
Committed: Fri Feb 20 17:16:55 2015 +0530

----------------------------------------------------------------------
 .../stratos/cli/RestCommandLineService.java     | 28 +++++++-
 .../apache/stratos/cli/StratosApplication.java  |  6 ++
 .../cli/commands/DeleteApplicationCommand.java  |  2 +-
 .../cli/commands/DeployApplicationCommand.java  |  4 +-
 .../DescribeApplicationRuntimeCommand.java      | 67 ++++++++++++++++++++
 5 files changed, 103 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/69f09a3c/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 609620c..b8977bf 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
@@ -118,6 +118,7 @@ public class RestCommandLineService {
     private static final String ENDPOINT_GET_KUBERNETES_MASTER = API_CONTEXT + "/kubernetesClusters/{kubernetesClusterId}/master";
     private static final String ENDPOINT_GET_KUBERNETES_HOST_CLUSTER = API_CONTEXT + "/kubernetesClusters/{kubernetesClusterId}";
     private static final String ENDPOINT_GET_NETWORK_PARTITION = API_CONTEXT + "/networkPartitions/{networkPartitionId}";
+    private static final String ENDPOINT_GET_APPLICATION_RUNTIME = API_CONTEXT + "/applications/{applicationId}/runtime";
 
     private static final String ENDPOINT_UPDATE_KUBERNETES_MASTER = API_CONTEXT + "/kubernetesClusters/{kubernetesClusterId}/master";
     private static final String ENDPOINT_UPDATE_KUBERNETES_HOST = API_CONTEXT + "/kubernetesClusters/{kubernetesClusterId}/minion/{minionId}";
@@ -1223,7 +1224,7 @@ public class RestCommandLineService {
      * @throws CommandException
      */// This method helps to remove applications
     public void deleteApplication (String applicationId) {
-        restClient.deleteEntity(ENDPOINT_REMOVE_APPLICATION.replace("{applicationId}", applicationId), applicationId,
+        restClient.deleteEntity(ENDPOINT_REMOVE_APPLICATION.replace("{appId}", applicationId), applicationId,
                 "application");
     }
 
@@ -1262,6 +1263,31 @@ public class RestCommandLineService {
     }
 
     /**
+     * Describe application runtime
+     * @throws CommandException
+     */
+    public void describeApplicationRuntime (String applicationID) {
+        try {
+            Type listType = new TypeToken<ApplicationBean>() {
+            }.getType();
+            ApplicationBean application = (ApplicationBean) restClient
+                    .getEntity(ENDPOINT_GET_APPLICATION_RUNTIME, ApplicationBean.class, "{applicationId}", applicationID,
+                            "application");
+
+            if (application == null) {
+                System.out.println("Application not found: " + applicationID);
+                return;
+            }
+
+            System.out.println("Application: " + applicationID);
+            System.out.println(getGson().toJson(application));
+        } catch (Exception e) {
+            String message = "Could not describe application runtime: " + applicationID;
+            printError(message, e);
+        }
+    }
+
+    /**
      * Add application signup
      * @throws CommandException
      */

http://git-wip-us.apache.org/repos/asf/stratos/blob/69f09a3c/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 3c3914e..fd648ed 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
@@ -246,6 +246,12 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon
         command = new DescribeKubernetesClusterCommand();
         commands.put(command.getName(), command);
 
+        command = new DeleteApplicationCommand();
+        commands.put(command.getName(), command);
+
+        command = new DescribeApplicationRuntimeCommand();
+        commands.put(command.getName(), command);
+
         if (logger.isDebugEnabled()) {
             logger.debug("Created {} commands for the application. {}", commands.size(), commands.keySet());
         }

http://git-wip-us.apache.org/repos/asf/stratos/blob/69f09a3c/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeleteApplicationCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeleteApplicationCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeleteApplicationCommand.java
index 0557b0c..9286ed1 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeleteApplicationCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeleteApplicationCommand.java
@@ -42,7 +42,7 @@ public class DeleteApplicationCommand implements Command<StratosCommandContext>
 
     @Override
     public String getArgumentSyntax() {
-        return "[Application Id]";
+        return "[application-id]";
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/stratos/blob/69f09a3c/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java
index 4dacb00..135ff81 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DeployApplicationCommand.java
@@ -49,12 +49,12 @@ public class DeployApplicationCommand implements Command<StratosCommandContext>
 
     @Override
     public String getName() {
-        return "remove-application";
+        return "deploy-application";
     }
 
     @Override
     public String getDescription() {
-        return "remove application";
+        return "deploy application";
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/stratos/blob/69f09a3c/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeApplicationRuntimeCommand.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeApplicationRuntimeCommand.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeApplicationRuntimeCommand.java
new file mode 100644
index 0000000..4405518
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/commands/DescribeApplicationRuntimeCommand.java
@@ -0,0 +1,67 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+
+ *  http://www.apache.org/licenses/LICENSE-2.0
+
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.stratos.cli.commands;
+
+import org.apache.commons.cli.Options;
+import org.apache.stratos.cli.Command;
+import org.apache.stratos.cli.RestCommandLineService;
+import org.apache.stratos.cli.StratosCommandContext;
+import org.apache.stratos.cli.exception.CommandException;
+import org.apache.stratos.cli.utils.CliConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DescribeApplicationRuntimeCommand implements Command<StratosCommandContext> {
+
+    private static final Logger logger = LoggerFactory.getLogger(DescribeApplicationRuntimeCommand.class);
+
+    public DescribeApplicationRuntimeCommand() {
+    }
+
+    public String getName() {
+        return "describe-application-runtime";
+    }
+
+    public String getDescription() {
+        return "Describe application runtime";
+    }
+
+    public String getArgumentSyntax() {
+        return "[application-id]";
+    }
+
+    public int execute(StratosCommandContext context, String[] args) throws CommandException {
+        if (logger.isDebugEnabled()) {
+            logger.debug("Executing command: ", getName());
+        }
+        if ((args == null) || (args.length == 0)) {
+            context.getStratosApplication().printUsage(getName());
+            return CliConstants.COMMAND_FAILED;
+        } else {
+            String applicationId = args[0];
+            RestCommandLineService.getInstance().describeApplicationRuntime(applicationId);
+            return CliConstants.COMMAND_SUCCESSFULL;
+        }
+    }
+
+    public Options getOptions() {
+        return null;
+    }
+}