[seam-commits] Seam SVN: r12630 - in modules/faces/trunk/impl/src: main/java/org/jboss/seam/faces/beanManager and 3 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Sat Apr 24 17:53:26 EDT 2010


Author: nickarls
Date: 2010-04-24 17:53:25 -0400 (Sat, 24 Apr 2010)
New Revision: 12630

Added:
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/beanManager/
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/beanManager/FacesServletContextBeanManagerProvider.java
   modules/faces/trunk/impl/src/main/resources/META-INF/services/org.jboss.weld.extensions.beanManager.BeanManagerProvider
Removed:
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/cdi/
Modified:
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/DelegatingPhaseListener.java
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/DelegatingSystemEventListener.java
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java
   modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java
   modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/SystemEventBridgeTest.java
Log:
BeanManagerAware for faces module
Fixed precedence
Lazy loading of providers
Weld-specific provider (Pete, can we have this in weld-extensions?)

Added: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/beanManager/FacesServletContextBeanManagerProvider.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/beanManager/FacesServletContextBeanManagerProvider.java	                        (rev 0)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/beanManager/FacesServletContextBeanManagerProvider.java	2010-04-24 21:53:25 UTC (rev 12630)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.
+ */
+package org.jboss.seam.faces.beanManager;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
+
+import org.jboss.weld.extensions.beanManager.BeanManagerProvider;
+
+/**
+ * A BeanManager provider for the Servlet Context attribute
+ * "javax.enterprise.inject.spi.BeanManager"
+ * 
+ * @author Nicklas Karlsson
+ * 
+ */
+public class FacesServletContextBeanManagerProvider implements BeanManagerProvider
+{
+   public static final FacesServletContextBeanManagerProvider DEFAULT = new FacesServletContextBeanManagerProvider();
+
+   public BeanManager getBeanManager()
+   {
+      FacesContext facesContext = FacesContext.getCurrentInstance();
+      if (facesContext == null)
+      {
+         return null;
+      }
+      ServletContext servletContext = (ServletContext) facesContext.getExternalContext().getContext();
+      return (BeanManager) servletContext.getAttribute(BeanManager.class.getName());
+   }
+
+   public int getPrecedence()
+   {
+      return 20;
+   }
+
+}
\ No newline at end of file

Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/DelegatingPhaseListener.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/DelegatingPhaseListener.java	2010-04-24 21:53:03 UTC (rev 12629)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/DelegatingPhaseListener.java	2010-04-24 21:53:25 UTC (rev 12630)
@@ -31,7 +31,7 @@
 import javax.faces.event.PhaseId;
 import javax.faces.event.PhaseListener;
 
-import org.jboss.seam.faces.cdi.BeanManagerAware;
+import org.jboss.weld.extensions.beanManager.BeanManagerAware;
 
 /**
  * Provide CDI injection to PhaseListener artifacts by delegating through this

Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/DelegatingSystemEventListener.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/DelegatingSystemEventListener.java	2010-04-24 21:53:03 UTC (rev 12629)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/DelegatingSystemEventListener.java	2010-04-24 21:53:25 UTC (rev 12630)
@@ -31,7 +31,7 @@
 import javax.faces.event.SystemEvent;
 import javax.faces.event.SystemEventListener;
 
-import org.jboss.seam.faces.cdi.BeanManagerAware;
+import org.jboss.weld.extensions.beanManager.BeanManagerAware;
 
 /**
  * Provide CDI injection to SystemEventListener artifacts by delegating through

Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java	2010-04-24 21:53:03 UTC (rev 12629)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/PhaseEventBridge.java	2010-04-24 21:53:25 UTC (rev 12630)
@@ -31,7 +31,6 @@
 import javax.faces.event.PhaseListener;
 import javax.inject.Inject;
 
-import org.jboss.seam.faces.cdi.BeanManagerAware;
 import org.jboss.seam.faces.event.qualifier.After;
 import org.jboss.seam.faces.event.qualifier.ApplyRequestValues;
 import org.jboss.seam.faces.event.qualifier.Before;
@@ -40,6 +39,7 @@
 import org.jboss.seam.faces.event.qualifier.RenderResponse;
 import org.jboss.seam.faces.event.qualifier.RestoreView;
 import org.jboss.seam.faces.event.qualifier.UpdateModelValues;
+import org.jboss.weld.extensions.beanManager.BeanManagerAware;
 import org.slf4j.Logger;
 
 /**

Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java	2010-04-24 21:53:03 UTC (rev 12629)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/event/SystemEventBridge.java	2010-04-24 21:53:25 UTC (rev 12630)
@@ -36,9 +36,9 @@
 import javax.faces.event.SystemEvent;
 import javax.faces.event.SystemEventListener;
 
-import org.jboss.seam.faces.cdi.BeanManagerAware;
 import org.jboss.seam.faces.event.qualifier.Component;
 import org.jboss.seam.faces.event.qualifier.View;
+import org.jboss.weld.extensions.beanManager.BeanManagerAware;
 
 /**
  * A SystemEventListener used to bridge JSF system events to the CDI event

Added: modules/faces/trunk/impl/src/main/resources/META-INF/services/org.jboss.weld.extensions.beanManager.BeanManagerProvider
===================================================================
--- modules/faces/trunk/impl/src/main/resources/META-INF/services/org.jboss.weld.extensions.beanManager.BeanManagerProvider	                        (rev 0)
+++ modules/faces/trunk/impl/src/main/resources/META-INF/services/org.jboss.weld.extensions.beanManager.BeanManagerProvider	2010-04-24 21:53:25 UTC (rev 12630)
@@ -0,0 +1 @@
+org.jboss.seam.faces.beanManager.FacesServletContextBeanManagerProvider

Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java	2010-04-24 21:53:03 UTC (rev 12629)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/PhaseEventBridgeTest.java	2010-04-24 21:53:25 UTC (rev 12630)
@@ -31,13 +31,13 @@
 import org.jboss.arquillian.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.seam.faces.MockLogger;
-import org.jboss.seam.faces.cdi.BeanManagerAware;
 import org.jboss.shrinkwrap.api.ArchivePaths;
 import org.jboss.shrinkwrap.api.Archives;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
 import org.jboss.test.faces.mock.context.MockFacesContext;
 import org.jboss.test.faces.mock.lifecycle.MockLifecycle;
+import org.jboss.weld.extensions.beanManager.BeanManagerAware;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 

Modified: modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/SystemEventBridgeTest.java
===================================================================
--- modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/SystemEventBridgeTest.java	2010-04-24 21:53:03 UTC (rev 12629)
+++ modules/faces/trunk/impl/src/test/java/org/jboss/seam/faces/event/SystemEventBridgeTest.java	2010-04-24 21:53:25 UTC (rev 12630)
@@ -47,13 +47,13 @@
 
 import org.jboss.arquillian.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.seam.faces.cdi.BeanManagerAware;
 import org.jboss.shrinkwrap.api.ArchivePaths;
 import org.jboss.shrinkwrap.api.Archives;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
 import org.jboss.test.faces.mock.application.MockApplication;
 import org.jboss.test.faces.mock.context.MockFacesContext;
+import org.jboss.weld.extensions.beanManager.BeanManagerAware;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 



More information about the seam-commits mailing list