http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/select_domain.jsp
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/select_domain.jsp
 
b/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/select_domain.jsp
deleted file mode 100644
index b777789..0000000
--- 
a/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/select_domain.jsp
+++ /dev/null
@@ -1,390 +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.
-  --%>
-<%@ page import="org.apache.stratos.common.constants.StratosConstants" %>
-<%@ page import="org.apache.stratos.common.util.CommonUtil" %>
-<%@ page import="org.apache.stratos.register.ui.utils.TenantConfigUtil" %>
-<%@ page 
import="org.apache.stratos.tenant.register.stub.beans.xsd.CaptchaInfoBean" %>
-<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
-<%@ 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/select_domain.js"></script>
-<script type="text/javascript" src="../admin/js/jquery.js"></script>
-<script type="text/javascript" src="../admin/js/jquery.form.js"></script>
-<script type="text/javascript" 
src="../dialog/js/jqueryui/jquery-ui.min.js"></script>
-<script type="text/javascript" 
src="../googleanalytics/js/googleAnalyticsProcessor.js"></script>
-<carbon:jsi18n
-        resourceBundle="org.apache.stratos.register.ui.i18n.JSResources"
-        request="<%=request%>"/>
-<fmt:bundle basename="org.apache.stratos.register.ui.i18n.Resources">
-
-<jsp:include page="../registry_common/registry_common-i18n-ajaxprocessor.jsp"/>
-<link href="../tenant-register/css/tenant-register.css" rel="stylesheet" 
type="text/css" media="all"/>
-<script type="text/javascript" src="js/register_config.js"></script>
-<script type="text/javascript">
-
-    var packageInfo;
-    
-    function setFreeUsagePlan() {
-        var foundFreePlan = false;
-        for (var i = 0; i < packageInfo.length; i++) {
-            if (packageInfo[i].subscriptionCharge == "0") {
-                document.getElementById("selectedUsagePlan").value = 
packageInfo[i].name;
-                foundFreePlan = true;
-                return;
-            }
-        }
-        if(!foundFreePlan) {
-            document.getElementById("selectedUsagePlan").value = 
packageInfo[0].name;
-        }
-    }
-
-//    jQuery(document).ready(
-//                          function() {
-//                              jQuery.ajax({
-//                                  type: 'POST',
-//                                  url: 'get_package_info_ajaxprocessor.jsp',
-//                                  dataType: 'json',
-//                                  data: 'plan=0',
-//                                  async: false,
-//                                  success: function(data) {
-//                                      packageInfo = data;
-//                                  },
-//                                  error:function (xhr, ajaxOptions, 
thrownError) {
-//                                      CARBON.showErrorDialog('Could not get 
package information.');
-//                                  }
-//                              });
-//
-//                          }
-//            );
-</script>
-
-
-<%
-    String domainName = "";
-    String admin = "";
-    String email = "";
-    String firstname = "";
-    String lastname = "";
-    String usagePlan = "";
-    String license = CommonUtil.getEula();
-    boolean isPublicCloud = CommonUtil.isPublicCloudSetup();
-
-    session.setAttribute(StratosConstants.ORIGINATED_SERVICE,
-            request.getParameter(StratosConstants.ORIGINATED_SERVICE));
-    String domain = (String) session.getAttribute("temp-domain-to-register");
-    if (domain == null) {
-        domain = "";
-    }
-    session.removeAttribute("temp-domain-to-register");
-    // hm, i'm not sure whether we really need to clear the success key, if 
someone in the same session
-    // have succeeded validating the domain, we should let them ignore the 
validation step. but if
-    // someone look at this without much investigation, he may think this is a 
bug, so thought of clearing
-    // it anyway...
-    session.removeAttribute("validate-domain-success-key");
-    if ("false".equals(session.getAttribute("temp-domain-available"))) {
-        session.removeAttribute("temp-domain-available");
-%>
-
-<script type="text/javascript">
-    jQuery(document).ready(function() {
-        CARBON.showWarningDialog(jsi18n["domain.unavailable"]);
-    });
-</script>
-<%
-    }
-%>
-<link href="../tenant-register/css/tenant-register.css" rel="stylesheet" 
type="text/css" media="all"/>
-
-<%
-    CaptchaInfoBean captchaInfoBean;
-    try {
-        captchaInfoBean = TenantConfigUtil.generateRandomCaptcha(config, 
session);
-    } catch (Exception e) {
-        return;
-    }
-    String captchaImagePath = captchaInfoBean.getImagePath();
-
-    String captchaImageUrl = "../../" + captchaImagePath;
-    String captchaSecretKey = captchaInfoBean.getSecretKey();
-
-    if (session.getAttribute("submit-domain") != null) {
-        domain = (String) session.getAttribute("submit-domain");
-        session.setAttribute("submit-domain", null);
-    }
-    if (session.getAttribute("submit-admin") != null) {
-        admin = (String) session.getAttribute("submit-admin");
-        session.setAttribute("submit-admin", null);
-    }
-    if (session.getAttribute("submit-admin-email") != null) {
-        email = (String) session.getAttribute("submit-admin-email");
-        session.setAttribute("submit-admin-email", null);
-    }
-    if (session.getAttribute("submit-admin-firstname") != null) {
-        firstname = (String) session.getAttribute("submit-admin-firstname");
-        session.setAttribute("submit-admin-firstname", null);
-    }
-    if (session.getAttribute("submit-admin-lastname") != null) {
-        lastname = (String) session.getAttribute("submit-admin-lastname");
-        session.setAttribute("submit-admin-lastname", null);
-    }
-%>
-
-<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"; %>
-<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar"; 
prefix="carbon" %>
-
-<%
-    if ("failed".equals(session.getAttribute("kaptcha-status"))) {
-        session.setAttribute("kaptcha-status", null);
-%>
-
-<script type="text/javascript">
-    jQuery(document).ready(function() {
-        CARBON.showWarningDialog('Please enter the letters shown as in the 
image to register.');
-    });
-</script>
-<%
-    }
-
-    if ("true".equals(session.getAttribute("add-tenant-failed"))) {
-        session.removeAttribute("add-tenant-failed");
-%>
-
-<script type="text/javascript">
-    jQuery(document).ready(function() {
-        CARBON.showWarningDialog('Organization registration failed. Please try 
again with a different domain.');
-    });
-</script>
-<%
-    }
-%>
-<script type="text/javascript">
-    jQuery(document).ready(function() {
-
-        jQuery(".toggle_container").show();
-        /*Hide (Collapse) the toggle containers on load use show() instead of 
hide() in the
-         above code if you want to keep the content section expanded. */
-
-        jQuery("h2.trigger").click(function() {
-            if (jQuery(this).next().is(":visible")) {
-                this.className = "active trigger";
-            } else {
-                this.className = "trigger";
-            }
-
-            jQuery(this).next().slideToggle("fast");
-            return false; //Prevent the browser jump to the link anchor
-        });
-    });
-</script>
-<div id="middle">
-
-    <h2><fmt:message key="register.new.organization"/></h2>
-
-    <div id="workArea">
-        <div class="registration_help"><fmt:message key="required.msg"/></div>
-        <div id="activityReason" style="display: none;"></div>
-        <form id="addTenantForm" action="submit_tenant_ajaxprocessor.jsp" 
method="post">
-
-            <table class="styledLeft">
-                <tbody>
-                <tr>
-                    <td class="nopadding">
-                        <h2 class="trigger"><a href="#"><fmt:message 
key="domain.information"/></a></h2>
-
-                        <div class="toggle_container">
-                            <table class="normal-nopadding" cellspacing="0">
-                                <tbody>
-                                <tr>
-                                    <td class="leftCol-med"><fmt:message 
key="domain"/><span class="required">*</span>
-                                    </td>
-                                    <td colspan="2"><input 
onblur="fillAdminValue()"
-                                                           value="<%=domain%>" 
type="text"
-                                                           name="domain" 
id="domain"
-                                                           style="width:400px" 
value=""/>
-                                        <input type="button" value="Check 
Availability"
-                                               
onclick="checkDomainAvailability(<%=isPublicCloud?"true":"false"%>)"/> <span
-                                                id="busyCheck"></span>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <td></td>
-                                    <td colspan="2">Provide a domain for your 
tenant, in the
-                                        format "example.com". This domain 
should be unique.
-                                        If this is a legitimate domain, 
optionally you will be able to validate the ownership of the domain.
-                                    </td>
-                                </tr>
-
-                                <tr>
-                                    <td></td>
-                                    <td colspan="2">
-                                        <div 
id="domain-confirmation-msg"></div>
-                                    </td>
-                                </tr>
-
-                                <tr>
-                                    <td></td>
-                                    <td colspan="2">
-                                        <input type="checkbox" 
name="domain-confirmation"
-                                               value="yes">Validate the domain 
now
-                                        (optional)</input>
-                                    </td>
-                                </tr>
-
-                                </tbody>
-                            </table>
-                        </div>
-
-                        <h2 class="trigger"><a href="#"><fmt:message 
key="contact.details"/></a></h2>
-
-                        <div class="toggle_container">
-                            <table class="normal-nopadding" cellspacing="0">
-                                <tbody>
-                                <tr>
-                                    <td class="leftCol-med"><fmt:message 
key="admin.firstname"/><span
-                                            class="required">*</span></td>
-                                    <td><input type="text" 
name="admin-firstname" id="admin-firstname"
-                                               style="width:400px" 
value="<%=firstname%>"/></td>
-                                </tr>
-                                <tr>
-                                    <td><fmt:message 
key="admin.lastname"/><span class="required">*</span></td>
-                                    <td><input type="text" 
name="admin-lastname" id="admin-lastname" style="width:400px"
-                                               value="<%=lastname%>"/></td>
-                                </tr>
-                                <tr>
-                                    <td><fmt:message 
key="admin.username"/><span class="required">*</span></td>
-                                    <td><input type="text" name="admin" 
id="admin" style="width:400px"
-                                               value="<%=admin%>"/><span 
id="adminValue"></span></td>
-                                </tr>
-                                <tr>
-                                    <td><fmt:message key="admin.password"/>
-                                        <span class="required">*</span></td>
-                                    <td><input type="password" 
name="admin-password" id="admin-password"
-                                               style="width:400px"/></td>
-                                </tr>
-                                <tr>
-                                    <td></td>
-                                    <td class="registration_help">(Minimum of 
6 Characters in length)</td>
-                                </tr>
-                                <tr>
-                                    <td><fmt:message 
key="admin.password.repeat"/>
-                                        <span class="required">*</span></td>
-                                    <td><input type="password" 
name="admin-password-repeat" id="admin-password-repeat"
-                                               style="width:400px"/></td>
-                                </tr>
-                                <tr>
-                                    <td class="leftCol-med"><fmt:message 
key="admin.email"/><span
-                                            class="required">*</span></td>
-                                    <td colspan="2"><input type="text" 
name="admin-email" id="admin-email"
-                                                           style="width:400px" 
value="<%=email%>"/></td>
-                                </tr>
-                                <tr>
-                                    <td class="leftCol-med"><fmt:message 
key="word.verification"/><span
-                                            class="required">*</span></td>
-                                    <td colspan="2"><fmt:message 
key="captcha.message"/></td>
-                                </tr>
-                                <tr>
-                                    <td></td>
-                                    <td colspan="2">
-                                        <div id="kaptchaImgDiv"></div>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <td></td>
-                                    <td colspan="2" height="100"><input 
type="text" id="captcha-user-answer"
-                                                                        
name="captcha-user-answer" style="width:400px"
-                                                                        
value=""/></td>
-                                </tr>
-                                </tbody>
-                            </table>
-                        </div>
-
-                        <%
-                            if (isPublicCloud) {
-                        %>
-                        <h2 class="trigger"><a href="#"><fmt:message 
key="terms.of.use"/></a></h2>
-
-                        <div class="toggle_container">
-                            <table class="normal-nopadding" cellspacing="0">
-                                <tbody>
-
-
-                                <tr></tr>
-                                <tr>
-                                    <td>
-                                        <textarea rows="10" 
readonly="readonly" name="license-text"
-                                                  
style="width:100%"><%=license%>
-                                        </textarea>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <td><input type="checkbox" 
name="activateButton" id="activateButton"
-                                               
onclick="activateSubmit(form.activateButton.checked)"/>
-                                        <label 
for="activateButton"><fmt:message key="accept.eula"/></label></td>
-                                </tr>
-                                <%
-                                    }
-                                %>
-
-
-                                </tbody>
-                            </table>
-                        </div>
-                    </td>
-                </tr>
-                <tr id="buttonRow" colspan="2">
-                    <td class="buttonRow">
-                        <input type="hidden" name="selectedUsagePlan" 
id="selectedUsagePlan"/>
-                        <input type="hidden" name="captcha-secret-key" 
value="<%=captchaSecretKey%>"/>
-                        <%
-                            if (isPublicCloud) {
-                        %>
-                        <input class="button" id="submit-button" type="button" 
disabled="disabled" style="float:left; margin-top:4px"
-                               value="Next >" 
onclick="setFreeUsagePlan();addTenant();jQuery(this).attr('disabled', 
true);jQuery('#waitMessage').toggle('fast')"/>
-                        <%
-                        } else {
-                        %>
-                        <input class="button" id="submit-button" type="button" 
style="float:left; margin-top:4px"
-                               value="Next >" 
onclick="setFreeUsagePlan();addTenant();jQuery(this).attr('disabled', 
true);jQuery('#waitMessage').toggle('fast')"/>
-                        <%
-                            }
-                        %>
-                        <div id="waitMessage" style="font-size:13px 
!important;margin-top:5px; float:left;display:none"><img
-                                src="images/ajax-loader.gif" align="left" 
hspace="20"/>Registering new tenant ...
-                        </div>
-                        <div style="clear:both"></div>
-                    </td>
-                </tr>
-                </tbody>
-            </table>
-        </form>
-        <br/>
-    </div>
-</div>
-<script type="text/javascript">
-    showKaptcha('<%=captchaImageUrl%>');
-</script>
-</fmt:bundle>
-
-

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/select_usage_plan.jsp
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/select_usage_plan.jsp
 
b/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/select_usage_plan.jsp
deleted file mode 100644
index ac781de..0000000
--- 
a/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/select_usage_plan.jsp
+++ /dev/null
@@ -1,280 +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.
-  --%>
-<%@ page import="org.apache.stratos.common.constants.StratosConstants" %>
-<%@ page import="org.apache.stratos.common.util.CommonUtil" %>
-<%@ page import="org.apache.stratos.register.ui.utils.TenantConfigUtil" %>
-<%@ page 
import="org.apache.stratos.tenant.register.stub.beans.xsd.CaptchaInfoBean" %>
-<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
-<%@ 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/select_domain.js"></script>
-<script type="text/javascript" src="../admin/js/jquery.js"></script>
-<script type="text/javascript" src="../admin/js/jquery.form.js"></script>
-<script type="text/javascript" 
src="../dialog/js/jqueryui/jquery-ui.min.js"></script>
-<script type="text/javascript" 
src="../googleanalytics/js/googleAnalyticsProcessor.js"></script>
-<carbon:jsi18n
-        resourceBundle="org.apache.stratos.register.ui.i18n.JSResources"
-        request="<%=request%>"/>
-<fmt:bundle basename="org.apache.stratos.register.ui.i18n.Resources">
-
-<jsp:include page="../registry_common/registry_common-i18n-ajaxprocessor.jsp"/>
-<link href="../tenant-register/css/tenant-register.css" rel="stylesheet" 
type="text/css" media="all"/>
-<script type="text/javascript" src="js/register_config.js"></script>
-<script type="text/javascript">
-
-<%
-    boolean chargeOnRegistration = CommonUtil.isChargedOnRegistration();
-    String regDomain = (String)session.getAttribute("regTenantDomain");
-%>
-    var packageInfo;
-    function showRentalMessage() {
-
-//        if (packageInfo == null) {
-//            jQuery.ajax({
-//                type: 'POST',
-//                url: 'get_package_info_ajaxprocessor.jsp',
-//                dataType: 'json',
-//                data: 'plan=0',
-//                async: false,
-//                success: function(data) {
-//                    packageInfo = data;
-//                },
-//                error:function (xhr, ajaxOptions, thrownError) {
-//                    CARBON.showErrorDialog('Could not get package 
information.');
-//                }
-//            });
-//        }
-
-        var plan = document.getElementById('selectedUsagePlan').
-                
options[document.getElementById('selectedUsagePlan').selectedIndex].value;
-        var charge;
-        for (var i = 0; i < packageInfo.length; i++) {
-            if (packageInfo[i].name == plan) {
-                charge = packageInfo[i].subscriptionCharge;
-                break;
-            }
-
-        }
-
-        document.getElementById('packagePrice').innerHTML = '<b>' + 
'<fmt:message key="billing.currency"/>' + charge + " per month" + '</b>';
-
-    }
-
-    function makePayment() {
-        var selectEl = document.getElementById("selectedUsagePlan");
-        var selectedUsagePlan = selectEl.options[selectEl.selectedIndex].value;
-        var regTenantDomain = '<%= regDomain%>';
-
-
-        for (var i = 0; i < packageInfo.length; i++) {
-        <% if (chargeOnRegistration) { %>
-            if (packageInfo[i].name == selectedUsagePlan && 
packageInfo[i].subscriptionCharge != "0") {
-                CARBON.showConfirmationDialog('<fmt:message 
key="redirect.to.paypal.msg1"/>' + " " + '<fmt:message 
key="billing.currency"/>' + packageInfo[i].subscriptionCharge +
-                                              ". " + '<fmt:message 
key="redirect.to.paypal.msg2"/>', function() {
-                    document.getElementById('waitMessage').style.display = 
'block';
-                    document.forms["selectUsagePlan"].submit();
-                }, function () {
-                    
document.getElementById('submit-button').removeAttribute('disabled');
-                })
-
-            } else if (packageInfo[i].name == selectedUsagePlan && 
packageInfo[i].subscriptionCharge == "0") {
-                location.href = "../tenant-register/success_register.jsp";
-                break;
-            }
-            <% } else { %>
-                if(packageInfo[i].name == selectedUsagePlan && 
packageInfo[i].subscriptionCharge != "0") {
-                    jQuery.ajax({
-                        type: 'POST',
-                        url: 
'../payment/upgrade_registration_usage_plan_ajaxprocessor.jsp',
-                        data: {selectedUsagePlan: selectedUsagePlan, 
regTenantDomain: regTenantDomain},
-                        async: false,
-                        success: function(msg) {
-                    }});
-                    location.href = "../tenant-register/success_register.jsp";
-                    break;
-                } else if (packageInfo[i].name == selectedUsagePlan && 
packageInfo[i].subscriptionCharge == "0") {
-                    location.href = "../tenant-register/success_register.jsp";
-                    break;
-                }
-        <% } %>
-
-        }
-    }
-
-    function cancelPaymet() {
-        location.href = "../tenant-register/success_register.jsp";
-    }
-
-    jQuery(document).ready(
-                          function() {
-//                              jQuery.ajax({
-//                                  type: 'POST',
-//                                  url: 'get_package_info_ajaxprocessor.jsp',
-//                                  dataType: 'json',
-//                                  data: 'plan=0',
-//                                  async: false,
-//                                  success: function(data) {
-//                                      packageInfo = data;
-//                                  },
-//                                  error:function (xhr, ajaxOptions, 
thrownError) {
-//                                      CARBON.showErrorDialog('Could not get 
package information.');
-//                                  }
-//                              });
-
-                              var charge;
-                              var name;
-                              for (var i = 0; i < packageInfo.length; i++) {
-                                  charge = packageInfo[i].subscriptionCharge;
-                                  name = packageInfo[i].name;
-                                  option = document.createElement("option");
-                                  option.value = name;
-                                  option.innerHTML = name;
-                                  
document.getElementById('selectedUsagePlan').appendChild(option);
-
-                              }
-                          }
-            );
-</script>
-
-
-<%
-    boolean isPublicCloud = CommonUtil.isPublicCloudSetup();
-
-    session.setAttribute(StratosConstants.ORIGINATED_SERVICE,
-            request.getParameter(StratosConstants.ORIGINATED_SERVICE));
-    String domain = (String) session.getAttribute("temp-domain-to-register");
-    if (domain == null) {
-        domain = "";
-    }
-    session.removeAttribute("temp-domain-to-register");
-    // hm, i'm not sure whether we really need to clear the success key, if 
someone in the same session
-    // have succeeded validating the domain, we should let them ignore the 
validation step. but if
-    // someone look at this without much investigation, he may think this is a 
bug, so thought of clearing
-    // it anyway...
-    session.removeAttribute("validate-domain-success-key");
-    if ("false".equals(session.getAttribute("temp-domain-available"))) {
-        session.removeAttribute("temp-domain-available");
-%>
-
-<script type="text/javascript">
-    jQuery(document).ready(function() {
-        CARBON.showWarningDialog(jsi18n["domain.unavailable"]);
-    });
-</script>
-<%
-    }
-%>
-<link href="../tenant-register/css/tenant-register.css" rel="stylesheet" 
type="text/css" media="all"/>
-<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"; %>
-<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar"; 
prefix="carbon" %>
-
-<script type="text/javascript">
-    jQuery(document).ready(function() {
-
-        jQuery(".toggle_container").show();
-        /*Hide (Collapse) the toggle containers on load use show() instead of 
hide() in the
-         above code if you want to keep the content section expanded. */
-
-        jQuery("h2.trigger").click(function() {
-            if (jQuery(this).next().is(":visible")) {
-                this.className = "active trigger";
-            } else {
-                this.className = "trigger";
-            }
-
-            jQuery(this).next().slideToggle("fast");
-            return false; //Prevent the browser jump to the link anchor
-        });
-    });
-
-</script>
-<div id="middle">
-
-    <h2><fmt:message key="register.new.organization"/></h2>
-
-    <div id="workArea">
-        <div class="registration_help"><fmt:message key="required.msg"/></div>
-        <div id="activityReason" style="display: none;"></div>
-        <form id="selectUsagePlan" action="init_payment_ajaxprocessor.jsp" 
method="post">
-
-            <table class="styledLeft">
-                <tbody>
-                <tr>
-                    <td class="nopadding">
-                        <h2 class="trigger"><a href="#"><fmt:message 
key="usage.plan.information"/></a></h2>
-
-                        <div class="toggle_container">
-                            <table class="normal-nopadding" cellspacing="0">
-                                <tbody>
-                                <tr>
-                                    <td class="leftCol-med">
-                                        <fmt:message 
key="select.usage.plan.for.tenant"/><span class="required">*</span>
-                                    </td>
-                                    <td colspan="2">
-                                        <select name="selectedUsagePlan" 
id="selectedUsagePlan"
-                                                
onchange="showRentalMessage();">
-                                        </select>
-                                        <a 
href="<%=CommonUtil.getStratosConfig().getUsagePlanURL()%>" target="_blank">
-                                            <b>Pricing Info</b>
-                                        </a>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <td></td>
-                                    <td colspan="2" id="packagePrice" 
class="registration_help"><b><fmt:message
-                                            key="demo.package.price"/></b></td>
-                                </tr>
-                                <tr>
-                                    <td></td>
-                                    <td colspan="2" 
class="registration_help"><fmt:message
-                                            key="select.package.message"/>
-                                    </td>
-                                </tr>
-                                </tbody>
-                            </table>
-                        </div>                        
-                    </td>
-                </tr>
-                <tr id="buttonRow">
-                    <td class="buttonRow">
-                        <input class="button" id="submit-button" type="button" 
style="float:left; margin-top:4px; margin-right:4px;"
-                               value="Submit" 
onclick="makePayment();jQuery(this).attr('disabled', true)"/>
-                        <input class="button" id="cancel-button" type="button" 
style="float:left; margin-top:4px"
-                               value="Cancel" onclick="cancelPaymet()"/>
-                        <div id="waitMessage" style="font-size:13px 
!important;margin-top:5px; float:left; display:none"><img
-                                src="images/ajax-loader.gif" align="left" 
hspace="20"/>Connecting to PayPal ...
-                        </div>
-                        <div style="clear:both"></div>
-                    </td>
-                </tr>
-                </tbody>
-            </table>
-        </form>
-        <br/>
-    </div>
-</div>
-</fmt:bundle>
-
-

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/submit_tenant_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/submit_tenant_ajaxprocessor.jsp
 
