You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2013/07/15 13:09:46 UTC

[2/5] Refactor tenant registration ui component according to the tenant registration stub modifications.

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/java/org/apache/stratos/register/ui/clients/PackageInfoServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/java/org/apache/stratos/register/ui/clients/PackageInfoServiceClient.java b/components/org.apache.stratos.tenant.registration.ui/src/main/java/org/apache/stratos/register/ui/clients/PackageInfoServiceClient.java
new file mode 100644
index 0000000..2979988
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/java/org/apache/stratos/register/ui/clients/PackageInfoServiceClient.java
@@ -0,0 +1,77 @@
+package org.apache.stratos.register.ui.clients;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.apache.stratos.common.packages.stub.PackageInfoServiceStub;
+import org.apache.stratos.common.packages.stub.PackageInfo;
+
+/**
+ * PackageInfoService client
+ */
+public class PackageInfoServiceClient {
+
+    private static Log log = LogFactory.getLog(PackageInfoServiceClient.class);
+
+    private PackageInfoServiceStub stub;
+    private String epr;
+
+    public PackageInfoServiceClient(
+            String cookie, String backendServerURL, ConfigurationContext configContext)
+            throws Exception {
+
+        epr = backendServerURL + "PackageInfoService";
+
+        try {
+            stub = new PackageInfoServiceStub(configContext, epr);
+
+            ServiceClient client = stub._getServiceClient();
+            Options option = client.getOptions();
+            option.setManageSession(true);
+            option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+
+        } catch (AxisFault axisFault) {
+            String msg = "Failed to initiate PackageInfoService client. " + axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+    public PackageInfo[] getBillingPackages() throws Exception {
+
+        try {
+            return stub.getPackageInfos();
+        } catch (Exception e) {
+            String msg = "Failed to get package information: " + e.getMessage();
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+    }
+
+    public JSONArray getBillingPackagesJsonArray() throws Exception {
+
+        try {
+            PackageInfo[] packageInfoArray = stub.getPackageInfos();
+            JSONArray jsonPackageInfoArray = new JSONArray();
+            for (PackageInfo packageInfo : packageInfoArray) {
+                JSONObject packageInfoObj = new JSONObject();
+                packageInfoObj.put("name", packageInfo.getName());
+                //TODO https://wso2.org/jira/browse/STRATOS-1819
+                packageInfoObj.put("subscriptionCharge", packageInfo.getSubscriptionCharge());
+                jsonPackageInfoArray.put(packageInfoObj);
+            }
+            return jsonPackageInfoArray;
+        } catch (Exception e) {
+            String msg = "Failed to get package information: " + e.getMessage();
+            log.error(msg, e);
+            throw new Exception(msg, e);
+        }
+
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/java/org/apache/stratos/register/ui/clients/TenantSelfRegistrationClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/java/org/apache/stratos/register/ui/clients/TenantSelfRegistrationClient.java b/components/org.apache.stratos.tenant.registration.ui/src/main/java/org/apache/stratos/register/ui/clients/TenantSelfRegistrationClient.java
new file mode 100644
index 0000000..0d4ba5a
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/java/org/apache/stratos/register/ui/clients/TenantSelfRegistrationClient.java
@@ -0,0 +1,107 @@
+/*
+*  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.apache.stratos.register.ui.clients;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.CarbonConstants;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.apache.stratos.tenant.register.stub.TenantMgtServiceStub;
+import org.apache.stratos.tenant.register.stub.beans.xsd.CaptchaInfoBean;
+import org.apache.stratos.tenant.register.stub.beans.xsd.TenantInfoBean;
+import org.wso2.carbon.ui.CarbonUIUtil;
+import org.wso2.carbon.utils.ServerConstants;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpSession;
+
+/**
+ * Tenant Self Registration Client class
+ */
+public class TenantSelfRegistrationClient {
+     private static final Log log = LogFactory.getLog(TenantSelfRegistrationClient.class);
+
+    private TenantMgtServiceStub stub;
+    private String epr;
+
+    public TenantSelfRegistrationClient(
+            String cookie, String backendServerURL, ConfigurationContext configContext)
+            throws RegistryException {
+
+        epr = backendServerURL + "TenantMgtService";
+
+        try {
+            stub = new TenantMgtServiceStub(configContext, epr);
+
+            ServiceClient client = stub._getServiceClient();
+            Options option = client.getOptions();
+            option.setManageSession(true);
+            option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+
+        } catch (AxisFault axisFault) {
+            String msg = "Failed to initiate AddServices service client. " + axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+    public TenantSelfRegistrationClient(ServletConfig config, HttpSession session)
+            throws RegistryException {
+
+        String cookie = (String)session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+        String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+        ConfigurationContext configContext = (ConfigurationContext) config.
+                getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+        epr = backendServerURL + "TenantMgtService";
+
+        try {
+            stub = new TenantMgtServiceStub(configContext, epr);
+
+            ServiceClient client = stub._getServiceClient();
+            Options option = client.getOptions();
+            option.setManageSession(true);
+            option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, cookie);
+
+        } catch (AxisFault axisFault) {
+            String msg = "Failed to initiate Add Services service client. " + axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+    public String registerTenant(TenantInfoBean tenantInfoBean,
+                                 CaptchaInfoBean captchaInfoBean) throws Exception {
+        return stub.registerTenant(tenantInfoBean, captchaInfoBean);
+     }
+
+    public boolean checkDomainAvailability(String domainName) throws Exception {
+        return stub.checkDomainAvailability(domainName);
+    }
+
+    public String validateOrSuggestDomain(String domainName, String successKey) throws Exception {
+        return stub.validateOrSuggestDomain(domainName, successKey);
+    }
+
+    public CaptchaInfoBean generateRandomCaptcha() throws Exception {
+        return stub.generateRandomCaptcha();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/java/org/apache/stratos/register/ui/utils/TenantConfigUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/java/org/apache/stratos/register/ui/utils/TenantConfigUtil.java b/components/org.apache.stratos.tenant.registration.ui/src/main/java/org/apache/stratos/register/ui/utils/TenantConfigUtil.java
new file mode 100644
index 0000000..b92ce5d
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/java/org/apache/stratos/register/ui/utils/TenantConfigUtil.java
@@ -0,0 +1,248 @@
+/*
+ *  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.apache.stratos.register.ui.utils;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.Base64;
+import org.apache.axis2.AxisFault;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.constants.StratosConstants;
+import org.apache.stratos.register.ui.clients.TenantSelfRegistrationClient;
+import org.wso2.carbon.registry.common.ui.UIException;
+import org.apache.stratos.tenant.register.stub.beans.xsd.CaptchaInfoBean;
+import org.apache.stratos.tenant.register.stub.beans.xsd.TenantInfoBean;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import java.io.StringReader;
+import java.util.Calendar;
+import java.util.Iterator;
+
+/**
+ * Utility methods for tenant configuration
+ */
+public class TenantConfigUtil {
+    private static final Log log = LogFactory.getLog(TenantConfigUtil.class);
+
+    /**
+     * Registers the tenant
+     *
+     * @param request HttpServletRequest
+     * @param config  ServletConfig
+     * @param session HttpSession
+     * @return String
+     * @throws UIException
+     */
+    public static String registerTenantConfigBean(HttpServletRequest request,
+                                                  ServletConfig config, HttpSession session) throws UIException {
+        TenantInfoBean tenantInfoBean = new TenantInfoBean();
+        CaptchaInfoBean captchaInfoBean = new CaptchaInfoBean();
+
+        try {
+            // filling tenant info.
+            tenantInfoBean.setFirstname(request.getParameter("admin-firstname"));
+            tenantInfoBean.setLastname(request.getParameter("admin-lastname"));
+            tenantInfoBean.setAdmin(request.getParameter("admin"));
+            tenantInfoBean.setAdminPassword(request.getParameter("admin-password"));
+            tenantInfoBean.setTenantDomain(resolveDomainName(request.getParameter("domain")));
+            tenantInfoBean.setEmail(request.getParameter("admin-email"));
+            tenantInfoBean.setSuccessKey((String) session.getAttribute("validate-domain-success-key"));
+            tenantInfoBean.setUsagePlan(request.getParameter("selectedUsagePlan"));
+            tenantInfoBean.setOriginatedService(TenantConfigUtil.base64Decode((String) session.getAttribute(
+                    StratosConstants.ORIGINATED_SERVICE)));
+            tenantInfoBean.setCreatedDate(Calendar.getInstance());
+            // filling captcha info
+            captchaInfoBean.setSecretKey(request.getParameter("captcha-secret-key"));
+            captchaInfoBean.setUserAnswer(request.getParameter("captcha-user-answer"));
+
+            TenantSelfRegistrationClient selfRegistrationClient =
+                    new TenantSelfRegistrationClient(config, session);
+
+            String returnText = selfRegistrationClient.registerTenant(tenantInfoBean, captchaInfoBean);
+
+            return returnText;
+
+        } catch (Exception e) {
+            AxisFault fault = new AxisFault(e.getMessage());
+            String msg = fault.getReason() + " Failed to add tenant config. tenant-domain: " +
+                    tenantInfoBean.getTenantDomain() + ", " +
+                    "tenant-admin: " + tenantInfoBean.getAdmin() + ".";
+            log.error(msg, e);
+            // we are preserving the original message.
+            throw new UIException(e.getMessage(), e);
+        }
+    }
+
+
+    // do this before the send redirect.
+
+    public static void setSubmissionValuesForSession(HttpServletRequest request) {
+        HttpSession session = request.getSession();
+
+        session.setAttribute("submit-domain", resolveDomainName(request.getParameter("domain")));
+        session.setAttribute("submit-admin", request.getParameter("admin"));
+        session.setAttribute("submit-admin-firstname", request.getParameter("admin-firstname"));
+        session.setAttribute("submit-admin-lastname", request.getParameter("admin-lastname"));
+        session.setAttribute("submit-admin-email", request.getParameter("admin-email"));
+    }
+
+
+    /**
+     * Checks the availability of the domain
+     *
+     * @param request HttpServletRequest
+     * @param config  ServletConfig
+     * @param session HttpSession
+     * @return true, if domain is available to register
+     * @throws UIException if failed to check the availability.
+     */
+    public static boolean checkDomainAvailability(
+            HttpServletRequest request, ServletConfig config, HttpSession session)
+            throws UIException {
+        String tenantDomain = null;
+        try {
+            tenantDomain = resolveDomainName(request.getParameter("domain"));
+            TenantSelfRegistrationClient selfRegistrationClient =
+                    new TenantSelfRegistrationClient(config, session);
+            return selfRegistrationClient.checkDomainAvailability(tenantDomain);
+        } catch (Exception e) {
+            String msg = "Failed to check the domain availability:" + tenantDomain + ".";
+            log.error(msg, e);
+            throw new UIException(msg, e);
+        }
+    }
+
+    /**
+     * Validates or suggests the domain
+     *
+     * @param config  ServletConfig
+     * @param session HttpSession
+     * @return domain
+     * @throws UIException, if validating or suggesting the domain failed.
+     */
+    public static String validateOrSuggestDomain(ServletConfig config,
+                                                 HttpSession session) throws UIException {
+        String tempDomainToRegister = resolveDomainName(
+                (String) session.getAttribute("temp-domain-to-register"));
+        // here successKey can be null, in such cases services will directly go to suggest a name
+        String successKey = (String) session.getAttribute("validate-domain-success-key");
+
+        try {
+            TenantSelfRegistrationClient selfRegistrationClient =
+                    new TenantSelfRegistrationClient(config, session);
+            return selfRegistrationClient.validateOrSuggestDomain(tempDomainToRegister, successKey);
+        } catch (Exception e) {
+            String msg = "Failed to validate or suggest a domain related to :" +
+                    tempDomainToRegister + ".";
+            log.error(msg, e);
+            throw new UIException(msg, e);
+        }
+    }
+
+    /**
+     * Generates a random captcha
+     *
+     * @param config  ServletConfig
+     * @param session HttpSession
+     * @return CaptchaInfoBean
+     * @throws UIException, if generating the random captcha fails.
+     */
+    public static CaptchaInfoBean generateRandomCaptcha(ServletConfig config,
+                                                        HttpSession session) throws UIException {
+        try {
+            TenantSelfRegistrationClient selfRegistrationClient =
+                    new TenantSelfRegistrationClient(config, session);
+            return selfRegistrationClient.generateRandomCaptcha();
+        } catch (Exception e) {
+            String msg = "Error in generating the captcha image.";
+            log.error(msg, e);
+            throw new UIException(msg, e);
+        }
+    }
+
+    public static HttpServletRequest readIntermediateData(HttpServletRequest request, String data) {
+        try {
+            XMLStreamReader parser =
+                    XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(data));
+            StAXOMBuilder builder = new StAXOMBuilder(parser);
+            OMElement documentElement = builder.getDocumentElement();
+            Iterator it = documentElement.getChildElements();
+            while (it.hasNext()) {
+                OMElement element = (OMElement) it.next();
+                if ("admin".equals(element.getLocalName())) {
+                    request.setAttribute("admin", element.getText());
+                } else if ("firstname".equals(element.getText())) {
+                    request.setAttribute("firstname", element.getText());
+                } else if ("lastname".equals(element.getText())) {
+                    request.setAttribute("lastname", element.getText());
+                } else if ("email".equals(element.getLocalName())) {
+                    request.setAttribute("email", element.getText());
+                } else if ("tenantDomain".equals(element.getLocalName())) {
+                    request.setAttribute("tenantDomain", element.getText());
+                } else if ("confirmationKey".equals(element.getLocalName())) {
+                    request.setAttribute("confirmationKey", element.getText());
+                }
+            }
+        } catch (Exception e) {
+            log.error("Error parsing xml", e);
+        }
+        return request;
+    }
+
+    /**
+     * Resolves the correct domain name in the form of example.com from the user input domain name.
+     * Currently strips out "www."and white space. Can add more checks.
+     *
+     * @param domainNameUserInput the user input domain name
+     * @return the domain after removing (if entered) www. from the input.
+     */
+    public static String resolveDomainName(String domainNameUserInput) {
+        if (domainNameUserInput == null) {
+            String msg = "Provided domain name is null";
+            log.error(msg);
+            return "";
+        }
+        String domainName = domainNameUserInput.trim();
+        if (domainName.startsWith("www.")) {
+            domainName = domainName.substring(4);
+        }
+        return domainName;
+    }
+
+    /**
+     * A basic method to decode the encoded Stratos Service Name
+     *
+     * @param encodedStr Encoded Stratos Service Name
+     * @return Decoded Stratos Service name
+     */
+    private static String base64Decode(String encodedStr) {
+        String decodedStr = null;
+        // Check whether this value is null(not set) or set to "null" which is also possible.
+        if (encodedStr != null && !"null".equals(encodedStr)) {
+            decodedStr = new String(Base64.decode(encodedStr));
+        }
+        return decodedStr;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/META-INF/component.xml b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/META-INF/component.xml
new file mode 100644
index 0000000..aa11e6b
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/META-INF/component.xml
@@ -0,0 +1,70 @@
+<!--
+ ~ 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.
+ -->
+<component xmlns="http://products.wso2.org/carbon">
+    <!-- sample menu configuration -->
+    <menus>
+        <menu>
+            <id>gaas_menu</id>
+            <i18n-key>gaas</i18n-key>
+            <i18n-bundle>org.wso2.carbon.register.ui.i18n.Resources</i18n-bundle>
+            <parent-menu></parent-menu>
+            <link>#</link>
+            <skip-authentication/>
+            <region>region1</region>
+            <order>2</order>
+            <style-class>home</style-class>
+        </menu>
+        <menu>
+            <id>gaas_register_org_menu</id>
+            <i18n-key>register.org.menu</i18n-key>
+            <i18n-bundle>org.wso2.carbon.register.ui.i18n.Resources</i18n-bundle>
+            <parent-menu>gaas_menu</parent-menu>
+            <link>../tenant-register/select_domain.jsp</link>
+            <region>region1</region>
+            <order>1</order>
+            <style-class>manage</style-class>
+            <icon>../tenant-register/images/signup-new-org.gif</icon>
+            <skip-authentication>
+                <skip-link>../tenant-register/self_registration_complete.jsp</skip-link>
+                <skip-link>../tenant-register/domain_availability_ajaxprocessor.jsp</skip-link>
+                <skip-link>../tenant-register/select_domain.jsp</skip-link>
+                <skip-link>../tenant-register/select_usage_plan.jsp</skip-link>
+                <skip-link>../tenant-register/success_register.jsp</skip-link>
+
+                <!-- the following files need to be placed in the validate-domain ui component,
+                 but since it has no menu, it had to be moved here -->
+                <skip-link>../validate-domain/validate_domain_not_logged_in.jsp</skip-link>
+                <skip-link>../validate-domain/validate_with_dns_ajaxprocessor.jsp</skip-link>
+                <skip-link>../validate-domain/validate_with_text_ajaxprocessor.jsp</skip-link>
+                <skip-link>../validate-domain/submit_validate_domain_ajaxprocessor.jsp</skip-link>
+
+                <!-- account-mgt stuff -->
+                <skip-link>../account-mgt/update_verifier.jsp</skip-link>
+                <skip-link>../email-verification/validator_ajaxprocessor.jsp</skip-link>
+                <skip-link>../email-verification/invalid_email.jsp</skip-link>
+                <skip-link>../account-mgt/update_verifier_redirector_ajaxprocessor.jsp</skip-link>
+
+                <!--payment stuff -->
+                <skip-link>../payment/registration_payment.jsp</skip-link>
+                <skip-link>../payment/registration_payment_completed.jsp</skip-link>
+            </skip-authentication>
+            <require-not-logged-in>true</require-not-logged-in>
+        </menu>
+    </menus>
+
+</component>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/org/apache/stratos/register/ui/i18n/JSResources.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/org/apache/stratos/register/ui/i18n/JSResources.properties b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/org/apache/stratos/register/ui/i18n/JSResources.properties
new file mode 100644
index 0000000..c49c4b0
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/org/apache/stratos/register/ui/i18n/JSResources.properties
@@ -0,0 +1,6 @@
+password.mismatched=Passwords do not match.
+email.mismatched=The emails are mismatching.
+current.password.should.provided=You should provide the current password in order to change the password.
+password.length=Your password must be at least 6 characters long. Try again.
+domain.available=Domain is available to register.
+domain.unavailable=Sorry!. The Domain is already registered. Please choose a different domain.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/org/apache/stratos/register/ui/i18n/Resources.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/org/apache/stratos/register/ui/i18n/Resources.properties b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/org/apache/stratos/register/ui/i18n/Resources.properties
new file mode 100644
index 0000000..b757c4f
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/org/apache/stratos/register/ui/i18n/Resources.properties
@@ -0,0 +1,62 @@
+submit.tenant=Submit Tenant
+domain=Tenant Domain
+domain.information=Domain Information
+terms.of.use=Terms of Use
+contact.details=Contact Details
+admin.username=Admin Username
+username=Username
+username.or.domain=Username/Domain
+current.admin.password=Current Admin Password
+new.admin.password=New Admin Password
+new.admin.password.repeat=New Admin Password (Repeat)
+admin.password=Admin Password
+admin.password.repeat=Admin Password (Repeat)
+govern.add_tenants.menu=Add New Tenant
+govern.view_tenants.menu=View Tenants
+overview=Overview
+tenants.list=Tenants List
+company.organization=Company/Organization
+admin.contact=Admin Contact
+edit=Edit
+multitenancy=Multitenancy
+added.successfully=You have successfully added a new tenant with domain:
+updated.successfully=You have successfully updated the tenant with domain:
+update.added.tenant=Update the just added/updated tenant
+update.tenant=Update Tenant
+add.new.tenant=Add a new tenant
+register.new.organization=Sign up your organization
+view.all.tenants=View all tenants
+tenant.admin=Tenant Admin
+tenant.description=Tenant Description
+admin.fullname=Full Name
+admin.firstname=First Name
+admin.lastname=Last Name
+admin.address=Address
+admin.email=Email
+admin.email.repeat=Email (Repeat)
+admin.telephone=Telephone
+admin.im=IM
+admin.url=URL
+self.registration=Registry Tenant
+gaas=Sign up
+register.org.menu=Sign up new organization
+gaas.register.a.new.tenant=Register A New Tenant
+active=Active
+theme.management=Theme Management
+word.verification=Word Verification
+captcha.message=Type the characters you see in the picture below.
+select.domain.menu=Sign up new organization
+select.domain.title=Select a domain for your organization
+password.reset=Password Reset
+password.reset.failed=Password Reset Attempt Failed
+verified.request.successfully=You have successfully verified your Password reset request.\nPls reset your password below.
+request.verification.failed=Password Reset Verification Failed. \nPls make sure you have clicked the correct link to reset your domain's admin password.
+accept.eula=I have read and accepted the terms in the license agreement above.
+usage.plan.information= Usage Plan Information
+select.usage.plan.for.tenant=Select Usage Plan For Tenant
+demo.package.price=$0 per month
+select.package.message=According to the selected plan, resources will be allocated for you. You can upgrade or downgrade your plan later according to your requirements. If you need more information on plans, click 'Pricing Info'.
+required.msg=All fields marked with an asterisk (<span class="required">*</span>) are required. 
+billing.currency=$
+redirect.to.paypal.msg1=You will be redirected to PayPal to make a registration payment of
+redirect.to.paypal.msg2=Do you wish to proceed?  
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/css/tenant-register.css
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/css/tenant-register.css b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/css/tenant-register.css
new file mode 100644
index 0000000..621c028
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/css/tenant-register.css
@@ -0,0 +1,78 @@
+body {
+	color:#111111;
+	font-size:0.75em;
+	font-size-adjust:none;
+	font-style:normal;
+	font-variant:normal;
+	font-weight:normal;
+	line-height:1.25em;
+	background-image: url(../images/body-bg.gif);
+	background-position: left top;
+	background-repeat: repeat-x;
+	margin: 0px;
+	padding: 0px;
+}
+
+div.clear {
+	clear:both;
+}
+p { }
+
+td { }
+
+a:link { }
+
+a:visited { }
+
+a:hover { }
+
+a:active { }
+
+div.features {
+	background-image: url(../images/features-bg.gif);
+	background-position: 39px 30px;
+	background-repeat: no-repeat;
+}
+div.feature {
+	float: left;
+	width: 221px;
+	margin-left: 39px;
+	margin-top: 30px;
+	padding: 20px;
+	text-align: left;
+}
+div.feature img {
+	float: left;
+	margin-right: 10px;
+	width: 64px;
+}
+div.feature h2 {
+	margin-top: 0px;
+	margin-bottom: 7px;
+	color: #0499CC;
+	font-size: 155%;
+	line-height: 110%;
+	font-weight: normal;
+	
+}
+div.feature p {
+	margin-top: 0px;
+	padding-top: 0px;
+}
+td.page-header-help a{
+    position:absolute;
+    right:20px;
+}
+div#middle div#workArea {
+    padding:0px;
+}
+.registration_help{
+    color:#555;
+    line-height:25px;
+}
+.toggle_container ,h2.trigger {
+    box-shadow: none;
+}
+.leftCol-med{
+    width:180px;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/docs/aboutUsagePlans.html
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/docs/aboutUsagePlans.html b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/docs/aboutUsagePlans.html
new file mode 100644
index 0000000..791b867
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/docs/aboutUsagePlans.html
@@ -0,0 +1,104 @@
+<!--
+ ~ 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.
+ -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <title>Select Usage Plan For Tenant - User Guide</title>
+  <link href="../../admin/css/documentation.css" rel="stylesheet" type="text/css" media="all" />
+</head>
+
+<body>
+
+
+ <h1>Select Usage Plan For Tenant</h1>
+
+
+ <h2> <b> Usage Plans(Subscriptions)</b></h2>
+
+<p>
+    According to the usage plan that you selected you will get different volume of service and registry
+    bandwidths other services that available for tenants.By selecting right usage plan that suits
+    your requirements you can get maximum profit
+</p>
+
+
+<h2><b>Multitenancy Free</b></h2>
+<p>
+  This is the free usage plan.You will get limited amount of resources.This package is
+  best suite for evaluation and tests.
+</p>
+ <h2><b>Multitenancy Small</b></h2>
+<p>
+   This package is best suite for small business.
+</p>
+<h2><b>Multitenancy Medium</b></h2>
+<p>
+   This usage plan suites for medium scale business.You will get average amount of resources
+    with this package.
+</p>
+<h2><b>Multitenancy Large</b></h2>
+<p>
+   This is the premium usage plan.You will get maximum resources form this plan.
+   This is best suite to large scale business.
+</p>
+
+<p>
+
+   Usage Plan summery
+<table border="1">
+<tr>
+<td>Usage Plan Name</td>
+<td>Number Of Users</td>
+<td>Registry Bandwidth (Mb) </td>
+<td>Service BandWidth (Mb) </td>
+<td>Cost Per Month ($)</td>
+</tr>
+<tr>
+<td>Multitenancy Free</td>
+<td>5</td>
+<td>10</td>
+<td>10</td>
+<td>10</td>
+</tr>
+<tr>
+<td>Multitenancy Small</td>
+<td>10</td>
+<td>25</td>
+<td>25</td>
+<td>25</td>
+</tr>
+<tr>
+<td>Multitenancy Medium</td>
+<td>20</td>
+<td>100</td>
+<td>100</td>
+<td>100</td>
+</tr>
+<tr>
+<td>Multitenancy Large</td>
+<td>50</td>
+<td>200</td>
+<td>200</td>
+<td>200</td>
+</tr>
+</table> 
+<div><strong>Figure1: Usage Plan Summery Table</strong></div>
+</p>
+</body>
+
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/docs/images/add-org.png
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/docs/images/add-org.png b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/docs/images/add-org.png
new file mode 100644
index 0000000..3d97bab
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/docs/images/add-org.png differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/docs/userguide.html
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/docs/userguide.html b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/docs/userguide.html
new file mode 100644
index 0000000..f97cf59
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/docs/userguide.html
@@ -0,0 +1,104 @@
+<!--
+ ~ 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.
+ -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+  <title>Multitenancy Tenant Self Registration - User Guide</title>
+  <link href="../../admin/css/documentation.css" rel="stylesheet" type="text/css" media="all" />
+</head>
+
+<body>
+<h1>Tenant Self Registration</h1>
+
+<p style="font-size:small;">
+You can use this form to register an account for the domain of your organization. You can also check whether the domain is available to register here.
+</p>
+<p style="font-size:small;">
+Optionally you can choose to validate the domain, or can go ahead registering without validating the domain for the moment.
+</p>
+
+<p>
+<img src="images/add-org.png" alt="Register New Organization Form"/>
+<div><strong>Figure1: Register A New Organization Form</strong></div>
+</p>
+
+<p>
+
+<p style="font-size:small;">
+You need to provide the following information to register your organization.
+</p>
+
+
+<table border="1">
+    <thead style="font-size:small;">
+        <td>
+           <b> The Form Field </b>
+        </td>
+        <td >
+            <b>Description</b>
+        </td>
+    </thead>
+    <tbody style="font-size:small;">
+        <tr>
+            <td>Domain</td>
+            <td>Enter the domain name of your organization in here.</td>
+        </tr>
+        <tr>
+            <td>Admin Username</td>
+            <td>The username of the first admin account for your organization. You can use this account to login to all WSO2 Stratos services under your domain name. There
+            is a user management UI that you can access after you login to the system where you can add new users (including users under admin role), new roles.
+            </td>
+        </tr>
+        <tr>
+            <td>First Name</td>
+            <td>Your first name, which will be used to address you in the further communication and the notifications.</td>
+        </tr>
+        <tr>
+            <td>Last Name</td>
+            <td>Your last name.</td>
+        </tr>
+        <tr>
+            <td>Admin Password</td>
+            <td>The password of the startup admin account. You can change the password later from the user management UI.</td>
+        </tr>
+        <tr>
+            <td>Admin Password (Repeat)</td>
+            <td>Repeat the password you provided in the above field, so we can catch any typing mistake you made in there.</td>
+        </tr>
+        <tr>
+            <td>Email</td>
+            <td>Your email address. This email will be used to complete the registration process and to contact you for any further requirement.</td>
+        </tr>
+        <tr>
+            <td>Word Verification</td>
+            <td>Enter the letters shown in the above image in this text box. 
+        </tr>
+    </tbody>
+</table>
+
+</p>
+
+<p style="font-size:small;">
+Once you completed the registration, you will be sent an email notification with the account verification information. 
+</p>
+<p style="font-size:small;">
+After verifying your registration, you can log in to the account using the log in page.
+</p>
+</body>
+
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/domain_availability_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/domain_availability_ajaxprocessor.jsp b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/domain_availability_ajaxprocessor.jsp
new file mode 100644
index 0000000..730d777
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/domain_availability_ajaxprocessor.jsp
@@ -0,0 +1,50 @@
+<!--
+ ~ 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 import="org.wso2.carbon.ui.CarbonUIMessage" %>
+<%@ page import="org.wso2.carbon.registry.common.ui.UIException" %>
+<%@ page import="org.wso2.carbon.register.ui.utils.TenantConfigUtil" %>
+<%@ page import="java.util.Enumeration" %>
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ 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" %>
+
+<%
+try {
+    boolean domainAvailable = TenantConfigUtil.checkDomainAvailability(request, config, session);
+
+    if (domainAvailable) {
+    %>
+    ----DomainAvailable----
+    <%
+    }
+    else {
+    %>
+    ----DomainUnavailable----
+    <%
+    }
+} catch (UIException e) {
+
+%>
+    Error in checking the domain availability.
+    please retry the registration from the <a href="../tenant-register/select_domain.jsp">start</a>.
+<%
+}
+
+%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/get_package_info_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/get_package_info_ajaxprocessor.jsp b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/get_package_info_ajaxprocessor.jsp
new file mode 100644
index 0000000..fe7a6f6
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/get_package_info_ajaxprocessor.jsp
@@ -0,0 +1,39 @@
+<%--
+~ 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.ui.CarbonUIUtil" %>
+<%@ page import="org.json.JSONArray" %>
+<%@ page import="org.wso2.carbon.register.ui.clients.PackageInfoServiceClient" %>
+<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
+<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ 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 backendServerUrl = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+    String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+    ConfigurationContext configContext =
+            (ConfigurationContext)config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+
+    PackageInfoServiceClient client = new PackageInfoServiceClient(cookie, backendServerUrl,configContext);
+    JSONArray packageInfoArray = client.getBillingPackagesJsonArray();
+
+    out.write(packageInfoArray.toString());
+%>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/ajax-loader.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/ajax-loader.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/ajax-loader.gif
new file mode 100644
index 0000000..f2a1bc0
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/ajax-loader.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/body-bg.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/body-bg.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/body-bg.gif
new file mode 100644
index 0000000..5db1464
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/body-bg.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/button-back.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/button-back.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/button-back.gif
new file mode 100644
index 0000000..6a52e34
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/button-back.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/content-back-left.jpg
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/content-back-left.jpg b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/content-back-left.jpg
new file mode 100644
index 0000000..ebfe8ed
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/content-back-left.jpg differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/content-back.jpg
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/content-back.jpg b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/content-back.jpg
new file mode 100644
index 0000000..62b8da1
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/content-back.jpg differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/create-org-button.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/create-org-button.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/create-org-button.gif
new file mode 100644
index 0000000..b7e62a3
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/create-org-button.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/feature-01-icon.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/feature-01-icon.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/feature-01-icon.gif
new file mode 100644
index 0000000..ff3ba26
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/feature-01-icon.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/feature-02-icon.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/feature-02-icon.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/feature-02-icon.gif
new file mode 100644
index 0000000..ee4cb66
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/feature-02-icon.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/feature-03-icon.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/feature-03-icon.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/feature-03-icon.gif
new file mode 100644
index 0000000..8f3c2a1
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/feature-03-icon.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/features-bg.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/features-bg.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/features-bg.gif
new file mode 100644
index 0000000..dd9e693
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/features-bg.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/footer.jpg
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/footer.jpg b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/footer.jpg
new file mode 100644
index 0000000..c617091
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/footer.jpg differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/forum.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/forum.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/forum.gif
new file mode 100644
index 0000000..e92779a
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/forum.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/header.jpg
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/header.jpg b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/header.jpg
new file mode 100644
index 0000000..4438a06
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/header.jpg differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/help.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/help.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/help.gif
new file mode 100644
index 0000000..43242c2
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/help.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/images.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/images.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/images.gif
new file mode 100644
index 0000000..94b46dc
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/images.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/issue-tracker.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/issue-tracker.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/issue-tracker.gif
new file mode 100644
index 0000000..9029c12
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/issue-tracker.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/logo.jpg
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/logo.jpg b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/logo.jpg
new file mode 100644
index 0000000..202360d
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/logo.jpg differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/mailing-list.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/mailing-list.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/mailing-list.gif
new file mode 100644
index 0000000..06d61e3
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/mailing-list.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/page-back.jpg
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/page-back.jpg b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/page-back.jpg
new file mode 100644
index 0000000..2e21b54
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/page-back.jpg differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/people.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/people.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/people.gif
new file mode 100644
index 0000000..edfa49b
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/people.gif differ

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

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/signup-new-org.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/signup-new-org.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/signup-new-org.gif
new file mode 100644
index 0000000..640a501
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/signup-new-org.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/thememgt.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/thememgt.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/thememgt.gif
new file mode 100644
index 0000000..e554e87
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/thememgt.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/user-guide.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/user-guide.gif b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/user-guide.gif
new file mode 100644
index 0000000..9342adc
Binary files /dev/null and b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/images/user-guide.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/init_payment_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/init_payment_ajaxprocessor.jsp b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/init_payment_ajaxprocessor.jsp
new file mode 100755
index 0000000..abf7b2e
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/init_payment_ajaxprocessor.jsp
@@ -0,0 +1,101 @@
+<!--
+ ~ 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.apache.axis2.context.ConfigurationContext" %>
+<%@ page import="org.json.JSONArray"%>
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ page import="org.wso2.carbon.register.ui.clients.PackageInfoServiceClient" %>
+<%@ page import="org.apache.stratos.common.util.CommonUtil" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
+<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
+<%@ page import="java.util.Collections" %>
+<%@ page import="java.util.Enumeration" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="org.json.JSONException" %>
+<%@ 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%>" />
+<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/register_config.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>
+<%
+    String tenantDomain = request.getParameter("domain");
+    // The actual usage plan the tenant selects in select_usage_plan.jsp
+    String selectedUsagePlan = request.getParameter("selectedUsagePlan");
+    session.setAttribute("selectedUsagePlan", selectedUsagePlan);
+    
+    String backendServerUrl = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+    String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+    ConfigurationContext configContext =
+            (ConfigurationContext)config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+
+    PackageInfoServiceClient client = new PackageInfoServiceClient(cookie, backendServerUrl,configContext);
+    JSONArray packageInfoArray = client.getBillingPackagesJsonArray();
+    String amount = "0";
+
+    for (int i = 0; i < packageInfoArray.length(); i++) {
+        try {
+            if (packageInfoArray.getJSONObject(i).getString("name").equals(selectedUsagePlan)) {
+                amount = packageInfoArray.getJSONObject(i).getString("subscriptionCharge");
+            }
+        } catch (JSONException e) {
+            //
+        }
+    }
+
+    String successUrl;
+    String paypalUrl = CommonUtil.getStratosConfig().getPaypalUrl();
+    String adminConsoleURL = CarbonUIUtil.getAdminConsoleURL(request);
+    adminConsoleURL = adminConsoleURL.substring(0, adminConsoleURL.indexOf("carbon"));
+     successUrl = adminConsoleURL + "carbon/payment/registration_payment.jsp";
+    String cancelUrl = adminConsoleURL + "carbon/admin/login.jsp";
+%>
+
+<script type="text/javascript">
+
+
+        var successUrl = '<%=successUrl%>';
+        var cancelUrl = '<%=cancelUrl%>';
+        var amount = '<%=amount%>';
+        var tenantDomain = '<%=tenantDomain%>';
+        jQuery.ajax({
+            type: 'GET',
+            url: '../payment/setEC-ajaxprocessor.jsp',
+            data: 'successUrl=' + successUrl + '&cancelUrl=' + cancelUrl + '&amount=' + amount + '&tenantDomain=' + tenantDomain,
+            dataType: 'json',
+            async: false,
+            success: function(msg) {
+                var resp = msg;
+                if(resp.ack=='Success'){
+                    location.href = '<%=paypalUrl%>' + resp.token;
+                }else{
+                    location.href = cancelUrl;
+                }
+            },
+            error:function () {
+                location.href = cancelUrl;
+            }
+        });
+</script>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/js/register_config.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/js/register_config.js b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/js/register_config.js
new file mode 100644
index 0000000..fdcd24e
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/js/register_config.js
@@ -0,0 +1,147 @@
+function addTenant(isPublicCloud) {
+    var domain = document.getElementById('domain');
+    var reason = "";
+    var addTenantForm = document.getElementById('addTenantForm');
+    var adminPassword = "";
+    var adminPasswordRepeat = "";
+    var email = "";
+    var firstname = document.getElementById('admin-firstname');
+    var lastname = document.getElementById('admin-lastname');
+    var adminName = document.getElementById('admin');
+    adminPassword = document.getElementById('admin-password');
+    adminPasswordRepeat = document.getElementById('admin-password-repeat');
+    email = document.getElementById('admin-email');
+
+    // the domain validation part is moved to the select_domain.js
+
+    var reason = validateEmpty(domain, "Domain");
+    if (reason == "") {
+        reason += checkDomain(domain, isPublicCloud);
+    }
+    if (reason == "") {
+        reason += validateEmpty(firstname, "First Name");
+    }
+    if (reason == "") {
+        reason += validateIllegal(firstname, "First Name");
+    }
+    if (reason == "") {
+        reason += validateEmpty(lastname, "Last Name");
+    }
+    if (reason == "") {
+        reason += validateIllegal(lastname, "Last Name");
+    }
+    if (reason == "") {
+        reason += validateEmpty(adminName, "Admin Username");
+    }
+    if (reason == "") {
+        reason += validateIllegal(adminName, "Admin Username");
+    }
+    if (reason == "") {
+        reason += validateUsername(adminName);
+    }
+    if (reason == "") {
+        reason += validateEmpty(adminPassword, "Admin Password");
+    }
+    if (reason == "") {
+        reason += validateAdminPassword(adminPassword);
+    }
+    if (reason == "") {
+        reason += validateEmpty(adminPasswordRepeat, "Admin Password (Repeat)");
+    }
+    if (reason == "") {
+        reason += validateEmpty(email, "Email");
+    }
+    if (reason == "") {
+        reason += validateEmail(email);
+    }
+    if (reason == "") {
+        if (adminPassword.value != adminPasswordRepeat.value) {
+            reason += jsi18n["password.mismatched"];
+        }
+        if (adminPassword.value.length < 6) {
+            reason += jsi18n["password.length"];
+        }
+    }
+    if (reason != "") {
+        CARBON.showWarningDialog(reason);
+        document.getElementbyId("submit-button").disabled = false;
+        document.getElementById('waitMessage').style.display = 'none';
+        return;
+    }
+    addTenantForm.submit();
+}
+
+function validateAdminPassword(fld) {
+    var error = "";
+
+    if (fld.value == "") {
+        error = org_wso2_carbon_registry_common_ui_jsi18n["no.password"] + "<br />";
+    } /* else if ((fld.value.length < 3) || (fld.value.length > 15)) {
+     error = org_wso2_carbon_registry_common_ui_jsi18n["wrong.password"] + "<br />";
+     } else if (illegalChars.test(fld.value)) {
+     error = org_wso2_carbon_registry_common_ui_jsi18n["illegal.password"] + "<br />";
+     } else if (!((fld.value.search(/(a-z)+/)) && (fld.value.search(/(0-9)+/)))) {
+     error = "The password must contain at least one numeral.<br />";
+     } */ else {
+        fld.style.background = 'White';
+    }
+    return error;
+}
+
+function activationChanged(cbox, domain) {
+    if (!cbox.checked) {
+        CARBON.showConfirmationDialog("Are you sure you want to deactivate the domain: " +
+                                      domain + ".", function() {
+            var submitForm = document.getElementById(domain + "_form");
+            submitForm.submit();
+        }, function() {
+            cbox.checked = "on";
+        });
+    } else {
+        var submitForm = document.getElementById(domain + "_form");
+        submitForm.submit();
+    }
+}
+
+function fillAdminValue() {
+    var adminValue = document.getElementById('adminValue');
+    var domain = document.getElementById('domain');
+
+    var reason = validateIllegal(domain, "Domain");
+    if (reason != "") {
+        CARBON.showErrorDialog(reason);
+        adminValue.innerHTML = '';
+        return;
+    }
+
+    if (domain.value == "") {
+        adminValue.innerHTML = '' + domain.value;
+    }
+    else {
+        adminValue.innerHTML = '@' + domain.value;
+    }
+}
+
+function showregistrationfail() {
+    var error = "";
+    CARBON.showWarningDialog(error);
+}
+
+var kaptchaImgUrl;
+function showKaptcha(kaptchaImgUrlArg) {
+    kaptchaImgUrl = kaptchaImgUrlArg;
+    var kaptchaImgDiv = document.getElementById("kaptchaImgDiv");
+    kaptchaImgDiv.innerHTML = "<img src='../tenant-register/images/ajax-loader.gif' alt='busy'/>";
+    setTimeout("showKaptchaTimely()", 4000);
+}
+
+function showKaptchaTimely() {
+    var kaptchaImgDiv = document.getElementById("kaptchaImgDiv");
+    kaptchaImgDiv.innerHTML = "<img src='" + kaptchaImgUrl + "' alt='If you can not see the captcha " +
+                              "image please refresh the page or click the link again.'/>";
+}
+
+function activateSubmit(fld) {
+    var submitButton = document.getElementById('submit-button');
+    submitButton.disabled = !fld;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/bafd6bb1/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/js/select_domain.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/js/select_domain.js b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/js/select_domain.js
new file mode 100644
index 0000000..592e308
--- /dev/null
+++ b/components/org.apache.stratos.tenant.registration.ui/src/main/resources/web/tenant-register/js/select_domain.js
@@ -0,0 +1,75 @@
+function checkDomainAvailability(isPublicCloud) {
+    var domain = document.getElementById('domain');
+
+    var reason = validateEmpty(domain, "Domain");
+    if (reason == "") {
+        reason += checkDomain(domain, isPublicCloud);
+    }
+
+    if(reason != "") {
+        CARBON.showWarningDialog(reason);
+        return false;
+    }
+
+    var busyCheck = document.getElementById("busyCheck");
+    busyCheck.innerHTML = "<img src=\"images/ajax-loader.gif\"/>";
+    
+    var domain_confirmation_div = document.getElementById("domain-confirmation-msg");
+    
+    new Ajax.Request('../tenant-register/domain_availability_ajaxprocessor.jsp',
+    {
+        method:'post',
+        parameters: {domain: domain.value},
+
+        onSuccess: function(transport) {
+            busyCheck.innerHTML = "";
+            var returnValue = transport.responseText;
+            if (returnValue.search(/----DomainAvailable----/) == -1) {
+                domain_confirmation_div.style.color = "#f00";
+                domain_confirmation_div.innerHTML = jsi18n["domain.unavailable"]; 
+                result = false;
+            } else {
+                domain_confirmation_div.style.color = "#058000";
+                domain_confirmation_div.innerHTML = jsi18n["domain.available"];
+                result = true;
+            }
+        },
+
+        onFailure: function(transport){
+            busyCheck.innerHTML = "";
+        }
+    });
+}
+
+function clearDomainConfirmationMsg() {
+    var domain_confirmation_div = document.getElementById("domain-confirmation-msg");
+    domain_confirmation_div.innerHTML = "";
+}
+
+
+function checkDomain(fld, isPublicCloudSetup)
+{
+    var error = "";
+    var domain = fld.value;
+    var lastIndexOfDot = domain.lastIndexOf(".");
+    var indexOfDot = domain.indexOf(".");
+    var extension = domain.substring(lastIndexOfDot, domain.length);
+
+    var illegalChars = /([^a-zA-Z0-9\._\-])/; // allow only letters and numbers . - _and period
+    if (extension.indexOf("-trial") >= 0 || extension.indexOf("-unverified") >= 0) {
+        // we are not allowing to create a domain with -trial or -unverified is in the extension
+        error = "The domain name you entered is not valid. Please enter a valid domain name.";
+    }
+    else if (isPublicCloudSetup && (lastIndexOfDot <= 0)) {
+        error = "Invalid domain: " + domain + ". You should have an extension to your domain.";
+    }
+    else if (indexOfDot == 0) {
+        error = "Invalid domain, starting with '.'";
+    }
+    else if (illegalChars.test(fld.value)) {
+        error = "The domain only allows letters, numbers, '.', '-' and '_'. <br />";
+    } else {
+        fld.style.background = 'White';
+    }
+    return error;
+}