[seam-commits] Seam SVN: r12550 - in modules/faces/trunk: examples/short-ly and 2 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Wed Apr 21 16:28:48 EDT 2010


Author: lincolnthree
Date: 2010-04-21 16:28:47 -0400 (Wed, 21 Apr 2010)
New Revision: 12550

Added:
   modules/faces/trunk/examples/short-ly/readme.txt
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/SeamApplicationWrapper.java
Modified:
   modules/faces/trunk/examples/short-ly/pom.xml
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/cdi/JndiBeanManagerProvider.java
   modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/cdi/ServletContextBeanManagerProvider.java
   modules/faces/trunk/readme.txt
Log:
Updates for java 1.5 compatibility
Updated pom/readmes

Modified: modules/faces/trunk/examples/short-ly/pom.xml
===================================================================
--- modules/faces/trunk/examples/short-ly/pom.xml	2010-04-21 19:35:09 UTC (rev 12549)
+++ modules/faces/trunk/examples/short-ly/pom.xml	2010-04-21 20:28:47 UTC (rev 12550)
@@ -6,7 +6,7 @@
 	<artifactId>seam-faces-examples-short-ly</artifactId>
 
 	<packaging>war</packaging>
-	<version>0.0.1-SNAPSHOT</version>
+	<version>3.0.0-SNAPSHOT</version>
 	<name>Seam Faces Example bit.ly clone with PrettyFaces</name>
 
 	<url>http://seamframework.org</url>

Added: modules/faces/trunk/examples/short-ly/readme.txt
===================================================================
--- modules/faces/trunk/examples/short-ly/readme.txt	                        (rev 0)
+++ modules/faces/trunk/examples/short-ly/readme.txt	2010-04-21 20:28:47 UTC (rev 12550)
@@ -0,0 +1,6 @@
+  - Purpose of the example - for example, to demonstrate feature X by illustrate how that API can be used to perform A, B and C.
+  - Prerequisites - The AS has been installed and the appropriate properties files have been updated
+  - Step by Step setup for the example -
+  - Step by Step execution of the example - "ant deploy" or "mvn clean install" or "run -c server1" + "run -c server2" or "using your browser hit: http://localhost:8080/MyNewApp"
+  - Expected results - you should see "Hello World" on the console or you can now navigate the web-based application
+  - the readme.txt should include the maintainer of the example (along with contact info). This may simply point to the examples' POM.
\ No newline at end of file

Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/cdi/JndiBeanManagerProvider.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/cdi/JndiBeanManagerProvider.java	2010-04-21 19:35:09 UTC (rev 12549)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/cdi/JndiBeanManagerProvider.java	2010-04-21 20:28:47 UTC (rev 12550)
@@ -29,21 +29,20 @@
  * A BeanManager provider for JNDI contexts
  * 
  * @author Nicklas Karlsson
