You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2013/07/12 15:13:33 UTC
[2/3] Version removal of Tenant management UI component
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/2.1.0/src/main/resources/web/tenant-mgt/view_tenants.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/2.1.0/src/main/resources/web/tenant-mgt/view_tenants.jsp b/components/org.apache.stratos.tenant.mgt.ui/2.1.0/src/main/resources/web/tenant-mgt/view_tenants.jsp
deleted file mode 100644
index f04efdb..0000000
--- a/components/org.apache.stratos.tenant.mgt.ui/2.1.0/src/main/resources/web/tenant-mgt/view_tenants.jsp
+++ /dev/null
@@ -1,236 +0,0 @@
-<!--
-~ 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.wso2.carbon.CarbonConstants" %>
-<%@ page import="org.wso2.carbon.tenant.mgt.stub.beans.xsd.PaginatedTenantInfoBean" %>
-<%@ page import="org.wso2.carbon.tenant.mgt.stub.beans.xsd.TenantInfoBean" %>
-<%@ page import="org.wso2.carbon.tenant.mgt.ui.clients.TenantServiceClient" %>
-<%@ page import="org.wso2.carbon.tenant.mgt.ui.utils.TenantMgtUtil" %>
-<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
-<%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %>
-<%@ page import="org.wso2.carbon.utils.ServerConstants" %>
-<%@ page import="java.text.SimpleDateFormat" %>
-<%@ page import="java.util.Calendar" %>
-<%@ page import="java.util.Date" %>
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
-<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
-<jsp:include page="../registry_common/registry_common-i18n-ajaxprocessor.jsp"/>
-<script type="text/javascript" src="../registry_common/js/registry_validation.js"></script>
-<script type="text/javascript" src="../registry_common/js/registry_common.js"></script>
-<script type="text/javascript" src="../ajax/js/prototype.js"></script>
-<script type="text/javascript" src="js/tenant_config.js"></script>
-
-
-<%
- if ("Success".equals(request.getParameter("addTenant"))) {
-%>
-<script type="text/javascript">showSuccessRegisterMessage()</script>
-<%
- }
- if ("SuccessUpdate".equals(request.getParameter("addTenant"))) {
-%>
-<script type="text/javascript">showSuccessUpdateMessage()</script>
-<%
- }
-
-%>
-<carbon:jsi18n
- resourceBundle="org.wso2.carbon.tenant.mgt.ui.i18n.JSResources"
- request="<%=request%>"/>
-
-<fmt:bundle basename="org.wso2.carbon.tenant.mgt.ui.i18n.Resources">
- <carbon:breadcrumb
- label="govern.view_tenants.menu"
- resourceBundle="org.wso2.carbon.tenant.mgt.ui.i18n.Resources"
- topPage="true"
- request="<%=request%>"/>
-
- <div id="top">
- <form id="findTenantForm" action="view_tenants.jsp?action=search" method="post">
- <table class="normal-nopadding" cellspacing="0">
- <tbody>
- <tr>
- <td><fmt:message key="enter.tenant.domain"/></td>
- <td colspan="2"><input type="text" name="domain" id="domain"
- style="width:400px"/>
- <input type="button" onclick="domainSelected()" value="Find"/>
- </td>
- </tr>
- </tbody>
- </table>
- </form>
- </div>
-
- <br/>
-
- <div id="middle">
-
- <%
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
- String activatingDomain = request.getParameter("activate.domain");
- String action = request.getParameter("action");
- String domainName = request.getParameter("domain");
- if (activatingDomain != null) {
- // try to activate deactive the tenant
- String activate = request.getParameter("activate");
- try {
- if (activate != null && activate.equalsIgnoreCase("on")) {
- TenantMgtUtil.activateTenant(request, config, session);
- } else {
- TenantMgtUtil.deactivateTenant(request, config, session);
- }
- } catch (Exception e) {
- String error1 = "Error in activating/deactivating tenant";
- request.setAttribute(CarbonUIMessage.ID,
- new CarbonUIMessage(error1, error1, null));
-
- %>
-
- <jsp:forward page="../admin/error.jsp?<%=error1%>"/>
-
- <%
- return;
- }
- }
-
- String pageNumberStr = request.getParameter("pageNumber");
- if (pageNumberStr == null) {
- pageNumberStr = "0";
- }
- int pageNumber = 0;
- try {
- pageNumber = Integer.parseInt(pageNumberStr);
- } catch (NumberFormatException ignored) {
- // page number format exception
- }
- int numberOfPages;
- int noOfPageLinksToDisplay = 5; //default value is set to 5
-
- String backendServerURL = CarbonUIUtil.getServerURL(
- config.getServletContext(), session);
- ConfigurationContext configContext = (ConfigurationContext) config
- .getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
-
- String cookie = (String) session.getAttribute
- (ServerConstants.ADMIN_SERVICE_COOKIE);
- TenantServiceClient client;
- PaginatedTenantInfoBean tenantsInfo;
- TenantInfoBean[] tenantInfoArr;
- try {
- client = new TenantServiceClient(cookie, backendServerURL, configContext);
- if (action != null && action.equals("search")) {
- tenantsInfo = client.retrievePaginatedPartialSearchTenants(domainName,pageNumber);
- } else {
- tenantsInfo = client.retrievePaginatedTenants(pageNumber);
- }
-
-
- tenantInfoArr = tenantsInfo.getTenantInfoBeans();
- numberOfPages = tenantsInfo.getNumberOfPages();
-
- } catch (Exception e) {
- String error1 = "Error in retrieving tenants";
- request.setAttribute(CarbonUIMessage.ID, new CarbonUIMessage(error1, error1, null));
- %>
-
- <jsp:forward page="../admin/error.jsp"/>
-
- <%
- return;
- }
- %>
-
- <h2><fmt:message key="tenants.list"/></h2>
- <br/>
- <carbon:paginator pageNumber="<%=pageNumber%>" numberOfPages="<%=numberOfPages%>"
- noOfPageLinksToDisplay="<%=noOfPageLinksToDisplay%>"
- page="view_tenants.jsp" pageNumberParameterName="pageNumber"/>
-
- <div id="workArea">
-
-
- <%
- if (tenantInfoArr != null && tenantInfoArr.length>0 && tenantInfoArr[0]!=null) {
- %>
-
- <table cellpadding="0" cellspacing="0" border="0" style="width:100%" class="styledLeft">
- <thead>
- <tr>
- <th style="padding-left:5px;text-align:left;"><fmt:message key="domain"/></th>
- <th style="padding-left:5px;text-align:left;"><fmt:message
- key="admin.email"/></th>
- <th style="padding-left:5px;text-align:left;"><fmt:message
- key="created.date"/></th>
- <th style="padding-left:5px;text-align:left;"><fmt:message key="active"/></th>
- <th style="padding-left:5px;text-align:left;"><fmt:message key="edit"/></th>
- </tr>
- </thead>
- <tbody>
-
- <%
- for (TenantInfoBean tenantInfo : tenantInfoArr) {
- if (tenantInfo == null) {
- continue;
- }
- String tenantDomain = TenantMgtUtil.removeHtmlElements(
- tenantInfo.getTenantDomain());
- String email = TenantMgtUtil.removeHtmlElements(tenantInfo.getEmail());
- boolean isActive = tenantInfo.getActive();
- Calendar createdDateCal = tenantInfo.getCreatedDate();
- Date createdDate = new Date(createdDateCal.getTimeInMillis());
- String createdDateStr = dateFormat.format(createdDate);
- %>
-
- <tr id="1">
- <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=tenantDomain%>
- </td>
- <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=email%>
- </td>
- <td style="padding-left:5px;padding-top:3px;text-align:left;"><%=createdDateStr%>
- </td>
- <td style="padding-left:5px;padding-top:3px;text-align:left;">
- <form id="<%=tenantDomain%>_form" action="view_tenants.jsp" method="post">
- <input type="checkbox" name="activate"
- onchange="javascript:activationChanged(this, '<%=tenantDomain%>')"
- <%if (isActive) {%>checked="true"<%}%>/>
- <input type="hidden" name="activate.domain" value="<%=tenantDomain%>"/>
- </form>
- </td>
- <td style="padding-left:5px;padding-top:3px;text-align:left;"><a
- href="add_tenant.jsp?domain=<%=tenantInfo.getTenantDomain()%>">Edit</a>
- </td>
- </tr>
- <% }
- %>
- </tbody>
- </table>
- <%
- }else{
- %>
- <div><fmt:message key="no.tenants.available"/></div>
- <%
- }
- %>
-
- </div>
- <carbon:paginator pageNumber="<%=pageNumber%>" numberOfPages="<%=numberOfPages%>"
- noOfPageLinksToDisplay="<%=noOfPageLinksToDisplay%>"
- page="view_tenants.jsp" pageNumberParameterName="pageNumber"/>
- </div>
-</fmt:bundle>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/pom.xml b/components/org.apache.stratos.tenant.mgt.ui/pom.xml
new file mode 100644
index 0000000..6fbac66
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/pom.xml
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>stratos-components-parent</artifactId>
+ <version>3.0.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.apache.stratos.tenant.mgt.ui</artifactId>
+ <packaging>bundle</packaging>
+ <name>Apache Stratos - User Interface for Tenant CRUD operations</name>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Name>${project.artifactId}</Bundle-Name>
+ <Export-Package>
+ org.apache.stratos.tenant.mgt.ui.*,
+ </Export-Package>
+ <Import-Package>
+ org.apache.stratos.tenant.mgt.stub.*; version="${carbon.platform.package.import.version.range}",
+ org.apache.axis2.client.*,
+ javax.servlet;version="${imp.pkg.version.javax.servlet}",
+ javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
+ org.apache.lucene.*,
+ *;resolution:=optional
+ </Import-Package>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ <Carbon-Component>UIBundle</Carbon-Component>
+ </instructions>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.wso2.carbon</groupId>
+ <artifactId>org.wso2.carbon.registry.common.ui</artifactId>
+ <version>${wso2carbon.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.wso2.carbon</groupId>
+ <artifactId>org.wso2.carbon.registry.core</artifactId>
+ <version>${wso2carbon.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.equinox</groupId>
+ <artifactId>javax.servlet</artifactId>
+ <version>3.0.0.v201112011016</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2.wso2</groupId>
+ <artifactId>axis2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom.wso2</groupId>
+ <artifactId>axiom</artifactId>
+ <version>${axiom.wso2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.wso2.carbon</groupId>
+ <artifactId>org.wso2.carbon.ui</artifactId>
+ <version>${wso2carbon.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.wso2.carbon</groupId>
+ <artifactId>org.wso2.carbon.tenant.mgt.stub</artifactId>
+ <version>${wso2carbon.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>org.apache.stratos.common</artifactId>
+ <version>${apache.stratos.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.json.wso2</groupId>
+ <artifactId>json</artifactId>
+ <version>${json.wso2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.stratos</groupId>
+ <artifactId>org.apache.stratos.common.stub</artifactId>
+ <version>${apache.stratos.version}</version>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/PackageInfoServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/PackageInfoServiceClient.java b/components/org.apache.stratos.tenant.mgt.ui/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/PackageInfoServiceClient.java
new file mode 100644
index 0000000..b0b692a
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/PackageInfoServiceClient.java
@@ -0,0 +1,79 @@
+package org.apache.stratos.tenant.mgt.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());
+ int subscriptionCharge = packageInfo.getSubscriptionCharge();
+ //TODO https://wso2.org/jira/browse/STRATOS-1819
+ StringBuffer charge = new StringBuffer("$" + subscriptionCharge );
+ packageInfoObj.put("subscriptionCharge", charge.toString());
+ 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/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/TenantServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/TenantServiceClient.java b/components/org.apache.stratos.tenant.mgt.ui/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/TenantServiceClient.java
new file mode 100644
index 0000000..2801b08
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/TenantServiceClient.java
@@ -0,0 +1,120 @@
+/*
+* 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.tenant.mgt.ui.clients;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.CarbonConstants;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.wso2.carbon.tenant.mgt.stub.TenantMgtAdminServiceStub;
+import org.wso2.carbon.tenant.mgt.stub.beans.xsd.PaginatedTenantInfoBean;
+import org.wso2.carbon.tenant.mgt.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 Service Client of tenant.mgt.ui
+ */
+public class TenantServiceClient {
+ private static final Log log = LogFactory.getLog(TenantServiceClient.class);
+
+ private TenantMgtAdminServiceStub stub;
+
+ public TenantServiceClient(String cookie, String backendServerURL,
+ ConfigurationContext configContext) throws RegistryException {
+
+ String epr = backendServerURL + "TenantMgtAdminService";
+
+ try {
+ stub = new TenantMgtAdminServiceStub(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 TenantServiceClient(ServletConfig config, HttpSession session)
+ throws RegistryException {
+
+ String cookie = (String)session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+ String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session);
+ ConfigurationContext configContext = (ConfigurationContext) config.
+ getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+ String epr = backendServerURL + "TenantMgtAdminService";
+
+ try {
+ stub = new TenantMgtAdminServiceStub(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 void addTenant(TenantInfoBean tenantInfoBean) throws Exception {
+ stub.addTenant(tenantInfoBean);
+ }
+
+ public TenantInfoBean[] retrieveTenants() throws Exception {
+ return stub.retrieveTenants();
+ }
+
+ public PaginatedTenantInfoBean retrievePaginatedTenants(int pageNumber) throws Exception {
+ return stub.retrievePaginatedTenants(pageNumber);
+ }
+
+ public PaginatedTenantInfoBean retrievePaginatedPartialSearchTenants(String domain,int pageNumber) throws Exception {
+ return stub.retrievePaginatedPartialSearchTenants(domain,pageNumber);
+ }
+
+ public TenantInfoBean getTenant(String domainName) throws Exception {
+ return stub.getTenant(domainName);
+ }
+
+ public void updateTenant(TenantInfoBean tenantInfoBean) throws Exception {
+ stub.updateTenant(tenantInfoBean);
+ }
+
+ public void activateTenant(String domainName) throws Exception {
+ stub.activateTenant(domainName);
+ }
+
+ public void deactivateTenant(String domainName) throws Exception {
+ stub.deactivateTenant(domainName);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/java/org/apache/stratos/tenant/mgt/ui/utils/TenantMgtUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/java/org/apache/stratos/tenant/mgt/ui/utils/TenantMgtUtil.java b/components/org.apache.stratos.tenant.mgt.ui/src/main/java/org/apache/stratos/tenant/mgt/ui/utils/TenantMgtUtil.java
new file mode 100644
index 0000000..7d06f16
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/java/org/apache/stratos/tenant/mgt/ui/utils/TenantMgtUtil.java
@@ -0,0 +1,217 @@
+/*
+ * 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.apache.stratos.tenant.mgt.ui.utils;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.tenant.mgt.stub.beans.xsd.TenantInfoBean;
+import org.apache.stratos.tenant.mgt.ui.clients.TenantServiceClient;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.Calendar;
+
+/**
+ * Utility methods for tenant.mgt.ui
+ */
+public class TenantMgtUtil {
+ private static final Log log = LogFactory.getLog(TenantMgtUtil.class);
+
+ /**
+ * Super admin Adds a tenant
+ *
+ * @param request HttpServletRequest
+ * @param config ServletConfig
+ * @param session HttpSession
+ * @throws Exception , if error in adding the tenant
+ */
+ public static void addTenantConfigBean(HttpServletRequest request, ServletConfig config,
+ HttpSession session) throws Exception {
+ TenantInfoBean tenantInfoBean = new TenantInfoBean();
+
+ try {
+ tenantInfoBean.setAdmin(request.getParameter("admin"));
+ tenantInfoBean.setFirstname(request.getParameter("admin-firstname"));
+ tenantInfoBean.setLastname(request.getParameter("admin-lastname"));
+ tenantInfoBean.setAdminPassword(request.getParameter("admin-password"));
+ tenantInfoBean.setTenantDomain(request.getParameter("domain"));
+ tenantInfoBean.setEmail(request.getParameter("admin-email"));
+ tenantInfoBean.setUsagePlan(request.getParameter("usage-plan-name"));
+ tenantInfoBean.setCreatedDate(Calendar.getInstance());
+ TenantServiceClient serviceClient = new TenantServiceClient(config, session);
+ serviceClient.addTenant(tenantInfoBean);
+
+ } catch (Exception e) {
+ String msg = "Failed to add tenant config. tenant-domain: "
+ + tenantInfoBean.getTenantDomain() + ", " + "tenant-admin: "
+ + tenantInfoBean.getAdmin() + ".";
+ log.error(msg, e);
+ throw new Exception(msg, e);
+ }
+ }
+
+ /**
+ * Super admin Updates a tenant
+ *
+ * @param request HttpServletRequest
+ * @param config ServletConfig
+ * @param session HttpSession
+ * @throws Exception , if error in updating the tenant
+ */
+ public static void updateTenantConfigBean(HttpServletRequest request, ServletConfig config,
+ HttpSession session) throws Exception {
+ TenantInfoBean tenantInfoBean = new TenantInfoBean();
+
+ try {
+ String tenantIdStr = request.getParameter("tenantId");
+ int tenantId;
+ try {
+ tenantId = Integer.parseInt(tenantIdStr);
+ } catch (Exception e) {
+ String msg = "Error in converting tenant id: " + tenantIdStr + " to a number.";
+ log.error(msg);
+ throw new Exception(msg, e);
+ }
+ tenantInfoBean.setTenantId(tenantId);
+ tenantInfoBean.setAdmin(request.getParameter("admin"));
+ tenantInfoBean.setFirstname(request.getParameter("admin-firstname"));
+ tenantInfoBean.setLastname(request.getParameter("admin-lastname"));
+ tenantInfoBean.setAdminPassword(request.getParameter("admin-password"));
+ tenantInfoBean.setTenantDomain(request.getParameter("domain"));
+ tenantInfoBean.setEmail(request.getParameter("admin-email"));
+ tenantInfoBean.setUsagePlan(request.getParameter("usage-plan-name"));
+ TenantServiceClient serviceClient = new TenantServiceClient(config, session);
+ serviceClient.updateTenant(tenantInfoBean);
+ //UsagePlanClient usagePlanClient = new UsagePlanClient(config, session);
+ //update usage plan(subscription) per tenant
+ //usagePlanClient.updateUsagePlan(tenantInfoBean);
+ } catch (Exception e) {
+ String msg = "Failed to update the tenant config. tenant-domain: "
+ + tenantInfoBean.getTenantDomain() + ", " + "tenant-admin: "
+ + tenantInfoBean.getAdmin() + ".";
+ log.error(msg, e);
+ throw new Exception(msg, e);
+ }
+ }
+
+ /**
+ * Super admin gets all the tenant
+ *
+ * @param request HttpServletRequest
+ * @param config ServletConfig
+ * @param session HttpSession
+ * @return TenantInfoBean[] - Array of tenants
+ * @throws Exception , if getting the tenant information failed.
+ */
+ public static TenantInfoBean[] getTenants(HttpServletRequest request, ServletConfig config,
+ HttpSession session) throws Exception {
+
+ try {
+
+ TenantServiceClient serviceClient = new TenantServiceClient(config, session);
+ return serviceClient.retrieveTenants();
+ } catch (Exception e) {
+ String msg = "Failed to get the minimum information bean of tenants. ";
+ log.error(msg, e);
+ throw new Exception(msg, e);
+ }
+ }
+
+ /**
+ * Super admin gets a particular tenant
+ *
+ * @param request HttpServletRequest
+ * @param config ServletConfig
+ * @param session HttpSession
+ * @return TenantInfoBean - for a tenant
+ * @throws Exception , if error in getting the tenant
+ */
+ public static TenantInfoBean getTenant(HttpServletRequest request, ServletConfig config,
+ HttpSession session) throws Exception {
+ String tenantDomain = "";
+ try {
+ tenantDomain = request.getParameter("domain");
+ TenantServiceClient serviceClient = new TenantServiceClient(config, session);
+ TenantInfoBean tenantBean=serviceClient.getTenant(tenantDomain);
+ return tenantBean;
+ } catch (Exception e) {
+ String msg = "Failed to get existing details of the tenant:" + tenantDomain;
+ log.error(msg, e);
+ throw new Exception(msg, e);
+ }
+ }
+
+ /**
+ * Super admin activates a tenant
+ *
+ * @param request HttpServletRequest
+ * @param config ServletConfig
+ * @param session HttpSession
+ * @throws Exception , if failed to activate the tenant.
+ */
+ public static void activateTenant(HttpServletRequest request, ServletConfig config,
+ HttpSession session) throws Exception {
+ String tenantDomain = "";
+ try {
+ tenantDomain = request.getParameter("activate.domain");
+ TenantServiceClient serviceClient = new TenantServiceClient(config, session);
+ serviceClient.activateTenant(tenantDomain);
+ } catch (Exception e) {
+ String msg = "Failed to activate the tenant:" + tenantDomain;
+ log.error(msg, e);
+ throw new Exception(msg, e);
+ }
+ }
+
+ /**
+ * Super admin deactivates a tenant
+ *
+ * @param request HttpServletRequest
+ * @param config ServletConfig
+ * @param session HttpSession
+ * @throws Exception , if failed to deactivate the tenant
+ */
+ public static void deactivateTenant(HttpServletRequest request, ServletConfig config,
+ HttpSession session) throws Exception {
+ String tenantDomain = "";
+ try {
+ tenantDomain = request.getParameter("activate.domain");
+ TenantServiceClient serviceClient = new TenantServiceClient(config, session);
+ serviceClient.deactivateTenant(tenantDomain);
+ } catch (Exception e) {
+ String msg = "Failed to deactivate the tenant:" + tenantDomain;
+ log.error(msg, e);
+ throw new Exception(msg, e);
+ }
+ }
+
+ /**
+ * This is used to avoid xss attacks
+ *
+ * @param text the text
+ * @return the text encoding '<' and '>' elements
+ */
+ public static String removeHtmlElements(String text) {
+ if (text == null) {
+ return null;
+ }
+ return text.replaceAll("<", "<").replaceAll(">", ">");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/META-INF/component.xml b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/META-INF/component.xml
new file mode 100644
index 0000000..87fc5af
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/META-INF/component.xml
@@ -0,0 +1,61 @@
+<!--
+ ~ 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>multitenancy_menu</id>
+ <i18n-key>multitenancy</i18n-key>
+ <i18n-bundle>org.wso2.carbon.tenant.mgt.ui.i18n.Resources</i18n-bundle>
+ <parent-menu>configure_menu</parent-menu>
+ <link>#</link>
+ <region>region1</region>
+ <order>60</order>
+ <style-class>home</style-class>
+ <icon>../tenant-mgt/images/multi_tenancy.png</icon>
+ <require-super-tenant>true</require-super-tenant>
+ </menu>
+ <menu>
+ <id>govern_add_tenants_menu</id>
+ <i18n-key>govern.add_tenants.menu</i18n-key>
+ <i18n-bundle>org.wso2.carbon.tenant.mgt.ui.i18n.Resources</i18n-bundle>
+ <parent-menu>multitenancy_menu</parent-menu>
+ <link>../tenant-mgt/add_tenant.jsp</link>
+ <region>region1</region>
+ <order>1</order>
+ <style-class>manage-configuration</style-class>
+ <icon>../tenant-mgt/images/services.gif</icon>
+ <require-permission>/permission/protected/manage/modify/tenants</require-permission>
+ <require-super-tenant>true</require-super-tenant>
+ </menu>
+ <menu>
+ <id>govern_view_tenants_menu</id>
+ <i18n-key>govern.view_tenants.menu</i18n-key>
+ <i18n-bundle>org.wso2.carbon.tenant.mgt.ui.i18n.Resources</i18n-bundle>
+ <parent-menu>multitenancy_menu</parent-menu>
+ <link>../tenant-mgt/view_tenants.jsp</link>
+ <region>region1</region>
+ <order>2</order>
+ <style-class>manage</style-class>
+ <icon>../tenant-mgt/images/services1.gif</icon>
+ <require-permission>/permission/protected/manage/monitor/tenants</require-permission>
+ <require-super-tenant>true</require-super-tenant>
+ </menu>
+ </menus>
+
+</component>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/org/apache/stratos/tenant/mgt/ui/i18n/JSResources.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/org/apache/stratos/tenant/mgt/ui/i18n/JSResources.properties b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/org/apache/stratos/tenant/mgt/ui/i18n/JSResources.properties
new file mode 100644
index 0000000..05d7817
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/org/apache/stratos/tenant/mgt/ui/i18n/JSResources.properties
@@ -0,0 +1,4 @@
+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.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/org/apache/stratos/tenant/mgt/ui/i18n/Resources.properties
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/org/apache/stratos/tenant/mgt/ui/i18n/Resources.properties b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/org/apache/stratos/tenant/mgt/ui/i18n/Resources.properties
new file mode 100644
index 0000000..afb8d02
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/org/apache/stratos/tenant/mgt/ui/i18n/Resources.properties
@@ -0,0 +1,56 @@
+submit.tenant=Submit Tenant
+domain=Domain
+tenant.id=Tenant ID
+activate.deactivate=Activation Status
+deactivate.account.msg=This tenant is active. You can deactivate this tenant from here.
+activate.account.msg=This tenant is inactive. You can activate this tenant from here.
+deactivate.account.btn=Deactivate
+activate.account.btn=Activate
+error.deactivating.activating.tenant=Error occurred in changing the activation status of the tenant.
+domain.information=Domain Information
+contact.details=Contact Details
+admin.username=Admin Username
+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=Register A New 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.telephone=Telephone
+admin.im=IM
+admin.url=URL
+self.registration=Registry Tenant
+gaas=GaaS
+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.
+created.date=Created Date
+enter.tenant.domain=Enter the Tenant Domain
+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
+select.package.message=According to the selected plan, resources will be allocated to you.\n You can update or downgrade your plan later \n according to your requirements.
+no.tenants.available=There are no tenants available
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/activate_tenant_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/activate_tenant_ajaxprocessor.jsp b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/activate_tenant_ajaxprocessor.jsp
new file mode 100644
index 0000000..325474b
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/activate_tenant_ajaxprocessor.jsp
@@ -0,0 +1,57 @@
+<!--
+ ~ Copyright (c) 2005-2011, 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.tenant.mgt.ui.clients.TenantServiceClient" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<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>
+
+<%--<carbon:jsi18n--%>
+ <%--resourceBundle="org.wso2.carbon.tenant.mgt.ui.i18n.JSResources"--%>
+ <%--request="<%=request%>" />--%>
+
+<div id="middle">
+<%
+ String error = "Error in updating the tenant activation status.";
+ String tenantDomain = "";
+ Boolean activated = (Boolean)session.getAttribute("isActivatedTenant");
+
+ TenantServiceClient serviceClient = new TenantServiceClient(config, session);
+
+ try {
+ tenantDomain = request.getParameter("activatingDomain");
+
+ if(activated){
+ serviceClient.deactivateTenant(tenantDomain);
+ } else if (!activated){
+ serviceClient.activateTenant(tenantDomain);
+ }
+
+ response.sendRedirect("../tenant-mgt/view_tenants.jsp");
+
+ } catch (Exception e) {
+ CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+ request.setAttribute(CarbonUIMessage.ID, uiMsg);
+ %>
+ <jsp:forward page="../admin/error.jsp"/>
+ <%
+ return;
+ }
+%>
+ </div>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/add_tenant.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/add_tenant.jsp b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/add_tenant.jsp
new file mode 100644
index 0000000..c01d47a
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/add_tenant.jsp
@@ -0,0 +1,386 @@
+<!--
+~ 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.stratos.common.util.CommonUtil" %>
+<%@ page import="org.wso2.carbon.tenant.mgt.stub.beans.xsd.TenantInfoBean" %>
+<%@ page import="org.wso2.carbon.tenant.mgt.ui.utils.TenantMgtUtil" %>
+<%@ page import="org.wso2.carbon.ui.CarbonUIMessage" %>
+<%@ page import="org.wso2.carbon.base.ServerConfiguration" %>
+<%@ 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.tenant.mgt.ui.i18n.JSResources"
+ request="<%=request%>"/>
+<%
+ String domainName = request.getParameter("domain");
+ String firstname = "";
+ String lastname = "";
+ String admin = "";
+ String usagePlan = "";
+ boolean isActive = false;
+ int tenantId = -1;
+ String error1 = "Tenant with the domain : " + domainName + " doesn't exist.";
+ boolean isUpdating = false;
+ boolean isPublicCloud = CommonUtil.isPublicCloudSetup();
+ String isCloudDeployment = ServerConfiguration.getInstance().getFirstProperty("IsCloudDeployment");
+ String email = "";
+ if (domainName != null && !domainName.equals("")) {
+ try {
+ TenantInfoBean infoBean = TenantMgtUtil.getTenant(request, config, session);
+ admin = infoBean.getAdmin();
+ tenantId = infoBean.getTenantId();
+ email = infoBean.getEmail();
+ firstname = infoBean.getFirstname();
+ lastname = infoBean.getLastname();
+ isActive = infoBean.getActive();
+ usagePlan = infoBean.getUsagePlan();
+ isUpdating = true;
+ session.setAttribute("isActivatedTenant", isActive);
+ } catch (Exception e) {
+ CarbonUIMessage uiMsg = new CarbonUIMessage(CarbonUIMessage.ERROR, e.getMessage(), e);
+ request.setAttribute(CarbonUIMessage.ID, uiMsg);
+%>
+<jsp:forward page="../admin/error.jsp"/>
+<%
+ return;
+ }
+ }
+
+ if (domainName == null) {
+ domainName = "";
+ }
+ if (firstname == null) {
+ firstname = admin;
+ }
+ if (lastname == null) {
+ lastname = "";
+ }
+%>
+
+<fmt:bundle basename="org.wso2.carbon.tenant.mgt.ui.i18n.Resources">
+<carbon:breadcrumb
+ label="govern.add_tenants.menu"
+ resourceBundle="org.wso2.carbon.tenant.mgt.ui.i18n.Resources"
+ topPage="true"
+ request="<%=request%>"/>
+<jsp:include page="../registry_common/registry_common-i18n-ajaxprocessor.jsp"/>
+<script type="text/javascript" src="../registry_common/js/registry_validation.js"></script>
+<script type="text/javascript" src="../registry_common/js/registry_common.js"></script>
+<script type="text/javascript" src="../ajax/js/prototype.js"></script>
+<script type="text/javascript" src="js/tenant_config.js"></script>
+
+<div id="middle">
+<%if (tenantId != 0) {%>
+<h2><%if (isUpdating) {%><fmt:message key="update.tenant"/>
+
+ <%} else {%> <fmt:message
+ key="register.new.organization"/><%}%></h2>
+
+<div id="workArea">
+
+<div id="activityReason" style="display: none;"></div>
+<form id="addTenantForm" action="submit_tenant_ajaxprocessor.jsp" method="post">
+ <input type="hidden" name="isUpdating" id="isUpdating" value="false">
+ <table class="styledLeft">
+ <thead>
+ <tr>
+ <th>
+ <fmt:message key="domain.information"/>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td class="nopadding">
+ <table class="normal-nopadding" cellspacing="0">
+ <tbody>
+ <tr>
+ <td><fmt:message key="domain"/>
+ <%if (!isUpdating) { %> <span class="required">*</span> <% }%>
+ </td>
+ <td colspan="2"><input
+ onchange="fillAdminValue();" <%if (isUpdating) { %>
+ readonly="true" <% }%> type="text" name="domain"
+ id="domain" style="width:400px"
+ value="<%=domainName%>"/>
+ </td>
+ </tr>
+ <%if (!isUpdating) { %>
+ <tr>
+ <td></td>
+ <td colspan="2">Use a domain for your organization,in the format
+ "example.com",This domain should be unique.
+ </td>
+ </tr>
+ <% }%>
+
+ <%if (isUpdating) { %>
+ <tr>
+ <td><fmt:message key="tenant.id"/>
+ </td>
+ <td colspan="2"><input
+ onchange="fillAdminValue();"
+ readonly="true" type="text" name="tenantId"
+ id="tenantId" style="width:400px"
+ value="<%=tenantId%>"/>
+ </td>
+ </tr>
+ <% }
+
+ %>
+
+ <tr>
+ <td colspan="3" class="middle-header"><fmt:message
+ key="usage.plan.information"/></td>
+
+ </tr>
+ <tr>
+ <td>
+ <fmt:message key="select.usage.plan.for.tenant"/><span
+ class="required">*</span>
+ </td>
+ <td>
+ <select name="usage-plan-name" id="usage-plan-name">
+ </select>
+ <%
+ if (!CommonUtil.getStratosConfig().getUsagePlanURL().equals("")) {
+ %>
+ <a href=<%=CommonUtil.getStratosConfig().getUsagePlanURL()%>
+ target=<%=CommonUtil.getStratosConfig().getUsagePlanURL()%>>
+ <b>More info</b></a>
+ <% } %>
+ </td>
+ <td>
+ <% if (usagePlan.length() > 2) {
+ %>
+ Your Current Usage Plan is : <%=usagePlan%>
+ <%}%>
+ </td>
+ <tr>
+ <td></td>
+ <td colspan="2"><fmt:message key="select.package.message"/>
+ </td>
+ </tr>
+
+
+ <tr>
+ <td colspan="3" class="middle-header"><fmt:message
+ key="tenant.admin"/></td>
+ </tr>
+ <tr>
+ <td><fmt:message key="admin.firstname"/><span
+ class="required">*</span></td>
+ <td colspan="2"><input type="text" name="admin-firstname"
+ id="admin-firstname" style="width:400px"
+ value="<%=firstname%>"/></td>
+ </tr>
+ <tr>
+ <td><fmt:message key="admin.lastname"/><span
+ class="required">*</span></td>
+ <td colspan="2"><input type="text" name="admin-lastname"
+ id="admin-lastname" style="width:400px"
+ value="<%=lastname%>"/></td>
+ </tr>
+
+
+ <tr>
+ <td><fmt:message key="admin.username"/>
+ <%if (!isUpdating) { %>
+ <span class="required">*</span></td>
+ <%}%>
+ <td colspan="2"><input <%if (isUpdating) {%>
+ readonly="true" <%}%> type="text" name="admin"
+ id="admin" style="width:400px" value="<%=admin%>"
+ onchange="isDomainNameAvailable();"/><span
+ id="adminValue"></span></td>
+ </tr>
+
+ <tr>
+ <td><%if (isUpdating) {%><fmt:message
+ key="new.admin.password"/><%} else {%><fmt:message
+ key="admin.password"/><%}%>
+ <%if (!isUpdating) {%><span class="required">*</span></td>
+ <%}%>
+ <td colspan="2"><input type="password" name="admin-password"
+ id="admin-password" style="width:400px"/>
+ </td>
+ </tr>
+ <tr>
+ <td><%if (isUpdating) {%><fmt:message
+ key="new.admin.password.repeat"/><%} else {%><fmt:message
+ key="admin.password.repeat"/><%}%>
+ <%if (!isUpdating) {%><span class="required">*</span></td>
+ <%}%>
+ <td colspan="2"><input type="password"
+ name="admin-password-repeat"
+ id="admin-password-repeat"
+ style="width:400px"/></td>
+ </tr>
+ <tr>
+ <td colspan="3" class="middle-header"><fmt:message
+ key="contact.details"/></td>
+ </tr>
+ <tr>
+ <td><fmt:message key="admin.email"/><span
+ class="required">*</span></td>
+ <td colspan="2"><input type="text" name="admin-email"
+ id="admin-email" style="width:400px"
+ value="<%=email%>"/></td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+ <tr id="buttonRow">
+ <td class="buttonRow">
+ <input class="button" type="button"
+ <% if (isUpdating) { %> value="Update" <% } else { %>
+ value="Save" <% }%>
+ onclick="addTenant(<%=isUpdating?"true":"false"%>, <%=isPublicCloud?"true":"false"%>)"/>
+ </td>
+ </tr>
+ <tr id="waitMessage" style="display:none">
+ <td>
+ <div style="font-size:13px !important;margin-top:10px;margin-bottom:10px;">
+ <img
+ src="images/ajax-loader.gif" align="left" hspace="20"/>Please
+ wait until the Service is
+ importing to the Registry...
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <%
+ // the tenantId field appears only for an update of existing tenant
+ if (isUpdating) {
+ %>
+ <input name="tenantId" type="hidden" value="<%=tenantId%>"/>
+ <%
+ }
+ %>
+ <%} else {%>
+ <tr>
+ <th>
+ <%=error1 %>
+ </th>
+ </tr>
+ <%}%>
+</form>
+
+<form id="activateTenantForm" action="activate_tenant_ajaxprocessor.jsp" method="post">
+ <%if ((isUpdating) && (tenantId > 0)) {%>
+ <table class="styledLeft">
+ <thead>
+ <tr>
+ <th>
+ <fmt:message key="activate.deactivate"/>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+
+ <% if (isActive) { %>
+ <tr>
+ <td colspan="3"><fmt:message key="deactivate.account.msg"/></td>
+ </tr>
+ <% } else {%>
+ <tr>
+ <td colspan="3"><fmt:message key="activate.account.msg"/></td>
+ </tr>
+ <% }%>
+
+ <tr id="buttonRow2">
+ <td class="buttonRow">
+ <input class="button" type="button" name="activateButton" id="activateButton"
+ onclick="return activateDeactivate('<%=domainName%>','<%=isActive%>');"
+ <% if (isActive) { %> value="<fmt:message key="deactivate.account.btn"/>"
+ <% } else { %> value="<fmt:message key="activate.account.btn"/>" <% } %>/>
+ </td>
+
+ <input type="hidden" name="activatingDomain" id="activatingDomain" value="<%=domainName%>"/>
+
+ </tr>
+ </tbody>
+ </table>
+ <%
+ }
+ %>
+</form>
+
+<br/>
+<script type="text/javascript">refreshFillAdminValue()</script>
+
+</div>
+</div>
+</fmt:bundle>
+<script type="text/javascript">
+ var packageInfo;
+ jQuery(document).ready(
+ function() {
+ jQuery.ajax({
+ type: 'POST',
+ url: 'get_package_info_ajaxprocessor.jsp',
+ dataType: 'json',
+ data: 'plan=0',
+ async: false,
+ success: function(data) {
+ packageInfo = data;
+ },
+ error:function (xhr, ajaxOptions, thrownError) {
+ CARBON.showErrorDialog('Could not get package information.');
+ }
+ });
+
+ var charge;
+ var name;
+ var isCloud = <%= isCloudDeployment %>;
+
+ if (!isCloud) {
+ String
+ demoOption = "Demo"
+ option = document.createElement("option");
+ option.value = demoOption;
+ option.selected = demoOption;
+ option.innerHTML = demoOption;
+ document.getElementById('usage-plan-name').appendChild(option);
+
+ } else {
+ for (var i = 0; i < packageInfo.length; i++) {
+ charge = packageInfo[i].subscriptionCharge;
+ name = packageInfo[i].name;
+ if (name == '<%=usagePlan%>') {
+ option = document.createElement("option");
+ option.value = name;
+ option.selected = name;
+ option.innerHTML = name;
+ document.getElementById('usage-plan-name').appendChild(option);
+
+ }
+ else {
+ option = document.createElement("option");
+ option.value = name;
+ option.innerHTML = name
+ document.getElementById('usage-plan-name').appendChild(option);
+ }
+ }
+ }
+ }
+ );
+</script>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/check_domain_availability_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/check_domain_availability_ajaxprocessor.jsp b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/check_domain_availability_ajaxprocessor.jsp
new file mode 100644
index 0000000..284f212
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/check_domain_availability_ajaxprocessor.jsp
@@ -0,0 +1,19 @@
+<%@ page import="org.apache.axis2.AxisFault" %>
+<%@ page import="org.wso2.carbon.stratos.common.util.CommonUtil" %>
+<%@ page import="org.json.JSONException" %>
+<%@ page import="org.json.JSONObject" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+ String tenantDomain = request.getParameter("domain");
+ boolean isDomainAvailable = CommonUtil.isDomainNameAvailable(tenantDomain);
+ JSONObject jsonObject = new JSONObject();
+
+ if (isDomainAvailable) {
+ jsonObject.put("available", "true");
+
+ } else {
+ jsonObject.put("available", "false");
+ }
+ out.println(jsonObject);
+
+%>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/css/tenant.css
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/css/tenant.css b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/css/tenant.css
new file mode 100644
index 0000000..26d0e28
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/css/tenant.css
@@ -0,0 +1,62 @@
+/*css editor styles */
+.csseditor-top-line{
+ background-color:black;
+ height:5px;
+}
+.csseditor-leftbox{
+ background-color:#9a9a9a;
+ padding-left:5px;
+ padding-right:5px;
+ padding-bottom:5px;
+ padding-top:15px;
+ height:380px;
+}
+.csseditor-leftbox-top{
+ color:#ffffff;
+ font-size:18px;
+ height:30px;
+}
+.csseditor-textbox{
+ background-color:#dfe7ed;
+ border:solid 1px #ffffff;
+ width:100%;
+}
+.csseditor-rightbox{
+ background-color:#c9c9c9;
+ border:solid 1px #ffffff;
+ height:400px;
+}
+.csseditor-rightbox-title{
+ background-color:#9a9a9a;
+ height:25px;
+ color:#ffffff;
+ padding-left:10px;
+ padding-top:5px;
+}
+.csseditor-searchbox{
+ padding-left:10px;
+ padding-top:10px;
+}
+#flickr_results{
+ height:300px;
+ overflow-y:auto;
+ overflow-x:hidden;
+ margin-left:5px;
+ margin-right:5px;
+ border:solid 1px #ffffff;
+}
+.imageList{
+}
+.imageList li {
+ padding-top: 3px !important;
+ padding-left: 5px !important;
+ background-color: #e1e9ec;
+ border: solid 1px #b5bdc1;
+}
+
+.imageList li a {
+ background-image: url(../images/images.gif);
+ background-repeat: no-repeat;
+ padding-left: 20px;
+ text-indent: 50px;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/aboutUsagePlans.html
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/aboutUsagePlans.html b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/aboutUsagePlans.html
new file mode 100644
index 0000000..791b867
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/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/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/images/add-org.png
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/images/add-org.png b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/images/add-org.png
new file mode 100644
index 0000000..fc710f8
Binary files /dev/null and b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/images/add-org.png differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/images/add-tenant.png
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/images/add-tenant.png b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/images/add-tenant.png
new file mode 100644
index 0000000..7fbb894
Binary files /dev/null and b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/images/add-tenant.png differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/images/view-tenants.png
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/images/view-tenants.png b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/images/view-tenants.png
new file mode 100644
index 0000000..03c4e83
Binary files /dev/null and b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/images/view-tenants.png differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/userguide.html
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/userguide.html b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/userguide.html
new file mode 100644
index 0000000..cd666b3
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/docs/userguide.html
@@ -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.
+ -->
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+ <title>Multitenancy Registry Tenant Configuration - User Guide</title>
+ <link href="../../admin/css/documentation.css" rel="stylesheet" type="text/css" media="all" />
+</head>
+
+<body>
+
+
+ <h1>Multitenancy Add new Tenants and View Tenants</h1>
+
+
+ <h2> <b> Add New Tenants</b></h2>
+
+<p>
+ Following form can be used to add new tenants.You are required to fill all the requested details.
+ <img src="images/add-tenant.png" alt="Add new tenant form"/>
+ <div><strong>Figure1: Add New Tenants Form</strong></div>
+
+
+</p>
+
+
+<h2><b>Multitenancy View Tenants</b></h2>
+
+
+<p>
+
+ You can view a list of available tenants from this page.
+
+<img src="images/view-tenants.png" alt="Register New Organization Form"/>
+<div><strong>Figure2: View tenants Form</strong></div>
+</p>
+
+
+</body>
+
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/get_package_info_ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/get_package_info_ajaxprocessor.jsp b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/get_package_info_ajaxprocessor.jsp
new file mode 100644
index 0000000..0543235
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/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.tenant.mgt.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/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/images/multi_tenancy.png
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/images/multi_tenancy.png b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/images/multi_tenancy.png
new file mode 100644
index 0000000..9e186e2
Binary files /dev/null and b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/images/multi_tenancy.png differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/images/services.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/images/services.gif b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/images/services.gif
new file mode 100755
index 0000000..9883116
Binary files /dev/null and b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/images/services.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/images/services1.gif
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/images/services1.gif b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/images/services1.gif
new file mode 100644
index 0000000..d40a7a3
Binary files /dev/null and b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/images/services1.gif differ
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/js/tenant_config.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/js/tenant_config.js b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/js/tenant_config.js
new file mode 100644
index 0000000..d00a81f
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/js/tenant_config.js
@@ -0,0 +1,218 @@
+function addTenant(isUpdating, isPublicCloud) {
+
+ var reason = "";
+ var addTenantForm = document.getElementById('addTenantForm');
+ var adminPassword = document.getElementById('admin-password');
+ var adminPasswordRepeat = document.getElementById('admin-password-repeat');
+ var email = document.getElementById('admin-email');
+ var firstname = document.getElementById('admin-firstname');
+ var lastname = document.getElementById('admin-lastname');
+
+ if (isUpdating) {
+
+ // only the given values will be updated, so no need to fill all the values.
+ 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 (adminPassword.value != null && adminPassword.value != "") {
+ if (adminPassword.value != adminPasswordRepeat.value) {
+ reason += jsi18n["password.mismatched"];
+ }
+ }
+ }
+ else {
+ var domain = document.getElementById('domain');
+ var adminName = document.getElementById('admin');
+
+ if (reason == "") {
+ reason += validateEmpty(domain, "Domain");
+ }
+ if (reason == "") {
+ reason += validateDomain(domain, isPublicCloud);
+ }
+
+ if (reason == "") {
+ reason +=domainAvailability(domain);
+ }
+
+ 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 Name");
+ }
+ if (reason == "") {
+ reason += validateIllegal(adminName, "Admin Name");
+ }
+ if (reason == "") {
+ reason += validateUsername(adminName);
+ }
+ if (reason == "") {
+ reason += validateEmpty(adminPassword, "AdminPassword");
+ }
+ if (reason == "") {
+ reason += validateEmpty(adminPasswordRepeat, "AdminPasswordRepeat");
+ }
+ 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.showErrorDialog(reason);
+ return;
+ }
+ document.getElementById("isUpdating").value=isUpdating;
+ addTenantForm.submit();
+}
+function showSuccessRegisterMessage() {
+ var message = "You have registered the Organization Successfully";
+ CARBON.showInfoDialog(message);
+ return;
+}
+function showSuccessUpdateMessage() {
+ var message = "Your changes saved Successfully!";
+ CARBON.showInfoDialog(message);
+ return;
+}
+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 = $('adminValue');
+ var domain = $('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 refreshFillAdminValue() {
+ //Call this method at loading time
+ fillAdminValue();
+}
+
+function validateDomain(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;
+}
+
+function domainSelected() {
+ var findDomainForm = document.getElementById('findTenantForm');
+ findDomainForm.submit();
+}
+
+
+function domainAvailability(domain) {
+ var error = "";
+ jQuery.ajax({
+ type: 'POST',
+ url: 'check_domain_availability_ajaxprocessor.jsp?',
+ dataType: 'json',
+ data: 'domain=' + domain.value,
+ success: function(result) {
+ var available = result.available;
+ if (available == 'false') {
+ error = "Sorry!. The Domain is already registered. Please choose a different domain.";
+ return error;
+ }else{
+ error ="";
+ }
+
+ },
+ error:function (xhr, ajaxOptions, thrownError) {
+ error = "Error in checking domain availability";
+
+ },
+ async: false
+ });
+
+ return error;
+}
+
+function activateDeactivate(domain, isActive) {
+ if (isActive == 'true') {
+ CARBON.showConfirmationDialog("Are you sure you want to deactivate the domain: " +
+ domain + "?", function() {
+ var submitForm = document.getElementById("activateTenantForm");
+ submitForm.submit();
+ }, function() {
+ });
+ } else {
+ var submitForm = document.getElementById("activateTenantForm");
+ submitForm.submit();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/edd9c596/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/js/theme_resource_util.js
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/js/theme_resource_util.js b/components/org.apache.stratos.tenant.mgt.ui/src/main/resources/web/tenant-mgt/js/theme_resource_util.js
new file mode 100644
index 0000000..e69de29