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:57 UTC

[1/3] committing refactored tenant activity component

Updated Branches:
  refs/heads/master c4eb9c387 -> f5c66c37f


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity/pom.xml
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity/pom.xml b/components/tenant-activity/org.apache.stratos.tenant.activity/pom.xml
new file mode 100644
index 0000000..7de2f3d
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity/pom.xml
@@ -0,0 +1,145 @@
+<!--
+ *  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.
+  -->
+<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</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Stratos - TenantActivity</name>
+
+    <build>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>target/generated-code/src</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                </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.internal.*,
+                            org.wso2.carbon.tenant.activity.services.*,
+                        </Private-Package>
+                        <Export-Package>
+                            org.wso2.carbon.tenant.activity.api.*,
+                            org.wso2.carbon.tenant.activity.util.*,
+                            org.wso2.carbon.tenant.activity.beans.*,
+                            org.wso2.carbon.tenant.activity.commands.*,
+                        </Export-Package>
+                        <Import-Package>
+                            !org.wso2.carbon.tenant.activity.stub.*,
+                            org.apache.stratos.common.*,
+                            org.wso2.carbon.cluster.mgt.core.*,
+                            !javax.xml.namespace,
+                            javax.xml.namespace; version=0.0.0,
+                            javax.servlet;version="${imp.pkg.version.javax.servlet}",
+                            javax.servlet.http;version="${imp.pkg.version.javax.servlet}",
+                            org.apache.axiom.*; version="${axiom.osgi.version.range}",
+                            *;resolution:=optional
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.axis2.wso2</groupId>
+            <artifactId>axis2</artifactId>
+            <version>${orbit.version.axis2}</version>
+        </dependency>
+        <!--dependency>
+            <groupId>org.apache.axis2.wso2</groupId>
+            <artifactId>axis2-kernel</artifactId>
+            <version>${orbit.version.axis2}</version>
+        </dependency-->
+
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+        </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.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.user.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.user.mgt</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.cluster.mgt.core</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+    </dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/beans/PaginatedTenantDataBean.java
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/beans/PaginatedTenantDataBean.java b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/beans/PaginatedTenantDataBean.java
new file mode 100644
index 0000000..ce43b61
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/beans/PaginatedTenantDataBean.java
@@ -0,0 +1,52 @@
+/*
+ *  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.beans;
+
+import org.wso2.carbon.utils.Pageable;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Bean for paginated tenant information
+ */
+public class PaginatedTenantDataBean implements Pageable, Serializable {
+    private TenantDataBean[] tenantInfoBeans;
+    private int numberOfPages;
+
+    public TenantDataBean[] getTenantInfoBeans() {
+        return tenantInfoBeans;
+    }
+
+    public void setTenantInfoBeans(TenantDataBean[] tenantInfoBeans) {
+        this.tenantInfoBeans = tenantInfoBeans;
+    }
+
+    public int getNumberOfPages() {
+        return numberOfPages;
+    }
+
+    public void setNumberOfPages(int numberOfPages) {
+        this.numberOfPages = numberOfPages;
+    }
+
+    public <T> void set(List<T> items) {
+        this.tenantInfoBeans = items.toArray(new TenantDataBean[items.size()]);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/beans/TenantDataBean.java
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/beans/TenantDataBean.java b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/beans/TenantDataBean.java
new file mode 100644
index 0000000..e301231
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/beans/TenantDataBean.java
@@ -0,0 +1,97 @@
+package org.apache.stratos.tenant.activity.beans;
+/*
+ *  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.
+ *
+ */
+
+
+import java.io.Serializable;
+
+/**
+ * Represents a Tenant
+ */
+@SuppressWarnings("unused")
+public class TenantDataBean implements Serializable {
+
+    /**
+     * The tenant Id
+     */
+    private int id;
+
+    /**
+     * The domain name of the tenant
+     */
+    private String domain;
+
+    /**
+     * The admin user name of the tenant
+     */
+    private String adminName;
+
+    /**
+     * The email address of the tenant
+     */
+    private String email;
+
+    /**
+     * Indicates whether this tenant is active or not
+     */
+    private boolean active;
+
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public String getAdminName() {
+        return adminName;
+    }
+
+    public void setAdminName(String adminName) {
+        this.adminName = adminName;
+    }
+
+    public String getDomain() {
+        return domain;
+    }
+
+    public void setDomain(String domain) {
+        this.domain = domain;
+    }
+
+    public boolean isActive() {
+        return active;
+    }
+
+    public void setActive(boolean active) {
+        this.active = active;
+    }
+
+
+}
\ 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/src/main/java/org/apache/stratos/tenant/activity/commands/GetActiveTenantsInMemberRequest.java
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/commands/GetActiveTenantsInMemberRequest.java b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/commands/GetActiveTenantsInMemberRequest.java
new file mode 100644
index 0000000..3cd4cd3
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/commands/GetActiveTenantsInMemberRequest.java
@@ -0,0 +1,59 @@
+/*
+ *  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.
+ *
+ */
+package org.apache.stratos.tenant.activity.commands;
+
+import org.apache.axis2.clustering.ClusteringCommand;
+import org.apache.axis2.clustering.ClusteringMessage;
+import org.apache.axis2.clustering.ClusteringFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.carbon.core.multitenancy.utils.TenantAxisUtils;
+import org.apache.stratos.tenant.activity.beans.TenantDataBean;
+import org.wso2.carbon.user.api.Tenant;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This Cluster message is used to get active tenants in each node then
+ * send response as other cluster command which holds active tenants
+ */
+public class GetActiveTenantsInMemberRequest extends ClusteringMessage {
+    private static final Log log = LogFactory.getLog(GetActiveTenantsInMemberRequest.class);
+    private List<TenantDataBean> tenants = new ArrayList<TenantDataBean>();
+
+    public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
+        try {
+            for (Tenant tenant : TenantAxisUtils.getActiveTenants(configurationContext)) {
+                TenantDataBean tb = new TenantDataBean();
+                tb.setDomain(tenant.getDomain());
+                tenants.add(tb);
+            }
+        } catch (Exception e) {
+            String msg = "Cannot get Active tenants";
+            log.error(msg, e);
+            throw new ClusteringFault(msg, e);
+        }
+    }
+
+    public ClusteringCommand getResponse() {
+        return new GetActiveTenantsInMemberResponse(tenants);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/commands/GetActiveTenantsInMemberResponse.java
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/commands/GetActiveTenantsInMemberResponse.java b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/commands/GetActiveTenantsInMemberResponse.java
new file mode 100644
index 0000000..b3c19d0
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/commands/GetActiveTenantsInMemberResponse.java
@@ -0,0 +1,54 @@
+/*
+ *  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.commands;
+
+import org.apache.axis2.clustering.ClusteringCommand;
+import org.apache.axis2.clustering.ClusteringFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.stratos.tenant.activity.beans.TenantDataBean;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * This clustering command is used send active tenants list if we send clustering message
+ * GetActiveTenantsInMemberRequest then as a response we can get GetActiveTenantsInMemberResponse
+ * which holds active tenants list
+ */
+public class GetActiveTenantsInMemberResponse extends ClusteringCommand {
+
+    private List<TenantDataBean> tenants = new ArrayList<TenantDataBean>();
+
+    public GetActiveTenantsInMemberResponse(List<TenantDataBean> tenantList) {
+        tenants = tenantList;
+    }
+
+    public void addTenant(TenantDataBean tenant) {
+        tenants.add(tenant);
+    }
+
+    public List<TenantDataBean> getTenants() {
+        return Collections.unmodifiableList(tenants);
+    }
+
+    @Override
+    public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/internal/TenantActivityServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/internal/TenantActivityServiceComponent.java b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/internal/TenantActivityServiceComponent.java
new file mode 100644
index 0000000..47042b9
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/internal/TenantActivityServiceComponent.java
@@ -0,0 +1,96 @@
+/*
+*  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.internal;
+
+import org.apache.stratos.tenant.activity.util.Util;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.transport.local.LocalTransportReceiver;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.service.component.ComponentContext;
+import org.wso2.carbon.registry.core.service.RegistryService;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.utils.ConfigurationContextService;
+
+import java.lang.Throwable;
+
+/**
+ * @scr.component name="org.wso2.stratos.tenant.activity" immediate="true"
+ * @scr.reference name="registry.service"
+ * interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="1..1"
+ * policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService"
+ * @scr.reference name="user.realmservice.default"
+ * interface="org.wso2.carbon.user.core.service.RealmService" cardinality="1..1"
+ * policy="dynamic" bind="setRealmService" unbind="unsetRealmService"
+ * @scr.reference name="config.context.service"
+ * interface="org.wso2.carbon.utils.ConfigurationContextService" cardinality="1..1"
+ * policy="dynamic" bind="setConfigurationContextService" unbind="unsetConfigurationContextService"
+ */
+public class TenantActivityServiceComponent {
+    private static Log log = LogFactory.getLog(TenantActivityServiceComponent.class);
+
+
+    protected void activate(ComponentContext context) {
+        try {
+            Util.registerRetrieverServices(context.getBundleContext());
+            if(log.isDebugEnabled()){
+                log.debug("******* Tenant Activity bundle is activated ******* ");
+            }
+        } catch (Throwable e) {
+            log.error("******* Error in activating Tenant Activity bundle ******* ", e);
+        }
+    }
+
+    protected void deactivate(ComponentContext context) {
+        if (log.isDebugEnabled()) {
+            log.debug("******* Tenant Activity is deactivated ******* ");
+        }
+    }
+
+    protected void setRegistryService(RegistryService registryService) {
+        Util.setRegistryService(registryService);
+    }
+
+    protected void unsetRegistryService(RegistryService registryService) {
+        Util.setRegistryService(null);
+    }
+
+    protected void setRealmService(RealmService realmService) {
+        Util.setRealmService(realmService);
+    }
+
+    protected void unsetRealmService(RealmService realmService) {
+        Util.setRealmService(null);
+    }
+
+    protected void setConfigurationContextService(ConfigurationContextService ccService) {
+        ConfigurationContext serverCtx = ccService.getServerConfigContext();
+        AxisConfiguration serverConfig = serverCtx.getAxisConfiguration();
+        LocalTransportReceiver.CONFIG_CONTEXT = new ConfigurationContext(serverConfig);
+        LocalTransportReceiver.CONFIG_CONTEXT.setServicePath("services");
+        LocalTransportReceiver.CONFIG_CONTEXT.setContextRoot("local:/");
+
+        Util.setConfigurationContextService(ccService);
+    }
+
+    protected void unsetConfigurationContextService(ConfigurationContextService ccService) {
+        Util.setConfigurationContextService(null);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/services/TenantActivityService.java
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/services/TenantActivityService.java b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/services/TenantActivityService.java
new file mode 100644
index 0000000..2d6e2a7
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/services/TenantActivityService.java
@@ -0,0 +1,83 @@
+/*
+*  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.services;
+
+import org.apache.stratos.tenant.activity.util.Util;
+import org.wso2.carbon.core.multitenancy.utils.TenantAxisUtils;
+import org.wso2.carbon.core.AbstractAdmin;
+import org.apache.stratos.tenant.activity.beans.PaginatedTenantDataBean;
+import org.apache.stratos.tenant.activity.beans.TenantDataBean;
+import org.apache.stratos.tenant.activity.util.TenantActivityUtil;
+import org.wso2.carbon.user.api.Tenant;
+import org.wso2.carbon.utils.DataPaginator;
+
+import java.util.*;
+
+/**
+ * This service use to get active tenants related data.If its single node
+ */
+public class TenantActivityService extends AbstractAdmin {
+    List<String> list = new ArrayList<String>();
+
+    public int getActiveTenantCount() throws Exception {
+        return getAllActiveTenantList().size();
+    }
+
+    /**
+     *
+     * @return Active tenants list on service cluster
+     * @throws Exception  when error in retrieving active tenants list
+     */
+    private List<TenantDataBean> getAllActiveTenantList() throws Exception {
+       // ClusterMgtUtil cm = new ClusterMgtUtil();
+        List<TenantDataBean> list = new ArrayList<TenantDataBean>();
+        //This will add current node active tenants list to tenant list
+        for (Tenant tenant : TenantAxisUtils.getActiveTenants(Util.getConfigurationContextService().getServerConfigContext())) {
+            TenantDataBean tb = new TenantDataBean();
+            tb.setDomain(tenant.getDomain());
+            list.add(tb);
+        }
+        //if there are multiple nodes in clusters get active tenants from there as well
+        for (TenantDataBean tenantDataBean : TenantActivityUtil.getActiveTenantsInCluster()) {
+            if (TenantActivityUtil.indexOfTenantInList(list, tenantDataBean) < 0) {
+                list.add(tenantDataBean);
+            }
+
+        }
+        return list;
+    }
+
+    public PaginatedTenantDataBean retrievePaginatedActiveTenants(int pageNumber) throws Exception {
+        List<TenantDataBean> tenantList = getAllActiveTenantList();
+        // Pagination
+        PaginatedTenantDataBean paginatedTenantInfoBean = new PaginatedTenantDataBean();
+        DataPaginator.doPaging(pageNumber, tenantList, paginatedTenantInfoBean);
+        return paginatedTenantInfoBean;
+    }
+
+    public boolean isActiveTenantOnService(String domainName) throws Exception {
+        boolean state = false;
+        for (TenantDataBean tenant : getAllActiveTenantList()) {
+            if (tenant.getDomain().equalsIgnoreCase(domainName)) {
+                return true;
+            }
+        }
+        return state;
+    }
+}
\ 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/src/main/java/org/apache/stratos/tenant/activity/util/TenantActivityUtil.java
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/util/TenantActivityUtil.java b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/util/TenantActivityUtil.java
new file mode 100644
index 0000000..195980b
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/util/TenantActivityUtil.java
@@ -0,0 +1,79 @@
+/*
+ *  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.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.stratos.tenant.activity.commands.GetActiveTenantsInMemberRequest;
+import org.apache.stratos.tenant.activity.commands.GetActiveTenantsInMemberResponse;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.tenant.activity.beans.TenantDataBean;
+
+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/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/util/Util.java
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/util/Util.java b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/util/Util.java
new file mode 100644
index 0000000..18f1bf8
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/java/org/apache/stratos/tenant/activity/util/Util.java
@@ -0,0 +1,82 @@
+/*
+ *  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.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.user.core.UserRealm;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.utils.ConfigurationContextService;
+
+/**
+ * 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/tenant-activity/org.apache.stratos.tenant.activity/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/resources/META-INF/component.xml b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/resources/META-INF/component.xml
new file mode 100644
index 0000000..ebbd1cc
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/resources/META-INF/component.xml
@@ -0,0 +1,37 @@
+<?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/tenant-activity/org.apache.stratos.tenant.activity/src/main/resources/META-INF/services.xml
----------------------------------------------------------------------
diff --git a/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/resources/META-INF/services.xml b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/resources/META-INF/services.xml
new file mode 100644
index 0000000..0288f27
--- /dev/null
+++ b/components/tenant-activity/org.apache.stratos.tenant.activity/src/main/resources/META-INF/services.xml
@@ -0,0 +1,42 @@
+<?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.apache.stratos.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/tenant-activity/pom.xml
----------------------------------------------------------------------
diff --git a/components/tenant-activity/pom.xml b/components/tenant-activity/pom.xml
new file mode 100644
index 0000000..6a128a8
--- /dev/null
+++ b/components/tenant-activity/pom.xml
@@ -0,0 +1,42 @@
+<?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.apache.stratos</groupId>
+        <artifactId>stratos-components-parent</artifactId>
+        <version>3.0.0</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>tenant.activity.parent</artifactId>
+    <packaging>pom</packaging>
+    <name>Apache Stratos - Tenant Activity Parent Module</name>
+    <description>WSO2 Stratos Tenant Activity Parent Module</description>
+    <url>http://apache.org</url>
+
+    <modules>
+        <module>org.apache.stratos.tenant.activity</module>
+        <module>org.apache.stratos.tenant.activity.ui</module>
+    </modules>
+
+</project>
+


[3/3] git commit: committing refactored tenant activity component

Posted by is...@apache.org.
committing refactored tenant activity component


Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/f5c66c37
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/f5c66c37
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/f5c66c37

Branch: refs/heads/master
Commit: f5c66c37f10446d04b623ed9a2dd4d89f99343f7
Parents: c4eb9c3
Author: Isuru <is...@wso2.com>
Authored: Wed Jul 10 12:04:29 2013 +0530
Committer: Isuru <is...@wso2.com>
Committed: Wed Jul 10 12:04:29 2013 +0530

----------------------------------------------------------------------
 components/pom.xml                              |   4 +
 .../ui/clients/TenantActivityServiceClient.java | 155 -----------------
 .../TenantActivityUIServiceComponent.java       |  57 ------
 .../ui/utils/ManagerConfigurations.java         | 148 ----------------
 .../activity/ui/utils/TenantMonitorUtil.java    | 143 ---------------
 .../src/main/resources/META-INF/component.xml   |  35 ----
 .../activity/ui/i18n/JSResources.properties     |   1 -
 .../activity/ui/i18n/Resources.properties       |  11 --
 .../web/tenant-activity/css/tenant-usage.css    |  28 ---
 .../tenant-activity/docs/images/view-usage.png  | Bin 44786 -> 0 bytes
 .../find-tenant-ajaxprocessor.jsp               |  59 -------
 .../web/tenant-activity/find-tenant.jsp         | 110 ------------
 .../tenant-activity/get-data-ajaxprocessor.jsp  |  66 -------
 .../images/instance-usage-report.gif            | Bin 849 -> 0 bytes
 .../web/tenant-activity/images/search.gif       | Bin 191 -> 0 bytes
 .../images/tenant-usage-report.gif              | Bin 1008 -> 0 bytes
 .../images/user-usage-report.gif                | Bin 1033 -> 0 bytes
 .../web/tenant-activity/show-active-tenants.jsp | 129 --------------
 .../web/tenant-activity/tenant-activity.jsp     | 174 -------------------
 .../activity/beans/PaginatedTenantDataBean.java |  52 ------
 .../tenant/activity/beans/TenantDataBean.java   |  98 -----------
 .../GetActiveTenantsInMemberRequest.java        |  59 -------
 .../GetActiveTenantsInMemberResponse.java       |  54 ------
 .../TenantActivityServiceComponent.java         |  99 -----------
 .../services/TenantActivityService.java         |  83 ---------
 .../activity/util/TenantActivityUtil.java       |  79 ---------
 .../wso2/carbon/tenant/activity/util/Util.java  |  85 ---------
 .../src/main/resources/META-INF/component.xml   |  37 ----
 .../src/main/resources/META-INF/services.xml    |  42 -----
 components/stratos/tenant-activity/pom.xml      |  41 -----
 .../pom.xml                                     | 142 +++++++++++++++
 .../ui/clients/TenantActivityServiceClient.java | 155 +++++++++++++++++
 .../TenantActivityUIServiceComponent.java       |  55 ++++++
 .../ui/utils/ManagerConfigurations.java         | 147 ++++++++++++++++
 .../activity/ui/utils/TenantMonitorUtil.java    | 143 +++++++++++++++
 .../src/main/resources/META-INF/component.xml   |  35 ++++
 .../activity/ui/i18n/JSResources.properties     |   1 +
 .../activity/ui/i18n/Resources.properties       |  11 ++
 .../web/tenant-activity/css/tenant-usage.css    |  28 +++
 .../tenant-activity/docs/images/view-usage.png  | Bin 0 -> 44786 bytes
 .../web/tenant-activity/docs/userguide.html     |  76 ++++++++
 .../find-tenant-ajaxprocessor.jsp               |  59 +++++++
 .../web/tenant-activity/find-tenant.jsp         | 110 ++++++++++++
 .../tenant-activity/get-data-ajaxprocessor.jsp  |  66 +++++++
 .../images/instance-usage-report.gif            | Bin 0 -> 849 bytes
 .../web/tenant-activity/images/search.gif       | Bin 0 -> 191 bytes
 .../images/tenant-usage-report.gif              | Bin 0 -> 1008 bytes
 .../images/user-usage-report.gif                | Bin 0 -> 1033 bytes
 .../web/tenant-activity/show-active-tenants.jsp | 129 ++++++++++++++
 .../web/tenant-activity/tenant-activity.jsp     | 174 +++++++++++++++++++
 .../org.apache.stratos.tenant.activity/pom.xml  | 145 ++++++++++++++++
 .../activity/beans/PaginatedTenantDataBean.java |  52 ++++++
 .../tenant/activity/beans/TenantDataBean.java   |  97 +++++++++++
 .../GetActiveTenantsInMemberRequest.java        |  59 +++++++
 .../GetActiveTenantsInMemberResponse.java       |  54 ++++++
 .../TenantActivityServiceComponent.java         |  96 ++++++++++
 .../services/TenantActivityService.java         |  83 +++++++++
 .../activity/util/TenantActivityUtil.java       |  79 +++++++++
 .../stratos/tenant/activity/util/Util.java      |  82 +++++++++
 .../src/main/resources/META-INF/component.xml   |  37 ++++
 .../src/main/resources/META-INF/services.xml    |  42 +++++
 components/tenant-activity/pom.xml              |  42 +++++
 62 files changed, 2203 insertions(+), 1845 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/pom.xml
----------------------------------------------------------------------
diff --git a/components/pom.xml b/components/pom.xml
index b92dd5d..c3cf70f 100644
--- a/components/pom.xml
+++ b/components/pom.xml
@@ -64,6 +64,8 @@
 		<module>org.apache.stratos.common/2.1.2</module>
 		<module>org.apache.stratos.tenant.dispatcher/2.1.0</module>
 		<module>org.apache.stratos.keystore.mgt/2.1.0</module>
+		<module>org.apache.stratos.email.sender</module>
+                <module>tenant-activity</module>
 	    </modules>
 	    
 	    <build>
@@ -249,6 +251,8 @@
         <google.guice.wso2.version>3.0.wso2v1</google.guice.wso2.version>
 	<commons-httpclient.version>3.0.1</commons-httpclient.version>
 	<json.wso2.version>2.0.0.wso2v1</json.wso2.version>
+	<orbit.version.axis2>1.6.1.wso2v5</orbit.version.axis2>
+	<orbit.version.axiom>1.2.11.wso2v3</orbit.version.axiom>
         <!--eclipse.osgi.version>3.5.0.v20090520</eclipse.osgi.version>
         <eclipse.osgi.services.version>3.2.0.v20090520-1800</eclipse.osgi.services.version>
         <equinox.commons.logging.version>1.0.4.v200706111724</equinox.commons.logging.version>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/clients/TenantActivityServiceClient.java
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/clients/TenantActivityServiceClient.java b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/clients/TenantActivityServiceClient.java
deleted file mode 100644
index 994b5bc..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/clients/TenantActivityServiceClient.java
+++ /dev/null
@@ -1,155 +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.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.wso2.carbon.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/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/internal/TenantActivityUIServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/internal/TenantActivityUIServiceComponent.java b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/internal/TenantActivityUIServiceComponent.java
deleted file mode 100644
index 0b3f2fd..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/internal/TenantActivityUIServiceComponent.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.wso2.carbon.tenant.activity.ui.internal;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.service.component.ComponentContext;
-import org.wso2.carbon.stratos.common.util.StratosConfiguration;
-import org.wso2.carbon.utils.ConfigurationContextService;
-
-/**
- * @scr.component name="org.wso2.carbon.tenant.activity.ui" immediate="true"
- * @scr.reference name="config.context.service"
- * interface="org.wso2.carbon.utils.ConfigurationContextService"
- * cardinality="1..1" policy="dynamic"  bind="setConfigurationContextService"
- * unbind="unsetConfigurationContextService"
- * @scr.reference name="stratos.config.service"
- * interface="org.wso2.carbon.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/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/utils/ManagerConfigurations.java
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/utils/ManagerConfigurations.java b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/utils/ManagerConfigurations.java
deleted file mode 100644
index 94da109..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/utils/ManagerConfigurations.java
+++ /dev/null
@@ -1,148 +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.ui.utils;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.stratos.common.constants.StratosConstants;
-import org.wso2.carbon.stratos.common.util.CommonUtil;
-import org.wso2.carbon.registry.core.RegistryConstants;
-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/carbon/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/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/utils/TenantMonitorUtil.java
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/utils/TenantMonitorUtil.java b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/utils/TenantMonitorUtil.java
deleted file mode 100644
index ef566fd..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/ui/utils/TenantMonitorUtil.java
+++ /dev/null
@@ -1,143 +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.ui.utils;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.stratos.common.config.CloudServiceConfig;
-import org.wso2.carbon.stratos.common.config.CloudServiceConfigParser;
-import org.wso2.carbon.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/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/META-INF/component.xml
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/META-INF/component.xml b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/META-INF/component.xml
deleted file mode 100644
index a163b36..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/META-INF/component.xml
+++ /dev/null
@@ -1,35 +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.
- -->
-<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/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/org/wso2/carbon/tenant/activity/ui/i18n/JSResources.properties
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/org/wso2/carbon/tenant/activity/ui/i18n/JSResources.properties b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/org/wso2/carbon/tenant/activity/ui/i18n/JSResources.properties
deleted file mode 100644
index f038b96..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/org/wso2/carbon/tenant/activity/ui/i18n/JSResources.properties
+++ /dev/null
@@ -1 +0,0 @@
-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/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/org/wso2/carbon/tenant/activity/ui/i18n/Resources.properties
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/org/wso2/carbon/tenant/activity/ui/i18n/Resources.properties b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/org/wso2/carbon/tenant/activity/ui/i18n/Resources.properties
deleted file mode 100644
index 85081f9..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/org/wso2/carbon/tenant/activity/ui/i18n/Resources.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-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/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/css/tenant-usage.css
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/css/tenant-usage.css b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/css/tenant-usage.css
deleted file mode 100644
index 5c85728..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/css/tenant-usage.css
+++ /dev/null
@@ -1,28 +0,0 @@
-.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/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/docs/images/view-usage.png
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/docs/images/view-usage.png b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/docs/images/view-usage.png
deleted file mode 100644
index 3d036c0..0000000
Binary files a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/docs/images/view-usage.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/find-tenant-ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/find-tenant-ajaxprocessor.jsp b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/find-tenant-ajaxprocessor.jsp
deleted file mode 100644
index 0c9a988..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/find-tenant-ajaxprocessor.jsp
+++ /dev/null
@@ -1,59 +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 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/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/find-tenant.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/find-tenant.jsp b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/find-tenant.jsp
deleted file mode 100644
index 919c62c..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/find-tenant.jsp
+++ /dev/null
@@ -1,110 +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.
--->
-<%@ 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.wso2.carbon.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/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/get-data-ajaxprocessor.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/get-data-ajaxprocessor.jsp b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/get-data-ajaxprocessor.jsp
deleted file mode 100644
index 15f558b..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/get-data-ajaxprocessor.jsp
+++ /dev/null
@@ -1,66 +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 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/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/images/instance-usage-report.gif
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/images/instance-usage-report.gif b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/images/instance-usage-report.gif
deleted file mode 100644
index 4a1ae6a..0000000
Binary files a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/images/instance-usage-report.gif and /dev/null differ

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

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

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

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/f5c66c37/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/show-active-tenants.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/show-active-tenants.jsp b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/show-active-tenants.jsp
deleted file mode 100644
index 4590272..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/show-active-tenants.jsp
+++ /dev/null
@@ -1,129 +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="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.wso2.carbon.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/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/tenant-activity.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/tenant-activity.jsp b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/tenant-activity.jsp
deleted file mode 100644
index 457aa84..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity.ui/2.1.0/src/main/resources/web/tenant-activity/tenant-activity.jsp
+++ /dev/null
@@ -1,174 +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="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.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

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/beans/PaginatedTenantDataBean.java
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/beans/PaginatedTenantDataBean.java b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/beans/PaginatedTenantDataBean.java
deleted file mode 100644
index cfff936..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/beans/PaginatedTenantDataBean.java
+++ /dev/null
@@ -1,52 +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.beans;
-
-import org.wso2.carbon.utils.Pageable;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * Bean for paginated tenant information
- */
-public class PaginatedTenantDataBean implements Pageable, Serializable {
-    private TenantDataBean[] tenantInfoBeans;
-    private int numberOfPages;
-
-    public TenantDataBean[] getTenantInfoBeans() {
-        return tenantInfoBeans;
-    }
-
-    public void setTenantInfoBeans(TenantDataBean[] tenantInfoBeans) {
-        this.tenantInfoBeans = tenantInfoBeans;
-    }
-
-    public int getNumberOfPages() {
-        return numberOfPages;
-    }
-
-    public void setNumberOfPages(int numberOfPages) {
-        this.numberOfPages = numberOfPages;
-    }
-
-    public <T> void set(List<T> items) {
-        this.tenantInfoBeans = items.toArray(new TenantDataBean[items.size()]);
-    }
-}

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/beans/TenantDataBean.java
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/beans/TenantDataBean.java b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/beans/TenantDataBean.java
deleted file mode 100644
index abdd228..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/beans/TenantDataBean.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.wso2.carbon.tenant.activity.beans;
-/*
- *  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.
- *
- */
-
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * Represents a Tenant
- */
-@SuppressWarnings("unused")
-public class TenantDataBean implements Serializable {
-
-    /**
-     * The tenant Id
-     */
-    private int id;
-
-    /**
-     * The domain name of the tenant
-     */
-    private String domain;
-
-    /**
-     * The admin user name of the tenant
-     */
-    private String adminName;
-
-    /**
-     * The email address of the tenant
-     */
-    private String email;
-
-    /**
-     * Indicates whether this tenant is active or not
-     */
-    private boolean active;
-
-
-    public String getEmail() {
-        return email;
-    }
-
-    public void setEmail(String email) {
-        this.email = email;
-    }
-
-    public int getId() {
-        return id;
-    }
-
-    public void setId(int id) {
-        this.id = id;
-    }
-
-    public String getAdminName() {
-        return adminName;
-    }
-
-    public void setAdminName(String adminName) {
-        this.adminName = adminName;
-    }
-
-    public String getDomain() {
-        return domain;
-    }
-
-    public void setDomain(String domain) {
-        this.domain = domain;
-    }
-
-    public boolean isActive() {
-        return active;
-    }
-
-    public void setActive(boolean active) {
-        this.active = active;
-    }
-
-
-}
\ 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/commands/GetActiveTenantsInMemberRequest.java
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/commands/GetActiveTenantsInMemberRequest.java b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/commands/GetActiveTenantsInMemberRequest.java
deleted file mode 100644
index bf9b880..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/commands/GetActiveTenantsInMemberRequest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *  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.
- *
- */
-package org.wso2.carbon.tenant.activity.commands;
-
-import org.apache.axis2.clustering.ClusteringCommand;
-import org.apache.axis2.clustering.ClusteringMessage;
-import org.apache.axis2.clustering.ClusteringFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.wso2.carbon.core.multitenancy.utils.TenantAxisUtils;
-import org.wso2.carbon.tenant.activity.beans.TenantDataBean;
-import org.wso2.carbon.user.api.Tenant;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This Cluster message is used to get active tenants in each node then
- * send response as other cluster command which holds active tenants
- */
-public class GetActiveTenantsInMemberRequest extends ClusteringMessage {
-    private static final Log log = LogFactory.getLog(GetActiveTenantsInMemberRequest.class);
-    private List<TenantDataBean> tenants = new ArrayList<TenantDataBean>();
-
-    public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
-        try {
-            for (Tenant tenant : TenantAxisUtils.getActiveTenants(configurationContext)) {
-                TenantDataBean tb = new TenantDataBean();
-                tb.setDomain(tenant.getDomain());
-                tenants.add(tb);
-            }
-        } catch (Exception e) {
-            String msg = "Cannot get Active tenants";
-            log.error(msg, e);
-            throw new ClusteringFault(msg, e);
-        }
-    }
-
-    public ClusteringCommand getResponse() {
-        return new GetActiveTenantsInMemberResponse(tenants);
-    }
-}

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/commands/GetActiveTenantsInMemberResponse.java
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/commands/GetActiveTenantsInMemberResponse.java b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/commands/GetActiveTenantsInMemberResponse.java
deleted file mode 100644
index 8e4f411..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/commands/GetActiveTenantsInMemberResponse.java
+++ /dev/null
@@ -1,54 +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.commands;
-
-import org.apache.axis2.clustering.ClusteringCommand;
-import org.apache.axis2.clustering.ClusteringFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.wso2.carbon.tenant.activity.beans.TenantDataBean;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * This clustering command is used send active tenants list if we send clustering message
- * GetActiveTenantsInMemberRequest then as a response we can get GetActiveTenantsInMemberResponse
- * which holds active tenants list
- */
-public class GetActiveTenantsInMemberResponse extends ClusteringCommand {
-
-    private List<TenantDataBean> tenants = new ArrayList<TenantDataBean>();
-
-    public GetActiveTenantsInMemberResponse(List<TenantDataBean> tenantList) {
-        tenants = tenantList;
-    }
-
-    public void addTenant(TenantDataBean tenant) {
-        tenants.add(tenant);
-    }
-
-    public List<TenantDataBean> getTenants() {
-        return Collections.unmodifiableList(tenants);
-    }
-
-    @Override
-    public void execute(ConfigurationContext configurationContext) throws ClusteringFault {
-    }
-}

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/internal/TenantActivityServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/internal/TenantActivityServiceComponent.java b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/internal/TenantActivityServiceComponent.java
deleted file mode 100644
index 19f18bc..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/internal/TenantActivityServiceComponent.java
+++ /dev/null
@@ -1,99 +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.internal;
-
-import org.wso2.carbon.stratos.common.util.*;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.transport.local.LocalTransportReceiver;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.osgi.service.component.ComponentContext;
-import org.wso2.carbon.registry.core.service.RegistryService;
-import org.wso2.carbon.tenant.activity.util.Util;
-import org.wso2.carbon.tenant.activity.util.Util;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.utils.ConfigurationContextService;
-
-import java.lang.System;
-import java.lang.Throwable;
-
-/**
- * @scr.component name="org.wso2.carbon.tenant.activity" immediate="true"
- * @scr.reference name="registry.service"
- * interface="org.wso2.carbon.registry.core.service.RegistryService" cardinality="1..1"
- * policy="dynamic" bind="setRegistryService" unbind="unsetRegistryService"
- * @scr.reference name="user.realmservice.default"
- * interface="org.wso2.carbon.user.core.service.RealmService" cardinality="1..1"
- * policy="dynamic" bind="setRealmService" unbind="unsetRealmService"
- * @scr.reference name="config.context.service"
- * interface="org.wso2.carbon.utils.ConfigurationContextService" cardinality="1..1"
- * policy="dynamic" bind="setConfigurationContextService" unbind="unsetConfigurationContextService"
- */
-public class TenantActivityServiceComponent {
-    private static Log log = LogFactory.getLog(TenantActivityServiceComponent.class);
-
-
-    protected void activate(ComponentContext context) {
-        try {
-            Util.registerRetrieverServices(context.getBundleContext());
-            if(log.isDebugEnabled()){
-                log.debug("******* Tenant Activity bundle is activated ******* ");
-            }
-        } catch (Throwable e) {
-            log.error("******* Error in activating Tenant Activity bundle ******* ", e);
-        }
-    }
-
-    protected void deactivate(ComponentContext context) {
-        if (log.isDebugEnabled()) {
-            log.debug("******* Tenant Activity is deactivated ******* ");
-        }
-    }
-
-    protected void setRegistryService(RegistryService registryService) {
-        Util.setRegistryService(registryService);
-    }
-
-    protected void unsetRegistryService(RegistryService registryService) {
-        Util.setRegistryService(null);
-    }
-
-    protected void setRealmService(RealmService realmService) {
-        Util.setRealmService(realmService);
-    }
-
-    protected void unsetRealmService(RealmService realmService) {
-        Util.setRealmService(null);
-    }
-
-    protected void setConfigurationContextService(ConfigurationContextService ccService) {
-        ConfigurationContext serverCtx = ccService.getServerConfigContext();
-        AxisConfiguration serverConfig = serverCtx.getAxisConfiguration();
-        LocalTransportReceiver.CONFIG_CONTEXT = new ConfigurationContext(serverConfig);
-        LocalTransportReceiver.CONFIG_CONTEXT.setServicePath("services");
-        LocalTransportReceiver.CONFIG_CONTEXT.setContextRoot("local:/");
-
-        Util.setConfigurationContextService(ccService);
-    }
-
-    protected void unsetConfigurationContextService(ConfigurationContextService ccService) {
-        Util.setConfigurationContextService(null);
-    }
-
-}
\ 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/services/TenantActivityService.java
----------------------------------------------------------------------
diff --git a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/services/TenantActivityService.java b/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/services/TenantActivityService.java
deleted file mode 100644
index 0fa57b1..0000000
--- a/components/stratos/tenant-activity/org.wso2.carbon.tenant.activity/2.1.0/src/main/java/org/wso2/carbon/tenant/activity/services/TenantActivityService.java
+++ /dev/null
@@ -1,83 +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.services;
-
-import org.wso2.carbon.core.multitenancy.utils.TenantAxisUtils;
-import org.wso2.carbon.core.AbstractAdmin;
-import org.wso2.carbon.tenant.activity.beans.PaginatedTenantDataBean;
-import org.wso2.carbon.tenant.activity.beans.TenantDataBean;
-import org.wso2.carbon.tenant.activity.util.TenantActivityUtil;
-import org.wso2.carbon.tenant.activity.util.Util;
-import org.wso2.carbon.user.api.Tenant;
-import org.wso2.carbon.utils.DataPaginator;
-
-import java.util.*;
-
-/**
- * This service use to get active tenants related data.If its single node
- */
-public class TenantActivityService extends AbstractAdmin {
-    List<String> list = new ArrayList<String>();
-
-    public int getActiveTenantCount() throws Exception {
-        return getAllActiveTenantList().size();
-    }
-
-    /**
-     *
-     * @return Active tenants list on service cluster
-     * @throws Exception  when error in retrieving active tenants list
-     */
-    private List<TenantDataBean> getAllActiveTenantList() throws Exception {
-       // ClusterMgtUtil cm = new ClusterMgtUtil();
-        List<TenantDataBean> list = new ArrayList<TenantDataBean>();
-        //This will add current node active tenants list to tenant list
-        for (Tenant tenant : TenantAxisUtils.getActiveTenants(Util.getConfigurationContextService().getServerConfigContext())) {
-            TenantDataBean tb = new TenantDataBean();
-            tb.setDomain(tenant.getDomain());
-            list.add(tb);
-        }
-        //if there are multiple nodes in clusters get active tenants from there as well
-        for (TenantDataBean tenantDataBean : TenantActivityUtil.getActiveTenantsInCluster()) {
-            if (TenantActivityUtil.indexOfTenantInList(list, tenantDataBean) < 0) {
-                list.add(tenantDataBean);
-            }
-
-        }
-        return list;
-    }
-
-    public PaginatedTenantDataBean retrievePaginatedActiveTenants(int pageNumber) throws Exception {
-        List<TenantDataBean> tenantList = getAllActiveTenantList();
-        // Pagination
-        PaginatedTenantDataBean paginatedTenantInfoBean = new PaginatedTenantDataBean();
-        DataPaginator.doPaging(pageNumber, tenantList, paginatedTenantInfoBean);
-        return paginatedTenantInfoBean;
-    }
-
-    public boolean isActiveTenantOnService(String domainName) throws Exception {
-        boolean state = false;
-        for (TenantDataBean tenant : getAllActiveTenantList()) {
-            if (tenant.getDomain().equalsIgnoreCase(domainName)) {
-                return true;
-            }
-        }
-        return state;
-    }
-}
\ No newline at end of file


[2/3] committing refactored tenant activity component

Posted by is...@apache.org.
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