http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/HourlyCartridgeStatsSummarizerHelper.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/HourlyCartridgeStatsSummarizerHelper.java
 
b/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/HourlyCartridgeStatsSummarizerHelper.java
deleted file mode 100644
index fde59df..0000000
--- 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/HourlyCartridgeStatsSummarizerHelper.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-package org.apache.stratos.usage.summary.helper;
-
-import org.apache.stratos.usage.summary.helper.util.DataAccessObject;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.analytics.hive.extension.AbstractHiveAnalyzer;
-
-import java.sql.Timestamp;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Helper class to set the timestamp of the last hourly summarization cycle in 
hive config.
- * This is needed to excluded the already summarized usage stats in the 
current summarization cycle.
- */
-public class HourlyCartridgeStatsSummarizerHelper extends AbstractHiveAnalyzer 
{
-
-    private static Log log = 
LogFactory.getLog(HourlyCartridgeStatsSummarizerHelper.class);
-
-    public void execute() {
-        log.info("Running custom analyzer for Stratos cartridge stats hourly 
summarization.");
-        try {
-            String lastHourlyTimestampStr = 
DataAccessObject.getInstance().getAndUpdateLastCartridgeStatsHourlyTimestamp();
-            Long lastHourlyTimestamp = 
Timestamp.valueOf(lastHourlyTimestampStr).getTime();
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:00");
-            String currentTsStr = formatter.format(new Date().getTime());
-
-            log.info("Running hourly cartridge stats analytics from " + 
lastHourlyTimestampStr + " to " + currentTsStr);
-            setProperty("last_hourly_ts", lastHourlyTimestamp.toString());
-        } catch (Exception e) {
-            log.error("An error occurred while setting hour range for hourly 
cartridge stats analysis. ", e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/HourlyServiceStatsSummarizerHelper.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/HourlyServiceStatsSummarizerHelper.java
 
b/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/HourlyServiceStatsSummarizerHelper.java
deleted file mode 100644
index 0a13245..0000000
--- 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/HourlyServiceStatsSummarizerHelper.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-package org.apache.stratos.usage.summary.helper;
-
-import org.apache.stratos.usage.summary.helper.util.DataAccessObject;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.analytics.hive.extension.AbstractHiveAnalyzer;
-
-import java.sql.Timestamp;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Helper class to set the timestamp of the last hourly summarization cycle in 
hive config.
- * This is needed to excluded the already summarized usage stats in the 
current summarization cycle.
- */
-public class HourlyServiceStatsSummarizerHelper extends AbstractHiveAnalyzer {
-
-    private static Log log = 
LogFactory.getLog(HourlyServiceStatsSummarizerHelper.class);
-
-    public void execute() {
-        log.info("Running custom analyzer for Stratos service stats hourly 
summarization.");
-        try {
-            String lastHourlyTimestampStr = 
DataAccessObject.getInstance().getAndUpdateLastServiceStatsHourlyTimestamp();
-            Long lastHourlyTimestamp = 
Timestamp.valueOf(lastHourlyTimestampStr).getTime();
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:00");
-            String currentTsStr = formatter.format(new Date().getTime());
-
-            log.info("Running hourly service stats analytics from " + 
lastHourlyTimestampStr + " to " + currentTsStr);
-            setProperty("last_hourly_ts", lastHourlyTimestamp.toString());
-        } catch (Exception e) {
-            log.error("An error occurred while setting hour range for hourly 
service stats analysis. ", e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/HourlySummarizerHelper.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/HourlySummarizerHelper.java
 
b/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/HourlySummarizerHelper.java
deleted file mode 100644
index f41fe9f..0000000
--- 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/HourlySummarizerHelper.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-package org.apache.stratos.usage.summary.helper;
-
-import org.apache.stratos.usage.summary.helper.util.DataAccessObject;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.analytics.hive.extension.AbstractHiveAnalyzer;
-
-import java.sql.Timestamp;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Helper class to set the timestamp of the last hourly summarization cycle in 
hive config.
- * This is needed to excluded the already summarized usage stats in the 
current summarization cycle.
- */
-public class HourlySummarizerHelper extends AbstractHiveAnalyzer {
-
-    private static Log log = LogFactory.getLog(HourlySummarizerHelper.class);
-
-    public void execute() {
-        log.info("Running custom analyzer for Stratos usage hourly 
summarization.");
-        try {
-            String lastHourlyTimestampStr = 
DataAccessObject.getInstance().getAndUpdateLastUsageHourlyTimestamp();
-            Long lastHourlyTimestamp = 
Timestamp.valueOf(lastHourlyTimestampStr).getTime();
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:00");
-            String currentTsStr = formatter.format(new Date().getTime());
-
-            log.info("Running hourly usage analytics from " + 
lastHourlyTimestampStr + " to " + currentTsStr);
-            setProperty("last_hourly_ts", lastHourlyTimestamp.toString());
-        } catch (Exception e) {
-            log.error("An error occurred while setting hour range for hourly 
usage analysis. ", e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/MonthlyCartridgeStatsSummarizerHelper.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/MonthlyCartridgeStatsSummarizerHelper.java
 
b/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/MonthlyCartridgeStatsSummarizerHelper.java
deleted file mode 100644
index 30e2ad4..0000000
--- 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/MonthlyCartridgeStatsSummarizerHelper.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-package org.apache.stratos.usage.summary.helper;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.analytics.hive.extension.AbstractHiveAnalyzer;
-import org.apache.stratos.usage.summary.helper.util.DataAccessObject;
-
-import java.sql.Timestamp;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Helper class to set the date range for the next monthly summarization cycle 
in the hive config.
- * This is important to select the data slice corresponding the current 
monthly summarization cycle
- * from the usage hourly tables.
- */
-public class MonthlyCartridgeStatsSummarizerHelper extends 
AbstractHiveAnalyzer {
-
-    private static Log log = LogFactory.getLog(HourlySummarizerHelper.class);
-
-    public void execute() {
-        log.info("Running custom analyzer for Stratos cartridge stats monthly 
summarization.");
-        try {
-            String lastMonthlyTimestampStr = 
DataAccessObject.getInstance().getAndUpdateLastCartridgeStatsMonthlyTimestamp();
-            Long lastMonthlyTimestampSecs = 
Timestamp.valueOf(lastMonthlyTimestampStr).getTime() / 1000;
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
-            String currentTsStr = formatter.format(new Date().getTime());
-            Long currentTsSecs = Timestamp.valueOf(currentTsStr).getTime() / 
1000;
-
-            log.info("Running monthly cartridge stats analytics from " + 
lastMonthlyTimestampStr + " to " + currentTsStr);
-            setProperty("last_monthly_ts", 
lastMonthlyTimestampSecs.toString());
-            setProperty("current_monthly_ts", currentTsSecs.toString());
-        } catch (Exception e) {
-            log.error("An error occurred while setting month range for monthly 
cartridge stats analytics. ", e);
-        }
-
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/MonthlyServiceStatsSummarizerHelper.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/MonthlyServiceStatsSummarizerHelper.java
 
b/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/MonthlyServiceStatsSummarizerHelper.java
deleted file mode 100644
index 8c81a83..0000000
--- 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/MonthlyServiceStatsSummarizerHelper.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-package org.apache.stratos.usage.summary.helper;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.analytics.hive.extension.AbstractHiveAnalyzer;
-import org.apache.stratos.usage.summary.helper.util.DataAccessObject;
-
-import java.sql.Timestamp;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Helper class to set the date range for the next monthly summarization cycle 
in the hive config.
- * This is important to select the data slice corresponding the current 
monthly summarization cycle
- * from the usage hourly tables.
- */
-public class MonthlyServiceStatsSummarizerHelper extends AbstractHiveAnalyzer {
-
-    private static Log log = LogFactory.getLog(HourlySummarizerHelper.class);
-
-    public void execute() {
-        log.info("Running custom analyzer for Stratos service stats monthly 
summarization.");
-        try {
-            String lastMonthlyTimestampStr = 
DataAccessObject.getInstance().getAndUpdateLastUsageMonthlyTimestamp();
-            Long lastMonthlyTimestampSecs = 
Timestamp.valueOf(lastMonthlyTimestampStr).getTime() / 1000;
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
-            String currentTsStr = formatter.format(new Date().getTime());
-            Long currentTsSecs = Timestamp.valueOf(currentTsStr).getTime() / 
1000;
-
-            log.info("Running monthly service stats analytics from " + 
lastMonthlyTimestampStr + " to " + currentTsStr);
-            setProperty("last_monthly_ts", 
lastMonthlyTimestampSecs.toString());
-            setProperty("current_monthly_ts", currentTsSecs.toString());
-        } catch (Exception e) {
-            log.error("An error occurred while setting month range for monthly 
service stats analytics. ", e);
-        }
-
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/MonthlySummarizerHelper.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/MonthlySummarizerHelper.java
 
b/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/MonthlySummarizerHelper.java
deleted file mode 100644
index b35fbb7..0000000
--- 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/MonthlySummarizerHelper.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-package org.apache.stratos.usage.summary.helper;
-
-import org.apache.stratos.usage.summary.helper.util.DataAccessObject;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.analytics.hive.extension.AbstractHiveAnalyzer;
-
-import java.sql.Timestamp;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Helper class to set the date range for the next monthly summarization cycle 
in the hive config.
- * This is important to select the data slice corresponding the current 
monthly summarization cycle
- * from the usage hourly tables.
- */
-public class MonthlySummarizerHelper extends AbstractHiveAnalyzer {
-
-    private static Log log = LogFactory.getLog(HourlySummarizerHelper.class);
-
-    public void execute() {
-        log.info("Running custom analyzer for Stratos usage monthly 
summarization.");
-        try {
-            String lastMonthlyTimestampStr = 
DataAccessObject.getInstance().getAndUpdateLastServiceStatsMonthlyTimestamp();
-            Long lastMonthlyTimestampSecs = 
Timestamp.valueOf(lastMonthlyTimestampStr).getTime() / 1000;
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
-            String currentTsStr = formatter.format(new Date().getTime());
-            Long currentTsSecs = Timestamp.valueOf(currentTsStr).getTime() / 
1000;
-
-            log.info("Running monthly service stats analytics from " + 
lastMonthlyTimestampStr + " to " + currentTsStr);
-            setProperty("last_monthly_ts", 
lastMonthlyTimestampSecs.toString());
-            setProperty("current_monthly_ts", currentTsSecs.toString());
-        } catch (Exception e) {
-            log.error("An error occurred while setting month range for monthly 
service stats analysis. ", e);
-        }
-
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/internal/UsageSummaryHelperServiceComponent.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/internal/UsageSummaryHelperServiceComponent.java
 
b/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/internal/UsageSummaryHelperServiceComponent.java
deleted file mode 100644
index 28bd055..0000000
--- 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/internal/UsageSummaryHelperServiceComponent.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-package org.apache.stratos.usage.summary.helper.internal;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.service.component.ComponentContext;
-import org.wso2.carbon.analytics.hive.service.HiveExecutorService;
-import org.wso2.carbon.ndatasource.core.DataSourceService;
-import org.apache.stratos.usage.summary.helper.util.DataHolder;
-
-import javax.sql.DataSource;
-
-/**
- *
- * @scr.component name="org.wso2.carbon.usage.summary" immediate="true"
- * @scr.reference name="hive.executor.service"
- * interface="org.wso2.carbon.analytics.hive.service.HiveExecutorService" 
cardinality="1..1"
- * policy="dynamic" bind="setHiveExecutorService" 
unbind="unsetHiveExecutorService"
- * @scr.reference name="datasources.service"
- * interface="org.wso2.carbon.ndatasource.core.DataSourceService"
- * cardinality="1..1" policy="dynamic"
- * bind="setDataSourceService" unbind="unsetDataSourceService"
- */
-public class UsageSummaryHelperServiceComponent {
-    
-    private static Log log = 
LogFactory.getLog(UsageSummaryHelperServiceComponent.class);
-
-    protected void activate(ComponentContext context){
-
-        log.info("Stratos usage summary helper bundle started");
-        /*try{
-
-        }catch (Throwable t){
-            log.error("Error occurred while activating the usage summary 
helper bundle..", t);
-        }*/
-    }
-
-    protected void deactivate(){
-        log.debug("Usage summary helper bundle was deactivated..");
-    }
-
-    protected void setHiveExecutorService(HiveExecutorService executorService){
-        //DataHolder.setExecutorService(executorService);
-    }
-
-    protected void unsetHiveExecutorService(HiveExecutorService 
executorService){
-        //DataHolder.setExecutorService(null);
-    }
-    
-    protected void setDataSourceService(DataSourceService dataSourceService){
-        DataHolder.setDataSourceService(dataSourceService);
-        try {
-            
DataHolder.setDataSource((DataSource)dataSourceService.getDataSource(DataHolder.BILLING_DATA_SOURCE_NAME).getDSObject());
-            log.info("Data source set to data holder");
-        } catch (Exception e) {
-            log.error("Error occurred while retrieving the data source: " + 
DataHolder.BILLING_DATA_SOURCE_NAME, e); //To change body of catch statement 
use File | Settings | File Templates.
-        }
-    }
-
-    protected void unsetDataSourceService(DataSourceService dataSourceService){
-        DataHolder.setDataSourceService(null);
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/util/DataAccessObject.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/util/DataAccessObject.java
 
b/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/util/DataAccessObject.java
deleted file mode 100644
index 3d46936..0000000
--- 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/util/DataAccessObject.java
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one 
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
- * KIND, either express or implied.  See the License for the 
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.usage.summary.helper.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Timestamp;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Helper class to retrieve relevant timestamps from relational database 
tables.
- */
-public class DataAccessObject {
-
-    private static Log log = LogFactory.getLog(DataAccessObject.class);
-
-    private static DataSource dataSource = null;
-
-    private static DataAccessObject usageDataAccessObj = null;
-
-    private DataAccessObject() {
-    }
-
-    public static DataAccessObject getInstance() throws Exception {
-        if (usageDataAccessObj == null) {
-            usageDataAccessObj = new DataAccessObject();
-        }
-
-        if (usageDataAccessObj.dataSource == null) {
-            if (DataHolder.getDataSource() != null) {
-                try {
-                    dataSource = DataHolder.getDataSource();
-                    //dataSource = (DataSource) 
DataHolder.getDataSourceService().
-                    //       
getDataSource(DataHolder.BILLING_DATA_SOURCE_NAME).getDSObject();
-                } catch (Exception e) {
-                    log.error("Error occurred while obtaining " + 
DataHolder.BILLING_DATA_SOURCE_NAME +
-                              " datasource from data source service.", e);
-                    throw new Exception(e);
-                }
-            } else {
-                log.error("Cannot obtain data source " + 
DataHolder.BILLING_DATA_SOURCE_NAME +
-                          ". Datasource service is null");
-                throw new Exception("Datasource service not available");
-            }
-
-        }
-
-        return usageDataAccessObj;
-    }
-
-    public String getAndUpdateLastUsageHourlyTimestamp() throws SQLException {
-
-        Timestamp lastSummaryTs = null;
-        Connection connection = null;
-
-        try {
-            connection = dataSource.getConnection();
-            String sql = "SELECT TIMESTMP FROM USAGE_LAST_HOURLY_TS WHERE 
ID='LatestTS'";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ResultSet resultSet = ps.executeQuery();
-            if (resultSet.next()) {
-                lastSummaryTs = resultSet.getTimestamp("TIMESTMP");
-            } else {
-                lastSummaryTs = new Timestamp(0);
-            }
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:00");
-            Timestamp currentTs = Timestamp.valueOf(formatter.format(new 
Date()));
-
-            String currentSql = "INSERT INTO USAGE_LAST_HOURLY_TS (ID, 
TIMESTMP) VALUES('LatestTS',?) ON DUPLICATE KEY UPDATE TIMESTMP=?";
-            PreparedStatement ps1 = connection.prepareStatement(currentSql);
-            ps1.setTimestamp(1, currentTs);
-            ps1.setTimestamp(2, currentTs);
-            ps1.execute();
-
-        } catch (SQLException e) {
-            log.error("Error occurred while trying to get and update the last 
hourly timestamp. ", e);
-        } finally {
-            if (connection != null) {
-                connection.close();
-            }
-        }
-
-        return lastSummaryTs.toString();
-    }
-
-    public String getAndUpdateLastUsageDailyTimestamp() throws SQLException {
-
-        Timestamp lastSummaryTs = null;
-        Connection connection = null;
-
-        try {
-            connection = dataSource.getConnection();
-            String sql = "SELECT TIMESTMP FROM USAGE_LAST_DAILY_TS WHERE 
ID='LatestTS'";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ResultSet resultSet = ps.executeQuery();
-            if (resultSet.next()) {
-                lastSummaryTs = resultSet.getTimestamp("TIMESTMP");
-            } else {
-                lastSummaryTs = new Timestamp(0);
-            }
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
-            Timestamp currentTs = Timestamp.valueOf(formatter.format(new 
Date()));
-
-            String currentSql = "INSERT INTO USAGE_LAST_DAILY_TS (ID, 
TIMESTMP) VALUES('LatestTS',?) ON DUPLICATE KEY UPDATE TIMESTMP=?";
-            PreparedStatement ps1 = connection.prepareStatement(currentSql);
-            ps1.setTimestamp(1, currentTs);
-            ps1.setTimestamp(2, currentTs);
-            ps1.execute();
-
-        } catch (SQLException e) {
-            log.error("Error occurred while trying to get and update the last 
daily timestamp. ", e);
-        } finally {
-            if (connection != null) {
-                connection.close();
-            }
-        }
-
-        return lastSummaryTs.toString();
-    }
-
-    public String getAndUpdateLastUsageMonthlyTimestamp() throws SQLException {
-
-        Timestamp lastSummaryTs = null;
-        Connection connection = null;
-
-        try {
-            connection = dataSource.getConnection();
-            String sql = "SELECT TIMESTMP FROM USAGE_LAST_MONTHLY_TS WHERE 
ID='LatestTS'";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ResultSet resultSet = ps.executeQuery();
-            if (resultSet.next()) {
-                lastSummaryTs = resultSet.getTimestamp("TIMESTMP");
-            } else {
-                lastSummaryTs = new Timestamp(0);
-            }
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
-            Timestamp currentTs = Timestamp.valueOf(formatter.format(new 
Date()));
-
-            String currentSql = "INSERT INTO USAGE_LAST_MONTHLY_TS (ID, 
TIMESTMP) VALUES('LatestTS',?) ON DUPLICATE KEY UPDATE TIMESTMP=?";
-            PreparedStatement ps1 = connection.prepareStatement(currentSql);
-            ps1.setTimestamp(1, currentTs);
-            ps1.setTimestamp(2, currentTs);
-            ps1.execute();
-
-        } catch (SQLException e) {
-            log.error("Error occurred while trying to get and update the last 
monthly timestamp. ", e);
-        } finally {
-            if (connection != null) {
-                connection.close();
-            }
-        }
-
-        return lastSummaryTs.toString();
-    }
-
-    public String getAndUpdateLastServiceStatsHourlyTimestamp() throws 
SQLException {
-
-        Timestamp lastSummaryTs = null;
-        Connection connection = null;
-
-        try {
-            connection = dataSource.getConnection();
-            String sql = "SELECT TIMESTMP FROM SERVICE_STATS_LAST_HOURLY_TS 
WHERE ID='LatestTS'";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ResultSet resultSet = ps.executeQuery();
-            if (resultSet.next()) {
-                lastSummaryTs = resultSet.getTimestamp("TIMESTMP");
-            } else {
-                lastSummaryTs = new Timestamp(0);
-            }
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:00");
-            Timestamp currentTs = Timestamp.valueOf(formatter.format(new 
Date()));
-
-            String currentSql = "INSERT INTO SERVICE_STATS_LAST_HOURLY_TS (ID, 
TIMESTMP) VALUES('LatestTS',?) ON DUPLICATE KEY UPDATE TIMESTMP=?";
-            PreparedStatement ps1 = connection.prepareStatement(currentSql);
-            ps1.setTimestamp(1, currentTs);
-            ps1.setTimestamp(2, currentTs);
-            ps1.execute();
-
-        } catch (SQLException e) {
-            log.error("Error occurred while trying to get and update the last 
hourly timestamp. ", e);
-        } finally {
-            if (connection != null) {
-                connection.close();
-            }
-        }
-
-        return lastSummaryTs.toString();
-    }
-
-    public String getAndUpdateLastServiceStatsDailyTimestamp() throws 
SQLException {
-
-        Timestamp lastSummaryTs = null;
-        Connection connection = null;
-
-        try {
-            connection = dataSource.getConnection();
-            String sql = "SELECT TIMESTMP FROM SERVICE_STATS_LAST_DAILY_TS 
WHERE ID='LatestTS'";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ResultSet resultSet = ps.executeQuery();
-            if (resultSet.next()) {
-                lastSummaryTs = resultSet.getTimestamp("TIMESTMP");
-            } else {
-                lastSummaryTs = new Timestamp(0);
-            }
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
-            Timestamp currentTs = Timestamp.valueOf(formatter.format(new 
Date()));
-
-            String currentSql = "INSERT INTO SERVICE_STATS_LAST_DAILY_TS (ID, 
TIMESTMP) VALUES('LatestTS',?) ON DUPLICATE KEY UPDATE TIMESTMP=?";
-            PreparedStatement ps1 = connection.prepareStatement(currentSql);
-            ps1.setTimestamp(1, currentTs);
-            ps1.setTimestamp(2, currentTs);
-            ps1.execute();
-
-        } catch (SQLException e) {
-            log.error("Error occurred while trying to get and update the last 
daily timestamp. ", e);
-        } finally {
-            if (connection != null) {
-                connection.close();
-            }
-        }
-
-        return lastSummaryTs.toString();
-    }
-
-    public String getAndUpdateLastServiceStatsMonthlyTimestamp() throws 
SQLException {
-
-        Timestamp lastSummaryTs = null;
-        Connection connection = null;
-
-        try {
-            connection = dataSource.getConnection();
-            String sql = "SELECT TIMESTMP FROM SERVICE_STATS_LAST_MONTHLY_TS 
WHERE ID='LatestTS'";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ResultSet resultSet = ps.executeQuery();
-            if (resultSet.next()) {
-                lastSummaryTs = resultSet.getTimestamp("TIMESTMP");
-            } else {
-                lastSummaryTs = new Timestamp(0);
-            }
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
-            Timestamp currentTs = Timestamp.valueOf(formatter.format(new 
Date()));
-
-            String currentSql = "INSERT INTO SERVICE_STATS_LAST_MONTHLY_TS 
(ID, TIMESTMP) VALUES('LatestTS',?) ON DUPLICATE KEY UPDATE TIMESTMP=?";
-            PreparedStatement ps1 = connection.prepareStatement(currentSql);
-            ps1.setTimestamp(1, currentTs);
-            ps1.setTimestamp(2, currentTs);
-            ps1.execute();
-
-        } catch (SQLException e) {
-            log.error("Error occurred while trying to get and update the last 
monthly timestamp. ", e);
-        } finally {
-            if (connection != null) {
-                connection.close();
-            }
-        }
-
-        return lastSummaryTs.toString();
-    }
-
-    public String getAndUpdateLastCartridgeStatsHourlyTimestamp() throws 
SQLException {
-
-        Timestamp lastSummaryTs = null;
-        Connection connection = null;
-
-        try {
-            connection = dataSource.getConnection();
-            String sql = "SELECT TIMESTMP FROM CARTRIDGE_STATS_LAST_HOURLY_TS 
WHERE ID='LatestTS'";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ResultSet resultSet = ps.executeQuery();
-            if (resultSet.next()) {
-                lastSummaryTs = resultSet.getTimestamp("TIMESTMP");
-            } else {
-                lastSummaryTs = new Timestamp(0);
-            }
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:00");
-            Timestamp currentTs = Timestamp.valueOf(formatter.format(new 
Date()));
-
-            String currentSql = "INSERT INTO CARTRIDGE_STATS_LAST_HOURLY_TS 
(ID, TIMESTMP) VALUES('LatestTS',?) ON DUPLICATE KEY UPDATE TIMESTMP=?";
-            PreparedStatement ps1 = connection.prepareStatement(currentSql);
-            ps1.setTimestamp(1, currentTs);
-            ps1.setTimestamp(2, currentTs);
-            ps1.execute();
-
-        } catch (SQLException e) {
-            log.error("Error occurred while trying to get and update the last 
hourly timestamp for cartridge stats. ", e);
-        } finally {
-            if (connection != null) {
-                connection.close();
-            }
-        }
-
-        return lastSummaryTs.toString();
-    }
-
-    public String getAndUpdateLastCartridgeStatsDailyTimestamp() throws 
SQLException {
-
-        Timestamp lastSummaryTs = null;
-        Connection connection = null;
-
-        try {
-            connection = dataSource.getConnection();
-            String sql = "SELECT TIMESTMP FROM CARTRIDGE_STATS_LAST_DAILY_TS 
WHERE ID='LatestTS'";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ResultSet resultSet = ps.executeQuery();
-            if (resultSet.next()) {
-                lastSummaryTs = resultSet.getTimestamp("TIMESTMP");
-            } else {
-                lastSummaryTs = new Timestamp(0);
-            }
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
-            Timestamp currentTs = Timestamp.valueOf(formatter.format(new 
Date()));
-
-            String currentSql = "INSERT INTO CARTRIDGE_STATS_LAST_DAILY_TS 
(ID, TIMESTMP) VALUES('LatestTS',?) ON DUPLICATE KEY UPDATE TIMESTMP=?";
-            PreparedStatement ps1 = connection.prepareStatement(currentSql);
-            ps1.setTimestamp(1, currentTs);
-            ps1.setTimestamp(2, currentTs);
-            ps1.execute();
-
-        } catch (SQLException e) {
-            log.error("Error occurred while trying to get and update the last 
daily timestamp for cartridge stats. ", e);
-        } finally {
-            if (connection != null) {
-                connection.close();
-            }
-        }
-
-        return lastSummaryTs.toString();
-    }
-
-    public String getAndUpdateLastCartridgeStatsMonthlyTimestamp() throws 
SQLException {
-
-        Timestamp lastSummaryTs = null;
-        Connection connection = null;
-
-        try {
-            connection = dataSource.getConnection();
-            String sql = "SELECT TIMESTMP FROM CARTRIDGE_STATS_LAST_MONTHLY_TS 
WHERE ID='LatestTS'";
-            PreparedStatement ps = connection.prepareStatement(sql);
-            ResultSet resultSet = ps.executeQuery();
-            if (resultSet.next()) {
-                lastSummaryTs = resultSet.getTimestamp("TIMESTMP");
-            } else {
-                lastSummaryTs = new Timestamp(0);
-            }
-
-            DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
-            Timestamp currentTs = Timestamp.valueOf(formatter.format(new 
Date()));
-
-            String currentSql = "INSERT INTO CARTRIDGE_STATS_LAST_MONTHLY_TS 
(ID, TIMESTMP) VALUES('LatestTS',?) ON DUPLICATE KEY UPDATE TIMESTMP=?";
-            PreparedStatement ps1 = connection.prepareStatement(currentSql);
-            ps1.setTimestamp(1, currentTs);
-            ps1.setTimestamp(2, currentTs);
-            ps1.execute();
-
-        } catch (SQLException e) {
-            log.error("Error occurred while trying to get and update the last 
monthly timestamp for cartridge stats. ", e);
-        } finally {
-            if (connection != null) {
-                connection.close();
-            }
-        }
-
-        return lastSummaryTs.toString();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/util/DataHolder.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/util/DataHolder.java
 
b/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/util/DataHolder.java
deleted file mode 100644
index 9261019..0000000
--- 
a/components/org.apache.stratos.usage.summary.helper/src/main/java/org/apache/stratos/usage/summary/helper/util/DataHolder.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one 
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
- * KIND, either express or implied.  See the License for the 
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.usage.summary.helper.util;
-
-import org.wso2.carbon.ndatasource.core.DataSourceService;
-
-import javax.sql.DataSource;
-
-public class DataHolder {
-
-    private static DataSourceService dataSourceService;
-
-    private static DataSource dataSource;
-
-    public static final String BILLING_DATA_SOURCE_NAME = "WSO2BillingDS";
-    //public static final String BILLING_DATA_SOURCE_NAME = "WSO2USAGE_DS";
-
-
-    public static DataSource getDataSource() {
-        return dataSource;
-    }
-
-    public static void setDataSource(DataSource dataSource) {
-        DataHolder.dataSource = dataSource;
-    }
-
-    public static DataSourceService getDataSourceService() {
-        return dataSourceService;
-    }
-
-    public static void setDataSourceService(DataSourceService 
dataSourceService) {
-        DataHolder.dataSourceService = dataSourceService;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.ui/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.usage.ui/pom.xml 
b/components/org.apache.stratos.usage.ui/pom.xml
deleted file mode 100644
index 15de5c4..0000000
--- a/components/org.apache.stratos.usage.ui/pom.xml
+++ /dev/null
@@ -1,127 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-# 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>4.0.0-SNAPSHOT</version>
-       <relativePath>../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.apache.stratos.usage.ui</artifactId>
-    <packaging>bundle</packaging>
-    <name>Apache Stratos - Usage - User Interface</name>
-
-    <build>
-
-        <plugins>
-            <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>
-                        <Export-Package>
-                            org.apache.stratos.usage.ui.*,
-                        </Export-Package>
-                        <Import-Package>
-                           org.apache.stratos.usage.stub.*; 
version="${project.version}",
-                            
javax.servlet;version="${imp.pkg.version.javax.servlet}",
-                            
javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
-                            !javax.xml.namespace,
-                            javax.xml.namespace; version=0.0.0,                
            
-                            org.apache.lucene.*,
-                            *;resolution:=optional
-                        </Import-Package>
-                        <Carbon-Component>UIBundle</Carbon-Component>
-                    </instructions>
-                </configuration>
-            </plugin>
-
-        </plugins>
-    </build>
-
-    <dependencies>
-
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-        </dependency>
-           <dependency>
-            <groupId>commons-codec.wso2</groupId>
-            <artifactId>commons-codec</artifactId>
-           <version>1.4.0.wso2v1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.registry.common.ui</artifactId>
-           <version>${wso2carbon.version}</version>
-        </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.eclipse.equinox</groupId>
-            <artifactId>javax.servlet</artifactId>
-               <version>3.0.0.v201112011016</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.axis2.wso2</groupId>
-            <artifactId>axis2</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.ws.commons.axiom.wso2</groupId>
-            <artifactId>axiom</artifactId>
-           <version>${axiom.wso2.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.ui</artifactId>
-           <version>${wso2carbon.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.stratos</groupId>
-            <artifactId>org.apache.stratos.common</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-       <dependency>
-            <groupId>org.apache.stratos</groupId>
-            <artifactId>org.apache.stratos.usage.stub</artifactId>
-               <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-
-</project>

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/clients/UsageServiceClient.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/clients/UsageServiceClient.java
 
b/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/clients/UsageServiceClient.java
deleted file mode 100644
index b0b21f5..0000000
--- 
a/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/clients/UsageServiceClient.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-package org.apache.stratos.usage.ui.clients;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.CarbonConstants;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.ui.CarbonUIUtil;
-import org.apache.stratos.usage.stub.beans.xsd.InstanceUsageStatics;
-import org.apache.stratos.usage.stub.beans.xsd.PaginatedInstanceUsage;
-import org.apache.stratos.usage.stub.beans.xsd.PaginatedTenantUsageInfo;
-import org.apache.stratos.usage.stub.beans.xsd.TenantUsage;
-import org.apache.stratos.usage.stub.services.UsageServiceStub;
-import org.wso2.carbon.utils.ServerConstants;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.http.HttpSession;
-
-public class UsageServiceClient {
-    private static final Log log = LogFactory.getLog(UsageServiceClient.class);
-
-    private UsageServiceStub stub;
-    private String epr;
-
-    public UsageServiceClient(
-            String cookie, String backendServerURL, ConfigurationContext 
configContext)
-            throws RegistryException {
-
-        epr = backendServerURL + "UsageService";
-
-        try {
-            stub = new UsageServiceStub(configContext, epr);
-
-            ServiceClient client = stub._getServiceClient();
-            Options option = client.getOptions();
-            option.setManageSession(true);
-            
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, 
cookie);
-
-        } catch (AxisFault axisFault) {
-            String msg = "Failed to initiate UsageService service client. " + 
axisFault.getMessage();
-            log.error(msg, axisFault);
-            throw new RegistryException(msg, axisFault);
-        }
-    }
-
-    public UsageServiceClient(ServletConfig config, HttpSession session)
-            throws RegistryException {
-
-        String cookie = (String) 
session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
-        String backendServerURL = 
CarbonUIUtil.getServerURL(config.getServletContext(), session);
-        ConfigurationContext configContext = (ConfigurationContext) config.
-                
getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
-        epr = backendServerURL + "UsageService";
-
-        try {
-            stub = new UsageServiceStub(configContext, epr);
-
-            ServiceClient client = stub._getServiceClient();
-            Options option = client.getOptions();
-            option.setManageSession(true);
-            
option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, 
cookie);
-
-        } catch (AxisFault axisFault) {
-            String msg = "Failed to initiate UsageService service client. " + 
axisFault.getMessage();
-            log.error(msg, axisFault);
-            throw new RegistryException(msg, axisFault);
-        }
-    }
-
-    public TenantUsage retrieveCurrentTenantUsage(String yearMonth) throws 
Exception {
-        return stub.retrieveCurrentTenantUsage(yearMonth);
-    }
-
-    public TenantUsage[] retrieveTenantUsages(String yearMonth) throws 
Exception {
-        return stub.retrieveTenantUsages(yearMonth);
-    }
-
-    public PaginatedTenantUsageInfo retrievePaginatedTenantUsages(String 
yearMonth, int pageNumber,
-                                                                  int 
entriesPerPage) throws Exception {
-        return stub.retrievePaginatedTenantUsages(yearMonth, pageNumber, 
entriesPerPage);
-    }
-
-    public TenantUsage retrieveTenantUsage(String yearMonth, int tenantId) 
throws Exception {
-        return stub.retrieveTenantUsage(yearMonth, tenantId);
-    }
-
-    public InstanceUsageStatics[] retrieveInstanceUsage() throws Exception{
-            return stub.retrieveInstanceUsage();
-    }
-
-    public PaginatedInstanceUsage retrievePaginatedInstanceUsage (
-            String yearMonth, int pageNumber, int numbersPerPage) throws 
Exception {
-            return stub.retrievePaginatedInstanceUsage(yearMonth, pageNumber, 
numbersPerPage);
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/report/AllTenantUsageData.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/report/AllTenantUsageData.java
 
b/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/report/AllTenantUsageData.java
deleted file mode 100755
index c959dca..0000000
--- 
a/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/report/AllTenantUsageData.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-package org.apache.stratos.usage.ui.report;
-
-public class AllTenantUsageData {
-
-       public AllTenantUsageData() {
-       }
-
-       String yearMonth;
-       
-       String tenantName;
-       
-       String numberOfUsers;
-       
-       String currentDataStorage;
-       
-       String regBandwidth;
-       
-       String svcBandwidth;
-       
-       String svcTotalRequest;
-
-       public String getYearMonth() {
-               return yearMonth;
-       }
-
-       public void setYearMonth(String yearMonth) {
-               this.yearMonth = yearMonth;
-       }
-
-       public String getTenantName() {
-               return tenantName;
-       }
-
-       public void setTenantName(String tenantName) {
-               this.tenantName = tenantName;
-       }
-
-       public String getNumberOfUsers() {
-               return numberOfUsers;
-       }
-
-       public void setNumberOfUsers(String numberOfUsers) {
-               this.numberOfUsers = numberOfUsers;
-       }
-
-       public String getCurrentDataStorage() {
-               return currentDataStorage;
-       }
-
-       public void setCurrentDataStorage(String currentDataStorage) {
-               this.currentDataStorage = currentDataStorage;
-       }
-
-       public String getRegBandwidth() {
-               return regBandwidth;
-       }
-
-       public void setRegBandwidth(String regBandwidth) {
-               this.regBandwidth = regBandwidth;
-       }
-
-       public String getSvcBandwidth() {
-               return svcBandwidth;
-       }
-
-       public void setSvcBandwidth(String svcBandwidth) {
-               this.svcBandwidth = svcBandwidth;
-       }
-
-       public String getSvcTotalRequest() {
-               return svcTotalRequest;
-       }
-
-       public void setSvcTotalRequest(String svcTotalRequest) {
-               this.svcTotalRequest = svcTotalRequest;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/report/AllTenantUsageReport.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/report/AllTenantUsageReport.java
 
b/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/report/AllTenantUsageReport.java
deleted file mode 100644
index 3b7ed7d..0000000
--- 
a/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/report/AllTenantUsageReport.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-package org.apache.stratos.usage.ui.report;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.usage.stub.beans.xsd.TenantUsage;
-import org.apache.stratos.usage.ui.utils.UsageUtil;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * this class is used to generate reports of all tenant usages
- */
-public class AllTenantUsageReport {
-
-    private TenantUsage[] tenantUsages;
-    private String yearMonth;
-
-    /**
-     * @param config
-     * @param session
-     * @param request
-     * @throws Exception
-     */
-    private static final Log log = 
LogFactory.getLog(AllTenantUsageReport.class);
-
-    public AllTenantUsageReport(ServletConfig config, HttpSession session, 
HttpServletRequest request)
-            throws Exception {
-       tenantUsages = UsageUtil.retrieveTenantUsages(request, config, session);
-     
- 
-        yearMonth = (String) request.getSession().getAttribute("year-month");
-    }
-
-    public List<AllTenantUsageData> getUsageReportData() {
-
-        List<AllTenantUsageData> reportData = new 
ArrayList<AllTenantUsageData>();   // all the strings need to be passed to
-        //  generate the report are added to this list
-
-        if (yearMonth == null) {
-            //  get the current year month
-            yearMonth = UsageUtil.getCurrentYearMonth();
-        }
-        String currentYearMonth = UsageUtil.getCurrentYearMonth();
-
-        //  add all the usage data to the list
-        try {
-            for (TenantUsage usage : tenantUsages) {
-                AllTenantUsageData usageData = new AllTenantUsageData();
-                usageData.setYearMonth(yearMonth);
-                String currentDataStorage = 
UsageUtil.getTotalDataStorage(usage);
-                String regBandwidth = 
UsageUtil.getTotalBandwidth(usage.getTotalRegistryBandwidth());
-                String svcBandwidth = 
UsageUtil.getTotalBandwidth(usage.getTotalServiceBandwidth());
-                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;
-
-                usageData.setTenantName(tenantName);
-                if (yearMonth.equals(currentYearMonth)) {
-                    
usageData.setNumberOfUsers(Integer.toString(numberOfUsers));
-                    usageData.setCurrentDataStorage(currentDataStorage);
-                }
-                // if the yearMonth is not current, number of users coloumn 
and storage usage coloumn are empty
-                else {
-                    usageData.setNumberOfUsers("-");
-                    usageData.setCurrentDataStorage("-");
-                }
-                usageData.setRegBandwidth(regBandwidth);
-                usageData.setSvcBandwidth(svcBandwidth);
-                usageData.setSvcTotalRequest(Long.toString(svcTotalRequest));
-                reportData.add(usageData);
-            }
-        }
-        catch (Exception e) {
-            String msg = "Error while retrieving tenant usages for month : " + 
yearMonth;
-            log.error(msg, e);
-        }
-        return reportData;         // return as an array
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/report/UsageReport.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/report/UsageReport.java
 
b/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/report/UsageReport.java
deleted file mode 100644
index 59aff53..0000000
--- 
a/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/report/UsageReport.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
-
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-package org.apache.stratos.usage.ui.report;
-
-import org.apache.stratos.usage.stub.beans.xsd.BandwidthStatistics;
-import org.apache.stratos.usage.stub.beans.xsd.RequestStatistics;
-import org.apache.stratos.usage.stub.beans.xsd.TenantUsage;
-import org.apache.stratos.usage.ui.utils.UsageUtil;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This class is used to generate tenant usage report
- */
-public class UsageReport {
-    private TenantUsage usage;
-    private String yearMonth;
-
-    public UsageReport(ServletConfig config, HttpSession session, 
HttpServletRequest request)
-            throws Exception {
-        usage = UsageUtil.retrieveCurrentTenantUsage(request, config, session);
-        yearMonth = (String) request.getSession().getAttribute("year-month");
-
-    }
-
-
-    public List<String> getUsageReportData() {
-
-        int numberOfUsers = usage.getNumberOfUsers();
-        if (yearMonth == null) {
-
-            yearMonth = UsageUtil.getCurrentYearMonth();
-        }
-
-        String tenantName = usage.getDomain();
-        String currentYearMonth = UsageUtil.getCurrentYearMonth();
-        List<String> reportData = new ArrayList<String>();
-        reportData.add("Basic Tenant Details");
-        reportData.add("");
-        reportData.add("Duration");
-        reportData.add("Tenant Name");
-        reportData.add("Number of users");
-        reportData.add("Basic Tenant Details");
-        reportData.add("");
-        reportData.add(yearMonth);
-        reportData.add(tenantName);
-        reportData.add(String.valueOf(numberOfUsers));
-
-
-        if (currentYearMonth.equals(yearMonth)) {
-            reportData.add("Storage Usage");
-            reportData.add("Data Storage");
-            reportData.add("Current Data Storage");
-            reportData.add("Historical Data Storage");
-            reportData.add("Total Data Storage");
-            String totalDataStorage = UsageUtil.getTotalDataStorage(usage);
-            String currentDataStorage = UsageUtil.getCurrentDataStorage(usage);
-            String historyDataStorage = UsageUtil.getHistoryDataStorage(usage);
-            reportData.add("Storage Usage");
-            reportData.add("Registry Content");
-            reportData.add(totalDataStorage);
-            reportData.add(currentDataStorage);
-            reportData.add(historyDataStorage);
-        }
-
-        String totRegInBandwidth = 
UsageUtil.getIncomingBandwidth(usage.getTotalRegistryBandwidth());
-        String totRegOutBandwidth = 
UsageUtil.getOutgoingBandwidth(usage.getTotalRegistryBandwidth());
-        String totRegBandwidth = 
UsageUtil.getTotalBandwidth(usage.getTotalRegistryBandwidth());
-        reportData.add("Registry Bandwidth Usage");
-        reportData.add("Server Name");
-        reportData.add("Incoming Bandwidth");
-        reportData.add("Outgoing Bandwidth");
-        reportData.add("Total Bandwidth");
-        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);
-                reportData.add("Server Name****");
-                reportData.add(regInBandwidth);
-                reportData.add(regOutBandwidth);
-                reportData.add(regBandwidth);
-
-            }
-        }
-        reportData.add("Registry Bandwidth Usage");
-        reportData.add("All Server Total");
-        reportData.add(totRegInBandwidth);
-        reportData.add(totRegOutBandwidth);
-        reportData.add(totRegBandwidth);
-
-        String totSvcInBandwidth = 
UsageUtil.getIncomingBandwidth(usage.getTotalServiceBandwidth());
-        String totSvcOutBandwidth = 
UsageUtil.getOutgoingBandwidth(usage.getTotalServiceBandwidth());
-        String totSvcBandwidth = 
UsageUtil.getTotalBandwidth(usage.getTotalServiceBandwidth());
-        reportData.add("Service Bandwidth Usage");
-        reportData.add("Server Name");
-        reportData.add("Incoming Bandwidth");
-        reportData.add("Outgoing Bandwidth");
-        reportData.add("Total Bandwidth");
-        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);
-                reportData.add("Server Name****");
-                reportData.add(svcInBandwidth);
-                reportData.add(svcOutBandwidth);
-                reportData.add(svcBandwidth);
-
-            }
-        }
-        reportData.add("Service Bandwidth Usage");
-        reportData.add("All Server Total");
-        reportData.add(totSvcInBandwidth);
-        reportData.add(totSvcOutBandwidth);
-        reportData.add(totSvcBandwidth);
-
-        String totWebappInBandwidth = 
UsageUtil.getIncomingBandwidth(usage.getTotalWebappBandwidth());
-        String totWebappOutBandwidth = 
UsageUtil.getOutgoingBandwidth(usage.getTotalWebappBandwidth());
-        String totWebappBandwidth = 
UsageUtil.getTotalBandwidth(usage.getTotalWebappBandwidth());
-        BandwidthStatistics[] webappBWStats = 
usage.getWebappBandwidthStatistics();
-        reportData.add("Webapp Bandwidth Usage");
-        reportData.add("Server Name");
-        reportData.add("Incoming Bandwidth");
-        reportData.add("Outgoing Bandwidth");
-        reportData.add("Total Bandwidth");
-        if (webappBWStats != null) {
-            for (BandwidthStatistics stat : webappBWStats) {
-                String webappInBandwidth = 
UsageUtil.getIncomingBandwidth(stat);
-                String webappOutBandwidth = 
UsageUtil.getOutgoingBandwidth(stat);
-                String webappBandwidth = UsageUtil.getTotalBandwidth(stat);
-                reportData.add("Server Name****");
-                reportData.add(webappInBandwidth);
-                reportData.add(webappOutBandwidth);
-                reportData.add(webappBandwidth);
-            }
-        }
-        reportData.add("Webapp Bandwidth Usage");
-        reportData.add("All Server Total");
-        reportData.add(totWebappInBandwidth);
-        reportData.add(totWebappOutBandwidth);
-        reportData.add(totWebappBandwidth);
-
-
-        long totSvcReqCount = 
usage.getTotalRequestStatistics().getRequestCount();
-        long totSvcRespCount = 
usage.getTotalRequestStatistics().getResponseCount();
-        long totSvcFaultCount = 
usage.getTotalRequestStatistics().getFaultCount();
-        RequestStatistics[] svcStats = usage.getRequestStatistics();
-        reportData.add("Service Usage Statistic");
-        reportData.add("Server Name");
-        reportData.add("Request Count");
-        reportData.add("Response Count");
-        reportData.add("Fault Count");
-        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();
-                reportData.add("Server Name****");
-                reportData.add(String.valueOf(svcReqCount));
-                reportData.add(String.valueOf(svcResCount));
-                reportData.add(String.valueOf(svcFaultCount));
-            }
-        }
-        reportData.add("Service Usage Statistic");
-        reportData.add("All Server Total");
-        reportData.add(String.valueOf(totSvcReqCount));
-        reportData.add(String.valueOf(totSvcRespCount));
-        reportData.add(String.valueOf(totSvcFaultCount));
-
-        return reportData;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/utils/UsageUtil.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/utils/UsageUtil.java
 
b/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/utils/UsageUtil.java
deleted file mode 100644
index e1b6760..0000000
--- 
a/components/org.apache.stratos.usage.ui/src/main/java/org/apache/stratos/usage/ui/utils/UsageUtil.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.usage.ui.utils;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.common.util.CommonUtil;
-import org.wso2.carbon.registry.common.ui.UIException;
-import org.apache.stratos.usage.stub.beans.xsd.*;
-import org.apache.stratos.usage.ui.clients.UsageServiceClient;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletRequest;
-import javax.servlet.http.HttpSession;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
-
-public class UsageUtil {
-    private static final Log log = LogFactory.getLog(UsageUtil.class);
-
-    private static long KB_LIMIT = 1024;
-    private static long MB_LIMIT = 1024 * 1024;
-    private static long GB_LIMIT = 1024 * 1024 * 1024;
-    private static long TB_LIMIT = (long) 1024 * 1024 * 1024 * 1024;
-
-    public static TenantUsage retrieveCurrentTenantUsage(ServletRequest 
request,
-                                                         ServletConfig config, 
HttpSession session) throws Exception {
-        try {
-            UsageServiceClient serviceClient = new UsageServiceClient(config, 
session);
-            String yearMonth = request.getParameter("year-month");
-            if (yearMonth == null) {
-                // get the current year month
-                yearMonth = getCurrentYearMonth();
-            }
-            return serviceClient.retrieveCurrentTenantUsage(yearMonth);
-        } catch (Exception e) {
-            String msg = "Failed to get current tenant usage.";
-            log.error(msg, e);
-            throw new UIException(msg, e);
-        }
-    }
-
-    public static TenantUsage[] retrieveTenantUsages(ServletRequest request,
-                                                     ServletConfig config, 
HttpSession session) throws Exception {
-        try {
-            UsageServiceClient serviceClient = new UsageServiceClient(config, 
session);
-            String yearMonth = request.getParameter("year-month");
-            if (yearMonth == null) {
-                // get the current year month
-                yearMonth = getCurrentYearMonth();
-            }
-            return serviceClient.retrieveTenantUsages(yearMonth);
-        } catch (Exception e) {
-            String msg = "Failed to get all tenants usages.";
-            log.error(msg, e);
-            throw new UIException(msg, e);
-        }
-    }
-
-    public static PaginatedTenantUsageInfo 
retrievePaginatedTenantUsages(ServletRequest request,
-                                                                         
ServletConfig config, HttpSession session) throws Exception {
-        String requestedPage = request.getParameter("requestedPage");
-        int pageNumber = 1;
-        int numberOfPages = 1;
-        int entriesPerPage = 15;
-        if (requestedPage != null && requestedPage.length() > 0) {
-            pageNumber = new Integer(requestedPage);
-        }
-
-        try {
-            UsageServiceClient serviceClient = new UsageServiceClient(config, 
session);
-            String yearMonth = request.getParameter("year-month");
-            if (yearMonth == null) {
-                // get the current year month
-                yearMonth = getCurrentYearMonth();
-            }
-            return serviceClient.retrievePaginatedTenantUsages(yearMonth, 
pageNumber, entriesPerPage);
-        } catch (Exception e) {
-            String msg = "Failed to get all tenants usages.";
-            log.error(msg, e);
-            throw new UIException(msg, e);
-        }
-    }
-
-    public static TenantUsage retrieveTenantUsage(ServletRequest request,
-                                                  ServletConfig config, 
HttpSession session) throws Exception {
-        try {
-            UsageServiceClient serviceClient = new UsageServiceClient(config, 
session);
-            String yearMonth = request.getParameter("year-month");
-            if (yearMonth == null) {
-                // get the current year month
-                yearMonth = getCurrentYearMonth();
-            }
-            String tenantIdStr = request.getParameter("tenant-id");
-            if (tenantIdStr == null) {
-                tenantIdStr = "0";
-            }
-            return serviceClient.retrieveTenantUsage(yearMonth, 
Integer.parseInt(tenantIdStr));
-        } catch (Exception e) {
-            String msg = "Failed to get tenant usages.";
-            log.error(msg, e);
-            throw new UIException(msg, e);
-        }
-    }
-
-
-    public static String convertBytesToString(long storage) {
-        if (storage < KB_LIMIT) {
-            return storage + " Byte(s)";
-        } else if (storage < MB_LIMIT) {
-            return storage / KB_LIMIT + " KByte(s)";
-        } else if (storage < GB_LIMIT) {
-            return storage / MB_LIMIT + " MByte(s)";
-        } else if (storage < TB_LIMIT) {
-            return storage / GB_LIMIT + " GByte(s)";
-        } else {
-            return storage / TB_LIMIT + " TByte(s)";
-        }
-    }
-
-    public static String getCurrentYearMonth() {
-        Calendar calendar = Calendar.getInstance();
-        return CommonUtil.getMonthString(calendar);
-    }
-
-    public static String[] getYearMonths() {
-        // we will list 100 months for now
-        List<String> yearMonths = new ArrayList<String>();
-        for (int i = 0; i > -100; i--) {
-            String yearMonth = CommonUtil.getMonthString(i);
-            yearMonths.add(yearMonth);
-        }
-        return yearMonths.toArray(new String[yearMonths.size()]);
-    }
-
-    public static String getCurrentDataStorage(TenantUsage usage) {
-        TenantDataCapacity regData = usage.getRegistryCapacity();
-        long currentData = 0;
-        if (regData != null) {
-            currentData = regData.getRegistryContentCapacity();
-        }
-        return convertBytesToString(currentData);
-    }
-
-    public static String getHistoryDataStorage(TenantUsage usage) {
-        TenantDataCapacity historyData = usage.getRegistryCapacity();
-        long currentData = 0;
-        if (historyData != null) {
-            currentData = historyData.getRegistryContentHistoryCapacity();
-        }
-        return convertBytesToString(currentData);
-    }
-
-    public static String getTotalDataStorage(TenantUsage usage) {
-        TenantDataCapacity regData = usage.getRegistryCapacity();
-        long totalDataStorage = 0;
-        if (regData != null) {
-            totalDataStorage =
-                    regData.getRegistryContentCapacity() + 
regData.getRegistryContentHistoryCapacity();
-        }
-        return convertBytesToString(totalDataStorage);
-    }
-
-    public static String getIncomingBandwidth(BandwidthStatistics bandwidth) {
-        long totalBW = 0;
-        if (bandwidth != null) {
-            totalBW = bandwidth.getIncomingBandwidth();
-        }
-        return convertBytesToString(totalBW);
-    }
-
-    public static String getOutgoingBandwidth(BandwidthStatistics bandwidth) {
-        long totalBW = 0;
-        if (bandwidth != null) {
-            totalBW = bandwidth.getOutgoingBandwidth();
-        }
-        return convertBytesToString(totalBW);
-    }
-
-    public static String getTotalBandwidth(BandwidthStatistics bandwidth) {
-        long totalBW = 0;
-        if (bandwidth != null) {
-            totalBW = bandwidth.getIncomingBandwidth() + 
bandwidth.getOutgoingBandwidth();
-        }
-        return convertBytesToString(totalBW);
-    }
-
-    public static InstanceUsageStatics[] retrieveInstanceUsage(ServletRequest 
request,
-                                                               ServletConfig 
config, HttpSession session)
-            throws Exception {
-
-        try {
-            UsageServiceClient serviceClient = new UsageServiceClient(config, 
session);
-            InstanceUsageStatics[] returnInstanceUsage = 
serviceClient.retrieveInstanceUsage();
-            return returnInstanceUsage;
-        } catch (Exception e) {
-            String msg = "Failed to get current instance usage.";
-            log.error(msg, e);
-            throw new UIException(msg, e);
-        }
-    }
-
-    public static PaginatedInstanceUsage 
retrievePaginatedInstanceUsages(ServletRequest request,
-                                                                         
ServletConfig config, HttpSession session) throws Exception {
-        String requestedPage = request.getParameter("requestedPage");
-        int pageNumber = 1;
-        int numberOfPages = 1;
-        int entriesPerPage = 15;
-        if (requestedPage != null && requestedPage.length() > 0) {
-            pageNumber = new Integer(requestedPage);
-        }
-        try {
-            UsageServiceClient serviceClient = new UsageServiceClient(config, 
session);
-            String yearMonth = request.getParameter("year-month");
-            if (yearMonth == null) {
-                // get the current year month
-                yearMonth = getCurrentYearMonth();
-            }
-            return serviceClient.retrievePaginatedInstanceUsage(yearMonth, 
pageNumber, entriesPerPage);
-        } catch (Exception e) {
-            String msg = "Failed to get paginated instance usages.";
-            log.error(msg, e);
-            throw new UIException(msg, e);
-        }
-    }
-    public static String getAPIUsage(TenantUsage usage) {
-        long count = 0;
-
-        if (usage.getApiManagerUsageStats() != null) {
-            count =usage.getApiManagerUsageStats()[0].getRequestCount();
-        }
-        return Long.toString(count);
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.usage.ui/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.usage.ui/src/main/resources/META-INF/component.xml
 
b/components/org.apache.stratos.usage.ui/src/main/resources/META-INF/component.xml
deleted file mode 100644
index c0ca849..0000000
--- 
a/components/org.apache.stratos.usage.ui/src/main/resources/META-INF/component.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<!--
-  ~  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.
-  -->
-<component xmlns="http://products.wso2.org/carbon";>
-    <!-- sample menu configuration -->
-    <menus>
-        <menu>
-            <id>usage_monitoring_menu</id>
-            <i18n-key>usage.monitoring</i18n-key>
-            
<i18n-bundle>org.apache.stratos.usage.ui.i18n.Resources</i18n-bundle>
-            <parent-menu></parent-menu>
-            <link>#</link>
-            <region>region4</region>
-            <style-class>home</style-class>
-            <order>22</order>
-            <icon>../services/images/services.gif</icon>
-        </menu>
-        <menu>
-            <id>tenant_usage_menu</id>
-            <i18n-key>tenant.usage.report</i18n-key>
-            
<i18n-bundle>org.apache.stratos.usage.ui.i18n.Resources</i18n-bundle>
-            <parent-menu>monitor_menu</parent-menu>
-            <link>../tenant-usage/tenant_usage.jsp</link>
-            <region>region4</region>
-            <order>51</order>
-            <style-class>manage</style-class>
-            <icon>../tenant-usage/images/user-usage-report.gif</icon>
-            
<require-permission>/permission/admin/monitor/tenantUsage</require-permission>
-            <require-not-super-tenant>true</require-not-super-tenant>
-        </menu>
-        <!--menu>
-            <id>all_tenant_instance_usage_menu</id>
-            <i18n-key>instance.usage.report</i18n-key>
-            
<i18n-bundle>org.apache.stratos.usage.ui.i18n.Resources</i18n-bundle>
-            <parent-menu>monitor_menu</parent-menu>
-            <link>../tenant-usage/all_tenant_instance_usage.jsp</link>
-            <region>region4</region>
-            <order>50</order>
-            <style-class>manage</style-class>
-            <icon>../tenant-usage/images/instance-usage-report.gif</icon>
-            
<require-permission>/permission/protected/monitor/userUsage</require-permission>
-            <require-super-tenant>true</require-super-tenant>
-        </menu-->
-        <menu>
-            <id>all_tenant_usage_menu</id>
-            <i18n-key>all.tenant.usage.report</i18n-key>
-            
<i18n-bundle>org.apache.stratos.usage.ui.i18n.Resources</i18n-bundle>
-            <parent-menu>monitor_menu</parent-menu>
-            <link>../tenant-usage/all_tenant_usage.jsp</link>
-            <region>region4</region>
-            <order>50</order>
-            <style-class>manage</style-class>
-            <icon>../tenant-usage/images/tenant-usage-report.gif</icon>
-            
<require-permission>/permission/protected/monitor/userUsage</require-permission>
-            <require-super-tenant>true</require-super-tenant>
-        </menu>
-    </menus>
-
-</component>

Reply via email to