Author: dan.j.allen
Date: 2009-05-29 14:20:39 -0400 (Fri, 29 May 2009)
New Revision: 11044
Added:
modules/trunk/beans/src/main/java/org/jboss/seam/beans/Created.java
modules/trunk/beans/src/main/java/org/jboss/seam/beans/Destroyed.java
modules/trunk/international/src/test/java/org/jboss/seam/international/SampleBean.java
modules/trunk/web/src/main/java/org/jboss/seam/web/SeamListener.java
Removed:
modules/trunk/drools/src/main/java/org/jboss/seam/drools/util/
modules/trunk/el/src/main/java/org/jboss/seam/el/SeamFunctionMapper.java
modules/trunk/international/src/test/java/org/jboss/seam/international/Thing.java
Modified:
modules/trunk/beans/pom.xml
modules/trunk/bpm/pom.xml
modules/trunk/bridge-api/pom.xml
modules/trunk/drools/pom.xml
modules/trunk/drools/src/main/java/org/jboss/seam/drools/RuleAgent.java
modules/trunk/drools/src/main/java/org/jboss/seam/drools/RuleBase.java
modules/trunk/el/pom.xml
modules/trunk/faces/pom.xml
modules/trunk/faces/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/FacesMessages.java
modules/trunk/faces/src/main/java/org/jboss/seam/faces/resources/FacesResourceLoader.java
modules/trunk/faces/src/test/java/org/jboss/seam/faces/context/FacesContextProducerTest.java
modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/FacesMessagesTest.java
modules/trunk/international/pom.xml
modules/trunk/international/src/main/java/org/jboss/seam/international/Interpolator.java
modules/trunk/international/src/main/java/org/jboss/seam/international/SeamResourceBundleAdapter.java
modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java
modules/trunk/international/src/test/java/org/jboss/seam/international/AutoInterpolatedMessagesTest.java
modules/trunk/international/src/test/java/org/jboss/seam/international/InterpolatorTest.java
modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesTest.java
modules/trunk/international/src/test/resources/messages.properties
modules/trunk/openwebbeans-bridge/pom.xml
modules/trunk/persistence/pom.xml
modules/trunk/resources/pom.xml
modules/trunk/resources/src/main/java/org/jboss/seam/resources/DefaultResourceLoader.java
modules/trunk/resources/src/test/java/org/jboss/seam/resources/DefaultResourceLoaderTest.java
modules/trunk/security/pom.xml
modules/trunk/security/src/main/java/org/jboss/seam/security/Credentials.java
modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java
modules/trunk/security/src/main/java/org/jboss/seam/security/RememberMe.java
modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityManager.java
modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
modules/trunk/security/src/main/java/org/jboss/seam/security/management/LdapIdentityStore.java
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PermissionManager.java
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PersistentPermissionResolver.java
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java
modules/trunk/transaction/pom.xml
modules/trunk/web/pom.xml
Log:
switch to @Logger Log log to inject log (except for a few places)
reorder dependencies in several pom.xml files
introduce early version of SeamListener to prototype notifying beans of session startup
event
Modified: modules/trunk/beans/pom.xml
===================================================================
--- modules/trunk/beans/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/beans/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -25,9 +25,7 @@
<dependency>
<groupId>${webbeans.groupId}</groupId>
- <artifactId>webbeans-logging</artifactId>
- <!-- assumes use of Web Beans impl -->
- <scope>provided</scope>
+ <artifactId>webbeans-logger</artifactId>
</dependency>
</dependencies>
Added: modules/trunk/beans/src/main/java/org/jboss/seam/beans/Created.java
===================================================================
--- modules/trunk/beans/src/main/java/org/jboss/seam/beans/Created.java
(rev 0)
+++ modules/trunk/beans/src/main/java/org/jboss/seam/beans/Created.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -0,0 +1,27 @@
+package org.jboss.seam.beans;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+/**
+ * A generic binding type that indicates that something was created.
+ *
+ * @author Dan Allen
+ */
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@Inherited
+public @interface Created {
+}
Added: modules/trunk/beans/src/main/java/org/jboss/seam/beans/Destroyed.java
===================================================================
--- modules/trunk/beans/src/main/java/org/jboss/seam/beans/Destroyed.java
(rev 0)
+++ modules/trunk/beans/src/main/java/org/jboss/seam/beans/Destroyed.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -0,0 +1,27 @@
+package org.jboss.seam.beans;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BindingType;
+
+/**
+ * A generic binding type that indicates that something was destroyed.
+ *
+ * @author Dan Allen
+ */
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@BindingType
+@Inherited
+public @interface Destroyed {
+}
Modified: modules/trunk/bpm/pom.xml
===================================================================
--- modules/trunk/bpm/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/bpm/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -15,38 +15,47 @@
<name>Seam BPM</name>
<dependencies>
+
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>jsr299-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jbpm</groupId>
- <artifactId>jbpm-jpdl</artifactId>
- </dependency>
- <dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</dependency>
+
<dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
</dependency>
+
<dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- </dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ </dependency>
+
<dependency>
- <groupId>org.jboss.seam</groupId>
+ <groupId>${seam.groupId}</groupId>
<artifactId>seam-el</artifactId>
</dependency>
+
<dependency>
- <groupId>org.jboss.seam</groupId>
+ <groupId>${seam.groupId}</groupId>
<artifactId>seam-international</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>jsr299-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logger</artifactId>
+ </dependency>
+
</dependencies>
</project>
Modified: modules/trunk/bridge-api/pom.xml
===================================================================
--- modules/trunk/bridge-api/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/bridge-api/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -32,8 +32,7 @@
<dependency>
<groupId>${webbeans.groupId}</groupId>
- <artifactId>webbeans-logging</artifactId>
- <scope>provided</scope> <!-- Assumes use of Web Beans RI -->
+ <artifactId>webbeans-logger</artifactId>
</dependency>
</dependencies>
Modified: modules/trunk/drools/pom.xml
===================================================================
--- modules/trunk/drools/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/drools/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -17,37 +17,41 @@
<dependencies>
<dependency>
- <groupId>${webbeans.groupId}</groupId>
- <artifactId>jsr299-api</artifactId>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>${webbeans.groupId}</groupId>
- <artifactId>webbeans-logging</artifactId>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-compiler</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-core</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>${seam.groupId}</groupId>
<artifactId>seam-el</artifactId>
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
+ <groupId>${seam.groupId}</groupId>
+ <artifactId>seam-resources</artifactId>
</dependency>
<dependency>
- <groupId>org.drools</groupId>
- <artifactId>drools-core</artifactId>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>jsr299-api</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.drools</groupId>
- <artifactId>drools-compiler</artifactId>
- <scope>provided</scope>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logger</artifactId>
</dependency>
</dependencies>
Modified: modules/trunk/drools/src/main/java/org/jboss/seam/drools/RuleAgent.java
===================================================================
--- modules/trunk/drools/src/main/java/org/jboss/seam/drools/RuleAgent.java 2009-05-29
18:14:11 UTC (rev 11043)
+++ modules/trunk/drools/src/main/java/org/jboss/seam/drools/RuleAgent.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -5,12 +5,13 @@
import java.util.Properties;
import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Current;
import javax.enterprise.inject.Initializer;
import javax.enterprise.inject.Produces;
-import org.jboss.seam.drools.util.Resources;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.seam.resources.ResourceLoader;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* Manager component for a rule base loaded from a drools RulesAgent
@@ -18,8 +19,10 @@
@ApplicationScoped
public class RuleAgent
{
- private static final LogProvider log = Logging.getLogProvider(RuleAgent.class);
+ @Logger Log log;
+ @Current ResourceLoader resourceLoader;
+
private org.drools.agent.RuleAgent agent;
private String configurationFile;
@@ -69,7 +72,7 @@
throws IOException
{
if (configurationFile != null) {
- InputStream inputStream = Resources.getResourceAsStream(configurationFile);
+ InputStream inputStream =
resourceLoader.getResourceAsStream(configurationFile);
if (inputStream != null) {
try {
properties.load(inputStream);
Modified: modules/trunk/drools/src/main/java/org/jboss/seam/drools/RuleBase.java
===================================================================
--- modules/trunk/drools/src/main/java/org/jboss/seam/drools/RuleBase.java 2009-05-29
18:14:11 UTC (rev 11043)
+++ modules/trunk/drools/src/main/java/org/jboss/seam/drools/RuleBase.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -8,16 +8,15 @@
import javax.enterprise.inject.Current;
import javax.enterprise.inject.Initializer;
import javax.enterprise.inject.Produces;
-import javax.servlet.ServletContext;
import org.drools.RuleBaseFactory;
import org.drools.compiler.DroolsError;
import org.drools.compiler.PackageBuilder;
import org.drools.compiler.PackageBuilderConfiguration;
import org.drools.compiler.RuleError;
-import org.jboss.seam.drools.util.Resources;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.seam.resources.ResourceLoader;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* Manager component for a Drools RuleBase
@@ -28,14 +27,14 @@
@ApplicationScoped
public class RuleBase
{
- private static final LogProvider log = Logging.getLogProvider(RuleBase.class);
+ @Logger Log log;
+ @Current ResourceLoader resourceLoader;
+
private String[] ruleFiles;
private String dslFile;
private org.drools.RuleBase ruleBase;
- @Current ServletContext servletContext;
-
@Initializer
public void compileRuleBase() throws Exception
{
@@ -117,6 +116,6 @@
public InputStream getResourceAsStream(String resource)
{
- return Resources.getResourceAsStream( resource, servletContext );
+ return resourceLoader.getResourceAsStream(resource);
}
}
Modified: modules/trunk/el/pom.xml
===================================================================
--- modules/trunk/el/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/el/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -36,19 +36,6 @@
<dependencies>
<dependency>
- <groupId>${webbeans.groupId}</groupId>
- <artifactId>jsr299-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>${webbeans.groupId}</groupId>
- <artifactId>webbeans-logging</artifactId>
- <!-- assumes use of Web Beans impl -->
- <scope>provided</scope>
- </dependency>
-
- <dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<scope>provided</scope>
@@ -64,6 +51,17 @@
<artifactId>seam-beans</artifactId>
</dependency>
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>jsr299-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logger</artifactId>
+ </dependency>
+
</dependencies>
</project>
Deleted: modules/trunk/el/src/main/java/org/jboss/seam/el/SeamFunctionMapper.java
===================================================================
--- modules/trunk/el/src/main/java/org/jboss/seam/el/SeamFunctionMapper.java 2009-05-29
18:14:11 UTC (rev 11043)
+++ modules/trunk/el/src/main/java/org/jboss/seam/el/SeamFunctionMapper.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -1,140 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY 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 along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- *
- * $Id$
- */
-package org.jboss.seam.el;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.el.FunctionMapper;
-
-import org.jboss.el.lang.ExtendedFunctionMapper;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-//import org.jboss.seam.security.SecurityFunctions;
-
-/**
- * Resolves Seam Security EL functions, s:hasRole() and s:hasPermission()
- * by decorating a delegate Unified EL FunctionMapper
- *
- * @author Shane Bryzak
- */
-public class SeamFunctionMapper extends ExtendedFunctionMapper
-{
- private static Map<String,List<Method>> methodCache = new
HashMap<String,List<Method>>();
-
- private static final LogProvider log =
Logging.getLogProvider(SeamFunctionMapper.class);
-
- private FunctionMapper functionMapper;
-
- public SeamFunctionMapper(FunctionMapper functionMapper)
- {
- this.functionMapper = functionMapper;
- }
-
- static
- {
- /*
- FIXME where should this class go so that these functions can be loaded?
- cacheMethod("hasPermission", SecurityFunctions.class,
"hasPermission",
- new Class[] {String.class, String.class, Object.class});
- cacheMethod("hasPermission", SecurityFunctions.class,
"hasPermission",
- new Class[] {Object.class, String.class});
- cacheMethod("hasRole", SecurityFunctions.class, "hasRole",
- new Class[] { String.class });
- */
- }
-
- @Override
- public Method resolveFunction(String prefix, String localName)
- {
- if ( "s".equals(prefix) )
- {
- List<Method> methods = methodCache.get(localName);
- return methods != null ? methods.get(0) : null;
- }
- else if (functionMapper != null)
- {
- return functionMapper.resolveFunction(prefix, localName);
- }
- else
- {
- return null;
- }
- }
-
- @Override
- public Method resolveFunction(String prefix, String localName, int paramCount)
- {
- if ( "s".equals(prefix) )
- {
- List<Method> methods = methodCache.get(localName);
- if (methods != null)
- {
- for (Method m : methods)
- {
- if (m.getParameterTypes().length == paramCount) return m;
- }
- }
-
- return null;
- }
- else if (functionMapper != null)
- {
- return functionMapper.resolveFunction(prefix, localName);
- }
- else
- {
- return null;
- }
- }
-
- private static void cacheMethod(String localName, Class cls, String name, Class[]
params)
- {
- try
- {
- Method m = cls.getMethod(name, params);
-
- List<Method> methods;
- if (methodCache.containsKey(localName))
- {
- methods = methodCache.get(localName);
- }
- else
- {
- methods = new ArrayList<Method>();
- methodCache.put(localName, methods);
- }
-
- methods.add(m);
- }
- catch (NoSuchMethodException ex)
- {
- log.warn(String.format("Method %s.%s could not be cached",
cls.getName(), name));
- }
- }
-
-}
Modified: modules/trunk/faces/pom.xml
===================================================================
--- modules/trunk/faces/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/faces/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -38,6 +38,30 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
<!-- doesn't inherit from seam-international because scope is provided
-->
<dependency>
<groupId>javax.validation</groupId>
@@ -85,35 +109,9 @@
<dependency>
<groupId>${webbeans.groupId}</groupId>
- <artifactId>webbeans-logging</artifactId>
- <!-- assumes use of Web Beans impl -->
- <scope>provided</scope>
+ <artifactId>webbeans-logger</artifactId>
</dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- <scope>provided</scope>
- </dependency>
-
</dependencies>
</project>
Modified:
modules/trunk/faces/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java
===================================================================
---
modules/trunk/faces/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/faces/src/main/java/org/jboss/seam/faces/context/FacesContextProducer.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -1,6 +1,7 @@
//$Id: FacesContext.java 5350 2007-06-20 17:53:19Z gavin $
package org.jboss.seam.faces.context;
+import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import javax.faces.context.FacesContext;
@@ -15,6 +16,7 @@
{
public
@Produces
+ @RequestScoped
FacesContext getFacesContext()
{
return FacesContext.getCurrentInstance();
Modified:
modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/FacesMessages.java
===================================================================
---
modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/FacesMessages.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/faces/src/main/java/org/jboss/seam/faces/international/FacesMessages.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -13,8 +13,8 @@
import org.jboss.seam.international.StatusMessage;
import org.jboss.seam.international.StatusMessages;
import org.jboss.seam.international.StatusMessagesDelegate;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* <p>
@@ -60,7 +60,7 @@
@Faces
class FacesMessages extends StatusMessagesDelegate
{
- private static final LogProvider log = Logging.getLogProvider(FacesMessages.class);
+ @Logger Log log;
private StatusMessages statusMessages;
Modified:
modules/trunk/faces/src/main/java/org/jboss/seam/faces/resources/FacesResourceLoader.java
===================================================================
---
modules/trunk/faces/src/main/java/org/jboss/seam/faces/resources/FacesResourceLoader.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/faces/src/main/java/org/jboss/seam/faces/resources/FacesResourceLoader.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -12,8 +12,8 @@
import org.jboss.seam.beans.RuntimeSelected;
import org.jboss.seam.beans.RuntimeSelectedBean;
import org.jboss.seam.resources.DefaultResourceLoader;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* Extend the {@link DefaultResourceLoader} in the JSF environment to first
@@ -25,8 +25,7 @@
@RuntimeSelected
class FacesResourceLoader extends DefaultResourceLoader implements RuntimeSelectedBean
{
- private static final LogProvider log =
Logging.getLogProvider(FacesResourceLoader.class);
-
+ @Logger Log log;
@Current FacesContext facesContext;
@Current Locale locale;
Modified:
modules/trunk/faces/src/test/java/org/jboss/seam/faces/context/FacesContextProducerTest.java
===================================================================
---
modules/trunk/faces/src/test/java/org/jboss/seam/faces/context/FacesContextProducerTest.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/faces/src/test/java/org/jboss/seam/faces/context/FacesContextProducerTest.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -1,5 +1,6 @@
package org.jboss.seam.faces.context;
+import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertSame;
import javax.faces.context.FacesContext;
@@ -36,7 +37,8 @@
assertSame(standaloneProducer.getFacesContext(), actualFacesContext);
FacesContext producedFacesContext = getFacesContextInstance();
- assertSame(producedFacesContext, actualFacesContext);
+ // QUESTION how exactly do we verify that we have the correct object if wrapped in
proxy?
+ assertEquals(producedFacesContext.hashCode(), actualFacesContext.hashCode());
assertSame(producedFacesContext.getCurrentPhaseId(), PhaseId.RENDER_RESPONSE);
}
Modified:
modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/FacesMessagesTest.java
===================================================================
---
modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/FacesMessagesTest.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/faces/src/test/java/org/jboss/seam/faces/international/FacesMessagesTest.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -29,6 +29,7 @@
import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.webbeans.context.ConversationContext;
import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.webbeans.log.LoggerProducer;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
@@ -46,8 +47,8 @@
@Artifact(addCurrentPackage = false)
@Classes(
{
- FacesMessages.class, StatusMessages.class, Interpolator.class, Expressions.class,
ExpressionsProducer.class,
- LocaleProducer.class, LocaleResolver.class, LocaleResolverProducer.class
+ LoggerProducer.class, FacesMessages.class, StatusMessages.class, Interpolator.class,
+ Expressions.class, ExpressionsProducer.class, LocaleProducer.class,
LocaleResolver.class, LocaleResolverProducer.class
})
public class FacesMessagesTest extends AbstractWebBeansTest
{
Modified: modules/trunk/international/pom.xml
===================================================================
--- modules/trunk/international/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/international/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -33,6 +33,18 @@
<dependencies>
<dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
<groupId>${seam.groupId}</groupId>
<artifactId>seam-bridge-api</artifactId>
</dependency>
@@ -55,23 +67,9 @@
<dependency>
<groupId>${webbeans.groupId}</groupId>
- <artifactId>webbeans-logging</artifactId>
- <!-- assumes use of Web Beans impl -->
- <scope>provided</scope>
+ <artifactId>webbeans-logger</artifactId>
</dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.validation</groupId>
- <artifactId>validation-api</artifactId>
- <scope>provided</scope>
- </dependency>
-
</dependencies>
</project>
Modified:
modules/trunk/international/src/main/java/org/jboss/seam/international/Interpolator.java
===================================================================
---
modules/trunk/international/src/main/java/org/jboss/seam/international/Interpolator.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/international/src/main/java/org/jboss/seam/international/Interpolator.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -8,8 +8,8 @@
import javax.enterprise.inject.Initializer;
import org.jboss.seam.el.Expressions;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* Interpolates EL expressions in Strings
@@ -18,7 +18,7 @@
*/
public class Interpolator implements Serializable
{
- private static final LogProvider log = Logging.getLogProvider(Interpolator.class);
+ @Logger Log log;
private Expressions expressions;
private Locale locale;
Modified:
modules/trunk/international/src/main/java/org/jboss/seam/international/SeamResourceBundleAdapter.java
===================================================================
---
modules/trunk/international/src/main/java/org/jboss/seam/international/SeamResourceBundleAdapter.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/international/src/main/java/org/jboss/seam/international/SeamResourceBundleAdapter.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -26,7 +26,7 @@
}
catch (MissingResourceException mre)
{
- // superclass will throw MissingResourceException if null is returned
+ // fear not, the superclass will throw MissingResourceException if null is
returned
}
return null;
Modified:
modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java
===================================================================
---
modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/international/src/main/java/org/jboss/seam/international/StatusMessages.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -43,8 +43,8 @@
import javax.validation.ConstraintViolation;
import org.jboss.seam.international.StatusMessage.Severity;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* <p>{@link StatusMessages} is a technology agnostic repository for holding
@@ -75,7 +75,7 @@
{
private static final long serialVersionUID = -5396789975397138270L;
- private static final LogProvider log = Logging.getLogProvider(StatusMessages.class);
+ @Logger Log log;
private List<StatusMessage> messages = new ArrayList<StatusMessage>();
Modified:
modules/trunk/international/src/test/java/org/jboss/seam/international/AutoInterpolatedMessagesTest.java
===================================================================
---
modules/trunk/international/src/test/java/org/jboss/seam/international/AutoInterpolatedMessagesTest.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/international/src/test/java/org/jboss/seam/international/AutoInterpolatedMessagesTest.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -14,11 +14,12 @@
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.webbeans.el.WebBeansELResolver;
+import org.jboss.webbeans.log.LoggerProducer;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
@Artifact
-(a)Classes({DefaultResourceLoader.class, ResourceLoaderProducer.class, Expressions.class,
ExpressionsProducer.class})
+(a)Classes({LoggerProducer.class, DefaultResourceLoader.class,
ResourceLoaderProducer.class, Expressions.class, ExpressionsProducer.class})
public class AutoInterpolatedMessagesTest extends AbstractWebBeansTest
{
private boolean elResolverInitialized = false;
@@ -38,7 +39,7 @@
{
ResourceBundle messages = getMessages();
assertEquals(messages.getString("title"), "Hello Seam!");
- assertEquals(messages.getString("thing"), "It's called
music");
+ assertEquals(messages.getString("tagline"), "We put the rich in Java
EE");
}
private void installWebBeansELResolver()
Modified:
modules/trunk/international/src/test/java/org/jboss/seam/international/InterpolatorTest.java
===================================================================
---
modules/trunk/international/src/test/java/org/jboss/seam/international/InterpolatorTest.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/international/src/test/java/org/jboss/seam/international/InterpolatorTest.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -15,6 +15,7 @@
import org.jboss.seam.el.ExpressionsProducer;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.webbeans.log.LoggerProducer;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
@@ -29,7 +30,10 @@
* @see LocaleProducer
*/
@Artifact(addCurrentPackage = false)
-(a)Classes({Interpolator.class, Expressions.class, ExpressionsProducer.class,
LocaleProducer.class, LocaleResolver.class, LocaleResolverProducer.class})
+@Classes({
+ LoggerProducer.class, Interpolator.class, Expressions.class,
ExpressionsProducer.class,
+ LocaleProducer.class, LocaleResolver.class, LocaleResolverProducer.class
+})
public class InterpolatorTest extends AbstractWebBeansTest
{
private boolean elResolverInitialized = false;
Copied:
modules/trunk/international/src/test/java/org/jboss/seam/international/SampleBean.java
(from rev 11026,
modules/trunk/international/src/test/java/org/jboss/seam/international/Thing.java)
===================================================================
---
modules/trunk/international/src/test/java/org/jboss/seam/international/SampleBean.java
(rev 0)
+++
modules/trunk/international/src/test/java/org/jboss/seam/international/SampleBean.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -0,0 +1,18 @@
+package org.jboss.seam.international;
+
+import javax.enterprise.inject.Named;
+
+public
+@Named
+class SampleBean
+{
+ public String getFeature()
+ {
+ return "rich";
+ }
+
+ public String getPlatform()
+ {
+ return "Java EE";
+ }
+}
Modified:
modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesTest.java
===================================================================
---
modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesTest.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/international/src/test/java/org/jboss/seam/international/StatusMessagesTest.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -10,6 +10,7 @@
import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.webbeans.context.ConversationContext;
import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.webbeans.log.LoggerProducer;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
@@ -22,7 +23,7 @@
@Artifact(addCurrentPackage = false)
@Classes(
{
- StatusMessages.class, Interpolator.class, Expressions.class,
ExpressionsProducer.class,
+ LoggerProducer.class, StatusMessages.class, Interpolator.class, Expressions.class,
ExpressionsProducer.class,
LocaleProducer.class, LocaleResolver.class, LocaleResolverProducer.class,
MessagesProducer.class,
DefaultResourceLoader.class, ResourceLoaderProducer.class
})
Deleted:
modules/trunk/international/src/test/java/org/jboss/seam/international/Thing.java
===================================================================
---
modules/trunk/international/src/test/java/org/jboss/seam/international/Thing.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/international/src/test/java/org/jboss/seam/international/Thing.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -1,13 +0,0 @@
-package org.jboss.seam.international;
-
-import javax.enterprise.inject.Named;
-
-public
-@Named
-class Thing
-{
- public String getName()
- {
- return "music";
- }
-}
Modified: modules/trunk/international/src/test/resources/messages.properties
===================================================================
--- modules/trunk/international/src/test/resources/messages.properties 2009-05-29 18:14:11
UTC (rev 11043)
+++ modules/trunk/international/src/test/resources/messages.properties 2009-05-29 18:20:39
UTC (rev 11044)
@@ -1,2 +1,2 @@
title=Hello Seam!
-thing=It's called #{thing.name}
+tagline=We put the #{sampleBean.feature} in #{sampleBean.platform}
Modified: modules/trunk/openwebbeans-bridge/pom.xml
===================================================================
--- modules/trunk/openwebbeans-bridge/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/openwebbeans-bridge/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -36,6 +36,13 @@
<dependencies>
<dependency>
+ <groupId>org.apache.openwebbeans</groupId>
+ <artifactId>openwebbeans-impl</artifactId>
+ <version>1.0.0-incubating-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
<groupId>${seam.groupId}</groupId>
<artifactId>seam-bridge-api</artifactId>
</dependency>
@@ -46,13 +53,6 @@
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.apache.openwebbeans</groupId>
- <artifactId>openwebbeans-impl</artifactId>
- <version>1.0.0-incubating-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
-
</dependencies>
</project>
Modified: modules/trunk/persistence/pom.xml
===================================================================
--- modules/trunk/persistence/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/persistence/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -15,30 +15,37 @@
<name>Seam Persistence</name>
<dependencies>
+
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>jsr299-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-logging</artifactId>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
</dependency>
+
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
- </dependency>
+ </dependency>
+
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</dependency>
+
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.seam</groupId>
+ <groupId>${seam.groupId}</groupId>
<artifactId>seam-el</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>jsr299-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logger</artifactId>
+ </dependency>
+
</dependencies>
</project>
Modified: modules/trunk/resources/pom.xml
===================================================================
--- modules/trunk/resources/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/resources/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -30,9 +30,7 @@
<dependency>
<groupId>${webbeans.groupId}</groupId>
- <artifactId>webbeans-logging</artifactId>
- <!-- assumes use of Web Beans impl -->
- <scope>provided</scope>
+ <artifactId>webbeans-logger</artifactId>
</dependency>
</dependencies>
Modified:
modules/trunk/resources/src/main/java/org/jboss/seam/resources/DefaultResourceLoader.java
===================================================================
---
modules/trunk/resources/src/main/java/org/jboss/seam/resources/DefaultResourceLoader.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/resources/src/main/java/org/jboss/seam/resources/DefaultResourceLoader.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -29,8 +29,8 @@
import java.util.ResourceBundle;
import org.jboss.seam.beans.Default;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* A simple resource loader.
@@ -45,7 +45,7 @@
@Default
class DefaultResourceLoader implements ResourceLoader
{
- private static final LogProvider log =
Logging.getLogProvider(DefaultResourceLoader.class);
+ @Logger Log log;
public Class<?> getClassForName(String name)
{
Modified:
modules/trunk/resources/src/test/java/org/jboss/seam/resources/DefaultResourceLoaderTest.java
===================================================================
---
modules/trunk/resources/src/test/java/org/jboss/seam/resources/DefaultResourceLoaderTest.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/resources/src/test/java/org/jboss/seam/resources/DefaultResourceLoaderTest.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -7,11 +7,14 @@
import java.net.URL;
import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
import org.jboss.testharness.impl.packaging.jsr299.JSR299ArtifactDescriptor;
+import org.jboss.webbeans.log.LoggerProducer;
import org.jboss.webbeans.test.AbstractWebBeansTest;
import org.testng.annotations.Test;
@Artifact
+(a)Classes(LoggerProducer.class)
public class DefaultResourceLoaderTest extends AbstractWebBeansTest
{
@Test
Modified: modules/trunk/security/pom.xml
===================================================================
--- modules/trunk/security/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/security/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -17,44 +17,45 @@
<dependencies>
<dependency>
- <groupId>${webbeans.groupId}</groupId>
- <artifactId>jsr299-api</artifactId>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>${webbeans.groupId}</groupId>
- <artifactId>webbeans-logging</artifactId>
+ <groupId>javax.ejb</groupId>
+ <artifactId>ejb-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>javax.persistence</groupId>
- <artifactId>persistence-api</artifactId>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
<scope>provided</scope>
</dependency>
+ <!-- Is this an acceptable dependency? -->
<dependency>
- <groupId>javax.ejb</groupId>
- <artifactId>ejb-api</artifactId>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <scope>provided</scope>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-core</artifactId>
</dependency>
<dependency>
- <groupId>org.drools</groupId>
- <artifactId>drools-core</artifactId>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -92,11 +93,16 @@
-->
<dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>jsr299-api</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logger</artifactId>
+ </dependency>
+
</dependencies>
</project>
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/Credentials.java
===================================================================
---
modules/trunk/security/src/main/java/org/jboss/seam/security/Credentials.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/security/src/main/java/org/jboss/seam/security/Credentials.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -9,29 +9,24 @@
import org.jboss.seam.security.events.CredentialsInitializedEvent;
import org.jboss.seam.security.events.CredentialsUpdatedEvent;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
-@Named
+(a)Named//("org.jboss.seam.security.credentials")
@SessionScoped
public class Credentials implements Serializable
{
private static final long serialVersionUID = -2271248957776488426L;
- public static final String EVENT_INIT_CREDENTIALS =
"org.jboss.seam.security.initCredentials";
- public static final String EVENT_CREDENTIALS_UPDATED =
"org.jboss.seam.security.credentialsUpdated";
-
- private static final LogProvider log = Logging.getLogProvider(Credentials.class);
-
@Current BeanManager manager;
private String username;
private String password;
- private boolean invalid = false;
+ private boolean invalid;
private boolean initialized;
+ public Credentials() {}
+
public boolean isInitialized()
{
return initialized;
@@ -97,6 +92,7 @@
{
username = null;
password = null;
+ initialized = false;
}
@Override
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java
===================================================================
--- modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java 2009-05-29
18:14:11 UTC (rev 11043)
+++ modules/trunk/security/src/main/java/org/jboss/seam/security/Identity.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -42,8 +42,8 @@
import org.jboss.seam.security.events.QuietLoginEvent;
import org.jboss.seam.security.management.IdentityManager;
import org.jboss.seam.security.permission.PermissionMapper;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* API for authorization and authentication via Seam security.
@@ -60,7 +60,7 @@
public static final String ROLES_GROUP = "Roles";
- private static final LogProvider log = Logging.getLogProvider(Identity.class);
+ @Logger Log log;
@Current private BeanManager manager;
@Current private Credentials credentials;
Modified: modules/trunk/security/src/main/java/org/jboss/seam/security/RememberMe.java
===================================================================
---
modules/trunk/security/src/main/java/org/jboss/seam/security/RememberMe.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/security/src/main/java/org/jboss/seam/security/RememberMe.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -32,52 +32,24 @@
*
* @author Shane Bryzak
*/
-@Named
+(a)Named//("org.jboss.seam.security.rememberMe")
@SessionScoped
public class RememberMe implements Serializable
{
private static final long serialVersionUID = 2242379431576068199L;
+
+ public enum Mode { disabled, usernameOnly, autoLogin}
- private class DecodedToken
- {
- private String username;
- private String value;
-
- public DecodedToken(String cookieValue)
- {
- if (cookieValue != null)
- {
- try
- {
- String decoded = new String(Base64.decode(cookieValue));
- username = decoded.substring(0, decoded.indexOf(':'));
- value = decoded.substring(decoded.indexOf(':') + 1);
- }
- catch (Exception ex)
- {
- // swallow
- }
- }
- }
-
- public String getUsername()
- {
- return username;
- }
-
- public String getValue()
- {
- return value;
- }
- }
-
+ @Current BeanManager manager;
+ @Current Identity identity;
+ @Current Credentials credentials;
+ @Current IdentityManager identityManager;
+
private ManagedCookie usernameSelector;
private ManagedCookie tokenSelector;
private TokenStore tokenStore;
- @Current BeanManager manager;
-
private boolean enabled;
private int cookieMaxAge = ManagedCookie.DEFAULT_MAX_AGE;
@@ -86,67 +58,13 @@
private Random random = new Random(System.currentTimeMillis());
- public enum Mode { disabled, usernameOnly, autoLogin}
-
private Mode mode = Mode.usernameOnly;
- @Current private Identity identity;
- @Current private Credentials credentials;
- @Current private IdentityManager identityManager;
+ public RememberMe() {}
- public Mode getMode()
- {
- return mode;
- }
-
- public void setMode(Mode mode)
- {
- this.mode = mode;
- }
-
- public boolean isEnabled()
- {
- return enabled;
- }
-
- public void setEnabled(boolean enabled)
- {
- if (this.enabled != enabled)
- {
- this.enabled = enabled;
- // selector is null during component initialization (setup handled in @Create
method)
- if (usernameSelector != null && mode.equals(Mode.usernameOnly))
- {
- usernameSelector.setCookieEnabled(enabled);
- }
- // selector is null during component initialization (setup handled in @Create
method)
- else if (tokenSelector != null && mode.equals(Mode.autoLogin))
- {
- tokenSelector.setCookieEnabled(enabled);
- }
- }
- }
-
- public int getCookieMaxAge() {
- return cookieMaxAge;
- }
-
- public void setCookieMaxAge(int cookieMaxAge) {
- this.cookieMaxAge = cookieMaxAge;
- }
-
- public TokenStore getTokenStore()
- {
- return tokenStore;
- }
-
- public void setTokenStore(TokenStore tokenStore)
- {
- this.tokenStore = tokenStore;
- }
-
+ public
@Initializer
- public void create()
+ void create()
{
Bean<ManagedCookie> selectorBean =
manager.getBeans(ManagedCookie.class).iterator().next();
@@ -169,24 +87,6 @@
}
}
}
-
- protected String generateTokenValue()
- {
- StringBuilder sb = new StringBuilder();
- sb.append(new UID().toString());
- sb.append(":");
- sb.append(random.nextLong());
- return sb.toString();
- }
-
- protected String encodeToken(String username, String value)
- {
- StringBuilder sb = new StringBuilder();
- sb.append(username);
- sb.append(":");
- sb.append(value);
- return Base64.encodeBytes(sb.toString().getBytes());
- }
public void initCredentials(@Observes CredentialsInitializedEvent event)
{
@@ -235,15 +135,7 @@
}
}
}
-
- /**
- * I hate these hacks...
- */
- private class BoolWrapper
- {
- boolean value;
- }
-
+
public void quietLogin(@Observes QuietLoginEvent event)
{
if (mode.equals(Mode.autoLogin) && isEnabled())
@@ -292,14 +184,6 @@
}
}
- public void loggedOut(@Observes LoggedOutEvent event)
- {
- if (mode.equals(Mode.autoLogin))
- {
- tokenSelector.clearCookieValue();
- }
- }
-
public void postAuthenticate(@Observes PostAuthenticateEvent event)
{
if (mode.equals(Mode.usernameOnly))
@@ -339,6 +223,65 @@
}
}
+ public void loggedOut(@Observes LoggedOutEvent event)
+ {
+ if (mode.equals(Mode.autoLogin))
+ {
+ tokenSelector.clearCookieValue();
+ }
+ }
+
+ public Mode getMode()
+ {
+ return mode;
+ }
+
+ public void setMode(Mode mode)
+ {
+ this.mode = mode;
+ }
+
+ public boolean isEnabled()
+ {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled)
+ {
+ if (this.enabled != enabled)
+ {
+ this.enabled = enabled;
+ // selector is null during component initialization (setup handled in @Create
method)
+ if (usernameSelector != null && mode.equals(Mode.usernameOnly))
+ {
+ usernameSelector.setCookieEnabled(enabled);
+ }
+ // selector is null during component initialization (setup handled in @Create
method)
+ else if (tokenSelector != null && mode.equals(Mode.autoLogin))
+ {
+ tokenSelector.setCookieEnabled(enabled);
+ }
+ }
+ }
+
+ public int getCookieMaxAge() {
+ return cookieMaxAge;
+ }
+
+ public void setCookieMaxAge(int cookieMaxAge) {
+ this.cookieMaxAge = cookieMaxAge;
+ }
+
+ public TokenStore getTokenStore()
+ {
+ return tokenStore;
+ }
+
+ public void setTokenStore(TokenStore tokenStore)
+ {
+ this.tokenStore = tokenStore;
+ }
+
/**
* A flag that an application can use to protect sensitive operations if the user has
been
* auto-authenticated.
@@ -348,4 +291,62 @@
return autoLoggedIn;
}
+ protected String generateTokenValue()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append(new UID().toString());
+ sb.append(":");
+ sb.append(random.nextLong());
+ return sb.toString();
+ }
+
+ protected String encodeToken(String username, String value)
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append(username);
+ sb.append(":");
+ sb.append(value);
+ return Base64.encodeBytes(sb.toString().getBytes());
+ }
+
+ /**
+ * I hate these hacks...
+ */
+ private class BoolWrapper
+ {
+ boolean value;
+ }
+
+ private class DecodedToken
+ {
+ private String username;
+ private String value;
+
+ public DecodedToken(String cookieValue)
+ {
+ if (cookieValue != null)
+ {
+ try
+ {
+ String decoded = new String(Base64.decode(cookieValue));
+ username = decoded.substring(0, decoded.indexOf(':'));
+ value = decoded.substring(decoded.indexOf(':') + 1);
+ }
+ catch (Exception ex)
+ {
+ // intentionally swallow
+ }
+ }
+ }
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+ }
}
Modified:
modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityManager.java
===================================================================
---
modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityManager.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/security/src/main/java/org/jboss/seam/security/management/IdentityManager.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -15,8 +15,8 @@
import org.jboss.seam.security.Identity;
import org.jboss.seam.security.util.Strings;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* Identity Management API, deals with user name/password-based identity management.
@@ -37,14 +37,14 @@
public static final String PERMISSION_UPDATE = "update";
public static final String PERMISSION_DELETE = "delete";
- private static final LogProvider log = Logging.getLogProvider(IdentityManager.class);
+ @Logger Log log;
+ @Current BeanManager manager;
+ @Current Identity identity;
+
private IdentityStore identityStore;
private IdentityStore roleIdentityStore;
- @Current BeanManager manager;
- @Current Identity identity;
-
@Initializer
public void create()
{
Modified:
modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java
===================================================================
---
modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/security/src/main/java/org/jboss/seam/security/management/JpaIdentityStore.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -26,8 +26,8 @@
import org.jboss.seam.security.events.PrePersistUserRoleEvent;
import org.jboss.seam.security.events.UserAuthenticatedEvent;
import org.jboss.seam.security.events.UserCreatedEvent;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* The default identity store implementation, uses JPA as its persistence mechanism.
@@ -39,14 +39,14 @@
{
private static final long serialVersionUID = 1171875389743972646L;
- private static final LogProvider log =
Logging.getLogProvider(JpaIdentityStore.class);
-
protected FeatureSet featureSet;
+
+ @Logger Log log;
@PersistenceContext EntityManager entityManager;
- JpaIdentityStoreConfig config;
- BeanManager manager;
+ private JpaIdentityStoreConfig config;
+ private BeanManager manager;
public Set<Feature> getFeatures()
{
Modified:
modules/trunk/security/src/main/java/org/jboss/seam/security/management/LdapIdentityStore.java
===================================================================
---
modules/trunk/security/src/main/java/org/jboss/seam/security/management/LdapIdentityStore.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/security/src/main/java/org/jboss/seam/security/management/LdapIdentityStore.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -22,8 +22,8 @@
import javax.naming.directory.SearchResult;
import javax.naming.ldap.InitialLdapContext;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* An IdentityStore implementation that integrates with a directory service.
@@ -39,7 +39,7 @@
private static final String LDAP_BOOLEAN_TRUE = "TRUE";
private static final String LDAP_BOOLEAN_FALSE = "FALSE";
- private static final LogProvider log =
Logging.getLogProvider(LdapIdentityStore.class);
+ @Logger Log log;
protected FeatureSet featureSet = new FeatureSet();
Modified:
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java
===================================================================
---
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/JpaPermissionStore.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -28,8 +28,8 @@
import org.jboss.seam.security.management.JpaIdentityStoreConfig;
import org.jboss.seam.security.permission.PermissionMetadata.ActionSet;
import org.jboss.seam.security.util.AnnotatedBeanProperty;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* A permission store implementation that uses JPA as its persistence mechanism.
@@ -41,7 +41,7 @@
{
private static final long serialVersionUID = 4764590939669047915L;
- private static final LogProvider log =
Logging.getLogProvider(JpaPermissionStore.class);
+ @Logger Log log;
private enum Discrimination { user, role, either }
Modified:
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PermissionManager.java
===================================================================
---
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PermissionManager.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PermissionManager.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -7,8 +7,8 @@
import javax.enterprise.inject.Named;
import org.jboss.seam.security.Identity;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* Permission management component, used to grant or revoke permissions on specific
objects or of
@@ -25,7 +25,7 @@
public static final String PERMISSION_GRANT = "seam.grant-permission";
public static final String PERMISSION_REVOKE = "seam.revoke-permission";
- private static final LogProvider log =
Logging.getLogProvider(PermissionManager.class);
+ @Logger Log log;
@Current PermissionStore permissionStore;
@Current Identity identity;
Modified:
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PersistentPermissionResolver.java
===================================================================
---
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PersistentPermissionResolver.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/PersistentPermissionResolver.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -12,8 +12,8 @@
import org.jboss.seam.security.Identity;
import org.jboss.seam.security.Role;
import org.jboss.seam.security.SimplePrincipal;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* Resolves dynamically-assigned permissions, mapped to a user or a role, and kept in
persistent
@@ -27,7 +27,7 @@
private PermissionStore permissionStore;
- private static final LogProvider log =
Logging.getLogProvider(PersistentPermissionResolver.class);
+ @Logger Log log;
@Current BeanManager manager;
@Current Identity identity;
Modified:
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java
===================================================================
---
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java 2009-05-29
18:14:11 UTC (rev 11043)
+++
modules/trunk/security/src/main/java/org/jboss/seam/security/permission/RuleBasedPermissionResolver.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -24,8 +24,8 @@
import org.jboss.seam.security.Role;
import org.jboss.seam.security.events.LoggedOutEvent;
import org.jboss.seam.security.events.PostAuthenticateEvent;
-import org.jboss.webbeans.log.LogProvider;
-import org.jboss.webbeans.log.Logging;
+import org.jboss.webbeans.log.Log;
+import org.jboss.webbeans.log.Logger;
/**
* A permission resolver that uses a Drools rule base to perform permission checks
@@ -37,7 +37,7 @@
{
private static final long serialVersionUID = -7572627522601793024L;
- private static final LogProvider log =
Logging.getLogProvider(RuleBasedPermissionResolver.class);
+ @Logger Log log;
private StatefulSession securityContext;
Modified: modules/trunk/transaction/pom.xml
===================================================================
--- modules/trunk/transaction/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/transaction/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -15,34 +15,43 @@
<name>Seam Transaction</name>
<dependencies>
+
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>jsr299-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-logging</artifactId>
+ <groupId>javax.ejb</groupId>
+ <artifactId>ejb-api</artifactId>
</dependency>
+
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
</dependency>
+
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
</dependency>
+
<dependency>
- <groupId>javax.ejb</groupId>
- <artifactId>ejb-api</artifactId>
- </dependency>
- <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
</dependency>
+
<dependency>
- <groupId>org.jboss.seam</groupId>
+ <groupId>${seam.groupId}</groupId>
<artifactId>seam-el</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>jsr299-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${webbeans.groupId}</groupId>
+ <artifactId>webbeans-logger</artifactId>
+ </dependency>
+
</dependencies>
</project>
Modified: modules/trunk/web/pom.xml
===================================================================
--- modules/trunk/web/pom.xml 2009-05-29 18:14:11 UTC (rev 11043)
+++ modules/trunk/web/pom.xml 2009-05-29 18:20:39 UTC (rev 11044)
@@ -28,6 +28,11 @@
<dependency>
<groupId>${seam.groupId}</groupId>
+ <artifactId>seam-beans</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>${seam.groupId}</groupId>
<artifactId>seam-bridge-api</artifactId>
</dependency>
@@ -39,9 +44,7 @@
<dependency>
<groupId>${webbeans.groupId}</groupId>
- <artifactId>webbeans-logging</artifactId>
- <!-- assumes use of Web Beans impl -->
- <scope>provided</scope>
+ <artifactId>webbeans-logger</artifactId>
</dependency>
</dependencies>
Added: modules/trunk/web/src/main/java/org/jboss/seam/web/SeamListener.java
===================================================================
--- modules/trunk/web/src/main/java/org/jboss/seam/web/SeamListener.java
(rev 0)
+++ modules/trunk/web/src/main/java/org/jboss/seam/web/SeamListener.java 2009-05-29
18:20:39 UTC (rev 11044)
@@ -0,0 +1,47 @@
+package org.jboss.seam.web;
+
+import javax.enterprise.inject.AnnotationLiteral;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletRequestEvent;
+import javax.servlet.http.HttpSessionEvent;
+
+import org.jboss.seam.beans.Created;
+import org.jboss.seam.beans.Destroyed;
+import org.jboss.seam.bridge.ManagerBridge;
+import org.jboss.webbeans.servlet.api.ServletListener;
+
+public class SeamListener implements ServletListener
+{
+ public void contextDestroyed(ServletContextEvent event)
+ {
+ }
+
+ public void contextInitialized(ServletContextEvent event)
+ {
+ }
+
+ public void requestDestroyed(ServletRequestEvent event)
+ {
+ }
+
+ public void requestInitialized(ServletRequestEvent event)
+ {
+ }
+
+ public void sessionCreated(HttpSessionEvent event)
+ {
+ getBeanManager().fireEvent(event.getSession(), new
AnnotationLiteral<Created>() {});
+ }
+
+ public void sessionDestroyed(HttpSessionEvent event)
+ {
+ getBeanManager().fireEvent(event.getSession(), new
AnnotationLiteral<Destroyed>() {});
+ }
+
+ protected BeanManager getBeanManager()
+ {
+ return ManagerBridge.getProvider().getCurrentManager();
+ }
+
+}