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 11:28:05 UTC

[1/7] Applying 0001-Refactor-status-monitor-module.patch

Updated Branches:
  refs/heads/master df3475cc5 -> fcb90b183


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/status-details.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/status-details.jsp b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/status-details.jsp
deleted file mode 100644
index d1881b1..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/status-details.jsp
+++ /dev/null
@@ -1,137 +0,0 @@
-<!--
-~ Copyright (c) 2005-2012, 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.
--->
-<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
-<%@ page import="org.wso2.carbon.CarbonConstants" %>
-<%@ page import="org.wso2.carbon.registry.common.ui.UIException" %>
-<%@ page import="org.wso2.carbon.status.monitor.stub.beans.xsd.ServiceStateDetailInfoBean" %>
-<%@ page import="org.wso2.carbon.status.monitor.ui.clients.HealthMonitorServiceClient" %>
-<%@ page import="org.wso2.carbon.status.monitor.ui.utils.StatusMonitorUtil" %>
-<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
-<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
-<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
-<%@ page import="java.text.SimpleDateFormat" %>
-<%@ page import="java.util.Calendar" %>
-<%@ page import="java.util.Date" %>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
-<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
-<jsp:include page="../registry_common/registry_common-i18n-ajaxprocessor.jsp"/>
-<script type="text/javascript" src="../registry_common/js/registry_validation.js"></script>
-<script type="text/javascript" src="../registry_common/js/registry_common.js"></script>
-<script type="text/javascript" src="../ajax/js/prototype.js"></script>
-<script type="text/javascript" src="js/status_config.js"></script>
-
-
-<carbon:jsi18n
-        resourceBundle="org.wso2.carbon.status.monitor.ui.i18n.JSResources"
-        request="<%=request%>"/>
-
-<fmt:bundle basename="org.wso2.carbon.status.monitor.ui.i18n.Resources">
-    <carbon:breadcrumb
-            label="monitor.status_details.menu"
-            resourceBundle="org.wso2.carbon.status.monitor.ui.i18n.Resources"
-            topPage="true"
-            request="<%=request%>"/>
-
-
-    <div id="middle">
-
-        <%
-            String backendServerURL = CarbonUIUtil.getServerURL(
-                    config.getServletContext(), session);
-            ConfigurationContext configContext = (ConfigurationContext) config
-                    .getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
-
-            String cookie = (String) session.getAttribute
-                    (ServerConstants.ADMIN_SERVICE_COOKIE);
-            HealthMonitorServiceClient client;
-
-            ServiceStateDetailInfoBean[] serviceStateDetailInfoBeanArr;
-            try {
-                client = new HealthMonitorServiceClient(cookie, backendServerURL, configContext);
-
-                 serviceStateDetailInfoBeanArr = client.retrieveStateDetails();
-
-            } catch (UIException e) {
-                String error1 = "Error in retrieving service state details";
-                request.setAttribute(CarbonUIMessage.ID, new CarbonUIMessage(error1, error1, null));
-        %>
-
-        <jsp:forward page="../admin/error.jsp"/>
-
-        <%
-                return;
-            }
-        %>
-
-        <br/>
-
-        <h2><fmt:message key="services.state.details"/></h2>
-
-        <div id="workArea">
-            <table cellpadding="0" cellspacing="0" border="0" style="width:100%" class="styledLeft">
-                <thead>
-                <tr>
-                    <th style="padding-left:5px;text-align:left;"><fmt:message
-                            key="service.name"/></th>
-                    <th style="padding-left:5px;text-align:left;"><fmt:message
-                     key="state.logged.time"/></th>
-                    <th style="padding-left:5px;text-align:left;"><fmt:message
-                            key="service.state.details"/></th>
-                    <th style="padding-left:5px;text-align:left;"><fmt:message
-                     key="details.logged.time"/></th>
-                </tr>
-                </thead>
-                <tbody>
-                <%
-                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
-
-                    if (serviceStateDetailInfoBeanArr != null) {
-                        for (ServiceStateDetailInfoBean
-                            serviceStateDetailInfoBean : serviceStateDetailInfoBeanArr) {
-                            if (serviceStateDetailInfoBean == null) {
-                                continue;
-                            }
-
-                            String service = serviceStateDetailInfoBean.getService();
-                            String stateDetail = serviceStateDetailInfoBean.getServiceStateDetail();
-                            Date stateLoggedTime = new Date(
-                                serviceStateDetailInfoBean.getStateLoggedTime());
-                            Date detailLoggedTime = new Date(
-                                serviceStateDetailInfoBean.getDetailLoggedTime());
-                            String stateLoggedTimeStr = dateFormat.format(stateLoggedTime);
-                            String detailLoggedTimeStr = dateFormat.format(detailLoggedTime);
-                %>
-                <tr id="1">
-                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=service%>
-                    </td>
-                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=stateLoggedTimeStr%>
-                    </td>
-                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=stateDetail%>
-                    </td>
-                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=detailLoggedTimeStr%>
-                    </td>
-                </tr>
-                <% }
-                }
-                %>
-                </tbody>
-            </table>
-        </div>
-    </div>
-</fmt:bundle>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/pom.xml b/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/pom.xml
deleted file mode 100644
index 5a9b7c0..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/pom.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<!--
-# Copyright (c) 2012, 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>status-monitor-parent</artifactId>
-        <version>2.1.0</version>
-<relativePath>../../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.wso2.carbon.status.monitor</artifactId>
-    <packaging>bundle</packaging>
-    <name>WSO2 Stratos - Stratos Status Monitor Back-End</name>
-
-    <build>
-
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-            </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>
-                        <Private-Package>
-                            org.wso2.carbon.status.monitor.internal.*,
-                        </Private-Package>
-                        <Export-Package>
-                            org.wso2.carbon.status.monitor.beans.*,
-                            org.wso2.carbon.status.monitor.services.*,
-                        </Export-Package>
-                        <Import-Package>
-                            org.wso2.carbon.registry.core.*;version=1.0.1,
-                            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.wso2.carbon.status.monitor.core.*,
-                            *;resolution:=optional
-                        </Import-Package>
-                        <DynamicImport-Package>*</DynamicImport-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.registry.core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.status.monitor.core</artifactId>
-        </dependency>
-    </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/beans/ServiceStateDetailInfoBean.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/beans/ServiceStateDetailInfoBean.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/beans/ServiceStateDetailInfoBean.java
deleted file mode 100644
index 381908f..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/beans/ServiceStateDetailInfoBean.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.beans;
-
-/**
- * Service State Details, includes the log information
- */
-public class ServiceStateDetailInfoBean {
-    private String service;
-    private String serviceStateDetail;
-    private long stateLoggedTime;
-    private long detailLoggedTime;
-
-    public String getService() {
-        return service;
-    }
-
-    public void setService(String service) {
-        this.service = service;
-    }
-
-    public String getServiceStateDetail() {
-        return serviceStateDetail;
-    }
-
-    public void setServiceStateDetail(String serviceStateDetail) {
-        this.serviceStateDetail = serviceStateDetail;
-    }
-
-    public long getStateLoggedTime() {
-        return stateLoggedTime;
-    }
-
-    public void setStateLoggedTime(long stateLoggedTime) {
-        this.stateLoggedTime = stateLoggedTime;
-    }
-
-    public long getDetailLoggedTime() {
-        return detailLoggedTime;
-    }
-
-    public void setDetailLoggedTime(long detailLoggedTime) {
-        this.detailLoggedTime = detailLoggedTime;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/beans/ServiceStateInfoBean.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/beans/ServiceStateInfoBean.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/beans/ServiceStateInfoBean.java
deleted file mode 100644
index 53c373f..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/beans/ServiceStateInfoBean.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.beans;
-
-/**
- * Service State Information.
- */
-public class ServiceStateInfoBean {
-    private int serviceID;
-    private String service;
-    private String serviceState;
-    private long date;
-
-    public int getServiceID() {
-        return serviceID;
-    }
-
-    public void setServiceID(int serviceID) {
-        this.serviceID = serviceID;
-    }
-
-    public String getService() {
-        return service;
-    }
-
-    public void setService(String service) {
-        this.service = service;
-    }
-
-    public String getServiceState() {
-        return serviceState;
-    }
-
-    public void setServiceState(String serviceState) {
-        this.serviceState = serviceState;
-    }
-
-    public long getDate() {
-        return date;
-    }
-
-    public void setDate(long date) {
-        this.date = date;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/internal/StatusMonitorServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/internal/StatusMonitorServiceComponent.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/internal/StatusMonitorServiceComponent.java
deleted file mode 100644
index 0c7e74d..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/internal/StatusMonitorServiceComponent.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-*  Copyright (c) 2005-2012, 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.status.monitor.internal;
-
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.ComponentContext;
-import org.wso2.carbon.status.monitor.core.exception.StatusMonitorException;
-import org.wso2.carbon.status.monitor.core.util.StatusMonitorUtil;
-import org.wso2.carbon.status.monitor.internal.core.MySQLConnector;
-import org.wso2.carbon.utils.ConfigurationContextService;
-
-/**
- * @scr.component name="org.wso2.carbon.status.monitor" immediate="true"
- * @scr.reference name="configuration.context.service"
- *                interface="org.wso2.carbon.utils.ConfigurationContextService"
- *                cardinality="1..1" policy="dynamic"
- *                bind="setConfigurationContextService"
- *                unbind="unsetConfigurationContextService"
- */
-public class StatusMonitorServiceComponent {
-    private static Log log = LogFactory.getLog(
-            StatusMonitorServiceComponent.class);
-
-    private static BundleContext bundleContext;
-    private static ConfigurationContextService configurationContextService;
-
-    protected void activate(ComponentContext context) {
-        try {
-            bundleContext = context.getBundleContext();
-            if (StatusMonitorUtil.getStatusMonitorConfiguration() == null) {
-                StatusMonitorUtil.initStatusMonitor(context.getBundleContext());
-                if (log.isDebugEnabled()) {
-                    log.debug("Status Monitor Agent initialized");
-                }
-            }
-            initConnector();
-            log.debug("******* Status Monitor bundle is activated ******* ");
-        } catch (Exception e) {
-            log.error("******* Status Monitor bundle failed activating ****", e);
-        }
-    }
-
-    private void initConnector() throws StatusMonitorException {
-        try {
-            MySQLConnector.initialize();
-        } catch (Exception e) {
-            String msg = "Error in initializing the mysql connection for the health monitoring";
-            log.error(msg, e);
-            throw new StatusMonitorException(msg, e);
-        }
-    }
-
-    protected void deactivate(ComponentContext context) {
-        log.debug("******* Status Monitor bundle is deactivated ******* ");
-    }
-
-    protected void setConfigurationContextService(ConfigurationContextService configurationContextService) {
-        log.debug("Receiving ConfigurationContext Service");
-        StatusMonitorServiceComponent.
-                configurationContextService = configurationContextService;
-
-    }
-
-    protected void unsetConfigurationContextService(
-            ConfigurationContextService configurationContextService) {
-        log.debug("Unsetting ConfigurationContext Service");
-        setConfigurationContextService(null);
-    }
-
-    public static BundleContext getBundleContext() {
-        return bundleContext;
-    }
-
-    public static ConfigurationContextService getConfigurationContextService() {
-        return configurationContextService;
-    }
-
-    public static ConfigurationContext getConfigurationContext() {
-        if (configurationContextService.getServerConfigContext() == null) {
-            return null;
-        }
-        return configurationContextService.getServerConfigContext();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/internal/core/MySQLConnector.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/internal/core/MySQLConnector.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/internal/core/MySQLConnector.java
deleted file mode 100644
index f0d2bcc..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/internal/core/MySQLConnector.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.internal.core;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.beans.ServiceStateDetailInfoBean;
-import org.wso2.carbon.status.monitor.beans.ServiceStateInfoBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import java.sql.Connection;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * The class connecting with the mysql database for the Status Monitor Back end
- */
-public class MySQLConnector {
-    private static Connection conn;
-    private static final Log log = LogFactory.getLog(MySQLConnector.class);
-
-    private static List<String> serviceList = new ArrayList<String>();
-    private static List<String> statusList = new ArrayList<String>();
-
-    /**
-     * gets the sql connection and initializes the MySQLConnectionInitializer.
-     *
-     * @return Static Connection
-     * @throws Exception, throws exception
-     */
-    public static Connection initialize() throws Exception {
-        //gets the sql connection.
-        conn = MySQLConnectionInitializer.initialize();
-
-        //initializes the service and state lists.
-        serviceList = MySQLConnectionInitializer.getServiceList();
-        statusList = MySQLConnectionInitializer.getStatusList();
-
-        if (log.isDebugEnabled()) {
-            log.debug("Connection to the status database is initialized from status.monitor");
-        }
-
-        return conn;
-    }
-
-    /**
-     * Gets the service state ID from the service ID
-     *
-     * @param serviceID: int
-     * @return service state ID
-     * @throws java.sql.SQLException, if the retrieval of the service state failed.
-     */
-    public static ServiceStateInfoBean getServiceState(int serviceID) throws SQLException {
-        ResultSet rs;
-        Statement stmtCon = conn.createStatement();
-        String sql = StatusMonitorConstants.GET_SERVICE_STATE_SQL + serviceID +
-                StatusMonitorConstants.ORDER_BY_TIMESTAMP_SQL;
-
-        stmtCon.executeQuery(sql);
-        rs = stmtCon.getResultSet();
-        int stateID;
-        Timestamp date;
-        ServiceStateInfoBean serviceStateInfoBean = new ServiceStateInfoBean();
-
-        try {
-            while (rs.next()) {
-                stateID = rs.getInt(StatusMonitorConstants.STATE_ID);
-                date = rs.getTimestamp(StatusMonitorConstants.TIMESTAMP);
-                serviceStateInfoBean.setDate(date.getTime());
-                serviceStateInfoBean.setService(serviceList.get(serviceID - 1));
-                serviceStateInfoBean.setServiceID(serviceID);
-                serviceStateInfoBean.setServiceState(statusList.get(stateID - 1));
-            }
-        } catch (SQLException e) {
-            String msg = "Getting the service state failed";
-            log.error(msg, e);
-            throw new SQLException(msg, e);
-        } finally {
-            rs.close();
-            stmtCon.close();
-        }
-        return serviceStateInfoBean;
-    }
-
-    /**
-     * Gets the list of all the service state details.
-     *
-     * @return the list of the service state details.
-     * @throws Exception, if the retrieval of the service state details failed.
-     */
-    public static List<ServiceStateDetailInfoBean> getAllServiceStateDetail() throws Exception {
-        List<ServiceStateDetailInfoBean> stateDetailList = new ArrayList<ServiceStateDetailInfoBean>();
-
-        ResultSet rs;
-        Statement stmtCon = conn.createStatement();
-        String sql = StatusMonitorConstants.GET_ALL_STATE_DETAIL_SQL;
-        stmtCon.executeQuery(sql);
-        rs = stmtCon.getResultSet();
-        String service;
-        String serviceStateDetail;
-        Timestamp stateLoggedTime;
-        Timestamp detailLoggedTime;
-
-        ServiceStateDetailInfoBean serviceStateDetailInfoBean;
-
-        try {
-            while (rs.next()) {
-                serviceStateDetailInfoBean = new ServiceStateDetailInfoBean();
-
-                service = rs.getString(StatusMonitorConstants.SERVICE_WSL_NAME);
-                stateLoggedTime = rs.getTimestamp(StatusMonitorConstants.SERVICE_STATE_WSL_TIMESTAMP);
-                detailLoggedTime =
-                        rs.getTimestamp(StatusMonitorConstants.SERVICE_STATE_DETAIL_WSL_TIMESTAMP);
-                serviceStateDetail = rs.getString(StatusMonitorConstants.SERVICE_STATE_DETAIL);
-
-                serviceStateDetailInfoBean.setService(service);
-                serviceStateDetailInfoBean.setStateLoggedTime(stateLoggedTime.getTime());
-                serviceStateDetailInfoBean.setServiceStateDetail(serviceStateDetail);
-                serviceStateDetailInfoBean.setDetailLoggedTime(detailLoggedTime.getTime());
-
-                stateDetailList.add(serviceStateDetailInfoBean);
-            }
-        } catch (SQLException e) {
-            String msg = "Getting the serviceID failed";
-            log.error(msg, e);
-            throw new SQLException(msg, e);
-        } finally {
-            rs.close();
-            stmtCon.close();
-        }
-        return stateDetailList;
-    }
-
-    /**
-     * Gets the list of all the service state.
-     *
-     * @return list of ServiceStateInfoBean.
-     * @throws Exception, if the retrieval of the list of service state infobean failed.
-     */
-    public static List<ServiceStateInfoBean> getAllServiceState() throws Exception {
-        List<ServiceStateInfoBean> serviceStateInfoBeanList = new ArrayList<ServiceStateInfoBean>();
-        for (int serviceID = 1; serviceID <= serviceList.size(); serviceID++) {
-            serviceStateInfoBeanList.add(getServiceState(serviceID));
-        }
-        return serviceStateInfoBeanList;
-    }
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/services/HealthMonitorService.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/services/HealthMonitorService.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/services/HealthMonitorService.java
deleted file mode 100644
index fcb5718..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/java/org/wso2/carbon/status/monitor/services/HealthMonitorService.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.services;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.core.AbstractAdmin;
-import org.wso2.carbon.status.monitor.beans.ServiceStateDetailInfoBean;
-import org.wso2.carbon.status.monitor.beans.ServiceStateInfoBean;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-import org.wso2.carbon.status.monitor.internal.core.MySQLConnector;
-
-import java.util.List;
-
-/**
- * This is the admin Web service which is used for health monitoring of the services
- */
-public class HealthMonitorService extends AbstractAdmin {
-    private static final Log log = LogFactory.getLog(
-            org.wso2.carbon.status.monitor.services.HealthMonitorService.class);
-
-    /**
-     * Get the status of all the services
-     *
-     * @return serviceStateInfoBean[]
-     * @throws Exception if failed to get Tenant Manager
-     */
-    public ServiceStateInfoBean[] getAllServiceStatus() throws Exception {
-        List<ServiceStateInfoBean> serviceStatusList = MySQLConnector.getAllServiceState();
-        return serviceStatusList.toArray(new ServiceStateInfoBean[serviceStatusList.size()]);
-    }
-
-    /**
-     * Get the status of a specific service
-     *
-     * @param ServiceName: String
-     * @return ServiceInfoBean: Service Information
-     * @throws Exception, if the retrieval of the service status failed.
-     */
-    public ServiceStateInfoBean getServiceStatus(String ServiceName) throws Exception {
-        int serviceID = MySQLConnectionInitializer.getServiceID(ServiceName);
-        return MySQLConnector.getServiceState(serviceID);
-    }
-
-    public ServiceStateDetailInfoBean[] getAllServiceStateDetail() throws Exception {
-        List<ServiceStateDetailInfoBean> serviceStatusDetailList =
-                MySQLConnector.getAllServiceStateDetail();
-        return serviceStatusDetailList.toArray(
-                new ServiceStateDetailInfoBean[serviceStatusDetailList.size()]);
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/resources/META-INF/component.xml b/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/resources/META-INF/component.xml
deleted file mode 100755
index 48b22f6..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/resources/META-INF/component.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~  Copyright (c) 2012, 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>Manage</DisplayName>
-            <ResourceId>/permission/protected/manage</ResourceId>
-        </ManagementPermission>
-        <ManagementPermission>
-            <DisplayName>Monitor</DisplayName>
-            <ResourceId>/permission/protected/manage/monitor</ResourceId>
-        </ManagementPermission>
-        <ManagementPermission>
-            <DisplayName>Tenants</DisplayName>
-            <ResourceId>/permission/protected/manage/monitor/tenants</ResourceId>
-        </ManagementPermission>
-        <ManagementPermission>
-            <DisplayName>Modify</DisplayName>
-            <ResourceId>/permission/protected/manage/modify</ResourceId>
-        </ManagementPermission>
-        <ManagementPermission>
-            <DisplayName>Tenants</DisplayName>
-            <ResourceId>/permission/protected/manage/modify/tenants</ResourceId>
-        </ManagementPermission>
-   </ManagementPermissions>
-</component>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/resources/META-INF/services.xml
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/resources/META-INF/services.xml b/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/resources/META-INF/services.xml
deleted file mode 100755
index f2513b4..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor/2.1.0/src/main/resources/META-INF/services.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- !
- ! Copyright 2012 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="HealthMonitorService" scope="transportsession">
-        <transports>
-            <transport>https</transport>
-        </transports>
-        <parameter name="ServiceClass" locked="false">
-            org.wso2.carbon.status.monitor.services.HealthMonitorService
-        </parameter>
-        <operation name="getServiceStatus">
-        </operation>
-        <operation name="getAllServiceStatus">
-        </operation>
-        <parameter name="hiddenService" locked="true">true</parameter>
-        <parameter name="adminService" locked="true">true</parameter>
-    </service>
-</serviceGroup>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/pom.xml b/components/stratos/status-monitor/pom.xml
deleted file mode 100644
index 0a6a461..0000000
--- a/components/stratos/status-monitor/pom.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright (c) 2012, 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>stratos-components</artifactId>
-        <version>2.1.0</version>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>status-monitor-parent</artifactId>
-    <packaging>pom</packaging>
-    <name>WSO2 Stratos - Status Monitor Parent Module</name>
-    <description>WSO2 Stratos Monitor Parent Module</description>
-    <url>http://wso2.org</url>
-
-    <modules>
-        <module>org.wso2.carbon.status.monitor.core/2.1.0</module>
-        <module>org.wso2.carbon.status.monitor.agent/2.1.0</module>
-        <module>org.wso2.carbon.status.monitor/2.1.0</module>
-        <module>org.wso2.carbon.status.monitor.ui/2.1.0</module>
-    </modules>
-</project>
-


[7/7] git commit: Applying 0001-Refactor-status-monitor-module.patch

Posted by la...@apache.org.
Applying 0001-Refactor-status-monitor-module.patch


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/fcb90b18
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/fcb90b18
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/fcb90b18

Branch: refs/heads/master
Commit: fcb90b183d3edb786d00337199879b4bd785615b
Parents: df3475c
Author: Lakmal Warusawithana <la...@wso2.com>
Authored: Thu Jul 11 14:57:48 2013 +0530
Committer: Lakmal Warusawithana <la...@wso2.com>
Committed: Thu Jul 11 14:57:48 2013 +0530

----------------------------------------------------------------------
 .../pom.xml                                     | 109 ++++++++
 .../agent/clients/ClientThreadsInitializer.java | 150 ++++++++++
 .../clients/common/LoadBalanceAgentClient.java  |  94 +++++++
 .../clients/common/ServiceLoginClient.java      | 100 +++++++
 .../service/ApplicationServerClient.java        | 253 +++++++++++++++++
 .../agent/clients/service/BAMServerClient.java  |  74 +++++
 .../agent/clients/service/BPSServerClient.java  | 128 +++++++++
 .../agent/clients/service/BRSServerClient.java  | 138 +++++++++
 .../agent/clients/service/CEPServerClient.java  | 154 +++++++++++
 .../agent/clients/service/DataServerClient.java | 190 +++++++++++++
 .../agent/clients/service/ESBServerClient.java  | 244 ++++++++++++++++
 .../clients/service/GadgetServerClient.java     | 111 ++++++++
 .../service/GovernanceRegistryServerClient.java | 182 ++++++++++++
 .../clients/service/IdentityServerClient.java   | 116 ++++++++
 .../clients/service/ManagerServiceClient.java   | 113 ++++++++
 .../clients/service/MashupServerClient.java     | 192 +++++++++++++
 .../service/MessageBrokerServiceClient.java     | 158 +++++++++++
 .../constants/StatusMonitorAgentConstants.java  |  55 ++++
 .../internal/StatusMonitorAgentComponent.java   | 110 ++++++++
 .../agent/internal/core/MySQLConnector.java     | 277 +++++++++++++++++++
 .../pom.xml                                     |  81 ++++++
 .../core/StatusMonitorConfigurationBuilder.java | 247 +++++++++++++++++
 .../monitor/core/beans/AuthConfigBean.java      |  61 ++++
 .../core/beans/SampleTenantConfigBean.java      |  34 +++
 .../core/constants/StatusMonitorConstants.java  | 152 ++++++++++
 .../core/exception/StatusMonitorException.java  |  33 +++
 .../internal/StatusMonitorCoreComponent.java    |  92 ++++++
 .../core/jdbc/MySQLConnectionInitializer.java   | 247 +++++++++++++++++
 .../monitor/core/util/StatusMonitorUtil.java    |  72 +++++
 .../src/main/resources/META-INF/component.xml   |  44 +++
 .../resources/database/wso2_slive_status.sql    | 148 ++++++++++
 .../pom.xml                                     |  86 ++++++
 .../ui/clients/HealthMonitorServiceClient.java  | 105 +++++++
 .../monitor/ui/utils/StatusMonitorUtil.java     | 107 +++++++
 .../src/main/resources/META-INF/component.xml   |  49 ++++
 .../monitor/ui/i18n/JSResources.properties      |   0
 .../status/monitor/ui/i18n/Resources.properties |  12 +
 .../resources/web/status-monitor/css/status.css |  62 +++++
 .../status-monitor/docs/images/view-details.png | Bin 0 -> 121916 bytes
 .../status-monitor/docs/images/view-status.png  | Bin 0 -> 149085 bytes
 .../web/status-monitor/docs/userguide.html      |  57 ++++
 .../web/status-monitor/images/services.gif      | Bin 0 -> 604 bytes
 .../web/status-monitor/images/services1.gif     | Bin 0 -> 608 bytes
 .../web/status-monitor/service-status.jsp       | 127 +++++++++
 .../web/status-monitor/status-details.jsp       | 138 +++++++++
 .../org.apache.stratos.status.monitor/pom.xml   |  82 ++++++
 .../beans/ServiceStateDetailInfoBean.java       |  62 +++++
 .../monitor/beans/ServiceStateInfoBean.java     |  61 ++++
 .../internal/StatusMonitorServiceComponent.java | 103 +++++++
 .../monitor/internal/core/MySQLConnector.java   | 171 ++++++++++++
 .../monitor/services/HealthMonitorService.java  |  68 +++++
 .../src/main/resources/META-INF/component.xml   |  44 +++
 .../src/main/resources/META-INF/services.xml    |  36 +++
 .../2.1.0/pom.xml                               | 105 -------
 .../agent/clients/ClientThreadsInitializer.java | 147 ----------
 .../clients/common/LoadBalanceAgentClient.java  |  91 ------
 .../clients/common/ServiceLoginClient.java      |  98 -------
 .../service/ApplicationServerClient.java        | 250 -----------------
 .../agent/clients/service/BAMServerClient.java  |  71 -----
 .../agent/clients/service/BPSServerClient.java  | 125 ---------
 .../agent/clients/service/BRSServerClient.java  | 135 ---------
 .../agent/clients/service/CEPServerClient.java  | 151 ----------
 .../agent/clients/service/DataServerClient.java | 187 -------------
 .../agent/clients/service/ESBServerClient.java  | 241 ----------------
 .../clients/service/GadgetServerClient.java     | 108 --------
 .../service/GovernanceRegistryServerClient.java | 179 ------------
 .../clients/service/IdentityServerClient.java   | 114 --------
 .../clients/service/ManagerServiceClient.java   | 111 --------
 .../clients/service/MashupServerClient.java     | 189 -------------
 .../service/MessageBrokerServiceClient.java     | 155 -----------
 .../constants/StatusMonitorAgentConstants.java  |  52 ----
 .../internal/StatusMonitorAgentComponent.java   | 109 --------
 .../agent/internal/core/MySQLConnector.java     | 274 ------------------
 .../2.1.0/pom.xml                               |  78 ------
 .../core/StatusMonitorConfigurationBuilder.java | 244 ----------------
 .../monitor/core/beans/AuthConfigBean.java      |  58 ----
 .../core/beans/SampleTenantConfigBean.java      |  31 ---
 .../core/constants/StatusMonitorConstants.java  | 149 ----------
 .../core/exception/StatusMonitorException.java  |  33 ---
 .../internal/StatusMonitorCoreComponent.java    |  91 ------
 .../core/jdbc/MySQLConnectionInitializer.java   | 244 ----------------
 .../monitor/core/util/StatusMonitorUtil.java    |  69 -----
 .../src/main/resources/META-INF/component.xml   |  41 ---
 .../resources/database/wso2_slive_status.sql    | 148 ----------
 .../2.1.0/pom.xml                               |  80 ------
 .../ui/clients/HealthMonitorServiceClient.java  | 104 -------
 .../monitor/ui/utils/StatusMonitorUtil.java     | 107 -------
 .../src/main/resources/META-INF/component.xml   |  48 ----
 .../monitor/ui/i18n/JSResources.properties      |   0
 .../status/monitor/ui/i18n/Resources.properties |  12 -
 .../resources/web/status-monitor/css/status.css |  62 -----
 .../status-monitor/docs/images/view-details.png | Bin 121916 -> 0 bytes
 .../status-monitor/docs/images/view-status.png  | Bin 149085 -> 0 bytes
 .../web/status-monitor/docs/userguide.html      |  56 ----
 .../web/status-monitor/images/services.gif      | Bin 604 -> 0 bytes
 .../web/status-monitor/images/services1.gif     | Bin 608 -> 0 bytes
 .../web/status-monitor/service-status.jsp       | 126 ---------
 .../web/status-monitor/status-details.jsp       | 137 ---------
 .../2.1.0/pom.xml                               |  79 ------
 .../beans/ServiceStateDetailInfoBean.java       |  59 ----
 .../monitor/beans/ServiceStateInfoBean.java     |  58 ----
 .../internal/StatusMonitorServiceComponent.java | 102 -------
 .../monitor/internal/core/MySQLConnector.java   | 168 -----------
 .../monitor/services/HealthMonitorService.java  |  65 -----
 .../src/main/resources/META-INF/component.xml   |  41 ---
 .../src/main/resources/META-INF/services.xml    |  34 ---
 components/stratos/status-monitor/pom.xml       |  42 ---
 107 files changed, 5529 insertions(+), 5458 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/pom.xml b/components/org.apache.stratos.status.monitor.agent/pom.xml
new file mode 100644
index 0000000..ce07ec2
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/pom.xml
@@ -0,0 +1,109 @@
+<!-- 
+  #  Licensed to the Apache Software Foundation (ASF) under one
+  #  or more contributor license agreements.  See the NOTICE file
+  #  distributed with this work for additional information
+  #  regarding copyright ownership.  The ASF licenses this file
+  #  to you under the Apache License, Version 2.0 (the
+  #  "License"); you may not use this file except in compliance
+  #  with the License.  You may obtain a copy of the License at
+  #  
+  #  http://www.apache.org/licenses/LICENSE-2.0
+  #  
+  #  Unless required by applicable law or agreed to in writing,
+  #  software distributed under the License is distributed on an
+  #  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  #  KIND, either express or implied.  See the License for the
+  #  specific language governing permissions and limitations
+  #  under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.stratos</groupId>
+        <artifactId>stratos-components-parent</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.stratos.status.monitor.agent</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Stratos - Stratos Status Monitor Agent</name>
+
+    <build>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </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>
+                        <Private-Package>
+                            org.apache.stratos.status.monitor.agent.internal.*,
+                        </Private-Package>
+                        <Export-Package>
+                            org.apache.stratos.status.monitor.agent.*,
+                        </Export-Package>
+                        <Import-Package>
+                            org.wso2.carbon.registry.core.*;version=1.0.1,
+                            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.stratos.status.monitor.core.*,
+                            *;resolution:=optional
+                        </Import-Package>
+                        <DynamicImport-Package>*</DynamicImport-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.registry.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.status.monitor.core</artifactId>
+	    <version>3.0.0-SNAPSHOT</version>
+        </dependency>
+
+        <!--dependencies for the service service-->
+        <!--dependencies for the Identity Server Client-->
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.authenticator.stub</artifactId>
+	    <version>4.0.0</version>
+        </dependency>
+
+        <!--dependencies for the CEP Server and MB Client-->
+        <dependency>
+            <groupId>org.apache.geronimo.specs.wso2</groupId>
+            <artifactId>geronimo-jms_1.1_spec</artifactId>
+            <version>${orbit.version.geronimo-jms_1.1_spec}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.qpid.wso2</groupId>
+            <artifactId>qpid-client</artifactId>
+            <version>0.12.wso2v1</version>
+        </dependency>
+
+        <!--dependencies to invoke the load average service-->
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.load.balance.agent.stub</artifactId>
+            <version>${wso2carbon.version}</version>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/ClientThreadsInitializer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/ClientThreadsInitializer.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/ClientThreadsInitializer.java
new file mode 100644
index 0000000..9a641aa
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/ClientThreadsInitializer.java
@@ -0,0 +1,150 @@
+/*
+ * 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.status.monitor.agent.clients;
+
+import org.apache.stratos.status.monitor.agent.clients.service.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.jms.JMSException;
+import javax.naming.NamingException;
+import javax.xml.stream.XMLStreamException;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.text.ParseException;
+
+/**
+ * The class that initializes the client threads
+ */
+public class ClientThreadsInitializer {
+    private static final Log log = LogFactory.getLog(ClientThreadsInitializer.class);
+
+    public static void initializeThreads() throws IOException, SQLException, NamingException,
+            JMSException, ParseException, XMLStreamException {
+
+        new Thread() {
+            public void run() {
+                try {
+                    ApplicationServerClient applicationServerClient = new ApplicationServerClient();
+                    applicationServerClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for " +
+                            "Application Server";
+                    log.warn(msg);
+                }
+                try {
+                    DataServerClient dataServerClient = new DataServerClient();
+                    dataServerClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for " +
+                            "Data Services Server";
+                    log.warn(msg);
+                }
+                try {
+                    ESBServerClient esbServerClient = new ESBServerClient();
+                    esbServerClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for ESB";
+                    log.warn(msg);
+                }
+                try {
+                    GovernanceRegistryServerClient governanceRegistryServerClient = new GovernanceRegistryServerClient();
+                    governanceRegistryServerClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for " +
+                            "Governance Registry";
+                    log.warn(msg);
+                }
+                try {
+                    BPSServerClient bpsServerClient = new BPSServerClient();
+                    bpsServerClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for " +
+                            "Business Process Server";
+                    log.warn(msg);
+                }
+                try {
+                    MashupServerClient mashupServerClient = new MashupServerClient();
+                    mashupServerClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for " +
+                            "Mashup Server";
+                    log.warn(msg);
+                }
+                try {
+                    BRSServerClient brsServerClient = new BRSServerClient();
+                    brsServerClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for " +
+                            "Business Rules Server";
+                    log.warn(msg);
+                }
+                try {
+                    GadgetServerClient gadgetServerClient = new GadgetServerClient();
+                    gadgetServerClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for " +
+                            "Gadgets Server";
+                    log.warn(msg);
+                }
+                try {
+                    IdentityServerClient serverClient = new IdentityServerClient();
+                    serverClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for " +
+                            "Identity Server";
+                    log.warn(msg);
+                }
+                try {
+                    BAMServerClient bamServerClient = new BAMServerClient();
+                    bamServerClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for " +
+                            "Business Activity Monitor";
+                    log.warn(msg);
+                }
+                try {
+                    ManagerServiceClient managerServiceClient = new ManagerServiceClient();
+                    managerServiceClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for " +
+                            "Manager";
+                    log.warn(msg);
+                }
+                try {
+                    MessageBrokerServiceClient messageBrokerServiceClient = new MessageBrokerServiceClient();
+                    messageBrokerServiceClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for " +
+                            "Message Broker";
+                    log.warn(msg);
+                }
+                try {
+                    CEPServerClient cepServerClient = new CEPServerClient();
+                    cepServerClient.start();
+                } catch (Exception e) {
+                    String msg = "Error in starting the status monitoring thread for " +
+                            "CEP Server";
+                    log.warn(msg);
+                }
+            }
+        }.start();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/common/LoadBalanceAgentClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/common/LoadBalanceAgentClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/common/LoadBalanceAgentClient.java
new file mode 100644
index 0000000..6c6b233
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/common/LoadBalanceAgentClient.java
@@ -0,0 +1,94 @@
+/*
+ *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.status.monitor.agent.clients.common;
+
+import org.apache.axis2.AxisFault;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.load.balance.agent.stub.LoadBalanceAgentServiceStub;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+
+import java.rmi.RemoteException;
+import java.sql.SQLException;
+
+/**
+ * The agent class that gets the load average of the service instances
+ */
+public class LoadBalanceAgentClient {
+    private static final Log log = LogFactory.getLog(LoadBalanceAgentClient.class);
+    /**
+     * Load Balance Agent - This gets the load information from the service instances of each of the
+     * service cluster.
+     */
+    private static final String serviceName = "LoadBalanceAgentService";
+    private static final String services = "/services/";
+
+
+    /**
+     * gets the load average from the remote instances given in the instances map.
+     *
+     * @param hostName, host name of the service
+     * @param serviceID, int
+     * @return the load average of the given instance.
+     * @throws java.sql.SQLException, if exception in writing to the database.
+     */
+    public static double getLoadAverageFromInstances(String hostName, int serviceID) throws SQLException {
+        double loadAverage = -1;
+        LoadBalanceAgentServiceStub stub;
+        String serviceUrl;
+
+        // gets the instance and the service
+        try {
+            serviceUrl = "https://" + hostName + services + serviceName;
+        } catch (Exception e) {
+            if (log.isDebugEnabled()) {
+                log.debug("Unable to get the running application instances to get the " +
+                        "load average", e);
+            }
+            return loadAverage;
+        }
+
+        // gets the load average of the service instance
+        try {
+            stub = new LoadBalanceAgentServiceStub(serviceUrl);
+            loadAverage = stub.getLoadAverage();
+        } catch (AxisFault e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, e.getMessage());
+            String msg = "Invoking the Load Balance Agent Client Failed";
+            log.warn(msg, e);
+        } catch (RemoteException e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, e.getMessage());
+            String msg = "Remote Exception in invoking the Load Balance Agent Client";
+            log.warn(msg, e);
+        } catch (Exception e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, e.getMessage());
+            String msg = "Exception in invoking the Load Balance Agent Client";
+            log.warn(msg, e);
+        }
+        if (log.isDebugEnabled()) {
+            log.debug("Load Average from the service: " + serviceUrl + ": " + loadAverage);
+        }
+        return loadAverage;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/common/ServiceLoginClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/common/ServiceLoginClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/common/ServiceLoginClient.java
new file mode 100644
index 0000000..c1f4d58
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/common/ServiceLoginClient.java
@@ -0,0 +1,100 @@
+/*
+ *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.status.monitor.agent.clients.common;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.authenticator.stub.AuthenticationAdminStub;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+
+import java.sql.SQLException;
+
+/**
+ * The client class that tries to log in into each of the services.
+ */
+public class ServiceLoginClient {
+    private static final Log log = LogFactory.getLog(ServiceLoginClient.class);
+    private static AuthConfigBean authConfigBean = StatusMonitorConfigurationBuilder.getAuthConfigBean();
+
+    static {
+        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE, authConfigBean.getJksLocation());
+        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE_PASSWORD, "wso2carbon");
+        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE_TYPE, "JKS");
+    }
+
+    /**
+     * Checks the log in
+     * @param hostName; host name of the service
+     * @param serviceID: int, service ID
+     * @return boolean: true, if successfully logged in
+     * @throws SQLException: if writing to the database failed.
+     */
+    public static boolean loginChecker(String hostName, int serviceID) throws SQLException {
+        if(log.isDebugEnabled()) {
+            log.debug("************** TRUST STORE : " +
+                    System.getProperty(StatusMonitorAgentConstants.TRUST_STORE));
+        }
+        String userName = authConfigBean.getUserName();
+        String password = authConfigBean.getPassword();
+        boolean loginStatus = false;
+        String authenticationServiceURL = "https://" + hostName +
+                StatusMonitorAgentConstants.AUTHENTICATION_ADMIN_PATH;
+        AuthenticationAdminStub authenticationAdminStub;
+        try {
+            authenticationAdminStub = new AuthenticationAdminStub(authenticationServiceURL);
+            ServiceClient client = authenticationAdminStub._getServiceClient();
+            Options options = client.getOptions();
+            options.setManageSession(true);
+
+            loginStatus = authenticationAdminStub.login(userName, password, hostName);
+            ServiceContext serviceContext = authenticationAdminStub.
+                    _getServiceClient().getLastOperationContext().getServiceContext();
+            // String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
+            String msg = "Log in client successfully logged in to the service: " + hostName;
+            if (log.isDebugEnabled()){
+                log.debug(msg);
+            }
+            if (!loginStatus) {
+                msg = "Login Checker failed for the service: " + hostName;
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, msg);
+                log.warn(msg);
+            }
+        } catch (AxisFault e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, e.getMessage());
+            String msg = "Failed to login; Inserting the stats in the db for the log in checker";
+            log.warn(msg, e);
+        } catch (Exception e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, e.getMessage());
+            String msg = "Exception in login; Inserting the stats in the db for the log in checker";
+            log.warn(msg, e);
+        }
+        return loginStatus;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ApplicationServerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ApplicationServerClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ApplicationServerClient.java
new file mode 100644
index 0000000..9472427
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ApplicationServerClient.java
@@ -0,0 +1,253 @@
+/*
+ *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.status.monitor.agent.clients.service;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.stratos.status.monitor.agent.clients.common.ServiceLoginClient;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.sql.SQLException;
+import java.text.ParseException;
+
+/**
+ * Status Monitor Agent client class for Application Server service
+ */
+public class ApplicationServerClient extends Thread {
+    private static int serviceID;
+    private static final Log log = LogFactory.getLog(ApplicationServerClient.class);
+    private static final AuthConfigBean authConfigBean =
+            StatusMonitorConfigurationBuilder.getAuthConfigBean();
+
+    private static OMElement createPayLoad() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace(StatusMonitorConstants.CARBON_OM_NAMESPACE, "ns1");
+        OMElement method = fac.createOMElement("echoString", omNs);
+        OMElement value = fac.createOMElement("s", omNs);
+        value.addChild(fac.createOMText(value, "Hello World"));
+        method.addChild(value);
+        return method;
+    }
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+//                LoadBalanceAgentClient.getLoadAverageFromInstances(StatusMonitorConstants.APPSERVER_HOST, serviceID);
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (IOException e) {
+                log.error(e);
+            } catch (SQLException e) {
+                log.error(e);
+            } catch (ParseException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    /**
+     * Executing the service
+     * @throws SQLException, exception in writing to the database
+     * @throws ParseException, parse exception
+     * @throws IOException, in initializing the service client
+     */
+    private static void executeService() throws SQLException, ParseException, IOException {
+        serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.APPSERVER);
+
+        OMElement result;
+        OMElement payload = createPayLoad();
+        ServiceClient serviceclient = new ServiceClient();
+        Options opts = new Options();
+
+        opts.setTo(new EndpointReference(StatusMonitorConstants.APPSERVER_HTTP +
+                StatusMonitorAgentConstants.TENANT_SERVICES + authConfigBean.getTenant() +
+                "/Axis2Service"));
+        opts.setAction(StatusMonitorConstants.CARBON_OM_NAMESPACE + "echoString");
+        opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
+
+
+        //check whether login success
+        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.APPSERVER_HOST, serviceID)) {
+            if (!webappTest()) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, "Webapp Invocation failed");
+                log.warn("WebApp invocation failed");
+
+            } else {
+                serviceclient.setOptions(opts);
+                try {
+                    result = serviceclient.sendReceive(payload);
+                    if (log.isDebugEnabled()) {
+                        log.debug(result);
+                    }
+                    if ((result.toString().indexOf("Hello World")) > 0) {
+                        if (pingPlatformTenant()) {
+//                            if (new JmeterTestClient().getAarUploadResults()) {
+//                                if (log.isDebugEnabled()) {
+//                                    log.debug("Jmeter aar upload Fail");
+//                                }
+//                                MySQLConnector.insertStats(serviceID, false);
+//                                MySQLConnector.insertState(serviceID, false, "UI: AAR upload test failed");
+//                            } else {
+                                MySQLConnector.insertStats(serviceID, true);
+                                MySQLConnector.insertState(serviceID, true, "");
+//                            }
+                        }
+                    } else {
+                        MySQLConnector.insertStats(serviceID, false);
+                        MySQLConnector.insertState(serviceID, false, " Service Invocation failed");
+                        log.warn("Service Invocation Failed");
+                    }
+
+                } catch (AxisFault e) {
+                    MySQLConnector.insertStats(serviceID, false);
+                    MySQLConnector.insertState(serviceID, false, e.getMessage());
+                    String msg = "Axis Fault in invoking the Appserver Client";
+                    log.warn(msg, e);
+                }
+                catch (NullPointerException e) {
+                    MySQLConnector.insertStats(serviceID, false);
+                    MySQLConnector.insertState(serviceID, false, e.getMessage());
+                    String msg = "Null Pointer Exception in invoking the Appserver client";
+                    log.warn(msg, e);
+                }
+            }
+        }
+    }
+
+    /**
+     * Pings the platform tenant
+     * @return true, if the ping was successful
+     * @throws IOException, in creating the service client
+     * @throws SQLException, in writing to the db.
+     * @throws ParseException, parse exception
+     */
+    private static Boolean pingPlatformTenant() throws IOException,
+            SQLException, ParseException {
+        Boolean pingPlatformTenantStatus = false;
+        OMElement result;
+        OMElement payload = createPayLoad();
+        ServiceClient serviceclient = new ServiceClient();
+        Options opts = new Options();
+
+        opts.setTo(new EndpointReference(StatusMonitorConstants.APPSERVER_HTTP +
+                StatusMonitorAgentConstants.TENANT_SERVICES +
+                StatusMonitorConfigurationBuilder.getSampleTenantConfigBean().getTenant() +
+                "/Axis2Service/"));
+        opts.setAction("http://service.carbon.wso2.org/echoString");
+        opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
+
+        serviceclient.setOptions(opts);
+        try {
+            result = serviceclient.sendReceive(payload);
+
+            if ((result.toString().indexOf("Hello World")) > 0) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Appserver test client - service invocation test passed");
+                }
+                pingPlatformTenantStatus = true;
+            } else {
+                String msg = "Ping to platform sample tenant domain failed";
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, msg);
+                log.warn(msg);
+            }
+
+        } catch (AxisFault e) {
+            MySQLConnector.insertStats(serviceID, false);
+            String msg = "Ping to platform sample tenant domain failed: ";
+            MySQLConnector.insertState(serviceID, false, msg + e.getMessage());
+            log.warn(msg, e);
+        }
+        catch (NullPointerException e) {
+            MySQLConnector.insertStats(serviceID, false);
+            String msg = "Ping to platform sample tenant domain failed: ";
+            MySQLConnector.insertState(serviceID, false, msg + e.getMessage());
+            log.warn(msg, e);
+        }
+        return pingPlatformTenantStatus;
+    }
+
+    /**
+     * Connects to the given web application.
+     * @return true, if successful
+     */
+    private static boolean webappTest() {
+        URL webAppURL;
+        BufferedReader in;
+        boolean webappStatus = false;
+
+        try {
+            webAppURL = new URL(StatusMonitorConstants.APPSERVER_HTTP + "/t/" +
+                    authConfigBean.getTenant() +
+                    "/webapps/SimpleServlet/simple-servlet");
+            URLConnection yc;
+            yc = webAppURL.openConnection();
+
+            in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
+
+            String inputLine;
+
+            while ((inputLine = in.readLine()) != null) {
+                if (log.isDebugEnabled()) {
+                    log.debug(inputLine);
+                }
+                if (inputLine.indexOf("Hello, World") > 1) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("True : " + inputLine.indexOf("Hello, World"));
+                    }
+                    webappStatus = true;
+                }
+            }
+            in.close();
+        } catch (IOException e) {
+            log.error(e);
+        }
+        return webappStatus;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BAMServerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BAMServerClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BAMServerClient.java
new file mode 100644
index 0000000..0ef70af
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BAMServerClient.java
@@ -0,0 +1,74 @@
+/*
+ *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.status.monitor.agent.clients.service;
+
+import org.apache.stratos.status.monitor.agent.clients.common.ServiceLoginClient;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.text.ParseException;
+
+/**
+ * Status Monitor Agent client class for Business Activity Monitor
+ */
+public class BAMServerClient extends Thread {
+
+    public static int serviceID;
+    private static final Log log = LogFactory.getLog(BAMServerClient.class);
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (IOException e) {
+                log.error(e);
+            } catch (SQLException e) {
+                log.error(e);
+            } catch (ParseException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    private static void executeService() throws SQLException, IOException, ParseException {
+        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.MONITOR);
+
+        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.MONITOR_HOST, serviceID)) {
+            MySQLConnector.insertStats(serviceID, true);
+            MySQLConnector.insertState(serviceID, true, "");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BPSServerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BPSServerClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BPSServerClient.java
new file mode 100644
index 0000000..787ab02
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BPSServerClient.java
@@ -0,0 +1,128 @@
+/*
+ *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.status.monitor.agent.clients.service;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.status.monitor.agent.clients.common.ServiceLoginClient;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.text.ParseException;
+
+/**
+ * Status Monitor Agent client class for Business Process Server
+ */
+public class BPSServerClient extends Thread{
+    private static final Log log = LogFactory.getLog(BPSServerClient.class);
+    private static final AuthConfigBean authConfigBean =
+            StatusMonitorConfigurationBuilder.getAuthConfigBean();
+
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (IOException e) {
+                log.error(e);
+            } catch (SQLException e) {
+                log.error(e);
+            } catch (ParseException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    private static OMElement createPayLoad() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace("http://ode/bpel/unit-test.wsdl", "ns1");
+        OMElement method = fac.createOMElement("hello", omNs);
+        OMElement value = fac.createOMElement("TestPart", null);
+        value.addChild(fac.createOMText(value, "Hello"));
+        method.addChild(value);
+        return method;
+    }
+
+    private static void executeService() throws IOException, SQLException, ParseException {
+
+        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.PROCESS);
+
+        OMElement result;
+        OMElement payload = createPayLoad();
+        ServiceClient serviceclient = new ServiceClient();
+        Options opts = new Options();
+        opts.setTo(new EndpointReference(StatusMonitorConstants.PROCESS_HTTP +
+                StatusMonitorAgentConstants.TENANT_SERVICES +
+                authConfigBean.getTenant() + "/HelloService"));
+        opts.setAction("http://ode/bpel/unit-test.wsdl/hello");
+
+        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.PROCESS_HOST, serviceID)) {
+            serviceclient.setOptions(opts);
+            try {
+                result = serviceclient.sendReceive(payload);
+                if(log.isDebugEnabled()){
+                    log.debug("Result of BPS: " + result);
+                }
+
+                if ((result.toString().indexOf("Hello World")) > 0) {
+                    MySQLConnector.insertStats(serviceID, true);
+                    MySQLConnector.insertState(serviceID, true, "");
+                } else {
+                    MySQLConnector.insertStats(serviceID, false);
+                    MySQLConnector.insertState(serviceID, false, "Service Invocation failed");
+                }
+
+            } catch (AxisFault e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                log.warn(e);
+            }
+            catch (NullPointerException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                log.warn(e);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BRSServerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BRSServerClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BRSServerClient.java
new file mode 100644
index 0000000..11ee7e1
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BRSServerClient.java
@@ -0,0 +1,138 @@
+/*
+ *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.status.monitor.agent.clients.service;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.stratos.status.monitor.agent.clients.common.ServiceLoginClient;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import java.io.IOException;
+import java.sql.SQLException;
+import java.text.ParseException;
+
+/**
+ * Status Monitor Agent client class for Business Rule Server
+ */
+public class BRSServerClient extends Thread {
+    private static final Log log = LogFactory.getLog(BRSServerClient.class);
+    private static final AuthConfigBean authConfigBean =
+            StatusMonitorConfigurationBuilder.getAuthConfigBean();
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (IOException e) {
+                log.error(e);
+            } catch (SQLException e) {
+                log.error(e);
+            } catch (ParseException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    private static OMElement createPayLoad() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace("http://brs.carbon.wso2.org", "ns1");
+        OMNamespace nameNs = fac.createOMNamespace("http://greeting.samples/xsd", "ns2");
+        OMElement method = fac.createOMElement("greetMe", omNs);
+        OMElement value = fac.createOMElement("User", omNs);
+        OMElement NameValue = fac.createOMElement("name", nameNs);
+        NameValue.addChild(fac.createOMText(NameValue, "QAuser"));
+        value.addChild(NameValue);
+        method.addChild(value);
+        if (log.isDebugEnabled()) {
+            log.debug("Method in createPayload(): " + method.toString());
+        }
+        return method;
+    }
+
+    private static void executeService() throws IOException, SQLException, ParseException {
+
+        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.RULE);
+
+        OMElement result;
+        OMElement payload = createPayLoad();
+        ServiceClient serviceclient = new ServiceClient();
+        Options opts = new Options();
+        opts.setTo(new EndpointReference(StatusMonitorConstants.RULE_HTTP +
+                StatusMonitorAgentConstants.TENANT_SERVICES +
+                authConfigBean.getTenant() + "/GreetingService"));
+        opts.setAction("http://brs.carbon.wso2.org/greetMe");
+
+        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.RULE_HOST, serviceID)) {
+            serviceclient.setOptions(opts);
+            try {
+                result = serviceclient.sendReceive(payload);
+                if (log.isDebugEnabled()) {
+                    log.debug("Result in BRSServerClient: " + result.toString());
+                }
+
+                if ((result.toString().indexOf("QAuser")) > 0) {
+                    MySQLConnector.insertStats(serviceID, true);
+                    MySQLConnector.insertState(serviceID, true, "");
+                } else {
+                    MySQLConnector.insertStats(serviceID, false);
+                    MySQLConnector.insertState(serviceID, false, "Service Invocation failed");
+                }
+
+            } catch (AxisFault e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "Fault when executing service: BRSServerClient: ";
+                log.warn(msg, e);
+            }
+            catch (NullPointerException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "NPE when executing service: BRSServerClient: ";
+                log.warn(msg, e);
+            }
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/CEPServerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/CEPServerClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/CEPServerClient.java
new file mode 100644
index 0000000..3b56307
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/CEPServerClient.java
@@ -0,0 +1,154 @@
+/*
+ *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.status.monitor.agent.clients.service;
+
+import org.apache.stratos.status.monitor.agent.clients.common.ServiceLoginClient;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSession;
+import javax.jms.TextMessage;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.sql.SQLException;
+import java.util.Properties;
+import javax.jms.QueueConnectionFactory;
+
+/**
+ * Status Monitor Agent client class for Complex Event Processing Server
+ */
+public class CEPServerClient extends Thread{
+    private static final Log log = LogFactory.getLog(CEPServerClient.class);
+    private static String tcpUserName;
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (SQLException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    private static void executeService() throws SQLException {
+        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.CEP);
+        AuthConfigBean authConfigBean = StatusMonitorConfigurationBuilder.getAuthConfigBean();
+
+        String userName = authConfigBean.getUserName();
+        tcpUserName = userName.replace('@','!');
+
+
+        //check whether login success
+        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.CEP_HOST, serviceID)) {
+
+
+            Properties properties = new Properties();
+            properties.put(Context.INITIAL_CONTEXT_FACTORY, StatusMonitorAgentConstants.QPID_ICF);
+            properties.put(StatusMonitorAgentConstants.CF_NAME_PREFIX +
+                    StatusMonitorAgentConstants.CF_NAME,
+                    getTCPConnectionURL(tcpUserName,
+                            authConfigBean.getPassword()));
+
+            InitialContext ctx;
+            try {
+                ctx = new InitialContext(properties);
+
+                // Lookup connection factory
+                QueueConnectionFactory connFactory =
+                        (QueueConnectionFactory) ctx.lookup(StatusMonitorAgentConstants.CF_NAME);
+                QueueConnection queueConnection = connFactory.createQueueConnection();
+                queueConnection.start();
+                QueueSession queueSession =
+                        queueConnection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+
+                // Send message
+                Queue queue = queueSession.createQueue(StatusMonitorAgentConstants.QUEUE_NAME_CEP +
+                        ";{create:always, node:{durable: True}}");
+
+                // create the message to send
+                TextMessage textMessage = queueSession.createTextMessage("Test Message Hello");
+                javax.jms.QueueSender queueSender = queueSession.createSender(queue);
+                queueSender.setTimeToLive(100000000);
+
+                QueueReceiver queueReceiver = queueSession.createReceiver(queue);
+                queueSender.send(textMessage);
+
+                TextMessage message = (TextMessage) queueReceiver.receiveNoWait();
+                if (log.isDebugEnabled()) {
+                    log.debug("Message in the execute() of CEPServer Client: " + message.getText());
+                }
+                if (message.getText().equals("Test Message Hello")) {
+                    MySQLConnector.insertStats(serviceID, true);
+                    MySQLConnector.insertState(serviceID, true, "");
+                } else {
+                    MySQLConnector.insertStats(serviceID, false);
+                    MySQLConnector.insertState(serviceID, false, "Send or retrieve messages failed");
+                }
+                queueSender.close();
+                queueSession.close();
+                queueConnection.close();
+
+            } catch (JMSException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "JMS Exception in inserting stats into the DB for the CEPServerClient";
+                log.warn(msg, e);
+            } catch (NamingException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "Naming Exception in inserting stats into the DB for the CEPServerClient";
+                log.warn(msg, e);
+            }
+        }
+    }
+
+    private static String getTCPConnectionURL(String username, String password) {
+        return new StringBuffer()
+                .append("amqp://").append(tcpUserName).append(":").append(password).append("@").
+                        append(StatusMonitorAgentConstants.CARBON_CLIENT_ID).append("/").
+                        append(StatusMonitorAgentConstants.CARBON_VIRTUAL_HOST_NAME).
+                        append("?brokerlist='tcp://").append(StatusMonitorConstants.CEP_HOST).
+                        append(":").append(StatusMonitorAgentConstants.CEP_DEFAULT_PORT).
+                        append("'").toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/DataServerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/DataServerClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/DataServerClient.java
new file mode 100644
index 0000000..580d6fb
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/DataServerClient.java
@@ -0,0 +1,190 @@
+/*
+ * 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.status.monitor.agent.clients.service;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.util.AXIOMUtil;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.stratos.status.monitor.agent.clients.common.ServiceLoginClient;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.beans.SampleTenantConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.text.ParseException;
+
+/**
+ * Status Monitor Agent client class for Data
+ */
+public class DataServerClient extends Thread{
+    private static final Log log = LogFactory.getLog(DataServerClient.class);
+    private static final AuthConfigBean authConfigBean =
+            StatusMonitorConfigurationBuilder.getAuthConfigBean();
+    private static final SampleTenantConfigBean sampleTenantConfigBean =
+            StatusMonitorConfigurationBuilder.getSampleTenantConfigBean();
+
+    private static OMElement createPayLoad() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice", "ns1");
+        return fac.createOMElement("getCustomers", omNs);
+    }
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (IOException e) {
+                log.error(e);
+            } catch (SQLException e) {
+                log.error(e);
+            } catch (ParseException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    private static void executeService() throws IOException, SQLException, ParseException {
+        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.DATA);
+
+        OMElement result;
+        OMElement payload = createPayLoad();
+        ServiceClient serviceclient = new ServiceClient();
+        Options opts = new Options();
+        opts.setTo(new EndpointReference(StatusMonitorConstants.DATA_HTTP +
+                StatusMonitorAgentConstants.TENANT_SERVICES +
+                 authConfigBean.getTenant() + "/GSpreadSample"));
+        opts.setAction("http://ws.wso2.org/dataservice/getCustomers");
+
+        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.DATA_HOST, serviceID)) {
+            serviceclient.setOptions(opts);
+            try {
+                result = serviceclient.sendReceive(payload);
+                if (log.isDebugEnabled()) {
+                    log.debug(result);
+                }
+
+                if ((result.toString().indexOf("Signal Gift Stores")) > 0) {
+                    executeShoppingCartDSPlatformSample();
+
+                } else {
+                    MySQLConnector.insertStats(serviceID, false);
+                    MySQLConnector.insertState(serviceID, false, "Service Invocation failed");
+                }
+
+            } catch (AxisFault e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "Error in executing service for DSS Server client";
+                log.warn(msg, e);
+            }
+            catch (NullPointerException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "NPE in executing the service for DSS client";
+                log.warn(msg, e);
+            }
+        }
+    }
+
+    private static boolean executeShoppingCartDSPlatformSample() throws IOException, SQLException, ParseException {
+        Boolean sampleStatus = false;
+        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.DATA);
+        String payload = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
+                "   <soapenv:Header/>\n" +
+                "   <soapenv:Body/>\n" +
+                "</soapenv:Envelope>";
+        String action = "getAllCategories";
+
+        try {
+            OMElement result;
+            result = sendRequest(payload, action, new EndpointReference(
+                    StatusMonitorConstants.DATA_HTTP + StatusMonitorAgentConstants.TENANT_SERVICES +
+                            sampleTenantConfigBean.getTenant() + "/ShoppingCartDS"));
+
+            if ((result.toString().indexOf("Compact Lens-Shutter Cameras")) > 0) {
+                sampleStatus = true;
+                MySQLConnector.insertStats(serviceID, true);
+                MySQLConnector.insertState(serviceID, true, "");
+            } else {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, "Platform sample ShoppingCartDS invocation failed");
+            }
+        } catch (AxisFault e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, "Platform sample ShoppingCartDS: " + e.getMessage());
+            String msg = "Fault in executing the Shopping cart sample";
+            log.warn(msg, e);
+        }
+        catch (NullPointerException e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, "Platform sample ShoppingCartDS: " + e.getMessage());
+            String msg = "NPE in executing the shopping cart sample";
+            log.warn(msg, e);
+        } catch (XMLStreamException e) {
+            String msg = "XMLStreamException in executing the shopping cart sample";
+            log.warn(msg, e);
+        }
+        return sampleStatus;
+    }
+
+    private static OMElement sendRequest(String payloadStr, String action, EndpointReference targetEPR)
+            throws XMLStreamException, AxisFault {
+        OMElement payload = AXIOMUtil.stringToOM(payloadStr);
+        Options options = new Options();
+        options.setTo(targetEPR);
+        options.setAction("urn:" + action); //since soapAction = ""
+
+        //Blocking invocation
+        ServiceClient sender = new ServiceClient();
+        sender.setOptions(options);
+        if (log.isDebugEnabled()){
+            log.debug("Request: " + payload.toString());
+        }
+        OMElement result = sender.sendReceive(payload);
+        if (log.isDebugEnabled()){
+            log.debug("Response: "+ payload.toString());
+        }
+        return result;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ESBServerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ESBServerClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ESBServerClient.java
new file mode 100644
index 0000000..0cd7b86
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ESBServerClient.java
@@ -0,0 +1,244 @@
+/*
+ * 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.status.monitor.agent.clients.service;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.util.AXIOMUtil;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.stratos.status.monitor.agent.clients.common.ServiceLoginClient;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.beans.SampleTenantConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.text.ParseException;
+
+/**
+ * Status Monitor Agent client class for ESB
+ */
+public class ESBServerClient extends Thread{
+
+    private static final Log log = LogFactory.getLog(ESBServerClient.class);
+    private static final AuthConfigBean authConfigBean =
+            StatusMonitorConfigurationBuilder.getAuthConfigBean();
+    private static final SampleTenantConfigBean sampleTenantConfigBean =
+            StatusMonitorConfigurationBuilder.getSampleTenantConfigBean();
+
+    private static int serviceID;
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (IOException e) {
+                log.error(e);
+            } catch (SQLException e) {
+                log.error(e);
+            } catch (ParseException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    private static OMElement createPayLoad() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace("http://service.carbon.wso2.org", "ns1");
+        OMElement method = fac.createOMElement("echoString", omNs);
+        OMElement value = fac.createOMElement("s", omNs);
+        value.addChild(fac.createOMText(value, "Hello World"));
+
+        method.addChild(value);
+        return method;
+    }
+
+    private static void executeService() throws IOException, SQLException, ParseException {
+
+        OMElement result = null;
+        OMElement payload = createPayLoad();
+        ServiceClient serviceclient = new ServiceClient();
+        Options opts = new Options();
+        opts.setTo(new EndpointReference(StatusMonitorConstants.ESB_HTTP + ":" +
+                StatusMonitorConstants.ESB_NHTTP_PORT +
+                StatusMonitorAgentConstants.TENANT_SERVICES +
+                authConfigBean.getTenant() + "/DemoProxy"));
+        opts.setAction("http://service.carbon.wso2.org/echoString");
+        serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.ESB);
+
+        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.ESB_HOST, serviceID)) {
+            serviceclient.setOptions(opts);
+            try {
+                result = serviceclient.sendReceive(payload);
+
+                if ((result.toString().indexOf("Hello World")) > 0) {
+                    executeProductPlatformSample();
+                } else {
+                    MySQLConnector.insertStats(serviceID, false);
+                    MySQLConnector.insertState(serviceID, false, "Service Invocation failed");
+                }
+
+            } catch (AxisFault e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "Error in executing service";
+                log.error(msg, e);
+            }
+            catch (NullPointerException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "NPE in executing the service";
+                log.error(msg, e);
+            }
+        }
+    }
+
+
+    private static boolean executeProductPlatformSample() throws IOException, SQLException, ParseException {
+        Boolean sampleStatus = false;
+        String payload = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
+                "   <soapenv:Header/>\n" +
+                "   <soapenv:Body/>\n" +
+                "</soapenv:Envelope>";
+        String action = "getAllCategories";
+
+        try {
+            OMElement result = null;
+            result = sendRequest(payload, action, new EndpointReference(
+                    StatusMonitorConstants.ESB_HTTP + ":" + StatusMonitorConstants.ESB_NHTTP_PORT +
+                            StatusMonitorAgentConstants.TENANT_SERVICES +
+                            sampleTenantConfigBean.getTenant() +
+                            "/ProductService"));
+
+            if ((result.toString().indexOf("Compact Lens-Shutter Cameras")) > 0) {
+                executeAdminServicePlatformSample();
+                sampleStatus = true;
+            } else {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, "Platform sample ProductService invocation failed");
+            }
+
+        } catch (AxisFault e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, "Platform sample: " + e.getMessage());
+            String msg = "Error in executing the product platform sample";
+            log.error(msg, e);
+        }
+        catch (NullPointerException e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, "Platform sample: " + e.getMessage());
+            String msg = "NPE in executing the product platform sample";
+            log.error(msg, e);
+        } catch (XMLStreamException e) {
+            String msg = "XMLStream exception in executing the product platform sample";
+            log.error(msg, e);
+        }
+        return sampleStatus;
+    }
+
+    private static boolean executeAdminServicePlatformSample() throws IOException, SQLException, ParseException {
+        Boolean sampleStatus = false;
+        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.ESB);
+        String payload = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
+                "   <soapenv:Header/>\n" +
+                "   <soapenv:Body/>\n" +
+                "</soapenv:Envelope>";
+        String action = "getAllCategories";
+
+        try {
+            OMElement result;
+            result = sendRequest(payload, action, new EndpointReference(
+                    StatusMonitorConstants.ESB_HTTP + ":" + StatusMonitorConstants.ESB_NHTTP_PORT +
+                            StatusMonitorAgentConstants.TENANT_SERVICES +
+                            sampleTenantConfigBean.getTenant() +
+                            "/AdminService"));
+
+            if ((result.toString().indexOf("Compact Lens-Shutter Cameras")) > 0) {
+                sampleStatus = true;
+                MySQLConnector.insertStats(serviceID, true);
+                MySQLConnector.insertState(serviceID, true, "");
+            } else {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, "Platform sample AdminService invocation failed");
+            }
+
+        } catch (AxisFault e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState( serviceID, false, "Platform sample AdminService: " + e.getMessage());
+            String msg = "Executing Admin Service Platform Sample failed";
+            log.error(msg, e);
+        }
+        catch (NullPointerException e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, "Platform sample AdminService: " + e.getMessage());
+            String msg = "NPE in executing the admin service platform sample";
+            log.error(msg, e);
+        } catch (XMLStreamException e) {
+            String msg = "XMLStreamException in executing the admin service platform sample";
+            log.error(msg, e);
+        }
+
+        return sampleStatus;
+    }
+
+    private static OMElement sendRequest(String payloadStr, String action, EndpointReference targetEPR)
+            throws XMLStreamException, AxisFault {
+        OMElement payload = AXIOMUtil.stringToOM(payloadStr);
+        Options options = new Options();
+        options.setTo(targetEPR);
+        options.setAction("urn:" + action); //since soapAction = ""
+
+        //Blocking invocation
+        ServiceClient sender = new ServiceClient();
+        sender.setOptions(options);
+        if (log.isDebugEnabled()) {
+            log.debug("Request: "+ payload.toString());
+        }
+        OMElement result = sender.sendReceive(payload);
+        if (log.isDebugEnabled()) {
+            log.debug("Response:" + payload.toString());
+        }
+
+        return result;
+    }
+}


