[jboss-cvs] jboss-seam/examples/booking/src/org/jboss/seam/example/booking ...
Gavin King
gavin.king at jboss.com
Sun Feb 25 18:27:19 EST 2007
User: gavin
Date: 07/02/25 18:27:19
Modified: examples/booking/src/org/jboss/seam/example/booking
Authenticator.java AuthenticatorAction.java
Log:
authenticator can be stateless
Revision Changes Path
1.2 +0 -1 jboss-seam/examples/booking/src/org/jboss/seam/example/booking/Authenticator.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Authenticator.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/booking/src/org/jboss/seam/example/booking/Authenticator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Authenticator.java 13 Feb 2007 03:49:42 -0000 1.1
+++ Authenticator.java 25 Feb 2007 23:27:19 -0000 1.2
@@ -6,5 +6,4 @@
public interface Authenticator
{
boolean authenticate();
- void destroy();
}
1.2 +4 -18 jboss-seam/examples/booking/src/org/jboss/seam/example/booking/AuthenticatorAction.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AuthenticatorAction.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/booking/src/org/jboss/seam/example/booking/AuthenticatorAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- AuthenticatorAction.java 13 Feb 2007 03:49:42 -0000 1.1
+++ AuthenticatorAction.java 25 Feb 2007 23:27:19 -0000 1.2
@@ -1,29 +1,20 @@
package org.jboss.seam.example.booking;
-import static org.jboss.seam.ScopeType.EVENT;
import static org.jboss.seam.ScopeType.SESSION;
import java.util.List;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
+import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
-import org.jboss.seam.annotations.Destroy;
-import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Out;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.security.Identity;
- at Stateful
- at Scope(EVENT)
+ at Stateless
@Name("authenticator")
public class AuthenticatorAction implements Authenticator
{
- @In Identity identity;
-
@PersistenceContext EntityManager em;
@Out(required=false, scope = SESSION)
@@ -31,10 +22,7 @@
public boolean authenticate()
{
- List results = em.createQuery(
- "select u from User u where u.username=:username and u.password=:password")
- .setParameter("username", identity.getUsername())
- .setParameter("password", identity.getPassword())
+ List results = em.createQuery("select u from User u where u.username=#{identity.username} and u.password=#{identity.password}")
.getResultList();
if ( results.size()==0 )
@@ -48,6 +36,4 @@
}
}
- @Remove @Destroy
- public void destroy() {}
}
More information about the jboss-cvs-commits
mailing list