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/10 08:36:58 UTC

[2/3] committing refactored tenant activity component

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/util/TenantActivityUtil.java
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/util/TenantActivityUtil.java b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/util/TenantActivityUtil.java
deleted file mode 100644
index 7c39cf6..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/util/TenantActivityUtil.java
+++ /dev/null
@@ -1,79 +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.
- *
- */
-package org.wso2.carbon.tenant.activity.util;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.clustering.ClusteringAgent;
-import org.apache.axis2.clustering.ClusteringCommand;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.tenant.activity.beans.TenantDataBean;
-import org.wso2.carbon.tenant.activity.commands.GetActiveTenantsInMemberRequest;
-import org.wso2.carbon.tenant.activity.commands.GetActiveTenantsInMemberResponse;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-public class TenantActivityUtil {
-    private static final Log log = LogFactory.getLog(TenantActivityUtil.class);
-
-    public static List<TenantDataBean> getActiveTenantsInCluster() throws AxisFault {
-        List<TenantDataBean> tenants = new ArrayList<TenantDataBean>();
-        try {
-            ClusteringAgent agent = getClusteringAgent();
-            List<ClusteringCommand> list = agent.sendMessage(new GetActiveTenantsInMemberRequest(), true);
-            if (log.isDebugEnabled()) {
-                log.debug("sent cluster command to to get Active tenants on cluster");
-            }
-            for (ClusteringCommand command : list) {
-                if (command instanceof GetActiveTenantsInMemberResponse) {
-                    GetActiveTenantsInMemberResponse response = (GetActiveTenantsInMemberResponse) command;
-                    for (TenantDataBean tenant : response.getTenants()) {
-                        tenants.add(tenant);
-                    }
-                }
-            }
-
-        } catch (AxisFault f) {
-            String msg = "Error in getting active tenant by cluster commands";
-            log.error(msg, f);
-            throw new AxisFault(msg);
-        }
-        return tenants;
-    }
-
-
-    private static ClusteringAgent getClusteringAgent() throws AxisFault {
-
-        AxisConfiguration axisConfig =
-                Util.getConfigurationContextService().getServerConfigContext().getAxisConfiguration();
-        return axisConfig.getClusteringAgent();
-    }
-
-    public static int indexOfTenantInList(List<TenantDataBean> list, TenantDataBean tenant) {
-        for (int i = 0; i < list.size(); i++) {
-            if (tenant.getDomain().equalsIgnoreCase(list.get(i).getDomain())) {
-                return i;
-            }
-        }
-        return -1;
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/util/Util.java
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/util/Util.java b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/util/Util.java
deleted file mode 100644
index 1a9e70c..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/util/Util.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *  Copyright (c) 2005-2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- *  WSO2 Inc. licenses this file to you under the Apache License,
- *  Version 2.0 (the "License"); you may not use this file except
- *  in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- */
-package org.wso2.carbon.tenant.activity.util;
-
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.framework.BundleContext;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.registry.core.service.RegistryService;
-import org.wso2.carbon.registry.core.session.UserRegistry;
-import org.wso2.carbon.tenant.activity.beans.TenantDataBean;
-import org.wso2.carbon.user.core.UserRealm;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.utils.ConfigurationContextService;
-
-import java.util.List;
-
-/**
- * Util methods for usage.
- */
-public class Util {
-
-    private static final Log log = LogFactory.getLog(Util.class);
-
-    private static RegistryService registryService;
-    private static RealmService realmService;
-    private static ConfigurationContextService configurationContextService;
-
-    public static synchronized void setRegistryService(RegistryService service) {
-        registryService = service;
-    }
-
-    public static void setConfigurationContextService(
-            ConfigurationContextService configurationContextService) {
-        Util.configurationContextService = configurationContextService;
-    }
-
-    public static ConfigurationContextService getConfigurationContextService() {
-        return configurationContextService;
-    }
-
-    public static synchronized void setRealmService(RealmService service) {
-        realmService = service;
-    }
-
-    public static RealmService getRealmService() {
-        return realmService;
-    }
-
-    public static RegistryService getRegistryService() {
-        return registryService;
-    }
-
-    public static UserRealm getUserRealm(int tenantId) throws RegistryException {
-        return registryService.getUserRealm(tenantId);
-    }
-
-    public static UserRegistry getSuperTenantGovernanceSystemRegistry() throws RegistryException {
-        return registryService.getGovernanceSystemRegistry();
-    }
-
-    public static void registerRetrieverServices(BundleContext bundleContext) throws Exception {
-        ConfigurationContextService configCtxSvc = Util.getConfigurationContextService();
-
-
-    }
-
-}

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

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/resources/META-INF/services.xml
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/resources/META-INF/services.xml b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/resources/META-INF/services.xml
deleted file mode 100644
index 2bb4f7b..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/resources/META-INF/services.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- !
- ! Copyright 2006 The Apache Software Foundation.
- !
- ! Licensed under the Apache License, Version 2.0 (the "License");
- ! you may not use this file except in compliance with the License.
- ! You may obtain a copy of the License at
- !
- !      http://www.apache.org/licenses/LICENSE-2.0
- !
- ! Unless required by applicable law or agreed to in writing, software
- ! distributed under the License is distributed on an "AS IS" BASIS,
- ! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ! See the License for the specific language governing permissions and
- ! limitations under the License.
- !-->
-<serviceGroup>
-
-    <service name="TenantActivityService" scope="transportsession">
-        <transports>
-            <transport>https</transport>
-        </transports>
-        <parameter name="ServiceClass" locked="false">
-            org.wso2.carbon.tenant.activity.services.TenantActivityService
-        </parameter>
-        <operation name="getActiveTenantCount">
-            <parameter name="superTenantService" locked="true">true</parameter>
-            <parameter name="AuthorizationAction" locked="true">/permission/protected/monitor/tenantActivity</parameter>
-        </operation>
-        <operation name="retrievePaginatedActiveTenants">
-            <parameter name="superTenantService" locked="true">true</parameter>
-            <parameter name="AuthorizationAction" locked="true">/permission/protected/monitor/tenantActivity</parameter>
-        </operation>
-        <operation name="isActiveTenantOnService">
-            <parameter name="superTenantService" locked="true">true</parameter>
-            <parameter name="AuthorizationAction" locked="true">/permission/protected/monitor/tenantActivity</parameter>
-        </operation>
-    </service>
-    <parameter name="adminService" locked="true">true</parameter>
-    <parameter name="hiddenService" locked="true">true</parameter>
-</serviceGroup>

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

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/pom.xml
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/pom.xml b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/pom.xml
new file mode 100644
index 0000000..93fb63d
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/pom.xml
@@ -0,0 +1,142 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+# Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.stratos</groupId>
+        <artifactId>tenant.activity.parent</artifactId>
+        <version>3.0.0</version>
+	<relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.stratos.tenant.activity.ui</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Stratos - Tenant Activity - User Interface</name>
+
+    <build>
+
+        <plugins>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.5</source>
+                    <target>1.5</target>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>1.4.0</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+                        <Bundle-Name>${project.artifactId}</Bundle-Name>
+                        <Private-Package>
+                            org.wso2.carbon.tenant.activity.ui.internal.*,
+                        </Private-Package>
+                        <Export-Package>
+                            org.wso2.carbon.tenant.activity.ui.*,
+                        </Export-Package>
+                        <Import-Package>
+			                org.wso2.carbon.tenant.activity.stub.*; version="${carbon.platform.package.import.version.range}",
+                            org.apache.stratos.common.*,
+                            javax.servlet;version="${imp.pkg.version.javax.servlet}",
+                            javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
+                            !javax.xml.namespace,
+                            javax.xml.namespace; version=0.0.0,                            
+                            org.apache.lucene.*,
+                            *;resolution:=optional
+                        </Import-Package>
+                        <Carbon-Component>UIBundle</Carbon-Component>
+                    </instructions>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+        </dependency>
+	    <dependency>
+            <groupId>commons-codec.wso2</groupId>
+            <artifactId>commons-codec</artifactId>
+	    <version>${version.commons.codec}</version>
+        </dependency>
+        <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>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+        </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>${orbit.version.axiom}</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.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.common</artifactId>
+	    <version>2.1.2</version>
+        </dependency>
+	    <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.tenant.activity.stub</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+    </dependencies>
+    
+    <properties>
+	<version.commons.codec>1.4.0.wso2v1</version.commons.codec>
+    </properties>
+    
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/clients/TenantActivityServiceClient.java
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/clients/TenantActivityServiceClient.java b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/clients/TenantActivityServiceClient.java
new file mode 100644
index 0000000..a7f3674
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/clients/TenantActivityServiceClient.java
@@ -0,0 +1,155 @@
+/*
+*  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.activity.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.authenticator.proxy.AuthenticationAdminClient;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.wso2.carbon.tenant.activity.stub.TenantActivityServiceExceptionException;
+import org.wso2.carbon.tenant.activity.stub.beans.xsd.*;
+import org.apache.stratos.tenant.activity.ui.internal.TenantActivityUIServiceComponent;
+import org.wso2.carbon.ui.CarbonUIUtil;
+import org.wso2.carbon.user.core.UserStoreException;
+import org.wso2.carbon.utils.ServerConstants;
+import org.wso2.carbon.tenant.activity.stub.TenantActivityServiceStub;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.http.HttpSession;
+import java.rmi.RemoteException;
+
+public class TenantActivityServiceClient {
+    private static final Log log = LogFactory.getLog(TenantActivityServiceClient.class);
+
+    private TenantActivityServiceStub stub;
+    private String epr;
+
+
+    public TenantActivityServiceClient(
+            String cookie, String backendServerURL, ConfigurationContext configContext)
+            throws RegistryException {
+
+        epr = backendServerURL + "TenantMonitorService";
+
+        try {
+            stub = new TenantActivityServiceStub(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 TenantMonitorService service client. " + axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+    public TenantActivityServiceClient(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 + "TenantActivityService";
+
+        try {
+            stub = new TenantActivityServiceStub(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 TenantMonitorService service client. " + axisFault.getMessage();
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+    public TenantActivityServiceClient(String url, ServletConfig config, HttpSession session)
+            throws Exception {
+        //String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
+        ConfigurationContext configContext = (ConfigurationContext) config.
+                getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
+        try {
+            String cookie = login(url + "/services/", 
+                    TenantActivityUIServiceComponent.stratosConfiguration.getAdminUserName(),
+                    TenantActivityUIServiceComponent.stratosConfiguration.getAdminPassword(), 
+                    configContext);
+            epr = url + "/services/TenantActivityService";
+            stub = new TenantActivityServiceStub(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 TenantMonitorService service client. ";
+            log.error(msg, axisFault);
+            throw new RegistryException(msg, axisFault);
+        }
+    }
+
+
+    public int getActiveTenantCount() throws TenantActivityServiceExceptionException, RemoteException {
+        int count = stub.getActiveTenantCount();
+        return count;
+    }
+
+    /*public String[] getActiveTenantList() throws TenantActivityServiceExceptionException, RemoteException {
+        return stub.getActiveTenantList();
+    } */
+
+    public PaginatedTenantDataBean getPaginatedActiveTenantList(int pageNumber) throws TenantActivityServiceExceptionException, RemoteException {
+        return stub.retrievePaginatedActiveTenants(pageNumber);
+    }
+
+    /*  public TenantDataBean[] getAllActiveTenantList() throws TenantActivityServiceExceptionException, RemoteException {
+        return stub.getAllActiveTenantList();
+    }*/
+
+    public boolean isTenantActiveInService(String domainName) throws TenantActivityServiceExceptionException, RemoteException {
+        return stub.isActiveTenantOnService(domainName);
+    }
+    
+    private String login(String serverUrl, String userName, 
+                               String password, ConfigurationContext confContext) throws UserStoreException {
+        String sessionCookie = null;
+        try {
+            AuthenticationAdminClient client =
+                    new AuthenticationAdminClient(confContext, serverUrl, null, null, false);
+            //TODO : get the correct IP
+            boolean isLogin = client.login(userName, password, "127.0.0.1");
+            if (isLogin) {
+                sessionCookie = client.getAdminCookie();
+            }
+        } catch (Exception e) {
+            throw new UserStoreException("Error in login to the server server: " + serverUrl +
+                                         "username: " + userName + ".", e);
+        }
+        return sessionCookie;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/internal/TenantActivityUIServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/internal/TenantActivityUIServiceComponent.java b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/internal/TenantActivityUIServiceComponent.java
new file mode 100644
index 0000000..d8c8eea
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/internal/TenantActivityUIServiceComponent.java
@@ -0,0 +1,55 @@
+package org.apache.stratos.tenant.activity.ui.internal;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.service.component.ComponentContext;
+import org.apache.stratos.common.util.StratosConfiguration;
+import org.wso2.carbon.utils.ConfigurationContextService;
+
+/**
+ * @scr.component name="org.wso2.stratos.tenant.activity.ui" immediate="true"
+ * @scr.reference name="config.context.service"
+ * interface="org.wso2.stratos.utils.ConfigurationContextService"
+ * cardinality="1..1" policy="dynamic"  bind="setConfigurationContextService"
+ * unbind="unsetConfigurationContextService"
+ * @scr.reference name="stratos.config.service"
+ * interface="org.wso2.stratos.stratos.common.util.StratosConfiguration" cardinality="1..1"
+ * policy="dynamic" bind="setStratosConfigurationService" unbind="unsetStratosConfigurationService"
+ */
+public class TenantActivityUIServiceComponent {
+    private static Log log = LogFactory.getLog(TenantActivityUIServiceComponent.class);
+    public static ConfigurationContextService contextService;
+    public static StratosConfiguration stratosConfiguration;
+
+    protected void activate(ComponentContext context) {
+        try {
+            if (log.isDebugEnabled()) {
+                log.error("******* Tenant Activity UI bundle is activated ******* ");
+            }
+        } catch (Throwable e) {
+            log.error("******* Error in activating Tenant Activity UI bundle ******* ", e);
+        }
+    }
+
+    protected void deactivate(ComponentContext context) {
+        if (log.isDebugEnabled()) {
+            log.debug("******* Tenant Activity UI bundle is deactivated ******* ");
+        }
+    }
+
+    protected void setStratosConfigurationService(StratosConfiguration stratosConfigService) {
+        TenantActivityUIServiceComponent.stratosConfiguration = stratosConfigService;
+    }
+
+    protected void unsetStratosConfigurationService(StratosConfiguration ccService) {
+        TenantActivityUIServiceComponent.stratosConfiguration = null;
+    }
+
+    protected void setConfigurationContextService(ConfigurationContextService contextService) {
+        TenantActivityUIServiceComponent.contextService = contextService;
+    }
+
+    protected void unsetConfigurationContextService(ConfigurationContextService contextService) {
+        TenantActivityUIServiceComponent.contextService = null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/ManagerConfigurations.java
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/ManagerConfigurations.java b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/ManagerConfigurations.java
new file mode 100644
index 0000000..294cb15
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/ManagerConfigurations.java
@@ -0,0 +1,147 @@
+/*
+*  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.activity.ui.utils;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.constants.StratosConstants;
+import org.apache.stratos.common.util.CommonUtil;
+import org.wso2.carbon.utils.CarbonUtils;
+
+import javax.xml.namespace.QName;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+
+public class ManagerConfigurations {
+
+    private static final String CONFIG_FILE = "throttling-agent-config.xml";
+
+    private static final String MANAGER_SERVICE_URL_PARAM_NAME = "managerServiceUrl";
+    private static final String USERNAME_PARAM_NAME = "userName";
+    private static final String PASSWORD_PARAM_NAME = "password";
+
+
+    private String managerServerUrl;
+    private String userName;
+    private String password;
+
+    private final static Log log = LogFactory.getLog(ManagerConfigurations.class);
+
+    private static final String CONFIG_NS =
+            "http://wso2.com/stratos/multitenancy/throttling/agent/config";
+    private static final String PARAMTERS_ELEMENT_NAME = "parameters";
+    private static final String PARAMTER_ELEMENT_NAME = "parameter";
+    private static final String PARAMTER_NAME_ATTR_NAME = "name";
+    private Map<String, String> parameters = new HashMap<String, String>();
+
+
+
+
+    public String getConfigFileName() throws Exception {
+
+        String configFileName = CarbonUtils.getCarbonConfigDirPath() +
+                File.separator + StratosConstants.MULTITENANCY_CONFIG_FOLDER +
+                File.separator + CONFIG_FILE;
+
+        return configFileName;
+
+    }
+
+
+    public ManagerConfigurations() throws Exception {
+
+        String throttlingAgentConfigFile = this.getConfigFileName();
+        try {
+            OMElement meteringConfig =
+                    CommonUtil.buildOMElement(new FileInputStream(throttlingAgentConfigFile));
+            deSerialize(meteringConfig);
+            Map<String, String> throttlingAgentParams = getParameters();
+            this.setUserName(throttlingAgentParams.get(USERNAME_PARAM_NAME));
+            this.setPassword(throttlingAgentParams.get(PASSWORD_PARAM_NAME));
+            this.setManagerServerUrl(throttlingAgentParams.get(MANAGER_SERVICE_URL_PARAM_NAME));
+        } catch (FileNotFoundException e) {
+            String msg = "Unable to find the file: " + throttlingAgentConfigFile + ".";
+            log.error(msg, e);
+        }
+    }
+
+    public void deSerialize(OMElement throttlingConfigEle) throws Exception {
+        Iterator meteringConfigChildIt = throttlingConfigEle.getChildElements();
+        while (meteringConfigChildIt.hasNext()) {
+            Object meteringConfigChild = meteringConfigChildIt.next();
+            if (!(meteringConfigChild instanceof OMElement)) {
+                continue;
+            }
+            OMElement meteringConfigChildEle = (OMElement) meteringConfigChild;
+            if (new QName(CONFIG_NS, PARAMTERS_ELEMENT_NAME, "").equals(meteringConfigChildEle
+                    .getQName())) {
+                Iterator parametersChildIt = meteringConfigChildEle.getChildElements();
+                while (parametersChildIt.hasNext()) {
+                    Object taskConfigChild = parametersChildIt.next();
+                    if (!(taskConfigChild instanceof OMElement)) {
+                        continue;
+                    }
+                    OMElement parameterChildEle = (OMElement) taskConfigChild;
+                    if (!new QName(CONFIG_NS, PARAMTER_ELEMENT_NAME, "").equals(parameterChildEle
+                            .getQName())) {
+                        continue;
+                    }
+                    String parameterName =
+                            parameterChildEle.getAttributeValue(new QName(PARAMTER_NAME_ATTR_NAME));
+                    String parameterValue = parameterChildEle.getText();
+                    parameters.put(parameterName, parameterValue);
+                }
+            }
+        }
+    }
+
+    public Map<String, String> getParameters() {
+        return parameters;
+    }
+
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getManagerServerUrl() {
+        return managerServerUrl;
+    }
+
+    public void setManagerServerUrl(String managerServerUrl) {
+        this.managerServerUrl = managerServerUrl;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/TenantMonitorUtil.java
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/TenantMonitorUtil.java b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/TenantMonitorUtil.java
new file mode 100644
index 0000000..54d9c83
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/java/org/apache/stratos/tenant/activity/ui/utils/TenantMonitorUtil.java
@@ -0,0 +1,143 @@
+/*
+ *  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.activity.ui.utils;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.config.CloudServiceConfig;
+import org.apache.stratos.common.config.CloudServiceConfigParser;
+import org.apache.stratos.common.config.CloudServicesDescConfig;
+
+import java.util.*;
+
+import org.wso2.carbon.tenant.activity.stub.beans.xsd.PaginatedTenantDataBean;
+import org.wso2.carbon.tenant.activity.stub.beans.xsd.TenantDataBean;
+
+public class TenantMonitorUtil {
+    private static final Log log = LogFactory.getLog(TenantMonitorUtil.class);
+
+    public static Map<String, String[]> tenantList = new HashMap<String, String[]>();
+    public static Map<String, TenantDataBean[]> tenantDataList = new HashMap<String, TenantDataBean[]>();
+
+
+    private static ManagerConfigurations managerConfig = null;
+
+
+    public static ManagerConfigurations getManagerConfig() {
+        return managerConfig;
+    }
+
+    public static void setManagerConfig(ManagerConfigurations managerConfig) {
+        TenantMonitorUtil.managerConfig = managerConfig;
+    }
+
+  /*  public static Map<String, Integer> getActiveTenantCount(ServletConfig config, HttpSession session) throws Exception {
+        Map<String, Integer> map = new HashMap<String, Integer>();
+        try {
+            CloudServicesDescConfig cloudServicesDescConfig = CloudServiceConfigParser.loadCloudServicesConfiguration();
+
+            Map<String, CloudServiceConfig> cloudServicesConfigs = cloudServicesDescConfig.getCloudServiceConfigs();
+            for (String serviceName : cloudServicesConfigs.keySet()) {
+                String backEndURL = cloudServicesConfigs.get(serviceName).getLink();
+                System.out.println(backEndURL);
+                if (backEndURL == null) {
+                    try {
+                        TenantActivityServiceClient client = new TenantActivityServiceClient(config, session);
+                        map.put(serviceName, client.getActiveTenantCount());
+                        for (String nn : client.getActiveTenantList()) {
+                            System.out.println(nn);
+                        }
+                    } catch (Exception e) {
+                        log.error("Failed to get active tenants for manager service");
+                    }
+
+                } else {
+                    try {
+                        TenantActivityServiceClient client = new TenantActivityServiceClient(backEndURL, config, session);
+                        map.put(serviceName, client.getActiveTenantCount());
+                    } catch (Exception e) {
+                        log.error("failed to get Active tenants for" + serviceName + e.toString());
+                    }
+                }
+
+            }
+        } catch (Exception e) {
+            log.error("Error while retrieving cloud desc configuration");
+
+        }
+        return map;
+    }*/
+
+    public static Map<String, CloudServiceConfig> getCloudServiceConfigMap() {
+        try {
+            CloudServicesDescConfig cloudServicesDescConfig = CloudServiceConfigParser.loadCloudServicesConfiguration();
+            return cloudServicesDescConfig.getCloudServiceConfigs();
+        } catch (Exception e) {
+            log.error("Error while getting service names " + e.toString());
+        }
+        return null;
+    }
+
+    public static PaginatedTenantDataBean getPaginatedTenantData(int pageNumber, String serviceName) {
+        int entriesPerPage = 15;
+        List<TenantDataBean> tenantListOnService = Arrays.asList(tenantDataList.get(serviceName));
+        List<TenantDataBean> tenantUsages = new ArrayList<TenantDataBean>();
+        int i = 0;
+        int numberOfPages = 0;
+        for (TenantDataBean tenant : tenantListOnService) {
+            if (i % entriesPerPage == 0) {
+                numberOfPages++;
+            }
+            if (numberOfPages == pageNumber) {
+                tenantUsages.add(tenant);
+            }
+            i++;
+
+        }
+        PaginatedTenantDataBean paginatedTenantInfo = new PaginatedTenantDataBean();
+        paginatedTenantInfo.setTenantInfoBeans(
+                tenantUsages.toArray(new TenantDataBean[tenantUsages.size()]));
+        paginatedTenantInfo.setNumberOfPages(numberOfPages);
+        return paginatedTenantInfo;
+    }
+
+    public static boolean isTenantActiveOnService(String serviceName, String domain) {
+        boolean status = false;
+        for (TenantDataBean tenantBean : tenantDataList.get(serviceName)) {
+            if (tenantBean.getDomain().equalsIgnoreCase(domain)) {
+                status = true;
+            }
+        }
+        return status;
+    }
+
+    public static Map<String, String> getAdminParameters() {
+        Map<String, String> adminParameters = new HashMap<String, String>();
+        if (managerConfig == null) {
+            try {
+                managerConfig = new ManagerConfigurations();
+            } catch (Exception e) {
+                log.error("Failed to get administrator credentials" + e.toString());
+            }
+        }
+        adminParameters.put("userName", managerConfig.getUserName());
+        adminParameters.put("password", managerConfig.getPassword());
+        return adminParameters;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/META-INF/component.xml b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/META-INF/component.xml
new file mode 100644
index 0000000..a163b36
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/META-INF/component.xml
@@ -0,0 +1,35 @@
+<!--
+ ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ ~
+ ~ WSO2 Inc. licenses this file to you under the Apache License,
+ ~ Version 2.0 (the "License"); you may not use this file except
+ ~ in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~    http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied.  See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<component xmlns="http://products.wso2.org/carbon">
+    <!-- sample menu configuration -->
+    <menus>
+        <menu>
+            <id>all_tenant_monitor_menu</id>
+            <i18n-key>Tenant Activity Monitor</i18n-key>
+            <i18n-bundle>org.wso2.carbon.tenant.activity.ui.i18n.Resources</i18n-bundle>
+            <parent-menu>monitor_menu</parent-menu>
+            <link>../tenant-activity/tenant-activity.jsp</link>
+            <region>region4</region>
+            <order>50</order>
+            <style-class>manage</style-class>
+            <icon>../tenant-activity/images/tenant-usage-report.gif</icon>
+            <require-permission>/permission/protected/monitor/userUsage</require-permission>
+            <require-super-tenant>true</require-super-tenant>
+        </menu>
+    </menus>
+</component>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/JSResources.properties
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/JSResources.properties b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/JSResources.properties
new file mode 100644
index 0000000..f038b96
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/JSResources.properties
@@ -0,0 +1 @@
+session.timed.out=Session timed out. Please login again
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/Resources.properties
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/Resources.properties b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/Resources.properties
new file mode 100644
index 0000000..85081f9
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/org/apache/stratos/tenant/activity/ui/i18n/Resources.properties
@@ -0,0 +1,11 @@
+service.name=Service Name
+active.user.count=Active User Count
+active.tenants.services= Active Tenants on Services
+view.list=View List
+active.tenant.count=Active Tenant Count
+active.tenants.on= Active Tenants on
+tenant.domain= Tenant Domain
+active.status=State
+enter.tenant.domain=Enter Tenant Domain
+tenant.status=Tenant State
+tenant.state.on.services.for.tenant= Tenant State on Services For Tenant Domain

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/css/tenant-usage.css
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/css/tenant-usage.css b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/css/tenant-usage.css
new file mode 100644
index 0000000..5c85728
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/css/tenant-usage.css
@@ -0,0 +1,28 @@
+.disableLink {
+    color: #aaaaaa;
+}
+
+.pageLinks {
+    background: #FFFFFF none repeat scroll 0%;
+    border: 1px solid #DDDDDD;
+    padding: 2px 3px;
+    text-decoration: none;
+    margin: 0px;
+    margin-left: 2px;
+    margin-right: 2px;
+}
+
+.pageLinks-selected {
+    background: #e8e9ae none repeat scroll 0%;
+    border: 1px solid #DDDDDD;
+    padding: 2px 3px;
+    text-decoration: none;
+    margin: 0px;
+    margin-left: 2px;
+    margin-right: 2px;
+}
+
+a {
+    color: #386698;
+    cursor: pointer;
+}
\ No newline at end of file

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

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/docs/userguide.html
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/docs/userguide.html b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/docs/userguide.html
new file mode 100644
index 0000000..2c6a979
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/docs/userguide.html
@@ -0,0 +1,76 @@
+<!--
+ ~ 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>View Usage - User Guide</title>
+  <link href="../../admin/css/documentation.css" rel="stylesheet" type="text/css" media="all" />
+</head>
+
+<body>
+<h1>View Usage</h1>
+
+<p>
+You can view usage of the stratos resource by your organization from this page
+</p>
+
+<p>
+<img src="images/view-usage.png" alt="View Usage"/>
+<div><strong>Figure1: View Usage</strong></div>
+</p>
+
+<p>
+
+<table>
+    <thead>
+        <td>
+            The Form Field
+        </td>
+        <td>
+            Description
+        </td>
+    </thead>
+    <tbody>
+        <tr>
+            <td>Year-Month</td>
+            <td>The year and the month the usage is metered.</td>
+        </tr>
+        <tr>
+            <td>Number of Users</td>
+            <td>Number of users of your stratos account.</td>
+        </tr>
+        <tr>
+            <td>Active data storage</td>
+            <td>The registry data storage amount.</td>
+        </tr>
+        <tr>
+            <td>Registry Total Bandwidth</td>
+            <td>Total bandwidth consumed by the registry accesses.</td>
+        </tr>
+        <tr>
+            <td>Service Total Bandwidth</td>
+            <td>The bandwidth consumed by the web services.</td>
+        </tr>
+    </tbody>
+</table>
+
+</p>
+
+</body>
+
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/find-tenant-ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/find-tenant-ajaxprocessor.jsp b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/find-tenant-ajaxprocessor.jsp
new file mode 100644
index 0000000..0c9a988
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/find-tenant-ajaxprocessor.jsp
@@ -0,0 +1,59 @@
+<%--
+ ~ 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 contentType="text/html" pageEncoding="UTF-8" %>
+<%@ page import="org.json.JSONObject" %>
+<%@ page import="org.wso2.carbon.billing.mgt.stub.beans.xsd.Invoice" %>
+<%@ page import="org.wso2.carbon.billing.mgt.stub.beans.xsd.Payment" %>
+<%@ page import="org.wso2.carbon.billing.mgt.ui.utils.BillingUtil" %>
+<%@ page import="java.util.Date" %>
+<%@ page import="org.wso2.carbon.tenant.activity.ui.clients.TenantActivityServiceClient" %>
+<%@ page import="java.io.Console" %>
+<%@ page import="javax.rmi.CORBA.Util" %>
+<%@ page import="org.wso2.carbon.tenant.activity.ui.utils.TenantMonitorUtil" %>
+<%@ page import="org.wso2.carbon.tenant.activity.stub.beans.xsd.PaginatedTenantDataBean" %>
+
+<%
+    String serverUrl = request.getParameter("backEndUrl");
+    String serviceName = request.getParameter("serviceName");
+    String domainName = request.getParameter("domainName");
+
+    boolean state = false;
+    if (serverUrl == null || "null".equals(serverUrl.trim())) {
+        try {
+            TenantActivityServiceClient client = new TenantActivityServiceClient(config, session);
+            state = client.isTenantActiveInService(domainName);
+        } catch (Exception e) {
+        }
+
+    } else {
+        try {
+            TenantActivityServiceClient client = new TenantActivityServiceClient(serverUrl, config, session);
+            state = client.isTenantActiveInService(domainName);
+        } catch (Exception e) {
+        }
+    }
+
+    try {
+        JSONObject obj = new JSONObject();
+        obj.put("isActive", state);
+        obj.put("service", serviceName);
+        out.write(obj.toString());
+    } catch (Exception e) {
+        e.printStackTrace();
+    }
+%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/find-tenant.jsp
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/find-tenant.jsp b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/find-tenant.jsp
new file mode 100644
index 0000000..d938710
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/find-tenant.jsp
@@ -0,0 +1,110 @@
+<!--
+~ 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.
+-->
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib prefix="carbon" uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" %>
+<%@ page import="org.wso2.carbon.tenant.activity.ui.utils.TenantMonitorUtil" %>
+<%@ page import="org.apache.stratos.common.config.CloudServiceConfig" %>
+<%@ page import="java.util.Map" %>
+<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>
+
+<carbon:jsi18n
+        resourceBundle="org.wso2.carbon.tenant.activity.ui.i18n.JSResources"
+        request="<%=request%>"/>
+
+<fmt:bundle basename="org.wso2.carbon.tenant.activity.ui.i18n.Resources">
+    <carbon:breadcrumb
+            label="govern.view_tenants.menu"
+            resourceBundle="org.wso2.carbon.tenant.activity.ui.i18n.Resources"
+            topPage="true"
+            request="<%=request%>"/>
+    <%
+        String domainNameStr = request.getParameter("domain");
+    %>
+    <div id="middle">
+        <h2><fmt:message key="tenant.state.on.services.for.tenant"/> "<%=domainNameStr%>"</h2>
+
+        <div id="workArea">
+            <table id="activeStateTable" cellpadding="0" cellspacing="0" border="0" style="width:100%"
+                   class="styledLeft">
+                <thead>
+                <tr>
+                    <th style="padding-left:5px;text-align:left;width:40%"><fmt:message key="service.name"/></th>
+                    <th style="padding-left:5px;text-align:left;"><fmt:message key="tenant.status"/></th>
+                </tr>
+                </thead>
+            </table>
+        </div>
+    </div>
+</fmt:bundle>
+<%
+    String domainName = request.getParameter("domain");
+    Map<String, CloudServiceConfig> cloudServicesConfigs = TenantMonitorUtil.getCloudServiceConfigMap();
+%>
+
+<script type="text/javascript">
+
+    function getStats() {
+        var serviceArray = new Array();
+    <%
+    for(String serviceName : cloudServicesConfigs.keySet()){
+    %>
+        var serviceObj = new Object();
+        serviceObj.backEndUrl = '<%=cloudServicesConfigs.get(serviceName).getLink()%>';
+        serviceObj.serviceName = '<%=serviceName%>';
+        serviceObj.domainName = '<%=domainName%>';
+        serviceArray.push(serviceObj);
+    <% }
+    %>
+
+        for (var i = 0; i < serviceArray.length; i++) {
+
+            jQuery.ajax({
+                type: 'GET',
+                url: 'find-tenant-ajaxprocessor.jsp',
+                data: 'backEndUrl=' + serviceArray[i].backEndUrl + '&serviceName=' + serviceArray[i].serviceName + '&domainName=' + serviceArray[i].domainName,
+                dataType: 'json',
+                async: true,
+                success: function(msg) {
+                    var resp = msg;
+                    var active = 'Active';
+                    var inActive = 'Inactive';
+                    if (resp.isActive === true) {
+                        document.getElementById('activeStateTable').innerHTML += '<tr><td>' + resp.service + '</td><td>' + active + '</td></tr>';
+                    }
+                    else {
+                        document.getElementById('activeStateTable').innerHTML += '<tr><td>' + resp.service + '</td><td>' + inActive + '</td></tr>';
+                    }
+                },
+                error:function () {
+                    CARBON.showErrorDialog('Could not connect to server');
+                    //document.getElementById('serviceStatTable').innerHTML += '<tr><td>' + eresp.servic + '</td><td>' + resp.count + '</td></tr>';
+                    document.getElementById('activeStateTable').innerHTML += 'Not Available';
+                }
+            });
+        }
+    }
+</script>
+
+<body onload="getStats();">
+<div>
+</div>
+</body>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/get-data-ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/get-data-ajaxprocessor.jsp b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/get-data-ajaxprocessor.jsp
new file mode 100644
index 0000000..15f558b
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/get-data-ajaxprocessor.jsp
@@ -0,0 +1,66 @@
+<%--
+ ~ 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 contentType="text/html" pageEncoding="UTF-8" %>
+<%@ page import="org.json.JSONObject" %>
+<%@ page import="org.wso2.carbon.billing.mgt.stub.beans.xsd.Invoice" %>
+<%@ page import="org.wso2.carbon.billing.mgt.stub.beans.xsd.Payment" %>
+<%@ page import="org.wso2.carbon.billing.mgt.ui.utils.BillingUtil" %>
+<%@ page import="java.util.Date" %>
+<%@ page import="org.wso2.carbon.tenant.activity.ui.clients.TenantActivityServiceClient" %>
+<%@ page import="java.io.Console" %>
+<%@ page import="javax.rmi.CORBA.Util" %>
+<%@ page import="org.wso2.carbon.tenant.activity.ui.utils.TenantMonitorUtil" %>
+<%@ page import="org.wso2.carbon.tenant.activity.stub.beans.xsd.PaginatedTenantDataBean" %>
+
+<%
+    String serverUrl = request.getParameter("backEndUrl");
+    String serviceName = request.getParameter("serviceName");
+
+
+    int count = 0;
+    if (serverUrl == null || "null".equals(serverUrl.trim())) {
+        try {
+            TenantActivityServiceClient client = new TenantActivityServiceClient(config, session);
+           // TenantMonitorUtil.tenantDataList.put(serviceName, client.getAllActiveTenantList());
+           count=client.getActiveTenantCount();
+        } catch (Exception e) {
+        }
+
+    } else {
+        try {
+            TenantActivityServiceClient client = new TenantActivityServiceClient(serverUrl, config, session);
+           // count = client.getAllActiveTenantList().length;
+           count=client.getActiveTenantCount();
+            if (count > 0) {
+               // TenantMonitorUtil.tenantDataList.put(serviceName, client.getAllActiveTenantList());
+            } else {
+                TenantMonitorUtil.tenantDataList.put(serviceName, null);
+            }
+        } catch (Exception e) {
+        }
+    }
+
+    try {
+        JSONObject obj = new JSONObject();
+        obj.put("count", count);
+        obj.put("service", serviceName);
+        out.write(obj.toString());
+    } catch (Exception e) {
+        e.printStackTrace();
+    }
+%>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/images/instance-usage-report.gif
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/images/instance-usage-report.gif b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/images/instance-usage-report.gif
new file mode 100644
index 0000000..4a1ae6a
Binary files /dev/null and b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/images/instance-usage-report.gif differ

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

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/images/tenant-usage-report.gif
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/images/tenant-usage-report.gif b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/images/tenant-usage-report.gif
new file mode 100644
index 0000000..a9b04e2
Binary files /dev/null and b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/images/tenant-usage-report.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/images/user-usage-report.gif
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/images/user-usage-report.gif b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/images/user-usage-report.gif
new file mode 100644
index 0000000..9070c35
Binary files /dev/null and b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/images/user-usage-report.gif differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/show-active-tenants.jsp
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/show-active-tenants.jsp b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/show-active-tenants.jsp
new file mode 100644
index 0000000..7f9e0cc
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/show-active-tenants.jsp
@@ -0,0 +1,129 @@
+<!--
+~ 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="java.util.List" %>
+<%@ page import="org.wso2.carbon.tenant.activity.ui.clients.TenantActivityServiceClient" %>
+<%@ page import="org.wso2.carbon.tenant.activity.ui.utils.TenantMonitorUtil" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="org.wso2.carbon.tenant.reg.agent.client.util.Util" %>
+<%@ page import="org.apache.stratos.common.config.CloudServiceConfig" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
+<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ page import="org.wso2.carbon.registry.common.ui.UIException" %>
+<%@ 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 import="org.wso2.carbon.tenant.activity.stub.TenantActivityServiceStub" %>
+<%@ page import="org.wso2.carbon.tenant.activity.stub.beans.xsd.TenantDataBean" %>
+<%@ 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>
+
+<carbon:jsi18n
+        resourceBundle="org.wso2.carbon.tenant.activity.ui.i18n.JSResources"
+        request="<%=request%>"/>
+
+<fmt:bundle basename="org.wso2.carbon.tenant.activity.ui.i18n.Resources">
+    <carbon:breadcrumb
+            label="govern.view_tenants.menu"
+            resourceBundle="org.wso2.carbon.tenant.activity.ui.i18n.Resources"
+            topPage="true"
+            request="<%=request%>"/>
+    <%
+        String serviceNameStr = request.getParameter("serviceName");
+    %>
+
+    <div id="middle">
+        <h2><fmt:message key="active.tenants.on"/> <%=serviceNameStr%>
+        </h2>
+
+        <div id="workArea">
+            <table id="serviceStatTable1" cellpadding="0" cellspacing="0" border="0" style="width:100%"
+                   class="styledLeft">
+                <thead>
+                <tr>
+                    <th style="padding-left:5px;text-align:left;width:30%"><fmt:message key="tenant.domain"/></th>
+                    <th style="padding-left:5px;text-align:left;"><fmt:message
+                            key="active.status"/></th>
+                </tr>
+                </thead>
+                <tbody>
+                <%
+                    String pageNumberStr = request.getParameter("pageNumber");
+                    if (pageNumberStr == null) {
+                        pageNumberStr = "0";
+
+                    }
+                    int pageNumber = 1;
+                    try {
+                        pageNumber = Integer.parseInt(pageNumberStr);
+                    } catch (NumberFormatException ignored) {
+                        // page number format exception
+                    }
+                    int numberOfPages = 1;
+                    try {
+                        String backEndUrl = TenantMonitorUtil.getCloudServiceConfigMap().get(request.getParameter("serviceName")).getLink();
+                        TenantActivityServiceClient client;
+                        if (backEndUrl == null || "null".equals(backEndUrl.trim())) {
+                            client = new TenantActivityServiceClient(config, session);
+                        } else {
+                            client = new TenantActivityServiceClient(backEndUrl, config, session);
+                        }
+                        for (TenantDataBean bean : client.getPaginatedActiveTenantList(pageNumber).getTenantInfoBeans()) {
+                %>
+                <tr>
+                    <td><%=bean.getDomain()%>
+                    </td>
+                    <td>Active</td>
+                </tr>
+                <%
+                    }
+                } catch (Exception e) {
+                %>
+                <tr>
+                    <td>No Data Available for this Service</td>
+                </tr>
+                <% }
+                    String reDirectPage = "show-active-tenants.jsp?serviceName=" + serviceNameStr + "&";
+                %>
+                <carbon:paginator pageNumber="<%=pageNumber%>" numberOfPages="<%=numberOfPages%>"
+                                  page="<%=reDirectPage%>" pageNumberParameterName="pageNumber"/>
+                </tbody>
+            </table>
+            <input type='hidden' name='serviceName' id="serviceName"/>
+        </div>
+    </div>
+</fmt:bundle>
+
+<script type="text/javascript">
+
+    function getStats() {
+        console.log("In the getStat() function");
+
+    }
+    function showTenants(serviceNameKey) {
+    }
+</script>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/tenant-activity.jsp
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/tenant-activity.jsp b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/tenant-activity.jsp
new file mode 100644
index 0000000..e7db5a7
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity.ui/src/main/resources/web/tenant-activity/tenant-activity.jsp
@@ -0,0 +1,174 @@
+<!--
+~ 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="java.util.List" %>
+<%@ page import="org.wso2.carbon.tenant.activity.ui.clients.TenantActivityServiceClient" %>
+<%@ page import="org.wso2.carbon.tenant.activity.ui.utils.TenantMonitorUtil" %>
+<%@ page import="java.util.Map" %>
+<%@ page import="org.apache.stratos.common.config.CloudServiceConfig" %>
+<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
+<%@ taglib uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" prefix="carbon" %>
+
+
+<%@ page import="org.apache.axis2.context.ConfigurationContext" %>
+<%@ page import="org.wso2.carbon.CarbonConstants" %>
+<%@ page import="org.wso2.carbon.registry.common.ui.UIException" %>
+<%@ 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" %>
+<%@ 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>
+
+<carbon:jsi18n
+        resourceBundle="org.wso2.carbon.tenant.activity.ui.i18n.JSResources"
+        request="<%=request%>"/>
+
+<fmt:bundle basename="org.wso2.carbon.tenant.activity.ui.i18n.Resources">
+    <carbon:breadcrumb
+            label="govern.view_tenants.menu"
+            resourceBundle="org.wso2.carbon.tenant.activity.ui.i18n.Resources"
+            topPage="true"
+            request="<%=request%>"/>
+
+
+    <div id="middle">
+        <div id="top">
+            <h2><fmt:message key="active.tenants.services"/></h2>
+
+            <form id="findTenantForm" action="find-tenant.jsp" method="post">
+                <table class="normal-nopadding" cellspacing="0">
+                    <tbody>
+                    <tr style="border:0; !important">
+                        <td style="border:0; !important">
+                            <nobr>
+                                &nbsp;&nbsp;&nbsp;
+                                Enter Tenant Domain
+                                <input type="text" name="domain" id="domain" value="">&nbsp;
+                            </nobr>
+                        </td>
+                        <td style="border:0; !important">
+                            <a class="icon-link" href="#" style="background-image: url(images/search.gif);"
+                               onclick="domainSelected();" alt="Search"></a>
+                        </td>
+                    </tr>
+                    </tbody>
+                </table>
+            </form>
+        </div>
+
+        <div id="workArea">
+            <table id="serviceStatTable1" cellpadding="0" cellspacing="0" border="0" style="width:100%"
+                   class="styledLeft">
+                <thead>
+                <tr>
+                    <th style="padding-left:5px;text-align:left;width:40%"><fmt:message key="service.name"/></th>
+                    <th style="padding-left:5px;text-align:left;width:150px"><fmt:message
+                            key="active.tenant.count"/></th>
+                    <th style="padding-left:5px;text-align:left;"><fmt:message key="view.list"/></th>
+                </tr>
+                </thead>
+            </table>
+        </div>
+    </div>
+</fmt:bundle>
+
+<%
+    Map<String, CloudServiceConfig> cloudServicesConfigs = TenantMonitorUtil.getCloudServiceConfigMap();
+%>
+
+
+<script type="text/javascript">
+
+    function getStats() {
+        console.log("In the getStat() function");
+        var serviceArray = new Array();
+
+    <%
+    for(String serviceName : cloudServicesConfigs.keySet()){
+
+    %>
+
+        var serviceObj = new Object();
+        serviceObj.backEndUrl = '<%=cloudServicesConfigs.get(serviceName).getLink()%>';
+        serviceObj.serviceName = '<%=serviceName%>';
+        serviceArray.push(serviceObj);
+
+    <% }
+    %>
+
+        for (var i = 0; i < serviceArray.length; i++) {
+
+            jQuery.ajax({
+                type: 'GET',
+                url: 'get-data-ajaxprocessor.jsp',
+                data: 'backEndUrl=' + serviceArray[i].backEndUrl + '&serviceName=' + serviceArray[i].serviceName,
+                dataType: 'json',
+                async: true,
+                success: function(msg) {
+                    var resp = msg;
+                    var view = 'View';
+                    if (resp.count > 0) {
+                        document.getElementById('serviceStatTable1').innerHTML += '<tr><td><a href="javascript:showTenants(\'' + resp.service + '\');">' + resp.service + '</a></td><td>' + resp.count + '</td><td><a href="javascript:showTenants(\'' + resp.service + '\');">' + view + '</a></td></tr>';
+                    }
+                    else {
+                        document.getElementById('serviceStatTable1').innerHTML += '<tr><td>' + resp.service + '</td><td>' + resp.count + '</td><td>-</td></tr>';
+                    }
+                },
+                error:function () {
+                    CARBON.showErrorDialog('Could not connect to server');
+                    //document.getElementById('serviceStatTable').innerHTML += '<tr><td>' + eresp.servic + '</td><td>' + resp.count + '</td></tr>';
+                    document.getElementById('serviceStatTable').innerHTML += 'Not Available';
+                }
+            });
+
+        }
+    }
+    function showTenants(serviceNameKey) {
+        document.getElementById("serviceName").value = serviceNameKey;
+        document.myform.submit();
+    }
+
+    function domainSelected() {
+        var findDomainForm = document.getElementById('findTenantForm');
+        var domain = document.getElementById("domain").getValue();
+        if(domain.length > 3){
+            findDomainForm.submit();
+        }
+        else{
+          CARBON.showErrorDialog('Enter valid domain name');
+        }
+
+    }
+
+</script>
+
+<body onload="getStats();">
+<div>
+    <table id="serviceStatTable"></table>
+    <form name="myform" method="post" action="show-active-tenants.jsp">
+        <input type='hidden' name='serviceName' id="serviceName"/>
+    </form>
+</div>
+</body>
\ No newline at end of file