b/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/submit_tenant_ajaxprocessor.jsp
deleted file mode 100644
index 6ea3e5a..0000000
--- 
a/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/submit_tenant_ajaxprocessor.jsp
+++ /dev/null
@@ -1,67 +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.
-  --%>
-<%@ page import="org.apache.stratos.register.ui.utils.TenantConfigUtil" %>
-<%@ page import="org.apache.stratos.common.constants.StratosConstants"%>
-<%@ page import="org.wso2.carbon.captcha.mgt.constants.CaptchaMgtConstants"%>
-<%@ page import="org.wso2.carbon.utils.multitenancy.MultitenantConstants" %>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"; %>
-<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar"; 
prefix="carbon" %>
-<carbon:jsi18n
-               resourceBundle="org.apache.stratos.register.ui.i18n.JSResources"
-               request="<%=request%>" />
-<%
-
-    try {
-        String gotoConfirmDomain = request.getParameter("domain-confirmation");
-        String domain = request.getParameter("domain");
-
-        String key = TenantConfigUtil.registerTenantConfigBean(request, 
config, session);
-
-        session.removeAttribute(StratosConstants.ORIGINATED_SERVICE);
-        session.setAttribute("add-tenant-success", "true");
-        session.setAttribute("regTenantDomain", domain);
-
-        String contextPath = "/" + 
MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/" + 
request.getParameter("domain");
-        //response.sendRedirect(contextPath + 
"/carbon/tenant-theme/theme_mgt.jsp?redirectWith=" + key);
-        // now we send the login page.
-
-       // response.sendRedirect(contextPath + "/carbon/admin/login.jsp");
-
-        if (gotoConfirmDomain != null && gotoConfirmDomain.equals("yes")) {
-            // send me to the domain validation form
-            
response.sendRedirect("../validate-domain/validate_domain_not_logged_in.jsp?domain="
 + domain);
-        }
-        else {
-            // send me direct to the add tenant form, without successkey they 
will add the suffix -unverified
-            response.sendRedirect("../tenant-register/select_usage_plan.jsp");
-        }
-
-    } catch (Exception e) {
-        String msg = e.getMessage();
-        TenantConfigUtil.setSubmissionValuesForSession(request);
-        if (msg.contains(CaptchaMgtConstants.CAPTCHA_ERROR_MSG)) {
-            session.setAttribute("kaptcha-status", "failed");
-        } else {
-        session.setAttribute("add-tenant-failed", "true");
-        }
-        response.sendRedirect("../tenant-register/select_domain.jsp");
-        return;
-    }
-%>

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/success_register.jsp
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/success_register.jsp
 
