You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2013/06/29 08:20:40 UTC

[41/52] [partial] initial commit to apache incubator. Here just commit WSO2 Stratos code base as it is. After that will start re-factor code to apache

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/js/account_mgt.js
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/js/account_mgt.js b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/js/account_mgt.js
new file mode 100644
index 0000000..c957312
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/js/account_mgt.js
@@ -0,0 +1,214 @@
+function deactivate(domain) {
+    sessionAwareFunction(function() {
+        CARBON.showConfirmationDialog("Are you sure you want to deactivate the domain: " +
+                                      domain + ".", function() {
+            var submitForm = document.getElementById("deactivate_form");
+            submitForm.submit();
+        });
+    }, "Session timed out. Please login again.");
+}
+
+function checkDomain(nname)
+{
+
+    var error = "";
+    error += validateEmpty(nname, "Domain");
+    if (error != "") {
+        return error;
+    }
+    //var arr = new Array(
+    //'.com','.net','.org','.biz','.coop','.info','.museum','.name',
+    //'.pro','.edu','.gov','.int','.mil','.ac','.ad','.ae','.af','.ag',
+    //'.ai','.al','.am','.an','.ao','.aq','.ar','.as','.at','.au','.aw',
+    //'.az','.ba','.bb','.bd','.be','.bf','.bg','.bh','.bi','.bj','.bm',
+    //'.bn','.bo','.br','.bs','.bt','.bv','.bw','.by','.bz','.ca','.cc',
+    //'.cd','.cf','.cg','.ch','.ci','.ck','.cl','.cm','.cn','.co','.cr',
+    //'.cu','.cv','.cx','.cy','.cz','.de','.dj','.dk','.dm','.do','.dz',
+    //'.ec','.ee','.eg','.eh','.er','.es','.et','.fi','.fj','.fk','.fm',
+    //'.fo','.fr','.ga','.gd','.ge','.gf','.gg','.gh','.gi','.gl','.gm',
+    //'.gn','.gp','.gq','.gr','.gs','.gt','.gu','.gv','.gy','.hk','.hm',
+    //'.hn','.hr','.ht','.hu','.id','.ie','.il','.im','.in','.io','.iq',
+    //'.ir','.is','.it','.je','.jm','.jo','.jp','.ke','.kg','.kh','.ki',
+    //'.km','.kn','.kp','.kr','.kw','.ky','.kz','.la','.lb','.lc','.li',
+    //'.lk','.lr','.ls','.lt','.lu','.lv','.ly','.ma','.mc','.md','.mg',
+    //'.mh','.mk','.ml','.mm','.mn','.mo','.mp','.mq','.mr','.ms','.mt',
+    //'.mu','.mv','.mw','.mx','.my','.mz','.na','.nc','.ne','.nf','.ng',
+    //'.ni','.nl','.no','.np','.nr','.nu','.nz','.om','.pa','.pe','.pf',
+    //'.pg','.ph','.pk','.pl','.pm','.pn','.pr','.ps','.pt','.pw','.py',
+    //'.qa','.re','.ro','.rw','.ru','.sa','.sb','.sc','.sd','.se','.sg',
+    //'.sh','.si','.sj','.sk','.sl','.sm','.sn','.so','.sr','.st','.sv',
+    //'.sy','.sz','.tc','.td','.tf','.tg','.th','.tj','.tk','.tm','.tn',
+    //'.to','.tp','.tr','.tt','.tv','.tw','.tz','.ua','.ug','.uk','.um',
+    //'.us','.uy','.uz','.va','.vc','.ve','.vg','.vi','.vn','.vu','.ws',
+    //'.wf','.ye','.yt','.yu','.za','.zm','.zw');
+
+    var mai = nname.value;
+
+    var val = true;
+    var dot = mai.lastIndexOf(".");
+    var dname = mai.substring(0, dot);
+    var ext = mai.substring(dot, mai.length);
+    //alert(ext);
+
+    if (ext.indexOf("-trial") >= 0 || ext.indexOf("-unverified") >= 0) {
+        // we are not allowing to create a domain with -trial or -unverified is in the extension
+        return "The domain name you entered is not valid. Please enter a valid domain name.";
+    }
+
+    if (ext.indexOf("/") >= 0 || ext.indexOf("\\") >= 0) {
+        return "The '/' and '\\' is not allowed in a domain name";
+    }
+
+    if (dot > 1 && dot < 57)
+    {
+        //	for(var i=0; i<arr.length; i++)
+        //	{
+        //	  if(ext == arr[i])
+        //	  {
+        //	 	val = true;
+        //		break;
+        //	  }
+        //	  else
+        //	  {
+        //	 	val = false;
+        //	  }
+        //	}
+        if (!val)
+        {
+            error = "Your domain extension " + ext + " is not correct";
+            return error;
+        }
+        else
+        {
+            for (var j = 0; j < dname.length; j++)
+            {
+                var dh = dname.charAt(j);
+                var hh = dh.charCodeAt(0);
+                if ((hh > 47 && hh < 59) || (hh > 64 && hh < 91) || (hh > 96 && hh < 123) || hh == 45 || hh == 46)
+                {
+                    if ((j == 0 || j == dname.length - 1) && hh == 45)
+                    {
+                        error = "Domain name should not begin and end with '-'";
+                        return error;
+                    }
+                }
+                else {
+                    error = "Your domain name should not have special characters";
+                    return error;
+                }
+            }
+        }
+    }
+    else
+    {
+        error = "Your Domain name is too short/long or you should have an extension to your domain.";
+        return error;
+    }
+
+    return error;
+}
+
+function clearDomainConfirmationMsg() {
+    var domain_confirmation_div = document.getElementById("domain-confirmation-msg");
+    domain_confirmation_div.innerHTML = "";
+}
+
+
+function domainSelected() {
+    var domain = document.getElementById('domainToValidate');
+
+    var reason = validateEmpty(domain, "Domain");
+    if (reason == "") {
+        reason += checkDomain(domain);
+    }
+
+    if (reason != "") {
+        CARBON.showWarningDialog(reason);
+        return false;
+    }
+    sessionAwareFunction(function() {
+        var validateDomainForm = document.getElementById('validateDomainForm');
+        validateDomainForm.submit();
+    }, "Session timed out. Please login again.");
+
+}
+
+function updateContact() {
+    var email = document.getElementById("email");
+    var oldEmail = document.getElementById("old-email");
+    var reason = "";
+    if (reason == "") {
+        reason += validateEmpty(email, "Email");
+    }
+    if (reason == "") {
+        reason += validateEmail(email);
+    }
+
+    if (reason == "" && email.value == oldEmail.innerHTML) {
+        reason += "You have not updated your email yet."
+    }
+
+    if (reason != "") {
+        CARBON.showWarningDialog(reason);
+        return;
+    }
+    // now call the updateContact.
+
+    sessionAwareFunction(function() {
+        debugger;
+        var busyContactPlaceHolder = document.getElementById("busyContact");
+        busyContactPlaceHolder.innerHTML = "<img src=\"images/ajax-loader.gif\"/>";
+
+        new Ajax.Request('../account-mgt/update_contact_ajaxprocessor.jsp',
+        {
+            method:'post',
+            parameters: {email: email.value},
+
+            onSuccess: function(transport) {
+                var returnValue = transport.responseText;
+                busyContactPlaceHolder.innerHTML = "";
+
+                if (returnValue.search(/----failed----/) == -1) {
+                    CARBON.showWarningDialog("We have sent an email to validate the contact details you just entered. Please follow " +
+                                             "the instructions in there to submit the updated contact details");
+                }
+                else {
+                    CARBON.showWarningDialog("Updating the contact information failed.");
+                }
+            },
+
+            onFailure: function(transport) {
+                busyContactPlaceHolder.innerHTML = "";
+                CARBON.showWarningDialog("Updating the contact information failed.");
+            }
+        });
+    }, "Session timed out. Please login again.");
+}
+
+
+function updateProfile() {
+    var update_profile_form = document.getElementById("update_profile_form");
+    var firstname = document.getElementById("firstname");
+    var oldFirstname = document.getElementById("old-firstname");
+    var lastname = document.getElementById("lastname");
+    var oldLastname = document.getElementById("old-lastname");
+
+    var reason = "";
+
+    if (reason == "") {
+        reason += validateEmpty(firstname, "First Name");
+    }
+    if (reason == "") {
+        reason += validateEmpty(lastname, "Last Name");
+
+        if ((reason == "" && firstname.value == oldFirstname.innerHTML) &&
+            (reason == "" && lastname.value == oldLastname.innerHTML)) {
+            reason += "You have not updated your firstname or last name yet.";
+        }
+    }
+    if (reason != "") {
+        CARBON.showWarningDialog(reason);
+        return;
+    }
+    update_profile_form.submit();
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_contact_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_contact_ajaxprocessor.jsp b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_contact_ajaxprocessor.jsp
new file mode 100644
index 0000000..58a323b
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_contact_ajaxprocessor.jsp
@@ -0,0 +1,35 @@
+<!--
+ ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. licenses this file to you under the Apache License,
+ ~ Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~    http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied.  See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<%@ page import="org.wso2.carbon.registry.core.exceptions.RegistryException" %>
+<%@ page import="org.wso2.carbon.account.mgt.ui.clients.AccountMgtClient" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+AccountMgtClient client;
+try {
+    String email = request.getParameter("email");
+    client = new AccountMgtClient(config, session);
+    client.updateContact(email);
+
+} catch (RegistryException e) {
+%>
+----failed----
+<%
+    return;
+}
+
+%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_profile_processor.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_profile_processor.jsp b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_profile_processor.jsp
new file mode 100644
index 0000000..d0158c9
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_profile_processor.jsp
@@ -0,0 +1,62 @@
+<!--
+ ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. licenses this file to you under the Apache License,
+ ~ Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~    http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied.  See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<%@ page import="org.wso2.carbon.registry.core.exceptions.RegistryException" %>
+<%@ page import="org.wso2.carbon.account.mgt.ui.clients.AccountMgtClient" %>
+<%@ page import="org.wso2.carbon.account.mgt.ui.utils.Util" %>
+<%@ 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.wso2.carbon.register.ui.i18n.JSResources"
+		request="<%=request%>" />
+<link href="css/update_profile.css" rel="stylesheet" type="text/css" media="all"/>
+
+
+<%
+    Boolean isUpdated;
+
+    try {
+    isUpdated = Util.updateFullname(request, config, session);
+    }
+    catch (Exception e) {
+    isUpdated  = false;
+    }
+
+%>
+<%        if (isUpdated) { %>
+
+    <div id="middle">
+
+       <h2>
+           Profile Successfully Updated.
+       </h2>
+
+
+   <%   }  else { %>
+
+    <div id="middle">
+
+       <h2>
+           Profile Update Failed
+       </h2>
+
+        <% } %>
+        <p>
+            Go to  <a href="../admin/index.jsp"> home page. </a>
+        </p>
+      </div>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_verifier.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_verifier.jsp b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_verifier.jsp
new file mode 100644
index 0000000..2b35fc3
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_verifier.jsp
@@ -0,0 +1,56 @@
+<!--
+ ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. licenses this file to you under the Apache License,
+ ~ Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~    http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied.  See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ page import="org.wso2.carbon.account.mgt.ui.clients.AccountMgtClient" %>
+<%@ page import="org.wso2.carbon.account.mgt.ui.utils.Util" %>
+<%@ page import="org.wso2.carbon.registry.core.exceptions.RegistryException" %>
+<%@ page import="org.wso2.carbon.account.mgt.ui.clients.EmailValidationClient" %>
+<%@ 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.wso2.carbon.register.ui.i18n.JSResources"
+        request="<%=request%>" />
+<%
+    String data = (String)session.getAttribute("intermediate-data");
+        
+    Util.readIntermediateData(request, data);
+
+    EmailValidationClient client;
+    String email;
+    String domain;
+    try {
+        email = (String)request.getAttribute("email");
+        domain = (String)request.getAttribute("tenantDomain");
+        String confirmationKey = (String)request.getAttribute("confirmationKey");
+
+        client = new EmailValidationClient(config, session);
+        client.proceedUpdateContact(domain, email, confirmationKey);
+    } catch (RegistryException e) {
+    %>
+      <div>Error in validating the contact.</div>
+    <%
+        return;
+    }
+
+%>
+
+<div style="margin:20px">You have successfully validated your email address and the contact information associated with your WSO2
+    Cloud Services account is updated. Click <a href="../admin/index.jsp">here</a> to access WSO2 Cloud Manager.    
+</div>
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_verifier_redirector_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_verifier_redirector_ajaxprocessor.jsp b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_verifier_redirector_ajaxprocessor.jsp
new file mode 100644
index 0000000..cb5beae
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/update_verifier_redirector_ajaxprocessor.jsp
@@ -0,0 +1,30 @@
+<!--
+ ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. licenses this file to you under the Apache License,
+ ~ Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~    http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied.  See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<%@ page import="org.wso2.carbon.account.mgt.ui.utils.Util" %>
+<%@ page import="org.wso2.carbon.utils.multitenancy.MultitenantConstants" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+//this jsp is used just to redirect to the correct update verifier.
+
+String data = (String)session.getAttribute("intermediate-data");
+
+Util.readIntermediateData(request, data);
+String domain = (String)request.getAttribute("tenantDomain");
+String contextPath = "/" + MultitenantConstants.TENANT_AWARE_URL_PREFIX + "/" + domain;
+response.sendRedirect("../account-mgt/update_verifier.jsp");
+%>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/validate_domain_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/validate_domain_ajaxprocessor.jsp b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/validate_domain_ajaxprocessor.jsp
new file mode 100644
index 0000000..71da4bd
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/validate_domain_ajaxprocessor.jsp
@@ -0,0 +1,29 @@
+<!--
+ ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. licenses this file to you under the Apache License,
+ ~ Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~    http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied.  See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+%@ page import="org.wso2.carbon.registry.core.RegistryConstants" %>
+<%@ 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" %>
+<%
+
+String domainToValidate = request.getParameter("domain");
+
+
+response.sendRedirect("../validate-domain/validate_domain_logged_in.jsp?domain=" + domainToValidate);
+
+%>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/validation_success_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/validation_success_ajaxprocessor.jsp b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/validation_success_ajaxprocessor.jsp
new file mode 100644
index 0000000..15aec9b
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/validation_success_ajaxprocessor.jsp
@@ -0,0 +1,49 @@
+<!--
+ ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. licenses this file to you under the Apache License,
+ ~ Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~    http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied.  See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<%@ page import="org.wso2.carbon.account.mgt.ui.clients.AccountMgtClient" %>
+<%@ page import="org.wso2.carbon.registry.core.exceptions.RegistryException" %>
+<%@ page import="org.wso2.carbon.utils.multitenancy.MultitenantConstants" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+try {
+    String domainToRegister = (String)session.getAttribute("temp-domain-to-register");
+    String successKey = (String)session.getAttribute("validate-domain-success-key");
+    AccountMgtClient client = new AccountMgtClient(config, session);
+    if (client.finishedDomainValidation(domainToRegister, successKey)) {
+
+        //session.setAttribute(MultitenantConstants.TENANT_DOMAIN, domainToRegister);
+        session.setAttribute("domain-validation-success", "true");
+        // redirect to the login page with new domain name
+        response.sendRedirect("/t/" + domainToRegister + "/carbon/account-mgt/account_mgt.jsp");
+        return;
+    } else {
+        session.removeAttribute("temp-domain-to-register");
+        session.removeAttribute("validate-domain-success-key");
+
+        // now redirect to the account_mgt.js with the failure
+        session.setAttribute("domain-validation-failure", "true");
+        response.sendRedirect("../account-mgt/account_mgt.jsp");
+        return;
+    }
+} catch (RegistryException e) {
+%>
+  <div>Error in finishing the validation.</div>
+<%
+    return;
+}
+%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/pom.xml b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/pom.xml
new file mode 100644
index 0000000..28fe6f9
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/pom.xml
@@ -0,0 +1,88 @@
+<!--
+# Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.wso2.carbon</groupId>
+        <artifactId>account-mgt-parent</artifactId>
+        <version>2.1.0</version>
+<relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.wso2.carbon.account.mgt</artifactId>
+    <packaging>bundle</packaging>
+    <name>WSO2 Stratos - Account Management</name>
+
+    <build>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+                        <Bundle-Name>${project.artifactId}</Bundle-Name>
+                        <Private-Package>
+                            org.wso2.carbon.account.mgt.*,
+                        </Private-Package>
+                        <Import-Package>
+                            org.wso2.carbon.registry.core.*;version=1.0.1,
+                            javax.xml.namespace; version=0.0.0,
+                            javax.servlet;version="${imp.pkg.version.javax.servlet}",
+                            javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
+                            *;resolution:=optional
+                        </Import-Package>
+                        <DynamicImport-Package>*</DynamicImport-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.registry.core</artifactId>
+        </dependency>
+        <dependency>
+           <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.email.verification</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.stratos.common</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.tenant.mgt</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>atlassian-jira</artifactId>
+            <version>1.0.0.wso2v1</version>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/beans/AccountInfoBean.java
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/beans/AccountInfoBean.java b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/beans/AccountInfoBean.java
new file mode 100644
index 0000000..ca03e48
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/beans/AccountInfoBean.java
@@ -0,0 +1,40 @@
+/*
+ *  Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ *  WSO2 Inc. licenses this file to you under the Apache License,
+ *  Version 2.0 (the "License"); you may not use this file except
+ *  in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.wso2.carbon.account.mgt.beans;
+
+public class AccountInfoBean {
+    private String firstname;
+    private String lastname;
+
+    public String getFirstname() {
+        return firstname;
+    }
+
+    public void setFirstname(String firstname) {
+        this.firstname = firstname;
+    }
+
+    public String getLastname() {
+        return lastname;
+    }
+
+    public void setLastname(String lastname) {
+        this.lastname = lastname;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/internal/AccountMgtServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/internal/AccountMgtServiceComponent.java b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/internal/AccountMgtServiceComponent.java
new file mode 100644
index 0000000..4707b02
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/internal/AccountMgtServiceComponent.java
@@ -0,0 +1,139 @@
+/*
+*  Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+*
+*  WSO2 Inc. licenses this file to you under the Apache License,
+*  Version 2.0 (the "License"); you may not use this file except
+*  in compliance with the License.
+*  You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+package org.wso2.carbon.account.mgt.internal;
+
+import org.wso2.carbon.account.mgt.util.Util;
+import org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber;
+import org.wso2.carbon.registry.core.service.RegistryService;
+import org.wso2.carbon.stratos.common.TenantBillingService;
+import org.wso2.carbon.stratos.common.listeners.TenantMgtListener;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.utils.ConfigurationContextService;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * @scr.component name="org.wso2.carbon.account.mgt" immediate="true"
+ * @scr.reference name="registry.service"
+ *                interface="org.wso2.carbon.registry.core.service.RegistryService"
+ *                cardinality="1..1" policy="dynamic" bind="setRegistryService"
+ *                unbind="unsetRegistryService"
+ * @scr.reference name="user.realmservice.default"
+ *                interface="org.wso2.carbon.user.core.service.RealmService"
+ *                cardinality="1..1" policy="dynamic" bind="setRealmService"
+ *                unbind="unsetRealmService"
+ * @scr.reference name="config.context.service"
+ *                interface="org.wso2.carbon.utils.ConfigurationContextService"
+ *                cardinality="1..1" policy="dynamic"
+ *                bind="setConfigurationContextService"
+ *                unbind="unsetConfigurationContextService"
+ * @scr.reference name="emailverification.service" interface=
+ *                "org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber"
+ *                cardinality="1..1" policy="dynamic"
+ *                bind="setEmailVerificationService"
+ *                unbind="unsetEmailVerificationService"
+ * @scr.reference name="org.wso2.carbon.tenant.mgt.listener.service"
+ *                interface="org.wso2.carbon.stratos.common.listeners.TenantMgtListener"
+ *                cardinality="0..n" policy="dynamic"
+ *                bind="setTenantMgtListenerService"
+ *                unbind="unsetTenantMgtListenerService"
+ * @scr.reference name="default.tenant.billing.service"
+ *                interface="org.wso2.carbon.stratos.common.TenantBillingService"
+ *                cardinality="1..1" policy="dynamic"
+ *                bind="setTenantBillingService"
+ *                unbind="unsetTenantBillingService"
+ */
+public class AccountMgtServiceComponent {
+    private static Log log = LogFactory.getLog(AccountMgtServiceComponent.class);
+    private static ConfigurationContextService configContextService = null;
+    private static TenantBillingService billingService = null;
+    
+    protected void activate(ComponentContext context) {
+        try {
+            Util.loadEmailVerificationConfig();
+            log.debug("******* Stratos account management bundle is activated ******* ");
+        } catch (Exception e) {
+            log.error("******* Stratos account management bundle failed activating ****", e);
+        }
+    }
+
+    protected void deactivate(ComponentContext context) {
+        log.debug("******* Stratos account managment bundle is deactivated ******* ");
+    }
+
+    protected void setRegistryService(RegistryService registryService) {
+        Util.setRegistryService(registryService);
+    }
+
+    protected void unsetRegistryService(RegistryService registryService) {
+        Util.setRegistryService(null);
+    }
+
+    protected void setRealmService(RealmService realmService) {
+        Util.setRealmService(realmService);
+    }
+
+    protected void unsetRealmService(RealmService realmService) {
+        Util.setRealmService(null);
+    }
+
+    protected void setConfigurationContextService(ConfigurationContextService contextService) {
+        if (log.isDebugEnabled()) {
+            log.debug("Setting the ConfigurationContext");
+        }
+        configContextService = contextService;
+    }
+
+    protected void unsetConfigurationContextService(ConfigurationContextService contextService) {
+        if (log.isDebugEnabled()) {
+            log.debug("Unsetting the ConfigurationContext");
+        }
+    }
+
+    protected void setEmailVerificationService(EmailVerifcationSubscriber emailService) {
+        Util.setEmailVerificationService(emailService);
+    }
+
+    protected void unsetEmailVerificationService(EmailVerifcationSubscriber emailService) {
+        Util.setEmailVerificationService(null);
+    }
+
+    protected void setTenantMgtListenerService(TenantMgtListener tenantMgtListener) {
+        Util.addTenantMgtListenerService(tenantMgtListener);
+    }
+
+    protected void unsetTenantMgtListenerService(TenantMgtListener tenantMgtListener) {
+        Util.removeTenantMgtListenerService(tenantMgtListener);
+    }
+    
+    protected void setTenantBillingService(TenantBillingService tenantBillingService) {
+        billingService = tenantBillingService;
+    }
+    
+    protected void unsetTenantBillingService(TenantBillingService tenantBilling) {
+        setTenantBillingService(null);
+    }
+    
+    public static TenantBillingService getBillingService() {
+        return billingService;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/AccountMgtService.java
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/AccountMgtService.java b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/AccountMgtService.java
new file mode 100644
index 0000000..17b83e4
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/AccountMgtService.java
@@ -0,0 +1,416 @@
+/*
+ * Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * 
+ * WSO2 Inc. licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.wso2.carbon.account.mgt.services;
+
+import org.wso2.carbon.account.mgt.beans.AccountInfoBean;
+import org.wso2.carbon.account.mgt.util.Util;
+import org.wso2.carbon.core.AbstractAdmin;
+import org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber;
+import org.wso2.carbon.registry.core.RegistryConstants;
+import org.wso2.carbon.registry.core.Resource;
+import org.wso2.carbon.registry.core.session.UserRegistry;
+import org.wso2.carbon.registry.core.utils.UUIDGenerator;
+import org.wso2.carbon.stratos.common.beans.TenantInfoBean;
+import org.wso2.carbon.stratos.common.constants.StratosConstants;
+import org.wso2.carbon.stratos.common.util.ClaimsMgtUtil;
+import org.wso2.carbon.stratos.common.util.CommonUtil;
+import org.wso2.carbon.tenant.mgt.util.TenantMgtUtil;
+import org.wso2.carbon.user.core.UserCoreConstants;
+import org.wso2.carbon.user.core.UserStoreException;
+import org.wso2.carbon.user.core.UserStoreManager;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.user.core.tenant.Tenant;
+import org.wso2.carbon.user.core.tenant.TenantManager;
+import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Account Management Service Class
+ */
+public class AccountMgtService extends AbstractAdmin {
+    private static final Log log = LogFactory.getLog(AccountMgtService.class);
+
+    /**
+     * Updates the contact email.
+     *
+     * @param contactEmail email
+     * @throws Exception, if update contact failed.
+     */
+    public void updateContact(String contactEmail) throws Exception {
+        EmailVerifcationSubscriber emailverifier = Util.getEmailVerificationService();
+
+        TenantManager tenantManager = Util.getTenantManager();
+        UserRegistry registry = (UserRegistry) getGovernanceRegistry();
+        if (registry == null) {
+            // we can't continue without having a valid registry in the session
+            String msg = "Error in retrieving the registry for the login tenant.";
+            log.error(msg);
+            throw new Exception(msg);
+        }
+        int tenantId = registry.getTenantId();
+
+        Tenant tenant;
+        try {
+            tenant = (Tenant) tenantManager.getTenant(tenantId);
+        } catch (UserStoreException e) {
+            String msg = "Error in retrieving the tenant information for the tenant id: " +
+                    tenantId + ".";
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+
+        // generating the confirmation key
+        String confirmationKey = UUIDGenerator.generateUUID();
+        UserRegistry superTenantSystemRegistry =
+                Util.getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID);
+        Resource resource;
+        String emailVerificationPath = StratosConstants.ADMIN_EMAIL_VERIFICATION_FLAG_PATH +
+                RegistryConstants.PATH_SEPARATOR + tenantId;
+        if (superTenantSystemRegistry.resourceExists(emailVerificationPath)) {
+            resource = superTenantSystemRegistry.get(emailVerificationPath);
+        } else {
+            resource = superTenantSystemRegistry.newResource();
+        }
+        resource.setContent(confirmationKey);
+        superTenantSystemRegistry.put(emailVerificationPath, resource);
+
+        try {
+            Map<String, String> datatostore = new HashMap<String, String>();
+            datatostore.put("first-name",
+                    ClaimsMgtUtil.getFirstName(Util.getRealmService(), tenantId));
+            datatostore.put("email", contactEmail);
+            datatostore.put("userName", tenant.getAdminName());
+            datatostore.put("tenantDomain", tenant.getDomain());
+            datatostore.put("confirmationKey", confirmationKey);
+            emailverifier.requestUserVerification(datatostore, Util.getEmailVerifierConfig());
+        } catch (Exception e) {
+            String msg = "Error in adding tenant, tenant domain: " + tenant.getDomain() + ".";
+            log.error(msg);
+            throw new Exception(msg, e);
+        }
+    }
+
+    /**
+     * gets the contact of the tenant admin
+     *
+     * @throws Exception, if getting the contact email address failed.
+     * @return, the contact email address
+     */
+    public String getContact() throws Exception {
+        TenantManager tenantManager = Util.getTenantManager();
+        UserRegistry registry = (UserRegistry) getGovernanceRegistry();
+        if (registry == null) {
+            // we can't continue without having a valid registry in the session
+            String msg = "Error in retrieving the registry for the login tenant.";
+            log.error(msg);
+            throw new Exception(msg);
+        }
+        int tenantId = registry.getTenantId();
+        // get the tenant information from the tenant manager
+        Tenant tenant;
+        try {
+            tenant = (Tenant) tenantManager.getTenant(tenantId);
+        } catch (UserStoreException e) {
+            String msg = "Error in retrieving the tenant information for the tenant id: " +
+                    tenantId + ".";
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+        return tenant.getEmail();
+    }
+
+    /**
+     * Updates the fullname information
+     *
+     * @param accountInfoBean profile information stored in AccountInfoBean
+     * @return true, if updated successfully.
+     * @throws Exception UserStoreException.
+     */
+    public boolean updateFullname(AccountInfoBean accountInfoBean) throws Exception {
+        TenantManager tenantManager = Util.getTenantManager();
+        UserRegistry registry = (UserRegistry) getGovernanceRegistry();
+        if (registry == null) {
+            // we can't continue without having a valid registry in the session
+            String msg = "Error in retrieving the registry for the login tenant.";
+            log.error(msg);
+            throw new Exception(msg);
+        }
+        int tenantId = registry.getTenantId();
+        // get the tenant information from the tenant manager
+        Tenant tenant;
+        try {
+            tenant = (Tenant) tenantManager.getTenant(tenantId);
+        } catch (UserStoreException e) {
+            String msg = "Error in retrieving the tenant information for the tenant id: " +
+                    tenantId + ".";
+            log.info(msg, e);
+            throw new Exception(msg, e);
+        }
+        RealmService realmService = Util.getRealmService();
+        try {
+            Map<String, String> claimsMap = new HashMap<String, String>();
+            claimsMap.put(UserCoreConstants.ClaimTypeURIs.GIVEN_NAME,
+                    accountInfoBean.getFirstname());
+            claimsMap.put(UserCoreConstants.ClaimTypeURIs.SURNAME, accountInfoBean.getLastname());
+            UserStoreManager userStoreManager =
+                    (UserStoreManager) realmService.getTenantUserRealm(tenantId)
+                            .getUserStoreManager();
+            userStoreManager.setUserClaimValues(
+                    ClaimsMgtUtil.getAdminUserNameFromTenantId(realmService, tenantId),
+                    claimsMap, UserCoreConstants.DEFAULT_PROFILE);
+            log.info("FirstName: " + accountInfoBean.getFirstname() +
+                    " has been updated to the tenant admin " +
+                    ClaimsMgtUtil.getAdminUserNameFromTenantId(realmService, tenantId) + " of " +
+                    tenant.getDomain());
+            
+            //Notify tenant update to all listeners
+            TenantInfoBean tenantInfoBean = new TenantInfoBean();
+            tenantInfoBean.setTenantId(tenantId);
+            tenantInfoBean.setFirstname(accountInfoBean.getFirstname());
+            tenantInfoBean.setLastname(accountInfoBean.getLastname());
+            Util.alertTenantUpdate(tenantInfoBean);
+            
+            return true;
+        } catch (Exception e) {
+            // this is expected, as many users haven't given their fullnames
+            // during their registration.
+            String msg =
+                    "Error in updating the firstname: " + accountInfoBean.getFirstname() +
+                            " for the tenant admin: " +
+                            ClaimsMgtUtil.getAdminUserNameFromTenantId(realmService, tenantId);
+            log.info(msg);
+            throw new Exception(msg, e);
+        }
+    }
+
+    /**
+     * gets the profile information - saved as claims -
+     * currently saved claims are first name and last name - hence the profile so far is a fullname.
+     *
+     * @return AccountInfoBean - Currently depicts the fullname as an object.
+     * @throws Exception, UserStoreException
+     */
+    public AccountInfoBean getFullname() throws Exception {
+
+        String firstname = "", lastname = "";
+        TenantManager tenantManager = Util.getTenantManager();
+        UserRegistry registry = (UserRegistry) getGovernanceRegistry();
+        if (registry == null) {
+            // we can't continue without having a valid registry in the session
+            String msg = "Error in retrieving the registry for the login tenant.";
+            log.error(msg);
+            throw new Exception(msg);
+        }
+        int tenantId = registry.getTenantId();
+        // get the tenant information from the tenant manager
+        Tenant tenant;
+        try {
+            tenant = (Tenant) tenantManager.getTenant(tenantId);
+        } catch (UserStoreException e) {
+            String msg = "Error in retrieving the tenant information for the tenant id: " +
+                    tenantId + ".";
+            log.info(msg, e);
+            throw new Exception(msg, e);
+        }
+
+        // getting the other parameters from the claims.
+        try {
+            firstname = ClaimsMgtUtil.getFirstName(Util.getRealmService(), tenantId);
+
+        } catch (Exception e) {
+            String msg = "Error in retrieving the firstname for the admin of the domain " +
+                    tenant.getDomain();
+            log.info(msg);
+        }
+        try {
+            lastname = ClaimsMgtUtil.getLastName(Util.getRealmService(), tenantId);
+        } catch (Exception e) {
+            // this is expected, as many users haven't given their lastnames
+            // during their registration.
+            String msg = "Error in retrieving the Lastname for the admin of the domain " +
+                    tenant.getDomain();
+            log.info(msg);
+        }
+
+        AccountInfoBean accountInfoBean = new AccountInfoBean();
+        accountInfoBean.setFirstname(firstname);
+        accountInfoBean.setLastname(lastname);
+        return accountInfoBean;
+    }
+
+
+    /**
+     * deactivates the tenant
+     *
+     * @throws Exception, if deactivating the tenant failed.
+     */
+    public void deactivate() throws Exception {
+        // The one who have a proper permission will be able to deactivate the tenant.
+        TenantManager tenantManager = Util.getTenantManager();
+        UserRegistry registry = (UserRegistry) getGovernanceRegistry();
+        if (registry == null) {
+            // we can't continue without having a valid registry in the session
+            String msg = "Error in retrieving the registry for the login tenant.";
+            log.error(msg);
+            throw new Exception(msg);
+        }
+        int tenantId = registry.getTenantId();
+        try {
+            tenantManager.deactivateTenant(tenantId);
+        } catch (UserStoreException e) {
+            String msg = "Error in deactivating the tenant id: " + tenantId + ".";
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+
+        //Notify tenant deactivation to Listeners
+        Util.alertTenantDeactivation(tenantId);
+    }
+
+    /**
+     * checks whether the domain is validated.
+     *
+     * @return true, if the domain has been validated.
+     * @throws Exception, if the domain validation failed.
+     */
+    public boolean isDomainValidated() throws Exception {
+        // first we will get the current domain name
+        TenantManager tenantManager = Util.getTenantManager();
+        UserRegistry registry = (UserRegistry) getGovernanceRegistry();
+        if (registry == null) {
+            // we can't continue without having a valid registry in the session
+            String msg = "Error in retrieving the registry for the login tenant.";
+            log.error(msg);
+            throw new Exception(msg);
+        }
+        int tenantId = registry.getTenantId();
+        // get the tenant information from the tenant manager
+        Tenant tenant;
+        try {
+            tenant = (Tenant) tenantManager.getTenant(tenantId);
+        } catch (UserStoreException e) {
+            String msg = "Error in retrieving the tenant information for the tenant id: " +
+                    tenantId + ".";
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+        String domainName = tenant.getDomain();
+        TenantMgtUtil.validateDomain(domainName);
+
+        String domainValidationPath = StratosConstants.TENANT_DOMAIN_VERIFICATION_FLAG_PATH +
+                RegistryConstants.PATH_SEPARATOR + tenantId;
+        UserRegistry superTenantRegistry = Util.getGovernanceSystemRegistry(
+                MultitenantConstants.SUPER_TENANT_ID);
+        if (superTenantRegistry.resourceExists(domainValidationPath)) {
+            Resource validationFlagR = superTenantRegistry.get(domainValidationPath);
+            return "true".equals(validationFlagR.getProperty(domainName));
+        }
+        return false;
+    }
+
+    /**
+     * If the domain validation has been completed.
+     *
+     * @param validatedDomain the domain being validated.
+     * @param successKey      success key
+     * @return true, if the domain has been validated successfully.
+     * @throws Exception, if the domain validation failed.
+     */
+    public boolean finishedDomainValidation(
+            String validatedDomain, String successKey) throws Exception {
+        // create a flag on domain validation, so that we can move the content
+        // of the current domain name to the new validated domain name
+        if (!CommonUtil.validateDomainFromSuccessKey(Util.getGovernanceSystemRegistry(
+                MultitenantConstants.SUPER_TENANT_ID), validatedDomain, successKey)) {
+            String msg = "Domain: " + validatedDomain + " is not validated against successKey: " +
+                    successKey + ".";
+            log.error(msg);
+            throw new Exception(msg);
+        }
+
+        // we keep an entry about domain validation here.
+
+        // first we will get the current domain name
+        UserRegistry registry = (UserRegistry) getGovernanceRegistry();
+        if (registry == null) {
+            // we can't continue without having a valid registry in the session
+            String msg = "Error in retrieving the registry for the login tenant.";
+            log.error(msg);
+            throw new Exception(msg);
+        }
+        int tenantId = registry.getTenantId();
+
+        // keep the domain validation path.
+
+        String domainValidationPath = StratosConstants.TENANT_DOMAIN_VERIFICATION_FLAG_PATH +
+                RegistryConstants.PATH_SEPARATOR + tenantId;
+        UserRegistry superTenantRegistry =
+                Util.getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID);
+        Resource validationFlagR = superTenantRegistry.newResource();
+        validationFlagR.setProperty(validatedDomain, "true");
+        superTenantRegistry.put(domainValidationPath, validationFlagR);
+
+        return true;
+    }
+
+    /**
+     * Check whether the domain is available.
+     *
+     * @param domainName domain name
+     * @return true, if the domain is available to register.
+     * @throws Exception, if the domain validation failed.
+     */
+    public boolean checkDomainAvailability(String domainName) throws Exception {
+        TenantManager tenantManager = Util.getTenantManager();
+        int tenantId = tenantManager.getTenantId(domainName);
+        return tenantId < 0;
+    }
+
+    /**
+     * check whether the email has been validated.
+     *
+     * @throws Exception, if the validation failed.
+     * @return, true if already validated.
+     */
+    public boolean isEmailValidated() throws Exception {
+        UserRegistry userRegistry = (UserRegistry) getGovernanceRegistry();
+        if (userRegistry.getTenantId() == MultitenantConstants.SUPER_TENANT_ID) {
+            // no email validation step required for super tenant
+            return true;
+        }
+
+        String email = getContact();
+        UserRegistry superTenantSystemRegistry =
+                Util.getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID);
+        String emailVerificationPath = StratosConstants.ADMIN_EMAIL_VERIFICATION_FLAG_PATH +
+                RegistryConstants.PATH_SEPARATOR +
+                userRegistry.getTenantId();
+        if (!superTenantSystemRegistry.resourceExists(emailVerificationPath)) {
+            // the confirmation key should exist,otherwise fail registration
+            return false;
+        }
+        Resource resource = superTenantSystemRegistry.get(emailVerificationPath);
+
+        return "true".equals(resource.getProperty(email));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/EmailValidationService.java
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/EmailValidationService.java b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/EmailValidationService.java
new file mode 100644
index 0000000..a8af206
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/EmailValidationService.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.wso2.carbon.account.mgt.services;
+
+import org.wso2.carbon.account.mgt.internal.AccountMgtServiceComponent;
+import org.wso2.carbon.account.mgt.util.Util;
+import org.wso2.carbon.registry.core.RegistryConstants;
+import org.wso2.carbon.registry.core.Resource;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.wso2.carbon.registry.core.session.UserRegistry;
+import org.wso2.carbon.stratos.common.beans.TenantInfoBean;
+import org.wso2.carbon.stratos.common.constants.StratosConstants;
+import org.wso2.carbon.stratos.common.util.CommonUtil;
+import org.wso2.carbon.user.api.Tenant;
+import org.wso2.carbon.user.core.UserStoreException;
+import org.wso2.carbon.user.core.tenant.TenantManager;
+import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Email Validation Service
+ */
+public class EmailValidationService {
+    private static final Log log = LogFactory.getLog(EmailValidationService.class);
+
+    /**
+     * Proceed updating the contact email address
+     *
+     * @param domain          tenant domain
+     * @param email           email address
+     * @param confirmationKey confirmation key.
+     * @throws Exception, RegistryException.
+     */
+    public void proceedUpdateContact(String domain, String email, String confirmationKey)
+            throws Exception {
+
+        TenantManager tenantManager = Util.getTenantManager();
+        int tenantId;
+
+        try {
+            tenantId = tenantManager.getTenantId(domain);
+        } catch (UserStoreException e) {
+            String msg = "Error in adding tenant, tenant domain: " + domain + ".";
+            log.error(msg);
+            throw new RegistryException(msg, e);
+        }
+
+        UserRegistry superTenantSystemRegistry = Util.getGovernanceSystemRegistry(
+                MultitenantConstants.SUPER_TENANT_ID);
+        String emailVerificationPath =
+                StratosConstants.ADMIN_EMAIL_VERIFICATION_FLAG_PATH +
+                RegistryConstants.PATH_SEPARATOR + tenantId;
+        if (!superTenantSystemRegistry.resourceExists(emailVerificationPath)) {
+            // the confirmation key should exist,otherwise fail registraion
+            String msg = "The confirmationKey doesn't exist in service.";
+            log.error(msg);
+            throw new RegistryException(msg);
+        }
+        Resource resource = superTenantSystemRegistry.get(emailVerificationPath);
+        String actualConfirmationKey = null;
+        Object content = resource.getContent();
+        if (content instanceof String) {
+            actualConfirmationKey = (String) content;
+        } else if (content instanceof byte[]) {
+            actualConfirmationKey = new String((byte[]) content);
+        }
+
+        if (actualConfirmationKey == null || !actualConfirmationKey.equals(confirmationKey)) {
+            // validation will fail.
+            String msg = "The email confirmation key is not matching";
+            log.error(msg);
+            throw new RegistryException(msg);
+        }
+
+        resource.setProperty(email, "true");
+
+        // now we will really update the tenant email
+        Tenant tenant;
+        try {
+            tenant = tenantManager.getTenant(tenantId);
+        } catch (UserStoreException e) {
+            String msg =
+                    "Error in retrieving the tenant information for the tenant id: " + tenantId +
+                    ".";
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+
+        // If TenantActivation is moderated, the mail address associated with the validation link
+        // would not be the tenant email. Otherwise, the validation mail would be the tenant email.
+        if (!CommonUtil.isTenantActivationModerated()) {
+            tenant.setEmail(email);
+        }
+
+        try {
+            tenantManager.updateTenant(tenant);
+        } catch (UserStoreException e) {
+            String msg =
+                    "Error in updating the tenant information for the tenant id: " + tenantId + ".";
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+
+        // activate the tenant on successful validation of the email, if it is not already activated.
+        if ("false".equals(resource.getProperty(StratosConstants.IS_EMAIL_VALIDATED))) {
+            tenantManager.activateTenant(tenantId);
+            // set the registry flag
+            resource.editPropertyValue(StratosConstants.IS_EMAIL_VALIDATED, "false", "true");
+
+            if (log.isDebugEnabled()) {
+                log.debug("Tenant : " + tenantId + " is activated after validating the " +
+                          "email of the tenant admin.");
+            }
+            
+            //Notify all the listeners that tenant has been activated for the first time
+            Util.alertTenantInitialActivation(tenantId);
+
+            //Activating the usage plan
+            try{
+                AccountMgtServiceComponent.getBillingService().activateUsagePlan(domain);
+            }catch(Exception e){
+                log.error("Error occurred while activating the usage plan for tenant: " + domain
+                        + " tenant Id: " + tenantId, e);
+            }
+
+        }
+        
+        //This is considered an update. Hence notify the update to all listeners
+        TenantInfoBean tenantInfoBean = new TenantInfoBean();
+        tenantInfoBean.setTenantId(tenantId);
+        tenantInfoBean.setTenantDomain(domain);
+        tenantInfoBean.setEmail(email);
+        Util.alertTenantUpdate(tenantInfoBean);
+
+        // update the registry
+        superTenantSystemRegistry.put(emailVerificationPath, resource);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/util/Util.java
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/util/Util.java b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/util/Util.java
new file mode 100644
index 0000000..25f7673
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/util/Util.java
@@ -0,0 +1,173 @@
+/*
+ *  Copyright (c) 2005-2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ *  WSO2 Inc. licenses this file to you under the Apache License,
+ *  Version 2.0 (the "License"); you may not use this file except
+ *  in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ *
+ */
+package org.wso2.carbon.account.mgt.util;
+
+import org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber;
+import org.wso2.carbon.email.verification.util.EmailVerifierConfig;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.wso2.carbon.registry.core.service.RegistryService;
+import org.wso2.carbon.registry.core.session.UserRegistry;
+import org.wso2.carbon.stratos.common.beans.TenantInfoBean;
+import org.wso2.carbon.stratos.common.constants.StratosConstants;
+import org.wso2.carbon.stratos.common.exception.StratosException;
+import org.wso2.carbon.stratos.common.listeners.TenantMgtListener;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.user.core.tenant.TenantManager;
+import org.wso2.carbon.utils.CarbonUtils;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+/**
+ * Util methods for AccountMgt
+ */
+public class Util {
+
+    private static final Log log = LogFactory.getLog(Util.class);
+
+    private static RegistryService registryService;
+    private static RealmService realmService;
+    private static EmailVerifcationSubscriber emailVerificationService = null;
+    private static EmailVerifierConfig emailVerfierConfig = null;
+    private static List<TenantMgtListener> tenantMgtListeners = new ArrayList<TenantMgtListener>();
+
+    public static synchronized void setRegistryService(RegistryService service) {
+        if (registryService == null) {
+            registryService = service;
+        }
+    }
+
+    
+    public static RealmService getRealmService() {
+        return realmService;
+    }
+
+
+    public static RegistryService getRegistryService() {
+        return registryService;
+    }
+
+    public static synchronized void setEmailVerificationService(EmailVerifcationSubscriber service) {
+        if (emailVerificationService == null) {
+            emailVerificationService = service;
+        }
+    }
+
+    public static EmailVerifcationSubscriber getEmailVerificationService() {
+        return emailVerificationService;
+    }
+
+
+    public static synchronized void setRealmService(RealmService service) {
+        if (realmService == null) {
+            realmService = service;
+        }
+    }
+
+
+    public static TenantManager getTenantManager() {
+        return realmService.getTenantManager();
+    }
+
+    public static UserRegistry getGovernanceSystemRegistry(int tenantId) throws RegistryException {
+        return registryService.getGovernanceSystemRegistry(tenantId);
+    }
+
+    public static HttpSession getRequestSession() throws RegistryException {
+        MessageContext messageContext = MessageContext.getCurrentMessageContext();
+        if (messageContext == null) {
+            String msg = "Could not get the user's session. Message context not found.";
+            log.error(msg);
+            throw new RegistryException(msg);
+        }
+
+        HttpServletRequest request =
+                (HttpServletRequest) messageContext.getProperty("transport.http.servletRequest");
+
+        return request.getSession();
+    }
+
+    public static void loadEmailVerificationConfig() {
+        String configXml = CarbonUtils.getCarbonConfigDirPath()+ File.separator
+                           + StratosConstants.EMAIL_CONFIG +File.separator +"email-update.xml";
+        emailVerfierConfig = org.wso2.carbon.email.verification.util.Util.loadeMailVerificationConfig(configXml);
+    }
+
+    public static EmailVerifierConfig getEmailVerifierConfig() {
+        return emailVerfierConfig;
+    }
+
+    public static void addTenantMgtListenerService(TenantMgtListener tenantMgtListener) {
+        tenantMgtListeners.add(tenantMgtListener);
+        sortTenantMgtListeners();
+    }
+
+    public static void removeTenantMgtListenerService(TenantMgtListener tenantMgtListener) {
+        tenantMgtListeners.remove(tenantMgtListener);
+        sortTenantMgtListeners();
+    }
+    
+    private static void sortTenantMgtListeners() {
+        Collections.sort(tenantMgtListeners, new Comparator<TenantMgtListener>() {
+            public int compare(TenantMgtListener o1, TenantMgtListener o2) {
+                return o1.getListenerOrder() - o2.getListenerOrder();
+            }
+        });
+    }
+    
+    public static void alertTenantRenames(int tenantId, String oldName, 
+                                          String newName) throws StratosException {
+
+        for (TenantMgtListener tenantMgtLister : tenantMgtListeners) {
+            tenantMgtLister.onTenantRename(tenantId, oldName, newName);
+        }
+    }
+    
+    public static void alertTenantDeactivation(int tenantId) throws StratosException {
+
+        for (TenantMgtListener tenantMgtLister : tenantMgtListeners) {
+            tenantMgtLister.onTenantDeactivation(tenantId);
+        }
+    }
+    
+    public static void alertTenantInitialActivation(int tenantId) throws StratosException {
+
+        for (TenantMgtListener tenantMgtLister : tenantMgtListeners) {
+            tenantMgtLister.onTenantInitialActivation(tenantId);
+        }
+    }
+    
+    public static void alertTenantUpdate(TenantInfoBean tenantInfoBean) throws StratosException {
+
+        for (TenantMgtListener tenantMgtLister : tenantMgtListeners) {
+            tenantMgtLister.onTenantUpdate(tenantInfoBean);
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/component.xml b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/component.xml
new file mode 100644
index 0000000..e399648
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/component.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~  Copyright (c) 2009, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+  ~
+  ~  Licensed under the Apache License, Version 2.0 (the "License");
+  ~  you may not use this file except in compliance with the License.
+  ~  You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  -->
+
+<component xmlns="http://products.wso2.org/carbon">
+    <ManagementPermissions>
+        <ManagementPermission>
+            <DisplayName>Configure</DisplayName>
+            <ResourceId>/permission/admin/configure</ResourceId>
+        </ManagementPermission>
+        <ManagementPermission>
+            <DisplayName>Account</DisplayName>
+            <ResourceId>/permission/admin/configure/account</ResourceId>
+        </ManagementPermission>
+    </ManagementPermissions>
+</component>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/services.xml
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/services.xml b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/services.xml
new file mode 100644
index 0000000..8b52fd8
--- /dev/null
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/services.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ !
+ ! Copyright 2006 The Apache Software Foundation.
+ !
+ ! Licensed under the Apache License, Version 2.0 (the "License");
+ ! you may not use this file except in compliance with the License.
+ ! You may obtain a copy of the License at
+ !
+ !      http://www.apache.org/licenses/LICENSE-2.0
+ !
+ ! Unless required by applicable law or agreed to in writing, software
+ ! distributed under the License is distributed on an "AS IS" BASIS,
+ ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ! See the License for the specific language governing permissions and
+ ! limitations under the License.
+ !-->
+<serviceGroup>
+
+    <service name="AccountMgtService" scope="transportsession">
+        <transports>
+            <transport>https</transport>
+        </transports>
+        <parameter name="ServiceClass" locked="false">
+            org.wso2.carbon.account.mgt.services.AccountMgtService
+        </parameter>
+
+        <operation name="updateContact">
+            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter>
+        </operation>
+
+        <operation name="getContact">
+            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter>
+        </operation>
+
+        <operation name="updateFullname">
+            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter>
+        </operation>
+
+        <operation name="getFullname">
+            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter>
+        </operation>
+
+        <operation name="deactivate">
+            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter>
+        </operation>
+
+        <operation name="isDomainValidated">
+            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter>
+        </operation>
+
+        <operation name="finishedDomainValidation">
+            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter>
+        </operation>
+
+        <operation name="checkDomainAvailability">
+            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter>
+        </operation>
+
+        <operation name="isEmailValidated">
+            <parameter name="AuthorizationAction" locked="true">/permission/admin/configure/account</parameter>
+        </operation>
+        <parameter name="adminService" locked="true">true</parameter>
+    </service>
+
+    <service name="EmailValidationService" scope="transportsession">
+        <transports>
+            <transport>https</transport>
+        </transports>
+        <parameter name="ServiceClass" locked="false">
+            org.wso2.carbon.account.mgt.services.EmailValidationService
+        </parameter>
+
+        <operation name="proceedUpdateContact">
+        </operation>
+    </service>
+
+    <parameter name="hiddenService" locked="true">true</parameter>
+
+</serviceGroup>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/account-mgt/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/pom.xml b/components/stratos/account-mgt/pom.xml
new file mode 100644
index 0000000..c58b0a4
--- /dev/null
+++ b/components/stratos/account-mgt/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (c) 2009-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~      http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.wso2.carbon</groupId>
+        <artifactId>stratos-components</artifactId>
+        <version>2.1.0</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>account-mgt-parent</artifactId>
+    <packaging>pom</packaging>
+    <name>WSO2 Stratos - Account  Management Parent Module</name>
+    <description>WSO2 Stratos Account Management Parent Module</description>
+    <url>http://wso2.org</url>
+
+    <modules>
+        <module>org.wso2.carbon.account.mgt/2.1.0</module>
+        <module>org.wso2.carbon.account.mgt.ui/2.1.0</module>
+    </modules>
+
+</project>
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/pom.xml b/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/pom.xml
new file mode 100644
index 0000000..5396a74
--- /dev/null
+++ b/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/pom.xml
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- ~ Copyright (c) 2009-2010, WSO2 Inc. (http://www.wso2.org) All Rights 
+	Reserved. ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); 
+	~ you may not use this file except in compliance with the License. ~ You 
+	may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 
+	~ ~ Unless required by applicable law or agreed to in writing, software ~ 
+	distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT 
+	WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the 
+	License for the specific language governing permissions and ~ limitations 
+	under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+	<parent>
+		<groupId>org.wso2.carbon</groupId>
+		<artifactId>adc-mgt</artifactId>
+		<version>2.1.0</version>
+                <relativePath>../../pom.xml</relativePath>
+	</parent>
+
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>org.wso2.carbon.adc.mgt.cli</artifactId>
+        <version>2.1.3</version>
+	<packaging>jar</packaging>
+	<name>WSO2 Carbon - ADC Management CLI</name>
+	<description>ADC management CLI bundle</description>
+	<url>http://wso2.org</url>
+	
+	<properties>
+		<slf4j.version>1.7.5</slf4j.version>
+	</properties>
+
+	<dependencies>
+		<!-- <dependency>
+			<groupId>org.wso2.carbon</groupId>
+			<artifactId>org.wso2.carbon.ui</artifactId>
+		</dependency> -->
+		<!-- Adding HttpClient dependencies. Those were resolved with above one -->
+		<dependency>
+			<groupId>commons-httpclient</groupId>
+			<artifactId>commons-httpclient</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.wso2.securevault</groupId>
+			<artifactId>org.wso2.securevault</artifactId>
+			<version>1.0.0-wso2v2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.httpcomponents.wso2</groupId>
+			<artifactId>httpcore</artifactId>
+			<version>4.1.0-wso2v1</version>
+		</dependency>
+		<dependency>
+			<groupId>org.wso2.carbon</groupId>
+			<artifactId>org.wso2.carbon.adc.mgt.stub</artifactId>
+			<version>4.1.3</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-cli</groupId>
+			<artifactId>commons-cli</artifactId>
+			<version>1.2</version>
+		</dependency>
+		<dependency>
+			<groupId>jline</groupId>
+			<artifactId>jline</artifactId>
+			<version>2.11</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-lang3</artifactId>
+			<version>3.1</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-validator</groupId>
+			<artifactId>commons-validator</artifactId>
+			<version>1.4.0</version>
+		</dependency>
+		<!-- Logging -->
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>${slf4j.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-log4j12</artifactId>
+			<version>${slf4j.version}</version>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>com.google.code.gson</groupId>
+			<artifactId>gson</artifactId>
+			<version>2.1</version>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-assembly-plugin</artifactId>
+				<configuration>
+					<archive>
+						<manifest>
+							<mainClass>org.wso2.carbon.adc.mgt.cli.CliTool</mainClass>
+						</manifest>
+					</archive>
+					<descriptors>
+						<descriptor>src/main/assembly/src.xml</descriptor>
+					</descriptors>
+				</configuration>
+				<executions>
+					<execution>
+						<id>make-assembly</id> <!-- this is used for inheritance merges -->
+						<phase>package</phase> <!-- bind to the packaging phase -->
+						<goals>
+							<goal>single</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/src/main/assembly/src.xml
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/src/main/assembly/src.xml b/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/src/main/assembly/src.xml
new file mode 100644
index 0000000..80e2e06
--- /dev/null
+++ b/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/src/main/assembly/src.xml
@@ -0,0 +1,33 @@
+<!--
+  ~ Copyright 2005-2011 WSO2, Inc. (http://wso2.com)
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~ http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<assembly
+	xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+	<id>Tool</id>
+	<formats>
+		<format>jar</format>
+	</formats>
+	<includeBaseDirectory>false</includeBaseDirectory>
+	<dependencySets>
+		<dependencySet>
+			<outputDirectory>/</outputDirectory>
+			<useProjectArtifact>true</useProjectArtifact>
+			<unpack>true</unpack>
+			<scope>runtime</scope>
+		</dependencySet>
+	</dependencySets>
+</assembly>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/src/main/java/org/wso2/carbon/adc/mgt/cli/CliTool.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/src/main/java/org/wso2/carbon/adc/mgt/cli/CliTool.java b/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/src/main/java/org/wso2/carbon/adc/mgt/cli/CliTool.java
new file mode 100644
index 0000000..1ff4f91
--- /dev/null
+++ b/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/src/main/java/org/wso2/carbon/adc/mgt/cli/CliTool.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+package org.wso2.carbon.adc.mgt.cli;
+
+import static org.wso2.carbon.adc.mgt.cli.utils.CliConstants.STRATOS_DIR;
+
+import java.io.File;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class is used for input the commands through CLITool, command prompt.
+ */
+public class CliTool {
+
+	private static final Logger logger = LoggerFactory.getLogger(CliTool.class);
+
+	/**
+	 * Main executable method used to call from CLI.
+	 * 
+	 */
+	public static void main(final String[] args) {
+		CliTool cliTool = new CliTool();
+		cliTool.createConfigDirectory();
+		cliTool.handleConsoleInputs(args);
+	}
+
+	/**
+	 * Here is the place all the command line inputs get processed
+	 * 
+	 * @param arguments
+	 *            passed to CLI tool.
+	 */
+	private void handleConsoleInputs(String[] arguments) {
+		if (logger.isInfoEnabled()) {
+			logger.info("Stratos CLI Started...");
+		}
+		StratosApplication application = new StratosApplication();
+		application.start(arguments);
+	}
+
+	private void createConfigDirectory() {
+		File stratosFile = new File(System.getProperty("user.home"), STRATOS_DIR);
+		if (stratosFile.exists()) {
+			if (logger.isInfoEnabled()) {
+				logger.info("Using directory: {}", stratosFile.getPath());
+			}
+		} else {
+			if (stratosFile.mkdir()) {
+				if (logger.isInfoEnabled()) {
+					logger.info("Created directory: {}", stratosFile.getPath());
+				}
+			} else if (logger.isWarnEnabled()) {
+				logger.warn("Failed to created directory: {}", stratosFile.getPath());
+			}
+		}
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/c1efa393/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/src/main/java/org/wso2/carbon/adc/mgt/cli/Command.java
----------------------------------------------------------------------
diff --git a/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/src/main/java/org/wso2/carbon/adc/mgt/cli/Command.java b/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/src/main/java/org/wso2/carbon/adc/mgt/cli/Command.java
new file mode 100644
index 0000000..5e3a250
--- /dev/null
+++ b/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.3/src/main/java/org/wso2/carbon/adc/mgt/cli/Command.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2013, WSO2, Inc. http://wso2.org
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+package org.wso2.carbon.adc.mgt.cli;
+
+import org.apache.commons.cli.Options;
+import org.wso2.carbon.adc.mgt.cli.exception.CommandException;
+
+public interface Command<T extends CommandContext> {
+
+	/**
+	 * @return The name of the command
+	 */
+	String getName();
+
+	/**
+	 * Information about the command
+	 * 
+	 * @return The description of the command
+	 */
+	String getDescription();
+
+	/**
+	 * This should return the syntax required for the command.
+	 * 
+	 * Used to display help.
+	 * 
+	 * @return The syntax for this command
+	 */
+	String getArgumentSyntax();
+
+	/**
+	 * The options accepted by the command
+	 * 
+	 * @return The Options for the commands
+	 */
+	Options getOptions();
+
+	/**
+	 * Executing the commands. Returns a code
+	 * 
+	 * @param context
+	 *            The context assoicated with the Command Line Application
+	 * @param args
+	 *            The arguments for the command
+	 * @return The status code
+	 * @throws CommandException
+	 *             if any errors occur when executing the command
+	 */
+	int execute(T context, String[] args) throws CommandException;
+
+}