You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by sa...@apache.org on 2013/07/02 10:19:04 UTC
[11/12] git commit: Refactoring org.wso2.carbon to org.apache.stratos
Refactoring org.wso2.carbon to org.apache.stratos
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/6724d973
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/6724d973
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/6724d973
Branch: refs/heads/master
Commit: 6724d97331214434d2c1813bde77f463536281d5
Parents: 6ee4434
Author: Sajith Kariyawasam <sa...@wso2.com>
Authored: Tue Jul 2 13:47:35 2013 +0530
Committer: Sajith Kariyawasam <sa...@wso2.com>
Committed: Tue Jul 2 13:47:35 2013 +0530
----------------------------------------------------------------------
.../2.1.0/pom.xml | 3 +-
.../resources/web/account-mgt/account_mgt.jsp | 2 +-
.../org.wso2.carbon.account.mgt/2.1.0/pom.xml | 5 +-
.../account/mgt/beans/AccountInfoBean.java | 40 -
.../internal/AccountMgtServiceComponent.java | 139 ---
.../account/mgt/services/AccountMgtService.java | 416 -------
.../mgt/services/EmailValidationService.java | 153 ---
.../org/wso2/carbon/account/mgt/util/Util.java | 173 ---
.../src/main/resources/META-INF/services.xml | 4 +-
.../org.apache.stratos.adc.mgt/2.1.3/.classpath | 289 +++++
.../org.apache.stratos.adc.mgt/2.1.3/.project | 17 +
.../2.1.3/.settings/org.eclipse.jdt.core.prefs | 16 +
.../org.apache.stratos.adc.mgt/2.1.3/pom.xml | 134 +++
.../2.1.3/src/conf/cartridge-config.properties | 38 +
.../2.1.3/src/conf/tenant-resource-policy.xml | 1 +
.../adc/mgt/client/CartridgeAgentClient.java | 39 +
.../client/CloudControllerServiceClient.java | 94 ++
.../stratos/adc/mgt/client/RegistryClient.java | 112 ++
.../adc/mgt/custom/domain/RegistryManager.java | 106 ++
.../adc/mgt/dao/CartridgeSubscription.java | 186 +++
.../stratos/adc/mgt/dao/DataCartridge.java | 49 +
.../apache/stratos/adc/mgt/dao/PortMapping.java | 56 +
.../apache/stratos/adc/mgt/dao/Repository.java | 56 +
.../adc/mgt/dao/RepositoryCredentials.java | 27 +
.../apache/stratos/adc/mgt/dns/DNSManager.java | 86 ++
.../org/apache/stratos/adc/mgt/dto/AppRepo.java | 85 ++
.../apache/stratos/adc/mgt/dto/Cartridge.java | 198 ++++
.../stratos/adc/mgt/dto/CartridgeDetail.java | 1 +
.../adc/mgt/dto/CartridgeInformation.java | 1 +
.../stratos/adc/mgt/dto/CartridgeWrapper.java | 49 +
.../org/apache/stratos/adc/mgt/dto/Policy.java | 145 +++
.../stratos/adc/mgt/dto/PolicyDefinition.java | 80 ++
.../adc/mgt/dto/RepositoryInformation.java | 43 +
.../stratos/adc/mgt/dto/SubscriptionInfo.java | 43 +
.../stratos/adc/mgt/exception/ADCException.java | 46 +
.../exception/AlreadySubscribedException.java | 45 +
.../exception/DomainMappingExistsException.java | 45 +
.../DuplicateCartridgeAliasException.java | 53 +
.../InvalidCartridgeAliasException.java | 54 +
.../exception/InvalidRepositoryException.java | 32 +
.../mgt/exception/NotSubscribedException.java | 46 +
.../adc/mgt/exception/PolicyException.java | 38 +
.../RepositoryCredentialsRequiredException.java | 37 +
.../exception/RepositoryRequiredException.java | 37 +
.../exception/RepositoryTransportException.java | 37 +
.../UnregisteredCartridgeException.java | 45 +
.../internal/ADCManagementServerComponent.java | 106 ++
.../stratos/adc/mgt/internal/DataHolder.java | 77 ++
.../adc/mgt/internal/HostingConstants.java | 37 +
.../internal/HostingManagementActivator.java | 60 +
.../service/ApplicationManagementService.java | 620 ++++++++++
.../InstanceInformationManagementService.java | 55 +
.../mgt/service/RepoNotificationService.java | 179 +++
.../adc/mgt/service/RepositoryInfoBean.java | 78 ++
.../service/RepositoryInformationService.java | 66 ++
.../mgt/utils/ApplicationManagementUtil.java | 1095 ++++++++++++++++++
.../stratos/adc/mgt/utils/CartridgeAppType.java | 41 +
.../mgt/utils/CartridgeConfigFileReader.java | 59 +
.../adc/mgt/utils/CartridgeConstants.java | 74 ++
.../stratos/adc/mgt/utils/CartridgeDomain.java | 143 +++
.../stratos/adc/mgt/utils/DomainInfo.java | 40 +
.../adc/mgt/utils/PersistenceManager.java | 853 ++++++++++++++
.../stratos/adc/mgt/utils/PolicyHolder.java | 289 +++++
.../adc/mgt/utils/RepositoryCreator.java | 266 +++++
.../adc/mgt/utils/RepositoryFactory.java | 129 +++
.../stratos/adc/mgt/utils/StratosDBUtils.java | 210 ++++
.../mgt/utils/SynchronizeRepositoryRequest.java | 143 +++
.../src/main/resources/META-INF/services.xml | 86 ++
.../2.1.3/src/main/resources/policies.xsd | 36 +
.../2.1.3/src/scripts/append_zone_file.sh | 24 +
.../stratos/adc/mgt/test/PolicyHolderTest.java | 63 +
.../2.1.3/src/test/resources/log4j.properties | 8 +
.../2.1.3/src/test/resources/policies-1.xml | 22 +
.../2.1.3/target/classes/META-INF/MANIFEST.MF | 121 ++
.../2.1.3/target/classes/META-INF/services.xml | 86 ++
.../adc/mgt/client/CartridgeAgentClient.class | Bin 0 -> 1633 bytes
.../client/CloudControllerServiceClient.class | Bin 0 -> 4468 bytes
.../stratos/adc/mgt/client/RegistryClient.class | Bin 0 -> 4162 bytes
.../adc/mgt/custom/domain/RegistryManager.class | Bin 0 -> 3785 bytes
.../adc/mgt/dao/CartridgeSubscription.class | Bin 0 -> 4728 bytes
.../stratos/adc/mgt/dao/DataCartridge.class | Bin 0 -> 1196 bytes
.../stratos/adc/mgt/dao/PortMapping.class | Bin 0 -> 1163 bytes
.../apache/stratos/adc/mgt/dao/Repository.class | Bin 0 -> 1208 bytes
.../adc/mgt/dao/RepositoryCredentials.class | Bin 0 -> 985 bytes
.../apache/stratos/adc/mgt/dns/DNSManager.class | Bin 0 -> 1866 bytes
.../apache/stratos/adc/mgt/dto/AppRepo.class | Bin 0 -> 1805 bytes
.../apache/stratos/adc/mgt/dto/Cartridge.class | Bin 0 -> 4630 bytes
.../stratos/adc/mgt/dto/CartridgeWrapper.class | Bin 0 -> 1345 bytes
.../org/apache/stratos/adc/mgt/dto/Policy.class | Bin 0 -> 3214 bytes
.../stratos/adc/mgt/dto/PolicyDefinition.class | Bin 0 -> 1561 bytes
.../adc/mgt/dto/RepositoryInformation.class | Bin 0 -> 963 bytes
.../stratos/adc/mgt/dto/SubscriptionInfo.class | Bin 0 -> 898 bytes
.../adc/mgt/exception/ADCException.class | Bin 0 -> 967 bytes
.../exception/AlreadySubscribedException.class | Bin 0 -> 1072 bytes
.../DomainMappingExistsException.class | Bin 0 -> 1064 bytes
.../DuplicateCartridgeAliasException.class | Bin 0 -> 1281 bytes
.../InvalidCartridgeAliasException.class | Bin 0 -> 1275 bytes
.../exception/InvalidRepositoryException.class | Bin 0 -> 696 bytes
.../mgt/exception/NotSubscribedException.class | Bin 0 -> 1062 bytes
.../adc/mgt/exception/PolicyException.class | Bin 0 -> 782 bytes
...RepositoryCredentialsRequiredException.class | Bin 0 -> 851 bytes
.../exception/RepositoryRequiredException.class | Bin 0 -> 818 bytes
.../RepositoryTransportException.class | Bin 0 -> 821 bytes
.../UnregisteredCartridgeException.class | Bin 0 -> 1084 bytes
.../internal/ADCManagementServerComponent.class | Bin 0 -> 3522 bytes
.../stratos/adc/mgt/internal/DataHolder.class | Bin 0 -> 1999 bytes
.../internal/HostingConstants$WebappState.class | Bin 0 -> 591 bytes
.../adc/mgt/internal/HostingConstants.class | Bin 0 -> 633 bytes
.../internal/HostingManagementActivator$1.class | Bin 0 -> 1388 bytes
.../internal/HostingManagementActivator.class | Bin 0 -> 1522 bytes
.../service/ApplicationManagementService.class | Bin 0 -> 21031 bytes
.../InstanceInformationManagementService.class | Bin 0 -> 1777 bytes
.../mgt/service/RepoNotificationService.class | Bin 0 -> 6962 bytes
.../adc/mgt/service/RepositoryInfoBean.class | Bin 0 -> 2428 bytes
.../service/RepositoryInformationService.class | Bin 0 -> 2308 bytes
.../mgt/utils/ApplicationManagementUtil.class | Bin 0 -> 39480 bytes
.../adc/mgt/utils/CartridgeAppType.class | Bin 0 -> 838 bytes
.../mgt/utils/CartridgeConfigFileReader.class | Bin 0 -> 2236 bytes
.../CartridgeConstants$DomainMappingInfo.class | Bin 0 -> 615 bytes
.../adc/mgt/utils/CartridgeConstants.class | Bin 0 -> 2974 bytes
.../stratos/adc/mgt/utils/CartridgeDomain.class | Bin 0 -> 2986 bytes
.../stratos/adc/mgt/utils/DomainInfo.class | Bin 0 -> 774 bytes
.../adc/mgt/utils/PersistenceManager.class | Bin 0 -> 24386 bytes
.../stratos/adc/mgt/utils/PolicyHolder$1.class | Bin 0 -> 253 bytes
.../utils/PolicyHolder$SingletonHolder.class | Bin 0 -> 1294 bytes
.../stratos/adc/mgt/utils/PolicyHolder.class | Bin 0 -> 9694 bytes
.../adc/mgt/utils/RepositoryCreator.class | Bin 0 -> 9634 bytes
.../adc/mgt/utils/RepositoryFactory.class | Bin 0 -> 2425 bytes
.../stratos/adc/mgt/utils/StratosDBUtils.class | Bin 0 -> 5867 bytes
.../utils/SynchronizeRepositoryRequest.class | Bin 0 -> 3371 bytes
.../2.1.3/target/classes/policies.xsd | 36 +
.../target/org.apache.stratos.adc.mgt-2.1.3.jar | Bin 0 -> 109380 bytes
.../OSGI-INF/metatype/metatype.xml | 7 +
.../OSGI-INF/scr-plugin/scrinfo.xml | 11 +
.../OSGI-INF/serviceComponents.xml | 11 +
.../2.1.3/target/test-classes/log4j.properties | 8 +
.../2.1.3/target/test-classes/policies-1.xml | 22 +
.../2.1.3/target/timestamp | Bin 0 -> 324 bytes
.../2.1.1/pom.xml | 2 +-
.../service/RepositorySynchronizer.java | 37 -
.../src/main/webapp/WEB-INF/cxf-servlet.xml | 2 +-
.../org.wso2.carbon.adc.mgt/2.1.3/pom.xml | 134 ---
.../2.1.3/src/conf/cartridge-config.properties | 38 -
.../2.1.3/src/conf/tenant-resource-policy.xml | 1 -
.../adc/mgt/client/CartridgeAgentClient.java | 39 -
.../client/CloudControllerServiceClient.java | 94 --
.../carbon/adc/mgt/client/RegistryClient.java | 112 --
.../adc/mgt/custom/domain/RegistryManager.java | 106 --
.../adc/mgt/dao/CartridgeSubscription.java | 186 ---
.../wso2/carbon/adc/mgt/dao/DataCartridge.java | 49 -
.../wso2/carbon/adc/mgt/dao/PortMapping.java | 56 -
.../org/wso2/carbon/adc/mgt/dao/Repository.java | 56 -
.../adc/mgt/dao/RepositoryCredentials.java | 27 -
.../org/wso2/carbon/adc/mgt/dns/DNSManager.java | 86 --
.../org/wso2/carbon/adc/mgt/dto/AppRepo.java | 85 --
.../org/wso2/carbon/adc/mgt/dto/Cartridge.java | 198 ----
.../carbon/adc/mgt/dto/CartridgeDetail.java | 0
.../adc/mgt/dto/CartridgeInformation.java | 0
.../carbon/adc/mgt/dto/CartridgeWrapper.java | 49 -
.../org/wso2/carbon/adc/mgt/dto/Policy.java | 145 ---
.../carbon/adc/mgt/dto/PolicyDefinition.java | 80 --
.../adc/mgt/dto/RepositoryInformation.java | 43 -
.../carbon/adc/mgt/dto/SubscriptionInfo.java | 43 -
.../carbon/adc/mgt/exception/ADCException.java | 46 -
.../exception/AlreadySubscribedException.java | 45 -
.../exception/DomainMappingExistsException.java | 45 -
.../DuplicateCartridgeAliasException.java | 53 -
.../InvalidCartridgeAliasException.java | 54 -
.../exception/InvalidRepositoryException.java | 32 -
.../mgt/exception/NotSubscribedException.java | 46 -
.../adc/mgt/exception/PolicyException.java | 38 -
.../RepositoryCredentialsRequiredException.java | 37 -
.../exception/RepositoryRequiredException.java | 37 -
.../exception/RepositoryTransportException.java | 37 -
.../UnregisteredCartridgeException.java | 45 -
.../internal/ADCManagementServerComponent.java | 106 --
.../carbon/adc/mgt/internal/DataHolder.java | 77 --
.../adc/mgt/internal/HostingConstants.java | 37 -
.../internal/HostingManagementActivator.java | 60 -
.../service/ApplicationManagementService.java | 620 ----------
.../InstanceInformationManagementService.java | 55 -
.../mgt/service/RepoNotificationService.java | 179 ---
.../adc/mgt/service/RepositoryInfoBean.java | 78 --
.../service/RepositoryInformationService.java | 66 --
.../mgt/utils/ApplicationManagementUtil.java | 1095 ------------------
.../carbon/adc/mgt/utils/CartridgeAppType.java | 41 -
.../mgt/utils/CartridgeConfigFileReader.java | 59 -
.../adc/mgt/utils/CartridgeConstants.java | 74 --
.../carbon/adc/mgt/utils/CartridgeDomain.java | 143 ---
.../wso2/carbon/adc/mgt/utils/DomainInfo.java | 40 -
.../adc/mgt/utils/PersistenceManager.java | 853 --------------
.../wso2/carbon/adc/mgt/utils/PolicyHolder.java | 289 -----
.../carbon/adc/mgt/utils/RepositoryCreator.java | 266 -----
.../carbon/adc/mgt/utils/RepositoryFactory.java | 129 ---
.../carbon/adc/mgt/utils/StratosDBUtils.java | 210 ----
.../mgt/utils/SynchronizeRepositoryRequest.java | 143 ---
.../src/main/resources/META-INF/services.xml | 86 --
.../2.1.3/src/main/resources/policies.xsd | 36 -
.../2.1.3/src/scripts/append_zone_file.sh | 24 -
.../carbon/adc/mgt/test/PolicyHolderTest.java | 63 -
.../2.1.3/src/test/resources/log4j.properties | 8 -
.../2.1.3/src/test/resources/policies-1.xml | 22 -
.../2.1.3/pom.xml | 10 +-
.../topology/mgt/builder/TopologySyncher.java | 114 --
.../mgt/exception/TopologyMgtException.java | 35 -
.../mgt/group/mgt/GroupMgtAgentBuilder.java | 109 --
.../mgt/SubDomainAwareGroupManagementAgent.java | 32 -
.../mgt/internal/TopologyMgtDSComponent.java | 290 -----
.../mgt/service/TopologyManagementService.java | 69 --
.../impl/TopologyManagementServiceImpl.java | 126 --
.../mgt/serviceobjects/DomainContext.java | 90 --
.../mgt/subscriber/TopicHealthChecker.java | 67 --
.../mgt/subscriber/TopologyListener.java | 44 -
.../mgt/subscriber/TopologySubscriber.java | 92 --
.../mgt/subscriber/TopologySubscriberTask.java | 0
.../adc/topology/mgt/util/ConfigHolder.java | 197 ----
.../topology/mgt/util/TopologyConstants.java | 13 -
.../adc/topology/mgt/util/TopologyMgtUtil.java | 5 -
.../src/main/resources/META-INF/services.xml | 2 +-
...de_registration_usage_plan_ajaxprocessor.jsp | 4 +-
components/stratos/pom.xml | 10 +-
221 files changed, 7649 insertions(+), 9264 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6724d973/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/pom.xml b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/pom.xml
index b48a810..15619fc 100644
--- a/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/pom.xml
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/pom.xml
@@ -24,8 +24,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.wso2.carbon.account.mgt.ui</artifactId>
+ <modelVersion>4.0.0</modelorg.apache.stratos.account.mgt.uiwso2.carbon.account.mgt.ui</artifactId>
<version>2.1.0</version>
<packaging>bundle</packaging>
<name>WSO2 Stratos - Account Managment - User Interface</name>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6724d973/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/account_mgt.jsp
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/account_mgt.jsp b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/account_mgt.jsp
index a43e0f2..3c693a6 100644
--- a/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/account_mgt.jsp
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt.ui/2.1.0/src/main/resources/web/account-mgt/account_mgt.jsp
@@ -15,7 +15,7 @@
~ specific language governing permissions and limitations
~ under the License.
-->
-<%@ page import="org.wso2.carbon.account.mgt.stub.beans.xsd.AccountInfoBean" %>
+<%@ page import="org.apache.stratos.account.mgt.AccountInfoBean" %>
<%@ page import="org.wso2.carbon.account.mgt.ui.clients.AccountMgtClient" %>
<%@ page import="org.wso2.carbon.account.mgt.ui.clients.UsagePlanClient" %>
<%@ page import="org.wso2.carbon.stratos.common.constants.StratosConstants" %>
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6724d973/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/pom.xml
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/pom.xml b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/pom.xml
index 28fe6f9..599833d 100644
--- a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/pom.xml
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/pom.xml
@@ -23,8 +23,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.wso2.carbon.account.mgt</artifactId>
+ <modelVersion>4.0.0</modelVorg.apache.stratos.account.mgtg.wso2.carbon.account.mgt</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Stratos - Account Management</name>
@@ -45,7 +44,7 @@
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Private-Package>
- org.wso2.carbon.account.mgt.*,
+ org.apache.stratos.account.mgt.*,
</Private-Package>
<Import-Package>
org.wso2.carbon.registry.core.*;version=1.0.1,
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6724d973/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/beans/AccountInfoBean.java
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/beans/AccountInfoBean.java b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/beans/AccountInfoBean.java
deleted file mode 100644
index ca03e48..0000000
--- a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/beans/AccountInfoBean.java
+++ /dev/null
@@ -1,40 +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.account.mgt.beans;
-
-public class AccountInfoBean {
- private String firstname;
- private String lastname;
-
- public String getFirstname() {
- return firstname;
- }
-
- public void setFirstname(String firstname) {
- this.firstname = firstname;
- }
-
- public String getLastname() {
- return lastname;
- }
-
- public void setLastname(String lastname) {
- this.lastname = lastname;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6724d973/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/internal/AccountMgtServiceComponent.java
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/internal/AccountMgtServiceComponent.java b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/internal/AccountMgtServiceComponent.java
deleted file mode 100644
index 4707b02..0000000
--- a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/internal/AccountMgtServiceComponent.java
+++ /dev/null
@@ -1,139 +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.account.mgt.internal;
-
-import org.wso2.carbon.account.mgt.util.Util;
-import org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber;
-import org.wso2.carbon.registry.core.service.RegistryService;
-import org.wso2.carbon.stratos.common.TenantBillingService;
-import org.wso2.carbon.stratos.common.listeners.TenantMgtListener;
-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.wso2.carbon.account.mgt" 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"
- * @scr.reference name="emailverification.service" interface=
- * "org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber"
- * cardinality="1..1" policy="dynamic"
- * bind="setEmailVerificationService"
- * unbind="unsetEmailVerificationService"
- * @scr.reference name="org.wso2.carbon.tenant.mgt.listener.service"
- * interface="org.wso2.carbon.stratos.common.listeners.TenantMgtListener"
- * cardinality="0..n" policy="dynamic"
- * bind="setTenantMgtListenerService"
- * unbind="unsetTenantMgtListenerService"
- * @scr.reference name="default.tenant.billing.service"
- * interface="org.wso2.carbon.stratos.common.TenantBillingService"
- * cardinality="1..1" policy="dynamic"
- * bind="setTenantBillingService"
- * unbind="unsetTenantBillingService"
- */
-public class AccountMgtServiceComponent {
- private static Log log = LogFactory.getLog(AccountMgtServiceComponent.class);
- private static ConfigurationContextService configContextService = null;
- private static TenantBillingService billingService = null;
-
- protected void activate(ComponentContext context) {
- try {
- Util.loadEmailVerificationConfig();
- log.debug("******* Stratos account management bundle is activated ******* ");
- } catch (Exception e) {
- log.error("******* Stratos account management bundle failed activating ****", e);
- }
- }
-
- protected void deactivate(ComponentContext context) {
- log.debug("******* Stratos account managment bundle 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 contextService) {
- if (log.isDebugEnabled()) {
- log.debug("Setting the ConfigurationContext");
- }
- configContextService = contextService;
- }
-
- protected void unsetConfigurationContextService(ConfigurationContextService contextService) {
- if (log.isDebugEnabled()) {
- log.debug("Unsetting the ConfigurationContext");
- }
- }
-
- protected void setEmailVerificationService(EmailVerifcationSubscriber emailService) {
- Util.setEmailVerificationService(emailService);
- }
-
- protected void unsetEmailVerificationService(EmailVerifcationSubscriber emailService) {
- Util.setEmailVerificationService(null);
- }
-
- protected void setTenantMgtListenerService(TenantMgtListener tenantMgtListener) {
- Util.addTenantMgtListenerService(tenantMgtListener);
- }
-
- protected void unsetTenantMgtListenerService(TenantMgtListener tenantMgtListener) {
- Util.removeTenantMgtListenerService(tenantMgtListener);
- }
-
- protected void setTenantBillingService(TenantBillingService tenantBillingService) {
- billingService = tenantBillingService;
- }
-
- protected void unsetTenantBillingService(TenantBillingService tenantBilling) {
- setTenantBillingService(null);
- }
-
- public static TenantBillingService getBillingService() {
- return billingService;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6724d973/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/AccountMgtService.java
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/AccountMgtService.java b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/AccountMgtService.java
deleted file mode 100644
index 17b83e4..0000000
--- a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/AccountMgtService.java
+++ /dev/null
@@ -1,416 +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.account.mgt.services;
-
-import org.wso2.carbon.account.mgt.beans.AccountInfoBean;
-import org.wso2.carbon.account.mgt.util.Util;
-import org.wso2.carbon.core.AbstractAdmin;
-import org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber;
-import org.wso2.carbon.registry.core.RegistryConstants;
-import org.wso2.carbon.registry.core.Resource;
-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.tenant.mgt.util.TenantMgtUtil;
-import org.wso2.carbon.user.core.UserCoreConstants;
-import org.wso2.carbon.user.core.UserStoreException;
-import org.wso2.carbon.user.core.UserStoreManager;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.user.core.tenant.Tenant;
-import org.wso2.carbon.user.core.tenant.TenantManager;
-import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Account Management Service Class
- */
-public class AccountMgtService extends AbstractAdmin {
- private static final Log log = LogFactory.getLog(AccountMgtService.class);
-
- /**
- * Updates the contact email.
- *
- * @param contactEmail email
- * @throws Exception, if update contact failed.
- */
- public void updateContact(String contactEmail) throws Exception {
- EmailVerifcationSubscriber emailverifier = Util.getEmailVerificationService();
-
- TenantManager tenantManager = Util.getTenantManager();
- UserRegistry registry = (UserRegistry) getGovernanceRegistry();
- if (registry == null) {
- // we can't continue without having a valid registry in the session
- String msg = "Error in retrieving the registry for the login tenant.";
- log.error(msg);
- throw new Exception(msg);
- }
- int tenantId = registry.getTenantId();
-
- Tenant tenant;
- try {
- tenant = (Tenant) tenantManager.getTenant(tenantId);
- } catch (UserStoreException e) {
- String msg = "Error in retrieving the tenant information for the tenant id: " +
- tenantId + ".";
- log.error(msg, e);
- throw new Exception(msg, e);
- }
-
- // generating the confirmation key
- String confirmationKey = UUIDGenerator.generateUUID();
- UserRegistry superTenantSystemRegistry =
- Util.getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID);
- Resource resource;
- String emailVerificationPath = StratosConstants.ADMIN_EMAIL_VERIFICATION_FLAG_PATH +
- RegistryConstants.PATH_SEPARATOR + tenantId;
- if (superTenantSystemRegistry.resourceExists(emailVerificationPath)) {
- resource = superTenantSystemRegistry.get(emailVerificationPath);
- } else {
- resource = superTenantSystemRegistry.newResource();
- }
- resource.setContent(confirmationKey);
- superTenantSystemRegistry.put(emailVerificationPath, resource);
-
- try {
- Map<String, String> datatostore = new HashMap<String, String>();
- datatostore.put("first-name",
- ClaimsMgtUtil.getFirstName(Util.getRealmService(), tenantId));
- datatostore.put("email", contactEmail);
- datatostore.put("userName", tenant.getAdminName());
- datatostore.put("tenantDomain", tenant.getDomain());
- datatostore.put("confirmationKey", confirmationKey);
- emailverifier.requestUserVerification(datatostore, Util.getEmailVerifierConfig());
- } catch (Exception e) {
- String msg = "Error in adding tenant, tenant domain: " + tenant.getDomain() + ".";
- log.error(msg);
- throw new Exception(msg, e);
- }
- }
-
- /**
- * gets the contact of the tenant admin
- *
- * @throws Exception, if getting the contact email address failed.
- * @return, the contact email address
- */
- public String getContact() throws Exception {
- TenantManager tenantManager = Util.getTenantManager();
- UserRegistry registry = (UserRegistry) getGovernanceRegistry();
- if (registry == null) {
- // we can't continue without having a valid registry in the session
- String msg = "Error in retrieving the registry for the login tenant.";
- log.error(msg);
- throw new Exception(msg);
- }
- int tenantId = registry.getTenantId();
- // get the tenant information from the tenant manager
- Tenant tenant;
- try {
- tenant = (Tenant) tenantManager.getTenant(tenantId);
- } catch (UserStoreException e) {
- String msg = "Error in retrieving the tenant information for the tenant id: " +
- tenantId + ".";
- log.error(msg, e);
- throw new Exception(msg, e);
- }
- return tenant.getEmail();
- }
-
- /**
- * Updates the fullname information
- *
- * @param accountInfoBean profile information stored in AccountInfoBean
- * @return true, if updated successfully.
- * @throws Exception UserStoreException.
- */
- public boolean updateFullname(AccountInfoBean accountInfoBean) throws Exception {
- TenantManager tenantManager = Util.getTenantManager();
- UserRegistry registry = (UserRegistry) getGovernanceRegistry();
- if (registry == null) {
- // we can't continue without having a valid registry in the session
- String msg = "Error in retrieving the registry for the login tenant.";
- log.error(msg);
- throw new Exception(msg);
- }
- int tenantId = registry.getTenantId();
- // get the tenant information from the tenant manager
- Tenant tenant;
- try {
- tenant = (Tenant) tenantManager.getTenant(tenantId);
- } catch (UserStoreException e) {
- String msg = "Error in retrieving the tenant information for the tenant id: " +
- tenantId + ".";
- log.info(msg, e);
- throw new Exception(msg, e);
- }
- RealmService realmService = Util.getRealmService();
- try {
- Map<String, String> claimsMap = new HashMap<String, String>();
- claimsMap.put(UserCoreConstants.ClaimTypeURIs.GIVEN_NAME,
- accountInfoBean.getFirstname());
- claimsMap.put(UserCoreConstants.ClaimTypeURIs.SURNAME, accountInfoBean.getLastname());
- UserStoreManager userStoreManager =
- (UserStoreManager) realmService.getTenantUserRealm(tenantId)
- .getUserStoreManager();
- userStoreManager.setUserClaimValues(
- ClaimsMgtUtil.getAdminUserNameFromTenantId(realmService, tenantId),
- claimsMap, UserCoreConstants.DEFAULT_PROFILE);
- log.info("FirstName: " + accountInfoBean.getFirstname() +
- " has been updated to the tenant admin " +
- ClaimsMgtUtil.getAdminUserNameFromTenantId(realmService, tenantId) + " of " +
- tenant.getDomain());
-
- //Notify tenant update to all listeners
- TenantInfoBean tenantInfoBean = new TenantInfoBean();
- tenantInfoBean.setTenantId(tenantId);
- tenantInfoBean.setFirstname(accountInfoBean.getFirstname());
- tenantInfoBean.setLastname(accountInfoBean.getLastname());
- Util.alertTenantUpdate(tenantInfoBean);
-
- return true;
- } catch (Exception e) {
- // this is expected, as many users haven't given their fullnames
- // during their registration.
- String msg =
- "Error in updating the firstname: " + accountInfoBean.getFirstname() +
- " for the tenant admin: " +
- ClaimsMgtUtil.getAdminUserNameFromTenantId(realmService, tenantId);
- log.info(msg);
- throw new Exception(msg, e);
- }
- }
-
- /**
- * gets the profile information - saved as claims -
- * currently saved claims are first name and last name - hence the profile so far is a fullname.
- *
- * @return AccountInfoBean - Currently depicts the fullname as an object.
- * @throws Exception, UserStoreException
- */
- public AccountInfoBean getFullname() throws Exception {
-
- String firstname = "", lastname = "";
- TenantManager tenantManager = Util.getTenantManager();
- UserRegistry registry = (UserRegistry) getGovernanceRegistry();
- if (registry == null) {
- // we can't continue without having a valid registry in the session
- String msg = "Error in retrieving the registry for the login tenant.";
- log.error(msg);
- throw new Exception(msg);
- }
- int tenantId = registry.getTenantId();
- // get the tenant information from the tenant manager
- Tenant tenant;
- try {
- tenant = (Tenant) tenantManager.getTenant(tenantId);
- } catch (UserStoreException e) {
- String msg = "Error in retrieving the tenant information for the tenant id: " +
- tenantId + ".";
- log.info(msg, e);
- throw new Exception(msg, e);
- }
-
- // getting the other parameters from the claims.
- try {
- firstname = ClaimsMgtUtil.getFirstName(Util.getRealmService(), tenantId);
-
- } catch (Exception e) {
- String msg = "Error in retrieving the firstname for the admin of the domain " +
- tenant.getDomain();
- log.info(msg);
- }
- try {
- lastname = ClaimsMgtUtil.getLastName(Util.getRealmService(), tenantId);
- } catch (Exception e) {
- // this is expected, as many users haven't given their lastnames
- // during their registration.
- String msg = "Error in retrieving the Lastname for the admin of the domain " +
- tenant.getDomain();
- log.info(msg);
- }
-
- AccountInfoBean accountInfoBean = new AccountInfoBean();
- accountInfoBean.setFirstname(firstname);
- accountInfoBean.setLastname(lastname);
- return accountInfoBean;
- }
-
-
- /**
- * deactivates the tenant
- *
- * @throws Exception, if deactivating the tenant failed.
- */
- public void deactivate() throws Exception {
- // The one who have a proper permission will be able to deactivate the tenant.
- TenantManager tenantManager = Util.getTenantManager();
- UserRegistry registry = (UserRegistry) getGovernanceRegistry();
- if (registry == null) {
- // we can't continue without having a valid registry in the session
- String msg = "Error in retrieving the registry for the login tenant.";
- log.error(msg);
- throw new Exception(msg);
- }
- int tenantId = registry.getTenantId();
- try {
- tenantManager.deactivateTenant(tenantId);
- } catch (UserStoreException e) {
- String msg = "Error in deactivating the tenant id: " + tenantId + ".";
- log.error(msg, e);
- throw new Exception(msg, e);
- }
-
- //Notify tenant deactivation to Listeners
- Util.alertTenantDeactivation(tenantId);
- }
-
- /**
- * checks whether the domain is validated.
- *
- * @return true, if the domain has been validated.
- * @throws Exception, if the domain validation failed.
- */
- public boolean isDomainValidated() throws Exception {
- // first we will get the current domain name
- TenantManager tenantManager = Util.getTenantManager();
- UserRegistry registry = (UserRegistry) getGovernanceRegistry();
- if (registry == null) {
- // we can't continue without having a valid registry in the session
- String msg = "Error in retrieving the registry for the login tenant.";
- log.error(msg);
- throw new Exception(msg);
- }
- int tenantId = registry.getTenantId();
- // get the tenant information from the tenant manager
- Tenant tenant;
- try {
- tenant = (Tenant) tenantManager.getTenant(tenantId);
- } catch (UserStoreException e) {
- String msg = "Error in retrieving the tenant information for the tenant id: " +
- tenantId + ".";
- log.error(msg, e);
- throw new Exception(msg, e);
- }
- String domainName = tenant.getDomain();
- TenantMgtUtil.validateDomain(domainName);
-
- String domainValidationPath = StratosConstants.TENANT_DOMAIN_VERIFICATION_FLAG_PATH +
- RegistryConstants.PATH_SEPARATOR + tenantId;
- UserRegistry superTenantRegistry = Util.getGovernanceSystemRegistry(
- MultitenantConstants.SUPER_TENANT_ID);
- if (superTenantRegistry.resourceExists(domainValidationPath)) {
- Resource validationFlagR = superTenantRegistry.get(domainValidationPath);
- return "true".equals(validationFlagR.getProperty(domainName));
- }
- return false;
- }
-
- /**
- * If the domain validation has been completed.
- *
- * @param validatedDomain the domain being validated.
- * @param successKey success key
- * @return true, if the domain has been validated successfully.
- * @throws Exception, if the domain validation failed.
- */
- public boolean finishedDomainValidation(
- String validatedDomain, String successKey) throws Exception {
- // create a flag on domain validation, so that we can move the content
- // of the current domain name to the new validated domain name
- if (!CommonUtil.validateDomainFromSuccessKey(Util.getGovernanceSystemRegistry(
- MultitenantConstants.SUPER_TENANT_ID), validatedDomain, successKey)) {
- String msg = "Domain: " + validatedDomain + " is not validated against successKey: " +
- successKey + ".";
- log.error(msg);
- throw new Exception(msg);
- }
-
- // we keep an entry about domain validation here.
-
- // first we will get the current domain name
- UserRegistry registry = (UserRegistry) getGovernanceRegistry();
- if (registry == null) {
- // we can't continue without having a valid registry in the session
- String msg = "Error in retrieving the registry for the login tenant.";
- log.error(msg);
- throw new Exception(msg);
- }
- int tenantId = registry.getTenantId();
-
- // keep the domain validation path.
-
- String domainValidationPath = StratosConstants.TENANT_DOMAIN_VERIFICATION_FLAG_PATH +
- RegistryConstants.PATH_SEPARATOR + tenantId;
- UserRegistry superTenantRegistry =
- Util.getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID);
- Resource validationFlagR = superTenantRegistry.newResource();
- validationFlagR.setProperty(validatedDomain, "true");
- superTenantRegistry.put(domainValidationPath, validationFlagR);
-
- return true;
- }
-
- /**
- * Check whether the domain is available.
- *
- * @param domainName domain name
- * @return true, if the domain is available to register.
- * @throws Exception, if the domain validation failed.
- */
- public boolean checkDomainAvailability(String domainName) throws Exception {
- TenantManager tenantManager = Util.getTenantManager();
- int tenantId = tenantManager.getTenantId(domainName);
- return tenantId < 0;
- }
-
- /**
- * check whether the email has been validated.
- *
- * @throws Exception, if the validation failed.
- * @return, true if already validated.
- */
- public boolean isEmailValidated() throws Exception {
- UserRegistry userRegistry = (UserRegistry) getGovernanceRegistry();
- if (userRegistry.getTenantId() == MultitenantConstants.SUPER_TENANT_ID) {
- // no email validation step required for super tenant
- return true;
- }
-
- String email = getContact();
- UserRegistry superTenantSystemRegistry =
- Util.getGovernanceSystemRegistry(MultitenantConstants.SUPER_TENANT_ID);
- String emailVerificationPath = StratosConstants.ADMIN_EMAIL_VERIFICATION_FLAG_PATH +
- RegistryConstants.PATH_SEPARATOR +
- userRegistry.getTenantId();
- if (!superTenantSystemRegistry.resourceExists(emailVerificationPath)) {
- // the confirmation key should exist,otherwise fail registration
- return false;
- }
- Resource resource = superTenantSystemRegistry.get(emailVerificationPath);
-
- return "true".equals(resource.getProperty(email));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6724d973/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/EmailValidationService.java
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/EmailValidationService.java b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/EmailValidationService.java
deleted file mode 100644
index a8af206..0000000
--- a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/services/EmailValidationService.java
+++ /dev/null
@@ -1,153 +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.wso2.carbon.account.mgt.services;
-
-import org.wso2.carbon.account.mgt.internal.AccountMgtServiceComponent;
-import org.wso2.carbon.account.mgt.util.Util;
-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.stratos.common.beans.TenantInfoBean;
-import org.wso2.carbon.stratos.common.constants.StratosConstants;
-import org.wso2.carbon.stratos.common.util.CommonUtil;
-import org.wso2.carbon.user.api.Tenant;
-import org.wso2.carbon.user.core.UserStoreException;
-import org.wso2.carbon.user.core.tenant.TenantManager;
-import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Email Validation Service
- */
-public class EmailValidationService {
- private static final Log log = LogFactory.getLog(EmailValidationService.class);
-
- /**
- * Proceed updating the contact email address
- *
- * @param domain tenant domain
- * @param email email address
- * @param confirmationKey confirmation key.
- * @throws Exception, RegistryException.
- */
- public void proceedUpdateContact(String domain, String email, String confirmationKey)
- throws Exception {
-
- TenantManager tenantManager = Util.getTenantManager();
- int tenantId;
-
- try {
- tenantId = tenantManager.getTenantId(domain);
- } catch (UserStoreException e) {
- String msg = "Error in adding tenant, tenant domain: " + domain + ".";
- log.error(msg);
- throw new RegistryException(msg, e);
- }
-
- UserRegistry superTenantSystemRegistry = Util.getGovernanceSystemRegistry(
- MultitenantConstants.SUPER_TENANT_ID);
- String emailVerificationPath =
- StratosConstants.ADMIN_EMAIL_VERIFICATION_FLAG_PATH +
- RegistryConstants.PATH_SEPARATOR + tenantId;
- if (!superTenantSystemRegistry.resourceExists(emailVerificationPath)) {
- // the confirmation key should exist,otherwise fail registraion
- String msg = "The confirmationKey doesn't exist in service.";
- log.error(msg);
- throw new RegistryException(msg);
- }
- Resource resource = superTenantSystemRegistry.get(emailVerificationPath);
- String actualConfirmationKey = null;
- Object content = resource.getContent();
- if (content instanceof String) {
- actualConfirmationKey = (String) content;
- } else if (content instanceof byte[]) {
- actualConfirmationKey = new String((byte[]) content);
- }
-
- if (actualConfirmationKey == null || !actualConfirmationKey.equals(confirmationKey)) {
- // validation will fail.
- String msg = "The email confirmation key is not matching";
- log.error(msg);
- throw new RegistryException(msg);
- }
-
- resource.setProperty(email, "true");
-
- // now we will really update the tenant email
- Tenant tenant;
- try {
- tenant = tenantManager.getTenant(tenantId);
- } catch (UserStoreException e) {
- String msg =
- "Error in retrieving the tenant information for the tenant id: " + tenantId +
- ".";
- log.error(msg, e);
- throw new RegistryException(msg, e);
- }
-
- // If TenantActivation is moderated, the mail address associated with the validation link
- // would not be the tenant email. Otherwise, the validation mail would be the tenant email.
- if (!CommonUtil.isTenantActivationModerated()) {
- tenant.setEmail(email);
- }
-
- try {
- tenantManager.updateTenant(tenant);
- } catch (UserStoreException e) {
- String msg =
- "Error in updating the tenant information for the tenant id: " + tenantId + ".";
- log.error(msg, e);
- throw new RegistryException(msg, e);
- }
-
- // activate the tenant on successful validation of the email, if it is not already activated.
- if ("false".equals(resource.getProperty(StratosConstants.IS_EMAIL_VALIDATED))) {
- tenantManager.activateTenant(tenantId);
- // set the registry flag
- resource.editPropertyValue(StratosConstants.IS_EMAIL_VALIDATED, "false", "true");
-
- if (log.isDebugEnabled()) {
- log.debug("Tenant : " + tenantId + " is activated after validating the " +
- "email of the tenant admin.");
- }
-
- //Notify all the listeners that tenant has been activated for the first time
- Util.alertTenantInitialActivation(tenantId);
-
- //Activating the usage plan
- try{
- AccountMgtServiceComponent.getBillingService().activateUsagePlan(domain);
- }catch(Exception e){
- log.error("Error occurred while activating the usage plan for tenant: " + domain
- + " tenant Id: " + tenantId, e);
- }
-
- }
-
- //This is considered an update. Hence notify the update to all listeners
- TenantInfoBean tenantInfoBean = new TenantInfoBean();
- tenantInfoBean.setTenantId(tenantId);
- tenantInfoBean.setTenantDomain(domain);
- tenantInfoBean.setEmail(email);
- Util.alertTenantUpdate(tenantInfoBean);
-
- // update the registry
- superTenantSystemRegistry.put(emailVerificationPath, resource);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6724d973/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/util/Util.java
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/util/Util.java b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/util/Util.java
deleted file mode 100644
index 25f7673..0000000
--- a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/java/org/wso2/carbon/account/mgt/util/Util.java
+++ /dev/null
@@ -1,173 +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.account.mgt.util;
-
-import org.wso2.carbon.email.verification.util.EmailVerifcationSubscriber;
-import org.wso2.carbon.email.verification.util.EmailVerifierConfig;
-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.stratos.common.beans.TenantInfoBean;
-import org.wso2.carbon.stratos.common.constants.StratosConstants;
-import org.wso2.carbon.stratos.common.exception.StratosException;
-import org.wso2.carbon.stratos.common.listeners.TenantMgtListener;
-import org.wso2.carbon.user.core.service.RealmService;
-import org.wso2.carbon.user.core.tenant.TenantManager;
-import org.wso2.carbon.utils.CarbonUtils;
-
-import org.apache.axis2.context.MessageContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-
-/**
- * Util methods for AccountMgt
- */
-public class Util {
-
- private static final Log log = LogFactory.getLog(Util.class);
-
- private static RegistryService registryService;
- private static RealmService realmService;
- private static EmailVerifcationSubscriber emailVerificationService = null;
- private static EmailVerifierConfig emailVerfierConfig = null;
- private static List<TenantMgtListener> tenantMgtListeners = new ArrayList<TenantMgtListener>();
-
- public static synchronized void setRegistryService(RegistryService service) {
- if (registryService == null) {
- registryService = service;
- }
- }
-
-
- public static RealmService getRealmService() {
- return realmService;
- }
-
-
- public static RegistryService getRegistryService() {
- return registryService;
- }
-
- public static synchronized void setEmailVerificationService(EmailVerifcationSubscriber service) {
- if (emailVerificationService == null) {
- emailVerificationService = service;
- }
- }
-
- public static EmailVerifcationSubscriber getEmailVerificationService() {
- return emailVerificationService;
- }
-
-
- public static synchronized void setRealmService(RealmService service) {
- if (realmService == null) {
- realmService = service;
- }
- }
-
-
- public static TenantManager getTenantManager() {
- return realmService.getTenantManager();
- }
-
- public static UserRegistry getGovernanceSystemRegistry(int tenantId) throws RegistryException {
- return registryService.getGovernanceSystemRegistry(tenantId);
- }
-
- public static HttpSession getRequestSession() throws RegistryException {
- MessageContext messageContext = MessageContext.getCurrentMessageContext();
- if (messageContext == null) {
- String msg = "Could not get the user's session. Message context not found.";
- log.error(msg);
- throw new RegistryException(msg);
- }
-
- HttpServletRequest request =
- (HttpServletRequest) messageContext.getProperty("transport.http.servletRequest");
-
- return request.getSession();
- }
-
- public static void loadEmailVerificationConfig() {
- String configXml = CarbonUtils.getCarbonConfigDirPath()+ File.separator
- + StratosConstants.EMAIL_CONFIG +File.separator +"email-update.xml";
- emailVerfierConfig = org.wso2.carbon.email.verification.util.Util.loadeMailVerificationConfig(configXml);
- }
-
- public static EmailVerifierConfig getEmailVerifierConfig() {
- return emailVerfierConfig;
- }
-
- public static void addTenantMgtListenerService(TenantMgtListener tenantMgtListener) {
- tenantMgtListeners.add(tenantMgtListener);
- sortTenantMgtListeners();
- }
-
- public static void removeTenantMgtListenerService(TenantMgtListener tenantMgtListener) {
- tenantMgtListeners.remove(tenantMgtListener);
- sortTenantMgtListeners();
- }
-
- private static void sortTenantMgtListeners() {
- Collections.sort(tenantMgtListeners, new Comparator<TenantMgtListener>() {
- public int compare(TenantMgtListener o1, TenantMgtListener o2) {
- return o1.getListenerOrder() - o2.getListenerOrder();
- }
- });
- }
-
- public static void alertTenantRenames(int tenantId, String oldName,
- String newName) throws StratosException {
-
- for (TenantMgtListener tenantMgtLister : tenantMgtListeners) {
- tenantMgtLister.onTenantRename(tenantId, oldName, newName);
- }
- }
-
- public static void alertTenantDeactivation(int tenantId) throws StratosException {
-
- for (TenantMgtListener tenantMgtLister : tenantMgtListeners) {
- tenantMgtLister.onTenantDeactivation(tenantId);
- }
- }
-
- public static void alertTenantInitialActivation(int tenantId) throws StratosException {
-
- for (TenantMgtListener tenantMgtLister : tenantMgtListeners) {
- tenantMgtLister.onTenantInitialActivation(tenantId);
- }
- }
-
- public static void alertTenantUpdate(TenantInfoBean tenantInfoBean) throws StratosException {
-
- for (TenantMgtListener tenantMgtLister : tenantMgtListeners) {
- tenantMgtLister.onTenantUpdate(tenantInfoBean);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6724d973/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/services.xml
----------------------------------------------------------------------
diff --git a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/services.xml b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/services.xml
index 8b52fd8..a5deded 100644
--- a/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/services.xml
+++ b/components/stratos/account-mgt/org.wso2.carbon.account.mgt/2.1.0/src/main/resources/META-INF/services.xml
@@ -22,7 +22,7 @@
<transport>https</transport>
</transports>
<parameter name="ServiceClass" locked="false">
- org.wso2.carbon.account.mgt.services.AccountMgtService
+ org.apache.stratos.account.mgt.services.AccountMgtService
</parameter>
<operation name="updateContact">
@@ -68,7 +68,7 @@
<transport>https</transport>
</transports>
<parameter name="ServiceClass" locked="false">
- org.wso2.carbon.account.mgt.services.EmailValidationService
+ org.apache.stratos.account.mgt.services.EmailValidationService
</parameter>
<operation name="proceedUpdateContact">