- *
+ * 
  */
 public class JndiBeanManagerProvider implements BeanManagerProvider
 {
-   private String location;
+   private final String location;
 
    public static final JndiBeanManagerProvider DEFAULT = new JndiBeanManagerProvider("java:comp/BeanManager");
    public static final JndiBeanManagerProvider JBOSS_HACK = new JndiBeanManagerProvider("java:app/BeanManager");
 
-   protected JndiBeanManagerProvider(String location)
+   protected JndiBeanManagerProvider(final String location)
    {
       this.location = location;
    }
 
-   @Override
    public BeanManager getBeanManager()
    {
       try

Modified: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/cdi/ServletContextBeanManagerProvider.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/cdi/ServletContextBeanManagerProvider.java	2010-04-21 19:35:09 UTC (rev 12549)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/cdi/ServletContextBeanManagerProvider.java	2010-04-21 20:28:47 UTC (rev 12550)
@@ -26,16 +26,16 @@
 import javax.servlet.ServletContext;
 
 /**
- * A BeanManager provider for the Servlet Context attribute "javax.enterprise.inject.spi.BeanManager"
+ * A BeanManager provider for the Servlet Context attribute
+ * "javax.enterprise.inject.spi.BeanManager"
  * 
  * @author Nicklas Karlsson
- *
+ * 
  */
 public class ServletContextBeanManagerProvider implements BeanManagerProvider
 {
    public static final ServletContextBeanManagerProvider DEFAULT = new ServletContextBeanManagerProvider();
 
-   @Override
    public BeanManager getBeanManager()
    {
       ServletContext servletContext = (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();

Added: modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/SeamApplicationWrapper.java
===================================================================
--- modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/SeamApplicationWrapper.java	                        (rev 0)
+++ modules/faces/trunk/impl/src/main/java/org/jboss/seam/faces/environment/SeamApplicationWrapper.java	2010-04-21 20:28:47 UTC (rev 12550)
@@ -0,0 +1,137 @@
+/*
+ * 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.environment;
+
+import java.util.Set;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.faces.FactoryFinder;
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+import javax.faces.application.ApplicationWrapper;
+import javax.faces.convert.Converter;
+import javax.faces.event.PostConstructApplicationEvent;
+import javax.faces.validator.Validator;
+import javax.inject.Inject;
+
+import org.jboss.seam.faces.event.PhaseEventBridge;
+
+/**
+ * Provides @{@link Inject} support for JSF artifacts such as {@link Converter},
+ * {@link Validator}.
+ * 
+ * @author <a href="mailto:lincolnbaxter at gmail.com>Lincoln Baxter, III</a>
+ * 
+ */
+ at ApplicationScoped
+public class SeamApplicationWrapper extends ApplicationWrapper
+{
+   private Application parent;
+
+   @Inject
+   BeanManager manager;
+
+   public void installWrapper(@Observes final PostConstructApplicationEvent event)
+   {
+      ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
+      parent = factory.getApplication();
+      factory.setApplication(this);
+   }
+
+   @Override
+   public Converter createConverter(final Class<?> targetClass)
+   {
+      Converter result = null;
+
+      Set<Bean<?>> beans = manager.getBeans(targetClass);
+      if (!beans.isEmpty())
+      {
+         Bean<?> bean = beans.iterator().next();
+         CreationalContext<?> context = manager.createCreationalContext(bean);
+         result = (Converter) manager.getReference(bean, PhaseEventBridge.class, context);
+      }
+
+      if (result == null)
+      {
+         result = parent.createConverter(targetClass);
+      }
+
+      return result;
+   }
+
+   @Override
+   public Converter createConverter(final String converterId)
+   {
+      /*
+       * We need to ask for an instance because we have no way of getting the
+       * type information by id
+       */
+      Converter result = parent.createConverter(converterId);
+      if (result != null)
+      {
+         Class<? extends Converter> targetClass = result.getClass();
+         Set<Bean<?>> beans = manager.getBeans(targetClass);
+         if (!beans.isEmpty())
+         {
+            Bean<?> bean = beans.iterator().next();
+            CreationalContext<?> context = manager.createCreationalContext(bean);
+            result = (Converter) manager.getReference(bean, targetClass, context);
+         }
+      }
+
+      return result;
+   }
+
+   @Override
+   public Validator createValidator(final String validatorId)
+   {
+      /*
+       * We need to ask for an instance because we have no way of getting the
+       * type information by id
+       */
+      Validator result = parent.createValidator(validatorId);
+      if (result != null)
+      {
+         Class<? extends Validator> targetClass = result.getClass();
+         Set<Bean<?>> beans = manager.getBeans(targetClass);
+         if (!beans.isEmpty())
+         {
+            Bean<?> bean = beans.iterator().next();
+            CreationalContext<?> context = manager.createCreationalContext(bean);
+            result = (Validator) manager.getReference(bean, targetClass, context);
+         }
+      }
+
+      return result;
+   }
+
+   @Override
+   public Application getWrapped()
+   {
+      return parent;
+   }
+}

Modified: modules/faces/trunk/readme.txt
===================================================================
--- modules/faces/trunk/readme.txt	2010-04-21 19:35:09 UTC (rev 12549)
+++ modules/faces/trunk/readme.txt	2010-04-21 20:28:47 UTC (rev 12550)
@@ -42,4 +42,10 @@
  Release Notes
  =============
 
- ...
+    *  View actions
+    * javax.faces.bean.*Scoped aliases
+    * @FlashScoped and @ViewScoped
+    * CDI / Faces Phase & System Event bridge
+    * JSF API producers (FacesContext, ExternalContext, NavigationHandler, etc...)
+    * Simplified EL name to conversation: #{conversation.transient}
+



More information about the seam-commits mailing list