b/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/success_register.jsp
deleted file mode 100644
index b8a7ab4..0000000
--- 
a/components/org.apache.stratos.register.ui/src/main/resources/web/tenant-register/success_register.jsp
+++ /dev/null
@@ -1,77 +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.
-  --%>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<link href="css/tenant-register.css" rel="stylesheet" type="text/css" 
media="all"/>
-
-<%
-    // String contextPath = "/" + MultitenantConstants.TENANT_AWARE_URL_PREFIX 
+ "/" + request.getParameter("domain");
-%>
-<div id="middle">
-
-    <h2>
-        Account Created Successfully
-    </h2>
-
-    <div id="workArea">
-
-       <h3>Congratulations! You have successfully created an account for your 
organization with WSO2 Stratos. </h3>
-
-        <p style="font-size:16px" align="left">
-        A confirmation email has been sent to your email address for this 
account. Please follow the instructions in the email to activate the account.
-        After that login from the <a href="/carbon/admin/login.jsp"> <b>login 
page</b></a>.
-        </p>
-    </div>
-
-
-    <div class="clear"></div>
-    <div class="features">
-        <div class="feature">
-            <img src="images/feature-01-icon.gif"/>
-
-            <h2>Elasticity</h2>
-
-            <p>
-                Stratos manages your underlying cloud infrastructure to 
seamlessly handle the scalability demands of
-                your application.
-            </p>
-        </div>
-        <div class="feature">
-            <img src="images/feature-02-icon.gif"/>
-
-            <h2>Multi-tenancy</h2>
-
-            <p>
-                Departments, developer groups, or projects run fully 
independently, but share the same middleware
-                platform for maximum resource utilization.
-            </p>
-        </div>
-        <div class="feature">
-            <img src="images/feature-03-icon.gif"/>
-
-            <h2>Self Provisioning</h2>
-
-            <p>
-                Authorized users can provision new tenants from a web portal 
in moments.
-            </p>
-        </div>
-        <div class="clear"></div>
-    </div>
-
-
-

