[jboss-svn-commits] JBL Code SVN: r33330 - in labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main: java/org/jboss/labs/sbs/plugin/nukesauth/proxy and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jun 3 09:24:35 EDT 2010
Author: lkrzyzanek
Date: 2010-06-03 09:24:33 -0400 (Thu, 03 Jun 2010)
New Revision: 33330
Added:
labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/java/org/jboss/labs/sbs/plugin/nukesauth/proxy/
labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/java/org/jboss/labs/sbs/plugin/nukesauth/proxy/EmailValidationHelperNukesProxy.java
Modified:
labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/plugin/spring.xml
Log:
ORG-606 - added validation on e-mail uniqueness (including nukes DB).
Added: labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/java/org/jboss/labs/sbs/plugin/nukesauth/proxy/EmailValidationHelperNukesProxy.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/java/org/jboss/labs/sbs/plugin/nukesauth/proxy/EmailValidationHelperNukesProxy.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/java/org/jboss/labs/sbs/plugin/nukesauth/proxy/EmailValidationHelperNukesProxy.java 2010-06-03 13:24:33 UTC (rev 33330)
@@ -0,0 +1,65 @@
+/*
+ * JBoss Community http://jboss.org/
+ *
+ * Copyright (c) 2010 Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT A WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License, v.2.1 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Red Hat Author(s): Libor Krzyzanek
+ */
+package org.jboss.labs.sbs.plugin.nukesauth.proxy;
+
+import java.util.List;
+
+import org.jboss.labs.sbs.plugin.nukesauth.NukesAccountManager;
+import org.jboss.labs.sbs.plugin.nukesauth.dao.NukesUser;
+
+import com.jivesoftware.base.EmailAlreadyExistsException;
+import com.jivesoftware.base.UserManager;
+import com.jivesoftware.community.EmailManager;
+import com.jivesoftware.community.util.EmailValidationHelper;
+
+/**
+ * Proxy for {@link EmailValidationHelper} for checking data with Nukes DB
+ *
+ * @author <a href="mailto:lkrzyzan at redhat.com">Libor Krzyzanek</a>
+ */
+public class EmailValidationHelperNukesProxy extends EmailValidationHelper {
+
+ private NukesAccountManager nukesAccountManager;
+
+ public EmailValidationHelperNukesProxy(UserManager userManager, EmailManager emailManager) {
+ super(userManager, emailManager);
+ }
+
+ /**
+ * Check if e-mail is already used in Nukes DB if yes then
+ * {@link EmailAlreadyExistsException} is thrown. Otherwise implementation in
+ * parent class is called.
+ */
+ @Override
+ public void sendValidationRequest(String email) throws EmailAlreadyExistsException {
+ List<NukesUser> nukes = nukesAccountManager.getNukesAccountsByEmail(email);
+ if (nukes.size() > 0) {
+ throw new EmailAlreadyExistsException("E-mail is used in Nukes Database");
+ }
+
+ super.sendValidationRequest(email);
+ }
+
+ public void setNukesAccountManager(NukesAccountManager nukesAccountManager) {
+ this.nukesAccountManager = nukesAccountManager;
+ }
+}
Property changes on: labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/java/org/jboss/labs/sbs/plugin/nukesauth/proxy/EmailValidationHelperNukesProxy.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/plugin/spring.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/plugin/spring.xml 2010-06-03 12:18:34 UTC (rev 33329)
+++ labs/jbosslabs/labs-3.0-build/integration/sbs-nukesauthentication/trunk/src/main/plugin/spring.xml 2010-06-03 13:24:33 UTC (rev 33330)
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
+http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
+http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
<!--
@@ -43,11 +45,19 @@
<property name="dataSource" ref="nukesUsersDataSource" />
</bean>
-
<bean id="syncUserWithNukesListener"
class="org.jboss.labs.sbs.plugin.nukesauth.listener.SyncUserWithNukesListener">
<property name="nukesAccountManager" ref="nukesAccountManager" />
<property name="sbsAccountManager" ref="sbsAccountManager" />
</bean>
+ <bean id="emailValidationHelper"
+ class="org.jboss.labs.sbs.plugin.nukesauth.proxy.EmailValidationHelperNukesProxy"
+ lazy-init="true">
+ <constructor-arg ref="userManager" />
+ <constructor-arg ref="emailManager" />
+ <property name="eventDispatcher" ref="jiveEventDispatcher" />
+ <property name="nukesAccountManager" ref="nukesAccountManager" />
+ </bean>
+
</beans>
More information about the jboss-svn-commits
mailing list