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 2013/07/11 07:18:14 UTC

[23/27] aplying 0001-Refactor-usage-module-to-apache-stratos.patch

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/all_tenant_usage.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/all_tenant_usage.jsp b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/all_tenant_usage.jsp
new file mode 100644
index 0000000..14c24d5
--- /dev/null
+++ b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/all_tenant_usage.jsp
@@ -0,0 +1,209 @@
+<!--
+  ~  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.
+  -->
+<%@ page import="org.wso2.carbon.usage.stub.beans.xsd.PaginatedTenantUsageInfo" %>
+<%@ page import="org.wso2.carbon.usage.stub.beans.xsd.TenantUsage" %>
+<%@ page import="org.wso2.carbon.usage.ui.utils.UsageUtil" %>
+<%@ page import="org.wso2.carbon.usage.ui.report.AllTenantUsageData" %>
+<%@ page import="org.wso2.carbon.usage.ui.report.AllTenantUsageReport" %>
+<%@ page import="java.util.List" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
+
+<carbon:jsi18n
+        resourceBundle="org.wso2.carbon.usage.ui.i18n.JSResources"
+        request="<%=request%>"/>
+
+
+<fmt:bundle basename="org.wso2.carbon.usage.ui.i18n.Resources">
+    <carbon:breadcrumb
+            label="tenants.usage.report"
+            resourceBundle="org.wso2.carbon.usage.ui.i18n.Resources"
+            topPage="true"
+            request="<%=request%>"/>
+    <jsp:include page="../registry_common/registry_common-i18n-ajaxprocessor.jsp"/>
+    <script type="text/javascript" src="../registry_common/js/registry_validation.js"></script>
+    <script type="text/javascript" src="../registry_common/js/registry_common.js"></script>
+    <script type="text/javascript" src="../ajax/js/prototype.js"></script>
+    <script type="text/javascript" src="../tenant-usage/js/tenant-usage.js"></script>
+    <script type="text/javascript" src="js/all-tenant-usage-report.js"></script>
+    <link rel="stylesheet" type="text/css" href="../tenant-usage/css/tenant-usage.css"/>
+
+
+    <%
+        PaginatedTenantUsageInfo tenantsInfo =
+                UsageUtil.retrievePaginatedTenantUsages(request, config, session);
+        TenantUsage[] tenantUsages = tenantsInfo.getTenantUsages();
+        int pageNumber = tenantsInfo.getPageNumber();
+        int numberOfPages = tenantsInfo.getNumberOfPages();
+        String yearMonth = request.getParameter("year-month");
+        session.setAttribute("year-month", yearMonth);
+
+
+        if (yearMonth == null) {
+            // get the current year month
+            yearMonth = UsageUtil.getCurrentYearMonth();
+        }
+        String currentYearMonth = UsageUtil.getCurrentYearMonth();
+        int rowCount = 5;
+        if (yearMonth.equals(currentYearMonth)) {
+            rowCount = 7;
+        }
+    %>
+
+
+    <%
+        //AllTenantUsageReport usageReport = new AllTenantUsageReport(config, session, request);
+        //List<AllTenantUsageData> reportDataArray = usageReport.getUsageReportData();
+        //request.getSession().setAttribute("all_tenant_usage_data", reportDataArray);
+    %>
+
+    <div id="middle">
+        <h2><fmt:message key="tenants.usage.report"/> for the Month - <%=yearMonth%> (All
+            Tenants)</h2>
+    </div>
+
+    <div id="workArea">
+
+        <form id="usageForm" action="all_tenant_usage.jsp" method="post">
+
+
+            <table class="styledLeft">
+                <thead>
+                <tr>
+                    <th>
+                        <fmt:message key="report.duration"/>
+                    </th>
+                </tr>
+                </thead>
+                <tbody>
+                <tr>
+                    <td class="nopadding">
+                        <table class="normal-nopadding" cellspacing="0">
+                            <tbody>
+                            <tr>
+                                <td><fmt:message key="year.month"/></td>
+                                <td colspan="2">
+                                    <select onchange="this.form.submit()" name="year-month"
+                                            id="year-month" style="width:400px">
+                                        <%
+                                            for (String ym : UsageUtil.getYearMonths()) {
+                                                String selectedStr = "";
+                                                if (ym.equals(yearMonth)) {
+                                                    selectedStr = "selected=\"true\" ";
+                                                }
+                                        %>
+                                        <option <%=selectedStr%> value="<%=ym%>"><%=ym%>
+                                        </option>
+                                        <%
+                                            }
+                                        %>
+                                    </select>
+                                    <input type="hidden" name="requestedPage" id="requestedPage"
+                                           value="<%=pageNumber%>"/>
+                                </td>
+                            </tr>
+
+                            <tr>
+                                <td colspan="<%=rowCount%>" class="middle-header"><fmt:message
+                                        key="users"/></td>
+                            </tr>
+                            <tr>
+                                <th><fmt:message key="tenant.domain"/></th>
+                                <%
+                                    if (yearMonth.equals(currentYearMonth)) {
+                                %>
+                                <th><fmt:message key="number.of.users"/></th>
+                                <th><fmt:message key="storage.usage"/></th><%}%>
+                                <%--<th><fmt:message key="registry.total.bandwidth"/></th>--%>
+                                <th><fmt:message key="service.total.bandwidth"/></th>
+                                <th><fmt:message key="webapp.total.bandwidth"/></th>
+                                <th><fmt:message key="service.total.request"/></th>
+                                <th><fmt:message key="full.report"/></th>
+                            </tr>
+                            <%
+                                if (tenantUsages != null) {
+                                    for (TenantUsage usage : tenantUsages) {
+                                        String currentDataStorage = UsageUtil.getTotalDataStorage(usage);
+                                        String regBandwidth = UsageUtil.getTotalBandwidth(usage.getTotalRegistryBandwidth());
+                                        String svcBandwidth = UsageUtil.getTotalBandwidth(usage.getTotalServiceBandwidth());
+                                        String webBandwidth = UsageUtil.getTotalBandwidth(usage.getTotalWebappBandwidth());
+                                        long svcTotalRequest = usage.getTotalRequestStatistics().getRequestCount();
+                                        int numberOfUsers = usage.getNumberOfUsers();
+
+                                        String username = (String) request.getSession().getAttribute("logged-user");
+                                        String tenantName = usage.getDomain();
+                                        int tenantId = usage.getTenantId();
+                                        String fullReportLink = "any_tenant_usage.jsp?tenant-id=" + tenantId + "&year-month=" + yearMonth;
+                            %>
+
+                            <tr>
+                                <td><%=tenantName%>
+                                </td>
+                                <%
+                                    if (yearMonth.equals(currentYearMonth)) {
+                                %>
+                                <td><%=numberOfUsers%>
+                                </td>
+                                <td><%=currentDataStorage%>
+                                </td>
+                                <%
+                                    }
+                                %>
+                                <%--<td><%=regBandwidth%>
+                                </td>--%>
+                                <td><%=svcBandwidth%>
+                                </td>
+                                <td><%=webBandwidth%>
+                                </td>
+                                <td><%=svcTotalRequest%>
+                                </td>
+                                <td><a href="<%=fullReportLink%>">Full Report</a></td>
+                            </tr>
+                            <%
+
+                                }
+                            } else {
+                            %>
+                            <tr>
+                                <td><fmt:message key="empty.usage.data"/></td>
+                            </tr>
+                            </tr>
+                            <%
+                                }
+
+                            %>
+                            <carbon:resourcePaginator pageNumber="<%=pageNumber%>"
+                                                      numberOfPages="<%=numberOfPages%>"
+                                                      resourceBundle="org.wso2.carbon.usage.ui.i18n.Resources"
+                                                      nextKey="next" prevKey="prev"
+                                                      tdColSpan="6"
+                                                      paginationFunction="submitAllTenantPaginatedUsage({0})"/>
+                            </tbody>
+                        </table>
+                    </td>
+                </tr>
+                </tbody>
+            </table>
+        </form>
+        <br/>
+    </div>
+    </div>
+</fmt:bundle>
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/all_tenant_usage_report.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/all_tenant_usage_report.jsp b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/all_tenant_usage_report.jsp
new file mode 100644
index 0000000..5da662b
--- /dev/null
+++ b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/all_tenant_usage_report.jsp
@@ -0,0 +1,26 @@
+<!--
+  ~  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.
+  -->
+<%@ page import="org.wso2.carbon.usage.ui.report.AllTenantUsageReport" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+    AllTenantUsageReport usageReport = new AllTenantUsageReport(config, session, request);
+    String[] reportDataArray = usageReport.getUsageReportData();
+    System.out.println("Report lenth "+reportDataArray.length);
+    request.getSession().setAttribute("all_tenant_usage_data", reportDataArray);
+%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/any_tenant_usage.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/any_tenant_usage.jsp b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/any_tenant_usage.jsp
new file mode 100644
index 0000000..16970ff
--- /dev/null
+++ b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/any_tenant_usage.jsp
@@ -0,0 +1,463 @@
+<!--
+  ~  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.
+  -->
+<%@ page import="org.wso2.carbon.usage.stub.beans.xsd.BandwidthStatistics" %>
+<%@ page import="org.wso2.carbon.usage.stub.beans.xsd.RequestStatistics" %>
+<%@ page import="org.wso2.carbon.usage.stub.beans.xsd.TenantUsage" %>
+<%@ page import="org.wso2.carbon.usage.ui.utils.UsageUtil" %>
+<%@ page import="org.wso2.carbon.usage.stub.beans.xsd.CartridgeStatistics" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
+
+<carbon:jsi18n
+        resourceBundle="org.wso2.carbon.usage.ui.i18n.JSResources"
+        request="<%=request%>"/>
+
+
+<fmt:bundle basename="org.wso2.carbon.usage.ui.i18n.Resources">
+<carbon:breadcrumb
+        label="tenant.usage.report"
+        resourceBundle="org.wso2.carbon.usage.ui.i18n.Resources"
+        topPage="false"
+        request="<%=request%>"/>
+<jsp:include page="../registry_common/registry_common-i18n-ajaxprocessor.jsp"/>
+<script type="text/javascript" src="../registry_common/js/registry_validation.js"></script>
+<script type="text/javascript" src="../registry_common/js/registry_common.js"></script>
+<script type="text/javascript" src="../ajax/js/prototype.js"></script>
+<script type="text/javascript" src="js/register_config.js"></script>
+<%
+
+    TenantUsage usage = UsageUtil.retrieveTenantUsage(request, config, session);
+    int numberOfUsers = usage.getNumberOfUsers();
+    String yearMonth = request.getParameter("year-month");
+    if (yearMonth == null) {
+        // get the current year month
+        yearMonth = UsageUtil.getCurrentYearMonth();
+    }
+    String username = (String) request.getSession().getAttribute("logged-user");
+    String tenantName = usage.getDomain();
+    int tenantId = usage.getTenantId();
+    String currentYearMonth = UsageUtil.getCurrentYearMonth();
+%>
+
+<div id="middle">
+
+<h2><fmt:message key="tenant.usage.report"/> for the Month - <%=yearMonth%> (Tenant: <%=tenantName%>
+    )</h2>
+
+<div id="workArea">
+
+<form id="usageForm" action="any_tenant_usage.jsp" method="get">
+
+<table class="styledLeft">
+<thead>
+<tr>
+    <th>
+        <fmt:message key="report.duration"/>
+    </th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="nopadding">
+<table class="normal-nopadding" cellspacing="0">
+<tbody>
+<tr>
+    <td><fmt:message key="year.month"/></td>
+    <td colspan="3">
+        <input type="hidden" name="tenant-id" value="<%=tenantId%>"/>
+        <select onchange="this.form.submit()" name="year-month" id="year-month" style="width:200px">
+            <%
+                for (String ym : UsageUtil.getYearMonths()) {
+                    String selectedStr = "";
+                    if (ym.equals(yearMonth)) {
+                        selectedStr = "selected=\"true\" ";
+                    }
+            %>
+            <option <%=selectedStr%> value="<%=ym%>"><%=ym%>
+            </option>
+            <%
+                }
+            %>
+        </select>
+    </td>
+</tr>
+
+<%
+    if (currentYearMonth.equals(yearMonth)) {
+%>
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="users"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="number.of.users"/></td>
+    <td colspan="3">
+        <input readonly="1" type="text" name="userCount" id="userCount" style="width:200px"
+               value="<%=numberOfUsers%>"/>
+    </td>
+</tr>
+
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="storage.usage"/></td>
+</tr>
+
+<tr>
+    <td><fmt:message key="data.storage.name"/></td>
+    <td><fmt:message key="current.data.storage"/></td>
+    <td><fmt:message key="history.data.storage"/></td>
+    <td><fmt:message key="total.data.storage"/></td>
+</tr>
+<%
+    String totalDataStorage = UsageUtil.getTotalDataStorage(usage);
+    String currentDataStorage = UsageUtil.getCurrentDataStorage(usage);
+    String historyDataStorage = UsageUtil.getHistoryDataStorage(usage);
+%>
+<tr>
+    <td><fmt:message key="registry.content.storage.name"/></td>
+    <td colspan="1">
+        <input readonly="1" type="text" name="currentData" id="currentData" style="width:200px"
+               value="<%=currentDataStorage%>"/>
+    </td>
+    <td colspan="1">
+        <input readonly="1" type="text" name="historyData" id="historyData" style="width:200px"
+               value="<%=historyDataStorage%>"/>
+    </td>
+    <td colspan="1">
+        <input readonly="1" type="text" name="totalData" id="totalData" style="width:200px"
+               value="<%=totalDataStorage%>"/>
+    </td>
+</tr>
+
+<%
+    }
+%>
+
+
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="api.usage"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="server.name"/></td>
+    <td><fmt:message key="number.of.api.calls"/></td>
+</tr>
+<%
+    String apiCallCount = UsageUtil.getAPIUsage(usage);
+%>
+
+<tr>
+    <td><fmt:message key="all.server.name"/></td>
+    <td>
+        <input readonly="1" type="text" name="totalAPICalls" id="APICalls"
+               style="width:200px" value="<%=apiCallCount%>"/>
+    </td>
+</tr>
+
+
+
+
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="registry.bandwidth.usage"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="server.name"/></td>
+    <td><fmt:message key="incoming.bandwidth"/></td>
+    <td><fmt:message key="outgoing.bandwidth"/></td>
+    <td><fmt:message key="total.bandwidth"/></td>
+</tr>
+<%
+    String totRegInBandwidth = UsageUtil.getIncomingBandwidth(usage.getTotalRegistryBandwidth());
+    String totRegOutBandwidth = UsageUtil.getOutgoingBandwidth(usage.getTotalRegistryBandwidth());
+    String totRegBandwidth = UsageUtil.getTotalBandwidth(usage.getTotalRegistryBandwidth());
+    BandwidthStatistics[] regBWStats = usage.getRegistryBandwidthStatistics();
+    if (regBWStats != null) {
+        for (BandwidthStatistics stat : regBWStats) {
+            String regInBandwidth = UsageUtil.getIncomingBandwidth(stat);
+            String regOutBandwidth = UsageUtil.getOutgoingBandwidth(stat);
+            String regBandwidth = UsageUtil.getTotalBandwidth(stat);
+%>
+<tr>
+    <td><%=stat.getKey()%>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="registryIncomingBW" id="registryIncomingBW"
+               style="width:200px" value="<%=regInBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="registryOutgoingBW" id="registryOutgoingBW"
+               style="width:200px" value="<%=regOutBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="registryTotalBW" id="registryTotalBW"
+               style="width:200px" value="<%=regBandwidth%>"/>
+    </td>
+</tr>
+<%
+        }
+    }
+%>
+<tr>
+    <td><fmt:message key="all.server.name"/></td>
+    <td>
+        <input readonly="1" type="text" name="totRegistryIncomingBW" id="totRegistryIncomingBW"
+               style="width:200px" value="<%=totRegInBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totRegistryOutgoingBW" id="totRegistryOutgoingBW"
+               style="width:200px" value="<%=totRegOutBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totRegistryTotalBW" id="totRegistryTotalBW"
+               style="width:200px" value="<%=totRegBandwidth%>"/>
+    </td>
+</tr>
+
+
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="service.bandwidth.usage"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="server.name"/></td>
+    <td><fmt:message key="incoming.bandwidth"/></td>
+    <td><fmt:message key="outgoing.bandwidth"/></td>
+    <td><fmt:message key="total.bandwidth"/></td>
+</tr>
+<%
+    String totSvcInBandwidth = UsageUtil.getIncomingBandwidth(usage.getTotalServiceBandwidth());
+    String totSvcOutBandwidth = UsageUtil.getOutgoingBandwidth(usage.getTotalServiceBandwidth());
+    String totSvcBandwidth = UsageUtil.getTotalBandwidth(usage.getTotalServiceBandwidth());
+    BandwidthStatistics[] svcBWStats = usage.getServiceBandwidthStatistics();
+    if (svcBWStats != null) {
+        for (BandwidthStatistics stat : svcBWStats) {
+            String svcInBandwidth = UsageUtil.getIncomingBandwidth(stat);
+            String svcOutBandwidth = UsageUtil.getOutgoingBandwidth(stat);
+            String svcBandwidth = UsageUtil.getTotalBandwidth(stat);
+%>
+<tr>
+    <td><%=stat.getKey()%>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="serviceIncomingBW" id="serviceIncomingBW"
+               style="width:200px" value="<%=svcInBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="serviceOutgoingBW" id="serviceOutgoingBW"
+               style="width:200px" value="<%=svcOutBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="serviceTotalBW" id="serviceTotalBW"
+               style="width:200px" value="<%=svcBandwidth%>"/>
+    </td>
+</tr>
+<%
+        }
+    }
+%>
+<tr>
+    <td><fmt:message key="all.server.name"/></td>
+    <td>
+        <input readonly="1" type="text" name="totServiceIncomingBW" id="totServiceIncomingBW"
+               style="width:200px" value="<%=totSvcInBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totServiceOutgoingBW" id="totServiceOutgoingBW"
+               style="width:200px" value="<%=totSvcOutBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totServiceTotalBW" id="totServiceTotalBW"
+               style="width:200px" value="<%=totSvcBandwidth%>"/>
+    </td>
+</tr>
+
+
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="webapp.bandwidth.usage"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="server.name"/></td>
+    <td><fmt:message key="incoming.bandwidth"/></td>
+    <td><fmt:message key="outgoing.bandwidth"/></td>
+    <td><fmt:message key="total.bandwidth"/></td>
+</tr>
+<%
+    String totWebappInBandwidth = UsageUtil.getIncomingBandwidth(usage.getTotalWebappBandwidth());
+    String totWebappOutBandwidth = UsageUtil.getOutgoingBandwidth(usage.getTotalWebappBandwidth());
+    String totWebappBandwidth = UsageUtil.getTotalBandwidth(usage.getTotalWebappBandwidth());
+    BandwidthStatistics[] webappBWStats = usage.getWebappBandwidthStatistics();
+    if (webappBWStats != null) {
+        for (BandwidthStatistics stat : webappBWStats) {
+            String webappInBandwidth = UsageUtil.getIncomingBandwidth(stat);
+            String webappOutBandwidth = UsageUtil.getOutgoingBandwidth(stat);
+            String webappBandwidth = UsageUtil.getTotalBandwidth(stat);
+%>
+<tr>
+    <td><%=stat.getKey()%>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="webappIncomingBW" id="webappIncomingBW"
+               style="width:200px" value="<%=webappInBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="webappOutgoingBW" id="webappOutgoingBW"
+               style="width:200px" value="<%=webappOutBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="webappTotalBW" id="webappTotalBW" style="width:200px"
+               value="<%=webappBandwidth%>"/>
+    </td>
+</tr>
+<%
+        }
+    }
+%>
+<tr>
+    <td><fmt:message key="all.server.name"/></td>
+    <td>
+        <input readonly="1" type="text" name="totWebappIncomingBW" id="totWebappIncomingBW"
+               style="width:200px" value="<%=totWebappInBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totWebappOutgoingBW" id="totWebappOutgoingBW"
+               style="width:200px" value="<%=totWebappOutBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totWebappTotalBW" id="totWebappTotalBW"
+               style="width:200px" value="<%=totWebappBandwidth%>"/>
+    </td>
+</tr>
+
+
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="service.usage.stat"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="server.name"/></td>
+    <td><fmt:message key="service.usage.request"/></td>
+    <td><fmt:message key="service.usage.response"/></td>
+    <td><fmt:message key="service.usage.fault"/></td>
+</tr>
+<%
+    long totSvcReqCount = usage.getTotalRequestStatistics().getRequestCount();
+    long totSvcRespCount = usage.getTotalRequestStatistics().getResponseCount();
+    long totSvcFaultCount = usage.getTotalRequestStatistics().getFaultCount();
+    RequestStatistics[] svcStats = usage.getRequestStatistics();
+    if (svcStats != null) {
+        for (RequestStatistics stat : svcStats) {
+            long svcReqCount = stat.getRequestCount();
+            long svcResCount = stat.getResponseCount();
+            long svcFaultCount = stat.getFaultCount();
+%>
+<tr>
+    <td><%=stat.getKey()%>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="serviceRequestCount" id="serviceRequestCount"
+               style="width:200px" value="<%=svcReqCount%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="serviceResponseCount" id="serviceResponseCount"
+               style="width:200px" value="<%=svcResCount%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="serviceFaultCount" id="serviceFaultCount"
+               style="width:200px" value="<%=svcFaultCount%>"/>
+    </td>
+</tr>
+<%
+        }
+    }
+%>
+<tr>
+    <td><fmt:message key="all.server.name"/></td>
+    <td>
+        <input readonly="1" type="text" name="totServiceRequestCount" id="totServiceRequestCount"
+               style="width:200px" value="<%=totSvcReqCount%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totServiceResponseCount" id="totServiceResponseCount"
+               style="width:200px" value="<%=totSvcRespCount%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totServiceFaultCount" id="totServiceFaultCount"
+               style="width:200px" value="<%=totSvcFaultCount%>"/>
+    </td>
+</tr>
+
+<!--cartridge stats-->
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="cartridge.stat"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="cartridge.type"/></td>
+    <td><fmt:message key="image.id"/></td>
+    <td><fmt:message key="cartridge.hours"/></td>
+        <%--<td><fmt:message key="service.usage.fault"/></td>--%>
+</tr>
+<%
+    long totalHours = usage.getTotalCartridgeHours().getCartridgeHours();
+    CartridgeStatistics[] cs = usage.getCartridgeStatistics();
+    if(cs!=null && cs.length>0 && cs[0] != null) {
+        for(CartridgeStatistics stat: cs) {
+
+%>
+<tr>
+    <td><%=stat.getKey()%>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="imageId" id="imageId"
+               style="width:200px" value="<%=stat.getInstanceId()%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="cartridgeHours" id="cartridgeHours"
+               style="width:200px" value="<%=stat.getCartridgeHours()%>"/>
+    </td>
+
+</tr>
+<%
+        }
+    }
+%>
+<tr>
+    <td><fmt:message key="all.server.name"/></td>
+    <td>
+        <input readonly="1" type="text" name="totalImageIds" id="totalImageIds"
+               style="width:200px" value=""/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totalCartridgeHours" id="totalCartridgeHours"
+               style="width:200px" value="<%=totalHours%>"/>
+    </td>
+
+</tr>
+
+</tbody>
+</table>
+</td>
+</tr>
+</tbody>
+</table>
+<br/>
+<input type='button' class='button' style="align:right" id="backButtonID"
+       onclick='window.location="../tenant-usage/all_tenant_usage.jsp?region=region4&item=all_tenant_usage_menu"'
+       value='<fmt:message key="back"/>'/>
+</form>
+<br/>
+</div>
+</div>
+</fmt:bundle>
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/css/tenant-usage.css
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/css/tenant-usage.css b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/css/tenant-usage.css
new file mode 100644
index 0000000..5c85728
--- /dev/null
+++ b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/css/tenant-usage.css
@@ -0,0 +1,28 @@
+.disableLink {
+    color: #aaaaaa;
+}
+
+.pageLinks {
+    background: #FFFFFF none repeat scroll 0%;
+    border: 1px solid #DDDDDD;
+    padding: 2px 3px;
+    text-decoration: none;
+    margin: 0px;
+    margin-left: 2px;
+    margin-right: 2px;
+}
+
+.pageLinks-selected {
+    background: #e8e9ae none repeat scroll 0%;
+    border: 1px solid #DDDDDD;
+    padding: 2px 3px;
+    text-decoration: none;
+    margin: 0px;
+    margin-left: 2px;
+    margin-right: 2px;
+}
+
+a {
+    color: #386698;
+    cursor: pointer;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/docs/images/view-usage.png
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/docs/images/view-usage.png b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/docs/images/view-usage.png
new file mode 100644
index 0000000..4080da3
Binary files /dev/null and b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/docs/images/view-usage.png differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/docs/userguide.html
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/docs/userguide.html b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/docs/userguide.html
new file mode 100644
index 0000000..c70d4ad
--- /dev/null
+++ b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/docs/userguide.html
@@ -0,0 +1,78 @@
+<!--
+  ~  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.
+  -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <title>View Tenant Usage - User Guide</title>
+  <link href="../../admin/css/documentation.css" rel="stylesheet" type="text/css" media="all" />
+</head>
+
+<body>
+<h1>View Usage</h1>
+
+<p>
+You can view usage of the stratos resource by your organization(Tenant) from this page
+</p>
+
+<p>
+<img src="images/view-usage.png" alt="View Usage"/>
+<div><strong>Figure1: View Usage</strong></div>
+</p>
+ <h2> <b>Description of usage data report fields</b></h2>
+<p>
+<table border="1">
+<tr>
+<th>The Form Field</th>
+<th>Description</th>
+</tr>
+<tr>
+<td>Report Duration </td>
+<td>The year and the month the usage is metered.</td>
+</tr>
+        <tr>
+            <td>Number of Users</td>
+            <td>Number of users of your stratos account.(This is valid only for current month)</td>
+        </tr>
+       <tr>
+        <tr>
+            <td>Storage Usage</td>
+            <td>The registry data storage amount.</td>
+        </tr>
+        <tr>
+            <td>Registry Bandwidth Usage</td>
+            <td>Registry bandwidth consumed by the registry resource accesses(registry uploads, downloads).</td>
+        </tr>
+        <tr>
+            <td>Service Bandwidth Usage</td>
+            <td>The bandwidth consumed by the web services hosted by you.</td>
+        </tr>
+        <tr>
+            <td>Webapp Bandwidth Usage</td>
+            <td>The bandwidth consumed by the web services.</td>
+        </tr>
+ 	<tr>
+            <td>Service Usage Statistics</td>
+            <td>Service statistics of requests and responses of services.</td>
+        </tr>
+    </tbody>
+</table>
+</p>
+<div><strong>Table1: Description of usage data report fields</strong></div>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/images/instance-usage-report.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/images/instance-usage-report.gif b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/images/instance-usage-report.gif
new file mode 100644
index 0000000..4a1ae6a
Binary files /dev/null and b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/images/instance-usage-report.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/images/tenant-usage-report.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/images/tenant-usage-report.gif b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/images/tenant-usage-report.gif
new file mode 100644
index 0000000..a9b04e2
Binary files /dev/null and b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/images/tenant-usage-report.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/images/user-usage-report.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/images/user-usage-report.gif b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/images/user-usage-report.gif
new file mode 100644
index 0000000..9070c35
Binary files /dev/null and b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/images/user-usage-report.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/js/all-tenant-usage-report.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/js/all-tenant-usage-report.js b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/js/all-tenant-usage-report.js
new file mode 100644
index 0000000..61043f0
--- /dev/null
+++ b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/js/all-tenant-usage-report.js
@@ -0,0 +1,49 @@
+function createXmlHttpRequest() {
+    var request;
+
+    // Lets try using ActiveX to instantiate the XMLHttpRequest
+    // object
+    try {
+        request = new ActiveXObject("Microsoft.XMLHTTP");
+    } catch(ex1) {
+        try {
+            request = new ActiveXObject("Msxml2.XMLHTTP");
+        } catch(ex2) {
+            request = null;
+        }
+    }
+
+    // If the previous didn't work, lets check if the browser natively support XMLHttpRequest
+    if (!request && typeof XMLHttpRequest != "undefined") {
+        //The browser does, so lets instantiate the object
+        request = new XMLHttpRequest();
+    }
+    function removeCarriageReturns(string) {
+        return string.replace(/\n/g, "");
+    }
+
+    return request;
+}
+function getUsageReportData() {
+    alert(1);
+    var xmlHttpReq = createXmlHttpRequest();
+    alert(2);
+    // Make sure the XMLHttpRequest object was instantiated
+    if (xmlHttpReq) {
+        // This is a synchronous POST, hence UI blocking.
+        xmlHttpReq.open("GET", "all_tenant_usage_report.jsp", false);
+        xmlHttpReq.send(null);
+        
+        if (xmlHttpReq.status == 200) {
+            return removeCarriageReturns(xmlHttpReq.responseText);
+        }
+
+        return false;
+    }
+
+    return false;
+}
+function removeCarriageReturns(string) {
+	alert(string);
+    return string.replace(/\n/g, "");
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/js/tenant-usage.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/js/tenant-usage.js b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/js/tenant-usage.js
new file mode 100644
index 0000000..76c4363
--- /dev/null
+++ b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/js/tenant-usage.js
@@ -0,0 +1,7 @@
+function submitAllTenantPaginatedUsage(pageNumber) {
+    sessionAwareFunction(function() {
+        document.getElementById("requestedPage").value = pageNumber;
+        var usageForm = document.getElementById("usageForm");
+        usageForm.submit();
+    }, jsi18n["session.timed.out"]);
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/js/usage-report.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/js/usage-report.js b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/js/usage-report.js
new file mode 100644
index 0000000..ed9e306
--- /dev/null
+++ b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/js/usage-report.js
@@ -0,0 +1,48 @@
+function createXmlHttpRequest() {
+    var request;
+
+    // Lets try using ActiveX to instantiate the XMLHttpRequest
+    // object
+    try {
+        request = new ActiveXObject("Microsoft.XMLHTTP");
+    } catch(ex1) {
+        try {
+            request = new ActiveXObject("Msxml2.XMLHTTP");
+        } catch(ex2) {
+            request = null;
+        }
+    }
+
+    // If the previous didn't work, lets check if the browser natively support XMLHttpRequest
+    if (!request && typeof XMLHttpRequest != "undefined") {
+        //The browser does, so lets instantiate the object
+        request = new XMLHttpRequest();
+    }
+    function removeCarriageReturns(string) {
+        return string.replace(/\n/g, "");
+    }
+
+    return request;
+}
+function getUsageReportData() {
+
+    var xmlHttpReq = createXmlHttpRequest();
+
+    // Make sure the XMLHttpRequest object was instantiated
+    if (xmlHttpReq) {
+        // This is a synchronous POST, hence UI blocking.
+        xmlHttpReq.open("GET", "usage_report.jsp", false);
+        xmlHttpReq.send(null);
+
+        if (xmlHttpReq.status == 200) {
+            return removeCarriageReturns(xmlHttpReq.responseText);
+        }
+
+        return false;
+    }
+
+    return false;
+}
+function removeCarriageReturns(string) {
+    return string.replace(/\n/g, "");
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/tenant_usage.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/tenant_usage.jsp b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/tenant_usage.jsp
new file mode 100644
index 0000000..ee0ffd6
--- /dev/null
+++ b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/tenant_usage.jsp
@@ -0,0 +1,475 @@
+<!--
+  ~  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.
+  -->
+<%@ page import="org.wso2.carbon.usage.stub.beans.xsd.BandwidthStatistics" %>
+<%@ page import="org.wso2.carbon.usage.stub.beans.xsd.RequestStatistics" %>
+<%@ page import="org.wso2.carbon.usage.ui.report.UsageReport" %>
+<%@ page import="org.wso2.carbon.usage.stub.beans.xsd.TenantUsage" %>
+<%@ page import="java.util.List" %>
+<%@ page import="org.wso2.carbon.usage.ui.utils.UsageUtil" %>
+<%@ page import="org.wso2.carbon.usage.stub.beans.xsd.CartridgeStatistics" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
+
+<carbon:jsi18n
+        resourceBundle="org.wso2.carbon.usage.ui.i18n.JSResources"
+        request="<%=request%>"/>
+
+
+<fmt:bundle basename="org.wso2.carbon.usage.ui.i18n.Resources">
+<carbon:breadcrumb
+        label="tenant.menu"
+        resourceBundle="org.wso2.carbon.usage.ui.i18n.Resources"
+        topPage="true"
+        request="<%=request%>"/>
+<jsp:include page="../registry_common/registry_common-i18n-ajaxprocessor.jsp"/>
+<script type="text/javascript" src="../registry_common/js/registry_validation.js"></script>
+<script type="text/javascript" src="../registry_common/js/registry_common.js"></script>
+<script type="text/javascript" src="../ajax/js/prototype.js"></script>
+<script type="text/javascript" src="js/register_config.js"></script>
+<script type="text/javascript" src="js/usage-report.js"></script>
+<%
+
+    TenantUsage usage = UsageUtil.retrieveCurrentTenantUsage(request, config, session);
+    int numberOfUsers = usage.getNumberOfUsers();
+    String yearMonth = request.getParameter("year-month");
+    session.setAttribute("year-month", yearMonth);
+
+
+    if (yearMonth == null) {
+        // get the current year month
+        yearMonth = UsageUtil.getCurrentYearMonth();
+    }
+    String username = (String) request.getSession().getAttribute("logged-user");
+    String tenantName = usage.getDomain();
+    int tenantId = usage.getTenantId();
+    String currentYearMonth = UsageUtil.getCurrentYearMonth();
+%>
+
+<%
+
+    UsageReport usageReport = new UsageReport(config, session, request);
+	List<String>  reportDataArray = usageReport.getUsageReportData();
+    request.getSession().setAttribute("usage_data", reportDataArray);
+%>
+
+<div id="middle">
+
+<h2><fmt:message key="tenant.usage.report"/> for the Month - <%=yearMonth%> (Tenant: <%=tenantName%>
+    )</h2>
+
+<%--<div id="report_ui">
+    <carbon:report
+            component="org.wso2.carbon.usage"
+            template="usage_report"
+            pdfReport="true"
+            htmlReport="true"
+            excelReport="true"
+            reportDataSession="usage_data"
+               />
+</div>--%>
+<div id="workArea">
+
+<form id="usageForm" action="tenant_usage.jsp" method="post">
+
+<table class="styledLeft">
+<thead>
+<tr>
+    <th>
+        <fmt:message key="report.duration"/>
+    </th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td class="nopadding">
+<table class="normal-nopadding" cellspacing="0">
+<tbody>
+<tr>
+    <td><fmt:message key="year.month"/></td>
+    <td colspan="3">
+        <select onchange="this.form.submit()" name="year-month" id="year-month" style="width:200px">
+            <%
+                for (String ym : UsageUtil.getYearMonths()) {
+                    String selectedStr = "";
+                    if (ym.equals(yearMonth)) {
+                        selectedStr = "selected=\"true\" ";
+                    }
+            %>
+            <option <%=selectedStr%> value="<%=ym%>"><%=ym%>
+            </option>
+            <%
+                }
+            %>
+        </select>
+    </td>
+</tr>
+<%
+    if (currentYearMonth.equals(yearMonth)) {
+%>
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="users"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="number.of.users"/></td>
+    <td colspan="3">
+        <input readonly="1" type="text" name="userCount" id="userCount" style="width:200px"
+               value="<%=numberOfUsers%>"/>
+    </td>
+</tr>
+
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="storage.usage"/></td>
+</tr>
+
+<tr>
+    <td><fmt:message key="data.storage.name"/></td>
+    <td><fmt:message key="current.data.storage"/></td>
+    <td><fmt:message key="history.data.storage"/></td>
+    <td><fmt:message key="total.data.storage"/></td>
+</tr>
+<%
+    String totalDataStorage = UsageUtil.getTotalDataStorage(usage);
+    String currentDataStorage = UsageUtil.getCurrentDataStorage(usage);
+    String historyDataStorage = UsageUtil.getHistoryDataStorage(usage);
+%>
+<tr>
+    <td><fmt:message key="registry.content.storage.name"/></td>
+    <td colspan="1">
+        <input readonly="1" type="text" name="currentData" id="currentData" style="width:200px"
+               value="<%=currentDataStorage%>"/>
+    </td>
+    <td colspan="1">
+        <input readonly="1" type="text" name="historyData" id="historyData" style="width:200px"
+               value="<%=historyDataStorage%>"/>
+    </td>
+    <td colspan="1">
+        <input readonly="1" type="text" name="totalData" id="totalData" style="width:200px"
+               value="<%=totalDataStorage%>"/>
+    </td>
+</tr>
+<%
+    }
+%>
+
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="api.usage"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="server.name"/></td>
+    <td><fmt:message key="number.of.api.calls"/></td>
+</tr>
+<%
+    String apiCallCount = UsageUtil.getAPIUsage(usage);
+%>
+
+<tr>
+    <td><fmt:message key="all.server.name"/></td>
+    <td>
+        <input readonly="1" type="text" name="totalAPICalls" id="APICalls"
+               style="width:200px" value="<%=apiCallCount%>"/>
+    </td>
+</tr>
+
+<%--<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="registry.bandwidth.usage"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="server.name"/></td>
+    <td><fmt:message key="incoming.bandwidth"/></td>
+    <td><fmt:message key="outgoing.bandwidth"/></td>
+    <td><fmt:message key="total.bandwidth"/></td>
+</tr>
+<%
+    String totRegInBandwidth = UsageUtil.getIncomingBandwidth(usage.getTotalRegistryBandwidth());
+    String totRegOutBandwidth = UsageUtil.getOutgoingBandwidth(usage.getTotalRegistryBandwidth());
+    String totRegBandwidth = UsageUtil.getTotalBandwidth(usage.getTotalRegistryBandwidth());
+    BandwidthStatistics[] regBWStats = usage.getRegistryBandwidthStatistics();
+    if (regBWStats != null && regBWStats.length > 0 && regBWStats[0] != null) {
+        for (BandwidthStatistics stat : regBWStats) {
+            String regInBandwidth = UsageUtil.getIncomingBandwidth(stat);
+            String regOutBandwidth = UsageUtil.getOutgoingBandwidth(stat);
+            String regBandwidth = UsageUtil.getTotalBandwidth(stat);
+%>
+<tr>
+    <td><%=stat.getKey()%>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="registryIncomingBW" id="registryIncomingBW"
+               style="width:200px" value="<%=regInBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="registryOutgoingBW" id="registryOutgoingBW"
+               style="width:200px" value="<%=regOutBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="registryTotalBW" id="registryTotalBW"
+               style="width:200px" value="<%=regBandwidth%>"/>
+    </td>
+</tr>
+<%
+        }
+    }
+%>
+<tr>
+    <td><fmt:message key="all.server.name"/></td>
+    <td>
+        <input readonly="1" type="text" name="totRegistryIncomingBW" id="totRegistryIncomingBW"
+               style="width:200px" value="<%=totRegInBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totRegistryOutgoingBW" id="totRegistryOutgoingBW"
+               style="width:200px" value="<%=totRegOutBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totRegistryTotalBW" id="totRegistryTotalBW"
+               style="width:200px" value="<%=totRegBandwidth%>"/>
+    </td>
+</tr>
+--%>
+
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="service.bandwidth.usage"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="server.name"/></td>
+    <td><fmt:message key="incoming.bandwidth"/></td>
+    <td><fmt:message key="outgoing.bandwidth"/></td>
+    <td><fmt:message key="total.bandwidth"/></td>
+</tr>
+<%
+    String totSvcInBandwidth = UsageUtil.getIncomingBandwidth(usage.getTotalServiceBandwidth());
+    String totSvcOutBandwidth = UsageUtil.getOutgoingBandwidth(usage.getTotalServiceBandwidth());
+    String totSvcBandwidth = UsageUtil.getTotalBandwidth(usage.getTotalServiceBandwidth());
+    BandwidthStatistics[] svcBWStats = usage.getServiceBandwidthStatistics();
+    if (svcBWStats != null && svcBWStats.length > 0 && svcBWStats[0] != null) {
+        for (BandwidthStatistics stat : svcBWStats) {
+            String svcInBandwidth = UsageUtil.getIncomingBandwidth(stat);
+            String svcOutBandwidth = UsageUtil.getOutgoingBandwidth(stat);
+            String svcBandwidth = UsageUtil.getTotalBandwidth(stat);
+%>
+<tr>
+    <td><%=stat.getKey()%>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="serviceIncomingBW" id="serviceIncomingBW"
+               style="width:200px" value="<%=svcInBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="serviceOutgoingBW" id="serviceOutgoingBW"
+               style="width:200px" value="<%=svcOutBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="serviceTotalBW" id="serviceTotalBW"
+               style="width:200px" value="<%=svcBandwidth%>"/>
+    </td>
+</tr>
+<%
+        }
+    }
+%>
+<tr>
+    <td><fmt:message key="all.server.name"/></td>
+    <td>
+        <input readonly="1" type="text" name="totServiceIncomingBW" id="totServiceIncomingBW"
+               style="width:200px" value="<%=totSvcInBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totServiceOutgoingBW" id="totServiceOutgoingBW"
+               style="width:200px" value="<%=totSvcOutBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totServiceTotalBW" id="totServiceTotalBW"
+               style="width:200px" value="<%=totSvcBandwidth%>"/>
+    </td>
+</tr>
+
+
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="webapp.bandwidth.usage"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="server.name"/></td>
+    <td><fmt:message key="incoming.bandwidth"/></td>
+    <td><fmt:message key="outgoing.bandwidth"/></td>
+    <td><fmt:message key="total.bandwidth"/></td>
+</tr>
+<%
+    String totWebappInBandwidth = UsageUtil.getIncomingBandwidth(usage.getTotalWebappBandwidth());
+    String totWebappOutBandwidth = UsageUtil.getOutgoingBandwidth(usage.getTotalWebappBandwidth());
+    String totWebappBandwidth = UsageUtil.getTotalBandwidth(usage.getTotalWebappBandwidth());
+    BandwidthStatistics[] webappBWStats = usage.getWebappBandwidthStatistics();
+    if (webappBWStats != null && webappBWStats.length > 0 && webappBWStats[0] != null) {
+        for (BandwidthStatistics stat : webappBWStats) {
+            String webappInBandwidth = UsageUtil.getIncomingBandwidth(stat);
+            String webappOutBandwidth = UsageUtil.getOutgoingBandwidth(stat);
+            String webappBandwidth = UsageUtil.getTotalBandwidth(stat);
+%>
+<tr>
+    <td><%=stat.getKey()%>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="webappIncomingBW" id="webappIncomingBW"
+               style="width:200px" value="<%=webappInBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="webappOutgoingBW" id="webappOutgoingBW"
+               style="width:200px" value="<%=webappOutBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="webappTotalBW" id="webappTotalBW" style="width:200px"
+               value="<%=webappBandwidth%>"/>
+    </td>
+</tr>
+<%
+        }
+    }
+%>
+<tr>
+    <td><fmt:message key="all.server.name"/></td>
+    <td>
+        <input readonly="1" type="text" name="totWebappIncomingBW" id="totWebappIncomingBW"
+               style="width:200px" value="<%=totWebappInBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totWebappOutgoingBW" id="totWebappOutgoingBW"
+               style="width:200px" value="<%=totWebappOutBandwidth%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totWebappTotalBW" id="totWebappTotalBW"
+               style="width:200px" value="<%=totWebappBandwidth%>"/>
+    </td>
+</tr>
+
+
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="service.usage.stat"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="server.name"/></td>
+    <td><fmt:message key="service.usage.request"/></td>
+    <td><fmt:message key="service.usage.response"/></td>
+    <td><fmt:message key="service.usage.fault"/></td>
+</tr>
+<%
+    long totSvcReqCount = usage.getTotalRequestStatistics().getRequestCount();
+    long totSvcRespCount = usage.getTotalRequestStatistics().getResponseCount();
+    long totSvcFaultCount = usage.getTotalRequestStatistics().getFaultCount();
+    RequestStatistics[] svcStats = usage.getRequestStatistics();
+    if (svcStats != null && svcStats.length > 0 && svcStats[0] != null) {
+        for (RequestStatistics stat : svcStats) {
+            long svcReqCount = stat.getRequestCount();
+            long svcResCount = stat.getResponseCount();
+            long svcFaultCount = stat.getFaultCount();
+%>
+<tr>
+    <td><%=stat.getKey()%>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="serviceRequestCount" id="serviceRequestCount"
+               style="width:200px" value="<%=svcReqCount%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="serviceResponseCount" id="serviceResponseCount"
+               style="width:200px" value="<%=svcResCount%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="serviceFaultCount" id="serviceFaultCount"
+               style="width:200px" value="<%=svcFaultCount%>"/>
+    </td>
+</tr>
+<%
+        }
+    }
+%>
+<tr>
+    <td><fmt:message key="all.server.name"/></td>
+    <td>
+        <input readonly="1" type="text" name="totServiceRequestCount" id="totServiceRequestCount"
+               style="width:200px" value="<%=totSvcReqCount%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totServiceResponseCount" id="totServiceResponseCount"
+               style="width:200px" value="<%=totSvcRespCount%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totServiceFaultCount" id="totServiceFaultCount"
+               style="width:200px" value="<%=totSvcFaultCount%>"/>
+    </td>
+</tr>
+
+<!--cartridge stats-->
+<tr>
+    <td colspan="4" class="middle-header"><fmt:message key="cartridge.stat"/></td>
+</tr>
+<tr>
+    <td><fmt:message key="cartridge.type"/></td>
+    <td><fmt:message key="image.id"/></td>
+    <td><fmt:message key="cartridge.hours"/></td>
+    <%--<td><fmt:message key="service.usage.fault"/></td>--%>
+</tr>
+<%
+    long totalHours = usage.getTotalCartridgeHours().getCartridgeHours();
+    CartridgeStatistics[] cs = usage.getCartridgeStatistics();
+    if(cs!=null && cs.length>0 && cs[0] != null) {
+        for(CartridgeStatistics stat: cs) {
+
+%>
+<tr>
+    <td><%=stat.getKey()%>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="imageId" id="imageId"
+               style="width:200px" value="<%=stat.getInstanceId()%>"/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="cartridgeHours" id="cartridgeHours"
+               style="width:200px" value="<%=stat.getCartridgeHours()%>"/>
+    </td>
+
+</tr>
+<%
+        }
+    }
+%>
+<tr>
+    <td><fmt:message key="all.server.name"/></td>
+    <td>
+        <input readonly="1" type="text" name="totalImageIds" id="totalImageIds"
+               style="width:200px" value=""/>
+    </td>
+    <td>
+        <input readonly="1" type="text" name="totalCartridgeHours" id="totalCartridgeHours"
+               style="width:200px" value="<%=totalHours%>"/>
+    </td>
+
+</tr>
+
+</tbody>
+</table>
+</td>
+</tr>
+</tbody>
+</table>
+</form>
+<br/>
+</div>
+</div>
+</fmt:bundle>
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/usage_report.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/usage_report.jsp b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/usage_report.jsp
new file mode 100644
index 0000000..ed85ae0
--- /dev/null
+++ b/components/org.apache.stratos.usage.ui/src/main/resources/web/tenant-usage/usage_report.jsp
@@ -0,0 +1,29 @@
+<%@ page import="org.wso2.carbon.usage.ui.report.UsageReport" %>
+<!--
+  ~  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.
+  -->
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<carbon:jsi18n
+resourceBundle="org.wso2.carbon.usage.ui.i18n.JSResources"
+request="<%=request%>" />
+<%
+
+    UsageReport usageReport = new UsageReport(config, session, request);
+    String[] reportDataArray = usageReport.getUsageReportData();
+    request.getSession().setAttribute("usage_data", reportDataArray);
+%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/org.apache.stratos.usage/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage/pom.xml b/components/org.apache.stratos.usage/pom.xml
new file mode 100644
index 0000000..d546f39
--- /dev/null
+++ b/components/org.apache.stratos.usage/pom.xml
@@ -0,0 +1,146 @@
+<!--
+# 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.stratos</groupId>
+        <artifactId>stratos-components-parent</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+	<relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.stratos.usage</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Stratos - Usage</name>
+
+    <build>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>target/generated-code/src</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+                        <Bundle-Name>${project.artifactId}</Bundle-Name>
+                        <ListenerManager-RequiredServices>
+                            org.apache.stratos.usage.api.TenantUsageRetriever
+                        </ListenerManager-RequiredServices>
+                        <Private-Package>
+                            org.apache.stratos.usage.internal.*,
+                            org.apache.stratos.usage.util.*,
+                            org.apache.stratos.usage.services.*,
+                            org.apache.stratos.usage.client.*
+                        </Private-Package>
+                        <Export-Package>
+                            org.apache.stratos.usage.beans.*,
+                            org.apache.stratos.usage.api.*,
+                        </Export-Package>
+                        <Import-Package>
+                            org.wso2.carbon.rule.*,
+                            org.wso2.carbon.registry.core.*;version=1.0.1,
+                            org.wso2.carbon.registry.resource.*,
+                            org.apache.stratos.common.*,
+                            !javax.xml.namespace,
+                            javax.xml.namespace; version=0.0.0,
+                            javax.servlet;version="${imp.pkg.version.javax.servlet}",
+                            javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
+                            org.apache.axiom.*; version="${axiom.osgi.version.range}",
+                            *;resolution:=optional
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+            
+        </plugins>
+    </build>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.axis2.wso2</groupId>
+            <artifactId>axis2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.registry.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.user.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.user.mgt</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.common</artifactId>
+            <version>2.1.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.usage.agent</artifactId>
+	    <version>2.1.2</version>
+        </dependency>
+         <!--<dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.usage.meteringqueryds.stub</artifactId>
+        </dependency>-->
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.ndatasource.core</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+    </dependencies>
+</project>