http://git-wip-us.apache.org/repos/asf/stratos/blob/ee5e9639/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
deleted file mode 100644
index 5cc1f0e..0000000
--- a/components/org.apache.stratos.status.monitor.agent/pom.xml
+++ /dev/null
@@ -1,100 +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.
-  -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-    <parent>
-        <groupId>org.apache.stratos</groupId>
-        <artifactId>stratos-components-parent</artifactId>
-        <version>4.1.0-SNAPSHOT</version>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.apache.stratos.status.monitor.agent</artifactId>
-    <packaging>bundle</packaging>
-    <name>Apache 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>${project.version}</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.2.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>
-</project>

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/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
deleted file mode 100644
index 9a641aa..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/ClientThreadsInitializer.java
+++ /dev/null
@@ -1,150 +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;
-
-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/stratos/blob/ee5e9639/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
deleted file mode 100644
index c1f4d58..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/common/ServiceLoginClient.java
+++ /dev/null
@@ -1,100 +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.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/stratos/blob/ee5e9639/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
deleted file mode 100644
index 9472427..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/ApplicationServerClient.java
+++ /dev/null
@@ -1,253 +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.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/stratos/blob/ee5e9639/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
deleted file mode 100644
index 0ef70af..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BAMServerClient.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements.  See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership.  The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *KIND, either express or implied.  See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-
-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/stratos/blob/ee5e9639/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
deleted file mode 100644
index 787ab02..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BPSServerClient.java
+++ /dev/null
@@ -1,128 +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.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/stratos/blob/ee5e9639/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
deleted file mode 100644
index 11ee7e1..0000000
--- 
a/components/org.apache.stratos.status.monitor.agent/src/main/java/org/apache/stratos/status/monitor/agent/clients/service/BRSServerClient.java
+++ /dev/null
@@ -1,138 +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.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);
-            }
-        }
-
-    }
-
-}

Reply via email to