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 18:51:40 UTC

[05/45] fixing component version issues and adding currently refactored components to the parent pom

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.tenant.mgt.email.sender/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/email/sender/util/TenantMgtEmailSenderUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.email.sender/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/email/sender/util/TenantMgtEmailSenderUtil.java b/components/org.apache.stratos.tenant.mgt.email.sender/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/email/sender/util/TenantMgtEmailSenderUtil.java
deleted file mode 100644
index 6b64019..0000000
--- a/components/org.apache.stratos.tenant.mgt.email.sender/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/email/sender/util/TenantMgtEmailSenderUtil.java
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.stratos.tenant.mgt.email.sender.util;
-
-import org.apache.stratos.tenant.mgt.email.sender.internal.DataHolder;
-import org.wso2.carbon.email.sender.api.EmailSender;
-import org.wso2.carbon.email.sender.api.EmailSenderConfiguration;
-import org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber;
-import org.wso2.carbon.email.verification.util.EmailVerifierConfig;
-import org.wso2.carbon.registry.core.RegistryConstants;
-import org.wso2.carbon.registry.core.Resource;
-import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.registry.core.session.UserRegistry;
-import org.wso2.carbon.registry.core.utils.UUIDGenerator;
-import org.wso2.carbon.stratos.common.beans.TenantInfoBean;
-import org.wso2.carbon.stratos.common.constants.StratosConstants;
-import org.wso2.carbon.stratos.common.util.ClaimsMgtUtil;
-import org.wso2.carbon.stratos.common.util.CommonUtil;
-import org.wso2.carbon.user.api.Tenant;
-import org.wso2.carbon.user.core.tenant.TenantManager;
-import org.wso2.carbon.utils.AuthenticationObserver;
-import org.wso2.carbon.utils.CarbonUtils;
-import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * Utility methods for the email sender component
- */
-public class TenantMgtEmailSenderUtil {
-
-    private static final Log log = LogFactory.getLog(TenantMgtEmailSenderUtil.class);
-    
-    private static EmailSender successMsgSender;
-    private static EmailSender tenantCreationNotifier;
-    private static EmailSender tenantActivationNotifier;
-    private static EmailSender passwordResetMsgSender;
-    private static EmailVerifierConfig emailVerifierConfig;
-    private static EmailVerifierConfig superTenantEmailVerifierConfig = null;
-    
-    public static void init() {
-        initTenantActivatedEmailSender();
-        initSuperTenantNotificationEmailSender();
-        initEmailVerificationSender();
-        initPasswordResetEmailSender();
-    }
-    
-    /**
-     * Sends validation mail to the tenant admin upon the tenant creation
-     *
-     * @param tenantInfoBean    - registered tenant's details
-     * @throws Exception, if the sending mail failed
-     */
-    public static void sendTenantCreationVerification(
-                                              TenantInfoBean tenantInfoBean) throws Exception {
-        String confirmationKey = generateConfirmationKey(tenantInfoBean,
-                DataHolder.getRegistryService().getConfigSystemRegistry(
-                        MultitenantConstants.SUPER_TENANT_ID));
-
-        if (CommonUtil.isTenantActivationModerated()) {
-            requestSuperTenantModeration(tenantInfoBean, confirmationKey);
-        } else {
-            //request for verification
-            requestUserVerification(tenantInfoBean, confirmationKey);
-        }
-    }
-    
-    /**
-     * Emails the tenant admin notifying the account creation.
-     *
-     * @param tenantId tenant Id
-     */
-    public static void notifyTenantInitialActivation(int tenantId) {
-        TenantManager tenantManager = DataHolder.getTenantManager();
-        String firstName = "";
-        String domainName = "";
-        String adminName = "";
-        String email = "";
-        try {
-            Tenant tenant = tenantManager.getTenant(tenantId);
-            domainName = tenant.getDomain();
-            firstName = ClaimsMgtUtil.getFirstName(DataHolder.getRealmService(), tenantId);
-            adminName = tenant.getAdminName();
-            email = tenant.getEmail(); 
-        } catch (Exception e) {
-            String msg = "Unable to get the tenant with the tenant domain";
-            log.error(msg, e);
-            // just catch from here.
-        }
-
-        // load the mail configuration
-        Map<String, String> userParams = new HashMap<String, String>();
-        userParams.put("first-name", firstName);
-        userParams.put("user-name", adminName);
-        userParams.put("domain-name", domainName);
-
-        try {
-            successMsgSender.sendEmail(email, userParams);
-        } catch (Exception e) {
-            // just catch from here..
-            String msg = "Error in sending the notification email.";
-            log.error(msg, e);
-        }
-        
-        // send the notification message to the super tenant
-        notifyTenantActivationToSuperAdmin(domainName, adminName, email);
-    }
-    
-    /**
-     * Emails the super admin notifying the account creation for a new tenant.
-     *
-     * @param tenantInfoBean - tenant details
-     */
-    public static void notifyTenantCreationToSuperAdmin(TenantInfoBean tenantInfoBean) {
-        String notificationEmailAddress = CommonUtil.getNotificationEmailAddress();
-
-        if (notificationEmailAddress.trim().equals("")) {
-            if (log.isDebugEnabled()) {
-                log.debug("No super-admin notification email address is set to notify upon a" +
-                          " tenant registration");
-            }
-            return;
-        }
-
-        Map<String, String> userParams = initializeSuperTenantNotificationParams(
-                tenantInfoBean.getTenantDomain(), tenantInfoBean.getAdmin(), 
-                tenantInfoBean.getEmail());
-
-        try {
-            tenantCreationNotifier.sendEmail(notificationEmailAddress, userParams);
-        } catch (Exception e) {
-            // just catch from here..
-            String msg = "Error in sending the notification email.";
-            log.error(msg, e);
-        }
-    }
-    
-    public static void notifyResetPassword(TenantInfoBean tenantInfoBean) throws Exception {
-        int tenantId = tenantInfoBean.getTenantId();
-        String firstName = ClaimsMgtUtil.getFirstName(DataHolder.getRealmService(), tenantId);
-
-        // load the mail configuration
-        Map<String, String> userParams = new HashMap<String, String>();
-        userParams.put("user-name", tenantInfoBean.getAdmin());
-        userParams.put("first-name", firstName);
-        userParams.put("domain-name", tenantInfoBean.getTenantDomain());
-        userParams.put("password", tenantInfoBean.getAdminPassword());
-
-        try {
-            passwordResetMsgSender.sendEmail(tenantInfoBean.getEmail(), userParams);
-        } catch (Exception e) {
-            // just catch from here..
-            String msg = "Error in sending the notification email.";
-            log.error(msg, e);
-        }
-    }
-    
-    /**
-     * Emails the super admin notifying the account activation for an unactivated tenant.
-     *
-     * @param domainName tenant domain
-     * @param adminName  tenant admin
-     * @param email      tenant's email address
-     */
-    private static void notifyTenantActivationToSuperAdmin(String domainName, String adminName,
-                                                          String email) {
-        String notificationEmailAddress = CommonUtil.getNotificationEmailAddress();
-
-        if (notificationEmailAddress.trim().equals("")) {
-            if (log.isDebugEnabled()) {
-                log.debug("No super-admin notification email address is set to notify upon a"
-                          + " tenant activation");
-            }
-            return;
-        }
-
-        Map<String, String> userParams =
-                initializeSuperTenantNotificationParams(domainName, adminName, email);
-
-        try {
-            tenantActivationNotifier.sendEmail(notificationEmailAddress, userParams);
-        } catch (Exception e) {
-            // just catch from here..
-            String msg = "Error in sending the notification email.";
-            log.error(msg, e);
-        }
-    }
-    
-    /**
-     * generates the confirmation key for the tenant
-     *
-     * @param tenantInfoBean            - tenant details
-     * @param superTenantConfigSystemRegistry
-     *                          - super tenant config system registry.
-     * @return confirmation key
-     * @throws RegistryException if generation of the confirmation key failed.
-     */
-    private static String generateConfirmationKey(TenantInfoBean tenantInfoBean,
-                                                  UserRegistry superTenantConfigSystemRegistry
-                                                  ) throws RegistryException {
-        // generating the confirmation key
-        String confirmationKey = UUIDGenerator.generateUUID();
-        UserRegistry superTenantGovernanceSystemRegistry;
-        try {
-            superTenantGovernanceSystemRegistry =
-                DataHolder.getRegistryService().getGovernanceSystemRegistry(
-                        MultitenantConstants.SUPER_TENANT_ID);
-        } catch (RegistryException e) {
-            String msg = "Exception in getting the governance system registry for the super tenant";
-            log.error(msg, e);
-            throw new RegistryException(msg, e);
-        }
-        Resource resource;
-        String emailVerificationPath = StratosConstants.ADMIN_EMAIL_VERIFICATION_FLAG_PATH +
-                                       RegistryConstants.PATH_SEPARATOR + 
-                                       tenantInfoBean.getTenantId();
-        try {
-            if (superTenantGovernanceSystemRegistry.resourceExists(emailVerificationPath)) {
-                resource = superTenantGovernanceSystemRegistry.get(emailVerificationPath);
-            } else {
-                resource = superTenantGovernanceSystemRegistry.newResource();
-            }
-            resource.setContent(confirmationKey);
-        } catch (RegistryException e) {
-            String msg = "Error in creating the resource or getting the resource" +
-                         "from the email verification path";
-            log.error(msg, e);
-            throw new RegistryException(msg, e);
-        }
-        // email is not validated yet, this prop is used to activate the tenant later.
-        resource.addProperty(StratosConstants.IS_EMAIL_VALIDATED, "false");
-        resource.addProperty(StratosConstants.TENANT_ADMIN, tenantInfoBean.getAdmin());
-        try {
-            superTenantGovernanceSystemRegistry.put(emailVerificationPath, resource);
-        } catch (RegistryException e) {
-            String msg = "Error in putting the resource to the super tenant registry" +
-                         " for the email verification path";
-            log.error(msg, e);
-            throw new RegistryException(msg, e);
-        }
-
-        // Used for * as a Service impl.
-        // Store the cloud service from which the register req. is originated.
-        if (tenantInfoBean.getOriginatedService() != null) {
-            String originatedServicePath =
-                    StratosConstants.ORIGINATED_SERVICE_PATH +
-                    StratosConstants.PATH_SEPARATOR +
-                    StratosConstants.ORIGINATED_SERVICE +
-                    StratosConstants.PATH_SEPARATOR + tenantInfoBean.getTenantId();
-            try {
-                Resource origServiceRes = superTenantConfigSystemRegistry.newResource();
-                origServiceRes.setContent(tenantInfoBean.getOriginatedService());
-                superTenantGovernanceSystemRegistry.put(originatedServicePath, origServiceRes);
-            } catch (RegistryException e) {
-                String msg = "Error in putting the originated service resource "
-                             + "to the governance registry";
-                log.error(msg, e);
-                throw new RegistryException(msg, e);
-            }
-        }
-        initializeRegistry(tenantInfoBean.getTenantId());
-        if (log.isDebugEnabled()) {
-            log.debug("Successfully generated the confirmation key.");
-        }
-        return confirmationKey;
-    }
-    
-    /**
-     * Sends mail for the super tenant for the account moderation. Once super tenant clicks the
-     * link provided in the email, the tenant will be activated.
-     *
-     * @param tenantInfoBean      - the tenant who registered an account
-     * @param confirmationKey confirmation key.
-     * @throws Exception if an exception is thrown from EmailVerificationSubscriber.
-     */
-    private static void requestSuperTenantModeration(TenantInfoBean tenantInfoBean, 
-                                                       String confirmationKey) throws Exception {
-        try {
-            Map<String, String> dataToStore = new HashMap<String, String>();
-            dataToStore.put("email", CommonUtil.getSuperAdminEmail());
-            dataToStore.put("first-name", tenantInfoBean.getFirstname());
-            dataToStore.put("userName", tenantInfoBean.getAdmin());
-            dataToStore.put("tenantDomain", tenantInfoBean.getTenantDomain());
-            dataToStore.put("confirmationKey", confirmationKey);
-
-            DataHolder.getEmailVerificationService().requestUserVerification(
-                    dataToStore, superTenantEmailVerifierConfig);
-            if (log.isDebugEnabled()) {
-                log.debug("Email verification for the tenant registration.");
-            }
-        } catch (Exception e) {
-            String msg = "Error in notifying the super tenant on the account creation for " +
-                         "the domain: " + tenantInfoBean.getTenantDomain();
-            log.error(msg);
-            throw new Exception(msg, e);
-        }
-    }
-    
-    /**
-     * request email verification from the user.
-     *
-     * @param tenantInfoBean - Tenant information
-     * @param confirmationKey confirmation key.
-     * @throws Exception if an exception is thrown from EmailVerificationSubscriber.
-     */
-    private static void requestUserVerification(TenantInfoBean tenantInfoBean, 
-                                                String confirmationKey) throws Exception {
-        try {
-            Map<String, String> dataToStore = new HashMap<String, String>();
-            dataToStore.put("email", tenantInfoBean.getEmail());
-            dataToStore.put("first-name", tenantInfoBean.getFirstname());
-            dataToStore.put("userName", tenantInfoBean.getAdmin());
-            dataToStore.put("tenantDomain", tenantInfoBean.getTenantDomain());
-            dataToStore.put("confirmationKey", confirmationKey);
-
-            EmailVerifcationSubscriber emailVerifier = DataHolder.getEmailVerificationService();
-            emailVerifier.requestUserVerification(dataToStore, emailVerifierConfig);
-            if (log.isDebugEnabled()) {
-                log.debug("Email verification for the tenant registration.");
-            }
-        } catch (Exception e) {
-            String msg = "Error in notifying tenant of domain: " + tenantInfoBean.getTenantDomain();
-            log.error(msg);
-            throw new Exception(msg, e);
-        }
-    }
-    
-    /**
-     * Initializes the registry for the tenant.
-     *
-     * @param tenantId tenant id.
-     */
-    private static void initializeRegistry(int tenantId) {
-        BundleContext bundleContext = DataHolder.getBundleContext();
-        if (bundleContext != null) {
-            ServiceTracker tracker =
-                    new ServiceTracker(bundleContext,
-                                       AuthenticationObserver.class.getName(),
-                                       null);
-            tracker.open();
-            Object[] services = tracker.getServices();
-            if (services != null) {
-                for (Object service : services) {
-                    ((AuthenticationObserver) service).startedAuthentication(tenantId);
-                }
-            }
-            tracker.close();
-        }
-    }
-    
-    /**
-     * loads the notification configurations for the mail to super tenant for account creations
-     * and activations.
-     */
-    private static void initSuperTenantNotificationEmailSender() {
-        // Tenant Registration Email Configurations
-        String tenantRegistrationEmailConfFile =
-                CarbonUtils.getCarbonConfigDirPath() + File.separator +
-                        StratosConstants.EMAIL_CONFIG + File.separator +
-                        "email-new-tenant-registration.xml";
-        EmailSenderConfiguration newTenantRegistrationEmailConf =
-                EmailSenderConfiguration.loadEmailSenderConfiguration(
-                        tenantRegistrationEmailConfFile);
-        tenantCreationNotifier = new EmailSender(newTenantRegistrationEmailConf);
-
-        // Tenant Activation Email Configurations
-        String tenantActivationEmailConfFile =
-                CarbonUtils.getCarbonConfigDirPath() + File.separator +
-                        StratosConstants.EMAIL_CONFIG + File.separator +
-                        "email-new-tenant-activation.xml";
-        EmailSenderConfiguration newTenantActivationEmailConf =
-                EmailSenderConfiguration
-                        .loadEmailSenderConfiguration(tenantActivationEmailConfFile);
-        tenantActivationNotifier = new EmailSender(newTenantActivationEmailConf);
-    }
-    
-    /**
-     * loads the Email configuration files to be sent on the tenant registrations.
-     */
-    private static void initEmailVerificationSender() {
-        String confXml =
-                CarbonUtils.getCarbonConfigDirPath() + File.separator +
-                        StratosConstants.EMAIL_CONFIG + File.separator + "email-registration.xml";
-        try {
-            emailVerifierConfig = org.wso2.carbon.email.verification.util.Util
-                            .loadeMailVerificationConfig(confXml);
-        } catch (Exception e) {
-            String msg = "Email Registration Configuration file not found. "
-                            + "Pls check the repository/conf/email folder.";
-            log.error(msg);
-        }
-        String superTenantConfXml =
-                CarbonUtils.getCarbonConfigDirPath() + File.separator +
-                        StratosConstants.EMAIL_CONFIG + File.separator +
-                        "email-registration-moderation.xml";
-        try {
-            superTenantEmailVerifierConfig = org.wso2.carbon.email.verification.util.Util
-                            .loadeMailVerificationConfig(superTenantConfXml);
-        } catch (Exception e) {
-            String msg =
-                    "Email Moderation Configuration file not found. "
-                            + "Pls check the repository/conf/email folder.";
-            log.error(msg);
-        }
-    }
-
-    /**
-     * loads the Email configuration files to be sent on the tenant activations.
-     */
-    private static void initTenantActivatedEmailSender() {
-        String confFilename =
-                CarbonUtils.getCarbonConfigDirPath() + File.separator +
-                        StratosConstants.EMAIL_CONFIG + File.separator +
-                        "email-registration-complete.xml";
-        EmailSenderConfiguration successMsgConfig =
-                EmailSenderConfiguration.loadEmailSenderConfiguration(confFilename);
-        successMsgSender = new EmailSender(successMsgConfig);
-    }
-
-    private static void initPasswordResetEmailSender() {
-        String passwordResetConfigFileName = CarbonUtils.getCarbonConfigDirPath()+ File.separator + 
-                StratosConstants.EMAIL_CONFIG + File.separator + "email-password-reset.xml";
-        EmailSenderConfiguration passwordResetMsgConfig =
-            EmailSenderConfiguration.loadEmailSenderConfiguration(passwordResetConfigFileName);
-        passwordResetMsgSender = new EmailSender(passwordResetMsgConfig);
-    }
-
-    /**
-     * Initializes the super tenant notification parameters
-     *
-     * @param domainName - tenant domain
-     * @param adminName  - tenant admin
-     * @param email      - tenant email
-     * @return the parameters
-     */
-    private static Map<String, String> initializeSuperTenantNotificationParams(
-            String domainName, String adminName, String email) {
-        TenantManager tenantManager = DataHolder.getTenantManager();
-        String firstName = "";
-        String lastName = "";
-        try {
-            int tenantId = tenantManager.getTenantId(domainName);
-            firstName = ClaimsMgtUtil.getFirstName(DataHolder.getRealmService(), tenantId);
-            lastName = ClaimsMgtUtil.getLastName(DataHolder.getRealmService(), tenantId);
-
-        } catch (Exception e) {
-            String msg = "Unable to get the tenant with the tenant domain";
-            log.error(msg, e);
-            // just catch from here.
-        }
-
-        // load the mail configuration
-        Map<String, String> userParams = new HashMap<String, String>();
-        userParams.put("user-name", adminName);
-        userParams.put("domain-name", domainName);
-        userParams.put("email-address", email);
-        userParams.put("first-name", firstName);
-        userParams.put("last-name", lastName);
-        return userParams;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.tenant.mgt.email.sender/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.email.sender/pom.xml b/components/org.apache.stratos.tenant.mgt.email.sender/pom.xml
new file mode 100644
index 0000000..ab9adcb
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.email.sender/pom.xml
@@ -0,0 +1,105 @@
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.apache.stratos</groupId>
+        <artifactId>stratos-components-parent</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>org.apache.stratos.tenant.mgt.email.sender</artifactId>
+    <packaging>bundle</packaging>
+    <name>Apache Stratos - Tenant Management Email Sender Component</name>
+
+    <build>
+
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+                        <Bundle-Name>${project.artifactId}</Bundle-Name>
+                        <Private-Package>
+                            org.apache.stratos.tenant.mgt.email.sender.internal.*,
+                            org.apache.stratos.tenant.mgt.email.sender.util.*,
+                        </Private-Package>
+                        <Export-Package>
+                            org.apache.stratos.tenant.mgt.email.sender.listener.*
+                        </Export-Package>
+                        <Import-Package>
+                            !javax.xml.namespace,
+                            javax.xml.namespace; version=0.0.0,
+                            org.wso2.carbon.email.sender.api,
+                            *;resolution:=optional
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.axis2.wso2</groupId>
+            <artifactId>axis2</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+	    <version>1.2.13</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.common</artifactId>
+	    <version>${apache.stratos.version}</version>
+        </dependency>
+        <dependency>
+           <groupId>org.wso2.carbon</groupId>
+           <artifactId>org.wso2.carbon.email.verification</artifactId>
+	   <version>4.1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.registry.core</artifactId>
+	    <version>${wso2carbon.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+	    <version>1.1.1</version>
+        </dependency>
+        <dependency>
+            <groupId>org.wso2.carbon</groupId>
+            <artifactId>org.wso2.carbon.email.sender</artifactId>
+            <version>2.1.0</version>
+        </dependency>
+    </dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/internal/DataHolder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/internal/DataHolder.java b/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/internal/DataHolder.java
new file mode 100644
index 0000000..99710c9
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/internal/DataHolder.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.stratos.tenant.mgt.email.sender.internal;
+
+import org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber;
+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.api.RealmConfiguration;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.user.core.tenant.TenantManager;
+import org.wso2.carbon.utils.ConfigurationContextService;
+
+import org.apache.axis2.context.ConfigurationContext;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * Utility methods for the email sender component
+ */
+public class DataHolder {
+
+    private static RegistryService registryService;
+    private static RealmService realmService;
+    private static ConfigurationContextService configurationContextService;
+    private static EmailVerifcationSubscriber emailVerificationService;
+    private static BundleContext bundleContext;
+
+    public static BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    public static void setBundleContext(BundleContext bundleContext) {
+        DataHolder.bundleContext = bundleContext;
+    }
+
+    public static ConfigurationContextService getConfigurationContextService() {
+        return configurationContextService;
+    }
+
+    public static void setConfigurationContextService(
+            ConfigurationContextService configurationContextService) {
+        DataHolder.configurationContextService = configurationContextService;
+    }
+
+    public static ConfigurationContext getConfigurationContext() {
+        return configurationContextService.getServerConfigContext();
+    }
+
+    public static synchronized void setRegistryService(RegistryService service) {
+        if ((registryService == null) || (service == null)) {
+            registryService = service;
+        }
+    }
+
+    public static RegistryService getRegistryService() {
+        return registryService;
+    }
+
+    public static synchronized void setRealmService(RealmService service) {
+        if ((realmService == null) || (service == null)){
+            realmService = service;
+        }
+    }
+
+    public static RealmService getRealmService() {
+        return realmService;
+    }
+
+    public static TenantManager getTenantManager() {
+        return realmService.getTenantManager();
+    }
+
+    public static RealmConfiguration getBootstrapRealmConfiguration() {
+        return realmService.getBootstrapRealmConfiguration();
+    }
+
+    public static UserRegistry getGovernanceSystemRegistry(int tenantId) throws RegistryException {
+        return registryService.getGovernanceSystemRegistry(tenantId);
+    }
+    
+    public static void setEmailVerificationService(EmailVerifcationSubscriber emailService) {
+        if ((emailVerificationService == null) || (emailService == null)){
+            emailVerificationService = emailService;
+        }
+    }
+    
+    public static EmailVerifcationSubscriber getEmailVerificationService() {
+        return emailVerificationService;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/internal/TenantMgtEmailSenderServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/internal/TenantMgtEmailSenderServiceComponent.java b/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/internal/TenantMgtEmailSenderServiceComponent.java
new file mode 100644
index 0000000..5226897
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/internal/TenantMgtEmailSenderServiceComponent.java
@@ -0,0 +1,106 @@
+/*
+*       Licensed to the Apache Software Foundation (ASF) under one
+*       or more contributor license agreements.  See the NOTICE file
+*       distributed with this work for additional information
+*       regarding copyright ownership.  The ASF licenses this file
+*       to you under the Apache License, Version 2.0 (the
+*       "License"); you may not use this file except in compliance
+*       with the License.  You may obtain a copy of the License at
+*
+*         http://www.apache.org/licenses/LICENSE-2.0
+*
+*       Unless required by applicable law or agreed to in writing,
+*       software distributed under the License is distributed on an
+*       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+*       KIND, either express or implied.  See the License for the
+*       specific language governing permissions and limitations
+*       under the License.
+*/
+package org.apache.stratos.tenant.mgt.email.sender.internal;
+
+import org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber;
+import org.wso2.carbon.registry.core.service.RegistryService;
+import org.apache.stratos.common.util.CommonUtil;
+import org.apache.stratos.tenant.mgt.email.sender.listener.EmailSenderListener;
+import org.apache.stratos.tenant.mgt.email.sender.util.TenantMgtEmailSenderUtil;
+import org.wso2.carbon.user.core.service.RealmService;
+import org.wso2.carbon.utils.ConfigurationContextService;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * @scr.component name="org.apache.stratos.tenant.mgt.email.sender"
+ * 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="configuration.context.service"
+ * interface="org.wso2.carbon.utils.ConfigurationContextService" cardinality="1..1"
+ * policy="dynamic" bind="setConfigurationContextService" unbind="unsetConfigurationContextService"
+ * @scr.reference name="emailverification.service" 
+ * interface= "org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber"
+ * cardinality="1..1" policy="dynamic"
+ * bind="setEmailVerificationService" unbind="unsetEmailVerificationService"
+ */
+public class TenantMgtEmailSenderServiceComponent {
+    private static Log log = LogFactory.getLog(TenantMgtEmailSenderServiceComponent.class);
+
+    protected void activate(ComponentContext context) {
+        try {
+            DataHolder.setBundleContext(context.getBundleContext());
+            if (!CommonUtil.isTenantManagementEmailsDisabled()) {
+                TenantMgtEmailSenderUtil.init();
+                EmailSenderListener emailSenderListener = new EmailSenderListener();
+                context.getBundleContext().registerService(
+                        org.apache.stratos.common.listeners.TenantMgtListener.class.getName(),
+                        emailSenderListener, null);
+                log.debug("******* Tenant Management Emails are enabled ******* ");
+            }
+            log.debug("******* Tenant Registration Email Sender bundle is activated ******* ");
+        } catch (Throwable e) {
+            log.error("******* Tenant Registration Email Sender bundle failed activating ****", e);
+        }
+    }
+
+    protected void deactivate(ComponentContext context) {
+        log.debug("******* Email Sender bundle is deactivated ******* ");
+    }
+
+    protected void setRegistryService(RegistryService registryService) {
+        DataHolder.setRegistryService(registryService);
+    }
+
+    protected void unsetRegistryService(RegistryService registryService) {
+        DataHolder.setRegistryService(null);
+    }
+
+    protected void setRealmService(RealmService realmService) {
+        DataHolder.setRealmService(realmService);
+    }
+
+    protected void unsetRealmService(RealmService realmService) {
+        DataHolder.setRealmService(null);
+    }
+
+    protected void setConfigurationContextService(ConfigurationContextService service) {
+        DataHolder.setConfigurationContextService(service);
+    }
+
+    protected void unsetConfigurationContextService(ConfigurationContextService service) {
+        DataHolder.setConfigurationContextService(null);
+    }
+
+    protected void setEmailVerificationService(EmailVerifcationSubscriber emailService) {
+        DataHolder.setEmailVerificationService(emailService);
+    }
+
+    protected void unsetEmailVerificationService(EmailVerifcationSubscriber emailService) {
+        DataHolder.setEmailVerificationService(null);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/listener/EmailSenderListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/listener/EmailSenderListener.java b/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/listener/EmailSenderListener.java
new file mode 100644
index 0000000..8e01c13
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/listener/EmailSenderListener.java
@@ -0,0 +1,70 @@
+package org.apache.stratos.tenant.mgt.email.sender.listener;
+
+import org.apache.stratos.common.beans.TenantInfoBean;
+import org.apache.stratos.common.exception.StratosException;
+import org.apache.stratos.common.listeners.TenantMgtListener;
+import org.apache.stratos.tenant.mgt.email.sender.util.TenantMgtEmailSenderUtil;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class EmailSenderListener implements TenantMgtListener {
+    
+    private static final int EXEC_ORDER = 20;
+    private static final Log log = LogFactory.getLog(EmailSenderListener.class);
+
+    public void onTenantCreate(TenantInfoBean tenantInfoBean) throws StratosException {
+        try {
+            TenantMgtEmailSenderUtil.sendTenantCreationVerification(tenantInfoBean);
+        } catch (Exception e) {
+            String message = "Error sending tenant creation Mail to tenant domain " 
+                + tenantInfoBean.getTenantDomain();
+            log.error(message, e);
+            throw new StratosException(message, e);
+        }
+        TenantMgtEmailSenderUtil.notifyTenantCreationToSuperAdmin(tenantInfoBean);
+    }
+
+    public int getListenerOrder() {
+        return EXEC_ORDER;
+    }
+
+    public void onTenantRename(int tenantId, String oldDomainName, 
+                             String newDomainName) throws StratosException {
+        // Do nothing. 
+
+    }
+
+    public void onTenantUpdate(TenantInfoBean tenantInfoBean) throws StratosException {
+        if ((tenantInfoBean.getAdminPassword() != null) && 
+                (!tenantInfoBean.getAdminPassword().equals(""))) {
+            try {
+                TenantMgtEmailSenderUtil.notifyResetPassword(tenantInfoBean);
+            } catch (Exception e) {
+                String message = "Error sending tenant update Mail to tenant domain " 
+                    + tenantInfoBean.getTenantDomain();
+                log.error(message, e);
+                throw new StratosException(message, e);
+            }
+        }
+    }
+
+    public void onTenantInitialActivation(int tenantId) throws StratosException {
+     // send the notification message to the tenant admin
+        TenantMgtEmailSenderUtil.notifyTenantInitialActivation(tenantId);
+    }
+
+    public void onTenantActivation(int tenantId) throws StratosException {
+        // Do nothing. 
+    }
+
+    public void onTenantDeactivation(int tenantId) throws StratosException {
+        // Do nothing. 
+    }
+
+    public void onSubscriptionPlanChange(int tenentId, String oldPlan, 
+                                         String newPlan) throws StratosException {
+        // Do nothing. 
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/util/TenantMgtEmailSenderUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/util/TenantMgtEmailSenderUtil.java b/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/util/TenantMgtEmailSenderUtil.java
new file mode 100644
index 0000000..8fb9358
--- /dev/null
+++ b/components/org.apache.stratos.tenant.mgt.email.sender/src/main/java/org/apache/stratos/tenant/mgt/email/sender/util/TenantMgtEmailSenderUtil.java
@@ -0,0 +1,482 @@
+/*
+ * Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.stratos.tenant.mgt.email.sender.util;
+
+import org.apache.stratos.tenant.mgt.email.sender.internal.DataHolder;
+import org.wso2.carbon.email.sender.api.EmailSender;
+import org.wso2.carbon.email.sender.api.EmailSenderConfiguration;
+import org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber;
+import org.wso2.carbon.email.verification.util.EmailVerifierConfig;
+import org.wso2.carbon.registry.core.RegistryConstants;
+import org.wso2.carbon.registry.core.Resource;
+import org.wso2.carbon.registry.core.exceptions.RegistryException;
+import org.wso2.carbon.registry.core.session.UserRegistry;
+import org.wso2.carbon.registry.core.utils.UUIDGenerator;
+import org.apache.stratos.common.beans.TenantInfoBean;
+import org.apache.stratos.common.constants.StratosConstants;
+import org.apache.stratos.common.util.ClaimsMgtUtil;
+import org.apache.stratos.common.util.CommonUtil;
+import org.wso2.carbon.user.api.Tenant;
+import org.wso2.carbon.user.core.tenant.TenantManager;
+import org.wso2.carbon.utils.AuthenticationObserver;
+import org.wso2.carbon.utils.CarbonUtils;
+import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * Utility methods for the email sender component
+ */
+public class TenantMgtEmailSenderUtil {
+
+    private static final Log log = LogFactory.getLog(TenantMgtEmailSenderUtil.class);
+    
+    private static EmailSender successMsgSender;
+    private static EmailSender tenantCreationNotifier;
+    private static EmailSender tenantActivationNotifier;
+    private static EmailSender passwordResetMsgSender;
+    private static EmailVerifierConfig emailVerifierConfig;
+    private static EmailVerifierConfig superTenantEmailVerifierConfig = null;
+    
+    public static void init() {
+        initTenantActivatedEmailSender();
+        initSuperTenantNotificationEmailSender();
+        initEmailVerificationSender();
+        initPasswordResetEmailSender();
+    }
+    
+    /**
+     * Sends validation mail to the tenant admin upon the tenant creation
+     *
+     * @param tenantInfoBean    - registered tenant's details
+     * @throws Exception, if the sending mail failed
+     */
+    public static void sendTenantCreationVerification(
+                                              TenantInfoBean tenantInfoBean) throws Exception {
+        String confirmationKey = generateConfirmationKey(tenantInfoBean,
+                DataHolder.getRegistryService().getConfigSystemRegistry(
+                        MultitenantConstants.SUPER_TENANT_ID));
+
+        if (CommonUtil.isTenantActivationModerated()) {
+            requestSuperTenantModeration(tenantInfoBean, confirmationKey);
+        } else {
+            //request for verification
+            requestUserVerification(tenantInfoBean, confirmationKey);
+        }
+    }
+    
+    /**
+     * Emails the tenant admin notifying the account creation.
+     *
+     * @param tenantId tenant Id
+     */
+    public static void notifyTenantInitialActivation(int tenantId) {
+        TenantManager tenantManager = DataHolder.getTenantManager();
+        String firstName = "";
+        String domainName = "";
+        String adminName = "";
+        String email = "";
+        try {
+            Tenant tenant = tenantManager.getTenant(tenantId);
+            domainName = tenant.getDomain();
+            firstName = ClaimsMgtUtil.getFirstName(DataHolder.getRealmService(), tenantId);
+            adminName = tenant.getAdminName();
+            email = tenant.getEmail(); 
+        } catch (Exception e) {
+            String msg = "Unable to get the tenant with the tenant domain";
+            log.error(msg, e);
+            // just catch from here.
+        }
+
+        // load the mail configuration
+        Map<String, String> userParams = new HashMap<String, String>();
+        userParams.put("first-name", firstName);
+        userParams.put("user-name", adminName);
+        userParams.put("domain-name", domainName);
+
+        try {
+            successMsgSender.sendEmail(email, userParams);
+        } catch (Exception e) {
+            // just catch from here..
+            String msg = "Error in sending the notification email.";
+            log.error(msg, e);
+        }
+        
+        // send the notification message to the super tenant
+        notifyTenantActivationToSuperAdmin(domainName, adminName, email);
+    }
+    
+    /**
+     * Emails the super admin notifying the account creation for a new tenant.
+     *
+     * @param tenantInfoBean - tenant details
+     */
+    public static void notifyTenantCreationToSuperAdmin(TenantInfoBean tenantInfoBean) {
+        String notificationEmailAddress = CommonUtil.getNotificationEmailAddress();
+
+        if (notificationEmailAddress.trim().equals("")) {
+            if (log.isDebugEnabled()) {
+                log.debug("No super-admin notification email address is set to notify upon a" +
+                          " tenant registration");
+            }
+            return;
+        }
+
+        Map<String, String> userParams = initializeSuperTenantNotificationParams(
+                tenantInfoBean.getTenantDomain(), tenantInfoBean.getAdmin(), 
+                tenantInfoBean.getEmail());
+
+        try {
+            tenantCreationNotifier.sendEmail(notificationEmailAddress, userParams);
+        } catch (Exception e) {
+            // just catch from here..
+            String msg = "Error in sending the notification email.";
+            log.error(msg, e);
+        }
+    }
+    
+    public static void notifyResetPassword(TenantInfoBean tenantInfoBean) throws Exception {
+        int tenantId = tenantInfoBean.getTenantId();
+        String firstName = ClaimsMgtUtil.getFirstName(DataHolder.getRealmService(), tenantId);
+
+        // load the mail configuration
+        Map<String, String> userParams = new HashMap<String, String>();
+        userParams.put("user-name", tenantInfoBean.getAdmin());
+        userParams.put("first-name", firstName);
+        userParams.put("domain-name", tenantInfoBean.getTenantDomain());
+        userParams.put("password", tenantInfoBean.getAdminPassword());
+
+        try {
+            passwordResetMsgSender.sendEmail(tenantInfoBean.getEmail(), userParams);
+        } catch (Exception e) {
+            // just catch from here..
+            String msg = "Error in sending the notification email.";
+            log.error(msg, e);
+        }
+    }
+    
+    /**
+     * Emails the super admin notifying the account activation for an unactivated tenant.
+     *
+     * @param domainName tenant domain
+     * @param adminName  tenant admin
+     * @param email      tenant's email address
+     */
+    private static void notifyTenantActivationToSuperAdmin(String domainName, String adminName,
+                                                          String email) {
+        String notificationEmailAddress = CommonUtil.getNotificationEmailAddress();
+
+        if (notificationEmailAddress.trim().equals("")) {
+            if (log.isDebugEnabled()) {
+                log.debug("No super-admin notification email address is set to notify upon a"
+                          + " tenant activation");
+            }
+            return;
+        }
+
+        Map<String, String> userParams =
+                initializeSuperTenantNotificationParams(domainName, adminName, email);
+
+        try {
+            tenantActivationNotifier.sendEmail(notificationEmailAddress, userParams);
+        } catch (Exception e) {
+            // just catch from here..
+            String msg = "Error in sending the notification email.";
+            log.error(msg, e);
+        }
+    }
+    
+    /**
+     * generates the confirmation key for the tenant
+     *
+     * @param tenantInfoBean            - tenant details
+     * @param superTenantConfigSystemRegistry
+     *                          - super tenant config system registry.
+     * @return confirmation key
+     * @throws RegistryException if generation of the confirmation key failed.
+     */
+    private static String generateConfirmationKey(TenantInfoBean tenantInfoBean,
+                                                  UserRegistry superTenantConfigSystemRegistry
+                                                  ) throws RegistryException {
+        // generating the confirmation key
+        String confirmationKey = UUIDGenerator.generateUUID();
+        UserRegistry superTenantGovernanceSystemRegistry;
+        try {
+            superTenantGovernanceSystemRegistry =
+                DataHolder.getRegistryService().getGovernanceSystemRegistry(
+                        MultitenantConstants.SUPER_TENANT_ID);
+        } catch (RegistryException e) {
+            String msg = "Exception in getting the governance system registry for the super tenant";
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+        Resource resource;
+        String emailVerificationPath = StratosConstants.ADMIN_EMAIL_VERIFICATION_FLAG_PATH +
+                                       RegistryConstants.PATH_SEPARATOR + 
+                                       tenantInfoBean.getTenantId();
+        try {
+            if (superTenantGovernanceSystemRegistry.resourceExists(emailVerificationPath)) {
+                resource = superTenantGovernanceSystemRegistry.get(emailVerificationPath);
+            } else {
+                resource = superTenantGovernanceSystemRegistry.newResource();
+            }
+            resource.setContent(confirmationKey);
+        } catch (RegistryException e) {
+            String msg = "Error in creating the resource or getting the resource" +
+                         "from the email verification path";
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+        // email is not validated yet, this prop is used to activate the tenant later.
+        resource.addProperty(StratosConstants.IS_EMAIL_VALIDATED, "false");
+        resource.addProperty(StratosConstants.TENANT_ADMIN, tenantInfoBean.getAdmin());
+        try {
+            superTenantGovernanceSystemRegistry.put(emailVerificationPath, resource);
+        } catch (RegistryException e) {
+            String msg = "Error in putting the resource to the super tenant registry" +
+                         " for the email verification path";
+            log.error(msg, e);
+            throw new RegistryException(msg, e);
+        }
+
+        // Used for * as a Service impl.
+        // Store the cloud service from which the register req. is originated.
+        if (tenantInfoBean.getOriginatedService() != null) {
+            String originatedServicePath =
+                    StratosConstants.ORIGINATED_SERVICE_PATH +
+                    StratosConstants.PATH_SEPARATOR +
+                    StratosConstants.ORIGINATED_SERVICE +
+                    StratosConstants.PATH_SEPARATOR + tenantInfoBean.getTenantId();
+            try {
+                Resource origServiceRes = superTenantConfigSystemRegistry.newResource();
+                origServiceRes.setContent(tenantInfoBean.getOriginatedService());
+                superTenantGovernanceSystemRegistry.put(originatedServicePath, origServiceRes);
+            } catch (RegistryException e) {
+                String msg = "Error in putting the originated service resource "
+                             + "to the governance registry";
+                log.error(msg, e);
+                throw new RegistryException(msg, e);
+            }
+        }
+        initializeRegistry(tenantInfoBean.getTenantId());
+        if (log.isDebugEnabled()) {
+            log.debug("Successfully generated the confirmation key.");
+        }
+        return confirmationKey;
+    }
+    
+    /**
+     * Sends mail for the super tenant for the account moderation. Once super tenant clicks the
+     * link provided in the email, the tenant will be activated.
+     *
+     * @param tenantInfoBean      - the tenant who registered an account
+     * @param confirmationKey confirmation key.
+     * @throws Exception if an exception is thrown from EmailVerificationSubscriber.
+     */
+    private static void requestSuperTenantModeration(TenantInfoBean tenantInfoBean, 
+                                                       String confirmationKey) throws Exception {
+        try {
+            Map<String, String> dataToStore = new HashMap<String, String>();
+            dataToStore.put("email", CommonUtil.getSuperAdminEmail());
+            dataToStore.put("first-name", tenantInfoBean.getFirstname());
+            dataToStore.put("userName", tenantInfoBean.getAdmin());
+            dataToStore.put("tenantDomain", tenantInfoBean.getTenantDomain());
+            dataToStore.put("confirmationKey", confirmationKey);
+
+            DataHolder.getEmailVerificationService().requestUserVerification(
+                    dataToStore, superTenantEmailVerifierConfig);
+            if (log.isDebugEnabled()) {
+                log.debug("Email verification for the tenant registration.");
+            }
+        } catch (Exception e) {
+            String msg = "Error in notifying the super tenant on the account creation for " +
+                         "the domain: " + tenantInfoBean.getTenantDomain();
+            log.error(msg);
+            throw new Exception(msg, e);
+        }
+    }
+    
+    /**
+     * request email verification from the user.
+     *
+     * @param tenantInfoBean - Tenant information
+     * @param confirmationKey confirmation key.
+     * @throws Exception if an exception is thrown from EmailVerificationSubscriber.
+     */
+    private static void requestUserVerification(TenantInfoBean tenantInfoBean, 
+                                                String confirmationKey) throws Exception {
+        try {
+            Map<String, String> dataToStore = new HashMap<String, String>();
+            dataToStore.put("email", tenantInfoBean.getEmail());
+            dataToStore.put("first-name", tenantInfoBean.getFirstname());
+            dataToStore.put("userName", tenantInfoBean.getAdmin());
+            dataToStore.put("tenantDomain", tenantInfoBean.getTenantDomain());
+            dataToStore.put("confirmationKey", confirmationKey);
+
+            EmailVerifcationSubscriber emailVerifier = DataHolder.getEmailVerificationService();
+            emailVerifier.requestUserVerification(dataToStore, emailVerifierConfig);
+            if (log.isDebugEnabled()) {
+                log.debug("Email verification for the tenant registration.");
+            }
+        } catch (Exception e) {
+            String msg = "Error in notifying tenant of domain: " + tenantInfoBean.getTenantDomain();
+            log.error(msg);
+            throw new Exception(msg, e);
+        }
+    }
+    
+    /**
+     * Initializes the registry for the tenant.
+     *
+     * @param tenantId tenant id.
+     */
+    private static void initializeRegistry(int tenantId) {
+        BundleContext bundleContext = DataHolder.getBundleContext();
+        if (bundleContext != null) {
+            ServiceTracker tracker =
+                    new ServiceTracker(bundleContext,
+                                       AuthenticationObserver.class.getName(),
+                                       null);
+            tracker.open();
+            Object[] services = tracker.getServices();
+            if (services != null) {
+                for (Object service : services) {
+                    ((AuthenticationObserver) service).startedAuthentication(tenantId);
+                }
+            }
+            tracker.close();
+        }
+    }
+    
+    /**
+     * loads the notification configurations for the mail to super tenant for account creations
+     * and activations.
+     */
+    private static void initSuperTenantNotificationEmailSender() {
+        // Tenant Registration Email Configurations
+        String tenantRegistrationEmailConfFile =
+                CarbonUtils.getCarbonConfigDirPath() + File.separator +
+                        StratosConstants.EMAIL_CONFIG + File.separator +
+                        "email-new-tenant-registration.xml";
+        EmailSenderConfiguration newTenantRegistrationEmailConf =
+                EmailSenderConfiguration.loadEmailSenderConfiguration(
+                        tenantRegistrationEmailConfFile);
+        tenantCreationNotifier = new EmailSender(newTenantRegistrationEmailConf);
+
+        // Tenant Activation Email Configurations
+        String tenantActivationEmailConfFile =
+                CarbonUtils.getCarbonConfigDirPath() + File.separator +
+                        StratosConstants.EMAIL_CONFIG + File.separator +
+                        "email-new-tenant-activation.xml";
+        EmailSenderConfiguration newTenantActivationEmailConf =
+                EmailSenderConfiguration
+                        .loadEmailSenderConfiguration(tenantActivationEmailConfFile);
+        tenantActivationNotifier = new EmailSender(newTenantActivationEmailConf);
+    }
+    
+    /**
+     * loads the Email configuration files to be sent on the tenant registrations.
+     */
+    private static void initEmailVerificationSender() {
+        String confXml =
+                CarbonUtils.getCarbonConfigDirPath() + File.separator +
+                        StratosConstants.EMAIL_CONFIG + File.separator + "email-registration.xml";
+        try {
+            emailVerifierConfig = org.wso2.carbon.email.verification.util.Util
+                            .loadeMailVerificationConfig(confXml);
+        } catch (Exception e) {
+            String msg = "Email Registration Configuration file not found. "
+                            + "Pls check the repository/conf/email folder.";
+            log.error(msg);
+        }
+        String superTenantConfXml =
+                CarbonUtils.getCarbonConfigDirPath() + File.separator +
+                        StratosConstants.EMAIL_CONFIG + File.separator +
+                        "email-registration-moderation.xml";
+        try {
+            superTenantEmailVerifierConfig = org.wso2.carbon.email.verification.util.Util
+                            .loadeMailVerificationConfig(superTenantConfXml);
+        } catch (Exception e) {
+            String msg =
+                    "Email Moderation Configuration file not found. "
+                            + "Pls check the repository/conf/email folder.";
+            log.error(msg);
+        }
+    }
+
+    /**
+     * loads the Email configuration files to be sent on the tenant activations.
+     */
+    private static void initTenantActivatedEmailSender() {
+        String confFilename =
+                CarbonUtils.getCarbonConfigDirPath() + File.separator +
+                        StratosConstants.EMAIL_CONFIG + File.separator +
+                        "email-registration-complete.xml";
+        EmailSenderConfiguration successMsgConfig =
+                EmailSenderConfiguration.loadEmailSenderConfiguration(confFilename);
+        successMsgSender = new EmailSender(successMsgConfig);
+    }
+
+    private static void initPasswordResetEmailSender() {
+        String passwordResetConfigFileName = CarbonUtils.getCarbonConfigDirPath()+ File.separator + 
+                StratosConstants.EMAIL_CONFIG + File.separator + "email-password-reset.xml";
+        EmailSenderConfiguration passwordResetMsgConfig =
+            EmailSenderConfiguration.loadEmailSenderConfiguration(passwordResetConfigFileName);
+        passwordResetMsgSender = new EmailSender(passwordResetMsgConfig);
+    }
+
+    /**
+     * Initializes the super tenant notification parameters
+     *
+     * @param domainName - tenant domain
+     * @param adminName  - tenant admin
+     * @param email      - tenant email
+     * @return the parameters
+     */
+    private static Map<String, String> initializeSuperTenantNotificationParams(
+            String domainName, String adminName, String email) {
+        TenantManager tenantManager = DataHolder.getTenantManager();
+        String firstName = "";
+        String lastName = "";
+        try {
+            int tenantId = tenantManager.getTenantId(domainName);
+            firstName = ClaimsMgtUtil.getFirstName(DataHolder.getRealmService(), tenantId);
+            lastName = ClaimsMgtUtil.getLastName(DataHolder.getRealmService(), tenantId);
+
+        } catch (Exception e) {
+            String msg = "Unable to get the tenant with the tenant domain";
+            log.error(msg, e);
+            // just catch from here.
+        }
+
+        // load the mail configuration
+        Map<String, String> userParams = new HashMap<String, String>();
+        userParams.put("user-name", adminName);
+        userParams.put("domain-name", domainName);
+        userParams.put("email-address", email);
+        userParams.put("first-name", firstName);
+        userParams.put("last-name", lastName);
+        return userParams;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.tenant.mgt.ui/2.1.0/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/2.1.0/pom.xml b/components/org.apache.stratos.tenant.mgt.ui/2.1.0/pom.xml
index d278f3c..6fbac66 100644
--- a/components/org.apache.stratos.tenant.mgt.ui/2.1.0/pom.xml
+++ b/components/org.apache.stratos.tenant.mgt.ui/2.1.0/pom.xml
@@ -1,19 +1,22 @@
 <?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.
-  -->
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.  
+-->
 <project xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
@@ -21,12 +24,10 @@
         <groupId>org.apache.stratos</groupId>
         <artifactId>stratos-components-parent</artifactId>
         <version>3.0.0-SNAPSHOT</version>
-<relativePath>../../pom.xml</relativePath>
     </parent>
 
     <modelVersion>4.0.0</modelVersion>
-	<artifactId>org.apache.stratos.tenant.mgt.ui</artifactId>
-	<version>2.1.0</version>
+    <artifactId>org.apache.stratos.tenant.mgt.ui</artifactId>
     <packaging>bundle</packaging>
     <name>Apache Stratos - User Interface for Tenant CRUD operations</name>
 
@@ -66,12 +67,12 @@
         <dependency>
             <groupId>org.wso2.carbon</groupId>
             <artifactId>org.wso2.carbon.registry.common.ui</artifactId>
-            <version>${carbon.platform.version}</version>
+            <version>${wso2carbon.version}</version>
         </dependency>
         <dependency>
             <groupId>org.wso2.carbon</groupId>
             <artifactId>org.wso2.carbon.registry.core</artifactId>
-            <version>${carbon.platform.version}</version>
+            <version>${wso2carbon.version}</version>
         </dependency>
         <dependency>
             <groupId>commons-logging</groupId>
@@ -91,32 +92,32 @@
         <dependency>
             <groupId>org.apache.ws.commons.axiom.wso2</groupId>
             <artifactId>axiom</artifactId>
-	    <version>1.2.11.wso2v2</version>
+	    <version>${axiom.wso2.version}</version>
         </dependency>
         <dependency>
             <groupId>org.wso2.carbon</groupId>
             <artifactId>org.wso2.carbon.ui</artifactId>
-            <version>${carbon.platform.version}</version>
+            <version>${wso2carbon.version}</version>
         </dependency>
         <dependency>
             <groupId>org.wso2.carbon</groupId>
             <artifactId>org.wso2.carbon.tenant.mgt.stub</artifactId>
-            <version>${carbon.platform.version}</version>
+            <version>${wso2carbon.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.stratos.common</artifactId>
-	    <version>2.1.0</version>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.common</artifactId>
+	    <version>${apache.stratos.version}</version>
         </dependency>
         <dependency>
             <groupId>org.json.wso2</groupId>
             <artifactId>json</artifactId>
-   	    <version>1.0.0.wso2v1</version>
+   	    <version>${json.wso2.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.stratos.common.stub</artifactId>
-            <version>${carbon.platform.version}</version>
+            <groupId>org.apache.stratos</groupId>
+            <artifactId>org.apache.stratos.common.stub</artifactId>
+            <version>${apache.stratos.version}</version>
         </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.tenant.mgt.ui/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/PackageInfoServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt.ui/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/PackageInfoServiceClient.java b/components/org.apache.stratos.tenant.mgt.ui/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/PackageInfoServiceClient.java
index 39dbf21..b0b692a 100644
--- a/components/org.apache.stratos.tenant.mgt.ui/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/PackageInfoServiceClient.java
+++ b/components/org.apache.stratos.tenant.mgt.ui/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/ui/clients/PackageInfoServiceClient.java
@@ -9,8 +9,8 @@ import org.apache.commons.logging.LogFactory;
 import org.json.JSONArray;
 import org.json.JSONObject;
 import org.wso2.carbon.registry.core.exceptions.RegistryException;
-import org.wso2.carbon.stratos.common.packages.stub.PackageInfoServiceStub;
-import org.wso2.carbon.stratos.common.packages.stub.PackageInfo;
+import org.apache.stratos.common.packages.stub.PackageInfoServiceStub;
+import org.apache.stratos.common.packages.stub.PackageInfo;
 
 /**
  * PackageInfoService client

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.tenant.mgt/2.1.0/pom.xml
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt/2.1.0/pom.xml b/components/org.apache.stratos.tenant.mgt/2.1.0/pom.xml
deleted file mode 100644
index 51a479e..0000000
--- a/components/org.apache.stratos.tenant.mgt/2.1.0/pom.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<!--
-# 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>stratos-components-parent</artifactId>
-        <version>3.0.0-SNAPSHOT</version>
-<relativePath>../../pom.xml</relativePath>
-    </parent>
-
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>org.apache.stratos.tenant.mgt</artifactId>
-    <version>2.1.0</version>
-    <packaging>bundle</packaging>
-    <name>Apache Stratos - Tenant Managment</name>
-
-    <build>
-
-        <plugins>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-scr-plugin</artifactId>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.felix</groupId>
-                <artifactId>maven-bundle-plugin</artifactId>
-                
-                <extensions>true</extensions>
-                <configuration>
-                    <instructions>
-                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
-                        <Bundle-Name>${project.artifactId}</Bundle-Name>
-                        <Private-Package>
-                            org.apache.stratos.tenant.mgt.internal.*,
-                            org.apache.stratos.tenant.mgt.persistence.*,
-                        </Private-Package>
-                        <Import-Package>
-                            org.apache.stratos.common.*,
-                            org.wso2.carbon.registry.core.*;version=1.0.1,
-                            org.wso2.carbon.captcha.mgt.*,
-                            !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>
-                        <Export-Package>
-                            org.apache.stratos.tenant.mgt.beans.*,
-                            org.apache.stratos.tenant.mgt.exception.*,
-                            org.apache.stratos.tenant.mgt.realm.*,
-                            org.apache.stratos.tenant.mgt.services.*,
-                            org.apache.stratos.tenant.mgt.util.*,
-                        </Export-Package>
-                        <DynamicImport-Package>*</DynamicImport-Package>
-                    </instructions>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.user.core</artifactId>
-            <version>${carbon.platform.version}</version>
-        </dependency>
-        <dependency>
-           <groupId>org.wso2.carbon</groupId>
-           <artifactId>org.wso2.carbon.tenant.mgt.core</artifactId>
-	   <version>2.1.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.registry.core</artifactId>
-            <version>${carbon.platform.version}</version>
-        </dependency>
-        <dependency>
-           <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.um.ws.api</artifactId>
-            <version>${carbon.platform.version}</version>
-        </dependency>
-        <dependency>
-           <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.captcha.mgt</artifactId>
-            <version>${carbon.platform.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.stratos.common</artifactId>
-	    <version>2.1.0</version>
-        </dependency>
-       
-        <dependency>
-            <groupId>org.wso2.carbon</groupId>
-            <artifactId>org.wso2.carbon.admin.mgt</artifactId>
-	    <version>4.1.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.rampart.wso2</groupId>
-            <artifactId>rampart-policy</artifactId>
-	    <version>1.6.1.wso2v8</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.rampart.wso2</groupId>
-            <artifactId>rampart-core</artifactId>
-	    <version>1.6.1.wso2v8</version>
-        </dependency>
-    </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.tenant.mgt/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/beans/PaginatedTenantInfoBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/beans/PaginatedTenantInfoBean.java b/components/org.apache.stratos.tenant.mgt/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/beans/PaginatedTenantInfoBean.java
deleted file mode 100644
index 3a55df6..0000000
--- a/components/org.apache.stratos.tenant.mgt/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/beans/PaginatedTenantInfoBean.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.apache.stratos.tenant.mgt.beans;
-
-import org.wso2.carbon.stratos.common.beans.TenantInfoBean;
-import org.wso2.carbon.utils.Pageable;
-
-import java.util.List;
-
-/**
- * Bean for paginated tenant information
- */
-public class PaginatedTenantInfoBean implements Pageable {
-    private TenantInfoBean[] tenantInfoBeans;
-    private int numberOfPages;
-
-    public TenantInfoBean[] getTenantInfoBeans() {
-        return tenantInfoBeans;
-    }
-
-    public void setTenantInfoBeans(TenantInfoBean[] 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 TenantInfoBean[items.size()]);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/ac065d73/components/org.apache.stratos.tenant.mgt/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/exception/TenantManagementException.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.tenant.mgt/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/exception/TenantManagementException.java b/components/org.apache.stratos.tenant.mgt/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/exception/TenantManagementException.java
deleted file mode 100644
index 1207f5d..0000000
--- a/components/org.apache.stratos.tenant.mgt/2.1.0/src/main/java/org/apache/stratos/tenant/mgt/exception/TenantManagementException.java
+++ /dev/null
@@ -1,33 +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.apache.stratos.tenant.mgt.exception;
-
-/**
- * Tenant Management Specific Exception.
- */
-public class TenantManagementException extends Exception {
-
-    public TenantManagementException(String msg, Exception e) {
-        super(msg, e);
-    }
-    
-    public TenantManagementException(String msg) {
-        super(msg);
-    }
-}