http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/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
deleted file mode 100644
index 3b56307..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/CEPServerClient.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-package org.apache.stratos.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/stratos/blob/ee5e9639/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
deleted file mode 100644
index 580d6fb..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/DataServerClient.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.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/stratos/blob/ee5e9639/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
deleted file mode 100644
index 0cd7b86..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ESBServerClient.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.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;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/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
deleted file mode 100644
index 8e95acc..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/GadgetServerClient.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.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/stratos/blob/ee5e9639/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
deleted file mode 100644
index 3f1ff5e..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/GovernanceRegistryServerClient.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.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/stratos/blob/ee5e9639/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
deleted file mode 100644
index 9e16137..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/IdentityServerClient.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.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/stratos/blob/ee5e9639/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
deleted file mode 100644
index 47316af..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ManagerServiceClient.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.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/stratos/blob/ee5e9639/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
deleted file mode 100644
index 61d3963..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/MashupServerClient.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.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/stratos/blob/ee5e9639/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
deleted file mode 100644
index a0f8459..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/MessageBrokerServiceClient.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.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/stratos/blob/ee5e9639/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
deleted file mode 100644
index 4e650ba..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/constants/StatusMonitorAgentConstants.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.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/stratos/blob/ee5e9639/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
deleted file mode 100644
index bc07b30..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/internal/StatusMonitorAgentComponent.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.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();
-    }
-}

Reply via email to