fixing to CLI for https://issues.apache.org/jira/browse/STRATOS-486
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/5bd3ffe2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/5bd3ffe2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/5bd3ffe2 Branch: refs/heads/master Commit: 5bd3ffe28eab2e78bae3983ef0538802ff12195e Parents: 096e96b Author: Nirmal Fernando <[email protected]> Authored: Sat Mar 1 13:44:14 2014 +0530 Committer: Nirmal Fernando <[email protected]> Committed: Sat Mar 1 13:44:14 2014 +0530 ---------------------------------------------------------------------- .../stratos/cli/RestCommandLineService.java | 44 +++++++++++++------- 1 file changed, 29 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/5bd3ffe2/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 2acc576..aad5efa 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 @@ -20,6 +20,7 @@ package org.apache.stratos.cli; import com.google.gson.Gson; import com.google.gson.GsonBuilder; + import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; @@ -48,6 +49,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.net.ssl.*; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -260,10 +262,12 @@ public class RestCommandLineService { }; if (multiTenetCartridge.size() == 0) { + String message = "Cannot find any deployed multi-tenant Cartridge. " + + "Please deploy a Cartridge using ["+CliConstants.CARTRIDGE_DEPLOYMENT+"] command."; if (logger.isDebugEnabled()) { - logger.debug("No multi-tenant cartridges available"); + logger.debug(message); } - System.out.println("There are no multi-tenant cartridges available"); + System.out.println(message); } else { Cartridge[] cartridges = new Cartridge[multiTelentCartridgeList.getCartridge().size()]; @@ -275,10 +279,12 @@ public class RestCommandLineService { } if (singleTentCartridge.size() == 0) { + String message = "Cannot find any deployed single-tenant Cartridge. " + + "Please deploy a Cartridge using ["+CliConstants.CARTRIDGE_DEPLOYMENT+"] command."; if (logger.isDebugEnabled()) { - logger.debug("No single-tenant cartridges available"); + logger.debug(message); } - System.out.println("There are no single-tenant cartridges available"); + System.out.println(message); } else { Cartridge[] cartridges1 = new Cartridge[singleTeneCartridgetList.getCartridge().size()]; @@ -331,7 +337,7 @@ public class RestCommandLineService { return; } } - System.out.println("No matching cartridge found..."); + System.out.println("Cannot find a matching Cartridge for [type] "+type); } catch (Exception e) { handleException("Exception in listing available cartridges", e); } finally { @@ -1028,10 +1034,12 @@ public class RestCommandLineService { tenants = tenantInfoList.getTenantInfoBean().toArray(tenants); if (tenants.length == 0) { + String message = "Cannot find any Tenant. " + + "Please create a new tenant using ["+CliConstants.ADD_TENANT+"] command."; if (logger.isDebugEnabled()) { - logger.debug("No tenants found"); + logger.debug(message); } - System.out.println("There are no available tenants"); + System.out.println(message); return; } @@ -1401,10 +1409,12 @@ public class RestCommandLineService { partitions = partitionList.getPartition().toArray(partitions); if (partitions.length == 0) { + String message = "Cannot find any deployed Partition. " + + "Please deploy a Partition using ["+CliConstants.PARTITION_DEPLOYMENT+"] command."; if (logger.isDebugEnabled()) { - logger.debug("No partitions found"); + logger.debug(message); } - System.out.println("There are no available partitions"); + System.out.println(message); return; } @@ -1465,14 +1475,16 @@ public class RestCommandLineService { policyArry = policyList.getAutoscalePolicy().toArray(policyArry); if (policyArry.length == 0) { + String message = "Cannot find any deployed auto-scaling policy. " + + "Please deploy a policy using ["+CliConstants.AUTOSCALING_POLICY_DEPLOYMENT+"] command."; if (logger.isDebugEnabled()) { - logger.debug("No autoscale policies found"); + logger.debug(message); } - System.out.println("There are no autoscale policies"); + System.out.println(message); return; } - System.out.println("Available Autoscale Policies:"); + System.out.println("Available Auto-scaling Policies:"); CommandLineUtils.printTable(policyArry, partitionMapper, "ID"); } catch (Exception e) { @@ -1527,10 +1539,12 @@ public class RestCommandLineService { policyArry = policyList.getDeploymentPolicy().toArray(policyArry); if (policyArry.length == 0) { + String message = "Cannot find any deployed deployment policy. " + + "Please deploy a policy using ["+CliConstants.DEPLOYMENT_POLICY_DEPLOYMENT+"] command."; if (logger.isDebugEnabled()) { - logger.debug("No deployment policies found"); + logger.debug(message); } - System.out.println("There are no deployment policies"); + System.out.println(message); return; } @@ -1627,7 +1641,7 @@ public class RestCommandLineService { return; } } - System.out.println("No matching partition found..."); + System.out.println("Cannot find a matching Partition for [id] "+id); } catch (Exception e) { handleException("Exception in listing deployment polices", e); } finally {
