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:17:56 UTC

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

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/java/org/wso2/carbon/usage/util/DataAccessObject.java
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/java/org/wso2/carbon/usage/util/DataAccessObject.java b/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/java/org/wso2/carbon/usage/util/DataAccessObject.java
deleted file mode 100644
index d7fce1d..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/java/org/wso2/carbon/usage/util/DataAccessObject.java
+++ /dev/null
@@ -1,358 +0,0 @@
-package org.wso2.carbon.usage.util;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.stratos.common.constants.UsageConstants;
-import org.wso2.carbon.usage.beans.BandwidthStatistics;
-import org.wso2.carbon.usage.beans.RequestStatistics;
-import org.wso2.carbon.usage.beans.TenantDataCapacity;
-
-import javax.sql.DataSource;
-import java.sql.*;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-
-public class DataAccessObject {
-    
-    private static Log log = LogFactory.getLog(DataAccessObject.class);
-    private DataSource dataSource;
-    
-    
-    public DataAccessObject(){
-        if(Util.getDataSourceService()!=null){
-            try{
-            this.dataSource = (DataSource)Util.getDataSourceService().
-                                getDataSource(Util.BILLING_DATA_SOURCE_NAME).getDSObject();
-            }catch(Exception e){
-                log.error("Error occurred while obtaining " + Util.BILLING_DATA_SOURCE_NAME +
-                        " datasource from data source service.", e);
-                dataSource=null;
-            }
-        }else{
-            log.error("Cannot obtain data source " + Util.BILLING_DATA_SOURCE_NAME + ". Datasource service is null");
-            dataSource=null;
-        }
-    }
-
-
-    public List<BandwidthStatistics> getHourlyBandwidthStats(int tenantId, Calendar startDate,
-                                                        Calendar endDate) throws Exception{
-        Connection connection = null;
-        List<BandwidthStatistics> bwsList = new ArrayList<BandwidthStatistics>();
-
-        try{
-            connection = dataSource.getConnection();
-            String sql = "SELECT * FROM USAGE_HOURLY_ANALYTICS WHERE TENANT_ID = ? AND HOUR_FACT >= ? AND HOUR_FACT <= ?";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ps.setInt(1, tenantId);
-            ps.setTimestamp(2, new Timestamp(startDate.getTimeInMillis()));
-            ps.setTimestamp(3, new Timestamp(endDate.getTimeInMillis()));
-            ResultSet resultSet = ps.executeQuery();
-
-            while(resultSet.next()){
-                String key = resultSet.getString("PAYLOAD_TYPE");
-                BandwidthStatistics bws = new BandwidthStatistics(key);
-
-                if(UsageConstants.SERVICE_INCOMING_BW.equals(key) ||
-                        UsageConstants.WEBAPP_INCOMING_BW.equals(key) ||
-                        UsageConstants.REGISTRY_INCOMING_BW.equals(key)){
-                    bws.setIncomingBandwidth(resultSet.getLong("PAYLOAD_VALUE"));
-
-                }else if(UsageConstants.SERVICE_OUTGOING_BW.equals(key) ||
-                        UsageConstants.WEBAPP_OUTGOING_BW.equals(key) ||
-                        UsageConstants.REGISTRY_OUTGOING_BW.equals(key)){
-                    bws.setOutgoingBandwidth(resultSet.getLong("PAYLOAD_VALUE"));
-                }else {
-                    //Do nothing
-                }
-
-                bws.setServerUrl(resultSet.getString("SERVER_NAME"));
-
-                bwsList.add(bws);
-            }
-        }catch(SQLException e){
-            log.error("Error occurred while retrieving hourly usage data from the database. ", e);
-
-        }finally {
-            if(connection!=null){
-                connection.close();
-            }
-        }
-
-        return bwsList;
-
-    }
-
-    /**
-     *
-     * @param tenantId Tenant ID
-     * @param startDate Start date - Stats of this date will be included
-     * @param endDate End date - Stats of this date will be included
-     * @return A list of BandwidthStatistics objects
-     * @throws Exception
-     */
-    public List<BandwidthStatistics> getDailyBandwidthStats(int tenantId, Calendar startDate,
-                                                        Calendar endDate) throws Exception{
-        Connection connection = null;
-        List<BandwidthStatistics> bwsList = new ArrayList<BandwidthStatistics>();
-
-        try{
-            connection = dataSource.getConnection();
-            String sql = "SELECT * FROM USAGE_DAILY_ANALYTICS WHERE TENANT_ID = ? AND DAY_FACT >= ? AND DAY_FACT <= ?";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ps.setInt(1, tenantId);
-            ps.setTimestamp(2, new Timestamp(startDate.getTimeInMillis()));
-            ps.setTimestamp(3, new Timestamp(endDate.getTimeInMillis()));
-            ResultSet resultSet = ps.executeQuery();
-
-            while(resultSet.next()){
-                String key = resultSet.getString("PAYLOAD_TYPE");
-                BandwidthStatistics bws = new BandwidthStatistics(key);
-                
-                if(UsageConstants.SERVICE_INCOMING_BW.equals(key) || 
-                        UsageConstants.WEBAPP_INCOMING_BW.equals(key) ||
-                        UsageConstants.REGISTRY_INCOMING_BW.equals(key)){
-                    bws.setIncomingBandwidth(resultSet.getLong("PAYLOAD_VALUE"));
-                    
-                }else if(UsageConstants.SERVICE_OUTGOING_BW.equals(key) || 
-                        UsageConstants.WEBAPP_OUTGOING_BW.equals(key) ||
-                        UsageConstants.REGISTRY_OUTGOING_BW.equals(key)){
-                    bws.setOutgoingBandwidth(resultSet.getLong("PAYLOAD_VALUE"));
-                }else {
-                    //Do nothing
-                }
-                
-                bws.setServerUrl(resultSet.getString("SERVER_NAME"));
-                
-                bwsList.add(bws);
-            }
-        }catch(SQLException e){
-            log.error("Error occurred while retrieving daily usage data from the database. ", e);
-            
-        }finally {
-            if(connection!=null){
-                connection.close();
-            }
-        }
-
-        return bwsList;
-
-    }
-
-    /**
-     *
-     * @param tenantId Tenant ID
-     * @param month Stats of this month will be retrieved
-     * @return A list of BandwidthStatistics objects
-     * @throws Exception
-     */
-    public List<BandwidthStatistics> getMonthlyBandwidthStats(int tenantId,
-                                                          Calendar month) throws Exception{
-        Connection connection = null;
-        List<BandwidthStatistics> bwsList = new ArrayList<BandwidthStatistics>();
-
-        try{
-            connection = dataSource.getConnection();
-            String sql = "SELECT * FROM USAGE_MONTHLY_ANALYTICS WHERE TENANT_ID = ? AND MONTH_FACT = ?";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ps.setInt(1, tenantId);
-            ps.setTimestamp(2, new Timestamp(month.getTimeInMillis()));
-            ResultSet resultSet = ps.executeQuery();
-
-            while(resultSet.next()){
-                String key = resultSet.getString("PAYLOAD_DATA");
-                BandwidthStatistics bws = new BandwidthStatistics(key);
-
-                if(UsageConstants.SERVICE_INCOMING_BW.equals(key) ||
-                        UsageConstants.WEBAPP_INCOMING_BW.equals(key) ||
-                        UsageConstants.REGISTRY_INCOMING_BW.equals(key)){
-                    bws.setIncomingBandwidth(resultSet.getLong("PAYLOAD_VALUE"));
-
-                }else if(UsageConstants.SERVICE_OUTGOING_BW.equals(key) ||
-                        UsageConstants.WEBAPP_OUTGOING_BW.equals(key) ||
-                        UsageConstants.REGISTRY_OUTGOING_BW.equals(key)){
-                    bws.setOutgoingBandwidth(resultSet.getLong("PAYLOAD_VALUE"));
-                }else {
-                    //Do nothing
-                }
-
-                bws.setServerUrl(resultSet.getString("SERVER_NAME"));
-
-                bwsList.add(bws);
-            }
-        }catch(SQLException e){
-            log.error("Error occurred while retrieving monthly usage data from the database. ", e);
-
-        }finally {
-            if(connection!=null){
-                connection.close();
-            }
-        }
-
-        return bwsList;
-
-    }
-
-    /**
-     *
-     * @param tenantId Tenant ID
-     * @param startDate Start date - Stats of this date will be included
-     * @param endDate End date - Stats of this date will be included
-     * @return A list of RequestStatistics objects
-     * @throws Exception
-     */
-    public List<RequestStatistics> getHourlyRequestStats(int tenantId, Calendar startDate,
-                                                         Calendar endDate) throws Exception{
-        Connection connection = null;
-        List<RequestStatistics> rsList = new ArrayList<RequestStatistics>();
-
-        try{
-            connection = dataSource.getConnection();
-            String sql = "SELECT * FROM SERVICE_STATS_HOURLY_ANALYTICS WHERE TENANT_ID = ? AND HOUR_FACT >= ? AND HOUR_FACT <= ?";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ps.setInt(1, tenantId);
-            ps.setTimestamp(2, new Timestamp(startDate.getTimeInMillis()));
-            ps.setTimestamp(3, new Timestamp(endDate.getTimeInMillis()));
-            ResultSet resultSet = ps.executeQuery();
-
-            while(resultSet.next()){
-                String key = resultSet.getString("SERVER_NAME");
-                RequestStatistics reqStat = new RequestStatistics(key);
-                reqStat.setRequestCount(resultSet.getInt("REQUEST_COUNT"));
-                reqStat.setResponseCount(resultSet.getInt("RESPONSE_COUNT"));
-                reqStat.setFaultCount(resultSet.getInt("FAULT_COUNT"));
-
-                rsList.add(reqStat);
-            }
-        }catch(SQLException e){
-            log.error("Error occurred while retrieving hourly service request stats from the database. ", e);
-
-        }finally {
-            if(connection!=null){
-                connection.close();
-            }
-        }
-
-        return rsList;
-
-    }
-
-
-    /**
-     *
-     * @param tenantId Tenant ID
-     * @param startDate Start date - Stats of this date will be included
-     * @param endDate End date - Stats of this date will be included
-     * @return A list of RequestStatistics objects
-     * @throws Exception
-     */
-    public List<RequestStatistics> getDailyRequestStats(int tenantId, Calendar startDate,
-                                                        Calendar endDate) throws Exception{
-        Connection connection = null;
-        List<RequestStatistics> rsList = new ArrayList<RequestStatistics>();
-
-        try{
-            connection = dataSource.getConnection();
-            String sql = "SELECT * FROM SERVICE_STATS_DAILY_ANALYTICS WHERE TENANT_ID = ? AND DAY_FACT >= ? AND DAY_FACT <= ?";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ps.setInt(1, tenantId);
-            ps.setTimestamp(2, new Timestamp(startDate.getTimeInMillis()));
-            ps.setTimestamp(3, new Timestamp(endDate.getTimeInMillis()));
-            ResultSet resultSet = ps.executeQuery();
-
-            while(resultSet.next()){
-                String key = resultSet.getString("SERVER_NAME");
-                RequestStatistics reqStat = new RequestStatistics(key);
-                reqStat.setRequestCount(resultSet.getInt("REQUEST_COUNT"));
-                reqStat.setResponseCount(resultSet.getInt("RESPONSE_COUNT"));
-                reqStat.setFaultCount(resultSet.getInt("FAULT_COUNT"));
-
-                rsList.add(reqStat);
-            }
-        }catch(SQLException e){
-            log.error("Error occurred while retrieving daily service request stats from the database. ", e);
-
-        }finally {
-            if(connection!=null){
-                connection.close();
-            }
-        }
-
-        return rsList;
-
-    }
-
-    /**
-     *
-     * @param tenantId Tenant ID
-     * @param month Month - Stats of this month will be retrieved
-     * @return A list of RequestStatistics objects
-     * @throws Exception
-     */
-    public List<RequestStatistics> getMonthlyRequestStats(int tenantId,
-                                                          Calendar month) throws Exception{
-        Connection connection = null;
-        List<RequestStatistics> rsList = new ArrayList<RequestStatistics>();
-
-        try{
-            connection = dataSource.getConnection();
-            String sql = "SELECT * FROM SERVICE_STATS_MONTHLY_ANALYTICS WHERE TENANT_ID = ? AND MONTH_FACT = ?";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ps.setInt(1, tenantId);
-            ps.setTimestamp(2, new Timestamp(month.getTimeInMillis()));
-            ResultSet resultSet = ps.executeQuery();
-
-            while(resultSet.next()){
-                String key = resultSet.getString("SERVER_NAME");
-                RequestStatistics reqStat = new RequestStatistics(key);
-                reqStat.setRequestCount(resultSet.getInt("REQUEST_COUNT"));
-                reqStat.setResponseCount(resultSet.getInt("RESPONSE_COUNT"));
-                reqStat.setFaultCount(resultSet.getInt("FAULT_COUNT"));
-
-                rsList.add(reqStat);
-            }
-        }catch(SQLException e){
-            log.error("Error occurred while retrieving monthly service request stats from the database. ", e);
-
-        }finally {
-            if(connection!=null){
-                connection.close();
-            }
-        }
-
-        return rsList;
-
-    }
-
-    public TenantDataCapacity getTenantDataCapacity(int tenantId) throws Exception{
-        Connection connection = null;
-        TenantDataCapacity tenantDataCapacity = null;
-
-        try{
-            connection = dataSource.getConnection();
-            String id = ""  + tenantId + "Final";
-            String sql = "SELECT * FROM REGISTRY_USAGE_HOURLY_ANALYTICS WHERE ID = ?";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ps.setString(1, id);
-            ResultSet resultSet = ps.executeQuery();
-
-            while(resultSet.next()){
-                long currentCapacity = resultSet.getLong("CURRENT_USAGE");
-                long historyCapacity = resultSet.getLong("HISTORY_USAGE");
-
-                tenantDataCapacity = new TenantDataCapacity(currentCapacity, historyCapacity);
-            }
-        }catch(SQLException e){
-            log.error("Error occurred while retrieving registry data usage from . ", e);
-
-        }finally {
-            if(connection!=null){
-                connection.close();
-            }
-        }
-
-        return tenantDataCapacity;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/java/org/wso2/carbon/usage/util/Util.java
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/java/org/wso2/carbon/usage/util/Util.java b/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/java/org/wso2/carbon/usage/util/Util.java
deleted file mode 100644
index 6c9ebae..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/java/org/wso2/carbon/usage/util/Util.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *  Copyright (c) 2005-2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- *  WSO2 Inc. 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.wso2.carbon.usage.util;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.BundleContext;
-import org.wso2.carbon.ndatasource.core.DataSourceService;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.registry.core.service.RegistryService;
-import org.wso2.carbon.registry.core.session.UserRegistry;
-import org.wso2.carbon.user.core.UserRealm;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.utils.ConfigurationContextService;
-import org.wso2.carbon.usage.api.TenantUsageRetriever;
-
-import javax.sql.DataSource;
-
-/**
- * Util methods for usage.
- */
-public class Util {
-
-    private static final Log log = LogFactory.getLog(Util.class);
-
-    private static RegistryService registryService;
-    private static RealmService realmService;
-    private static TenantUsageRetriever tenantUsageRetriever;
-    private static ConfigurationContextService configurationContextService;
-    private static DataSourceService dataSourceService;
-    public static String BILLING_DATA_SOURCE_NAME="WSO2BillingDS";
-
-    public static synchronized void setRegistryService(RegistryService service) {
-        if (registryService == null) {
-            registryService = service;
-        }
-    }
-    
-    public static void setConfigurationContextService(
-            ConfigurationContextService configurationContextService) {
-        Util.configurationContextService = configurationContextService;
-    }
-    
-    public static ConfigurationContextService getConfigurationContextService(){
-        return configurationContextService;
-    }
-
-    public static synchronized void setRealmService(RealmService service) {
-        if (realmService == null) {
-            realmService = service;
-        }
-    }
-
-    public static RealmService getRealmService() {
-        return realmService;
-    }
-
-    public static RegistryService getRegistryService() {
-        return registryService;
-    }
-
-    public static TenantUsageRetriever getTenantUsageRetriever() {
-        return tenantUsageRetriever;
-    }
-
-    public static UserRealm getUserRealm(int tenantId) throws RegistryException {
-        return registryService.getUserRealm(tenantId);
-    }
-
-    public static UserRegistry getSuperTenantGovernanceSystemRegistry() throws RegistryException {
-        return registryService.getGovernanceSystemRegistry();
-    }
-
-    public static void registerRetrieverServices(BundleContext bundleContext) throws Exception {
-        ConfigurationContextService confCtxSvc = Util.getConfigurationContextService();
-
-        // creating and registering tenant and user usage retrievers
-        tenantUsageRetriever = new TenantUsageRetriever(
-                registryService, confCtxSvc.getServerConfigContext());
-        bundleContext.registerService(
-                TenantUsageRetriever.class.getName(), tenantUsageRetriever, null);
-    }
-
-    public static DataSourceService getDataSourceService() {
-        return dataSourceService;
-    }
-
-    public static void setDataSourceService(DataSourceService dataSourceService) {
-        Util.dataSourceService = dataSourceService;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/META-INF/component.xml b/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/META-INF/component.xml
deleted file mode 100644
index 2d2f81e..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/META-INF/component.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~  Copyright (c) 2009, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-  ~
-  ~  Licensed 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.
-  -->
-
-<component xmlns="http://products.wso2.org/carbon">
-    <ManagementPermissions>
-        <ManagementPermission>
-            <DisplayName>Monitor</DisplayName>
-            <ResourceId>/permission/admin/monitor</ResourceId>
-        </ManagementPermission>
-        <!--<ManagementPermission>
-            <DisplayName>User-Usage</DisplayName>
-            <ResourceId>/permission/admin/monitor/userUsage</ResourceId>
-        </ManagementPermission> -->
-        <ManagementPermission>
-            <DisplayName>Tenant-Usage</DisplayName>
-            <ResourceId>/permission/admin/monitor/tenantUsage</ResourceId>
-        </ManagementPermission>
-        <ManagementPermission>
-            <DisplayName>Protected</DisplayName>
-            <ResourceId>/permission/protected</ResourceId>
-        </ManagementPermission>
-        <ManagementPermission>
-            <DisplayName>Monitor</DisplayName>
-            <ResourceId>/permission/protected/monitor</ResourceId>
-        </ManagementPermission>
-        <ManagementPermission>
-            <DisplayName>Any-Tenant-Usage</DisplayName>
-            <ResourceId>/permission/protected/monitor/anytenantUsage</ResourceId>
-        </ManagementPermission>
-    </ManagementPermissions>
-</component>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/META-INF/services.xml
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/META-INF/services.xml b/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/META-INF/services.xml
deleted file mode 100644
index 8e82415..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/META-INF/services.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- !
- ! Copyright 2006 The Apache Software Foundation.
- !
- ! Licensed 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.
- !-->
-<serviceGroup>
-
-    <service name="UsageService" scope="transportsession">
-        <transports>
-            <transport>https</transport>
-        </transports>
-        <parameter name="ServiceClass" locked="false">
-            org.wso2.carbon.usage.services.UsageService
-        </parameter>
-
-        <operation name="retrieveCurrentTenantUsage">
-            <parameter name="AuthorizationAction" locked="true">/permission/admin/monitor/tenantUsage</parameter>
-        </operation>
-        <operation name="retrieveTenantUsages">
-            <parameter name="superTenantService" locked="true">true</parameter>
-            <parameter name="AuthorizationAction" locked="true">/permission/protected/monitor/anytenantUsage</parameter>
-        </operation>
-        <operation name="retrievePaginatedTenantUsages">
-            <parameter name="superTenantService" locked="true">true</parameter>
-            <parameter name="AuthorizationAction" locked="true">/permission/protected/monitor/anytenantUsage</parameter>
-        </operation>
-        <operation name="retrieveTenantUsage">
-            <parameter name="superTenantService" locked="true">true</parameter>
-            <parameter name="AuthorizationAction" locked="true">/permission/protected/monitor/anytenantUsage</parameter>
-        </operation>
-    </service>
-    <parameter name="adminService" locked="true">true</parameter>
-
-    <parameter name="hiddenService" locked="true">true</parameter>
-</serviceGroup>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/reports/all_tenant_usage_report.jrxml
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/reports/all_tenant_usage_report.jrxml b/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/reports/all_tenant_usage_report.jrxml
deleted file mode 100644
index b9483aa..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/reports/all_tenant_usage_report.jrxml
+++ /dev/null
@@ -1,137 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="all_tenant_usage_report"  pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
-	<property name="ireport.zoom" value="1.0"/>
-	<property name="ireport.x" value="0"/>
-	<property name="ireport.y" value="0"/>
-	<field name="yearMonth" class="java.lang.String"/>
-	<field name="tenantName" class="java.lang.String"/>
-	<field name="numberOfUsers" class="java.lang.String"/>
-	<field name="currentDataStorage" class="java.lang.String"/>
-	<field name="regBandwidth" class="java.lang.String"/>
-	<field name="svcBandwidth" class="java.lang.String"/>
-	<field name="svcTotalRequest" class="java.lang.String"/>
-	<background>
-		<band splitType="Stretch"/>
-	</background>
-	<title>
-		<band height="79" splitType="Stretch"/>
-	</title>
-	<pageHeader>
-		<band height="35" splitType="Stretch">
-			<staticText>
-				<reportElement mode="Transparent" x="0" y="0" width="279" height="35" backcolor="#9B9999"/>
-				<textElement>
-					<font size="13" isBold="true"/>
-				</textElement>
-				<text><![CDATA[Tenant Usage Report for the month]]></text>
-			</staticText>
-			<textField>
-				<reportElement mode="Transparent" x="279" y="0" width="276" height="35" backcolor="#9B9999"/>
-				<textElement>
-					<font size="13" isBold="true"/>
-				</textElement>
-				<textFieldExpression class="java.lang.String"><![CDATA[$F{yearMonth}]]></textFieldExpression>
-			</textField>
-		</band>
-	</pageHeader>
-	<columnHeader>
-		<band height="61" splitType="Stretch">
-			<staticText>
-				<reportElement mode="Opaque" x="0" y="29" width="100" height="32" backcolor="#C0C0C0"/>
-				<textElement>
-					<font isBold="true"/>
-				</textElement>
-				<text><![CDATA[Domain]]></text>
-			</staticText>
-			<staticText>
-				<reportElement mode="Opaque" x="100" y="29" width="100" height="32" backcolor="#C0C0C0"/>
-				<textElement>
-					<font isBold="true"/>
-				</textElement>
-				<text><![CDATA[Number of users]]></text>
-			</staticText>
-			<staticText>
-				<reportElement mode="Opaque" x="200" y="29" width="100" height="32" backcolor="#C0C0C0"/>
-				<textElement>
-					<font isBold="true"/>
-				</textElement>
-				<text><![CDATA[Storage Usage]]></text>
-			</staticText>
-			<staticText>
-				<reportElement mode="Opaque" x="300" y="29" width="100" height="32" backcolor="#C0C0C0"/>
-				<textElement>
-					<font isBold="true"/>
-				</textElement>
-				<text><![CDATA[Total Registry Bandwidth]]></text>
-			</staticText>
-			<staticText>
-				<reportElement mode="Opaque" x="400" y="29" width="73" height="32" backcolor="#C0C0C0"/>
-				<textElement>
-					<font isBold="true"/>
-				</textElement>
-				<text><![CDATA[Total Service Bandwidht]]></text>
-			</staticText>
-			<staticText>
-				<reportElement mode="Opaque" x="473" y="29" width="82" height="32" backcolor="#C0C0C0"/>
-				<textElement>
-					<font isBold="true"/>
-				</textElement>
-				<text><![CDATA[Service Requests]]></text>
-			</staticText>
-		</band>
-	</columnHeader>
-	<detail>
-		<band height="103" splitType="Stretch">
-			<textField>
-				<reportElement x="0" y="21" width="100" height="20"/>
-				<textElement/>
-				<textFieldExpression class="java.lang.String"><![CDATA[$F{tenantName}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="100" y="21" width="100" height="20"/>
-				<textElement/>
-				<textFieldExpression class="java.lang.String"><![CDATA[$F{numberOfUsers}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="200" y="21" width="100" height="20"/>
-				<textElement/>
-				<textFieldExpression class="java.lang.String"><![CDATA[$F{currentDataStorage}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="300" y="21" width="100" height="20"/>
-				<textElement/>
-				<textFieldExpression class="java.lang.String"><![CDATA[$F{regBandwidth}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="400" y="21" width="73" height="20"/>
-				<textElement/>
-				<textFieldExpression class="java.lang.String"><![CDATA[$F{svcBandwidth}]]></textFieldExpression>
-			</textField>
-			<textField>
-				<reportElement x="473" y="21" width="82" height="20"/>
-				<textElement/>
-				<textFieldExpression class="java.lang.String"><![CDATA[$F{svcTotalRequest}]]></textFieldExpression>
-			</textField>
-		</band>
-	</detail>
-	<columnFooter>
-		<band height="45" splitType="Stretch"/>
-	</columnFooter>
-	<pageFooter>
-		<band height="54" splitType="Stretch">
-			<textField>
-				<reportElement x="455" y="34" width="100" height="20"/>
-				<textElement/>
-				<textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression>
-			</textField>
-			<textField pattern="MMMMM dd, yyyy">
-				<reportElement x="0" y="34" width="100" height="20"/>
-				<textElement/>
-				<textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression>
-			</textField>
-		</band>
-	</pageFooter>
-	<summary>
-		<band height="42" splitType="Stretch"/>
-	</summary>
-</jasperReport>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/reports/usage_report.jrxml
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/reports/usage_report.jrxml b/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/reports/usage_report.jrxml
deleted file mode 100644
index 5b43c2f..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.0/src/main/resources/reports/usage_report.jrxml
+++ /dev/null
@@ -1,135 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="report2" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
-	<property name="ireport.zoom" value="1.0"/>
-	<property name="ireport.x" value="0"/>
-	<property name="ireport.y" value="0"/>
-	<field name="task" class="java.lang.String"/>
-	<field name="usagecol1" class="java.lang.String"/>
-	<field name="usagecol2" class="java.lang.String"/>
-	<field name="usagecol3" class="java.lang.String"/>
-	<field name="usagecol4" class="java.lang.String"/>
-	<field name="usagecol1Value" class="java.lang.String"/>
-	<field name="usagecol2Value" class="java.lang.String"/>
-	<field name="usagecol3Value" class="java.lang.String"/>
-	<field name="usagecol4Value" class="java.lang.String"/>
-	<field name="tenantDomain" class="java.lang.String"/>
-	<group name="usagedatagroup">
-		<groupExpression><![CDATA[$F{task}]]></groupExpression>
-		<groupHeader>
-			<band height="72" splitType="Stretch">
-				<rectangle>
-					<reportElement x="0" y="21" width="555" height="16" backcolor="#D0F5E8"/>
-				</rectangle>
-				<textField>
-					<reportElement x="0" y="22" width="555" height="16"/>
-					<textElement>
-						<font size="9"/>
-					</textElement>
-					<textFieldExpression class="java.lang.String"><![CDATA[$F{task}]]></textFieldExpression>
-				</textField>
-				<rectangle>
-					<reportElement x="0" y="38" width="555" height="16" backcolor="#E6F1B6"/>
-				</rectangle>
-				<textField isBlankWhenNull="true">
-					<reportElement x="0" y="39" width="132" height="17"/>
-					<textElement verticalAlignment="Middle">
-						<font size="9"/>
-					</textElement>
-					<textFieldExpression class="java.lang.String"><![CDATA[$F{usagecol1}]]></textFieldExpression>
-				</textField>
-				<textField isBlankWhenNull="true">
-					<reportElement x="145" y="39" width="132" height="15"/>
-					<textElement verticalAlignment="Middle">
-						<font size="9"/>
-					</textElement>
-					<textFieldExpression class="java.lang.String"><![CDATA[$F{usagecol2}]]></textFieldExpression>
-				</textField>
-				<textField isBlankWhenNull="true">
-					<reportElement x="288" y="39" width="132" height="16"/>
-					<textElement verticalAlignment="Middle">
-						<font size="9"/>
-					</textElement>
-					<textFieldExpression class="java.lang.String"><![CDATA[$F{usagecol3}]]></textFieldExpression>
-				</textField>
-				<textField isBlankWhenNull="true">
-					<reportElement x="423" y="38" width="132" height="16"/>
-					<textElement verticalAlignment="Middle"/>
-					<textFieldExpression class="java.lang.String"><![CDATA[$F{usagecol4}]]></textFieldExpression>
-				</textField>
-				<rectangle>
-					<reportElement x="0" y="55" width="555" height="15" backcolor="#DBE596"/>
-				</rectangle>
-				<textField isBlankWhenNull="true">
-					<reportElement x="0" y="57" width="132" height="14"/>
-					<textElement verticalAlignment="Middle"/>
-					<textFieldExpression class="java.lang.String"><![CDATA[$F{usagecol1Value}]]></textFieldExpression>
-				</textField>
-				<textField isBlankWhenNull="true">
-					<reportElement x="145" y="55" width="132" height="16"/>
-					<textElement verticalAlignment="Middle">
-						<font size="9"/>
-					</textElement>
-					<textFieldExpression class="java.lang.String"><![CDATA[$F{usagecol2Value}]]></textFieldExpression>
-				</textField>
-				<textField isBlankWhenNull="true">
-					<reportElement x="287" y="55" width="132" height="14"/>
-					<textElement verticalAlignment="Middle"/>
-					<textFieldExpression class="java.lang.String"><![CDATA[$F{usagecol3Value}]]></textFieldExpression>
-				</textField>
-				<textField isBlankWhenNull="true">
-					<reportElement x="423" y="56" width="132" height="15"/>
-					<textElement verticalAlignment="Middle"/>
-					<textFieldExpression class="java.lang.String"><![CDATA[$F{usagecol4Value}]]></textFieldExpression>
-				</textField>
-			</band>
-		</groupHeader>
-		<groupFooter>
-			<band splitType="Stretch"/>
-		</groupFooter>
-	</group>
-	<background>
-		<band splitType="Stretch"/>
-	</background>
-	<title>
-		<band height="17" splitType="Stretch"/>
-	</title>
-	<pageHeader>
-		<band height="19" splitType="Stretch">
-			<textField pattern="dd/MM/yyyy h.mm a">
-				<reportElement x="403" y="0" width="132" height="16"/>
-				<textElement/>
-				<textFieldExpression class="java.util.Date"><![CDATA[new java.util.Date()]]></textFieldExpression>
-			</textField>
-			<staticText>
-				<reportElement x="0" y="1" width="169" height="15"/>
-				<textElement textAlignment="Right">
-					<font size="12" isUnderline="true"/>
-				</textElement>
-				<text><![CDATA[Usage Report For : ]]></text>
-			</staticText>
-			<textField>
-				<reportElement x="169" y="0" width="234" height="16"/>
-				<textElement verticalAlignment="Middle">
-					<font size="12"/>
-				</textElement>
-				<textFieldExpression class="java.lang.String"><![CDATA[$F{tenantDomain}]]></textFieldExpression>
-			</textField>
-		</band>
-	</pageHeader>
-	<columnHeader>
-		<band splitType="Stretch"/>
-	</columnHeader>
-	<detail>
-		<band height="5" splitType="Stretch"/>
-	</detail>
-	<columnFooter>
-		<band splitType="Stretch"/>
-	</columnFooter>
-	<pageFooter>
-		<band height="8" splitType="Stretch"/>
-	</pageFooter>
-	<summary>
-		<band height="7" splitType="Stretch"/>
-	</summary>
-</jasperReport>
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.1/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/pom.xml b/components/stratos/usage/org.wso2.carbon.usage/2.1.1/pom.xml
deleted file mode 100644
index 8b4005a..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/pom.xml
+++ /dev/null
@@ -1,142 +0,0 @@
-<!--
-# Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-#
-# Licensed 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.wso2.carbon</groupId>
-        <artifactId>usage-parent</artifactId>
-        <version>2.1.0</version>
-	<relativePath>../../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.wso2.carbon.usage</artifactId>
-    <version>2.1.1</version>
-    <packaging>bundle</packaging>
-    <name>WSO2 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.wso2.carbon.usage.api.TenantUsageRetriever
-                        </ListenerManager-RequiredServices>
-                        <Private-Package>
-                            org.wso2.carbon.usage.internal.*,
-                            org.wso2.carbon.usage.util.*,
-                            org.wso2.carbon.usage.services.*,
-                            org.wso2.carbon.usage.client.*
-                        </Private-Package>
-                        <Export-Package>
-                            org.wso2.carbon.usage.beans.*,
-                            org.wso2.carbon.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.wso2.carbon.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.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.stratos.common</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.usage.agent</artifactId>
-        </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>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/api/TenantUsageRetriever.java
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/api/TenantUsageRetriever.java b/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/api/TenantUsageRetriever.java
deleted file mode 100644
index 22037e2..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/api/TenantUsageRetriever.java
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed 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.wso2.carbon.usage.api;
-
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.stratos.common.constants.UsageConstants;
-import org.wso2.carbon.stratos.common.util.CommonUtil;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.registry.core.service.RegistryService;
-import org.wso2.carbon.usage.beans.*;
-import org.wso2.carbon.usage.util.DataAccessObject;
-import org.wso2.carbon.usage.util.Util;
-import org.wso2.carbon.user.core.UserRealm;
-import org.wso2.carbon.user.core.UserStoreException;
-import org.wso2.carbon.user.core.tenant.TenantManager;
-
-import java.util.*;
-
-public class TenantUsageRetriever {
-    private static final Log log = LogFactory.getLog(TenantUsageRetriever.class);
-    private static final String DEFAULT_SERVICE_NAME = "Stratos";
-    private static final String METERING_ENDPOINT = "local://services/MeteringQueryDS";
-    private static final String TOTAL_LABEL = "Total";
-    public static final int REG_BANDWIDTH_INDEX = 0;
-    public static final int SVC_BANDWIDTH_INDEX = 1;
-    public static final int WEBAPP_BANDWIDTH_INDEX = 2;
-    public static final int API_CALL_STATS=3;
-
-    private RegistryService registryService;
-    private DataAccessObject dao;
-
-    public TenantUsageRetriever(RegistryService registryService, ConfigurationContext configContext)
-            throws Exception {
-
-        // we are loading the essentials from the constructors in order to restrict the users
-        // to use the usage retrievers.
-        this.registryService = registryService;
-        this.dao = new DataAccessObject();
-    }
-
-
-    public TenantDataCapacity getDataCapacity(int tenantId, Calendar startDate, Calendar endDate,
-                                              boolean currentMonth) throws Exception {
-        TenantDataCapacity dataCapacity = null;
-
-        if(currentMonth){
-            dataCapacity = dao.getTenantDataCapacity(tenantId);
-        } else {
-            //we don't have a way to see the registry usage of last months yet
-        }
-
-        return dataCapacity;
-
-    }
-
-    /**
-     * This returns the number of users in a given tenant
-     * @param tenantId Tenant ID
-     * @return Number of users
-     * @throws RegistryException
-     */
-    public int getCurrentUserCount(int tenantId) throws RegistryException {
-        UserRealm userRealm = registryService.getUserRealm(tenantId);
-        int usersCount;
-        try {
-            String[] users = userRealm.getUserStoreManager().listUsers("*", -1);
-            usersCount = users.length;
-        } catch (UserStoreException e) {
-            String msg = "Error in getting the current users.";
-            log.error(msg, e);
-            throw new RegistryException(msg, e);
-        }
-        return usersCount;
-    }
-
-    public BandwidthStatistics[][] getBandwidthStatistics(int tenantId, Calendar startDate,
-                                                          Calendar endDate, boolean currentMonth) throws Exception {
-        //return the bandwidth usage of a user for a given period
-        BandwidthStatistics[] stats;
-        if (currentMonth) {
-            //get from daily usage stats
-            List<BandwidthStatistics> bwsList = new ArrayList<BandwidthStatistics>();
-            bwsList = dao.getDailyBandwidthStats(tenantId, startDate, endDate);
-
-            //next we'll get from the houlry stats to get the stats which are not yet
-            //summarized to the daily stats table
-            Calendar startHour = Calendar.getInstance();
-            startHour.set(Calendar.HOUR, 0);
-            startHour.set(Calendar.MINUTE, 0);
-            startHour.set(Calendar.SECOND, 0);
-
-            Calendar endHour = Calendar.getInstance();
-
-            bwsList.addAll(dao.getHourlyBandwidthStats(tenantId, startHour, endHour));
-            stats = convertBWListToArray(bwsList);
-
-        } else {
-            //get from monthly usage stats
-            Calendar monthCal = (Calendar) endDate.clone();
-            monthCal.set(Calendar.DATE, 0);
-            monthCal.set(Calendar.HOUR, 0);
-            monthCal.set(Calendar.MINUTE, 0);
-            monthCal.set(Calendar.SECOND, 0);
-
-            stats = convertBWListToArray(dao.getMonthlyBandwidthStats(tenantId, monthCal));
-        }
-
-        // store the statistics in a temporary map. This is because, we are getting the server name
-        // from the URL and there might be two distinct URL gives same server name.
-        // For example, http://esb.a.b/ and http://esb.c.d/ both will give the server name as "esb"
-        // Hence, the value should be accumulated value
-        HashMap<String, BandwidthStatistics> regBwMap = new HashMap<String, BandwidthStatistics>();
-        HashMap<String, BandwidthStatistics> svcBwMap = new HashMap<String, BandwidthStatistics>();
-        HashMap<String, BandwidthStatistics> webappBwMap = new HashMap<String, BandwidthStatistics>();
-
-        if (stats != null) {
-            for (BandwidthStatistics stat : stats) {
-                //Proceed only if incoming bandwidth or outgoing bandwidth is not zero
-                if (stat.getIncomingBandwidth() == 0 && stat.getOutgoingBandwidth() == 0) {
-                    continue;
-                }
-
-                //TODO: fix the extractServiceUrl method properly
-                String serverName = extractServiceNameFromUrl(stat.getServerUrl());
-                String bandwidthName = stat.getKey();
-
-                HashMap<String, BandwidthStatistics> bwMap;
-                if (bandwidthName.equals(UsageConstants.REGISTRY_INCOMING_BW) ||
-                        bandwidthName.equals(UsageConstants.REGISTRY_OUTGOING_BW)) {
-                    bwMap = regBwMap;
-                } else if (bandwidthName.equals(UsageConstants.SERVICE_INCOMING_BW) ||
-                        bandwidthName.equals(UsageConstants.SERVICE_OUTGOING_BW)) {
-                    bwMap = svcBwMap;
-                } else if (bandwidthName.equals(UsageConstants.WEBAPP_INCOMING_BW) ||
-                        bandwidthName.equals(UsageConstants.WEBAPP_OUTGOING_BW)) {
-                    bwMap = webappBwMap;
-                } else {
-                    log.warn("Unable to identify bandwidth name " + bandwidthName);
-                    continue;
-                }
-
-                //find whether the map already has this key; If not, insert a new one
-                BandwidthStatistics reqStat = bwMap.get(serverName);
-                if (reqStat == null) {
-                    reqStat = new BandwidthStatistics(serverName);
-                    bwMap.put(serverName, reqStat);
-                }
-
-                // Update the service specific statistics
-                reqStat.setIncomingBandwidth(
-                        reqStat.getIncomingBandwidth() + stat.getIncomingBandwidth());
-                reqStat.setOutgoingBandwidth(
-                        reqStat.getOutgoingBandwidth() + stat.getOutgoingBandwidth());
-            }
-        }
-
-        //Convert to array and return it
-        BandwidthStatistics[][] returnValue = new BandwidthStatistics[3][];
-        Collection<BandwidthStatistics> values = regBwMap.values();
-        returnValue[REG_BANDWIDTH_INDEX] = values.toArray(new BandwidthStatistics[values.size()]);
-        values = svcBwMap.values();
-        returnValue[SVC_BANDWIDTH_INDEX] = values.toArray(new BandwidthStatistics[values.size()]);
-        values = webappBwMap.values();
-        returnValue[WEBAPP_BANDWIDTH_INDEX] = values.toArray(new BandwidthStatistics[values.size()]);
-
-        return returnValue;
-    }
-
-
-    public APIManagerUsageStats[] getAPIManagerUsageStats(int tenantId, Calendar startDate,
-                                                          Calendar endDate, boolean currentMonth) throws Exception {
-        //return the bandwidth usage of a user for a given period
-        APIManagerUsageStats[] stats;
-        if (currentMonth) {
-            //get from daily usage stats
-            List<APIManagerUsageStats> bwsList = new ArrayList<APIManagerUsageStats>();
-            bwsList = dao.getDailyAPIManagerUsageStats(tenantId, startDate, endDate);
-
-            //next we'll get from the houlry stats to get the stats which are not yet
-            //summarized to the daily stats table
-            Calendar startHour = Calendar.getInstance();
-            startHour.set(Calendar.HOUR, 0);
-            startHour.set(Calendar.MINUTE, 0);
-            startHour.set(Calendar.SECOND, 0);
-
-            Calendar endHour = Calendar.getInstance();
-
-            bwsList.addAll(dao.getHourlyAPIManagerUsageStats(tenantId, startHour, endHour));
-            stats = convertAPIStatListToArray(bwsList);
-
-        } else {
-            //get from monthly usage stats
-            Calendar monthCal = (Calendar) endDate.clone();
-            monthCal.set(Calendar.DATE, 0);
-            monthCal.set(Calendar.HOUR, 0);
-            monthCal.set(Calendar.MINUTE, 0);
-            monthCal.set(Calendar.SECOND, 0);
-
-            stats = convertAPIStatListToArray(dao.getMonthlyAPIManagerUsageStats(tenantId, monthCal));
-        }
-        HashMap<String, APIManagerUsageStats> statMap = new HashMap<String, APIManagerUsageStats>();
-        if (stats != null) {
-            for (APIManagerUsageStats stat : stats) {
-                if (stat.getRequestCount() == 0) {
-                    continue;
-                }
-                String serverName = extractServiceNameFromUrl(stat.getServerUrl());
-                String statName = stat.getKey();
-
-                HashMap<String, APIManagerUsageStats> statsHashMap;
-                if (statName.equals("API-Call")) {
-                    statsHashMap = statMap;
-                } else {
-                    log.warn("Unable to identify bandwidth name " + statName);
-                    continue;
-                }
-
-                //find whether the map already has this key; If not, insert a new one
-                APIManagerUsageStats reqStat = statsHashMap.get(serverName);
-                if (reqStat == null) {
-                    reqStat = new APIManagerUsageStats(serverName);
-                    statsHashMap.put(serverName, reqStat);
-                }
-                reqStat.setRequestCount(stat.getRequestCount());
-            }
-        }
-
-        //Convert to array and return it
-        APIManagerUsageStats[] returnValue = new APIManagerUsageStats[0];
-        Collection<APIManagerUsageStats> values = statMap.values();
-        returnValue = values.toArray(new APIManagerUsageStats[values.size()]);
-        return returnValue;
-    }
-
-
-    public RequestStatistics[] getRequestStatistics(int tenantId, Calendar startDate,
-                                                    Calendar endDate, boolean currentMonth) throws Exception {
-        RequestStatistics[] stats;
-        if (currentMonth) {
-            //get from daily usage stats
-            List<RequestStatistics> rsList = new ArrayList<RequestStatistics>();
-            rsList = dao.getDailyRequestStats(tenantId, startDate, endDate);
-
-            //next we'll get from the houlry stats to get the stats which are not yet
-            //summarized to the daily stats table
-            Calendar startHour = Calendar.getInstance();
-            startHour.set(Calendar.HOUR, 0);
-            startHour.set(Calendar.MINUTE, 0);
-            startHour.set(Calendar.SECOND, 0);
-
-            Calendar endHour = Calendar.getInstance();
-
-            rsList.addAll(dao.getHourlyRequestStats(tenantId, startHour, endHour));
-
-            stats = convertRSListToArray(rsList);
-        } else {
-            //get from monthly usage stats
-            Calendar monthCal = (Calendar) endDate.clone();
-            monthCal.set(Calendar.DATE, 0);
-            monthCal.set(Calendar.HOUR, 0);
-            monthCal.set(Calendar.MINUTE, 0);
-            monthCal.set(Calendar.SECOND, 0);
-
-            stats = convertRSListToArray(dao.getMonthlyRequestStats(tenantId, monthCal));
-        }
-
-        // store the statistics in a temporary map. This is because, we are getting the server name
-        // from the URL and there might be two distinct URL gives same server name.
-        // For example, http://esb.a.b/ and http://esb.c.d/ both will give the server name as "esb"
-        // Hence, the value should be accumulated value
-        HashMap<String, RequestStatistics> tempReqStatMap = new HashMap<String, RequestStatistics>();
-
-        if (stats != null) {
-            for (RequestStatistics stat : stats) {
-                //Proceed only if request count is not zero
-                if (stat.getRequestCount() == 0) {
-                    continue;
-                }
-
-                String serverName = extractServiceNameFromUrl(stat.getKey());
-
-                //find whether the map already has this key; If not, insert a new one
-                RequestStatistics reqStat = tempReqStatMap.get(serverName);
-                if (reqStat == null) {
-                    reqStat = new RequestStatistics(serverName);
-                    tempReqStatMap.put(serverName, reqStat);
-                }
-
-                // Update the service specific statistics
-                reqStat.setRequestCount(reqStat.getRequestCount() + stat.getRequestCount());
-                reqStat.setResponseCount(reqStat.getResponseCount() + stat.getResponseCount());
-                reqStat.setFaultCount(reqStat.getFaultCount() + stat.getFaultCount());
-            }
-        }
-
-        //Convert to array and return it
-        Collection<RequestStatistics> values = tempReqStatMap.values();
-        return values.toArray(new RequestStatistics[values.size()]);
-
-    }
-
-    public TenantUsage getTenantUsage(int tenantId, String yearMonth) throws Exception {
-        //get the domain name
-        TenantManager tenantManger = Util.getRealmService().getTenantManager();
-        String domain = tenantManger.getDomain(tenantId);
-        TenantUsage tenantUsage = new TenantUsage(tenantId, domain);
-
-        //Get the startDate, endDate from yearMonth String
-        Date date = CommonUtil.getDateFromMonthString(yearMonth);
-        Calendar startDate = Calendar.getInstance();
-        startDate.setTime(date);
-        Calendar endDate = (Calendar) startDate.clone();
-        endDate.add(Calendar.MONTH, 1);
-
-        //Calculate whether the yearMonth fits to current month; if the current date is less than
-        // endDate, then we treat it as current month
-        boolean isCurrentMonth = (Calendar.getInstance().compareTo(endDate) <= 0);
-
-        //get the data capacity
-        TenantDataCapacity capacity;
-        try {
-            capacity = getDataCapacity(tenantId, startDate, endDate, isCurrentMonth);
-        } catch (Exception e) {
-            String msg = "Error in getting data capacity from metering service.";
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-        tenantUsage.setRegistryCapacity(capacity);
-
-        //get the service request statistics
-        RequestStatistics[] reqStats = null;
-        try {
-            reqStats = getRequestStatistics(tenantId, startDate, endDate, isCurrentMonth);
-        } catch (Exception e) {
-            String msg = "Error in getting request statistics from metering service.";
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-        tenantUsage.setRequestStatistics(reqStats);
-
-        //Calculate total Request statistics
-        RequestStatistics totalReqStat = new RequestStatistics(TOTAL_LABEL);
-        long totalReq = 0;
-        long totalRes = 0;
-        long totalFault = 0;
-        if(reqStats!=null){
-            for (RequestStatistics stat : reqStats) {
-                totalReq += stat.getRequestCount();
-                totalRes += stat.getResponseCount();
-                totalFault += stat.getFaultCount();
-            }
-            totalReqStat.setRequestCount(totalReq);
-            totalReqStat.setResponseCount(totalRes);
-            totalReqStat.setFaultCount(totalFault);
-        }
-        tenantUsage.setTotalRequestStatistics(totalReqStat);
-
-        //get Bandwidth statistics
-        BandwidthStatistics[][] bwStats = null;
-        try {
-            bwStats = getBandwidthStatistics(tenantId, startDate, endDate, isCurrentMonth);
-        } catch (Exception e) {
-            String msg = "Error in getting bandwidth statistics from metering service.";
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-        tenantUsage.setRegistryBandwidthStatistics(bwStats[REG_BANDWIDTH_INDEX]);
-        tenantUsage.setServiceBandwidthStatistics(bwStats[SVC_BANDWIDTH_INDEX]);
-        tenantUsage.setWebappBandwidthStatistics(bwStats[WEBAPP_BANDWIDTH_INDEX]);
-
-        //get the total bandwidths
-        int index = 0;
-        for (BandwidthStatistics[] bwArray : bwStats) {
-            long incomingBandwidth = 0;
-            long outgoingBandwidth = 0;
-            for (BandwidthStatistics bandwidth : bwArray) {
-                incomingBandwidth += bandwidth.getIncomingBandwidth();
-                outgoingBandwidth += bandwidth.getOutgoingBandwidth();
-            }
-            BandwidthStatistics total = new BandwidthStatistics(TOTAL_LABEL);
-            total.setIncomingBandwidth(incomingBandwidth);
-            total.setOutgoingBandwidth(outgoingBandwidth);
-            switch (index) {
-                case REG_BANDWIDTH_INDEX:
-                    tenantUsage.setTotalRegistryBandwidth(total);
-                    break;
-                case SVC_BANDWIDTH_INDEX:
-                    tenantUsage.setTotalServiceBandwidth(total);
-                    break;
-                case WEBAPP_BANDWIDTH_INDEX:
-                    tenantUsage.setTotalWebappBandwidth(total);
-                    break;
-            }
-            ++index;
-        }
-
-        // the users count will be calculated only if the yearMonth is the current yearMonth
-        if (isCurrentMonth) {
-            int usersCount = getCurrentUserCount(tenantId);
-            tenantUsage.setNumberOfUsers(usersCount);
-        }
-        // get the API invocation data
-        APIManagerUsageStats[] apiStats = null;
-        try {
-            apiStats = getAPIManagerUsageStats(tenantId, startDate, endDate, isCurrentMonth);
-        } catch (Exception e) {
-            String msg = "Error in getting bandwidth statistics from metering service.";
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-        tenantUsage.setApiManagerUsageStats(apiStats);
-        return tenantUsage;
-    }
-
-    /**
-     * @param serviceURL
-     * @return service name
-     *         <p/>
-     *         Extract the stratos service part from URL; expecting the URL as
-     *         protocol://service.domain:port/tenant-domain/ or service.domain:port/tenant
-     *         We are interested in "service" part only
-     */
-    private String extractServiceNameFromUrl(String serviceURL) {
-        if (serviceURL == null || serviceURL.equals("")) {
-            //No service URL is given, so return a default value
-            return DEFAULT_SERVICE_NAME;
-        }
-
-        int startIndex = serviceURL.indexOf("://"); //exclude protocol:// part
-        if (startIndex != -1) {
-            // protocol://service.domain:port/tenant-domain/ case
-            startIndex += 3;
-        } else {
-            //service.domain:port/tenant case
-            startIndex = 0;
-        }
-
-        int endIndex = serviceURL.indexOf('.', startIndex); //take upto first "."
-        if (endIndex == -1) {
-            // "." is not there; search for ":"
-            endIndex = serviceURL.indexOf(':', startIndex);
-
-            if (endIndex == -1) {
-                //Still could not find ":", then search for "/"
-                endIndex = serviceURL.indexOf('/', startIndex);
-
-                if (endIndex == -1) {
-                    //Noting is there, so take the whole service URL
-                    endIndex = serviceURL.length();
-                }
-            }
-
-        }
-        return serviceURL.substring(startIndex, endIndex);
-    }
-
-    /**
-     * @return Instance Usages Statics Array that contains data
-     * @throws Exception when back end error occurs
-     */
-    public InstanceUsageStatics[] getInstanceUsages() throws Exception {
-
-        //TODO: implement
-        return null;
-        /*InstanceUsageStat[] instanceData = meteringStub.getInstanceUsageStats();
-        if (instanceData == null || instanceData.length == 0) {
-            return null;
-        }
-        InstanceUsageStatics[] returnValue = new InstanceUsageStatics[instanceData.length];
-        int elementID = 0;
-        for (InstanceUsageStat iu : instanceData) {
-            InstanceUsageStatics iu1 = new InstanceUsageStatics();
-            iu1.setInstanceID(iu.getInstanceId().intValue());
-            iu1.setInstanceURL(iu.getServerURL());
-            iu1.setStartTime(iu.getStartTimestamp());
-            iu1.setStopTime(iu.getStopTimestamp());
-            iu1.setRunning(iu.getIsRunning());
-            returnValue[elementID] = iu1;
-            elementID = elementID + 1;
-        }
-        return returnValue;
-        */
-    }
-
-
-    private BandwidthStatistics[] convertBWListToArray(List<BandwidthStatistics> bwsList) {
-        BandwidthStatistics[] bwsArray = new BandwidthStatistics[bwsList.size()];
-        bwsArray = bwsList.toArray(bwsArray);
-        return bwsArray;
-    }
-
-    private APIManagerUsageStats[] convertAPIStatListToArray(List<APIManagerUsageStats> bwsList) {
-        APIManagerUsageStats[] bwsArray = new APIManagerUsageStats[bwsList.size()];
-        bwsArray = bwsList.toArray(bwsArray);
-        return bwsArray;
-    }
-
-    private RequestStatistics[] convertRSListToArray(List<RequestStatistics> rsList) {
-        RequestStatistics[] rsArray = new RequestStatistics[rsList.size()];
-        rsArray = rsList.toArray(rsArray);
-        return rsArray;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/APIManagerUsageStats.java
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/APIManagerUsageStats.java b/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/APIManagerUsageStats.java
deleted file mode 100644
index 9321011..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/APIManagerUsageStats.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-*  Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-*  WSO2 Inc. 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.wso2.carbon.usage.beans;
-
-public class APIManagerUsageStats {
-    private String key;
-    private String serverUrl;
-    private long incomingBandwidth;
-    private long outgoingBandwidth;
-    private long requestCount;
-
-    public long getRequestCount() {
-        return requestCount;
-    }
-
-    public void setRequestCount(long requestCount) {
-        this.requestCount = requestCount;
-    }
-
-
-    public APIManagerUsageStats(String key) {
-        this.key = key;
-    }
-
-    public String getKey() {
-        return key;
-    }
-
-    public void setKey(String key) {
-        this.key = key;
-    }
-
-    public long getIncomingBandwidth() {
-        return incomingBandwidth;
-    }
-
-    public void setIncomingBandwidth(long incomingBandwidth) {
-        this.incomingBandwidth = incomingBandwidth;
-    }
-
-    public long getOutgoingBandwidth() {
-        return outgoingBandwidth;
-    }
-
-    public void setOutgoingBandwidth(long outgoingBandwidth) {
-        this.outgoingBandwidth = outgoingBandwidth;
-    }
-
-    public String getServerUrl() {
-        return serverUrl;
-    }
-
-    public void setServerUrl(String serverUrl) {
-        this.serverUrl = serverUrl;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/BandwidthStatistics.java
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/BandwidthStatistics.java b/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/BandwidthStatistics.java
deleted file mode 100644
index f236e0f..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/BandwidthStatistics.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Copyright (c) 2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed 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.wso2.carbon.usage.beans;
-
-/**
- * 
- */
-public class BandwidthStatistics {
-    private String key;
-    private String serverUrl;
-    private long incomingBandwidth;
-    private long outgoingBandwidth;
-
-    public BandwidthStatistics(String key){
-        this.key = key;
-    }
-
-    public String getKey() {
-        return key;
-    }
-
-    public void setKey(String key) {
-        this.key = key;
-    }
-
-    public long getIncomingBandwidth() {
-        return incomingBandwidth;
-    }
-
-    public void setIncomingBandwidth(long incomingBandwidth) {
-        this.incomingBandwidth = incomingBandwidth;
-    }
-
-    public long getOutgoingBandwidth() {
-        return outgoingBandwidth;
-    }
-
-    public void setOutgoingBandwidth(long outgoingBandwidth) {
-        this.outgoingBandwidth = outgoingBandwidth;
-    }
-
-    public String getServerUrl() {
-        return serverUrl;
-    }
-
-    public void setServerUrl(String serverUrl) {
-        this.serverUrl = serverUrl;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/InstanceUsageStatics.java
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/InstanceUsageStatics.java b/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/InstanceUsageStatics.java
deleted file mode 100644
index 25cb759..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/InstanceUsageStatics.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-*  Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-*  WSO2 Inc. 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.wso2.carbon.usage.beans;
-
-import java.util.Calendar;
-
-public class InstanceUsageStatics {
-
-    private Calendar startTime;
-    private Calendar stopTime;
-    private String instanceURL;
-    private Integer instanceID;
-    private long usedTimeInSeconds;
-    private boolean running;
-
-    public boolean isRunning() {
-        return running;
-    }
-
-    public void setRunning(boolean running) {
-        this.running = running;
-    }
-
-    public Calendar getStartTime() {
-        return startTime;
-    }
-
-    public void setStartTime(Calendar startTime) {
-        this.startTime = startTime;
-    }
-
-    public Calendar getStopTime() {
-        return stopTime;
-    }
-
-    public void setStopTime(Calendar stopTime) {
-        //Check weather stop time is Default value in database in that case
-        //server should still running so set isRunning as true
-        Calendar fixedDate = Calendar.getInstance();
-        fixedDate.set(2001, 1, 1, 00, 00, 00);
-        if (stopTime.compareTo(fixedDate) == 0) {
-            this.running = true;
-        }
-        this.stopTime = stopTime;
-    }
-
-    public String getInstanceURL() {
-        return instanceURL;
-    }
-
-    public void setInstanceURL(String instanceURL) {
-        this.instanceURL = instanceURL;
-    }
-
-    public Integer getInstanceID() {
-        return instanceID;
-    }
-
-    public void setInstanceID(Integer instanceID) {
-        this.instanceID = instanceID;
-    }
-
-    public long getUsedTimeInSeconds() {
-        long returnValue = (this.stopTime.getTimeInMillis() -
-                this.startTime.getTimeInMillis()) / 1000;
-        if (returnValue < 0) {
-            running = true;
-        }
-        return usedTimeInSeconds;
-    }
-    public void setUsedTimeInSeconds(long value){
-        this.usedTimeInSeconds=value;
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/PaginatedInstanceUsage.java
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/PaginatedInstanceUsage.java b/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/PaginatedInstanceUsage.java
deleted file mode 100644
index b7407af..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/PaginatedInstanceUsage.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-*  Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-*  WSO2 Inc. 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.wso2.carbon.usage.beans;
-
-import java.util.Arrays;
-
-public class PaginatedInstanceUsage {
-    private InstanceUsageStatics[] instanceUsages;
-    private int pageNumber;
-    private int numberOfPages;
-
-    public InstanceUsageStatics[] getInstanceUsages() {
-        if(instanceUsages != null) {
-        return Arrays.copyOf(instanceUsages, instanceUsages.length);
-        }
-
-        return null;
-    }
-
-    public void setInstanceUsages(InstanceUsageStatics[] instanceUsages) {
-        if(instanceUsages != null) {
-            this.instanceUsages = Arrays.copyOf(instanceUsages, instanceUsages.length);
-        }
-    }
-
-    public int getPageNumber() {
-        return pageNumber;
-    }
-
-    public void setPageNumber(int pageNumber) {
-        this.pageNumber = pageNumber;
-    }
-
-    public int getNumberOfPages() {
-        return numberOfPages;
-    }
-
-    public void setNumberOfPages(int numberOfPages) {
-        this.numberOfPages = numberOfPages;
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/PaginatedTenantUsageInfo.java
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/PaginatedTenantUsageInfo.java b/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/PaginatedTenantUsageInfo.java
deleted file mode 100644
index 0a3bd1b..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/PaginatedTenantUsageInfo.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-*  Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-*  WSO2 Inc. 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.wso2.carbon.usage.beans;
-
-import java.util.Arrays;
-
-public class PaginatedTenantUsageInfo {
-    private TenantUsage[] tenantUsages;
-    private int pageNumber;
-    private int numberOfPages;
-    
-    public TenantUsage[] getTenantUsages() {
-        return Arrays.copyOf(tenantUsages, tenantUsages.length);
-    }
-    public void setTenantUsages(TenantUsage[] tenantUsages) {
-        this.tenantUsages = Arrays.copyOf(tenantUsages, tenantUsages.length);
-    }
-    public int getPageNumber() {
-        return pageNumber;
-    }
-    public void setPageNumber(int pageNumber) {
-        this.pageNumber = pageNumber;
-    }
-    public int getNumberOfPages() {
-        return numberOfPages;
-    }
-    public void setNumberOfPages(int numberOfPages) {
-        this.numberOfPages = numberOfPages;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/RequestStatistics.java
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/RequestStatistics.java b/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/RequestStatistics.java
deleted file mode 100644
index 085b91a..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/RequestStatistics.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed 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.wso2.carbon.usage.beans;
-public class RequestStatistics {
-    private String key;
-    private long requestCount;
-    private long responseCount;
-    private long faultCount;
-
-    public RequestStatistics(String key) {
-        this.key = key;
-    }
-
-    public String getKey() {
-        return key;
-    }
-
-    public void setKey(String key) {
-        this.key = key;
-    }
-
-    public long getRequestCount() {
-        return requestCount;
-    }
-
-    public void setRequestCount(long requestCount) {
-        this.requestCount = requestCount;
-    }
-
-    public long getResponseCount() {
-        return responseCount;
-    }
-
-    public void setResponseCount(long responseCount) {
-        this.responseCount = responseCount;
-    }
-
-    public long getFaultCount() {
-        return faultCount;
-    }
-
-    public void setFaultCount(long faultCount) {
-        this.faultCount = faultCount;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/df3475cc/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/TenantDataCapacity.java
----------------------------------------------------------------------
diff --git a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/TenantDataCapacity.java b/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/TenantDataCapacity.java
deleted file mode 100644
index 543126d..0000000
--- a/components/stratos/usage/org.wso2.carbon.usage/2.1.1/src/main/java/org/wso2/carbon/usage/beans/TenantDataCapacity.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Copyright (c) 2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed 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.wso2.carbon.usage.beans;
-
-public class TenantDataCapacity {
-
-    private long registryContentCapacity;
-    private long registryContentHistoryCapacity;
-
-    public TenantDataCapacity() {
-    }
-    
-    /**
-     * @param registryContentCapacity
-     * @param registryContentHistoryCapacity
-     */
-    public TenantDataCapacity(
-            long registryContentCapacity, long registryContentHistoryCapacity) {
-        this.registryContentCapacity = registryContentCapacity;
-        this.registryContentHistoryCapacity = registryContentHistoryCapacity;
-    }
-
-    public long getRegistryContentCapacity() {
-        return registryContentCapacity;
-    }
-
-    public void setRegistryContentCapacity(long registryContentCapacity) {
-        this.registryContentCapacity = registryContentCapacity;
-    }
-
-    public long getRegistryContentHistoryCapacity() {
-        return registryContentHistoryCapacity;
-    }
-
-    public void setRegistryContentHistoryCapacity(long registryContentHistoryCapacity) {
-        this.registryContentHistoryCapacity = registryContentHistoryCapacity;
-    }
-
-}