Repository: incubator-stratos Updated Branches: refs/heads/master 634619876 -> 323124234
Enable list tenant command in CLI Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/c85b96fa Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/c85b96fa Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/c85b96fa Branch: refs/heads/master Commit: c85b96fa2c4cbf4c5d5b78bed2e817f607691ac1 Parents: 83749f3 Author: Manula Thantriwatte <[email protected]> Authored: Fri Feb 21 11:37:01 2014 +0530 Committer: Manula Thantriwatte <[email protected]> Committed: Fri Feb 21 11:37:01 2014 +0530 ---------------------------------------------------------------------- .../stratos/cli/RestCommandLineService.java | 29 ++++++++++---------- .../apache/stratos/cli/StratosApplication.java | 4 +-- .../stratos/cli/beans/TenantInfoBean.java | 28 +++++++++++++++++++ 3 files changed, 45 insertions(+), 16 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c85b96fa/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 ae1c288..2acc576 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 @@ -1014,17 +1014,18 @@ public class RestCommandLineService { RowMapper<TenantInfoBean> tenantInfoMapper = new RowMapper<TenantInfoBean>() { public String[] getData(TenantInfoBean tenantInfo) { - String[] data = new String[4]; - data[0] = tenantInfo.getFirstname(); - data[1] = tenantInfo.getLastname(); - data[2] = tenantInfo.getTenantDomain(); - data[3] = tenantInfo.getEmail(); + String[] data = new String[5]; + data[0] = tenantInfo.getTenantDomain(); + data[1] = "" + tenantInfo.getTenantId(); + data[2] = tenantInfo.getEmail(); + data[3] = tenantInfo.isActive() ? "Active" : "De-active"; + data[4] = tenantInfo.getCreatedDate(); return data; } }; - TenantInfoBean[] tenants = new TenantInfoBean[tenantInfoList.getTenantInfoBeans().size()]; - tenants = tenantInfoList.getTenantInfoBeans().toArray(tenants); + TenantInfoBean[] tenants = new TenantInfoBean[tenantInfoList.getTenantInfoBean().size()]; + tenants = tenantInfoList.getTenantInfoBean().toArray(tenants); if (tenants.length == 0) { if (logger.isDebugEnabled()) { @@ -1035,7 +1036,7 @@ public class RestCommandLineService { } System.out.println("Available Tenants:" ); - CommandLineUtils.printTable(tenants, tenantInfoMapper, "First Name", "Last Name", "Domain", "Email"); + CommandLineUtils.printTable(tenants, tenantInfoMapper, "Domain", "Tenant ID", "Email", "State", "Created Date"); System.out.println(); } catch (Exception e) { @@ -1753,18 +1754,18 @@ public class RestCommandLineService { // This class convert JSON string to TenantInfoBean object private class TenantInfoList { - private ArrayList<TenantInfoBean> tenantInfoBeans; + private ArrayList<TenantInfoBean> tenantInfoBean; - public ArrayList<TenantInfoBean> getTenantInfoBeans() { - return tenantInfoBeans; + public ArrayList<TenantInfoBean> getTenantInfoBean() { + return tenantInfoBean; } - public void setTenantInfoBeans(ArrayList<TenantInfoBean> tenantInfoBeans) { - this.tenantInfoBeans = tenantInfoBeans; + public void setTenantInfoBean(ArrayList<TenantInfoBean> tenantInfoBean) { + this.tenantInfoBean = tenantInfoBean; } TenantInfoList() { - tenantInfoBeans = new ArrayList<TenantInfoBean>(); + tenantInfoBean = new ArrayList<TenantInfoBean>(); } } http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c85b96fa/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 d1903aa..d810350 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 @@ -105,8 +105,8 @@ public class StratosApplication extends CommandLineApplication<StratosCommandCon //command = new DeleteTenantCommand(); //commands.put(command.getName(), command); - //command = new ListAllTenants(); - //commands.put(command.getName(), command); + command = new ListAllTenants(); + commands.put(command.getName(), command); command = new DeactivateTenantCommand(); commands.put(command.getName(), command); http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c85b96fa/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/TenantInfoBean.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/TenantInfoBean.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/TenantInfoBean.java index 8ac42e8..175b2cf 100644 --- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/TenantInfoBean.java +++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/TenantInfoBean.java @@ -18,6 +18,8 @@ */ package org.apache.stratos.cli.beans; +import java.util.Calendar; + public class TenantInfoBean { private String admin; private String firstname; @@ -25,6 +27,9 @@ public class TenantInfoBean { private String adminPassword; private String tenantDomain; private String email; + private String createdDate; + private boolean active; + private int tenantId; public String getAdmin() { return admin; @@ -74,4 +79,27 @@ public class TenantInfoBean { this.email = email; } + public String getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(String createdDate) { + this.createdDate = createdDate; + } + + public boolean isActive() { + return active; + } + + public void setActive(boolean active) { + this.active = active; + } + + public int getTenantId() { + return tenantId; + } + + public void setTenantId(int tenantId) { + this.tenantId = tenantId; + } }