[5/7] Applying 0001-Refactor-status-monitor-module.patch

Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/constants/StatusMonitorConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/constants/StatusMonitorConstants.java b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/constants/StatusMonitorConstants.java
new file mode 100644
index 0000000..ff54b72
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/constants/StatusMonitorConstants.java
@@ -0,0 +1,152 @@
+/*
+ * 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.status.monitor.core.constants;
+
+/**
+ * Constants common to the stratos status monitor
+ */
+public class StatusMonitorConstants {
+
+    /*Status Monitor Configuration File*/
+    public static final String STATUS_MONITOR_CONFIG = "status-monitor-config.xml";
+    public static final String CONFIG_NS = "http://wso2.com/carbon/status/monitor/config";
+
+    /*Authentication Configurations*/
+    public static final String AUTH_CONFIG = "authConfig";
+    public static final String JKS_LOCATION = "jksLocation";
+    public static final String AUTHCONFIG_USER_NAME = "userName";
+    public static final String AUTHCONFIG_PASSWORD = "password";
+    public static final String AUTHCONFIG_TENANT = "tenantDomain";
+
+    /*The tenant with the service samples*/
+    public static final String PS_CONFIG = "platformSample";
+    public static final String PSCONFIG_TENANT = "tenantDomain";
+
+    /*Database configurations*/
+    public static final String DB_CONFIG = "dbConfig";
+    public static final String NS_PREFIX = "";
+    public static final String DBCONFIG_VALIDATION_QUERY = "validationQuery";
+    public static final String DBCONFIG_MAX_WAIT = "maxWait";
+    public static final String DBCONFIG_MIN_IDLE = "minIdle";
+    public static final String DBCONFIG_MAX_ACTIVE = "maxActive";
+    public static final String DBCONFIG_DRIVER_NAME = "driverName";
+    public static final String DBCONFIG_PASSWORD = "password";
+    public static final String DBCONFIG_USER_NAME = "userName";
+    public static final String DBCONFIG_URL = "url";
+
+    public static final long HOUR_IN_MILLIS = 3600000;
+
+    /*Services List*/
+    public static final String MANAGER = "StratosLive Manager";
+    public static final String ESB = "StratosLive Enterprise Service Bus";
+    public static final String APPSERVER = "StratosLive Application Server";
+    public static final String DATA = "StratosLive Data Services Server";
+    public static final String GOVERNANCE = "StratosLive Governance Registry";
+    public static final String IDENTITY = "StratosLive Identity Server";
+    public static final String MONITOR = "StratosLive Business Activity Monitor";
+    public static final String PROCESS = "StratosLive Business Process Server";
+    public static final String RULE = "StratosLive Business Rules Server";
+    public static final String MASHUP = "StratosLive Mashup Server";
+    public static final String GADGET = "StratosLive Gadget Server";
+    public static final String CEP = "StratosLive Complex Event Processing Server";
+    public static final String MESSAGING = "StratosLive Message Broker";
+
+    public static final String CARBON_OM_NAMESPACE = "http://service.carbon.wso2.org";
+
+    /*Hosts list*/
+    public static final String APPSERVER_HOST = "appserver.stratoslive.wso2.com";
+    public static final String APPSERVER_HTTP = "http://appserver.stratoslive.wso2.com";
+    public static final String MONITOR_HOST = "monitor.stratoslive.wso2.com";
+
+    public static final String MESSAGING_HOST = "messaging.stratoslive.wso2.com";
+    public static final String MESSAGING_DEFAULT_PORT = "5675";
+
+    public static final String MASHUP_HOST = "mashup.stratoslive.wso2.com";
+    public static final String MASHUP_HTTP = "http://mashup.stratoslive.wso2.com";
+
+    public static final String PROCESS_HOST = "process.stratoslive.wso2.com";
+    public static final String PROCESS_HTTP = "http://process.stratoslive.wso2.com";
+
+    public static final String RULE_HOST = "rule.stratoslive.wso2.com";
+    public static final String RULE_HTTP = "http://rule.stratoslive.wso2.com";
+
+    public static final String CEP_HOST = "cep.stratoslive.wso2.com";
+
+    public static final String ESB_HOST = "esb.stratoslive.wso2.com";
+    public static final String ESB_HTTP = "http://esb.stratoslive.wso2.com";
+    public static final String ESB_NHTTP_PORT = "8280";
+
+    public static final String GOVERNANCE_HOST = "governance.stratoslive.wso2.com";
+    public static final String GOVERNANCE_HTTP = "http://governance.stratoslive.wso2.com";
+
+    public static final String GADGETS_HOST = "gadget.stratoslive.wso2.com";
+    public static final String GADGETS_HTTP = "http://gadget.stratoslive.wso2.com";
+
+    public static final String DATA_HOST = "data.stratoslive.wso2.com";
+    public static final String DATA_HTTP = "http://data.stratoslive.wso2.com";
+
+    public static final String IDENTITY_HOST = "identity.stratoslive.wso2.com";
+    public static final String IDENTITY_HTTPS = "https://identity.stratoslive.wso2.com";
+
+    public static final String MANAGER_HOST = "stratoslive.wso2.com";
+    public static final String MANAGER_HTTPS = "https://stratoslive.wso2.com";
+
+    public static final long SLEEP_TIME = 15 * 60 * 1000;
+
+
+    /*SQL Statements - Status Monitor Core and Common*/
+    public static final String GET_SERVICE_ID_SQL_WSL_NAME_LIKE_SQL =
+            "SELECT WSL_ID FROM WSL_SERVICE WHERE WSL_NAME LIKE ";
+    public static final String GET_SERVICE_STATE_ID_SQL =
+            "SELECT WSL_ID FROM WSL_SERVICE_STATE WHERE WSL_SERVICE_ID = ";
+    public static final String ID = "WSL_ID";
+    public static final String STATE_ID = "WSL_STATE_ID";
+    public static final String TIMESTAMP = "WSL_TIMESTAMP";
+    public static final String NAME = "WSL_NAME";
+    public static final String ORDER_BY_TIMESTAMP_SQL = " ORDER BY WSL_TIMESTAMP DESC LIMIT 1";
+    public static final String ORDER_BY_TIMESTAMP_SQL_DESC_LIMIT_01_SQL =
+            " ORDER BY WSL_TIMESTAMP DESC LIMIT 0,1";
+    public static final String SELECT_ALL_FROM_WSL_SERVICE_STATE_SQL =
+            "SELECT * FROM  WSL_SERVICE_STATE WHERE WSL_SERVICE_ID =";
+
+    /*SQL Statements - Status Monitor Back End*/
+    public static final String GET_STATE_NAME_SQL = "SELECT WSL_NAME FROM WSL_STATE";
+    public static final String GET_SERVICE_NAME_SQL = "SELECT WSL_NAME FROM WSL_SERVICE";
+    public static final String GET_ALL_STATE_DETAIL_SQL = "select s.WSL_NAME, ss.WSL_TIMESTAMP, " +
+            "ssd.WSL_DETAIL, ssd.WSL_TIMESTAMP " +
+            "from WSL_SERVICE as s, WSL_SERVICE_STATE as ss, WSL_SERVICE_STATE_DETAIL as " +
+            "ssd where s.WSL_ID = ss.WSL_SERVICE_ID AND ss.WSL_ID = ssd.WSL_SERVICE_STATE_ID " +
+            "AND (ss.WSL_STATE_ID=2 OR ss.WSL_STATE_ID=3) order by ss.WSL_TIMESTAMP DESC";
+    public static final String SERVICE_WSL_NAME = "s.WSL_NAME";
+    public static final String SERVICE_STATE_WSL_TIMESTAMP = "ss.WSL_TIMESTAMP";
+    public static final String SERVICE_STATE_DETAIL_WSL_TIMESTAMP = "ssd.WSL_TIMESTAMP";
+    public static final String SERVICE_STATE_DETAIL = "ssd.WSL_DETAIL";
+    public static final String GET_SERVICE_STATE_SQL =
+            "SELECT * FROM WSL_SERVICE_STATE WHERE WSL_SERVICE_ID=";
+
+    /*SQL statements - Status Monitor Agent*/
+    public static final String INSERT_STAT_SQL = "INSERT INTO WSL_SERVICE_HEARTBEAT VALUES (?,?,?,?)";
+    public static final String INSERT_STATE_SQL = "INSERT INTO WSL_SERVICE_STATE VALUES (?,?,?,?)";
+    public static final String UPDATE_STATE_SQL =
+            "UPDATE WSL_SERVICE_STATE SET WSL_STATE_ID=? WHERE WSL_ID= ?";
+    public static final String INSERT_STATE_DETAIL_SQL =
+            "INSERT INTO WSL_SERVICE_STATE_DETAIL VALUES (?,?,?,?)";
+
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/exception/StatusMonitorException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/exception/StatusMonitorException.java b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/exception/StatusMonitorException.java
new file mode 100644
index 0000000..1a1958a
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/exception/StatusMonitorException.java
@@ -0,0 +1,33 @@
+/*
+ * 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.status.monitor.core.exception;
+
+/**
+ * StatusMonitor specific exceptions
+ */
+public class StatusMonitorException extends Exception{
+
+    public StatusMonitorException(String msg, Exception e) {
+        super(msg, e);
+    }
+
+    public StatusMonitorException(String msg) {
+        super(msg);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/internal/StatusMonitorCoreComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/internal/StatusMonitorCoreComponent.java b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/internal/StatusMonitorCoreComponent.java
new file mode 100644
index 0000000..1aa0d74
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/internal/StatusMonitorCoreComponent.java
@@ -0,0 +1,92 @@
+/*
+ * 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.status.monitor.core.internal;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.stratos.status.monitor.core.util.StatusMonitorUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+import org.wso2.carbon.utils.ConfigurationContextService;
+
+/**
+ * @scr.component name="org.wso2.carbon.status.monitor" immediate="true"
+ * @scr.reference name="configuration.context.service"
+ *                interface="org.wso2.carbon.utils.ConfigurationContextService"
+ *                cardinality="1..1" policy="dynamic"
+ *                bind="setConfigurationContextService"
+ *                unbind="unsetConfigurationContextService"
+ */
+public class StatusMonitorCoreComponent {
+    private static Log log = LogFactory.getLog(
+            StatusMonitorCoreComponent.class);
+
+    private static BundleContext bundleContext;
+    private static ConfigurationContextService configurationContextService;
+
+    protected void activate(ComponentContext context) {
+        try {
+            bundleContext = context.getBundleContext();
+            if (StatusMonitorUtil.getStatusMonitorConfiguration() == null) {
+                StatusMonitorUtil.initStatusMonitor(context.getBundleContext());
+                if (log.isDebugEnabled()) {
+                    log.debug("Status Monitor Agent initialized");
+                }
+            }
+            if (log.isDebugEnabled()) {
+                log.debug("******* Status Monitor core bundle is activated ******* ");
+            }
+        } catch (Exception e) {
+            log.error("******* Status Monitor Core bundle failed activating ****", e);
+        }
+    }
+
+    protected void deactivate(ComponentContext context) {
+        log.debug("******* Status Monitor core bundle is deactivated ******* ");
+    }
+
+    protected void setConfigurationContextService(
+            ConfigurationContextService configurationContextService) {
+        log.debug("Receiving ConfigurationContext Service");
+        StatusMonitorCoreComponent.
+                configurationContextService = configurationContextService;
+    }
+
+    protected void unsetConfigurationContextService(
+            ConfigurationContextService configurationContextService) {
+        log.debug("Unsetting ConfigurationContext Service");
+        setConfigurationContextService(null);
+    }
+
+    public static BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    public static ConfigurationContextService getConfigurationContextService() {
+        return configurationContextService;
+    }
+
+    public static ConfigurationContext getConfigurationContext() {
+        if (configurationContextService.getServerConfigContext() == null) {
+            return null;
+        }
+        return configurationContextService.getServerConfigContext();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/jdbc/MySQLConnectionInitializer.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/jdbc/MySQLConnectionInitializer.java b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/jdbc/MySQLConnectionInitializer.java
new file mode 100644
index 0000000..dd13232
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/jdbc/MySQLConnectionInitializer.java
@@ -0,0 +1,247 @@
+/*
+ * 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.status.monitor.core.jdbc;
+
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.commons.dbcp.BasicDataSource;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * The class connecting with the mysql database
+ */
+public class MySQLConnectionInitializer {
+    private static Connection conn = null;
+    private static BasicDataSource dataSource;
+    private static final Log log = LogFactory.getLog(StatusMonitorConfigurationBuilder.class);
+
+    private static List<String> serviceList = new ArrayList<String>();
+    private static List<String> statusList = new ArrayList<String>();
+
+    /**
+     * gets a copy of services list
+     *
+     * @return an unmodifiable list.
+     */
+    public static List<String> getServiceList() {
+        return Collections.unmodifiableList(serviceList);
+    }
+
+    /**
+     * gets a copy of statuses list
+     *
+     * @return an unmodifiable list.
+     */
+    public static List<String> getStatusList() {
+        return Collections.unmodifiableList(statusList);
+    }
+
+    /**
+     * gets the sql connection and initializes the MySQLConnectionInitializer.
+     *
+     * @return Static Connection
+     * @throws Exception, throws exception       MySQLConnectionInitializer
+     */
+    public static Connection initialize() throws Exception {
+        //gets the data source from the configuration builder.
+        dataSource = StatusMonitorConfigurationBuilder.getDataSource();
+
+        //gets the sql connection.
+        getConnection();
+
+        //initializes the service and state lists.
+        serviceList = getServiceNamesList();
+        statusList = getStateNameList();
+
+        if (log.isDebugEnabled()) {
+            log.debug("Successfully initialized the mysql connection");
+        }
+        return conn;
+    }
+
+    /**
+     * Gets the SQL Connection to the status monitor database
+     *
+     * @return a Connection object
+     * @throws Exception, if getting the connection failed.
+     */
+    private static Connection getConnection() throws Exception {
+        try {
+            String userName = dataSource.getUsername(); //monitor
+            String password = dataSource.getPassword();   //monitor
+            String url = dataSource.getUrl(); //jdbc:mysql://localhost:3306/stratos_status
+            String driverName = dataSource.getDriverClassName();
+
+            Class.forName(driverName).newInstance();
+            conn = DriverManager.getConnection(url, userName, password);
+
+            if (conn != null) {
+                if (log.isDebugEnabled()) {
+                    log.debug("Connection Successful");
+                }
+            }
+        } catch (SQLException e) {
+            String msg = "SQL connection to the health monitor database instance failed";
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        } catch (Exception e) {
+            String msg = "Connection to the health monitor database instance failed";
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+        return conn;
+    }
+
+    /**
+     * Gets the list of available services
+     *
+     * @return List of services
+     * @throws SQLException, if getting the service name failed.
+     */
+    private static List<String> getServiceNamesList() throws SQLException {
+        List<String> serviceList = new ArrayList<String>();
+        ResultSet rs;
+        Statement stmtCon = conn.createStatement();
+        String sql = StatusMonitorConstants.GET_SERVICE_NAME_SQL;
+
+        stmtCon.executeQuery(sql);
+        rs = stmtCon.getResultSet();
+        String serviceName;
+        try {
+            while (rs.next()) {
+                serviceName = rs.getString(StatusMonitorConstants.NAME);
+                serviceList.add(serviceName);
+            }
+        } catch (SQLException e) {
+            String msg = "Getting the service name list failed";
+            log.error(msg, e);
+            throw new SQLException(msg, e);
+        } finally {
+            rs.close();
+            stmtCon.close();
+        }
+        return serviceList;
+    }
+
+    /**
+     * Gets state name with the given state id
+     *
+     * @return state name
+     *         {Up & Running, Broken, Down, Fixed. }
+     * @throws java.sql.SQLException, if the retrieval of the list of states failed.
+     */
+    private static List<String> getStateNameList() throws SQLException {
+        List<String> stateList = new ArrayList<String>();
+        ResultSet rs;
+        Statement stmtCon = conn.createStatement();
+        String sql = StatusMonitorConstants.GET_STATE_NAME_SQL;
+
+        stmtCon.executeQuery(sql);
+        rs = stmtCon.getResultSet();
+        String stateName;
+        try {
+            while (rs.next()) {
+                stateName = rs.getString(StatusMonitorConstants.NAME);
+                stateList.add(stateName);
+            }
+        } catch (SQLException e) {
+            String msg = "Getting the serviceID failed";
+            log.error(msg, e);
+            throw new SQLException(msg, e);
+        } finally {
+            rs.close();
+            stmtCon.close();
+        }
+        return stateList;
+    }
+
+    /**
+     * Gets the ServiceID, for the given product.
+     *
+     * @param product, name of the service/product
+     * @return serviceID: int
+     * @throws SQLException, if retrieving the service id failed.
+     */
+    public static int getServiceID(String product) throws SQLException {
+        Statement stmtCon = conn.createStatement();
+        String sql = StatusMonitorConstants.GET_SERVICE_ID_SQL_WSL_NAME_LIKE_SQL + "\"" + product + "\"";
+        int serviceId = 0;
+        ResultSet rs = stmtCon.getResultSet();
+
+        try {
+            stmtCon.executeQuery(sql);
+            while (rs.next()) {
+                serviceId = rs.getInt(StatusMonitorConstants.ID);
+            }
+        } catch (SQLException e) {
+            String msg = "Getting the serviceID failed";
+            log.error(msg, e);
+            throw new SQLException(msg, e);
+        } finally {
+            rs.close();
+            stmtCon.close();
+        }
+        return serviceId;
+    }
+
+    /**
+     * Gets the ServiceStateID, for the given product/service.
+     *
+     * @param serviceID: int; ID of the service/product
+     * @return serviceStateID: int
+     * @throws SQLException, if retrieving the service id failed.
+     */
+    public static int getServiceStateID(int serviceID) throws SQLException {
+        ResultSet rs;
+        Statement stmtCon = conn.createStatement();
+        String sql = StatusMonitorConstants.GET_SERVICE_STATE_ID_SQL + serviceID +
+                StatusMonitorConstants.ORDER_BY_TIMESTAMP_SQL;
+
+        stmtCon.executeQuery(sql);
+        rs = stmtCon.getResultSet();
+        int stateID = 0;
+        try {
+            while (rs.next()) {
+                stateID = rs.getInt(StatusMonitorConstants.ID);
+            }
+        } catch (SQLException e) {
+            String msg = "Getting the service state ID failed";
+            log.error(msg, e);
+            throw new SQLException(msg, e);
+        } finally {
+            rs.close();
+            stmtCon.close();
+        }
+        return stateID;
+    }
+}
+
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/util/StatusMonitorUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/util/StatusMonitorUtil.java b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/util/StatusMonitorUtil.java
new file mode 100644
index 0000000..9d70386
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/util/StatusMonitorUtil.java
@@ -0,0 +1,72 @@
+/*
+ * 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.status.monitor.core.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.framework.BundleContext;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.exception.StatusMonitorException;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+import org.wso2.carbon.utils.CarbonUtils;
+
+import java.io.File;
+
+/**
+ * Utility methods for Status monitor core.
+ */
+public class StatusMonitorUtil {
+
+    private static final Log log =
+            LogFactory.getLog(StatusMonitorUtil.class);
+    private static StatusMonitorConfigurationBuilder statusMonitorConfiguration;
+
+    public static StatusMonitorConfigurationBuilder getStatusMonitorConfiguration() {
+        return statusMonitorConfiguration;
+    }
+
+    /**
+     * load the configuration for the status monitoring
+     * @param bundleContext, BundleContext
+     * @throws org.apache.stratos.status.monitor.core.exception.StatusMonitorException,
+     * if the status monitoring failed.
+     */
+    public static void initStatusMonitor(
+            BundleContext bundleContext) throws StatusMonitorException {
+        String configFile =
+                CarbonUtils.getCarbonConfigDirPath() + File.separator +
+                        StatusMonitorConstants.STATUS_MONITOR_CONFIG;
+        try {
+            statusMonitorConfiguration = new StatusMonitorConfigurationBuilder(configFile);
+        } catch (Exception e) {
+            String msg = "The Status Monitor Configuration file not found";
+            log.error(msg, e);
+            throw new StatusMonitorException (msg, e);
+        }
+        try {
+            MySQLConnectionInitializer.initialize();
+        } catch (Exception e) {
+            String msg = "Error in initializing the mysql connection for the health monitoring";
+            log.error(msg, e);
+            throw new StatusMonitorException (msg, e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.core/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.core/src/main/resources/META-INF/component.xml b/components/org.apache.stratos.status.monitor.core/src/main/resources/META-INF/component.xml
new file mode 100755
index 0000000..e396e5b
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.core/src/main/resources/META-INF/component.xml
@@ -0,0 +1,44 @@
+<?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.
+  -->
+
+<component xmlns="http://products.wso2.org/carbon">
+    <ManagementPermissions>
+        <ManagementPermission>
+            <DisplayName>Manage</DisplayName>
+            <ResourceId>/permission/protected/manage</ResourceId>
+        </ManagementPermission>
+        <ManagementPermission>
+            <DisplayName>Monitor</DisplayName>
+            <ResourceId>/permission/protected/manage/monitor</ResourceId>
+        </ManagementPermission>
+        <ManagementPermission>
+            <DisplayName>Tenants</DisplayName>
+            <ResourceId>/permission/protected/manage/monitor/tenants</ResourceId>
+        </ManagementPermission>
+        <ManagementPermission>
+            <DisplayName>Modify</DisplayName>
+            <ResourceId>/permission/protected/manage/modify</ResourceId>
+        </ManagementPermission>
+        <ManagementPermission>
+            <DisplayName>Tenants</DisplayName>
+            <ResourceId>/permission/protected/manage/modify/tenants</ResourceId>
+        </ManagementPermission>
+   </ManagementPermissions>
+</component>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.core/src/main/resources/database/wso2_slive_status.sql
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.core/src/main/resources/database/wso2_slive_status.sql b/components/org.apache.stratos.status.monitor.core/src/main/resources/database/wso2_slive_status.sql
new file mode 100644
index 0000000..65a93cb
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.core/src/main/resources/database/wso2_slive_status.sql
@@ -0,0 +1,148 @@
+-- MySQL dump 10.13  Distrib 5.1.41, for debian-linux-gnu (x86_64)
+--
+-- Host: localhost    Database: wso2_slive_status
+-- ------------------------------------------------------
+-- Server version	5.1.41-3ubuntu12.10
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `WSL_MAIL_CONTENT_HASH`
+--
+drop database stratos_status;
+create database stratos_status;
+use stratos_status;
+DROP TABLE IF EXISTS `WSL_MAIL_CONTENT_HASH`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `WSL_MAIL_CONTENT_HASH` (
+  `WSL_HASH_ID` int(11) NOT NULL AUTO_INCREMENT,
+  `WSL_MAIL_HASH` varchar(255) NOT NULL,
+  `WSL_IS_MAIL_SENT` tinyint(1) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`WSL_HASH_ID`)
+) ENGINE=MyISAM AUTO_INCREMENT=88 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `WSL_SERVICE`
+--
+
+DROP TABLE IF EXISTS `WSL_SERVICE`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `WSL_SERVICE` (
+  `WSL_ID` int(11) NOT NULL AUTO_INCREMENT,
+  `WSL_NAME` varchar(265) NOT NULL,
+  PRIMARY KEY (`WSL_ID`)
+) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `WSL_SERVICE_HEARTBEAT`
+--
+
+DROP TABLE IF EXISTS `WSL_SERVICE_HEARTBEAT`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `WSL_SERVICE_HEARTBEAT` (
+  `WSL_ID` bigint(20) NOT NULL AUTO_INCREMENT,
+  `WSL_SERVICE_ID` int(11) NOT NULL,
+  `WSL_STATUS` tinyint(1) NOT NULL DEFAULT '0',
+  `WSL_TIMESTAMP` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+  PRIMARY KEY (`WSL_ID`)
+) ENGINE=MyISAM AUTO_INCREMENT=50286 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `WSL_SERVICE_STATE`
+--
+
+DROP TABLE IF EXISTS `WSL_SERVICE_STATE`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `WSL_SERVICE_STATE` (
+  `WSL_ID` bigint(20) NOT NULL AUTO_INCREMENT,
+  `WSL_SERVICE_ID` int(11) NOT NULL,
+  `WSL_STATE_ID` int(11) NOT NULL,
+  `WSL_TIMESTAMP` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+  PRIMARY KEY (`WSL_ID`)
+) ENGINE=MyISAM AUTO_INCREMENT=45884 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `WSL_SERVICE_STATE_DETAIL`
+--
+
+DROP TABLE IF EXISTS `WSL_SERVICE_STATE_DETAIL`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `WSL_SERVICE_STATE_DETAIL` (
+  `WSL_ID` bigint(20) NOT NULL AUTO_INCREMENT,
+  `WSL_SERVICE_STATE_ID` bigint(20) NOT NULL,
+  `WSL_DETAIL` varchar(2048) NOT NULL,
+  `WSL_TIMESTAMP` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+  PRIMARY KEY (`WSL_ID`)
+) ENGINE=MyISAM AUTO_INCREMENT=1249 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `WSL_STATE`
+--
+
+DROP TABLE IF EXISTS `WSL_STATE`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `WSL_STATE` (
+  `WSL_ID` int(11) NOT NULL AUTO_INCREMENT,
+  `WSL_NAME` varchar(256) NOT NULL,
+  PRIMARY KEY (`WSL_ID`)
+) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `WSL_USER`
+--
+
+DROP TABLE IF EXISTS `WSL_USER`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `WSL_USER` (
+  `WSL_UID` int(11) NOT NULL AUTO_INCREMENT,
+  `WSL_MAIL` varchar(255) NOT NULL,
+  PRIMARY KEY (`WSL_UID`),
+  UNIQUE KEY `WSL_UID` (`WSL_UID`)
+) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+LOCK TABLES `WSL_SERVICE` WRITE;
+/*!40000 ALTER TABLE `WSL_SERVICE` DISABLE KEYS */;
+INSERT INTO `WSL_SERVICE` VALUES (1,'StratosLive Manager'),(2,'StratosLive Enterprise Service Bus'),(3,'StratosLive Application Server'),(4,'StratosLive Data Services Server'),(5,'StratosLive Governance Registry'),(6,'StratosLive Identity Server'),(7,'StratosLive Business Activity Monitor'),(8,'StratosLive Business Process Server'),(9,'StratosLive Business Rules Server'),(10,'StratosLive Mashup Server'),(11,'StratosLive Gadget Server'),(12,'StratosLive Complex Event Processing Server'),(13,'StratosLive Message Broker');
+/*!40000 ALTER TABLE `WSL_SERVICE` ENABLE KEYS */;
+UNLOCK TABLES;
+
+LOCK TABLES `WSL_STATE` WRITE;
+/*!40000 ALTER TABLE `WSL_STATE` DISABLE KEYS */;
+INSERT INTO `WSL_STATE` VALUES (1,'Up & Running'),(2,'Broken'),(3,'Down'),(4,'Resolved');
+/*!40000 ALTER TABLE `WSL_STATE` ENABLE KEYS */;
+UNLOCK TABLES;
+
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2011-09-06  9:39:52

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/pom.xml b/components/org.apache.stratos.status.monitor.ui/pom.xml
new file mode 100644
index 0000000..36a9585
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.ui/pom.xml
@@ -0,0 +1,86 @@
+<?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>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.stratos.status.monitor.ui</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Stratos - Status Monitor - 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.status.monitor.ui.*,
+                        </Export-Package>
+                        <Import-Package>
+                            javax.servlet;version="${imp.pkg.version.javax.servlet}",
+                            javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
+                            org.apache.stratos.monitor.stub.*; version="${carbon.platform.package.import.version.range}",
+                            *;resolution:=optional
+                        </Import-Package>
+                        <Carbon-Component>UIBundle</Carbon-Component>
+                    </instructions>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.ui</artifactId>
+	    <version>4.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.status.monitor.stub</artifactId>
+	    <version>4.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.common</artifactId>
+	    <version>3.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+          <groupId>org.json.wso2</groupId>
+          <artifactId>json</artifactId>
+	  <version>1.0.0.wso2v1</version>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/src/main/java/org/apache/stratos/status/monitor/ui/clients/HealthMonitorServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/src/main/java/org/apache/stratos/status/monitor/ui/clients/HealthMonitorServiceClient.java b/components/org.apache.stratos.status.monitor.ui/src/main/java/org/apache/stratos/status/monitor/ui/clients/HealthMonitorServiceClient.java
new file mode 100755
index 0000000..6090f6c
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.ui/src/main/java/org/apache/stratos/status/monitor/ui/clients/HealthMonitorServiceClient.java
@@ -0,0 +1,105 @@
+/*
+ * 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.status.monitor.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.status.monitor.stub.HealthMonitorServiceStub;
+import org.wso2.carbon.status.monitor.stub.beans.xsd.ServiceStateDetailInfoBean;
+import org.wso2.carbon.status.monitor.stub.beans.xsd.ServiceStateInfoBean;
+
+import org.wso2.carbon.ui.CarbonUIUtil;
+import org.wso2.carbon.utils.ServerConstants;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpSession;
+
+/**
+ * HealthMonitorService Client of status.monitor.ui
+ */
+public class HealthMonitorServiceClient {
+    private static final Log log = LogFactory.getLog(
+            HealthMonitorServiceClient.class);
+
+    private HealthMonitorServiceStub stub;
+
+    public HealthMonitorServiceClient(String cookie, String backendServerURL,
+                                      ConfigurationContext configContext) throws RegistryException {
+
+        String epr = backendServerURL + "HealthMonitorService";
+
+        try {
+            stub = new HealthMonitorServiceStub(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 HealthMonitor service client. " + axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+    public HealthMonitorServiceClient(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);
+        String epr = backendServerURL + "HealthMonitorService";
+
+        try {
+            stub = new HealthMonitorServiceStub(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 HealthMonitor Services service client. " +
+                    axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+    public ServiceStateInfoBean[] retrieveStatuses() throws Exception {
+        return stub.getAllServiceStatus();
+    }
+
+    public ServiceStateInfoBean getServiceStatus(String serviceName) throws Exception {
+        return stub.getServiceStatus(serviceName);
+    }
+
+    public ServiceStateDetailInfoBean[] retrieveStateDetails() throws Exception {
+        return stub.getAllServiceStateDetail();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/src/main/java/org/apache/stratos/status/monitor/ui/utils/StatusMonitorUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/src/main/java/org/apache/stratos/status/monitor/ui/utils/StatusMonitorUtil.java b/components/org.apache.stratos.status.monitor.ui/src/main/java/org/apache/stratos/status/monitor/ui/utils/StatusMonitorUtil.java
new file mode 100755
index 0000000..5534b2c
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.ui/src/main/java/org/apache/stratos/status/monitor/ui/utils/StatusMonitorUtil.java
@@ -0,0 +1,107 @@
+/*
+ * 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.status.monitor.ui.utils;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.status.monitor.stub.beans.xsd.ServiceStateDetailInfoBean;
+import org.wso2.carbon.status.monitor.stub.beans.xsd.ServiceStateInfoBean;
+import org.apache.stratos.status.monitor.ui.clients.HealthMonitorServiceClient;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+/**
+ * Utility methods for status.monitor.ui
+ */
+public class StatusMonitorUtil {
+    private static final Log log = LogFactory.getLog(
+            StatusMonitorUtil.class);
+
+    /**
+     * Get all the service statuses
+     *
+     * @param request HttpServletRequest
+     * @param config  ServletConfig
+     * @param session HttpSession
+     * @return ServiceStateInfoBean[] - Array of service states
+     * @throws Exception , if getting the service status information failed.
+     */
+    public static ServiceStateInfoBean[] retrieveStatuses(
+            HttpServletRequest request, ServletConfig config,
+                                              HttpSession session) throws Exception {
+
+        try {
+            HealthMonitorServiceClient serviceClient =
+                    new HealthMonitorServiceClient(config, session);
+            return serviceClient.retrieveStatuses();
+        } catch (Exception e) {
+            String msg = "Failed to get the service status info beans";
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+    }
+
+    /**
+     * Get all the service statuses
+     * @param request HttpServletRequest
+     * @param config  ServletConfig
+     * @param session HttpSession
+     * @return ServiceStateDetailInfoBean[] - Array of service state details
+     * @throws Exception , if getting the service state detail information failed.
+     */
+    public static ServiceStateDetailInfoBean[] retrieveStateDetails(
+            HttpServletRequest request, ServletConfig config,
+            HttpSession session) throws Exception {
+        try {
+            HealthMonitorServiceClient serviceClient =
+                    new HealthMonitorServiceClient(config, session);
+            return serviceClient.retrieveStateDetails();
+        } catch (Exception e) {
+            String msg = "Failed to get the service state details info beans";
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+    }
+
+    /**
+     * Get the status of a particular service
+     *
+     * @param request HttpServletRequest
+     * @param config  ServletConfig
+     * @param session HttpSession
+     * @return ServiceStateInfoBean - State details of the service
+     * @throws Exception, if error in getting the service state information
+     */
+    public static ServiceStateInfoBean getStatus(HttpServletRequest request, ServletConfig config,
+                                           HttpSession session) throws Exception {
+        String serviceName = "";
+        try {
+            serviceName = request.getParameter("service");
+            HealthMonitorServiceClient serviceClient =
+                    new HealthMonitorServiceClient(config, session);
+            return serviceClient.getServiceStatus(serviceName);
+        } catch (Exception e) {
+            String msg = "Failed to get the status details of the service:" + serviceName;
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/src/main/resources/META-INF/component.xml b/components/org.apache.stratos.status.monitor.ui/src/main/resources/META-INF/component.xml
new file mode 100755
index 0000000..1cde360
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.ui/src/main/resources/META-INF/component.xml
@@ -0,0 +1,49 @@
+<!--
+  ~ 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>status_monitor_menu</id>
+            <i18n-key>monitor.service.status</i18n-key>
+            <i18n-bundle>org.wso2.carbon.status.monitor.ui.i18n.Resources</i18n-bundle>
+            <parent-menu>monitor_menu</parent-menu>
+            <link>../status-monitor/service-status.jsp</link>
+            <region>region4</region>
+            <order>51</order>
+            <style-class>manage</style-class>
+            <icon>../status-monitor/images/services.gif</icon>
+            <require-permission>/permission/protected/manage/monitor/tenants</require-permission>
+            <require-super-tenant>true</require-super-tenant>
+        </menu>
+        <menu>
+            <id>status_details_menu</id>
+            <i18n-key>services.state.details</i18n-key>
+            <i18n-bundle>org.wso2.carbon.status.monitor.ui.i18n.Resources</i18n-bundle>
+            <parent-menu>monitor_menu</parent-menu>
+            <link>../status-monitor/status-details.jsp</link>
+            <region>region4</region>
+            <order>52</order>
+            <style-class>manage</style-class>
+            <icon>../status-monitor/images/services1.gif</icon>
+            <require-permission>/permission/protected/manage/monitor/tenants</require-permission>
+            <require-super-tenant>true</require-super-tenant>
+        </menu>
+    </menus>
+</component>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/src/main/resources/org/apache/carbon/status/monitor/ui/i18n/JSResources.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/src/main/resources/org/apache/carbon/status/monitor/ui/i18n/JSResources.properties b/components/org.apache.stratos.status.monitor.ui/src/main/resources/org/apache/carbon/status/monitor/ui/i18n/JSResources.properties
new file mode 100755
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/src/main/resources/org/apache/carbon/status/monitor/ui/i18n/Resources.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/src/main/resources/org/apache/carbon/status/monitor/ui/i18n/Resources.properties b/components/org.apache.stratos.status.monitor.ui/src/main/resources/org/apache/carbon/status/monitor/ui/i18n/Resources.properties
new file mode 100755
index 0000000..8933add
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.ui/src/main/resources/org/apache/carbon/status/monitor/ui/i18n/Resources.properties
@@ -0,0 +1,12 @@
+monitor.service.status=Services Status
+services.state.details=Services State Details
+monitor.service_status.menu=Stratos Service Status
+monitor.status_details.menu=Service Status Details
+services.list=List of Services
+service.id=#
+service.name=Service Name
+service.state=Service State
+logged.time=Logged Time
+state.logged.time=State Logged Time
+service.state.details=Service State Details
+details.logged.time=Details Logged Time
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/css/status.css
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/css/status.css b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/css/status.css
new file mode 100755
index 0000000..2f06cc5
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/css/status.css
@@ -0,0 +1,62 @@
+/*css editor styles */
+.csseditor-top-line{
+    background-color:black;
+    height:5px;
+}
+.csseditor-leftbox{
+    background-color:#9a9a9a;
+    padding-left:5px;
+    padding-right:5px;
+    padding-bottom:5px;
+    padding-top:15px;
+   height:380px;
+}
+.csseditor-leftbox-top{
+    color:#ffffff;
+    font-size:18px;
+    height:30px;
+}
+.csseditor-textbox{
+    background-color:#dfe7ed;
+    border:solid 1px #ffffff;
+    width:100%;
+}
+.csseditor-rightbox{
+    background-color:#c9c9c9;
+    border:solid 1px #ffffff;
+    height:400px;
+}
+.csseditor-rightbox-title{
+    background-color:#9a9a9a;
+    height:25px;
+    color:#ffffff;
+    padding-left:10px;
+    padding-top:5px;
+}
+.csseditor-searchbox{
+    padding-left:10px;
+    padding-top:10px;
+}
+#flickr_results{
+    height:300px;
+    overflow-y:auto;
+    overflow-x:hidden;
+    margin-left:5px;
+    margin-right:5px;
+    border:solid 1px #ffffff;
+}
+.imageList{
+}
+.imageList li {
+    padding-top: 3px !important;
+    padding-left: 5px !important;
+    background-color: #e1e9ec;
+    border: solid 1px #b5bdc1;
+}
+
+.imageList li a {
+    background-image: url(../images/images.gif);
+    background-repeat: no-repeat;
+    padding-left: 20px;
+    text-indent: 50px;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/docs/images/view-details.png
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/docs/images/view-details.png b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/docs/images/view-details.png
new file mode 100644
index 0000000..260c203
Binary files /dev/null and b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/docs/images/view-details.png differ

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

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/docs/userguide.html
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/docs/userguide.html b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/docs/userguide.html
new file mode 100755
index 0000000..a228b4a
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/docs/userguide.html
@@ -0,0 +1,57 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <title>Services Status Monitor - User Guide</title>
+  <link href="../../admin/css/documentation.css" rel="stylesheet" type="text/css" media="all" />
+</head>
+
+<body>
+
+
+ <h1>View the Status of the Services</h1>
+
+
+ <h2> <b> View Service Status</b></h2>
+
+<p>
+    In this page, you can see the status of the services. A service instance can be 'Up & Running',
+    'Broken', 'Down', and 'Resolved'.
+</p>
+    <img src="images/view-status.png" alt="View Status Page"/>
+    <div><strong>Figure1: View Services Status</strong></div>
+
+ 
+
+
+<h2><b>View Status Details</b></h2>
+
+
+<p>
+
+   This page lists the service status logs. Hence, here you can view the details behind the service status.
+
+<img src="images/view-details.png" alt="View Status Details Page"/>
+<div><strong>Figure2: View Services Status Details</strong></div>
+
+
+</body>
+
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/images/services.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/images/services.gif b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/images/services.gif
new file mode 100755
index 0000000..9883116
Binary files /dev/null and b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/images/services.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/images/services1.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/images/services1.gif b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/images/services1.gif
new file mode 100755
index 0000000..d40a7a3
Binary files /dev/null and b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/images/services1.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/service-status.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/service-status.jsp b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/service-status.jsp
new file mode 100644
index 0000000..054fe25
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/service-status.jsp
@@ -0,0 +1,127 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ page import="org.wso2.carbon.registry.common.ui.UIException" %>
+<%@ page import="org.wso2.carbon.status.monitor.stub.beans.xsd.ServiceStateInfoBean" %>
+<%@ page import="org.wso2.carbon.status.monitor.ui.clients.HealthMonitorServiceClient" %>
+<%@ page import="org.wso2.carbon.status.monitor.ui.utils.StatusMonitorUtil" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
+<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
+<%@ page import="java.text.SimpleDateFormat" %>
+<%@ page import="java.util.Calendar" %>
+<%@ page import="java.util.Date" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
+<jsp:include page="../registry_common/registry_common-i18n-ajaxprocessor.jsp"/>
+<script type="text/javascript" src="../registry_common/js/registry_validation.js"></script>
+<script type="text/javascript" src="../registry_common/js/registry_common.js"></script>
+<script type="text/javascript" src="../ajax/js/prototype.js"></script>
+<script type="text/javascript" src="js/status_config.js"></script>
+
+
+<carbon:jsi18n
+        resourceBundle="org.wso2.carbon.status.monitor.ui.i18n.JSResources"
+        request="<%=request%>"/>
+
+<fmt:bundle basename="org.wso2.carbon.status.monitor.ui.i18n.Resources">
+    <carbon:breadcrumb
+            label="monitor.service_status.menu"
+            resourceBundle="org.wso2.carbon.status.monitor.ui.i18n.Resources"
+            topPage="true"
+            request="<%=request%>"/>
+
+
+    <div id="middle">
+
+        <%
+            String backendServerURL = CarbonUIUtil.getServerURL(
+                    config.getServletContext(), session);
+            ConfigurationContext configContext = (ConfigurationContext) config
+                    .getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+
+            String cookie = (String) session.getAttribute
+                    (ServerConstants.ADMIN_SERVICE_COOKIE);
+            HealthMonitorServiceClient client;
+            ServiceStateInfoBean[] serviceStateInfoBeanArr;
+            try {
+                client = new HealthMonitorServiceClient(cookie, backendServerURL, configContext);
+
+                serviceStateInfoBeanArr = client.retrieveStatuses();
+
+            } catch (UIException e) {
+                String error1 = "Error in retrieving service status";
+                request.setAttribute(CarbonUIMessage.ID, new CarbonUIMessage(error1, error1, null));
+        %>
+
+        <jsp:forward page="../admin/error.jsp"/>
+
+        <%
+                return;
+            }
+        %>
+
+        <br/>
+
+        <h2><fmt:message key="services.list"/></h2>
+
+        <div id="workArea">
+            <table cellpadding="0" cellspacing="0" border="0" style="width:100%" class="styledLeft">
+                <thead>
+                <tr>
+                    <th style="padding-left:5px;text-align:left;"><fmt:message
+                            key="service.name"/></th>
+                    <th style="padding-left:5px;text-align:left;"><fmt:message
+                            key="service.state"/></th>
+                    <th style="padding-left:5px;text-align:left;"><fmt:message key="logged.time"/></th>
+                </tr>
+                </thead>
+                <tbody>
+                <%
+                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+
+                    if (serviceStateInfoBeanArr != null) {
+                        for (ServiceStateInfoBean serviceStateInfoBean : serviceStateInfoBeanArr) {
+                            if (serviceStateInfoBean == null) {
+                                continue;
+                            }
+
+                            String service = serviceStateInfoBean.getService();
+                            String state = serviceStateInfoBean.getServiceState();
+                            Date loggedDate = new Date(serviceStateInfoBean.getDate());
+                            String loggedDateStr = dateFormat.format(loggedDate);
+                %>
+                <tr id="1">
+                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=service%>
+                    </td>
+                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=state%>
+                    </td>
+                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=loggedDateStr%>
+                    </td>
+                </tr>
+                <% }
+                }
+                %>
+                </tbody>
+            </table>
+        </div>
+    </div>
+</fmt:bundle>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/status-details.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/status-details.jsp b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/status-details.jsp
new file mode 100644
index 0000000..15e2343
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.ui/src/main/resources/web/status-monitor/status-details.jsp
@@ -0,0 +1,138 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ page import="org.wso2.carbon.registry.common.ui.UIException" %>
+<%@ page import="org.wso2.carbon.status.monitor.stub.beans.xsd.ServiceStateDetailInfoBean" %>
+<%@ page import="org.wso2.carbon.status.monitor.ui.clients.HealthMonitorServiceClient" %>
+<%@ page import="org.wso2.carbon.status.monitor.ui.utils.StatusMonitorUtil" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
+<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
+<%@ page import="java.text.SimpleDateFormat" %>
+<%@ page import="java.util.Calendar" %>
+<%@ page import="java.util.Date" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
+<jsp:include page="../registry_common/registry_common-i18n-ajaxprocessor.jsp"/>
+<script type="text/javascript" src="../registry_common/js/registry_validation.js"></script>
+<script type="text/javascript" src="../registry_common/js/registry_common.js"></script>
+<script type="text/javascript" src="../ajax/js/prototype.js"></script>
+<script type="text/javascript" src="js/status_config.js"></script>
+
+
+<carbon:jsi18n
+        resourceBundle="org.wso2.carbon.status.monitor.ui.i18n.JSResources"
+        request="<%=request%>"/>
+
+<fmt:bundle basename="org.wso2.carbon.status.monitor.ui.i18n.Resources">
+    <carbon:breadcrumb
+            label="monitor.status_details.menu"
+            resourceBundle="org.wso2.carbon.status.monitor.ui.i18n.Resources"
+            topPage="true"
+            request="<%=request%>"/>
+
+
+    <div id="middle">
+
+        <%
+            String backendServerURL = CarbonUIUtil.getServerURL(
+                    config.getServletContext(), session);
+            ConfigurationContext configContext = (ConfigurationContext) config
+                    .getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+
+            String cookie = (String) session.getAttribute
+                    (ServerConstants.ADMIN_SERVICE_COOKIE);
+            HealthMonitorServiceClient client;
+
+            ServiceStateDetailInfoBean[] serviceStateDetailInfoBeanArr;
+            try {
+                client = new HealthMonitorServiceClient(cookie, backendServerURL, configContext);
+
+                 serviceStateDetailInfoBeanArr = client.retrieveStateDetails();
+
+            } catch (UIException e) {
+                String error1 = "Error in retrieving service state details";
+                request.setAttribute(CarbonUIMessage.ID, new CarbonUIMessage(error1, error1, null));
+        %>
+
+        <jsp:forward page="../admin/error.jsp"/>
+
+        <%
+                return;
+            }
+        %>
+
+        <br/>
+
+        <h2><fmt:message key="services.state.details"/></h2>
+
+        <div id="workArea">
+            <table cellpadding="0" cellspacing="0" border="0" style="width:100%" class="styledLeft">
+                <thead>
+                <tr>
+                    <th style="padding-left:5px;text-align:left;"><fmt:message
+                            key="service.name"/></th>
+                    <th style="padding-left:5px;text-align:left;"><fmt:message
+                     key="state.logged.time"/></th>
+                    <th style="padding-left:5px;text-align:left;"><fmt:message
+                            key="service.state.details"/></th>
+                    <th style="padding-left:5px;text-align:left;"><fmt:message
+                     key="details.logged.time"/></th>
+                </tr>
+                </thead>
+                <tbody>
+                <%
+                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+
+                    if (serviceStateDetailInfoBeanArr != null) {
+                        for (ServiceStateDetailInfoBean
+                            serviceStateDetailInfoBean : serviceStateDetailInfoBeanArr) {
+                            if (serviceStateDetailInfoBean == null) {
+                                continue;
+                            }
+
+                            String service = serviceStateDetailInfoBean.getService();
+                            String stateDetail = serviceStateDetailInfoBean.getServiceStateDetail();
+                            Date stateLoggedTime = new Date(
+                                serviceStateDetailInfoBean.getStateLoggedTime());
+                            Date detailLoggedTime = new Date(
+                                serviceStateDetailInfoBean.getDetailLoggedTime());
+                            String stateLoggedTimeStr = dateFormat.format(stateLoggedTime);
+                            String detailLoggedTimeStr = dateFormat.format(detailLoggedTime);
+                %>
+                <tr id="1">
+                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=service%>
+                    </td>
+                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=stateLoggedTimeStr%>
+                    </td>
+                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=stateDetail%>
+                    </td>
+                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=detailLoggedTimeStr%>
+                    </td>
+                </tr>
+                <% }
+                }
+                %>
+                </tbody>
+            </table>
+        </div>
+    </div>
+</fmt:bundle>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor/pom.xml b/components/org.apache.stratos.status.monitor/pom.xml
new file mode 100644
index 0000000..4384e23
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor/pom.xml
@@ -0,0 +1,82 @@
+<!-- 
+  #  Licensed to the Apache Software Foundation (ASF) under one
+  #  or more contributor license agreements.  See the NOTICE file
+  #  distributed with this work for additional information
+  #  regarding copyright ownership.  The ASF licenses this file
+  #  to you under the Apache License, Version 2.0 (the
+  #  "License"); you may not use this file except in compliance
+  #  with the License.  You may obtain a copy of the License at
+  #  
+  #  http://www.apache.org/licenses/LICENSE-2.0
+  #  
+  #  Unless required by applicable law or agreed to in writing,
+  #  software distributed under the License is distributed on an
+  #  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  #  KIND, either express or implied.  See the License for the
+  #  specific language governing permissions and limitations
+  #  under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.stratos</groupId>
+        <artifactId>stratos-components-parent</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.stratos.status.monitor</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Stratos - Stratos Status Monitor Back-End</name>
+
+    <build>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </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>
+                        <Private-Package>
+                            org.apache.stratos.status.monitor.internal.*,
+                        </Private-Package>
+                        <Export-Package>
+                            org.apache.stratos.status.monitor.beans.*,
+                            org.apache.stratos.status.monitor.services.*,
+                        </Export-Package>
+                        <Import-Package>
+                            org.wso2.carbon.registry.core.*;version=1.0.1,
+                            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.stratos.status.monitor.core.*,
+                            *;resolution:=optional
+                        </Import-Package>
+                        <DynamicImport-Package>*</DynamicImport-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.registry.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.status.monitor.core</artifactId>
+	    <version>3.0.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/beans/ServiceStateDetailInfoBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/beans/ServiceStateDetailInfoBean.java b/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/beans/ServiceStateDetailInfoBean.java
new file mode 100644
index 0000000..e31746d
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/beans/ServiceStateDetailInfoBean.java
@@ -0,0 +1,62 @@
+/*
+ *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.status.monitor.beans;
+
+/**
+ * Service State Details, includes the log information
+ */
+public class ServiceStateDetailInfoBean {
+    private String service;
+    private String serviceStateDetail;
+    private long stateLoggedTime;
+    private long detailLoggedTime;
+
+    public String getService() {
+        return service;
+    }
+
+    public void setService(String service) {
+        this.service = service;
+    }
+
+    public String getServiceStateDetail() {
+        return serviceStateDetail;
+    }
+
+    public void setServiceStateDetail(String serviceStateDetail) {
+        this.serviceStateDetail = serviceStateDetail;
+    }
+
+    public long getStateLoggedTime() {
+        return stateLoggedTime;
+    }
+
+    public void setStateLoggedTime(long stateLoggedTime) {
+        this.stateLoggedTime = stateLoggedTime;
+    }
+
+    public long getDetailLoggedTime() {
+        return detailLoggedTime;
+    }
+
+    public void setDetailLoggedTime(long detailLoggedTime) {
+        this.detailLoggedTime = detailLoggedTime;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/beans/ServiceStateInfoBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/beans/ServiceStateInfoBean.java b/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/beans/ServiceStateInfoBean.java
new file mode 100644
index 0000000..2e97b8c
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/beans/ServiceStateInfoBean.java
@@ -0,0 +1,61 @@
+/*
+ *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.status.monitor.beans;
+
+/**
+ * Service State Information.
+ */
+public class ServiceStateInfoBean {
+    private int serviceID;
+    private String service;
+    private String serviceState;
+    private long date;
+
+    public int getServiceID() {
+        return serviceID;
+    }
+
+    public void setServiceID(int serviceID) {
+        this.serviceID = serviceID;
+    }
+
+    public String getService() {
+        return service;
+    }
+
+    public void setService(String service) {
+        this.service = service;
+    }
+
+    public String getServiceState() {
+        return serviceState;
+    }
+
+    public void setServiceState(String serviceState) {
+        this.serviceState = serviceState;
+    }
+
+    public long getDate() {
+        return date;
+    }
+
+    public void setDate(long date) {
+        this.date = date;
+    }
+}


[6/7] Applying 0001-Refactor-status-monitor-module.patch

Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/GadgetServerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/GadgetServerClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/GadgetServerClient.java
new file mode 100644
index 0000000..8e95acc
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/GadgetServerClient.java
@@ -0,0 +1,111 @@
+/*
+ * 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.status.monitor.agent.clients.service;
+
+import org.apache.stratos.status.monitor.agent.clients.common.ServiceLoginClient;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.registry.app.RemoteRegistry;
+import org.wso2.carbon.registry.core.Resource;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.sql.SQLException;
+import java.text.ParseException;
+
+/**
+ * Status Monitor Agent client class for Gadget Server
+ */
+public class GadgetServerClient extends Thread{
+
+    private static final Log log = LogFactory.getLog(GadgetServerClient.class);
+    private static final AuthConfigBean authConfigBean =
+            StatusMonitorConfigurationBuilder.getAuthConfigBean();
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (IOException e) {
+                log.error(e);
+            } catch (SQLException e) {
+                log.error(e);
+            } catch (ParseException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    static RemoteRegistry registry = null;
+
+    private static void executeService() throws IOException, SQLException, ParseException {
+        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.GADGET);
+
+        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.GADGETS_HOST, serviceID)) {
+            try {
+                registry = new RemoteRegistry(new URL(StatusMonitorConstants.GADGETS_HTTP +
+                        "/t/" + authConfigBean.getTenant() + "/registry"),
+                        authConfigBean.getUserName(), authConfigBean.getPassword());
+            } catch (RegistryException e) {
+                log.error(e);
+            } catch (MalformedURLException e) {
+                log.error(e);
+            }
+
+            /*get resource */
+            try {
+                Resource r2 = registry.get(StatusMonitorAgentConstants.GS_SAMPLE_TEST_RESOURCE_PATH);
+                if(log.isDebugEnabled()) {
+                    log.debug("MediaType in the executeService() of GadgetServerClient in Status" +
+                            " Monitor Agent: " + r2.getMediaType());
+                }
+
+                if (r2.getMediaType().equalsIgnoreCase("application/vnd.wso2-gadget+xml")) {
+                    MySQLConnector.insertStats(serviceID, true);
+                    MySQLConnector.insertState(serviceID, true, "");
+                }
+            } catch (RegistryException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "Exception in executing the service for GadgetServerClient - Status Monitor Agent";
+                log.error(msg, e);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/GovernanceRegistryServerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/GovernanceRegistryServerClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/GovernanceRegistryServerClient.java
new file mode 100644
index 0000000..3f1ff5e
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/GovernanceRegistryServerClient.java
@@ -0,0 +1,182 @@
+/*
+ * 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.status.monitor.agent.clients.service;
+
+import org.apache.stratos.status.monitor.agent.clients.common.ServiceLoginClient;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.registry.app.RemoteRegistry;
+import org.wso2.carbon.registry.core.Resource;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.sql.SQLException;
+import java.text.ParseException;
+
+/**
+ * Status Monitor Agent client class for Governance Registry
+ */
+public class GovernanceRegistryServerClient extends Thread{
+    private static final Log log = LogFactory.getLog(GovernanceRegistryServerClient.class);
+    private static final AuthConfigBean authConfigBean =
+            StatusMonitorConfigurationBuilder.getAuthConfigBean();
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (IOException e) {
+                log.error(e);
+            } catch (SQLException e) {
+                log.error(e);
+            } catch (ParseException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    static RemoteRegistry registry = null;
+
+    private static void executeService() throws IOException, SQLException, ParseException {
+        boolean getValue = false;
+        boolean putValue = false;
+        boolean deleteValue = false;
+        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.GOVERNANCE);
+
+        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.GOVERNANCE_HOST, serviceID)) {
+            try {
+
+                registry = new RemoteRegistry(new URL(StatusMonitorConstants.GOVERNANCE_HTTP +
+                        "/t/" + authConfigBean.getTenant() + "/registry"),
+                        authConfigBean.getUserName(), authConfigBean.getPassword());
+            } catch (RegistryException e) {
+                log.error(e);
+            } catch (MalformedURLException e) {
+                log.error(e);
+            } catch (Exception e) {
+                log.error(e);
+            }
+
+            /*put resource */
+            Resource r1;
+
+            try {
+                r1 = registry.newResource();
+                r1.setContent("test content".getBytes());
+                r1.setMediaType("text/plain");
+                String pathValue = registry.put(
+                        StatusMonitorAgentConstants.GREG_SAMPLE_TEST_RESOURCE_PATH, r1);
+
+                if (pathValue.equalsIgnoreCase(
+                        StatusMonitorAgentConstants.GREG_SAMPLE_TEST_RESOURCE_PATH)) {
+                    putValue = true;
+                }
+            } catch (RegistryException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                log.warn(e);
+            } catch (Exception e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                log.warn(e);
+            }
+
+            /*get resource */
+            try {
+                if (putValue) {
+                    Resource r2 = registry.get(
+                            StatusMonitorAgentConstants.GREG_SAMPLE_TEST_RESOURCE_PATH);
+                    if (log.isDebugEnabled()) {
+                        log.debug("Media Type: " + r2.getMediaType());
+                    }
+
+                    if (r2.getMediaType().equalsIgnoreCase("text/plain")) {
+                        getValue = true;
+                    }
+                }
+            } catch (RegistryException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                log.warn(e);
+            } catch (Exception e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                log.warn(e);
+            }
+
+            /*Delete resource */
+            try {
+                if (getValue) {
+                    registry.delete(StatusMonitorAgentConstants.GREG_SAMPLE_TEST_RESOURCE_PATH);
+
+                    if (!registry.resourceExists(
+                            StatusMonitorAgentConstants.GREG_SAMPLE_TEST_RESOURCE_PATH)) {
+                        deleteValue = true;
+                    }
+                }
+
+            } catch (RegistryException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                log.warn(e);
+            } catch (Exception e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                log.warn(e);
+            }
+
+            //write to mysql db
+            try {
+                if (getValue & putValue & deleteValue) {
+                    if (log.isDebugEnabled()) {
+                        log.debug("Governance Registry Status Monitor agent: Writing to the database");
+                    }
+                    MySQLConnector.insertStats(serviceID, true);
+                    MySQLConnector.insertState(serviceID, true, "");
+                }
+            } catch (SQLException e) {
+                String msg = "Error in writing to the database for Governance Registry - status monitor agent";
+                log.error(msg, e);
+            }
+        }
+    }
+}
+
+
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/IdentityServerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/IdentityServerClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/IdentityServerClient.java
new file mode 100644
index 0000000..9e16137
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/IdentityServerClient.java
@@ -0,0 +1,116 @@
+/*
+ * 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.status.monitor.agent.clients.service;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.authenticator.stub.AuthenticationAdminStub;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import java.io.File;
+import java.io.IOException;
+import java.sql.SQLException;
+
+/**
+ * Status Monitor Agent client class for Identity Server
+ */
+public class IdentityServerClient extends Thread{
+    private static final Log log = LogFactory.getLog(IdentityServerClient.class);
+    private static AuthConfigBean authConfigBean =
+            StatusMonitorConfigurationBuilder.getAuthConfigBean();
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (IOException e) {
+                log.error(e);
+            } catch (SQLException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    private static void executeService() throws SQLException, IOException {
+
+        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE, authConfigBean.getJksLocation());
+        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE_PASSWORD, "wso2carbon");
+        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE_TYPE, "JKS");
+
+        File newFile = new File(authConfigBean.getJksLocation());
+        if(log.isDebugEnabled()){
+            log.debug("Canonical Path: " + newFile.getCanonicalPath());
+        }
+
+        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.IDENTITY);
+        String authenticationServiceURL = StatusMonitorConstants.IDENTITY_HTTPS +
+                StatusMonitorAgentConstants.AUTHENTICATION_ADMIN_PATH;
+        AuthenticationAdminStub authenticationAdminStub;
+        try {
+            authenticationAdminStub = new AuthenticationAdminStub(authenticationServiceURL);
+            ServiceClient client = authenticationAdminStub._getServiceClient();
+            Options options = client.getOptions();
+            options.setManageSession(true);
+
+            Boolean status;
+            status = authenticationAdminStub.login(authConfigBean.getUserName(),
+                    authConfigBean.getPassword(), StatusMonitorConstants.IDENTITY_HOST);
+            ServiceContext serviceContext = authenticationAdminStub.
+                    _getServiceClient().getLastOperationContext().getServiceContext();
+            // String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
+
+            if (status) {
+                MySQLConnector.insertStats(serviceID, true);
+                MySQLConnector.insertState(serviceID, true, "");
+            }
+        } catch (AxisFault e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, e.getMessage());
+            String msg = "Fault in executing the service for IS client - Status Monitor Agent";
+            log.warn(msg, e);
+
+        } catch (Exception e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, e.getMessage());
+            String msg = "Exception in executing the service for IS client - Status Monitor Agent";
+            log.warn(msg, e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ManagerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ManagerServiceClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ManagerServiceClient.java
new file mode 100644
index 0000000..47316af
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ManagerServiceClient.java
@@ -0,0 +1,113 @@
+/*
+ * 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.status.monitor.agent.clients.service;
+
+import org.apache.axis2.client.Options;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ServiceContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.authenticator.stub.AuthenticationAdminStub;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import java.io.IOException;
+import java.sql.SQLException;
+
+/**
+ * Status Monitor Agent client class for Stratos Manager
+ */
+public class ManagerServiceClient extends Thread{
+
+    private static final Log log = LogFactory.getLog(ManagerServiceClient.class);
+    private static final AuthConfigBean authConfigBean =
+            StatusMonitorConfigurationBuilder.getAuthConfigBean();
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (IOException e) {
+                log.error(e);
+            } catch (SQLException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    private static void executeService() throws SQLException, IOException {
+
+        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE, authConfigBean.getJksLocation());
+        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE_PASSWORD, "wso2carbon");
+        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE_TYPE, "JKS");
+
+        String userName = authConfigBean.getUserName();
+        String password = authConfigBean.getPassword();
+        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.MANAGER);
+        String authenticationServiceURL = StatusMonitorConstants.MANAGER_HTTPS +
+                StatusMonitorAgentConstants.AUTHENTICATION_ADMIN_PATH;
+        AuthenticationAdminStub authenticationAdminStub;
+        try {
+            authenticationAdminStub = new AuthenticationAdminStub(authenticationServiceURL);
+            ServiceClient client = authenticationAdminStub._getServiceClient();
+            Options options = client.getOptions();
+            options.setManageSession(true);
+
+            Boolean status;
+            status = authenticationAdminStub.login(userName, password,
+                    StatusMonitorConstants.MANAGER_HOST);
+            ServiceContext serviceContext = authenticationAdminStub.
+                    _getServiceClient().getLastOperationContext().getServiceContext();
+            // String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
+
+            if (status) {
+                MySQLConnector.insertStats(serviceID, true);
+                MySQLConnector.insertState(serviceID, true, "");
+            }
+        } catch (AxisFault e) {
+            MySQLConnector.insertStats(serviceID, false);
+
+            MySQLConnector.insertState(serviceID, false, e.getMessage());
+            String msg = "Fault in executing the service - Status Monitor Agent for Manager";
+            log.warn(msg, e);
+        } catch (Exception e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, e.getMessage());
+            String msg = "Exception in executing the service - Status Monitor Agent for Manager";
+            log.warn(msg, e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/MashupServerClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/MashupServerClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/MashupServerClient.java
new file mode 100644
index 0000000..61d3963
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/MashupServerClient.java
@@ -0,0 +1,192 @@
+/*
+ * 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.status.monitor.agent.clients.service;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.stratos.status.monitor.agent.clients.common.ServiceLoginClient;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.beans.SampleTenantConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import javax.xml.stream.XMLStreamException;
+import java.io.IOException;
+import java.sql.SQLException;
+import java.text.ParseException;
+
+/**
+ * Status Monitor Agent client class for Mashup Server
+ */
+public class MashupServerClient extends Thread{
+
+    private static final Log log = LogFactory.getLog(MashupServerClient.class);
+    private static final AuthConfigBean authConfigBean =
+            StatusMonitorConfigurationBuilder.getAuthConfigBean();
+    private static final SampleTenantConfigBean sampleTenantConfigBean =
+            StatusMonitorConfigurationBuilder.getSampleTenantConfigBean();
+    private static int serviceID;
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (IOException e) {
+                log.error(e);
+            } catch (SQLException e) {
+                log.error(e);
+            } catch (ParseException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    private static OMElement createPayLoad() {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace("http://services.mashup.wso2.org/schemaTest1", "ns1");
+        OMElement method = fac.createOMElement("echoJSString", omNs);
+        OMElement value = fac.createOMElement("param", null);
+        value.addChild(fac.createOMText(value, "Hello World"));
+        method.addChild(value);
+        return method;
+    }
+
+    private static void executeService() throws IOException, SQLException, ParseException {
+
+        serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.MASHUP);
+
+        OMElement result;
+        OMElement payload = createPayLoad();
+        ServiceClient serviceclient = new ServiceClient();
+        Options opts = new Options();
+
+        opts.setTo(new EndpointReference(StatusMonitorConstants.MASHUP_HTTP +
+                StatusMonitorAgentConstants.TENANT_SERVICES + authConfigBean.getTenant() +
+                "/test123/schemaTest1/ "));
+        opts.setAction("http://services.mashup.wso2.org/schemaTest1");
+
+        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.MASHUP_HOST, serviceID)) {
+            serviceclient.setOptions(opts);
+            try {
+                result = serviceclient.sendReceive(payload);
+
+                if ((result.toString().indexOf("Hello World")) > 0) {
+                    if (executeRelatedProductsService()) {
+                        MySQLConnector.insertStats(serviceID, true);
+                        MySQLConnector.insertState(serviceID, true, "");
+                    }
+                } else {
+                    MySQLConnector.insertStats(serviceID, false);
+                    MySQLConnector.insertState(serviceID, false, "Service Invocation failed");
+                }
+
+            } catch (AxisFault e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "Error in executing the service - Status Monitor Agent for MashupServerClient";
+                log.warn(msg, e);
+            }
+            catch (NullPointerException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "NPE in executing the service - Status Monitor Agent for MashupServerClient";
+                log.warn(msg, e);
+            } catch (XMLStreamException e) {
+                String msg = "XMLStreamException in execting the service - Status Monitor Agent for MashupServerClient";
+                log.warn(msg, e);
+            }
+        }
+    }
+
+    private static Boolean executeRelatedProductsService() throws IOException, SQLException, ParseException, XMLStreamException {
+
+        Boolean relatedProductsServiceStatus = false;
+
+        OMElement result;
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+        OMNamespace omNs = fac.createOMNamespace("http://services.mashup.wso2.org/RelatedProducts?xsd", "rel");
+        OMElement payload = fac.createOMElement("getRelatedProducts", omNs);
+        OMElement value1 = fac.createOMElement("query", null);
+        OMElement value2 = fac.createOMElement("count", null);
+        OMElement value3 = fac.createOMElement("format", null);
+        value1.addChild(fac.createOMText(value1, "mac"));
+        value2.addChild(fac.createOMText(value2, "2"));
+        value3.addChild(fac.createOMText(value3, "xml"));
+
+        payload.addChild(value1);
+        payload.addChild(value2);
+        payload.addChild(value3);
+
+        ServiceClient serviceclient = new ServiceClient();
+        Options opts = new Options();
+        opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
+
+        opts.setTo(new EndpointReference(StatusMonitorConstants.MASHUP_HTTP +
+                StatusMonitorAgentConstants.TENANT_SERVICES +
+                sampleTenantConfigBean.getTenant() + "/carbon/RelatedProducts"));
+        opts.setAction("http://services.mashup.wso2.org/RelatedProducts?xsd/RelatedProducts");
+
+        serviceclient.setOptions(opts);
+        try {
+            result = serviceclient.sendReceive(payload);
+
+            if ((result.toString().contains("New USB Graphics Drawing Tablet Mouse Pad"))) {
+                relatedProductsServiceStatus = true;
+            } else {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, "Platform Sample: RelatedProducts service Invocation failed");
+            }
+        } catch (AxisFault e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, "Platform Sample: RelatedProducts - " + e.getMessage());
+            String msg = "Error in executing the related products service";
+            log.warn(msg, e);
+        }
+        catch (NullPointerException e) {
+            MySQLConnector.insertStats(serviceID, false);
+            MySQLConnector.insertState(serviceID, false, "Platform Sample: RelatedProducts - " + e.getMessage());
+            String msg = "NPE in executing the related products service";
+            log.warn(msg, e);
+        }
+        return relatedProductsServiceStatus;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/MessageBrokerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/MessageBrokerServiceClient.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/MessageBrokerServiceClient.java
new file mode 100644
index 0000000..a0f8459
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/MessageBrokerServiceClient.java
@@ -0,0 +1,158 @@
+/*
+ * 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.status.monitor.agent.clients.service;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.status.monitor.agent.clients.common.ServiceLoginClient;
+import org.apache.stratos.status.monitor.agent.constants.StatusMonitorAgentConstants;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.StatusMonitorConfigurationBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSession;
+import javax.jms.TextMessage;
+import javax.jms.QueueConnectionFactory;
+
+/**
+ * Status Monitor Agent client class for Message Broker Service
+ */
+public class MessageBrokerServiceClient extends Thread{
+
+    private static final Log log = LogFactory.getLog(MessageBrokerServiceClient.class);
+    private static String tcpUserName;
+
+    public void run() {
+        while (true) {
+            try {
+                executeService();
+
+                // return from while loop if the thread is interrupted
+                if (isInterrupted()) {
+                    break;
+                }
+                // let the thread sleep for 15 mins
+                try {
+                    sleep(StatusMonitorConstants.SLEEP_TIME);
+                } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
+                }
+            } catch (SQLException e) {
+                log.error(e);
+            }
+        }
+    }
+
+    private static void executeService() throws SQLException {
+        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.MESSAGING);
+        AuthConfigBean authConfigBean = StatusMonitorConfigurationBuilder.getAuthConfigBean();
+
+        String userName = authConfigBean.getUserName();
+        tcpUserName = userName.replace('@','!');
+
+        //check whether login success
+        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.MESSAGING_HOST, serviceID)) {
+
+            Properties properties = new Properties();
+            properties.put(Context.INITIAL_CONTEXT_FACTORY, StatusMonitorAgentConstants.QPID_ICF);
+            properties.put(StatusMonitorAgentConstants.CF_NAME_PREFIX +
+                    StatusMonitorAgentConstants.CF_NAME,
+                    getTCPConnectionURL(tcpUserName,
+                            authConfigBean.getPassword()));
+
+            if (log.isDebugEnabled()) {
+                log.debug("getTCPConnectionURL(username,password) = " +
+                        getTCPConnectionURL(tcpUserName,
+                                authConfigBean.getPassword()));
+            }
+            try {
+                InitialContext ctx = new InitialContext(properties);
+                // Lookup connection factory
+                QueueConnectionFactory connFactory =
+                        (QueueConnectionFactory) ctx.lookup(StatusMonitorAgentConstants.CF_NAME);
+                QueueConnection queueConnection = connFactory.createQueueConnection();
+                queueConnection.start();
+                QueueSession queueSession =
+                        queueConnection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+
+                // Send message
+                Queue queue = queueSession.createQueue(StatusMonitorAgentConstants.QUEUE_NAME_MB +
+                        ";{create:always, node:{durable: True}}");
+
+                // create the message to send
+                TextMessage textMessage = queueSession.createTextMessage("Test Message Hello");
+                javax.jms.QueueSender queueSender = queueSession.createSender(queue);
+                queueSender.setTimeToLive(100000000);
+
+                QueueReceiver queueReceiver = queueSession.createReceiver(queue);
+                queueSender.send(textMessage);
+
+                TextMessage message = (TextMessage) queueReceiver.receiveNoWait();
+
+                if (message.getText().equals("Test Message Hello")) {
+                    MySQLConnector.insertStats(serviceID, true);
+                    MySQLConnector.insertState(serviceID, true, "");
+                } else {
+                    MySQLConnector.insertStats(serviceID, false);
+                    MySQLConnector.insertState(serviceID, false, "Send and retrieve messages failed");
+                }
+                queueSender.close();
+                queueSession.close();
+                queueConnection.close();
+
+            } catch (JMSException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "Exception in executing the client - " +
+                        "Status Monitor Agent for MessageBrokerServiceClient";
+                log.warn(msg, e);
+
+            } catch (NamingException e) {
+                MySQLConnector.insertStats(serviceID, false);
+                MySQLConnector.insertState(serviceID, false, e.getMessage());
+                String msg = "Naming exception in executing the client - " +
+                        "Status Monitor agent for MessageBrokerServiceClient";
+                log.warn(msg, e);
+            }
+        }
+    }
+
+    private static String getTCPConnectionURL(String username, String password) {
+        return new StringBuffer()
+                .append("amqp://").append(tcpUserName).append(":").append(password).
+                        append("@").append(StatusMonitorAgentConstants.CARBON_CLIENT_ID).
+                        append("/").append(StatusMonitorAgentConstants.CARBON_VIRTUAL_HOST_NAME).
+                        append("?brokerlist='tcp://").append(StatusMonitorConstants.MESSAGING_HOST).
+                        append(":").append(StatusMonitorConstants.MESSAGING_DEFAULT_PORT).
+                        append("'").toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/constants/StatusMonitorAgentConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/constants/StatusMonitorAgentConstants.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/constants/StatusMonitorAgentConstants.java
new file mode 100644
index 0000000..4e650ba
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/constants/StatusMonitorAgentConstants.java
@@ -0,0 +1,55 @@
+/*
+ * 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.status.monitor.agent.constants;
+
+/**
+ * Constants specific to the Status Monitor Agents
+ */
+public class StatusMonitorAgentConstants {
+
+    /*CEP and MB Specific constants*/
+    public static final String QPID_ICF = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory";
+    public static final String CF_NAME_PREFIX = "connectionfactory.";
+    public static final String CF_NAME = "qpidConnectionfactory";
+
+    public static final String CARBON_CLIENT_ID = "carbon";
+    public static final String CARBON_VIRTUAL_HOST_NAME = "carbon";
+
+    /*CEP Server client specific constants*/
+    public static final String CEP_DEFAULT_PORT = "5674";
+    public static final String QUEUE_NAME_CEP = "testQueueQACEP1";
+
+    /*MB Server client specific constants*/
+    public static final String QUEUE_NAME_MB = "testQueueQA6";
+
+    /*Gadget Server specific constants*/
+    public static final String GS_SAMPLE_TEST_RESOURCE_PATH =
+            "/_system/config/repository/gadget-server/gadgets/AmazonSearchGadget/amazon-search.xml";
+    public static final String GREG_SAMPLE_TEST_RESOURCE_PATH =
+            "/_system/local/registry.txt";
+
+    /*TrustStore and Identity constants*/
+    public static final String TRUST_STORE = "javax.net.ssl.trustStore";
+    public static final String TRUST_STORE_PASSWORD = "javax.net.ssl.trustStorePassword";
+    public static final String TRUST_STORE_TYPE = "javax.net.ssl.trustStoreType";
+    public static final String AUTHENTICATION_ADMIN_PATH = "/services/AuthenticationAdmin";
+
+    /*Common constants*/
+    public static final String TENANT_SERVICES = "/services/t/";
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/internal/StatusMonitorAgentComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/internal/StatusMonitorAgentComponent.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/internal/StatusMonitorAgentComponent.java
new file mode 100644
index 0000000..bc07b30
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/internal/StatusMonitorAgentComponent.java
@@ -0,0 +1,110 @@
+/*
+ * 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.status.monitor.agent.internal;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+import org.apache.stratos.status.monitor.agent.clients.ClientThreadsInitializer;
+import org.apache.stratos.status.monitor.agent.internal.core.MySQLConnector;
+import org.apache.stratos.status.monitor.core.exception.StatusMonitorException;
+import org.apache.stratos.status.monitor.core.util.StatusMonitorUtil;
+import org.wso2.carbon.utils.ConfigurationContextService;
+
+/**
+ * @scr.component name="org.apache.stratos.status.monitor.agent" immediate="true"
+ * @scr.reference name="configuration.context.service"
+ * interface="org.wso2.carbon.utils.ConfigurationContextService"
+ * cardinality="1..1" policy="dynamic"
+ * bind="setConfigurationContextService"
+ * unbind="unsetConfigurationContextService"
+ */
+public class StatusMonitorAgentComponent {
+    private static Log log = LogFactory.getLog(StatusMonitorAgentComponent.class);
+
+    private static BundleContext bundleContext;
+    private static ConfigurationContextService configurationContextService;
+
+    protected void activate(ComponentContext context) {
+        try {
+            bundleContext = context.getBundleContext();
+            if (StatusMonitorUtil.getStatusMonitorConfiguration() == null) {
+                StatusMonitorUtil.initStatusMonitor(context.getBundleContext());
+                if (log.isDebugEnabled()) {
+                    log.debug("Status Monitor Agent initialized");
+                }
+            }
+            initConnector();
+            if (log.isDebugEnabled()) {
+                log.debug("******* Status Monitor agent bundle is activated ******* ");
+            }
+            ClientThreadsInitializer.initializeThreads();
+            if (log.isDebugEnabled()) {
+                log.debug("Client threads of the Status Monitor Agent are started.");
+            }
+        } catch (Exception e) {
+            log.error("******* Status Monitor agent bundle failed activating ****", e);
+        }
+    }
+
+    private void initConnector() throws StatusMonitorException {
+        try {
+            MySQLConnector.initialize();
+        } catch (Exception e) {
+            String msg = "Error in initializing the mysql connection for the health monitoring";
+            log.error(msg, e);
+            throw new StatusMonitorException(msg, e);
+        }
+    }
+
+    protected void deactivate(ComponentContext context) {
+        log.debug("******* Status Monitor bundle is deactivated ******* ");
+    }
+
+    protected void setConfigurationContextService(
+            ConfigurationContextService configurationContextService) {
+        log.debug("Receiving ConfigurationContext Service");
+        StatusMonitorAgentComponent.
+                configurationContextService = configurationContextService;
+
+    }
+
+    protected void unsetConfigurationContextService(
+            ConfigurationContextService configurationContextService) {
+        log.debug("Unsetting ConfigurationContext Service");
+        setConfigurationContextService(null);
+    }
+
+    public static BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    public static ConfigurationContextService getConfigurationContextService() {
+        return configurationContextService;
+    }
+
+    public static ConfigurationContext getConfigurationContext() {
+        if (configurationContextService.getServerConfigContext() == null) {
+            return null;
+        }
+        return configurationContextService.getServerConfigContext();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/internal/core/MySQLConnector.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/internal/core/MySQLConnector.java b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/internal/core/MySQLConnector.java
new file mode 100644
index 0000000..099ea14
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/internal/core/MySQLConnector.java
@@ -0,0 +1,277 @@
+/*
+ * 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.status.monitor.agent.internal.core;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * The class connecting with the mysql database for the Status Monitor Agent
+ */
+public class MySQLConnector {
+    private static Connection conn;
+    private static final Log log = LogFactory.getLog(MySQLConnector.class);
+
+    private static List<String> serviceList = new ArrayList<String>();
+    private static List<String> statusList = new ArrayList<String>();
+
+    private static int resolvedNotFixed = 0;
+    private static int resolvedWSLID;
+
+    /**
+     * gets the sql connection and initializes the MySQLConnectionInitializer.
+     *
+     * @return Static Connection
+     * @throws Exception, throws exception
+     */
+    public static Connection initialize() throws Exception {
+        //gets the sql connection.
+        conn = MySQLConnectionInitializer.initialize();
+
+        //initializes the service and state lists.
+        serviceList = MySQLConnectionInitializer.getServiceList();
+        statusList = MySQLConnectionInitializer.getStatusList();
+
+        if (log.isDebugEnabled()) {
+            log.debug("Connection to the status database is initialized from status.monitor");
+        }
+
+        return conn;
+    }
+
+    /**
+     * Inserts into the heartbeats table
+     *
+     * @param serviceID serviceId
+     * @param status    - status of the service
+     * @throws SQLException, if inserting the stats failed
+     */
+    public static void insertStats(int serviceID, Boolean status) throws SQLException {
+        String sql = StatusMonitorConstants.INSERT_STAT_SQL;
+        PreparedStatement pstmt = conn.prepareStatement(sql);
+        try {
+            pstmt.setString(1, null);
+            pstmt.setInt(2, serviceID);
+            pstmt.setBoolean(3, status);
+            pstmt.setString(4, null);
+            pstmt.executeUpdate();
+        } catch (SQLException e) {
+            String msg = "Inserting stats failed";
+            log.error(msg, e);
+            throw new SQLException(msg, e);
+        } finally {
+            pstmt.close();
+        }
+    }
+
+    /**
+     * Inserting state into the state table.
+     *
+     * @param serviceID, service id
+     * @param status,    status of the service {"Up & Running", "Broken", "Down", and "Fixed"}
+     * @param details,   the service state details.
+     * @throws SQLException, if writing to the database failed.
+     */
+    public static void insertState(int serviceID, Boolean status, String details) throws SQLException {
+
+        int stateID = MySQLConnectionInitializer.getServiceStateID(serviceID);
+        if (!status) {
+            insertStateDetails(stateID, status, details);
+        }
+
+        // boolean insertStatus = getInsertStatus(serviceID);
+        if (/*insertStatus & */(resolvedNotFixed == 0 || resolvedNotFixed == 1)) {
+            if (log.isDebugEnabled()) {
+                log.debug("Inserting data into the state database");
+            }
+            String sql = StatusMonitorConstants.INSERT_STATE_SQL;
+            PreparedStatement pstmt = conn.prepareStatement(sql);
+            try {
+
+                pstmt.setString(1, null);
+                pstmt.setInt(2, serviceID);
+                if (status) {
+                    pstmt.setInt(3, 1);
+                } else {
+                    pstmt.setInt(3, 2);
+                }
+                pstmt.setString(4, null);
+                pstmt.executeUpdate();
+            } catch (SQLException e) {
+                String msg = "Inserting state failed";
+                log.error(msg, e);
+                throw new SQLException(msg, e);
+            } finally {
+                resolvedWSLID = 0;
+                resolvedNotFixed = 0;
+                pstmt.close();
+            }
+        }
+
+        if (/*insertStatus & */resolvedNotFixed == 2) {
+            String sql = StatusMonitorConstants.UPDATE_STATE_SQL;
+            PreparedStatement pstmtUpdate = conn.prepareStatement(sql);
+            try {
+                if (status) {
+                    pstmtUpdate.setInt(1, 1);
+                } else {
+                    pstmtUpdate.setInt(1, 2);
+                }
+                pstmtUpdate.setInt(2, resolvedWSLID);
+                pstmtUpdate.executeUpdate();
+            } catch (SQLException e) {
+                String msg = "Inserting state failed";
+                log.error(msg, e);
+                throw new SQLException(msg, e);
+            } finally {
+                resolvedNotFixed = 0;
+                resolvedWSLID = 0;
+                pstmtUpdate.close();
+            }
+        }
+    }
+
+    /**
+     * Inserts the state details into the
+     *
+     * @param serviceStateID, service state ID
+     * @param status,         boolean: status of the service
+     * @param detail,         service state detail
+     * @throws SQLException, if writing to the database failed.
+     */
+    public static void insertStateDetails(int serviceStateID, boolean status, String detail) throws SQLException {
+
+        String sql = StatusMonitorConstants.INSERT_STATE_DETAIL_SQL;
+        PreparedStatement pstmt = conn.prepareStatement(sql);
+
+        try {
+            pstmt.setString(1, null);
+            pstmt.setInt(2, serviceStateID);
+            if (!status) {
+                pstmt.setString(3, detail);
+            }
+            pstmt.setString(4, null);
+            pstmt.executeUpdate();
+        } catch (SQLException e) {
+            String msg = "Inserting state details failed";
+            log.error(msg, e);
+            throw new SQLException(msg, e);
+        } finally {
+            pstmt.close();
+        }
+    }
+
+    /**
+     * Gets the insert status
+     *
+     * @param ServiceID, id of the service
+     * @return true, if insert status was successful
+     * @throws SQLException, if writing to the database failed.
+     */
+    public static boolean getInsertStatus(int ServiceID) throws SQLException {
+
+        ResultSet rs = null;
+        Statement stmtCon = null;
+        boolean currentStatus = false;
+        String sqlGetStateID = StatusMonitorConstants.SELECT_ALL_FROM_WSL_SERVICE_STATE_SQL + ServiceID +
+                StatusMonitorConstants.ORDER_BY_TIMESTAMP_SQL_DESC_LIMIT_01_SQL;
+
+        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+        Date SystemDate = new Date();
+        dateFormat.format(SystemDate);
+
+        int state_id;
+        Date date;
+        try {
+            stmtCon = conn.createStatement();
+            stmtCon.executeQuery(sqlGetStateID);
+            rs = stmtCon.getResultSet();
+            if (rs != null) {
+
+                while (rs.next()) {
+                    state_id = rs.getInt(StatusMonitorConstants.STATE_ID);
+
+                    if (state_id == 1) {
+                        if (log.isDebugEnabled()) {
+                            log.debug("Up and Running :" + state_id);
+                        }
+                        currentStatus = true;
+                    }
+
+                    if (state_id == 2) {
+                        if (log.isDebugEnabled()) {
+                            log.debug("Broken :" + state_id);
+                        }
+                        currentStatus = true;
+                    }
+
+                    if (state_id == 4) {
+                        currentStatus = true;
+                        date = rs.getTimestamp(StatusMonitorConstants.TIMESTAMP);
+                        resolvedWSLID = rs.getInt(StatusMonitorConstants.ID);
+
+                        long currentTimeMs = SystemDate.getTime();
+                        long resolvedTimeMs = date.getTime();
+
+                        double time_diff = ((currentTimeMs - resolvedTimeMs) / (double) StatusMonitorConstants.HOUR_IN_MILLIS);
+                        if (log.isDebugEnabled()) {
+                            log.debug("State ID: " + state_id);
+                        }
+                        if (time_diff >= 1.0) {
+                            resolvedNotFixed = 1;
+                        } else {
+                            resolvedNotFixed = 2;
+                        }
+                    }
+                }
+
+            } else {
+                currentStatus = true;
+            }
+        } catch (SQLException e) {
+            String msg = "Getting Insert state failed";
+            log.error(msg, e);
+            throw new SQLException(msg, e);
+        } finally {
+            if (rs != null) {
+                rs.close();
+            }
+            if (stmtCon != null) {
+                stmtCon.close();
+            }
+        }
+        return currentStatus;
+    }
+}
+
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.core/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.core/pom.xml b/components/org.apache.stratos.status.monitor.core/pom.xml
new file mode 100644
index 0000000..ecbcb02
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.core/pom.xml
@@ -0,0 +1,81 @@
+<!-- 
+  #  Licensed to the Apache Software Foundation (ASF) under one
+  #  or more contributor license agreements.  See the NOTICE file
+  #  distributed with this work for additional information
+  #  regarding copyright ownership.  The ASF licenses this file
+  #  to you under the Apache License, Version 2.0 (the
+  #  "License"); you may not use this file except in compliance
+  #  with the License.  You may obtain a copy of the License at
+  #  
+  #  http://www.apache.org/licenses/LICENSE-2.0
+  #  
+  #  Unless required by applicable law or agreed to in writing,
+  #  software distributed under the License is distributed on an
+  #  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  #  KIND, either express or implied.  See the License for the
+  #  specific language governing permissions and limitations
+  #  under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.stratos</groupId>
+        <artifactId>stratos-components-parent</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.stratos.status.monitor.core</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Stratos - Stratos Status Monitor Core</name>
+
+    <build>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </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>
+                        <Export-Package>
+                            org.apache.stratos.status.monitor.core.*,
+                        </Export-Package>
+                        <Private-Package>
+                            org.apache.stratos.status.monitor.core.internal.*,
+                        </Private-Package>
+                        <Import-Package>
+                            org.wso2.carbon.registry.core.*;version=1.0.1,
+                            javax.xml.namespace; version=0.0.0,
+                            javax.servlet;version="${imp.pkg.version.javax.servlet}",
+                            javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
+                            *;resolution:=optional
+                        </Import-Package>
+                        <DynamicImport-Package>*</DynamicImport-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.registry.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.common</artifactId>
+	    <version>3.0.0-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/StatusMonitorConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/StatusMonitorConfigurationBuilder.java b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/StatusMonitorConfigurationBuilder.java
new file mode 100644
index 0000000..071d995
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/StatusMonitorConfigurationBuilder.java
@@ -0,0 +1,247 @@
+/*
+ * 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.status.monitor.core;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.stratos.status.monitor.core.beans.AuthConfigBean;
+import org.apache.stratos.status.monitor.core.beans.SampleTenantConfigBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.exception.StatusMonitorException;
+import org.apache.commons.dbcp.BasicDataSource;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.Iterator;
+
+/**
+ * Builds the status monitor configurations from the configuration file, status-monitor-config.xml.
+ */
+public class StatusMonitorConfigurationBuilder {
+    private static final Log log = LogFactory.getLog(StatusMonitorConfigurationBuilder.class);
+    private static BasicDataSource dataSource;
+    private static AuthConfigBean authConfigBean;
+    private static SampleTenantConfigBean sampleTenantConfigBean;
+
+
+    public StatusMonitorConfigurationBuilder(String statusConfigFile) throws StatusMonitorException {
+        try {
+            OMElement statusConfig = buildOMElement(new FileInputStream(statusConfigFile));
+            deserialize(statusConfig);
+            if (log.isDebugEnabled()) {
+                log.debug("********Status Monitor Configuration Builder**********" + statusConfigFile);
+            }
+        } catch (FileNotFoundException e) {
+            String msg = "Unable to find the file responsible for status monitor configs: "
+                            + statusConfigFile;
+            log.error(msg, e);
+            throw new StatusMonitorException(msg, e);
+        }
+    }
+
+    private OMElement buildOMElement(InputStream inputStream) throws StatusMonitorException {
+        XMLStreamReader parser;
+        try {
+            parser = XMLInputFactory.newInstance().createXMLStreamReader(inputStream);
+        } catch (XMLStreamException e) {
+            String msg = "Error in initializing the parser to build the OMElement.";
+            log.error(msg, e);
+            throw new StatusMonitorException(msg, e);
+        }
+
+        StAXOMBuilder builder = new StAXOMBuilder(parser);
+        return builder.getDocumentElement();
+    }
+
+    /*
+       Deserialize the following
+       <billingConfig xmlns="http://wso2.com/carbon/status.monitor.config">
+           <dbConfig>
+                ...
+           </dbConfig>
+        </billingConfig>
+     */
+    private void deserialize(OMElement statusMonitorConfigEle) throws StatusMonitorException {
+        Iterator statusMonitorConfigChildIt = statusMonitorConfigEle.getChildElements();
+
+        while (statusMonitorConfigChildIt.hasNext()) {
+            OMElement statusMonitorConfigChildEle = (OMElement) statusMonitorConfigChildIt.next();
+
+            if (new QName(StatusMonitorConstants.CONFIG_NS, StatusMonitorConstants.DB_CONFIG,
+                    StatusMonitorConstants.NS_PREFIX).equals(statusMonitorConfigChildEle.getQName())) {
+                //element is "dbConfig"
+                initDataSource(statusMonitorConfigChildEle);
+            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
+                    StatusMonitorConstants.AUTH_CONFIG,
+                    StatusMonitorConstants.NS_PREFIX).equals(statusMonitorConfigChildEle.getQName())) {
+                //element is "authConfig"
+                initAuthentication(statusMonitorConfigChildEle);
+            } else if (new QName(StatusMonitorConstants.CONFIG_NS, StatusMonitorConstants.PS_CONFIG,
+                    StatusMonitorConstants.NS_PREFIX).equals(statusMonitorConfigChildEle.getQName())) {
+                //element is "psConfig"
+                initSampleServicesMonitoring(statusMonitorConfigChildEle);
+            } else {
+                String msg = "Unknown element in Status Monitor Configuration: " +
+                                statusMonitorConfigChildEle.getQName().getLocalPart();
+                log.warn(msg);
+            }
+        }
+    }
+
+    /*
+     * Deserialise dbConfigElement (Given below) and initialize data source
+        <dbConfig>
+            <url>jdbc:mysql://localhost:3306/stratos_stat</url>
+            <userName>monitor</userName>
+            <password>monitor</password>
+            <driverName>com.mysql.jdbc.Driver</driverName>
+            <maxActive>80</maxActive>
+            <maxWait>60000</maxWait>
+            <minIdle>5</minIdle>
+            <validationQuery>SELECT 1</validationQuery>
+        </dbConfig>
+     */
+    private void initDataSource(OMElement dbConfigEle) throws StatusMonitorException {
+        // initializing the data source and load the database configurations
+        Iterator dbConfigChildIt = dbConfigEle.getChildElements();
+        dataSource = new BasicDataSource();
+
+        while (dbConfigChildIt.hasNext()) {
+
+            OMElement dbConfigChildEle = (OMElement) dbConfigChildIt.next();
+            if (new QName(StatusMonitorConstants.CONFIG_NS, StatusMonitorConstants.DBCONFIG_URL,
+                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
+                dataSource.setUrl(dbConfigChildEle.getText());
+            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
+                    StatusMonitorConstants.DBCONFIG_USER_NAME,
+                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
+                dataSource.setUsername(dbConfigChildEle.getText());
+            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
+                    StatusMonitorConstants.DBCONFIG_PASSWORD,
+                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
+                dataSource.setPassword(dbConfigChildEle.getText());
+            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
+                    StatusMonitorConstants.DBCONFIG_DRIVER_NAME,
+                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
+                dataSource.setDriverClassName(dbConfigChildEle.getText());
+            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
+                    StatusMonitorConstants.DBCONFIG_MAX_ACTIVE,
+                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
+                dataSource.setMaxActive(Integer.parseInt(dbConfigChildEle.getText()));
+            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
+                    StatusMonitorConstants.DBCONFIG_MAX_WAIT,
+                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
+                dataSource.setMaxWait(Integer.parseInt(dbConfigChildEle.getText()));
+            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
+                    StatusMonitorConstants.DBCONFIG_MIN_IDLE,
+                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
+                dataSource.setMinIdle(Integer.parseInt(dbConfigChildEle.getText()));
+            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
+                    StatusMonitorConstants.DBCONFIG_VALIDATION_QUERY,
+                    StatusMonitorConstants.NS_PREFIX)
+                    .equals(dbConfigChildEle.getQName())) {
+                dataSource.setValidationQuery(dbConfigChildEle.getText());
+            } else {
+                String msg = "Unknown element in DBConfig of Status Monitor Configuration: " +
+                                dbConfigChildEle.getQName().getLocalPart();
+                log.warn(msg);
+            }
+        }
+    }
+
+    /*
+     * Deserialise authConfigElement (Given below) and initializes authConfigBean
+    <authConfig>
+         <jksLocation>/home/carbon/automation/projects/src/resources/wso2carbon.jks</jksLocation>
+         <userName>admin@wso2-heartbeat-checker.org</userName>
+         <password>password123</password>
+     </authConfig>
+     */
+    private void initAuthentication(OMElement authConfigEle) throws StatusMonitorException {
+        // initializing the and loading the authentication configurations
+        Iterator authConfigChildIt = authConfigEle.getChildElements();
+        authConfigBean = new AuthConfigBean();
+
+        while (authConfigChildIt.hasNext()) {
+            OMElement authConfigChildEle = (OMElement) authConfigChildIt.next();
+            if (new QName(StatusMonitorConstants.CONFIG_NS, StatusMonitorConstants.JKS_LOCATION,
+                    StatusMonitorConstants.NS_PREFIX).equals(authConfigChildEle.getQName())) {
+                authConfigBean.setJksLocation(authConfigChildEle.getText());
+            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
+                    StatusMonitorConstants.AUTHCONFIG_USER_NAME,
+                    StatusMonitorConstants.NS_PREFIX).equals(authConfigChildEle.getQName())) {
+                authConfigBean.setUserName(authConfigChildEle.getText());
+            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
+                    StatusMonitorConstants.AUTHCONFIG_PASSWORD,
+                    StatusMonitorConstants.NS_PREFIX).equals(authConfigChildEle.getQName())) {
+                authConfigBean.setPassword(authConfigChildEle.getText());
+            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
+                    StatusMonitorConstants.AUTHCONFIG_TENANT,
+                    StatusMonitorConstants.NS_PREFIX).equals(authConfigChildEle.getQName())) {
+                authConfigBean.setTenant(authConfigChildEle.getText());
+            } else {
+                String msg = "Unknown element in AuthConfig of Status Monitor Configuration: " +
+                                authConfigChildEle.getQName().getLocalPart();
+                log.warn(msg);
+            }
+        }
+    }
+
+    /**
+     <platformSample>
+              <tenantDomain>wso2.org</tenantDomain>
+     </platformSample>
+    */
+    private void initSampleServicesMonitoring (OMElement psConfigEle) throws StatusMonitorException {
+        // initializing the and loading the authentication configurations
+        Iterator psConfigChildIt = psConfigEle.getChildElements();
+        sampleTenantConfigBean = new SampleTenantConfigBean();
+
+        while (psConfigChildIt.hasNext()) {
+            OMElement psConfigChildEle = (OMElement) psConfigChildIt.next();
+            if (new QName(StatusMonitorConstants.CONFIG_NS, StatusMonitorConstants.PSCONFIG_TENANT,
+                    StatusMonitorConstants.NS_PREFIX).equals(psConfigChildEle.getQName())) {
+                sampleTenantConfigBean.setTenant(psConfigChildEle.getText());
+            } else {
+                String msg = "Unknown element in PSConfig of Status Monitor Configuration: " +
+                                psConfigChildEle.getQName().getLocalPart();
+                log.warn(msg);
+            }
+        }
+    }
+
+    public static BasicDataSource getDataSource() {
+        return dataSource;
+    }
+
+    public static AuthConfigBean getAuthConfigBean() {
+        return authConfigBean;
+    }
+
+    public static SampleTenantConfigBean getSampleTenantConfigBean() {
+        return sampleTenantConfigBean;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/beans/AuthConfigBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/beans/AuthConfigBean.java b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/beans/AuthConfigBean.java
new file mode 100644
index 0000000..a98d94a
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/beans/AuthConfigBean.java
@@ -0,0 +1,61 @@
+/*
+ * 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.status.monitor.core.beans;
+
+/**
+ * Authentication Configuration object that is read from the startus-monitor-config.xml.
+ */
+public class AuthConfigBean {
+    private String jksLocation;
+    private String userName;
+    private String password;
+    private String tenant;
+
+    public String getTenant() {
+        return tenant;
+    }
+
+    public void setTenant(String tenant) {
+        this.tenant = tenant;
+    }
+
+    public String getJksLocation() {
+        return jksLocation;
+    }
+
+    public void setJksLocation(String jksLocation) {
+        this.jksLocation = jksLocation;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/beans/SampleTenantConfigBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/beans/SampleTenantConfigBean.java b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/beans/SampleTenantConfigBean.java
new file mode 100644
index 0000000..5c25e0c
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor.core/src/main/java/org/apache/stratos/status/monitor/core/beans/SampleTenantConfigBean.java
@@ -0,0 +1,34 @@
+/*
+ * 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.status.monitor.core.beans;
+
+/**
+ * The tenant with the sample services installed.
+ */
+public class SampleTenantConfigBean {
+    private String tenant;
+
+    public String getTenant() {
+        return tenant;
+    }
+
+    public void setTenant(String tenant) {
+        this.tenant = tenant;
+    }
+}


[3/7] Applying 0001-Refactor-status-monitor-module.patch

Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/ESBServerClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/ESBServerClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/ESBServerClient.java
deleted file mode 100644
index b722d32..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/ESBServerClient.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
-* Copyright (c) 2012, 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.status.monitor.agent.clients.service;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.util.AXIOMUtil;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.agent.clients.common.ServiceLoginClient;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.beans.SampleTenantConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import javax.xml.stream.XMLStreamException;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.text.ParseException;
-
-/**
- * Status Monitor Agent client class for ESB
- */
-public class ESBServerClient extends Thread{
-
-    private static final Log log = LogFactory.getLog(ESBServerClient.class);
-    private static final AuthConfigBean authConfigBean =
-            StatusMonitorConfigurationBuilder.getAuthConfigBean();
-    private static final SampleTenantConfigBean sampleTenantConfigBean =
-            StatusMonitorConfigurationBuilder.getSampleTenantConfigBean();
-
-    private static int serviceID;
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (IOException e) {
-                log.error(e);
-            } catch (SQLException e) {
-                log.error(e);
-            } catch (ParseException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    private static OMElement createPayLoad() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace("http://service.carbon.wso2.org", "ns1");
-        OMElement method = fac.createOMElement("echoString", omNs);
-        OMElement value = fac.createOMElement("s", omNs);
-        value.addChild(fac.createOMText(value, "Hello World"));
-
-        method.addChild(value);
-        return method;
-    }
-
-    private static void executeService() throws IOException, SQLException, ParseException {
-
-        OMElement result = null;
-        OMElement payload = createPayLoad();
-        ServiceClient serviceclient = new ServiceClient();
-        Options opts = new Options();
-        opts.setTo(new EndpointReference(StatusMonitorConstants.ESB_HTTP + ":" +
-                StatusMonitorConstants.ESB_NHTTP_PORT +
-                StatusMonitorAgentConstants.TENANT_SERVICES +
-                authConfigBean.getTenant() + "/DemoProxy"));
-        opts.setAction("http://service.carbon.wso2.org/echoString");
-        serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.ESB);
-
-        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.ESB_HOST, serviceID)) {
-            serviceclient.setOptions(opts);
-            try {
-                result = serviceclient.sendReceive(payload);
-
-                if ((result.toString().indexOf("Hello World")) > 0) {
-                    executeProductPlatformSample();
-                } else {
-                    MySQLConnector.insertStats(serviceID, false);
-                    MySQLConnector.insertState(serviceID, false, "Service Invocation failed");
-                }
-
-            } catch (AxisFault e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "Error in executing service";
-                log.error(msg, e);
-            }
-            catch (NullPointerException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "NPE in executing the service";
-                log.error(msg, e);
-            }
-        }
-    }
-
-
-    private static boolean executeProductPlatformSample() throws IOException, SQLException, ParseException {
-        Boolean sampleStatus = false;
-        String payload = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
-                "   <soapenv:Header/>\n" +
-                "   <soapenv:Body/>\n" +
-                "</soapenv:Envelope>";
-        String action = "getAllCategories";
-
-        try {
-            OMElement result = null;
-            result = sendRequest(payload, action, new EndpointReference(
-                    StatusMonitorConstants.ESB_HTTP + ":" + StatusMonitorConstants.ESB_NHTTP_PORT +
-                            StatusMonitorAgentConstants.TENANT_SERVICES +
-                            sampleTenantConfigBean.getTenant() +
-                            "/ProductService"));
-
-            if ((result.toString().indexOf("Compact Lens-Shutter Cameras")) > 0) {
-                executeAdminServicePlatformSample();
-                sampleStatus = true;
-            } else {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, "Platform sample ProductService invocation failed");
-            }
-
-        } catch (AxisFault e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, "Platform sample: " + e.getMessage());
-            String msg = "Error in executing the product platform sample";
-            log.error(msg, e);
-        }
-        catch (NullPointerException e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, "Platform sample: " + e.getMessage());
-            String msg = "NPE in executing the product platform sample";
-            log.error(msg, e);
-        } catch (XMLStreamException e) {
-            String msg = "XMLStream exception in executing the product platform sample";
-            log.error(msg, e);
-        }
-        return sampleStatus;
-    }
-
-    private static boolean executeAdminServicePlatformSample() throws IOException, SQLException, ParseException {
-        Boolean sampleStatus = false;
-        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.ESB);
-        String payload = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
-                "   <soapenv:Header/>\n" +
-                "   <soapenv:Body/>\n" +
-                "</soapenv:Envelope>";
-        String action = "getAllCategories";
-
-        try {
-            OMElement result;
-            result = sendRequest(payload, action, new EndpointReference(
-                    StatusMonitorConstants.ESB_HTTP + ":" + StatusMonitorConstants.ESB_NHTTP_PORT +
-                            StatusMonitorAgentConstants.TENANT_SERVICES +
-                            sampleTenantConfigBean.getTenant() +
-                            "/AdminService"));
-
-            if ((result.toString().indexOf("Compact Lens-Shutter Cameras")) > 0) {
-                sampleStatus = true;
-                MySQLConnector.insertStats(serviceID, true);
-                MySQLConnector.insertState(serviceID, true, "");
-            } else {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, "Platform sample AdminService invocation failed");
-            }
-
-        } catch (AxisFault e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState( serviceID, false, "Platform sample AdminService: " + e.getMessage());
-            String msg = "Executing Admin Service Platform Sample failed";
-            log.error(msg, e);
-        }
-        catch (NullPointerException e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, "Platform sample AdminService: " + e.getMessage());
-            String msg = "NPE in executing the admin service platform sample";
-            log.error(msg, e);
-        } catch (XMLStreamException e) {
-            String msg = "XMLStreamException in executing the admin service platform sample";
-            log.error(msg, e);
-        }
-
-        return sampleStatus;
-    }
-
-    private static OMElement sendRequest(String payloadStr, String action, EndpointReference targetEPR)
-            throws XMLStreamException, AxisFault {
-        OMElement payload = AXIOMUtil.stringToOM(payloadStr);
-        Options options = new Options();
-        options.setTo(targetEPR);
-        options.setAction("urn:" + action); //since soapAction = ""
-
-        //Blocking invocation
-        ServiceClient sender = new ServiceClient();
-        sender.setOptions(options);
-        if (log.isDebugEnabled()) {
-            log.debug("Request: "+ payload.toString());
-        }
-        OMElement result = sender.sendReceive(payload);
-        if (log.isDebugEnabled()) {
-            log.debug("Response:" + payload.toString());
-        }
-
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/GadgetServerClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/GadgetServerClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/GadgetServerClient.java
deleted file mode 100644
index 97b3c55..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/GadgetServerClient.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-* Copyright (c) 2012, 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.status.monitor.agent.clients.service;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.registry.app.RemoteRegistry;
-import org.wso2.carbon.registry.core.Resource;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.status.monitor.agent.clients.common.ServiceLoginClient;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.sql.SQLException;
-import java.text.ParseException;
-
-/**
- * Status Monitor Agent client class for Gadget Server
- */
-public class GadgetServerClient extends Thread{
-
-    private static final Log log = LogFactory.getLog(GadgetServerClient.class);
-    private static final AuthConfigBean authConfigBean =
-            StatusMonitorConfigurationBuilder.getAuthConfigBean();
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (IOException e) {
-                log.error(e);
-            } catch (SQLException e) {
-                log.error(e);
-            } catch (ParseException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    static RemoteRegistry registry = null;
-
-    private static void executeService() throws IOException, SQLException, ParseException {
-        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.GADGET);
-
-        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.GADGETS_HOST, serviceID)) {
-            try {
-                registry = new RemoteRegistry(new URL(StatusMonitorConstants.GADGETS_HTTP +
-                        "/t/" + authConfigBean.getTenant() + "/registry"),
-                        authConfigBean.getUserName(), authConfigBean.getPassword());
-            } catch (RegistryException e) {
-                log.error(e);
-            } catch (MalformedURLException e) {
-                log.error(e);
-            }
-
-            /*get resource */
-            try {
-                Resource r2 = registry.get(StatusMonitorAgentConstants.GS_SAMPLE_TEST_RESOURCE_PATH);
-                if(log.isDebugEnabled()) {
-                    log.debug("MediaType in the executeService() of GadgetServerClient in Status" +
-                            " Monitor Agent: " + r2.getMediaType());
-                }
-
-                if (r2.getMediaType().equalsIgnoreCase("application/vnd.wso2-gadget+xml")) {
-                    MySQLConnector.insertStats(serviceID, true);
-                    MySQLConnector.insertState(serviceID, true, "");
-                }
-            } catch (RegistryException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "Exception in executing the service for GadgetServerClient - Status Monitor Agent";
-                log.error(msg, e);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/GovernanceRegistryServerClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/GovernanceRegistryServerClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/GovernanceRegistryServerClient.java
deleted file mode 100644
index eb25db7..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/GovernanceRegistryServerClient.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
-* Copyright (c) 2012, 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.status.monitor.agent.clients.service;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.registry.app.RemoteRegistry;
-import org.wso2.carbon.registry.core.Resource;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.status.monitor.agent.clients.common.ServiceLoginClient;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.sql.SQLException;
-import java.text.ParseException;
-
-/**
- * Status Monitor Agent client class for Governance Registry
- */
-public class GovernanceRegistryServerClient extends Thread{
-    private static final Log log = LogFactory.getLog(GovernanceRegistryServerClient.class);
-    private static final AuthConfigBean authConfigBean =
-            StatusMonitorConfigurationBuilder.getAuthConfigBean();
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (IOException e) {
-                log.error(e);
-            } catch (SQLException e) {
-                log.error(e);
-            } catch (ParseException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    static RemoteRegistry registry = null;
-
-    private static void executeService() throws IOException, SQLException, ParseException {
-        boolean getValue = false;
-        boolean putValue = false;
-        boolean deleteValue = false;
-        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.GOVERNANCE);
-
-        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.GOVERNANCE_HOST, serviceID)) {
-            try {
-
-                registry = new RemoteRegistry(new URL(StatusMonitorConstants.GOVERNANCE_HTTP +
-                        "/t/" + authConfigBean.getTenant() + "/registry"),
-                        authConfigBean.getUserName(), authConfigBean.getPassword());
-            } catch (RegistryException e) {
-                log.error(e);
-            } catch (MalformedURLException e) {
-                log.error(e);
-            } catch (Exception e) {
-                log.error(e);
-            }
-
-            /*put resource */
-            Resource r1;
-
-            try {
-                r1 = registry.newResource();
-                r1.setContent("test content".getBytes());
-                r1.setMediaType("text/plain");
-                String pathValue = registry.put(
-                        StatusMonitorAgentConstants.GREG_SAMPLE_TEST_RESOURCE_PATH, r1);
-
-                if (pathValue.equalsIgnoreCase(
-                        StatusMonitorAgentConstants.GREG_SAMPLE_TEST_RESOURCE_PATH)) {
-                    putValue = true;
-                }
-            } catch (RegistryException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                log.warn(e);
-            } catch (Exception e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                log.warn(e);
-            }
-
-            /*get resource */
-            try {
-                if (putValue) {
-                    Resource r2 = registry.get(
-                            StatusMonitorAgentConstants.GREG_SAMPLE_TEST_RESOURCE_PATH);
-                    if (log.isDebugEnabled()) {
-                        log.debug("Media Type: " + r2.getMediaType());
-                    }
-
-                    if (r2.getMediaType().equalsIgnoreCase("text/plain")) {
-                        getValue = true;
-                    }
-                }
-            } catch (RegistryException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                log.warn(e);
-            } catch (Exception e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                log.warn(e);
-            }
-
-            /*Delete resource */
-            try {
-                if (getValue) {
-                    registry.delete(StatusMonitorAgentConstants.GREG_SAMPLE_TEST_RESOURCE_PATH);
-
-                    if (!registry.resourceExists(
-                            StatusMonitorAgentConstants.GREG_SAMPLE_TEST_RESOURCE_PATH)) {
-                        deleteValue = true;
-                    }
-                }
-
-            } catch (RegistryException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                log.warn(e);
-            } catch (Exception e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                log.warn(e);
-            }
-
-            //write to mysql db
-            try {
-                if (getValue & putValue & deleteValue) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("Governance Registry Status Monitor agent: Writing to the database");
-                    }
-                    MySQLConnector.insertStats(serviceID, true);
-                    MySQLConnector.insertState(serviceID, true, "");
-                }
-            } catch (SQLException e) {
-                String msg = "Error in writing to the database for Governance Registry - status monitor agent";
-                log.error(msg, e);
-            }
-        }
-    }
-}
-
-
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/IdentityServerClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/IdentityServerClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/IdentityServerClient.java
deleted file mode 100644
index bceeb45..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/IdentityServerClient.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
-* Copyright (c) 2012, 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.status.monitor.agent.clients.service;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.authenticator.stub.AuthenticationAdminStub;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import java.io.File;
-import java.io.IOException;
-import java.sql.SQLException;
-
-/**
- * Status Monitor Agent client class for Identity Server
- */
-public class IdentityServerClient extends Thread{
-    private static final Log log = LogFactory.getLog(IdentityServerClient.class);
-    private static AuthConfigBean authConfigBean =
-            StatusMonitorConfigurationBuilder.getAuthConfigBean();
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (IOException e) {
-                log.error(e);
-            } catch (SQLException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    private static void executeService() throws SQLException, IOException {
-
-        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE, authConfigBean.getJksLocation());
-        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE_PASSWORD, "wso2carbon");
-        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE_TYPE, "JKS");
-
-        File newFile = new File(authConfigBean.getJksLocation());
-        if(log.isDebugEnabled()){
-            log.debug("Canonical Path: " + newFile.getCanonicalPath());
-        }
-
-        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.IDENTITY);
-        String authenticationServiceURL = StatusMonitorConstants.IDENTITY_HTTPS +
-                StatusMonitorAgentConstants.AUTHENTICATION_ADMIN_PATH;
-        AuthenticationAdminStub authenticationAdminStub;
-        try {
-            authenticationAdminStub = new AuthenticationAdminStub(authenticationServiceURL);
-            ServiceClient client = authenticationAdminStub._getServiceClient();
-            Options options = client.getOptions();
-            options.setManageSession(true);
-
-            Boolean status;
-            status = authenticationAdminStub.login(authConfigBean.getUserName(),
-                    authConfigBean.getPassword(), StatusMonitorConstants.IDENTITY_HOST);
-            ServiceContext serviceContext = authenticationAdminStub.
-                    _getServiceClient().getLastOperationContext().getServiceContext();
-            // String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
-
-            if (status) {
-                MySQLConnector.insertStats(serviceID, true);
-                MySQLConnector.insertState(serviceID, true, "");
-            }
-        } catch (AxisFault e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, e.getMessage());
-            String msg = "Fault in executing the service for IS client - Status Monitor Agent";
-            log.warn(msg, e);
-
-        } catch (Exception e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, e.getMessage());
-            String msg = "Exception in executing the service for IS client - Status Monitor Agent";
-            log.warn(msg, e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/ManagerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/ManagerServiceClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/ManagerServiceClient.java
deleted file mode 100644
index 2f225e0..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/ManagerServiceClient.java
+++ /dev/null
@@ -1,111 +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.status.monitor.agent.clients.service;
-
-import org.apache.axis2.client.Options;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.authenticator.stub.AuthenticationAdminStub;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import java.io.IOException;
-import java.sql.SQLException;
-
-/**
- * Status Monitor Agent client class for Stratos Manager
- */
-public class ManagerServiceClient extends Thread{
-
-    private static final Log log = LogFactory.getLog(ManagerServiceClient.class);
-    private static final AuthConfigBean authConfigBean =
-            StatusMonitorConfigurationBuilder.getAuthConfigBean();
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (IOException e) {
-                log.error(e);
-            } catch (SQLException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    private static void executeService() throws SQLException, IOException {
-
-        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE, authConfigBean.getJksLocation());
-        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE_PASSWORD, "wso2carbon");
-        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE_TYPE, "JKS");
-
-        String userName = authConfigBean.getUserName();
-        String password = authConfigBean.getPassword();
-        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.MANAGER);
-        String authenticationServiceURL = StatusMonitorConstants.MANAGER_HTTPS +
-                StatusMonitorAgentConstants.AUTHENTICATION_ADMIN_PATH;
-        AuthenticationAdminStub authenticationAdminStub;
-        try {
-            authenticationAdminStub = new AuthenticationAdminStub(authenticationServiceURL);
-            ServiceClient client = authenticationAdminStub._getServiceClient();
-            Options options = client.getOptions();
-            options.setManageSession(true);
-
-            Boolean status;
-            status = authenticationAdminStub.login(userName, password,
-                    StatusMonitorConstants.MANAGER_HOST);
-            ServiceContext serviceContext = authenticationAdminStub.
-                    _getServiceClient().getLastOperationContext().getServiceContext();
-            // String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
-
-            if (status) {
-                MySQLConnector.insertStats(serviceID, true);
-                MySQLConnector.insertState(serviceID, true, "");
-            }
-        } catch (AxisFault e) {
-            MySQLConnector.insertStats(serviceID, false);
-
-            MySQLConnector.insertState(serviceID, false, e.getMessage());
-            String msg = "Fault in executing the service - Status Monitor Agent for Manager";
-            log.warn(msg, e);
-        } catch (Exception e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, e.getMessage());
-            String msg = "Exception in executing the service - Status Monitor Agent for Manager";
-            log.warn(msg, e);
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/MashupServerClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/MashupServerClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/MashupServerClient.java
deleted file mode 100644
index 0acd932..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/MashupServerClient.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
-* Copyright (c) 2012, 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.status.monitor.agent.clients.service;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.agent.clients.common.ServiceLoginClient;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.beans.SampleTenantConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import javax.xml.stream.XMLStreamException;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.text.ParseException;
-
-/**
- * Status Monitor Agent client class for Mashup Server
- */
-public class MashupServerClient extends Thread{
-
-    private static final Log log = LogFactory.getLog(MashupServerClient.class);
-    private static final AuthConfigBean authConfigBean =
-            StatusMonitorConfigurationBuilder.getAuthConfigBean();
-    private static final SampleTenantConfigBean sampleTenantConfigBean =
-            StatusMonitorConfigurationBuilder.getSampleTenantConfigBean();
-    private static int serviceID;
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (IOException e) {
-                log.error(e);
-            } catch (SQLException e) {
-                log.error(e);
-            } catch (ParseException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    private static OMElement createPayLoad() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace("http://services.mashup.wso2.org/schemaTest1", "ns1");
-        OMElement method = fac.createOMElement("echoJSString", omNs);
-        OMElement value = fac.createOMElement("param", null);
-        value.addChild(fac.createOMText(value, "Hello World"));
-        method.addChild(value);
-        return method;
-    }
-
-    private static void executeService() throws IOException, SQLException, ParseException {
-
-        serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.MASHUP);
-
-        OMElement result;
-        OMElement payload = createPayLoad();
-        ServiceClient serviceclient = new ServiceClient();
-        Options opts = new Options();
-
-        opts.setTo(new EndpointReference(StatusMonitorConstants.MASHUP_HTTP +
-                StatusMonitorAgentConstants.TENANT_SERVICES + authConfigBean.getTenant() +
-                "/test123/schemaTest1/ "));
-        opts.setAction("http://services.mashup.wso2.org/schemaTest1");
-
-        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.MASHUP_HOST, serviceID)) {
-            serviceclient.setOptions(opts);
-            try {
-                result = serviceclient.sendReceive(payload);
-
-                if ((result.toString().indexOf("Hello World")) > 0) {
-                    if (executeRelatedProductsService()) {
-                        MySQLConnector.insertStats(serviceID, true);
-                        MySQLConnector.insertState(serviceID, true, "");
-                    }
-                } else {
-                    MySQLConnector.insertStats(serviceID, false);
-                    MySQLConnector.insertState(serviceID, false, "Service Invocation failed");
-                }
-
-            } catch (AxisFault e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "Error in executing the service - Status Monitor Agent for MashupServerClient";
-                log.warn(msg, e);
-            }
-            catch (NullPointerException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "NPE in executing the service - Status Monitor Agent for MashupServerClient";
-                log.warn(msg, e);
-            } catch (XMLStreamException e) {
-                String msg = "XMLStreamException in execting the service - Status Monitor Agent for MashupServerClient";
-                log.warn(msg, e);
-            }
-        }
-    }
-
-    private static Boolean executeRelatedProductsService() throws IOException, SQLException, ParseException, XMLStreamException {
-
-        Boolean relatedProductsServiceStatus = false;
-
-        OMElement result;
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace("http://services.mashup.wso2.org/RelatedProducts?xsd", "rel");
-        OMElement payload = fac.createOMElement("getRelatedProducts", omNs);
-        OMElement value1 = fac.createOMElement("query", null);
-        OMElement value2 = fac.createOMElement("count", null);
-        OMElement value3 = fac.createOMElement("format", null);
-        value1.addChild(fac.createOMText(value1, "mac"));
-        value2.addChild(fac.createOMText(value2, "2"));
-        value3.addChild(fac.createOMText(value3, "xml"));
-
-        payload.addChild(value1);
-        payload.addChild(value2);
-        payload.addChild(value3);
-
-        ServiceClient serviceclient = new ServiceClient();
-        Options opts = new Options();
-        opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
-
-        opts.setTo(new EndpointReference(StatusMonitorConstants.MASHUP_HTTP +
-                StatusMonitorAgentConstants.TENANT_SERVICES +
-                sampleTenantConfigBean.getTenant() + "/carbon/RelatedProducts"));
-        opts.setAction("http://services.mashup.wso2.org/RelatedProducts?xsd/RelatedProducts");
-
-        serviceclient.setOptions(opts);
-        try {
-            result = serviceclient.sendReceive(payload);
-
-            if ((result.toString().contains("New USB Graphics Drawing Tablet Mouse Pad"))) {
-                relatedProductsServiceStatus = true;
-            } else {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, "Platform Sample: RelatedProducts service Invocation failed");
-            }
-        } catch (AxisFault e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, "Platform Sample: RelatedProducts - " + e.getMessage());
-            String msg = "Error in executing the related products service";
-            log.warn(msg, e);
-        }
-        catch (NullPointerException e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, "Platform Sample: RelatedProducts - " + e.getMessage());
-            String msg = "NPE in executing the related products service";
-            log.warn(msg, e);
-        }
-        return relatedProductsServiceStatus;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/MessageBrokerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/MessageBrokerServiceClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/MessageBrokerServiceClient.java
deleted file mode 100644
index 02ed7a4..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/MessageBrokerServiceClient.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
-* Copyright (c) 2012, 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.status.monitor.agent.clients.service;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.agent.clients.common.ServiceLoginClient;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueReceiver;
-import javax.jms.QueueSession;
-import javax.jms.TextMessage;
-import javax.jms.QueueConnectionFactory;
-
-/**
- * Status Monitor Agent client class for Message Broker Service
- */
-public class MessageBrokerServiceClient extends Thread{
-
-    private static final Log log = LogFactory.getLog(MessageBrokerServiceClient.class);
-    private static String tcpUserName;
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (SQLException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    private static void executeService() throws SQLException {
-        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.MESSAGING);
-        AuthConfigBean authConfigBean = StatusMonitorConfigurationBuilder.getAuthConfigBean();
-
-        String userName = authConfigBean.getUserName();
-        tcpUserName = userName.replace('@','!');
-
-        //check whether login success
-        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.MESSAGING_HOST, serviceID)) {
-
-            Properties properties = new Properties();
-            properties.put(Context.INITIAL_CONTEXT_FACTORY, StatusMonitorAgentConstants.QPID_ICF);
-            properties.put(StatusMonitorAgentConstants.CF_NAME_PREFIX +
-                    StatusMonitorAgentConstants.CF_NAME,
-                    getTCPConnectionURL(tcpUserName,
-                            authConfigBean.getPassword()));
-
-            if (log.isDebugEnabled()) {
-                log.debug("getTCPConnectionURL(username,password) = " +
-                        getTCPConnectionURL(tcpUserName,
-                                authConfigBean.getPassword()));
-            }
-            try {
-                InitialContext ctx = new InitialContext(properties);
-                // Lookup connection factory
-                QueueConnectionFactory connFactory =
-                        (QueueConnectionFactory) ctx.lookup(StatusMonitorAgentConstants.CF_NAME);
-                QueueConnection queueConnection = connFactory.createQueueConnection();
-                queueConnection.start();
-                QueueSession queueSession =
-                        queueConnection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
-
-                // Send message
-                Queue queue = queueSession.createQueue(StatusMonitorAgentConstants.QUEUE_NAME_MB +
-                        ";{create:always, node:{durable: True}}");
-
-                // create the message to send
-                TextMessage textMessage = queueSession.createTextMessage("Test Message Hello");
-                javax.jms.QueueSender queueSender = queueSession.createSender(queue);
-                queueSender.setTimeToLive(100000000);
-
-                QueueReceiver queueReceiver = queueSession.createReceiver(queue);
-                queueSender.send(textMessage);
-
-                TextMessage message = (TextMessage) queueReceiver.receiveNoWait();
-
-                if (message.getText().equals("Test Message Hello")) {
-                    MySQLConnector.insertStats(serviceID, true);
-                    MySQLConnector.insertState(serviceID, true, "");
-                } else {
-                    MySQLConnector.insertStats(serviceID, false);
-                    MySQLConnector.insertState(serviceID, false, "Send and retrieve messages failed");
-                }
-                queueSender.close();
-                queueSession.close();
-                queueConnection.close();
-
-            } catch (JMSException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "Exception in executing the client - " +
-                        "Status Monitor Agent for MessageBrokerServiceClient";
-                log.warn(msg, e);
-
-            } catch (NamingException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "Naming exception in executing the client - " +
-                        "Status Monitor agent for MessageBrokerServiceClient";
-                log.warn(msg, e);
-            }
-        }
-    }
-
-    private static String getTCPConnectionURL(String username, String password) {
-        return new StringBuffer()
-                .append("amqp://").append(tcpUserName).append(":").append(password).
-                        append("@").append(StatusMonitorAgentConstants.CARBON_CLIENT_ID).
-                        append("/").append(StatusMonitorAgentConstants.CARBON_VIRTUAL_HOST_NAME).
-                        append("?brokerlist='tcp://").append(StatusMonitorConstants.MESSAGING_HOST).
-                        append(":").append(StatusMonitorConstants.MESSAGING_DEFAULT_PORT).
-                        append("'").toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/constants/StatusMonitorAgentConstants.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/constants/StatusMonitorAgentConstants.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/constants/StatusMonitorAgentConstants.java
deleted file mode 100644
index f504af3..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/constants/StatusMonitorAgentConstants.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.agent.constants;
-
-/**
- * Constants specific to the Status Monitor Agents
- */
-public class StatusMonitorAgentConstants {
-
-    /*CEP and MB Specific constants*/
-    public static final String QPID_ICF = "org.apache.qpid.jndi.PropertiesFileInitialContextFactory";
-    public static final String CF_NAME_PREFIX = "connectionfactory.";
-    public static final String CF_NAME = "qpidConnectionfactory";
-
-    public static final String CARBON_CLIENT_ID = "carbon";
-    public static final String CARBON_VIRTUAL_HOST_NAME = "carbon";
-
-    /*CEP Server client specific constants*/
-    public static final String CEP_DEFAULT_PORT = "5674";
-    public static final String QUEUE_NAME_CEP = "testQueueQACEP1";
-
-    /*MB Server client specific constants*/
-    public static final String QUEUE_NAME_MB = "testQueueQA6";
-
-    /*Gadget Server specific constants*/
-    public static final String GS_SAMPLE_TEST_RESOURCE_PATH =
-            "/_system/config/repository/gadget-server/gadgets/AmazonSearchGadget/amazon-search.xml";
-    public static final String GREG_SAMPLE_TEST_RESOURCE_PATH =
-            "/_system/local/registry.txt";
-
-    /*TrustStore and Identity constants*/
-    public static final String TRUST_STORE = "javax.net.ssl.trustStore";
-    public static final String TRUST_STORE_PASSWORD = "javax.net.ssl.trustStorePassword";
-    public static final String TRUST_STORE_TYPE = "javax.net.ssl.trustStoreType";
-    public static final String AUTHENTICATION_ADMIN_PATH = "/services/AuthenticationAdmin";
-
-    /*Common constants*/
-    public static final String TENANT_SERVICES = "/services/t/";
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/internal/StatusMonitorAgentComponent.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/internal/StatusMonitorAgentComponent.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/internal/StatusMonitorAgentComponent.java
deleted file mode 100644
index 765214e..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/internal/StatusMonitorAgentComponent.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
-*  Copyright (c) 2005-2012, 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.status.monitor.agent.internal;
-
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.ComponentContext;
-import org.wso2.carbon.status.monitor.agent.clients.ClientThreadsInitializer;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.exception.StatusMonitorException;
-import org.wso2.carbon.status.monitor.core.util.StatusMonitorUtil;
-import org.wso2.carbon.utils.ConfigurationContextService;
-
-/**
- * @scr.component name="org.wso2.carbon.status.monitor.agent" immediate="true"
- * @scr.reference name="configuration.context.service"
- * interface="org.wso2.carbon.utils.ConfigurationContextService"
- * cardinality="1..1" policy="dynamic"
- * bind="setConfigurationContextService"
- * unbind="unsetConfigurationContextService"
- */
-public class StatusMonitorAgentComponent {
-    private static Log log = LogFactory.getLog(StatusMonitorAgentComponent.class);
-
-    private static BundleContext bundleContext;
-    private static ConfigurationContextService configurationContextService;
-
-    protected void activate(ComponentContext context) {
-        try {
-            bundleContext = context.getBundleContext();
-            if (StatusMonitorUtil.getStatusMonitorConfiguration() == null) {
-                StatusMonitorUtil.initStatusMonitor(context.getBundleContext());
-                if (log.isDebugEnabled()) {
-                    log.debug("Status Monitor Agent initialized");
-                }
-            }
-            initConnector();
-            if (log.isDebugEnabled()) {
-                log.debug("******* Status Monitor agent bundle is activated ******* ");
-            }
-            ClientThreadsInitializer.initializeThreads();
-            if (log.isDebugEnabled()) {
-                log.debug("Client threads of the Status Monitor Agent are started.");
-            }
-        } catch (Exception e) {
-            log.error("******* Status Monitor agent bundle failed activating ****", e);
-        }
-    }
-
-    private void initConnector() throws StatusMonitorException {
-        try {
-            MySQLConnector.initialize();
-        } catch (Exception e) {
-            String msg = "Error in initializing the mysql connection for the health monitoring";
-            log.error(msg, e);
-            throw new StatusMonitorException(msg, e);
-        }
-    }
-
-    protected void deactivate(ComponentContext context) {
-        log.debug("******* Status Monitor bundle is deactivated ******* ");
-    }
-
-    protected void setConfigurationContextService(
-            ConfigurationContextService configurationContextService) {
-        log.debug("Receiving ConfigurationContext Service");
-        StatusMonitorAgentComponent.
-                configurationContextService = configurationContextService;
-
-    }
-
-    protected void unsetConfigurationContextService(
-            ConfigurationContextService configurationContextService) {
-        log.debug("Unsetting ConfigurationContext Service");
-        setConfigurationContextService(null);
-    }
-
-    public static BundleContext getBundleContext() {
-        return bundleContext;
-    }
-
-    public static ConfigurationContextService getConfigurationContextService() {
-        return configurationContextService;
-    }
-
-    public static ConfigurationContext getConfigurationContext() {
-        if (configurationContextService.getServerConfigContext() == null) {
-            return null;
-        }
-        return configurationContextService.getServerConfigContext();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/internal/core/MySQLConnector.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/internal/core/MySQLConnector.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/internal/core/MySQLConnector.java
deleted file mode 100644
index 920c5df..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/internal/core/MySQLConnector.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.agent.internal.core;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * The class connecting with the mysql database for the Status Monitor Agent
- */
-public class MySQLConnector {
-    private static Connection conn;
-    private static final Log log = LogFactory.getLog(MySQLConnector.class);
-
-    private static List<String> serviceList = new ArrayList<String>();
-    private static List<String> statusList = new ArrayList<String>();
-
-    private static int resolvedNotFixed = 0;
-    private static int resolvedWSLID;
-
-    /**
-     * gets the sql connection and initializes the MySQLConnectionInitializer.
-     *
-     * @return Static Connection
-     * @throws Exception, throws exception
-     */
-    public static Connection initialize() throws Exception {
-        //gets the sql connection.
-        conn = MySQLConnectionInitializer.initialize();
-
-        //initializes the service and state lists.
-        serviceList = MySQLConnectionInitializer.getServiceList();
-        statusList = MySQLConnectionInitializer.getStatusList();
-
-        if (log.isDebugEnabled()) {
-            log.debug("Connection to the status database is initialized from status.monitor");
-        }
-
-        return conn;
-    }
-
-    /**
-     * Inserts into the heartbeats table
-     *
-     * @param serviceID serviceId
-     * @param status    - status of the service
-     * @throws SQLException, if inserting the stats failed
-     */
-    public static void insertStats(int serviceID, Boolean status) throws SQLException {
-        String sql = StatusMonitorConstants.INSERT_STAT_SQL;
-        PreparedStatement pstmt = conn.prepareStatement(sql);
-        try {
-            pstmt.setString(1, null);
-            pstmt.setInt(2, serviceID);
-            pstmt.setBoolean(3, status);
-            pstmt.setString(4, null);
-            pstmt.executeUpdate();
-        } catch (SQLException e) {
-            String msg = "Inserting stats failed";
-            log.error(msg, e);
-            throw new SQLException(msg, e);
-        } finally {
-            pstmt.close();
-        }
-    }
-
-    /**
-     * Inserting state into the state table.
-     *
-     * @param serviceID, service id
-     * @param status,    status of the service {"Up & Running", "Broken", "Down", and "Fixed"}
-     * @param details,   the service state details.
-     * @throws SQLException, if writing to the database failed.
-     */
-    public static void insertState(int serviceID, Boolean status, String details) throws SQLException {
-
-        int stateID = MySQLConnectionInitializer.getServiceStateID(serviceID);
-        if (!status) {
-            insertStateDetails(stateID, status, details);
-        }
-
-        // boolean insertStatus = getInsertStatus(serviceID);
-        if (/*insertStatus & */(resolvedNotFixed == 0 || resolvedNotFixed == 1)) {
-            if (log.isDebugEnabled()) {
-                log.debug("Inserting data into the state database");
-            }
-            String sql = StatusMonitorConstants.INSERT_STATE_SQL;
-            PreparedStatement pstmt = conn.prepareStatement(sql);
-            try {
-
-                pstmt.setString(1, null);
-                pstmt.setInt(2, serviceID);
-                if (status) {
-                    pstmt.setInt(3, 1);
-                } else {
-                    pstmt.setInt(3, 2);
-                }
-                pstmt.setString(4, null);
-                pstmt.executeUpdate();
-            } catch (SQLException e) {
-                String msg = "Inserting state failed";
-                log.error(msg, e);
-                throw new SQLException(msg, e);
-            } finally {
-                resolvedWSLID = 0;
-                resolvedNotFixed = 0;
-                pstmt.close();
-            }
-        }
-
-        if (/*insertStatus & */resolvedNotFixed == 2) {
-            String sql = StatusMonitorConstants.UPDATE_STATE_SQL;
-            PreparedStatement pstmtUpdate = conn.prepareStatement(sql);
-            try {
-                if (status) {
-                    pstmtUpdate.setInt(1, 1);
-                } else {
-                    pstmtUpdate.setInt(1, 2);
-                }
-                pstmtUpdate.setInt(2, resolvedWSLID);
-                pstmtUpdate.executeUpdate();
-            } catch (SQLException e) {
-                String msg = "Inserting state failed";
-                log.error(msg, e);
-                throw new SQLException(msg, e);
-            } finally {
-                resolvedNotFixed = 0;
-                resolvedWSLID = 0;
-                pstmtUpdate.close();
-            }
-        }
-    }
-
-    /**
-     * Inserts the state details into the
-     *
-     * @param serviceStateID, service state ID
-     * @param status,         boolean: status of the service
-     * @param detail,         service state detail
-     * @throws SQLException, if writing to the database failed.
-     */
-    public static void insertStateDetails(int serviceStateID, boolean status, String detail) throws SQLException {
-
-        String sql = StatusMonitorConstants.INSERT_STATE_DETAIL_SQL;
-        PreparedStatement pstmt = conn.prepareStatement(sql);
-
-        try {
-            pstmt.setString(1, null);
-            pstmt.setInt(2, serviceStateID);
-            if (!status) {
-                pstmt.setString(3, detail);
-            }
-            pstmt.setString(4, null);
-            pstmt.executeUpdate();
-        } catch (SQLException e) {
-            String msg = "Inserting state details failed";
-            log.error(msg, e);
-            throw new SQLException(msg, e);
-        } finally {
-            pstmt.close();
-        }
-    }
-
-    /**
-     * Gets the insert status
-     *
-     * @param ServiceID, id of the service
-     * @return true, if insert status was successful
-     * @throws SQLException, if writing to the database failed.
-     */
-    public static boolean getInsertStatus(int ServiceID) throws SQLException {
-
-        ResultSet rs = null;
-        Statement stmtCon = null;
-        boolean currentStatus = false;
-        String sqlGetStateID = StatusMonitorConstants.SELECT_ALL_FROM_WSL_SERVICE_STATE_SQL + ServiceID +
-                StatusMonitorConstants.ORDER_BY_TIMESTAMP_SQL_DESC_LIMIT_01_SQL;
-
-        DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
-        Date SystemDate = new Date();
-        dateFormat.format(SystemDate);
-
-        int state_id;
-        Date date;
-        try {
-            stmtCon = conn.createStatement();
-            stmtCon.executeQuery(sqlGetStateID);
-            rs = stmtCon.getResultSet();
-            if (rs != null) {
-
-                while (rs.next()) {
-                    state_id = rs.getInt(StatusMonitorConstants.STATE_ID);
-
-                    if (state_id == 1) {
-                        if (log.isDebugEnabled()) {
-                            log.debug("Up and Running :" + state_id);
-                        }
-                        currentStatus = true;
-                    }
-
-                    if (state_id == 2) {
-                        if (log.isDebugEnabled()) {
-                            log.debug("Broken :" + state_id);
-                        }
-                        currentStatus = true;
-                    }
-
-                    if (state_id == 4) {
-                        currentStatus = true;
-                        date = rs.getTimestamp(StatusMonitorConstants.TIMESTAMP);
-                        resolvedWSLID = rs.getInt(StatusMonitorConstants.ID);
-
-                        long currentTimeMs = SystemDate.getTime();
-                        long resolvedTimeMs = date.getTime();
-
-                        double time_diff = ((currentTimeMs - resolvedTimeMs) / (double) StatusMonitorConstants.HOUR_IN_MILLIS);
-                        if (log.isDebugEnabled()) {
-                            log.debug("State ID: " + state_id);
-                        }
-                        if (time_diff >= 1.0) {
-                            resolvedNotFixed = 1;
-                        } else {
-                            resolvedNotFixed = 2;
-                        }
-                    }
-                }
-
-            } else {
-                currentStatus = true;
-            }
-        } catch (SQLException e) {
-            String msg = "Getting Insert state failed";
-            log.error(msg, e);
-            throw new SQLException(msg, e);
-        } finally {
-            if (rs != null) {
-                rs.close();
-            }
-            if (stmtCon != null) {
-                stmtCon.close();
-            }
-        }
-        return currentStatus;
-    }
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/pom.xml b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/pom.xml
deleted file mode 100644
index 951da1f..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/pom.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<!--
-# Copyright (c) 2012, 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>status-monitor-parent</artifactId>
-        <version>2.1.0</version>
-<relativePath>../../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.wso2.carbon.status.monitor.core</artifactId>
-    <packaging>bundle</packaging>
-    <name>WSO2 Stratos - Stratos Status Monitor Core</name>
-
-    <build>
-
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-            </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>
-                        <Export-Package>
-                            org.wso2.carbon.status.monitor.core.*,
-                        </Export-Package>
-                        <Private-Package>
-                            org.wso2.carbon.status.monitor.core.internal.*,
-                        </Private-Package>
-                        <Import-Package>
-                            org.wso2.carbon.registry.core.*;version=1.0.1,
-                            javax.xml.namespace; version=0.0.0,
-                            javax.servlet;version="${imp.pkg.version.javax.servlet}",
-                            javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
-                            *;resolution:=optional
-                        </Import-Package>
-                        <DynamicImport-Package>*</DynamicImport-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.registry.core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.stratos.common</artifactId>
-        </dependency>
-    </dependencies>
-
-</project>


[4/7] Applying 0001-Refactor-status-monitor-module.patch

Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/internal/StatusMonitorServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/internal/StatusMonitorServiceComponent.java b/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/internal/StatusMonitorServiceComponent.java
new file mode 100644
index 0000000..e33df54
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/internal/StatusMonitorServiceComponent.java
@@ -0,0 +1,103 @@
+/*
+ *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.status.monitor.internal;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.stratos.status.monitor.internal.core.MySQLConnector;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.ComponentContext;
+import org.apache.stratos.status.monitor.core.exception.StatusMonitorException;
+import org.apache.stratos.status.monitor.core.util.StatusMonitorUtil;
+import org.wso2.carbon.utils.ConfigurationContextService;
+
+/**
+ * @scr.component name="org.apache.stratos.status.monitor" immediate="true"
+ * @scr.reference name="configuration.context.service"
+ *                interface="org.wso2.carbon.utils.ConfigurationContextService"
+ *                cardinality="1..1" policy="dynamic"
+ *                bind="setConfigurationContextService"
+ *                unbind="unsetConfigurationContextService"
+ */
+public class StatusMonitorServiceComponent {
+    private static Log log = LogFactory.getLog(
+            StatusMonitorServiceComponent.class);
+
+    private static BundleContext bundleContext;
+    private static ConfigurationContextService configurationContextService;
+
+    protected void activate(ComponentContext context) {
+        try {
+            bundleContext = context.getBundleContext();
+            if (StatusMonitorUtil.getStatusMonitorConfiguration() == null) {
+                StatusMonitorUtil.initStatusMonitor(context.getBundleContext());
+                if (log.isDebugEnabled()) {
+                    log.debug("Status Monitor Agent initialized");
+                }
+            }
+            initConnector();
+            log.debug("******* Status Monitor bundle is activated ******* ");
+        } catch (Exception e) {
+            log.error("******* Status Monitor bundle failed activating ****", e);
+        }
+    }
+
+    private void initConnector() throws StatusMonitorException {
+        try {
+            MySQLConnector.initialize();
+        } catch (Exception e) {
+            String msg = "Error in initializing the mysql connection for the health monitoring";
+            log.error(msg, e);
+            throw new StatusMonitorException(msg, e);
+        }
+    }
+
+    protected void deactivate(ComponentContext context) {
+        log.debug("******* Status Monitor bundle is deactivated ******* ");
+    }
+
+    protected void setConfigurationContextService(ConfigurationContextService configurationContextService) {
+        log.debug("Receiving ConfigurationContext Service");
+        StatusMonitorServiceComponent.
+                configurationContextService = configurationContextService;
+
+    }
+
+    protected void unsetConfigurationContextService(
+            ConfigurationContextService configurationContextService) {
+        log.debug("Unsetting ConfigurationContext Service");
+        setConfigurationContextService(null);
+    }
+
+    public static BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    public static ConfigurationContextService getConfigurationContextService() {
+        return configurationContextService;
+    }
+
+    public static ConfigurationContext getConfigurationContext() {
+        if (configurationContextService.getServerConfigContext() == null) {
+            return null;
+        }
+        return configurationContextService.getServerConfigContext();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/internal/core/MySQLConnector.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/internal/core/MySQLConnector.java b/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/internal/core/MySQLConnector.java
new file mode 100644
index 0000000..0571a65
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/internal/core/MySQLConnector.java
@@ -0,0 +1,171 @@
+/*
+ *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.status.monitor.internal.core;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.status.monitor.beans.ServiceStateDetailInfoBean;
+import org.apache.stratos.status.monitor.beans.ServiceStateInfoBean;
+import org.apache.stratos.status.monitor.core.constants.StatusMonitorConstants;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The class connecting with the mysql database for the Status Monitor Back end
+ */
+public class MySQLConnector {
+    private static Connection conn;
+    private static final Log log = LogFactory.getLog(MySQLConnector.class);
+
+    private static List<String> serviceList = new ArrayList<String>();
+    private static List<String> statusList = new ArrayList<String>();
+
+    /**
+     * gets the sql connection and initializes the MySQLConnectionInitializer.
+     *
+     * @return Static Connection
+     * @throws Exception, throws exception
+     */
+    public static Connection initialize() throws Exception {
+        //gets the sql connection.
+        conn = MySQLConnectionInitializer.initialize();
+
+        //initializes the service and state lists.
+        serviceList = MySQLConnectionInitializer.getServiceList();
+        statusList = MySQLConnectionInitializer.getStatusList();
+
+        if (log.isDebugEnabled()) {
+            log.debug("Connection to the status database is initialized from status.monitor");
+        }
+
+        return conn;
+    }
+
+    /**
+     * Gets the service state ID from the service ID
+     *
+     * @param serviceID: int
+     * @return service state ID
+     * @throws java.sql.SQLException, if the retrieval of the service state failed.
+     */
+    public static ServiceStateInfoBean getServiceState(int serviceID) throws SQLException {
+        ResultSet rs;
+        Statement stmtCon = conn.createStatement();
+        String sql = StatusMonitorConstants.GET_SERVICE_STATE_SQL + serviceID +
+                StatusMonitorConstants.ORDER_BY_TIMESTAMP_SQL;
+
+        stmtCon.executeQuery(sql);
+        rs = stmtCon.getResultSet();
+        int stateID;
+        Timestamp date;
+        ServiceStateInfoBean serviceStateInfoBean = new ServiceStateInfoBean();
+
+        try {
+            while (rs.next()) {
+                stateID = rs.getInt(StatusMonitorConstants.STATE_ID);
+                date = rs.getTimestamp(StatusMonitorConstants.TIMESTAMP);
+                serviceStateInfoBean.setDate(date.getTime());
+                serviceStateInfoBean.setService(serviceList.get(serviceID - 1));
+                serviceStateInfoBean.setServiceID(serviceID);
+                serviceStateInfoBean.setServiceState(statusList.get(stateID - 1));
+            }
+        } catch (SQLException e) {
+            String msg = "Getting the service state failed";
+            log.error(msg, e);
+            throw new SQLException(msg, e);
+        } finally {
+            rs.close();
+            stmtCon.close();
+        }
+        return serviceStateInfoBean;
+    }
+
+    /**
+     * Gets the list of all the service state details.
+     *
+     * @return the list of the service state details.
+     * @throws Exception, if the retrieval of the service state details failed.
+     */
+    public static List<ServiceStateDetailInfoBean> getAllServiceStateDetail() throws Exception {
+        List<ServiceStateDetailInfoBean> stateDetailList = new ArrayList<ServiceStateDetailInfoBean>();
+
+        ResultSet rs;
+        Statement stmtCon = conn.createStatement();
+        String sql = StatusMonitorConstants.GET_ALL_STATE_DETAIL_SQL;
+        stmtCon.executeQuery(sql);
+        rs = stmtCon.getResultSet();
+        String service;
+        String serviceStateDetail;
+        Timestamp stateLoggedTime;
+        Timestamp detailLoggedTime;
+
+        ServiceStateDetailInfoBean serviceStateDetailInfoBean;
+
+        try {
+            while (rs.next()) {
+                serviceStateDetailInfoBean = new ServiceStateDetailInfoBean();
+
+                service = rs.getString(StatusMonitorConstants.SERVICE_WSL_NAME);
+                stateLoggedTime = rs.getTimestamp(StatusMonitorConstants.SERVICE_STATE_WSL_TIMESTAMP);
+                detailLoggedTime =
+                        rs.getTimestamp(StatusMonitorConstants.SERVICE_STATE_DETAIL_WSL_TIMESTAMP);
+                serviceStateDetail = rs.getString(StatusMonitorConstants.SERVICE_STATE_DETAIL);
+
+                serviceStateDetailInfoBean.setService(service);
+                serviceStateDetailInfoBean.setStateLoggedTime(stateLoggedTime.getTime());
+                serviceStateDetailInfoBean.setServiceStateDetail(serviceStateDetail);
+                serviceStateDetailInfoBean.setDetailLoggedTime(detailLoggedTime.getTime());
+
+                stateDetailList.add(serviceStateDetailInfoBean);
+            }
+        } catch (SQLException e) {
+            String msg = "Getting the serviceID failed";
+            log.error(msg, e);
+            throw new SQLException(msg, e);
+        } finally {
+            rs.close();
+            stmtCon.close();
+        }
+        return stateDetailList;
+    }
+
+    /**
+     * Gets the list of all the service state.
+     *
+     * @return list of ServiceStateInfoBean.
+     * @throws Exception, if the retrieval of the list of service state infobean failed.
+     */
+    public static List<ServiceStateInfoBean> getAllServiceState() throws Exception {
+        List<ServiceStateInfoBean> serviceStateInfoBeanList = new ArrayList<ServiceStateInfoBean>();
+        for (int serviceID = 1; serviceID <= serviceList.size(); serviceID++) {
+            serviceStateInfoBeanList.add(getServiceState(serviceID));
+        }
+        return serviceStateInfoBeanList;
+    }
+}
+
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/services/HealthMonitorService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/services/HealthMonitorService.java b/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/services/HealthMonitorService.java
new file mode 100644
index 0000000..f04ec4d
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor/src/main/java/org/apache/stratos/status/monitor/services/HealthMonitorService.java
@@ -0,0 +1,68 @@
+/*
+ *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.status.monitor.services;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.core.AbstractAdmin;
+import org.apache.stratos.status.monitor.beans.ServiceStateDetailInfoBean;
+import org.apache.stratos.status.monitor.beans.ServiceStateInfoBean;
+import org.apache.stratos.status.monitor.core.jdbc.MySQLConnectionInitializer;
+import org.apache.stratos.status.monitor.internal.core.MySQLConnector;
+
+import java.util.List;
+
+/**
+ * This is the admin Web service which is used for health monitoring of the services
+ */
+public class HealthMonitorService extends AbstractAdmin {
+    private static final Log log = LogFactory.getLog(
+            HealthMonitorService.class);
+
+    /**
+     * Get the status of all the services
+     *
+     * @return serviceStateInfoBean[]
+     * @throws Exception if failed to get Tenant Manager
+     */
+    public ServiceStateInfoBean[] getAllServiceStatus() throws Exception {
+        List<ServiceStateInfoBean> serviceStatusList = MySQLConnector.getAllServiceState();
+        return serviceStatusList.toArray(new ServiceStateInfoBean[serviceStatusList.size()]);
+    }
+
+    /**
+     * Get the status of a specific service
+     *
+     * @param ServiceName: String
+     * @return ServiceInfoBean: Service Information
+     * @throws Exception, if the retrieval of the service status failed.
+     */
+    public ServiceStateInfoBean getServiceStatus(String ServiceName) throws Exception {
+        int serviceID = MySQLConnectionInitializer.getServiceID(ServiceName);
+        return MySQLConnector.getServiceState(serviceID);
+    }
+
+    public ServiceStateDetailInfoBean[] getAllServiceStateDetail() throws Exception {
+        List<ServiceStateDetailInfoBean> serviceStatusDetailList =
+                MySQLConnector.getAllServiceStateDetail();
+        return serviceStatusDetailList.toArray(
+                new ServiceStateDetailInfoBean[serviceStatusDetailList.size()]);
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor/src/main/resources/META-INF/component.xml b/components/org.apache.stratos.status.monitor/src/main/resources/META-INF/component.xml
new file mode 100755
index 0000000..e396e5b
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor/src/main/resources/META-INF/component.xml
@@ -0,0 +1,44 @@
+<?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.
+  -->
+
+<component xmlns="http://products.wso2.org/carbon">
+    <ManagementPermissions>
+        <ManagementPermission>
+            <DisplayName>Manage</DisplayName>
+            <ResourceId>/permission/protected/manage</ResourceId>
+        </ManagementPermission>
+        <ManagementPermission>
+            <DisplayName>Monitor</DisplayName>
+            <ResourceId>/permission/protected/manage/monitor</ResourceId>
+        </ManagementPermission>
+        <ManagementPermission>
+            <DisplayName>Tenants</DisplayName>
+            <ResourceId>/permission/protected/manage/monitor/tenants</ResourceId>
+        </ManagementPermission>
+        <ManagementPermission>
+            <DisplayName>Modify</DisplayName>
+            <ResourceId>/permission/protected/manage/modify</ResourceId>
+        </ManagementPermission>
+        <ManagementPermission>
+            <DisplayName>Tenants</DisplayName>
+            <ResourceId>/permission/protected/manage/modify/tenants</ResourceId>
+        </ManagementPermission>
+   </ManagementPermissions>
+</component>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/org.apache.stratos.status.monitor/src/main/resources/META-INF/services.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.status.monitor/src/main/resources/META-INF/services.xml b/components/org.apache.stratos.status.monitor/src/main/resources/META-INF/services.xml
new file mode 100755
index 0000000..132648a
--- /dev/null
+++ b/components/org.apache.stratos.status.monitor/src/main/resources/META-INF/services.xml
@@ -0,0 +1,36 @@
+<?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.
+  -->
+<serviceGroup>
+
+    <service name="HealthMonitorService" scope="transportsession">
+        <transports>
+            <transport>https</transport>
+        </transports>
+        <parameter name="ServiceClass" locked="false">
+            org.apache.stratos.status.monitor.services.HealthMonitorService
+        </parameter>
+        <operation name="getServiceStatus">
+        </operation>
+        <operation name="getAllServiceStatus">
+        </operation>
+        <parameter name="hiddenService" locked="true">true</parameter>
+        <parameter name="adminService" locked="true">true</parameter>
+    </service>
+</serviceGroup>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/pom.xml b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/pom.xml
deleted file mode 100644
index e038120..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/pom.xml
+++ /dev/null
@@ -1,105 +0,0 @@
-<!--
-# Copyright (c) 2012, 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>status-monitor-parent</artifactId>
-        <version>2.1.0</version>
-<relativePath>../../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.wso2.carbon.status.monitor.agent</artifactId>
-    <packaging>bundle</packaging>
-    <name>WSO2 Stratos - Stratos Status Monitor Agent</name>
-
-    <build>
-
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-            </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>
-                        <Private-Package>
-                            org.wso2.carbon.status.monitor.agent.internal.*,
-                        </Private-Package>
-                        <Export-Package>
-                            org.wso2.carbon.status.monitor.agent.*,
-                        </Export-Package>
-                        <Import-Package>
-                            org.wso2.carbon.registry.core.*;version=1.0.1,
-                            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.wso2.carbon.status.monitor.core.*,
-                            *;resolution:=optional
-                        </Import-Package>
-                        <DynamicImport-Package>*</DynamicImport-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.registry.core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.status.monitor.core</artifactId>
-        </dependency>
-
-        <!--dependencies for the service service-->
-        <!--dependencies for the Identity Server Client-->
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.authenticator.stub</artifactId>
-        </dependency>
-
-        <!--dependencies for the CEP Server and MB Client-->
-        <dependency>
-            <groupId>org.apache.geronimo.specs.wso2</groupId>
-            <artifactId>geronimo-jms_1.1_spec</artifactId>
-            <version>${orbit.version.geronimo-jms_1.1_spec}</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.qpid.wso2</groupId>
-            <artifactId>qpid-client</artifactId>
-            <version>0.12.wso2v1</version>
-        </dependency>
-
-        <!--dependencies to invoke the load average service-->
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.load.balance.agent.stub</artifactId>
-            <version>${wso2carbon.version}</version>
-        </dependency>
-    </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/ClientThreadsInitializer.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/ClientThreadsInitializer.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/ClientThreadsInitializer.java
deleted file mode 100644
index c0868b0..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/ClientThreadsInitializer.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.agent.clients;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.agent.clients.service.*;
-
-import javax.jms.JMSException;
-import javax.naming.NamingException;
-import javax.xml.stream.XMLStreamException;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.text.ParseException;
-
-/**
- * The class that initializes the client threads
- */
-public class ClientThreadsInitializer {
-    private static final Log log = LogFactory.getLog(ClientThreadsInitializer.class);
-
-    public static void initializeThreads() throws IOException, SQLException, NamingException,
-            JMSException, ParseException, XMLStreamException {
-
-        new Thread() {
-            public void run() {
-                try {
-                    ApplicationServerClient applicationServerClient = new ApplicationServerClient();
-                    applicationServerClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for " +
-                            "Application Server";
-                    log.warn(msg);
-                }
-                try {
-                    DataServerClient dataServerClient = new DataServerClient();
-                    dataServerClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for " +
-                            "Data Services Server";
-                    log.warn(msg);
-                }
-                try {
-                    ESBServerClient esbServerClient = new ESBServerClient();
-                    esbServerClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for ESB";
-                    log.warn(msg);
-                }
-                try {
-                    GovernanceRegistryServerClient governanceRegistryServerClient = new GovernanceRegistryServerClient();
-                    governanceRegistryServerClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for " +
-                            "Governance Registry";
-                    log.warn(msg);
-                }
-                try {
-                    BPSServerClient bpsServerClient = new BPSServerClient();
-                    bpsServerClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for " +
-                            "Business Process Server";
-                    log.warn(msg);
-                }
-                try {
-                    MashupServerClient mashupServerClient = new MashupServerClient();
-                    mashupServerClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for " +
-                            "Mashup Server";
-                    log.warn(msg);
-                }
-                try {
-                    BRSServerClient brsServerClient = new BRSServerClient();
-                    brsServerClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for " +
-                            "Business Rules Server";
-                    log.warn(msg);
-                }
-                try {
-                    GadgetServerClient gadgetServerClient = new GadgetServerClient();
-                    gadgetServerClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for " +
-                            "Gadgets Server";
-                    log.warn(msg);
-                }
-                try {
-                    IdentityServerClient serverClient = new IdentityServerClient();
-                    serverClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for " +
-                            "Identity Server";
-                    log.warn(msg);
-                }
-                try {
-                    BAMServerClient bamServerClient = new BAMServerClient();
-                    bamServerClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for " +
-                            "Business Activity Monitor";
-                    log.warn(msg);
-                }
-                try {
-                    ManagerServiceClient managerServiceClient = new ManagerServiceClient();
-                    managerServiceClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for " +
-                            "Manager";
-                    log.warn(msg);
-                }
-                try {
-                    MessageBrokerServiceClient messageBrokerServiceClient = new MessageBrokerServiceClient();
-                    messageBrokerServiceClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for " +
-                            "Message Broker";
-                    log.warn(msg);
-                }
-                try {
-                    CEPServerClient cepServerClient = new CEPServerClient();
-                    cepServerClient.start();
-                } catch (Exception e) {
-                    String msg = "Error in starting the status monitoring thread for " +
-                            "CEP Server";
-                    log.warn(msg);
-                }
-            }
-        }.start();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/common/LoadBalanceAgentClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/common/LoadBalanceAgentClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/common/LoadBalanceAgentClient.java
deleted file mode 100644
index 96e924f..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/common/LoadBalanceAgentClient.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.agent.clients.common;
-
-import org.apache.axis2.AxisFault;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.load.balance.agent.stub.LoadBalanceAgentServiceStub;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-
-import java.rmi.RemoteException;
-import java.sql.SQLException;
-
-/**
- * The agent class that gets the load average of the service instances
- */
-public class LoadBalanceAgentClient {
-    private static final Log log = LogFactory.getLog(LoadBalanceAgentClient.class);
-    /**
-     * Load Balance Agent - This gets the load information from the service instances of each of the
-     * service cluster.
-     */
-    private static final String serviceName = "LoadBalanceAgentService";
-    private static final String services = "/services/";
-
-
-    /**
-     * gets the load average from the remote instances given in the instances map.
-     *
-     * @param hostName, host name of the service
-     * @param serviceID, int
-     * @return the load average of the given instance.
-     * @throws java.sql.SQLException, if exception in writing to the database.
-     */
-    public static double getLoadAverageFromInstances(String hostName, int serviceID) throws SQLException {
-        double loadAverage = -1;
-        LoadBalanceAgentServiceStub stub;
-        String serviceUrl;
-
-        // gets the instance and the service
-        try {
-            serviceUrl = "https://" + hostName + services + serviceName;
-        } catch (Exception e) {
-            if (log.isDebugEnabled()) {
-                log.debug("Unable to get the running application instances to get the " +
-                        "load average", e);
-            }
-            return loadAverage;
-        }
-
-        // gets the load average of the service instance
-        try {
-            stub = new LoadBalanceAgentServiceStub(serviceUrl);
-            loadAverage = stub.getLoadAverage();
-        } catch (AxisFault e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, e.getMessage());
-            String msg = "Invoking the Load Balance Agent Client Failed";
-            log.warn(msg, e);
-        } catch (RemoteException e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, e.getMessage());
-            String msg = "Remote Exception in invoking the Load Balance Agent Client";
-            log.warn(msg, e);
-        } catch (Exception e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, e.getMessage());
-            String msg = "Exception in invoking the Load Balance Agent Client";
-            log.warn(msg, e);
-        }
-        if (log.isDebugEnabled()) {
-            log.debug("Load Average from the service: " + serviceUrl + ": " + loadAverage);
-        }
-        return loadAverage;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/common/ServiceLoginClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/common/ServiceLoginClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/common/ServiceLoginClient.java
deleted file mode 100644
index 1b09adb..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/common/ServiceLoginClient.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.agent.clients.common;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.authenticator.stub.AuthenticationAdminStub;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-
-import java.sql.SQLException;
-
-/**
- * The client class that tries to log in into each of the services.
- */
-public class ServiceLoginClient {
-    private static final Log log = LogFactory.getLog(ServiceLoginClient.class);
-    private static AuthConfigBean authConfigBean = StatusMonitorConfigurationBuilder.getAuthConfigBean();
-
-    static {
-        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE, authConfigBean.getJksLocation());
-        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE_PASSWORD, "wso2carbon");
-        System.setProperty(StatusMonitorAgentConstants.TRUST_STORE_TYPE, "JKS");
-    }
-
-    /**
-     * Checks the log in
-     * @param hostName; host name of the service
-     * @param serviceID: int, service ID
-     * @return boolean: true, if successfully logged in
-     * @throws SQLException: if writing to the database failed.
-     */
-    public static boolean loginChecker(String hostName, int serviceID) throws SQLException {
-        if(log.isDebugEnabled()) {
-            log.debug("************** TRUST STORE : " +
-                    System.getProperty(StatusMonitorAgentConstants.TRUST_STORE));
-        }
-        String userName = authConfigBean.getUserName();
-        String password = authConfigBean.getPassword();
-        boolean loginStatus = false;
-        String authenticationServiceURL = "https://" + hostName +
-                StatusMonitorAgentConstants.AUTHENTICATION_ADMIN_PATH;
-        AuthenticationAdminStub authenticationAdminStub;
-        try {
-            authenticationAdminStub = new AuthenticationAdminStub(authenticationServiceURL);
-            ServiceClient client = authenticationAdminStub._getServiceClient();
-            Options options = client.getOptions();
-            options.setManageSession(true);
-
-            loginStatus = authenticationAdminStub.login(userName, password, hostName);
-            ServiceContext serviceContext = authenticationAdminStub.
-                    _getServiceClient().getLastOperationContext().getServiceContext();
-            // String sessionCookie = (String) serviceContext.getProperty(HTTPConstants.COOKIE_STRING);
-            String msg = "Log in client successfully logged in to the service: " + hostName;
-            if (log.isDebugEnabled()){
-                log.debug(msg);
-            }
-            if (!loginStatus) {
-                msg = "Login Checker failed for the service: " + hostName;
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, msg);
-                log.warn(msg);
-            }
-        } catch (AxisFault e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, e.getMessage());
-            String msg = "Failed to login; Inserting the stats in the db for the log in checker";
-            log.warn(msg, e);
-        } catch (Exception e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, e.getMessage());
-            String msg = "Exception in login; Inserting the stats in the db for the log in checker";
-            log.warn(msg, e);
-        }
-        return loginStatus;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/ApplicationServerClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/ApplicationServerClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/ApplicationServerClient.java
deleted file mode 100644
index 840d75b..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/ApplicationServerClient.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.agent.clients.service;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.agent.clients.common.ServiceLoginClient;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.net.URLConnection;
-import java.sql.SQLException;
-import java.text.ParseException;
-
-/**
- * Status Monitor Agent client class for Application Server service
- */
-public class ApplicationServerClient extends Thread {
-    private static int serviceID;
-    private static final Log log = LogFactory.getLog(ApplicationServerClient.class);
-    private static final AuthConfigBean authConfigBean =
-            StatusMonitorConfigurationBuilder.getAuthConfigBean();
-
-    private static OMElement createPayLoad() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace(StatusMonitorConstants.CARBON_OM_NAMESPACE, "ns1");
-        OMElement method = fac.createOMElement("echoString", omNs);
-        OMElement value = fac.createOMElement("s", omNs);
-        value.addChild(fac.createOMText(value, "Hello World"));
-        method.addChild(value);
-        return method;
-    }
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-//                LoadBalanceAgentClient.getLoadAverageFromInstances(StatusMonitorConstants.APPSERVER_HOST, serviceID);
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (IOException e) {
-                log.error(e);
-            } catch (SQLException e) {
-                log.error(e);
-            } catch (ParseException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    /**
-     * Executing the service
-     * @throws SQLException, exception in writing to the database
-     * @throws ParseException, parse exception
-     * @throws IOException, in initializing the service client
-     */
-    private static void executeService() throws SQLException, ParseException, IOException {
-        serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.APPSERVER);
-
-        OMElement result;
-        OMElement payload = createPayLoad();
-        ServiceClient serviceclient = new ServiceClient();
-        Options opts = new Options();
-
-        opts.setTo(new EndpointReference(StatusMonitorConstants.APPSERVER_HTTP +
-                StatusMonitorAgentConstants.TENANT_SERVICES + authConfigBean.getTenant() +
-                "/Axis2Service"));
-        opts.setAction(StatusMonitorConstants.CARBON_OM_NAMESPACE + "echoString");
-        opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
-
-
-        //check whether login success
-        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.APPSERVER_HOST, serviceID)) {
-            if (!webappTest()) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, "Webapp Invocation failed");
-                log.warn("WebApp invocation failed");
-
-            } else {
-                serviceclient.setOptions(opts);
-                try {
-                    result = serviceclient.sendReceive(payload);
-                    if (log.isDebugEnabled()) {
-                        log.debug(result);
-                    }
-                    if ((result.toString().indexOf("Hello World")) > 0) {
-                        if (pingPlatformTenant()) {
-//                            if (new JmeterTestClient().getAarUploadResults()) {
-//                                if (log.isDebugEnabled()) {
-//                                    log.debug("Jmeter aar upload Fail");
-//                                }
-//                                MySQLConnector.insertStats(serviceID, false);
-//                                MySQLConnector.insertState(serviceID, false, "UI: AAR upload test failed");
-//                            } else {
-                                MySQLConnector.insertStats(serviceID, true);
-                                MySQLConnector.insertState(serviceID, true, "");
-//                            }
-                        }
-                    } else {
-                        MySQLConnector.insertStats(serviceID, false);
-                        MySQLConnector.insertState(serviceID, false, " Service Invocation failed");
-                        log.warn("Service Invocation Failed");
-                    }
-
-                } catch (AxisFault e) {
-                    MySQLConnector.insertStats(serviceID, false);
-                    MySQLConnector.insertState(serviceID, false, e.getMessage());
-                    String msg = "Axis Fault in invoking the Appserver Client";
-                    log.warn(msg, e);
-                }
-                catch (NullPointerException e) {
-                    MySQLConnector.insertStats(serviceID, false);
-                    MySQLConnector.insertState(serviceID, false, e.getMessage());
-                    String msg = "Null Pointer Exception in invoking the Appserver client";
-                    log.warn(msg, e);
-                }
-            }
-        }
-    }
-
-    /**
-     * Pings the platform tenant
-     * @return true, if the ping was successful
-     * @throws IOException, in creating the service client
-     * @throws SQLException, in writing to the db.
-     * @throws ParseException, parse exception
-     */
-    private static Boolean pingPlatformTenant() throws IOException,
-            SQLException, ParseException {
-        Boolean pingPlatformTenantStatus = false;
-        OMElement result;
-        OMElement payload = createPayLoad();
-        ServiceClient serviceclient = new ServiceClient();
-        Options opts = new Options();
-
-        opts.setTo(new EndpointReference(StatusMonitorConstants.APPSERVER_HTTP +
-                StatusMonitorAgentConstants.TENANT_SERVICES +
-                StatusMonitorConfigurationBuilder.getSampleTenantConfigBean().getTenant() +
-                "/Axis2Service/"));
-        opts.setAction("http://service.carbon.wso2.org/echoString");
-        opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
-
-        serviceclient.setOptions(opts);
-        try {
-            result = serviceclient.sendReceive(payload);
-
-            if ((result.toString().indexOf("Hello World")) > 0) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Appserver test client - service invocation test passed");
-                }
-                pingPlatformTenantStatus = true;
-            } else {
-                String msg = "Ping to platform sample tenant domain failed";
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, msg);
-                log.warn(msg);
-            }
-
-        } catch (AxisFault e) {
-            MySQLConnector.insertStats(serviceID, false);
-            String msg = "Ping to platform sample tenant domain failed: ";
-            MySQLConnector.insertState(serviceID, false, msg + e.getMessage());
-            log.warn(msg, e);
-        }
-        catch (NullPointerException e) {
-            MySQLConnector.insertStats(serviceID, false);
-            String msg = "Ping to platform sample tenant domain failed: ";
-            MySQLConnector.insertState(serviceID, false, msg + e.getMessage());
-            log.warn(msg, e);
-        }
-        return pingPlatformTenantStatus;
-    }
-
-    /**
-     * Connects to the given web application.
-     * @return true, if successful
-     */
-    private static boolean webappTest() {
-        URL webAppURL;
-        BufferedReader in;
-        boolean webappStatus = false;
-
-        try {
-            webAppURL = new URL(StatusMonitorConstants.APPSERVER_HTTP + "/t/" +
-                    authConfigBean.getTenant() +
-                    "/webapps/SimpleServlet/simple-servlet");
-            URLConnection yc;
-            yc = webAppURL.openConnection();
-
-            in = new BufferedReader(new InputStreamReader(yc.getInputStream()));
-
-            String inputLine;
-
-            while ((inputLine = in.readLine()) != null) {
-                if (log.isDebugEnabled()) {
-                    log.debug(inputLine);
-                }
-                if (inputLine.indexOf("Hello, World") > 1) {
-                    if (log.isDebugEnabled()) {
-                        log.debug("True : " + inputLine.indexOf("Hello, World"));
-                    }
-                    webappStatus = true;
-                }
-            }
-            in.close();
-        } catch (IOException e) {
-            log.error(e);
-        }
-        return webappStatus;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/BAMServerClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/BAMServerClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/BAMServerClient.java
deleted file mode 100644
index 1d0cb7b..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/BAMServerClient.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2012, 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.status.monitor.agent.clients.service;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.agent.clients.common.ServiceLoginClient;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.text.ParseException;
-
-/**
- * Status Monitor Agent client class for Business Activity Monitor
- */
-public class BAMServerClient extends Thread {
-
-    public static int serviceID;
-    private static final Log log = LogFactory.getLog(BAMServerClient.class);
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (IOException e) {
-                log.error(e);
-            } catch (SQLException e) {
-                log.error(e);
-            } catch (ParseException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    private static void executeService() throws SQLException, IOException, ParseException {
-        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.MONITOR);
-
-        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.MONITOR_HOST, serviceID)) {
-            MySQLConnector.insertStats(serviceID, true);
-            MySQLConnector.insertState(serviceID, true, "");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/BPSServerClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/BPSServerClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/BPSServerClient.java
deleted file mode 100644
index e4fdc03..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/BPSServerClient.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2012, 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.status.monitor.agent.clients.service;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.agent.clients.common.ServiceLoginClient;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.text.ParseException;
-
-/**
- * Status Monitor Agent client class for Business Process Server
- */
-public class BPSServerClient extends Thread{
-    private static final Log log = LogFactory.getLog(BPSServerClient.class);
-    private static final AuthConfigBean authConfigBean =
-            StatusMonitorConfigurationBuilder.getAuthConfigBean();
-
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (IOException e) {
-                log.error(e);
-            } catch (SQLException e) {
-                log.error(e);
-            } catch (ParseException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    private static OMElement createPayLoad() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace("http://ode/bpel/unit-test.wsdl", "ns1");
-        OMElement method = fac.createOMElement("hello", omNs);
-        OMElement value = fac.createOMElement("TestPart", null);
-        value.addChild(fac.createOMText(value, "Hello"));
-        method.addChild(value);
-        return method;
-    }
-
-    private static void executeService() throws IOException, SQLException, ParseException {
-
-        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.PROCESS);
-
-        OMElement result;
-        OMElement payload = createPayLoad();
-        ServiceClient serviceclient = new ServiceClient();
-        Options opts = new Options();
-        opts.setTo(new EndpointReference(StatusMonitorConstants.PROCESS_HTTP +
-                StatusMonitorAgentConstants.TENANT_SERVICES +
-                authConfigBean.getTenant() + "/HelloService"));
-        opts.setAction("http://ode/bpel/unit-test.wsdl/hello");
-
-        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.PROCESS_HOST, serviceID)) {
-            serviceclient.setOptions(opts);
-            try {
-                result = serviceclient.sendReceive(payload);
-                if(log.isDebugEnabled()){
-                    log.debug("Result of BPS: " + result);
-                }
-
-                if ((result.toString().indexOf("Hello World")) > 0) {
-                    MySQLConnector.insertStats(serviceID, true);
-                    MySQLConnector.insertState(serviceID, true, "");
-                } else {
-                    MySQLConnector.insertStats(serviceID, false);
-                    MySQLConnector.insertState(serviceID, false, "Service Invocation failed");
-                }
-
-            } catch (AxisFault e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                log.warn(e);
-            }
-            catch (NullPointerException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                log.warn(e);
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/BRSServerClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/BRSServerClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/BRSServerClient.java
deleted file mode 100644
index e1ef4c3..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/BRSServerClient.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
-* Copyright (c) 2012, 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.status.monitor.agent.clients.service;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.agent.clients.common.ServiceLoginClient;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.text.ParseException;
-
-/**
- * Status Monitor Agent client class for Business Rule Server
- */
-public class BRSServerClient extends Thread {
-    private static final Log log = LogFactory.getLog(BRSServerClient.class);
-    private static final AuthConfigBean authConfigBean =
-            StatusMonitorConfigurationBuilder.getAuthConfigBean();
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (IOException e) {
-                log.error(e);
-            } catch (SQLException e) {
-                log.error(e);
-            } catch (ParseException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    private static OMElement createPayLoad() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace("http://brs.carbon.wso2.org", "ns1");
-        OMNamespace nameNs = fac.createOMNamespace("http://greeting.samples/xsd", "ns2");
-        OMElement method = fac.createOMElement("greetMe", omNs);
-        OMElement value = fac.createOMElement("User", omNs);
-        OMElement NameValue = fac.createOMElement("name", nameNs);
-        NameValue.addChild(fac.createOMText(NameValue, "QAuser"));
-        value.addChild(NameValue);
-        method.addChild(value);
-        if (log.isDebugEnabled()) {
-            log.debug("Method in createPayload(): " + method.toString());
-        }
-        return method;
-    }
-
-    private static void executeService() throws IOException, SQLException, ParseException {
-
-        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.RULE);
-
-        OMElement result;
-        OMElement payload = createPayLoad();
-        ServiceClient serviceclient = new ServiceClient();
-        Options opts = new Options();
-        opts.setTo(new EndpointReference(StatusMonitorConstants.RULE_HTTP +
-                StatusMonitorAgentConstants.TENANT_SERVICES +
-                authConfigBean.getTenant() + "/GreetingService"));
-        opts.setAction("http://brs.carbon.wso2.org/greetMe");
-
-        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.RULE_HOST, serviceID)) {
-            serviceclient.setOptions(opts);
-            try {
-                result = serviceclient.sendReceive(payload);
-                if (log.isDebugEnabled()) {
-                    log.debug("Result in BRSServerClient: " + result.toString());
-                }
-
-                if ((result.toString().indexOf("QAuser")) > 0) {
-                    MySQLConnector.insertStats(serviceID, true);
-                    MySQLConnector.insertState(serviceID, true, "");
-                } else {
-                    MySQLConnector.insertStats(serviceID, false);
-                    MySQLConnector.insertState(serviceID, false, "Service Invocation failed");
-                }
-
-            } catch (AxisFault e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "Fault when executing service: BRSServerClient: ";
-                log.warn(msg, e);
-            }
-            catch (NullPointerException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "NPE when executing service: BRSServerClient: ";
-                log.warn(msg, e);
-            }
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/CEPServerClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/CEPServerClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/CEPServerClient.java
deleted file mode 100644
index f153a95..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/CEPServerClient.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.agent.clients.service;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.agent.clients.common.ServiceLoginClient;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.QueueReceiver;
-import javax.jms.QueueSession;
-import javax.jms.TextMessage;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import java.sql.SQLException;
-import java.util.Properties;
-import javax.jms.QueueConnectionFactory;
-
-/**
- * Status Monitor Agent client class for Complex Event Processing Server
- */
-public class CEPServerClient extends Thread{
-    private static final Log log = LogFactory.getLog(CEPServerClient.class);
-    private static String tcpUserName;
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (SQLException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    private static void executeService() throws SQLException {
-        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.CEP);
-        AuthConfigBean authConfigBean = StatusMonitorConfigurationBuilder.getAuthConfigBean();
-
-        String userName = authConfigBean.getUserName();
-        tcpUserName = userName.replace('@','!');
-
-
-        //check whether login success
-        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.CEP_HOST, serviceID)) {
-
-
-            Properties properties = new Properties();
-            properties.put(Context.INITIAL_CONTEXT_FACTORY, StatusMonitorAgentConstants.QPID_ICF);
-            properties.put(StatusMonitorAgentConstants.CF_NAME_PREFIX +
-                    StatusMonitorAgentConstants.CF_NAME,
-                    getTCPConnectionURL(tcpUserName,
-                            authConfigBean.getPassword()));
-
-            InitialContext ctx;
-            try {
-                ctx = new InitialContext(properties);
-
-                // Lookup connection factory
-                QueueConnectionFactory connFactory =
-                        (QueueConnectionFactory) ctx.lookup(StatusMonitorAgentConstants.CF_NAME);
-                QueueConnection queueConnection = connFactory.createQueueConnection();
-                queueConnection.start();
-                QueueSession queueSession =
-                        queueConnection.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
-
-                // Send message
-                Queue queue = queueSession.createQueue(StatusMonitorAgentConstants.QUEUE_NAME_CEP +
-                        ";{create:always, node:{durable: True}}");
-
-                // create the message to send
-                TextMessage textMessage = queueSession.createTextMessage("Test Message Hello");
-                javax.jms.QueueSender queueSender = queueSession.createSender(queue);
-                queueSender.setTimeToLive(100000000);
-
-                QueueReceiver queueReceiver = queueSession.createReceiver(queue);
-                queueSender.send(textMessage);
-
-                TextMessage message = (TextMessage) queueReceiver.receiveNoWait();
-                if (log.isDebugEnabled()) {
-                    log.debug("Message in the execute() of CEPServer Client: " + message.getText());
-                }
-                if (message.getText().equals("Test Message Hello")) {
-                    MySQLConnector.insertStats(serviceID, true);
-                    MySQLConnector.insertState(serviceID, true, "");
-                } else {
-                    MySQLConnector.insertStats(serviceID, false);
-                    MySQLConnector.insertState(serviceID, false, "Send or retrieve messages failed");
-                }
-                queueSender.close();
-                queueSession.close();
-                queueConnection.close();
-
-            } catch (JMSException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "JMS Exception in inserting stats into the DB for the CEPServerClient";
-                log.warn(msg, e);
-            } catch (NamingException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "Naming Exception in inserting stats into the DB for the CEPServerClient";
-                log.warn(msg, e);
-            }
-        }
-    }
-
-    private static String getTCPConnectionURL(String username, String password) {
-        return new StringBuffer()
-                .append("amqp://").append(tcpUserName).append(":").append(password).append("@").
-                        append(StatusMonitorAgentConstants.CARBON_CLIENT_ID).append("/").
-                        append(StatusMonitorAgentConstants.CARBON_VIRTUAL_HOST_NAME).
-                        append("?brokerlist='tcp://").append(StatusMonitorConstants.CEP_HOST).
-                        append(":").append(StatusMonitorAgentConstants.CEP_DEFAULT_PORT).
-                        append("'").toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/DataServerClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/DataServerClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/DataServerClient.java
deleted file mode 100644
index 7839a68..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.agent/2.1.0/src/main/java/org/wso2/carbon/status/monitor/agent/clients/service/DataServerClient.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
-* Copyright (c) 2012, 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.status.monitor.agent.clients.service;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.util.AXIOMUtil;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.agent.clients.common.ServiceLoginClient;
-import org.wso2.carbon.status.monitor.agent.constants.StatusMonitorAgentConstants;
-import org.wso2.carbon.status.monitor.agent.internal.core.MySQLConnector;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.beans.SampleTenantConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-
-import javax.xml.stream.XMLStreamException;
-import java.io.IOException;
-import java.sql.SQLException;
-import java.text.ParseException;
-
-/**
- * Status Monitor Agent client class for Data
- */
-public class DataServerClient extends Thread{
-    private static final Log log = LogFactory.getLog(DataServerClient.class);
-    private static final AuthConfigBean authConfigBean =
-            StatusMonitorConfigurationBuilder.getAuthConfigBean();
-    private static final SampleTenantConfigBean sampleTenantConfigBean =
-            StatusMonitorConfigurationBuilder.getSampleTenantConfigBean();
-
-    private static OMElement createPayLoad() {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-        OMNamespace omNs = fac.createOMNamespace("http://ws.wso2.org/dataservice", "ns1");
-        return fac.createOMElement("getCustomers", omNs);
-    }
-
-    public void run() {
-        while (true) {
-            try {
-                executeService();
-
-                // return from while loop if the thread is interrupted
-                if (isInterrupted()) {
-                    break;
-                }
-                // let the thread sleep for 15 mins
-                try {
-                    sleep(StatusMonitorConstants.SLEEP_TIME);
-                } catch (InterruptedException e) {
-                    Thread.currentThread().interrupt();
-                }
-            } catch (IOException e) {
-                log.error(e);
-            } catch (SQLException e) {
-                log.error(e);
-            } catch (ParseException e) {
-                log.error(e);
-            }
-        }
-    }
-
-    private static void executeService() throws IOException, SQLException, ParseException {
-        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.DATA);
-
-        OMElement result;
-        OMElement payload = createPayLoad();
-        ServiceClient serviceclient = new ServiceClient();
-        Options opts = new Options();
-        opts.setTo(new EndpointReference(StatusMonitorConstants.DATA_HTTP +
-                StatusMonitorAgentConstants.TENANT_SERVICES +
-                 authConfigBean.getTenant() + "/GSpreadSample"));
-        opts.setAction("http://ws.wso2.org/dataservice/getCustomers");
-
-        if (ServiceLoginClient.loginChecker(StatusMonitorConstants.DATA_HOST, serviceID)) {
-            serviceclient.setOptions(opts);
-            try {
-                result = serviceclient.sendReceive(payload);
-                if (log.isDebugEnabled()) {
-                    log.debug(result);
-                }
-
-                if ((result.toString().indexOf("Signal Gift Stores")) > 0) {
-                    executeShoppingCartDSPlatformSample();
-
-                } else {
-                    MySQLConnector.insertStats(serviceID, false);
-                    MySQLConnector.insertState(serviceID, false, "Service Invocation failed");
-                }
-
-            } catch (AxisFault e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "Error in executing service for DSS Server client";
-                log.warn(msg, e);
-            }
-            catch (NullPointerException e) {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, e.getMessage());
-                String msg = "NPE in executing the service for DSS client";
-                log.warn(msg, e);
-            }
-        }
-    }
-
-    private static boolean executeShoppingCartDSPlatformSample() throws IOException, SQLException, ParseException {
-        Boolean sampleStatus = false;
-        int serviceID = MySQLConnectionInitializer.getServiceID(StatusMonitorConstants.DATA);
-        String payload = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" +
-                "   <soapenv:Header/>\n" +
-                "   <soapenv:Body/>\n" +
-                "</soapenv:Envelope>";
-        String action = "getAllCategories";
-
-        try {
-            OMElement result;
-            result = sendRequest(payload, action, new EndpointReference(
-                    StatusMonitorConstants.DATA_HTTP + StatusMonitorAgentConstants.TENANT_SERVICES +
-                            sampleTenantConfigBean.getTenant() + "/ShoppingCartDS"));
-
-            if ((result.toString().indexOf("Compact Lens-Shutter Cameras")) > 0) {
-                sampleStatus = true;
-                MySQLConnector.insertStats(serviceID, true);
-                MySQLConnector.insertState(serviceID, true, "");
-            } else {
-                MySQLConnector.insertStats(serviceID, false);
-                MySQLConnector.insertState(serviceID, false, "Platform sample ShoppingCartDS invocation failed");
-            }
-        } catch (AxisFault e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, "Platform sample ShoppingCartDS: " + e.getMessage());
-            String msg = "Fault in executing the Shopping cart sample";
-            log.warn(msg, e);
-        }
-        catch (NullPointerException e) {
-            MySQLConnector.insertStats(serviceID, false);
-            MySQLConnector.insertState(serviceID, false, "Platform sample ShoppingCartDS: " + e.getMessage());
-            String msg = "NPE in executing the shopping cart sample";
-            log.warn(msg, e);
-        } catch (XMLStreamException e) {
-            String msg = "XMLStreamException in executing the shopping cart sample";
-            log.warn(msg, e);
-        }
-        return sampleStatus;
-    }
-
-    private static OMElement sendRequest(String payloadStr, String action, EndpointReference targetEPR)
-            throws XMLStreamException, AxisFault {
-        OMElement payload = AXIOMUtil.stringToOM(payloadStr);
-        Options options = new Options();
-        options.setTo(targetEPR);
-        options.setAction("urn:" + action); //since soapAction = ""
-
-        //Blocking invocation
-        ServiceClient sender = new ServiceClient();
-        sender.setOptions(options);
-        if (log.isDebugEnabled()){
-            log.debug("Request: " + payload.toString());
-        }
-        OMElement result = sender.sendReceive(payload);
-        if (log.isDebugEnabled()){
-            log.debug("Response: "+ payload.toString());
-        }
-        return result;
-    }
-}


[2/7] Applying 0001-Refactor-status-monitor-module.patch

Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/StatusMonitorConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/StatusMonitorConfigurationBuilder.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/StatusMonitorConfigurationBuilder.java
deleted file mode 100644
index 9e6851e..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/StatusMonitorConfigurationBuilder.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.core;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.core.beans.AuthConfigBean;
-import org.wso2.carbon.status.monitor.core.beans.SampleTenantConfigBean;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.exception.StatusMonitorException;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.Iterator;
-
-/**
- * Builds the status monitor configurations from the configuration file, status-monitor-config.xml.
- */
-public class StatusMonitorConfigurationBuilder {
-    private static final Log log = LogFactory.getLog(StatusMonitorConfigurationBuilder.class);
-    private static BasicDataSource dataSource;
-    private static AuthConfigBean authConfigBean;
-    private static SampleTenantConfigBean sampleTenantConfigBean;
-
-
-    public StatusMonitorConfigurationBuilder(String statusConfigFile) throws StatusMonitorException {
-        try {
-            OMElement statusConfig = buildOMElement(new FileInputStream(statusConfigFile));
-            deserialize(statusConfig);
-            if (log.isDebugEnabled()) {
-                log.debug("********Status Monitor Configuration Builder**********" + statusConfigFile);
-            }
-        } catch (FileNotFoundException e) {
-            String msg = "Unable to find the file responsible for status monitor configs: "
-                            + statusConfigFile;
-            log.error(msg, e);
-            throw new StatusMonitorException(msg, e);
-        }
-    }
-
-    private OMElement buildOMElement(InputStream inputStream) throws StatusMonitorException {
-        XMLStreamReader parser;
-        try {
-            parser = XMLInputFactory.newInstance().createXMLStreamReader(inputStream);
-        } catch (XMLStreamException e) {
-            String msg = "Error in initializing the parser to build the OMElement.";
-            log.error(msg, e);
-            throw new StatusMonitorException(msg, e);
-        }
-
-        StAXOMBuilder builder = new StAXOMBuilder(parser);
-        return builder.getDocumentElement();
-    }
-
-    /*
-       Deserialize the following
-       <billingConfig xmlns="http://wso2.com/carbon/status.monitor.config">
-           <dbConfig>
-                ...
-           </dbConfig>
-        </billingConfig>
-     */
-    private void deserialize(OMElement statusMonitorConfigEle) throws StatusMonitorException {
-        Iterator statusMonitorConfigChildIt = statusMonitorConfigEle.getChildElements();
-
-        while (statusMonitorConfigChildIt.hasNext()) {
-            OMElement statusMonitorConfigChildEle = (OMElement) statusMonitorConfigChildIt.next();
-
-            if (new QName(StatusMonitorConstants.CONFIG_NS, StatusMonitorConstants.DB_CONFIG,
-                    StatusMonitorConstants.NS_PREFIX).equals(statusMonitorConfigChildEle.getQName())) {
-                //element is "dbConfig"
-                initDataSource(statusMonitorConfigChildEle);
-            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
-                    StatusMonitorConstants.AUTH_CONFIG,
-                    StatusMonitorConstants.NS_PREFIX).equals(statusMonitorConfigChildEle.getQName())) {
-                //element is "authConfig"
-                initAuthentication(statusMonitorConfigChildEle);
-            } else if (new QName(StatusMonitorConstants.CONFIG_NS, StatusMonitorConstants.PS_CONFIG,
-                    StatusMonitorConstants.NS_PREFIX).equals(statusMonitorConfigChildEle.getQName())) {
-                //element is "psConfig"
-                initSampleServicesMonitoring(statusMonitorConfigChildEle);
-            } else {
-                String msg = "Unknown element in Status Monitor Configuration: " +
-                                statusMonitorConfigChildEle.getQName().getLocalPart();
-                log.warn(msg);
-            }
-        }
-    }
-
-    /*
-     * Deserialise dbConfigElement (Given below) and initialize data source
-        <dbConfig>
-            <url>jdbc:mysql://localhost:3306/stratos_stat</url>
-            <userName>monitor</userName>
-            <password>monitor</password>
-            <driverName>com.mysql.jdbc.Driver</driverName>
-            <maxActive>80</maxActive>
-            <maxWait>60000</maxWait>
-            <minIdle>5</minIdle>
-            <validationQuery>SELECT 1</validationQuery>
-        </dbConfig>
-     */
-    private void initDataSource(OMElement dbConfigEle) throws StatusMonitorException {
-        // initializing the data source and load the database configurations
-        Iterator dbConfigChildIt = dbConfigEle.getChildElements();
-        dataSource = new BasicDataSource();
-
-        while (dbConfigChildIt.hasNext()) {
-
-            OMElement dbConfigChildEle = (OMElement) dbConfigChildIt.next();
-            if (new QName(StatusMonitorConstants.CONFIG_NS, StatusMonitorConstants.DBCONFIG_URL,
-                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
-                dataSource.setUrl(dbConfigChildEle.getText());
-            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
-                    StatusMonitorConstants.DBCONFIG_USER_NAME,
-                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
-                dataSource.setUsername(dbConfigChildEle.getText());
-            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
-                    StatusMonitorConstants.DBCONFIG_PASSWORD,
-                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
-                dataSource.setPassword(dbConfigChildEle.getText());
-            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
-                    StatusMonitorConstants.DBCONFIG_DRIVER_NAME,
-                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
-                dataSource.setDriverClassName(dbConfigChildEle.getText());
-            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
-                    StatusMonitorConstants.DBCONFIG_MAX_ACTIVE,
-                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
-                dataSource.setMaxActive(Integer.parseInt(dbConfigChildEle.getText()));
-            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
-                    StatusMonitorConstants.DBCONFIG_MAX_WAIT,
-                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
-                dataSource.setMaxWait(Integer.parseInt(dbConfigChildEle.getText()));
-            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
-                    StatusMonitorConstants.DBCONFIG_MIN_IDLE,
-                    StatusMonitorConstants.NS_PREFIX).equals(dbConfigChildEle.getQName())) {
-                dataSource.setMinIdle(Integer.parseInt(dbConfigChildEle.getText()));
-            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
-                    StatusMonitorConstants.DBCONFIG_VALIDATION_QUERY,
-                    StatusMonitorConstants.NS_PREFIX)
-                    .equals(dbConfigChildEle.getQName())) {
-                dataSource.setValidationQuery(dbConfigChildEle.getText());
-            } else {
-                String msg = "Unknown element in DBConfig of Status Monitor Configuration: " +
-                                dbConfigChildEle.getQName().getLocalPart();
-                log.warn(msg);
-            }
-        }
-    }
-
-    /*
-     * Deserialise authConfigElement (Given below) and initializes authConfigBean
-    <authConfig>
-         <jksLocation>/home/carbon/automation/projects/src/resources/wso2carbon.jks</jksLocation>
-         <userName>admin@wso2-heartbeat-checker.org</userName>
-         <password>password123</password>
-     </authConfig>
-     */
-    private void initAuthentication(OMElement authConfigEle) throws StatusMonitorException {
-        // initializing the and loading the authentication configurations
-        Iterator authConfigChildIt = authConfigEle.getChildElements();
-        authConfigBean = new AuthConfigBean();
-
-        while (authConfigChildIt.hasNext()) {
-            OMElement authConfigChildEle = (OMElement) authConfigChildIt.next();
-            if (new QName(StatusMonitorConstants.CONFIG_NS, StatusMonitorConstants.JKS_LOCATION,
-                    StatusMonitorConstants.NS_PREFIX).equals(authConfigChildEle.getQName())) {
-                authConfigBean.setJksLocation(authConfigChildEle.getText());
-            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
-                    StatusMonitorConstants.AUTHCONFIG_USER_NAME,
-                    StatusMonitorConstants.NS_PREFIX).equals(authConfigChildEle.getQName())) {
-                authConfigBean.setUserName(authConfigChildEle.getText());
-            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
-                    StatusMonitorConstants.AUTHCONFIG_PASSWORD,
-                    StatusMonitorConstants.NS_PREFIX).equals(authConfigChildEle.getQName())) {
-                authConfigBean.setPassword(authConfigChildEle.getText());
-            } else if (new QName(StatusMonitorConstants.CONFIG_NS,
-                    StatusMonitorConstants.AUTHCONFIG_TENANT,
-                    StatusMonitorConstants.NS_PREFIX).equals(authConfigChildEle.getQName())) {
-                authConfigBean.setTenant(authConfigChildEle.getText());
-            } else {
-                String msg = "Unknown element in AuthConfig of Status Monitor Configuration: " +
-                                authConfigChildEle.getQName().getLocalPart();
-                log.warn(msg);
-            }
-        }
-    }
-
-    /**
-     <platformSample>
-              <tenantDomain>wso2.org</tenantDomain>
-     </platformSample>
-    */
-    private void initSampleServicesMonitoring (OMElement psConfigEle) throws StatusMonitorException {
-        // initializing the and loading the authentication configurations
-        Iterator psConfigChildIt = psConfigEle.getChildElements();
-        sampleTenantConfigBean = new SampleTenantConfigBean();
-
-        while (psConfigChildIt.hasNext()) {
-            OMElement psConfigChildEle = (OMElement) psConfigChildIt.next();
-            if (new QName(StatusMonitorConstants.CONFIG_NS, StatusMonitorConstants.PSCONFIG_TENANT,
-                    StatusMonitorConstants.NS_PREFIX).equals(psConfigChildEle.getQName())) {
-                sampleTenantConfigBean.setTenant(psConfigChildEle.getText());
-            } else {
-                String msg = "Unknown element in PSConfig of Status Monitor Configuration: " +
-                                psConfigChildEle.getQName().getLocalPart();
-                log.warn(msg);
-            }
-        }
-    }
-
-    public static BasicDataSource getDataSource() {
-        return dataSource;
-    }
-
-    public static AuthConfigBean getAuthConfigBean() {
-        return authConfigBean;
-    }
-
-    public static SampleTenantConfigBean getSampleTenantConfigBean() {
-        return sampleTenantConfigBean;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/beans/AuthConfigBean.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/beans/AuthConfigBean.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/beans/AuthConfigBean.java
deleted file mode 100644
index aa3f306..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/beans/AuthConfigBean.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.core.beans;
-
-/**
- * Authentication Configuration object that is read from the startus-monitor-config.xml.
- */
-public class AuthConfigBean {
-    private String jksLocation;
-    private String userName;
-    private String password;
-    private String tenant;
-
-    public String getTenant() {
-        return tenant;
-    }
-
-    public void setTenant(String tenant) {
-        this.tenant = tenant;
-    }
-
-    public String getJksLocation() {
-        return jksLocation;
-    }
-
-    public void setJksLocation(String jksLocation) {
-        this.jksLocation = jksLocation;
-    }
-
-    public String getUserName() {
-        return userName;
-    }
-
-    public void setUserName(String userName) {
-        this.userName = userName;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/beans/SampleTenantConfigBean.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/beans/SampleTenantConfigBean.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/beans/SampleTenantConfigBean.java
deleted file mode 100644
index 7b2aa42..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/beans/SampleTenantConfigBean.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.core.beans;
-
-/**
- * The tenant with the sample services installed.
- */
-public class SampleTenantConfigBean {
-    private String tenant;
-
-    public String getTenant() {
-        return tenant;
-    }
-
-    public void setTenant(String tenant) {
-        this.tenant = tenant;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/constants/StatusMonitorConstants.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/constants/StatusMonitorConstants.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/constants/StatusMonitorConstants.java
deleted file mode 100644
index c357059..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/constants/StatusMonitorConstants.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.core.constants;
-
-/**
- * Constants common to the stratos status monitor
- */
-public class StatusMonitorConstants {
-
-    /*Status Monitor Configuration File*/
-    public static final String STATUS_MONITOR_CONFIG = "status-monitor-config.xml";
-    public static final String CONFIG_NS = "http://wso2.com/carbon/status/monitor/config";
-
-    /*Authentication Configurations*/
-    public static final String AUTH_CONFIG = "authConfig";
-    public static final String JKS_LOCATION = "jksLocation";
-    public static final String AUTHCONFIG_USER_NAME = "userName";
-    public static final String AUTHCONFIG_PASSWORD = "password";
-    public static final String AUTHCONFIG_TENANT = "tenantDomain";
-
-    /*The tenant with the service samples*/
-    public static final String PS_CONFIG = "platformSample";
-    public static final String PSCONFIG_TENANT = "tenantDomain";
-
-    /*Database configurations*/
-    public static final String DB_CONFIG = "dbConfig";
-    public static final String NS_PREFIX = "";
-    public static final String DBCONFIG_VALIDATION_QUERY = "validationQuery";
-    public static final String DBCONFIG_MAX_WAIT = "maxWait";
-    public static final String DBCONFIG_MIN_IDLE = "minIdle";
-    public static final String DBCONFIG_MAX_ACTIVE = "maxActive";
-    public static final String DBCONFIG_DRIVER_NAME = "driverName";
-    public static final String DBCONFIG_PASSWORD = "password";
-    public static final String DBCONFIG_USER_NAME = "userName";
-    public static final String DBCONFIG_URL = "url";
-
-    public static final long HOUR_IN_MILLIS = 3600000;
-
-    /*Services List*/
-    public static final String MANAGER = "StratosLive Manager";
-    public static final String ESB = "StratosLive Enterprise Service Bus";
-    public static final String APPSERVER = "StratosLive Application Server";
-    public static final String DATA = "StratosLive Data Services Server";
-    public static final String GOVERNANCE = "StratosLive Governance Registry";
-    public static final String IDENTITY = "StratosLive Identity Server";
-    public static final String MONITOR = "StratosLive Business Activity Monitor";
-    public static final String PROCESS = "StratosLive Business Process Server";
-    public static final String RULE = "StratosLive Business Rules Server";
-    public static final String MASHUP = "StratosLive Mashup Server";
-    public static final String GADGET = "StratosLive Gadget Server";
-    public static final String CEP = "StratosLive Complex Event Processing Server";
-    public static final String MESSAGING = "StratosLive Message Broker";
-
-    public static final String CARBON_OM_NAMESPACE = "http://service.carbon.wso2.org";
-
-    /*Hosts list*/
-    public static final String APPSERVER_HOST = "appserver.stratoslive.wso2.com";
-    public static final String APPSERVER_HTTP = "http://appserver.stratoslive.wso2.com";
-    public static final String MONITOR_HOST = "monitor.stratoslive.wso2.com";
-
-    public static final String MESSAGING_HOST = "messaging.stratoslive.wso2.com";
-    public static final String MESSAGING_DEFAULT_PORT = "5675";
-
-    public static final String MASHUP_HOST = "mashup.stratoslive.wso2.com";
-    public static final String MASHUP_HTTP = "http://mashup.stratoslive.wso2.com";
-
-    public static final String PROCESS_HOST = "process.stratoslive.wso2.com";
-    public static final String PROCESS_HTTP = "http://process.stratoslive.wso2.com";
-
-    public static final String RULE_HOST = "rule.stratoslive.wso2.com";
-    public static final String RULE_HTTP = "http://rule.stratoslive.wso2.com";
-
-    public static final String CEP_HOST = "cep.stratoslive.wso2.com";
-
-    public static final String ESB_HOST = "esb.stratoslive.wso2.com";
-    public static final String ESB_HTTP = "http://esb.stratoslive.wso2.com";
-    public static final String ESB_NHTTP_PORT = "8280";
-
-    public static final String GOVERNANCE_HOST = "governance.stratoslive.wso2.com";
-    public static final String GOVERNANCE_HTTP = "http://governance.stratoslive.wso2.com";
-
-    public static final String GADGETS_HOST = "gadget.stratoslive.wso2.com";
-    public static final String GADGETS_HTTP = "http://gadget.stratoslive.wso2.com";
-
-    public static final String DATA_HOST = "data.stratoslive.wso2.com";
-    public static final String DATA_HTTP = "http://data.stratoslive.wso2.com";
-
-    public static final String IDENTITY_HOST = "identity.stratoslive.wso2.com";
-    public static final String IDENTITY_HTTPS = "https://identity.stratoslive.wso2.com";
-
-    public static final String MANAGER_HOST = "stratoslive.wso2.com";
-    public static final String MANAGER_HTTPS = "https://stratoslive.wso2.com";
-
-    public static final long SLEEP_TIME = 15 * 60 * 1000;
-
-
-    /*SQL Statements - Status Monitor Core and Common*/
-    public static final String GET_SERVICE_ID_SQL_WSL_NAME_LIKE_SQL =
-            "SELECT WSL_ID FROM WSL_SERVICE WHERE WSL_NAME LIKE ";
-    public static final String GET_SERVICE_STATE_ID_SQL =
-            "SELECT WSL_ID FROM WSL_SERVICE_STATE WHERE WSL_SERVICE_ID = ";
-    public static final String ID = "WSL_ID";
-    public static final String STATE_ID = "WSL_STATE_ID";
-    public static final String TIMESTAMP = "WSL_TIMESTAMP";
-    public static final String NAME = "WSL_NAME";
-    public static final String ORDER_BY_TIMESTAMP_SQL = " ORDER BY WSL_TIMESTAMP DESC LIMIT 1";
-    public static final String ORDER_BY_TIMESTAMP_SQL_DESC_LIMIT_01_SQL =
-            " ORDER BY WSL_TIMESTAMP DESC LIMIT 0,1";
-    public static final String SELECT_ALL_FROM_WSL_SERVICE_STATE_SQL =
-            "SELECT * FROM  WSL_SERVICE_STATE WHERE WSL_SERVICE_ID =";
-
-    /*SQL Statements - Status Monitor Back End*/
-    public static final String GET_STATE_NAME_SQL = "SELECT WSL_NAME FROM WSL_STATE";
-    public static final String GET_SERVICE_NAME_SQL = "SELECT WSL_NAME FROM WSL_SERVICE";
-    public static final String GET_ALL_STATE_DETAIL_SQL = "select s.WSL_NAME, ss.WSL_TIMESTAMP, " +
-            "ssd.WSL_DETAIL, ssd.WSL_TIMESTAMP " +
-            "from WSL_SERVICE as s, WSL_SERVICE_STATE as ss, WSL_SERVICE_STATE_DETAIL as " +
-            "ssd where s.WSL_ID = ss.WSL_SERVICE_ID AND ss.WSL_ID = ssd.WSL_SERVICE_STATE_ID " +
-            "AND (ss.WSL_STATE_ID=2 OR ss.WSL_STATE_ID=3) order by ss.WSL_TIMESTAMP DESC";
-    public static final String SERVICE_WSL_NAME = "s.WSL_NAME";
-    public static final String SERVICE_STATE_WSL_TIMESTAMP = "ss.WSL_TIMESTAMP";
-    public static final String SERVICE_STATE_DETAIL_WSL_TIMESTAMP = "ssd.WSL_TIMESTAMP";
-    public static final String SERVICE_STATE_DETAIL = "ssd.WSL_DETAIL";
-    public static final String GET_SERVICE_STATE_SQL =
-            "SELECT * FROM WSL_SERVICE_STATE WHERE WSL_SERVICE_ID=";
-
-    /*SQL statements - Status Monitor Agent*/
-    public static final String INSERT_STAT_SQL = "INSERT INTO WSL_SERVICE_HEARTBEAT VALUES (?,?,?,?)";
-    public static final String INSERT_STATE_SQL = "INSERT INTO WSL_SERVICE_STATE VALUES (?,?,?,?)";
-    public static final String UPDATE_STATE_SQL =
-            "UPDATE WSL_SERVICE_STATE SET WSL_STATE_ID=? WHERE WSL_ID= ?";
-    public static final String INSERT_STATE_DETAIL_SQL =
-            "INSERT INTO WSL_SERVICE_STATE_DETAIL VALUES (?,?,?,?)";
-
-}
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/exception/StatusMonitorException.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/exception/StatusMonitorException.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/exception/StatusMonitorException.java
deleted file mode 100644
index 24f1997..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/exception/StatusMonitorException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  Copyright (c) 2005-2012, 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.status.monitor.core.exception;
-
-/**
- * StatusMonitor specific exceptions
- */
-public class StatusMonitorException extends Exception{
-
-    public StatusMonitorException(String msg, Exception e) {
-        super(msg, e);
-    }
-
-    public StatusMonitorException(String msg) {
-        super(msg);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/internal/StatusMonitorCoreComponent.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/internal/StatusMonitorCoreComponent.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/internal/StatusMonitorCoreComponent.java
deleted file mode 100644
index 3adf53e..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/internal/StatusMonitorCoreComponent.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-*  Copyright (c) 2005-2012, 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.status.monitor.core.internal;
-
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.ComponentContext;
-import org.wso2.carbon.status.monitor.core.util.StatusMonitorUtil;
-import org.wso2.carbon.utils.ConfigurationContextService;
-
-/**
- * @scr.component name="org.wso2.carbon.status.monitor" immediate="true"
- * @scr.reference name="configuration.context.service"
- *                interface="org.wso2.carbon.utils.ConfigurationContextService"
- *                cardinality="1..1" policy="dynamic"
- *                bind="setConfigurationContextService"
- *                unbind="unsetConfigurationContextService"
- */
-public class StatusMonitorCoreComponent {
-    private static Log log = LogFactory.getLog(
-            StatusMonitorCoreComponent.class);
-
-    private static BundleContext bundleContext;
-    private static ConfigurationContextService configurationContextService;
-
-    protected void activate(ComponentContext context) {
-        try {
-            bundleContext = context.getBundleContext();
-            if (StatusMonitorUtil.getStatusMonitorConfiguration() == null) {
-                StatusMonitorUtil.initStatusMonitor(context.getBundleContext());
-                if (log.isDebugEnabled()) {
-                    log.debug("Status Monitor Agent initialized");
-                }
-            }
-            if (log.isDebugEnabled()) {
-                log.debug("******* Status Monitor core bundle is activated ******* ");
-            }
-        } catch (Exception e) {
-            log.error("******* Status Monitor Core bundle failed activating ****", e);
-        }
-    }
-
-    protected void deactivate(ComponentContext context) {
-        log.debug("******* Status Monitor core bundle is deactivated ******* ");
-    }
-
-    protected void setConfigurationContextService(
-            ConfigurationContextService configurationContextService) {
-        log.debug("Receiving ConfigurationContext Service");
-        StatusMonitorCoreComponent.
-                configurationContextService = configurationContextService;
-    }
-
-    protected void unsetConfigurationContextService(
-            ConfigurationContextService configurationContextService) {
-        log.debug("Unsetting ConfigurationContext Service");
-        setConfigurationContextService(null);
-    }
-
-    public static BundleContext getBundleContext() {
-        return bundleContext;
-    }
-
-    public static ConfigurationContextService getConfigurationContextService() {
-        return configurationContextService;
-    }
-
-    public static ConfigurationContext getConfigurationContext() {
-        if (configurationContextService.getServerConfigContext() == null) {
-            return null;
-        }
-        return configurationContextService.getServerConfigContext();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/jdbc/MySQLConnectionInitializer.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/jdbc/MySQLConnectionInitializer.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/jdbc/MySQLConnectionInitializer.java
deleted file mode 100644
index 5d106f6..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/jdbc/MySQLConnectionInitializer.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.core.jdbc;
-
-import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * The class connecting with the mysql database
- */
-public class MySQLConnectionInitializer {
-    private static Connection conn = null;
-    private static BasicDataSource dataSource;
-    private static final Log log = LogFactory.getLog(StatusMonitorConfigurationBuilder.class);
-
-    private static List<String> serviceList = new ArrayList<String>();
-    private static List<String> statusList = new ArrayList<String>();
-
-    /**
-     * gets a copy of services list
-     *
-     * @return an unmodifiable list.
-     */
-    public static List<String> getServiceList() {
-        return Collections.unmodifiableList(serviceList);
-    }
-
-    /**
-     * gets a copy of statuses list
-     *
-     * @return an unmodifiable list.
-     */
-    public static List<String> getStatusList() {
-        return Collections.unmodifiableList(statusList);
-    }
-
-    /**
-     * gets the sql connection and initializes the MySQLConnectionInitializer.
-     *
-     * @return Static Connection
-     * @throws Exception, throws exception       MySQLConnectionInitializer
-     */
-    public static Connection initialize() throws Exception {
-        //gets the data source from the configuration builder.
-        dataSource = StatusMonitorConfigurationBuilder.getDataSource();
-
-        //gets the sql connection.
-        getConnection();
-
-        //initializes the service and state lists.
-        serviceList = getServiceNamesList();
-        statusList = getStateNameList();
-
-        if (log.isDebugEnabled()) {
-            log.debug("Successfully initialized the mysql connection");
-        }
-        return conn;
-    }
-
-    /**
-     * Gets the SQL Connection to the status monitor database
-     *
-     * @return a Connection object
-     * @throws Exception, if getting the connection failed.
-     */
-    private static Connection getConnection() throws Exception {
-        try {
-            String userName = dataSource.getUsername(); //monitor
-            String password = dataSource.getPassword();   //monitor
-            String url = dataSource.getUrl(); //jdbc:mysql://localhost:3306/stratos_status
-            String driverName = dataSource.getDriverClassName();
-
-            Class.forName(driverName).newInstance();
-            conn = DriverManager.getConnection(url, userName, password);
-
-            if (conn != null) {
-                if (log.isDebugEnabled()) {
-                    log.debug("Connection Successful");
-                }
-            }
-        } catch (SQLException e) {
-            String msg = "SQL connection to the health monitor database instance failed";
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        } catch (Exception e) {
-            String msg = "Connection to the health monitor database instance failed";
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-        return conn;
-    }
-
-    /**
-     * Gets the list of available services
-     *
-     * @return List of services
-     * @throws SQLException, if getting the service name failed.
-     */
-    private static List<String> getServiceNamesList() throws SQLException {
-        List<String> serviceList = new ArrayList<String>();
-        ResultSet rs;
-        Statement stmtCon = conn.createStatement();
-        String sql = StatusMonitorConstants.GET_SERVICE_NAME_SQL;
-
-        stmtCon.executeQuery(sql);
-        rs = stmtCon.getResultSet();
-        String serviceName;
-        try {
-            while (rs.next()) {
-                serviceName = rs.getString(StatusMonitorConstants.NAME);
-                serviceList.add(serviceName);
-            }
-        } catch (SQLException e) {
-            String msg = "Getting the service name list failed";
-            log.error(msg, e);
-            throw new SQLException(msg, e);
-        } finally {
-            rs.close();
-            stmtCon.close();
-        }
-        return serviceList;
-    }
-
-    /**
-     * Gets state name with the given state id
-     *
-     * @return state name
-     *         {Up & Running, Broken, Down, Fixed. }
-     * @throws java.sql.SQLException, if the retrieval of the list of states failed.
-     */
-    private static List<String> getStateNameList() throws SQLException {
-        List<String> stateList = new ArrayList<String>();
-        ResultSet rs;
-        Statement stmtCon = conn.createStatement();
-        String sql = StatusMonitorConstants.GET_STATE_NAME_SQL;
-
-        stmtCon.executeQuery(sql);
-        rs = stmtCon.getResultSet();
-        String stateName;
-        try {
-            while (rs.next()) {
-                stateName = rs.getString(StatusMonitorConstants.NAME);
-                stateList.add(stateName);
-            }
-        } catch (SQLException e) {
-            String msg = "Getting the serviceID failed";
-            log.error(msg, e);
-            throw new SQLException(msg, e);
-        } finally {
-            rs.close();
-            stmtCon.close();
-        }
-        return stateList;
-    }
-
-    /**
-     * Gets the ServiceID, for the given product.
-     *
-     * @param product, name of the service/product
-     * @return serviceID: int
-     * @throws SQLException, if retrieving the service id failed.
-     */
-    public static int getServiceID(String product) throws SQLException {
-        Statement stmtCon = conn.createStatement();
-        String sql = StatusMonitorConstants.GET_SERVICE_ID_SQL_WSL_NAME_LIKE_SQL + "\"" + product + "\"";
-        int serviceId = 0;
-        ResultSet rs = stmtCon.getResultSet();
-
-        try {
-            stmtCon.executeQuery(sql);
-            while (rs.next()) {
-                serviceId = rs.getInt(StatusMonitorConstants.ID);
-            }
-        } catch (SQLException e) {
-            String msg = "Getting the serviceID failed";
-            log.error(msg, e);
-            throw new SQLException(msg, e);
-        } finally {
-            rs.close();
-            stmtCon.close();
-        }
-        return serviceId;
-    }
-
-    /**
-     * Gets the ServiceStateID, for the given product/service.
-     *
-     * @param serviceID: int; ID of the service/product
-     * @return serviceStateID: int
-     * @throws SQLException, if retrieving the service id failed.
-     */
-    public static int getServiceStateID(int serviceID) throws SQLException {
-        ResultSet rs;
-        Statement stmtCon = conn.createStatement();
-        String sql = StatusMonitorConstants.GET_SERVICE_STATE_ID_SQL + serviceID +
-                StatusMonitorConstants.ORDER_BY_TIMESTAMP_SQL;
-
-        stmtCon.executeQuery(sql);
-        rs = stmtCon.getResultSet();
-        int stateID = 0;
-        try {
-            while (rs.next()) {
-                stateID = rs.getInt(StatusMonitorConstants.ID);
-            }
-        } catch (SQLException e) {
-            String msg = "Getting the service state ID failed";
-            log.error(msg, e);
-            throw new SQLException(msg, e);
-        } finally {
-            rs.close();
-            stmtCon.close();
-        }
-        return stateID;
-    }
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/util/StatusMonitorUtil.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/util/StatusMonitorUtil.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/util/StatusMonitorUtil.java
deleted file mode 100644
index 053f93b..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/java/org/wso2/carbon/status/monitor/core/util/StatusMonitorUtil.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2012, 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.status.monitor.core.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.BundleContext;
-import org.wso2.carbon.status.monitor.core.StatusMonitorConfigurationBuilder;
-import org.wso2.carbon.status.monitor.core.constants.StatusMonitorConstants;
-import org.wso2.carbon.status.monitor.core.exception.StatusMonitorException;
-import org.wso2.carbon.status.monitor.core.jdbc.MySQLConnectionInitializer;
-import org.wso2.carbon.utils.CarbonUtils;
-
-import java.io.File;
-
-/**
- * Utility methods for Status monitor core.
- */
-public class StatusMonitorUtil {
-
-    private static final Log log =
-            LogFactory.getLog(org.wso2.carbon.status.monitor.core.util.StatusMonitorUtil.class);
-    private static StatusMonitorConfigurationBuilder statusMonitorConfiguration;
-
-    public static StatusMonitorConfigurationBuilder getStatusMonitorConfiguration() {
-        return statusMonitorConfiguration;
-    }
-
-    /**
-     * load the configuration for the status monitoring
-     * @param bundleContext, BundleContext
-     * @throws org.wso2.carbon.status.monitor.core.exception.StatusMonitorException,
-     * if the status monitoring failed.
-     */
-    public static void initStatusMonitor(
-            BundleContext bundleContext) throws StatusMonitorException {
-        String configFile =
-                CarbonUtils.getCarbonConfigDirPath() + File.separator +
-                        StatusMonitorConstants.STATUS_MONITOR_CONFIG;
-        try {
-            statusMonitorConfiguration = new StatusMonitorConfigurationBuilder(configFile);
-        } catch (Exception e) {
-            String msg = "The Status Monitor Configuration file not found";
-            log.error(msg, e);
-            throw new StatusMonitorException (msg, e);
-        }
-        try {
-            MySQLConnectionInitializer.initialize();
-        } catch (Exception e) {
-            String msg = "Error in initializing the mysql connection for the health monitoring";
-            log.error(msg, e);
-            throw new StatusMonitorException (msg, e);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/resources/META-INF/component.xml b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/resources/META-INF/component.xml
deleted file mode 100755
index 48b22f6..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/resources/META-INF/component.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  ~  Copyright (c) 2012, 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>Manage</DisplayName>
-            <ResourceId>/permission/protected/manage</ResourceId>
-        </ManagementPermission>
-        <ManagementPermission>
-            <DisplayName>Monitor</DisplayName>
-            <ResourceId>/permission/protected/manage/monitor</ResourceId>
-        </ManagementPermission>
-        <ManagementPermission>
-            <DisplayName>Tenants</DisplayName>
-            <ResourceId>/permission/protected/manage/monitor/tenants</ResourceId>
-        </ManagementPermission>
-        <ManagementPermission>
-            <DisplayName>Modify</DisplayName>
-            <ResourceId>/permission/protected/manage/modify</ResourceId>
-        </ManagementPermission>
-        <ManagementPermission>
-            <DisplayName>Tenants</DisplayName>
-            <ResourceId>/permission/protected/manage/modify/tenants</ResourceId>
-        </ManagementPermission>
-   </ManagementPermissions>
-</component>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/resources/database/wso2_slive_status.sql
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/resources/database/wso2_slive_status.sql b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/resources/database/wso2_slive_status.sql
deleted file mode 100644
index 65a93cb..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.core/2.1.0/src/main/resources/database/wso2_slive_status.sql
+++ /dev/null
@@ -1,148 +0,0 @@
--- MySQL dump 10.13  Distrib 5.1.41, for debian-linux-gnu (x86_64)
---
--- Host: localhost    Database: wso2_slive_status
--- ------------------------------------------------------
--- Server version	5.1.41-3ubuntu12.10
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Table structure for table `WSL_MAIL_CONTENT_HASH`
---
-drop database stratos_status;
-create database stratos_status;
-use stratos_status;
-DROP TABLE IF EXISTS `WSL_MAIL_CONTENT_HASH`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `WSL_MAIL_CONTENT_HASH` (
-  `WSL_HASH_ID` int(11) NOT NULL AUTO_INCREMENT,
-  `WSL_MAIL_HASH` varchar(255) NOT NULL,
-  `WSL_IS_MAIL_SENT` tinyint(1) NOT NULL DEFAULT '0',
-  PRIMARY KEY (`WSL_HASH_ID`)
-) ENGINE=MyISAM AUTO_INCREMENT=88 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `WSL_SERVICE`
---
-
-DROP TABLE IF EXISTS `WSL_SERVICE`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `WSL_SERVICE` (
-  `WSL_ID` int(11) NOT NULL AUTO_INCREMENT,
-  `WSL_NAME` varchar(265) NOT NULL,
-  PRIMARY KEY (`WSL_ID`)
-) ENGINE=MyISAM AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `WSL_SERVICE_HEARTBEAT`
---
-
-DROP TABLE IF EXISTS `WSL_SERVICE_HEARTBEAT`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `WSL_SERVICE_HEARTBEAT` (
-  `WSL_ID` bigint(20) NOT NULL AUTO_INCREMENT,
-  `WSL_SERVICE_ID` int(11) NOT NULL,
-  `WSL_STATUS` tinyint(1) NOT NULL DEFAULT '0',
-  `WSL_TIMESTAMP` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
-  PRIMARY KEY (`WSL_ID`)
-) ENGINE=MyISAM AUTO_INCREMENT=50286 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `WSL_SERVICE_STATE`
---
-
-DROP TABLE IF EXISTS `WSL_SERVICE_STATE`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `WSL_SERVICE_STATE` (
-  `WSL_ID` bigint(20) NOT NULL AUTO_INCREMENT,
-  `WSL_SERVICE_ID` int(11) NOT NULL,
-  `WSL_STATE_ID` int(11) NOT NULL,
-  `WSL_TIMESTAMP` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
-  PRIMARY KEY (`WSL_ID`)
-) ENGINE=MyISAM AUTO_INCREMENT=45884 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `WSL_SERVICE_STATE_DETAIL`
---
-
-DROP TABLE IF EXISTS `WSL_SERVICE_STATE_DETAIL`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `WSL_SERVICE_STATE_DETAIL` (
-  `WSL_ID` bigint(20) NOT NULL AUTO_INCREMENT,
-  `WSL_SERVICE_STATE_ID` bigint(20) NOT NULL,
-  `WSL_DETAIL` varchar(2048) NOT NULL,
-  `WSL_TIMESTAMP` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
-  PRIMARY KEY (`WSL_ID`)
-) ENGINE=MyISAM AUTO_INCREMENT=1249 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `WSL_STATE`
---
-
-DROP TABLE IF EXISTS `WSL_STATE`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `WSL_STATE` (
-  `WSL_ID` int(11) NOT NULL AUTO_INCREMENT,
-  `WSL_NAME` varchar(256) NOT NULL,
-  PRIMARY KEY (`WSL_ID`)
-) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `WSL_USER`
---
-
-DROP TABLE IF EXISTS `WSL_USER`;
-/*!40101 SET @saved_cs_client     = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `WSL_USER` (
-  `WSL_UID` int(11) NOT NULL AUTO_INCREMENT,
-  `WSL_MAIL` varchar(255) NOT NULL,
-  PRIMARY KEY (`WSL_UID`),
-  UNIQUE KEY `WSL_UID` (`WSL_UID`)
-) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-LOCK TABLES `WSL_SERVICE` WRITE;
-/*!40000 ALTER TABLE `WSL_SERVICE` DISABLE KEYS */;
-INSERT INTO `WSL_SERVICE` VALUES (1,'StratosLive Manager'),(2,'StratosLive Enterprise Service Bus'),(3,'StratosLive Application Server'),(4,'StratosLive Data Services Server'),(5,'StratosLive Governance Registry'),(6,'StratosLive Identity Server'),(7,'StratosLive Business Activity Monitor'),(8,'StratosLive Business Process Server'),(9,'StratosLive Business Rules Server'),(10,'StratosLive Mashup Server'),(11,'StratosLive Gadget Server'),(12,'StratosLive Complex Event Processing Server'),(13,'StratosLive Message Broker');
-/*!40000 ALTER TABLE `WSL_SERVICE` ENABLE KEYS */;
-UNLOCK TABLES;
-
-LOCK TABLES `WSL_STATE` WRITE;
-/*!40000 ALTER TABLE `WSL_STATE` DISABLE KEYS */;
-INSERT INTO `WSL_STATE` VALUES (1,'Up & Running'),(2,'Broken'),(3,'Down'),(4,'Resolved');
-/*!40000 ALTER TABLE `WSL_STATE` ENABLE KEYS */;
-UNLOCK TABLES;
-
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2011-09-06  9:39:52

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/pom.xml b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/pom.xml
deleted file mode 100644
index 7dba39e..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-# Copyright (c) 2012, 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>status-monitor-parent</artifactId>
-        <version>2.1.0</version>
-<relativePath>../../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.wso2.carbon.status.monitor.ui</artifactId>
-    <packaging>bundle</packaging>
-    <name>WSO2 Stratos - Status Monitor - 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.wso2.carbon.status.monitor.ui.*,
-                        </Export-Package>
-                        <Import-Package>
-                            javax.servlet;version="${imp.pkg.version.javax.servlet}",
-                            javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
-                            org.wso2.carbon.stratos.monitor.stub.*; version="${carbon.platform.package.import.version.range}",
-                            *;resolution:=optional
-                        </Import-Package>
-                        <Carbon-Component>UIBundle</Carbon-Component>
-                    </instructions>
-                </configuration>
-            </plugin>
-
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.ui</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.status.monitor.stub</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.stratos.common</artifactId>
-        </dependency>
-        <dependency>
-          <groupId>org.json.wso2</groupId>
-          <artifactId>json</artifactId>
-        </dependency>
-    </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/java/org/wso2/carbon/status/monitor/ui/clients/HealthMonitorServiceClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/java/org/wso2/carbon/status/monitor/ui/clients/HealthMonitorServiceClient.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/java/org/wso2/carbon/status/monitor/ui/clients/HealthMonitorServiceClient.java
deleted file mode 100755
index c1f29ca..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/java/org/wso2/carbon/status/monitor/ui/clients/HealthMonitorServiceClient.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
-*  Copyright (c) 2012, 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.status.monitor.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.status.monitor.stub.HealthMonitorServiceStub;
-import org.wso2.carbon.status.monitor.stub.beans.xsd.ServiceStateDetailInfoBean;
-import org.wso2.carbon.status.monitor.stub.beans.xsd.ServiceStateInfoBean;
-
-import org.wso2.carbon.ui.CarbonUIUtil;
-import org.wso2.carbon.utils.ServerConstants;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.http.HttpSession;
-
-/**
- * HealthMonitorService Client of status.monitor.ui
- */
-public class HealthMonitorServiceClient {
-    private static final Log log = LogFactory.getLog(
-            org.wso2.carbon.status.monitor.ui.clients.HealthMonitorServiceClient.class);
-
-    private HealthMonitorServiceStub stub;
-
-    public HealthMonitorServiceClient(String cookie, String backendServerURL,
-                                      ConfigurationContext configContext) throws RegistryException {
-
-        String epr = backendServerURL + "HealthMonitorService";
-
-        try {
-            stub = new HealthMonitorServiceStub(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 HealthMonitor service client. " + axisFault.getMessage();
-            log.error(msg, axisFault);
-            throw new RegistryException(msg, axisFault);
-        }
-    }
-
-    public HealthMonitorServiceClient(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);
-        String epr = backendServerURL + "HealthMonitorService";
-
-        try {
-            stub = new HealthMonitorServiceStub(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 HealthMonitor Services service client. " +
-                    axisFault.getMessage();
-            log.error(msg, axisFault);
-            throw new RegistryException(msg, axisFault);
-        }
-    }
-
-    public ServiceStateInfoBean[] retrieveStatuses() throws Exception {
-        return stub.getAllServiceStatus();
-    }
-
-    public ServiceStateInfoBean getServiceStatus(String serviceName) throws Exception {
-        return stub.getServiceStatus(serviceName);
-    }
-
-    public ServiceStateDetailInfoBean[] retrieveStateDetails() throws Exception {
-        return stub.getAllServiceStateDetail();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/java/org/wso2/carbon/status/monitor/ui/utils/StatusMonitorUtil.java
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/java/org/wso2/carbon/status/monitor/ui/utils/StatusMonitorUtil.java b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/java/org/wso2/carbon/status/monitor/ui/utils/StatusMonitorUtil.java
deleted file mode 100755
index 30d7e41..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/java/org/wso2/carbon/status/monitor/ui/utils/StatusMonitorUtil.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *  Copyright (c) 2012, 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.status.monitor.ui.utils;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.status.monitor.stub.beans.xsd.ServiceStateDetailInfoBean;
-import org.wso2.carbon.status.monitor.stub.beans.xsd.ServiceStateInfoBean;
-import org.wso2.carbon.status.monitor.ui.clients.HealthMonitorServiceClient;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-/**
- * Utility methods for status.monitor.ui
- */
-public class StatusMonitorUtil {
-    private static final Log log = LogFactory.getLog(
-            org.wso2.carbon.status.monitor.ui.utils.StatusMonitorUtil.class);
-
-    /**
-     * Get all the service statuses
-     *
-     * @param request HttpServletRequest
-     * @param config  ServletConfig
-     * @param session HttpSession
-     * @return ServiceStateInfoBean[] - Array of service states
-     * @throws Exception , if getting the service status information failed.
-     */
-    public static ServiceStateInfoBean[] retrieveStatuses(
-            HttpServletRequest request, ServletConfig config,
-                                              HttpSession session) throws Exception {
-
-        try {
-            HealthMonitorServiceClient serviceClient =
-                    new HealthMonitorServiceClient(config, session);
-            return serviceClient.retrieveStatuses();
-        } catch (Exception e) {
-            String msg = "Failed to get the service status info beans";
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-    }
-
-    /**
-     * Get all the service statuses
-     * @param request HttpServletRequest
-     * @param config  ServletConfig
-     * @param session HttpSession
-     * @return ServiceStateDetailInfoBean[] - Array of service state details
-     * @throws Exception , if getting the service state detail information failed.
-     */
-    public static ServiceStateDetailInfoBean[] retrieveStateDetails(
-            HttpServletRequest request, ServletConfig config,
-            HttpSession session) throws Exception {
-        try {
-            HealthMonitorServiceClient serviceClient =
-                    new HealthMonitorServiceClient(config, session);
-            return serviceClient.retrieveStateDetails();
-        } catch (Exception e) {
-            String msg = "Failed to get the service state details info beans";
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-    }
-
-    /**
-     * Get the status of a particular service
-     *
-     * @param request HttpServletRequest
-     * @param config  ServletConfig
-     * @param session HttpSession
-     * @return ServiceStateInfoBean - State details of the service
-     * @throws Exception, if error in getting the service state information
-     */
-    public static ServiceStateInfoBean getStatus(HttpServletRequest request, ServletConfig config,
-                                           HttpSession session) throws Exception {
-        String serviceName = "";
-        try {
-            serviceName = request.getParameter("service");
-            HealthMonitorServiceClient serviceClient =
-                    new HealthMonitorServiceClient(config, session);
-            return serviceClient.getServiceStatus(serviceName);
-        } catch (Exception e) {
-            String msg = "Failed to get the status details of the service:" + serviceName;
-            log.error(msg, e);
-            throw new Exception(msg, e);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/META-INF/component.xml b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/META-INF/component.xml
deleted file mode 100755
index 746c7f4..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/META-INF/component.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2012, 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.
- -->
-<component xmlns="http://products.wso2.org/carbon">
-    <!-- sample menu configuration -->
-    <menus>
-        <menu>
-            <id>status_monitor_menu</id>
-            <i18n-key>monitor.service.status</i18n-key>
-            <i18n-bundle>org.wso2.carbon.status.monitor.ui.i18n.Resources</i18n-bundle>
-            <parent-menu>monitor_menu</parent-menu>
-            <link>../status-monitor/service-status.jsp</link>
-            <region>region4</region>
-            <order>51</order>
-            <style-class>manage</style-class>
-            <icon>../status-monitor/images/services.gif</icon>
-            <require-permission>/permission/protected/manage/monitor/tenants</require-permission>
-            <require-super-tenant>true</require-super-tenant>
-        </menu>
-        <menu>
-            <id>status_details_menu</id>
-            <i18n-key>services.state.details</i18n-key>
-            <i18n-bundle>org.wso2.carbon.status.monitor.ui.i18n.Resources</i18n-bundle>
-            <parent-menu>monitor_menu</parent-menu>
-            <link>../status-monitor/status-details.jsp</link>
-            <region>region4</region>
-            <order>52</order>
-            <style-class>manage</style-class>
-            <icon>../status-monitor/images/services1.gif</icon>
-            <require-permission>/permission/protected/manage/monitor/tenants</require-permission>
-            <require-super-tenant>true</require-super-tenant>
-        </menu>
-    </menus>
-</component>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/org/wso2/carbon/status/monitor/ui/i18n/JSResources.properties
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/org/wso2/carbon/status/monitor/ui/i18n/JSResources.properties b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/org/wso2/carbon/status/monitor/ui/i18n/JSResources.properties
deleted file mode 100755
index e69de29..0000000

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/org/wso2/carbon/status/monitor/ui/i18n/Resources.properties
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/org/wso2/carbon/status/monitor/ui/i18n/Resources.properties b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/org/wso2/carbon/status/monitor/ui/i18n/Resources.properties
deleted file mode 100755
index 8933add..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/org/wso2/carbon/status/monitor/ui/i18n/Resources.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-monitor.service.status=Services Status
-services.state.details=Services State Details
-monitor.service_status.menu=Stratos Service Status
-monitor.status_details.menu=Service Status Details
-services.list=List of Services
-service.id=#
-service.name=Service Name
-service.state=Service State
-logged.time=Logged Time
-state.logged.time=State Logged Time
-service.state.details=Service State Details
-details.logged.time=Details Logged Time
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/css/status.css
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/css/status.css b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/css/status.css
deleted file mode 100755
index 2f06cc5..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/css/status.css
+++ /dev/null
@@ -1,62 +0,0 @@
-/*css editor styles */
-.csseditor-top-line{
-    background-color:black;
-    height:5px;
-}
-.csseditor-leftbox{
-    background-color:#9a9a9a;
-    padding-left:5px;
-    padding-right:5px;
-    padding-bottom:5px;
-    padding-top:15px;
-   height:380px;
-}
-.csseditor-leftbox-top{
-    color:#ffffff;
-    font-size:18px;
-    height:30px;
-}
-.csseditor-textbox{
-    background-color:#dfe7ed;
-    border:solid 1px #ffffff;
-    width:100%;
-}
-.csseditor-rightbox{
-    background-color:#c9c9c9;
-    border:solid 1px #ffffff;
-    height:400px;
-}
-.csseditor-rightbox-title{
-    background-color:#9a9a9a;
-    height:25px;
-    color:#ffffff;
-    padding-left:10px;
-    padding-top:5px;
-}
-.csseditor-searchbox{
-    padding-left:10px;
-    padding-top:10px;
-}
-#flickr_results{
-    height:300px;
-    overflow-y:auto;
-    overflow-x:hidden;
-    margin-left:5px;
-    margin-right:5px;
-    border:solid 1px #ffffff;
-}
-.imageList{
-}
-.imageList li {
-    padding-top: 3px !important;
-    padding-left: 5px !important;
-    background-color: #e1e9ec;
-    border: solid 1px #b5bdc1;
-}
-
-.imageList li a {
-    background-image: url(../images/images.gif);
-    background-repeat: no-repeat;
-    padding-left: 20px;
-    text-indent: 50px;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/docs/images/view-details.png
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/docs/images/view-details.png b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/docs/images/view-details.png
deleted file mode 100644
index 260c203..0000000
Binary files a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/docs/images/view-details.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/docs/images/view-status.png
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/docs/images/view-status.png b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/docs/images/view-status.png
deleted file mode 100644
index 9f5143e..0000000
Binary files a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/docs/images/view-status.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/docs/userguide.html
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/docs/userguide.html b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/docs/userguide.html
deleted file mode 100755
index 46ea38b..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/docs/userguide.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!--
- ~ Copyright (c) 2005-2012, 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.
- -->
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-  <title>Services Status Monitor - User Guide</title>
-  <link href="../../admin/css/documentation.css" rel="stylesheet" type="text/css" media="all" />
-</head>
-
-<body>
-
-
- <h1>View the Status of the Services</h1>
-
-
- <h2> <b> View Service Status</b></h2>
-
-<p>
-    In this page, you can see the status of the services. A service instance can be 'Up & Running',
-    'Broken', 'Down', and 'Resolved'.
-</p>
-    <img src="images/view-status.png" alt="View Status Page"/>
-    <div><strong>Figure1: View Services Status</strong></div>
-
- 
-
-
-<h2><b>View Status Details</b></h2>
-
-
-<p>
-
-   This page lists the service status logs. Hence, here you can view the details behind the service status.
-
-<img src="images/view-details.png" alt="View Status Details Page"/>
-<div><strong>Figure2: View Services Status Details</strong></div>
-
-
-</body>
-
-</html>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/images/services.gif
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/images/services.gif b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/images/services.gif
deleted file mode 100755
index 9883116..0000000
Binary files a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/images/services.gif and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/images/services1.gif
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/images/services1.gif b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/images/services1.gif
deleted file mode 100755
index d40a7a3..0000000
Binary files a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/images/services1.gif and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/fcb90b18/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/service-status.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/service-status.jsp b/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/service-status.jsp
deleted file mode 100644
index f7541b9..0000000
--- a/components/stratos/status-monitor/org.wso2.carbon.status.monitor.ui/2.1.0/src/main/resources/web/status-monitor/service-status.jsp
+++ /dev/null
@@ -1,126 +0,0 @@
-<!--
-~ Copyright (c) 2005-2012, 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.
--->
-<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
-<%@ page import="org.wso2.carbon.CarbonConstants" %>
-<%@ page import="org.wso2.carbon.registry.common.ui.UIException" %>
-<%@ page import="org.wso2.carbon.status.monitor.stub.beans.xsd.ServiceStateInfoBean" %>
-<%@ page import="org.wso2.carbon.status.monitor.ui.clients.HealthMonitorServiceClient" %>
-<%@ page import="org.wso2.carbon.status.monitor.ui.utils.StatusMonitorUtil" %>
-<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
-<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
-<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
-<%@ page import="java.text.SimpleDateFormat" %>
-<%@ page import="java.util.Calendar" %>
-<%@ page import="java.util.Date" %>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
-<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
-<jsp:include page="../registry_common/registry_common-i18n-ajaxprocessor.jsp"/>
-<script type="text/javascript" src="../registry_common/js/registry_validation.js"></script>
-<script type="text/javascript" src="../registry_common/js/registry_common.js"></script>
-<script type="text/javascript" src="../ajax/js/prototype.js"></script>
-<script type="text/javascript" src="js/status_config.js"></script>
-
-
-<carbon:jsi18n
-        resourceBundle="org.wso2.carbon.status.monitor.ui.i18n.JSResources"
-        request="<%=request%>"/>
-
-<fmt:bundle basename="org.wso2.carbon.status.monitor.ui.i18n.Resources">
-    <carbon:breadcrumb
-            label="monitor.service_status.menu"
-            resourceBundle="org.wso2.carbon.status.monitor.ui.i18n.Resources"
-            topPage="true"
-            request="<%=request%>"/>
-
-
-    <div id="middle">
-
-        <%
-            String backendServerURL = CarbonUIUtil.getServerURL(
-                    config.getServletContext(), session);
-            ConfigurationContext configContext = (ConfigurationContext) config
-                    .getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
-
-            String cookie = (String) session.getAttribute
-                    (ServerConstants.ADMIN_SERVICE_COOKIE);
-            HealthMonitorServiceClient client;
-            ServiceStateInfoBean[] serviceStateInfoBeanArr;
-            try {
-                client = new HealthMonitorServiceClient(cookie, backendServerURL, configContext);
-
-                serviceStateInfoBeanArr = client.retrieveStatuses();
-
-            } catch (UIException e) {
-                String error1 = "Error in retrieving service status";
-                request.setAttribute(CarbonUIMessage.ID, new CarbonUIMessage(error1, error1, null));
-        %>
-
-        <jsp:forward page="../admin/error.jsp"/>
-
-        <%
-                return;
-            }
-        %>
-
-        <br/>
-
-        <h2><fmt:message key="services.list"/></h2>
-
-        <div id="workArea">
-            <table cellpadding="0" cellspacing="0" border="0" style="width:100%" class="styledLeft">
-                <thead>
-                <tr>
-                    <th style="padding-left:5px;text-align:left;"><fmt:message
-                            key="service.name"/></th>
-                    <th style="padding-left:5px;text-align:left;"><fmt:message
-                            key="service.state"/></th>
-                    <th style="padding-left:5px;text-align:left;"><fmt:message key="logged.time"/></th>
-                </tr>
-                </thead>
-                <tbody>
-                <%
-                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
-
-                    if (serviceStateInfoBeanArr != null) {
-                        for (ServiceStateInfoBean serviceStateInfoBean : serviceStateInfoBeanArr) {
-                            if (serviceStateInfoBean == null) {
-                                continue;
-                            }
-
-                            String service = serviceStateInfoBean.getService();
-                            String state = serviceStateInfoBean.getServiceState();
-                            Date loggedDate = new Date(serviceStateInfoBean.getDate());
-                            String loggedDateStr = dateFormat.format(loggedDate);
-                %>
-                <tr id="1">
-                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=service%>
-                    </td>
-                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=state%>
-                    </td>
-                    <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=loggedDateStr%>
-                    </td>
-                </tr>
-                <% }
-                }
-                %>
-                </tbody>
-            </table>
-        </div>
-    </div>
-</fmt:bundle>
\ No newline at end of file