[jboss-cvs] JBossAS SVN: r96370 - in trunk: component-matrix and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 13 14:36:35 EST 2009


Author: stan.silvert at jboss.com
Date: 2009-11-13 14:36:35 -0500 (Fri, 13 Nov 2009)
New Revision: 96370

Added:
   trunk/tomcat/src/main/java/org/jboss/web/validation/
   trunk/tomcat/src/main/java/org/jboss/web/validation/ValidatorFactoryVDFConnector.java
   trunk/varia/src/resources/beanvalidation/
   trunk/varia/src/resources/beanvalidation/bv-core-jboss-beans.xml
   trunk/varia/src/resources/beanvalidation/bv-deployers-jboss-beans.xml
Modified:
   trunk/build/build.xml
   trunk/component-matrix/pom.xml
   trunk/tomcat/pom.xml
   trunk/tomcat/src/assembly/jboss-faces.xml
   trunk/tomcat/src/main/java/org/jboss/web/jsf/integration/config/JBossJSFConfigureListener.java
   trunk/varia/pom.xml
Log:
JBAS-7178 Let JSF get its BVF from the DeploymentUnit


Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml	2009-11-13 19:06:29 UTC (rev 96369)
+++ trunk/build/build.xml	2009-11-13 19:36:35 UTC (rev 96370)
@@ -2019,6 +2019,7 @@
       <fileset refid="javax.inject:javax.inject:jar"/>
       <fileset refid="javax.mail:mail:jar"/>
       <fileset refid="javax.validation:validation-api:jar"/>
+      <fileset refid="org.jboss.mc-int:jboss-mc-int-servlet:jar"/>
       <fileset refid="jboss.messaging:jboss-messaging:jar"/>
       <fileset refid="org.beanshell:bsh:jar"/>
       <fileset refid="joesnmp:joesnmp:jar"/>

Modified: trunk/component-matrix/pom.xml
===================================================================
--- trunk/component-matrix/pom.xml	2009-11-13 19:06:29 UTC (rev 96369)
+++ trunk/component-matrix/pom.xml	2009-11-13 19:36:35 UTC (rev 96370)
@@ -35,7 +35,7 @@
     <version.jacorb>2.3.1jboss.patch01-brew</version.jacorb>
     <version.javassist>3.11.0.GA</version.javassist>
     <version.javax.faces>2.0.1-FCS</version.javax.faces>
-    <version.javax.validation>1.0.CR3</version.javax.validation>
+    <version.javax.validation>1.0.CR5</version.javax.validation>
     <version.jboss.jaxr>1.2.1.GA</version.jboss.jaxr>
     <version.jboss.jbossts>4.6.1.GA</version.jboss.jbossts>
     <version.jaxws.api>2.1</version.jaxws.api>
@@ -53,7 +53,7 @@
     <version.org.hibernate.commons.annotations>3.1.0.GA</version.org.hibernate.commons.annotations>
     <version.org.hibernate.ejb3.persistence>1.0.2.GA</version.org.hibernate.ejb3.persistence>
     <version.org.hibernate.entity.manager>3.4.0.GA</version.org.hibernate.entity.manager>
-    <version.org.hibernate.validator>4.0.0.Beta2</version.org.hibernate.validator>
+    <version.org.hibernate.validator>4.0.0.CR1</version.org.hibernate.validator>
     <version.org.hibernate>3.3.1.GA</version.org.hibernate>
     <version.org.jboss.aop>2.1.3.GA</version.org.jboss.aop>
     <version.org.jboss.aspects.currentinvocation>1.0.0.GA</version.org.jboss.aspects.currentinvocation>
@@ -91,6 +91,7 @@
     <version.org.jboss.logging>2.2.0.CR1</version.org.jboss.logging>
     <version.org.jboss.logmanager>1.1.0.GA</version.org.jboss.logmanager>
     <version.org.jboss.man>2.1.1.GA</version.org.jboss.man>
+    <version.org.jboss.mc-int>2.2.0.Alpha1</version.org.jboss.mc-int>
     <version.org.jboss.mdr>2.0.2.GA</version.org.jboss.mdr>
     <version.org.jboss.metadata.common>2.0.0.Alpha8</version.org.jboss.metadata.common>
     <version.org.jboss.metadata.client>2.0.0.Alpha</version.org.jboss.metadata.client>
@@ -115,6 +116,7 @@
     <version.org.springframework>2.5.5</version.org.springframework>
     <version.oswego-concurrent.concurrent>1.3.4-jboss-update1</version.oswego-concurrent.concurrent>
     <version.seam.integration>5.1.0.CR1</version.seam.integration>
+    <version.beanvalidation.integration>1.0.0-Beta-1</version.beanvalidation.integration>
     <version.staxex>2.1.1</version.staxex>
     <version.streambuffer>0.9</version.streambuffer>
     <version.suffix.org.jboss.javaee>.GA</version.suffix.org.jboss.javaee>
@@ -133,6 +135,12 @@
     <dependencies>
     
       <dependency>
+        <groupId>org.jboss.beanvalidation</groupId>
+        <artifactId>beanvalidation-deployers</artifactId>
+        <version>${version.beanvalidation.integration}</version>
+      </dependency>
+        
+      <dependency>
         <groupId>org.jboss.seam.integration</groupId>
         <artifactId>jboss-seam-int-microcontainer</artifactId>
         <version>${version.seam.integration}</version>
@@ -2005,8 +2013,68 @@
         <artifactId>jboss-kernel</artifactId>
         <version>${version.org.jboss.microcontainer}</version>
       </dependency>
-
+      
       <dependency>
+       <groupId>org.jboss.mc-int</groupId>
+       <artifactId>jboss-mc-int-servlet</artifactId>
+       <version>${version.org.jboss.mc-int}</version>
+       <exclusions>
+         <exclusion>
+           <groupId>org.jboss.deployers</groupId>
+           <artifactId>jboss-deployers-vfs-spi</artifactId>
+         </exclusion>
+         <exclusion>
+           <groupId>apache-xerces</groupId>
+           <artifactId>xml-apis</artifactId>
+         </exclusion>
+         <exclusion>
+           <groupId>org.jboss</groupId>
+           <artifactId>jboss-vfs</artifactId>
+         </exclusion>
+         <exclusion>
+           <groupId>org.jboss</groupId>
+           <artifactId>jboss-common-core</artifactId>
+         </exclusion>
+         <exclusion>
+           <groupId>org.jboss.logging</groupId>
+           <artifactId>jboss-logging-spi</artifactId>
+         </exclusion>
+         <exclusion>
+           <groupId>org.jboss.logging</groupId>
+           <artifactId>jboss-logging-log4j</artifactId>
+         </exclusion>
+         <exclusion>
+           <groupId>org.jboss.microcontainer</groupId>
+           <artifactId>jboss-dependency</artifactId>
+         </exclusion>
+         <exclusion>
+           <groupId>org.jboss.deployers</groupId>
+           <artifactId>jboss-deployers-spi</artifactId>
+         </exclusion>
+         <exclusion>
+           <groupId>org.jboss.deployers</groupId>
+           <artifactId>jboss-deployers-structure-spi</artifactId>
+         </exclusion>
+         <exclusion>
+           <groupId>org.jboss.deployers</groupId>
+           <artifactId>jboss-deployers-vfs</artifactId>
+         </exclusion>
+         <exclusion>
+           <groupId>org.jboss.deployers</groupId>
+           <artifactId>jboss-deployers-core-spi</artifactId>
+         </exclusion>
+         <exclusion>
+           <groupId>org.jboss.microcontainer</groupId>
+           <artifactId>jboss-kernel</artifactId>
+         </exclusion>
+         <exclusion>
+           <groupId>javax.servlet</groupId>
+           <artifactId>servlet-api</artifactId>
+         </exclusion>
+       </exclusions>
+      </dependency>
+    
+      <dependency>
         <groupId>org.jboss.integration</groupId>
         <artifactId>jboss-profileservice-spi</artifactId>
         <version>${version.org.jboss.integration}</version>

Modified: trunk/tomcat/pom.xml
===================================================================
--- trunk/tomcat/pom.xml	2009-11-13 19:06:29 UTC (rev 96369)
+++ trunk/tomcat/pom.xml	2009-11-13 19:36:35 UTC (rev 96370)
@@ -379,6 +379,10 @@
       <groupId>javax.validation</groupId>
       <artifactId>validation-api</artifactId>
     </dependency>
+    <dependency>
+       <groupId>org.jboss.mc-int</groupId>
+       <artifactId>jboss-mc-int-servlet</artifactId>
+    </dependency>
   </dependencies>
   
 </project>

Modified: trunk/tomcat/src/assembly/jboss-faces.xml
===================================================================
--- trunk/tomcat/src/assembly/jboss-faces.xml	2009-11-13 19:06:29 UTC (rev 96369)
+++ trunk/tomcat/src/assembly/jboss-faces.xml	2009-11-13 19:36:35 UTC (rev 96370)
@@ -10,6 +10,7 @@
       <outputDirectory>/</outputDirectory>
       <includes>
         <include>org/jboss/web/jsf/integration/**</include>
+        <include>org/jboss/web/validation/**</include>
       </includes>
     </fileSet>
   </fileSets>

Modified: trunk/tomcat/src/main/java/org/jboss/web/jsf/integration/config/JBossJSFConfigureListener.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/jsf/integration/config/JBossJSFConfigureListener.java	2009-11-13 19:06:29 UTC (rev 96369)
+++ trunk/tomcat/src/main/java/org/jboss/web/jsf/integration/config/JBossJSFConfigureListener.java	2009-11-13 19:36:35 UTC (rev 96370)
@@ -27,13 +27,18 @@
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
 import javax.validation.Validation;
+import javax.validation.ValidatorFactory;
 import org.jboss.logging.Logger;
+import org.jboss.mc.servlet.vdf.spi.VDFConnector;
+import org.jboss.web.validation.ValidatorFactoryVDFConnector;
 
+
 /**
  * This ServletContextListener sets up a JBoss-specific environment for JSF
  * and then delegates the rest of the setup to the JSF RI.
  *
  * @author Stan Silvert
+ * @author Ales Justin
  */
 public class JBossJSFConfigureListener extends ConfigureListener 
 {
@@ -59,8 +64,8 @@
   
         checkForMyFaces();
         initializeJspRuntime();
+        initialized = true;
         addBeanValidatorFactory();
-        initialized = true;
         
         try
         {
@@ -116,10 +121,23 @@
         }
     }
     
-    private void addBeanValidatorFactory()
+    protected void addBeanValidatorFactory()
     {
-       this.servletContext.setAttribute(BeanValidator.VALIDATOR_FACTORY_KEY,
-                                        Validation.buildDefaultValidatorFactory());
+       VDFConnector<ValidatorFactory> vfc = new ValidatorFactoryVDFConnector(servletContext);
+
+       ValidatorFactory factory;
+       if (vfc.isValid())
+       {
+          factory = vfc.getUtility();
+       }
+       else
+       {
+          LOG.warn("No such ValidatorFactory in VDF layer, creating new instance.");
+          factory = Validation.buildDefaultValidatorFactory();
+       }
+
+       this.servletContext.setAttribute(BeanValidator.VALIDATOR_FACTORY_KEY, factory);
     }
 
+
 }

Added: trunk/tomcat/src/main/java/org/jboss/web/validation/ValidatorFactoryVDFConnector.java
===================================================================
--- trunk/tomcat/src/main/java/org/jboss/web/validation/ValidatorFactoryVDFConnector.java	                        (rev 0)
+++ trunk/tomcat/src/main/java/org/jboss/web/validation/ValidatorFactoryVDFConnector.java	2009-11-13 19:36:35 UTC (rev 96370)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.web.validation;
+
+import javax.servlet.ServletContext;
+import javax.validation.ValidatorFactory;
+
+import org.jboss.mc.servlet.vdf.api.BaseAttachmentVDFConnector;
+
+/**
+ * Get ValidatorFactory from MC (VDF layer).
+ *
+ * @author Ales Justin
+ */
+public class ValidatorFactoryVDFConnector extends BaseAttachmentVDFConnector<ValidatorFactory>
+{
+   public static final String ALLOW_HIERARCHY_LOOKUP = "org.jboss.mc.servlet.vdf.allow_hierarchy_lookup";
+
+   public ValidatorFactoryVDFConnector(ServletContext servletContext)
+   {
+      super(servletContext);
+      String allowHierarchyLookupString = servletContext.getInitParameter(ALLOW_HIERARCHY_LOOKUP);
+      // by default we allow hierarchy lookup; this might change once we have VF per module
+      setAllowHierarchyLookup("false".equals(allowHierarchyLookupString) == false);
+   }
+
+   protected Class<ValidatorFactory> getAttachmentType()
+   {
+      return ValidatorFactory.class;
+   }
+}
\ No newline at end of file

Modified: trunk/varia/pom.xml
===================================================================
--- trunk/varia/pom.xml	2009-11-13 19:06:29 UTC (rev 96369)
+++ trunk/varia/pom.xml	2009-11-13 19:36:35 UTC (rev 96370)
@@ -131,6 +131,20 @@
                    <fileset file="${source.resources}/beanshell/bsh-deployers-jboss-beans.xml"/>
                 </copy>
             
+                <!-- beanvalidation.deployer -->
+                <mkdir dir="${build.deployers}/beanvalidation.deployer"/>
+                <mkdir dir="${build.deployers}/beanvalidation.deployer/META-INF"/>
+
+                <copy todir="${build.deployers}/beanvalidation.deployer/META-INF">
+                   <fileset dir="${source.resources}/beanvalidation">
+                     <include name="*.xml"/>
+                   </fileset>
+                </copy>
+
+                <copy todir="${build.deployers}/beanvalidation.deployer">
+                  <fileset file="${maven.dependency.org.jboss.beanvalidation.beanvalidation-deployers.jar.path}"/>
+                </copy>
+                
                 <!-- seam.deployer -->
                 <mkdir dir="${build.deployers}/seam.deployer"/>
                 <mkdir dir="${build.deployers}/seam.deployer/META-INF"/>
@@ -359,6 +373,11 @@
       <artifactId>jboss-seam-int-microcontainer</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>org.jboss.beanvalidation</groupId>
+      <artifactId>beanvalidation-deployers</artifactId>
+    </dependency>
+      
   </dependencies>
   
   <profiles>

Added: trunk/varia/src/resources/beanvalidation/bv-core-jboss-beans.xml
===================================================================
--- trunk/varia/src/resources/beanvalidation/bv-core-jboss-beans.xml	                        (rev 0)
+++ trunk/varia/src/resources/beanvalidation/bv-core-jboss-beans.xml	2009-11-13 19:36:35 UTC (rev 96370)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Bean Validation (jsr303) core beans.
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <!-- ValidatorFactory factory -->
+  <beanfactory name="ValidatorFactoryFactory" class="org.hibernate.validator.util.LazyValidatorFactory"/>
+
+  <!-- JEE DU filter -->
+  <bean name="VFDUFilter" class="org.jboss.beanvalidation.util.AttachmentPresentDeploymentUnitFilter">
+    <property name="attachmentNames">
+      <set>
+        <value>org.jboss.metadata.ear.spec.EarMetaData</value>
+        <value>org.jboss.metadata.web.jboss.JBossWebMetaData</value>
+        <value>org.jboss.metadata.ejb.jboss.JBossMetaData</value>
+      </set>
+    </property>
+  </bean>
+
+  <!-- Default JNDI name creator -->
+  <bean name="DefaultJndiBinder" class="org.jboss.beanvalidation.util.DefaultJndiBinder" />
+
+</deployment>

Added: trunk/varia/src/resources/beanvalidation/bv-deployers-jboss-beans.xml
===================================================================
--- trunk/varia/src/resources/beanvalidation/bv-deployers-jboss-beans.xml	                        (rev 0)
+++ trunk/varia/src/resources/beanvalidation/bv-deployers-jboss-beans.xml	2009-11-13 19:36:35 UTC (rev 96370)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Bean Validator (jsr303) deployers.
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+  <!-- ValidatorFactory creator -->
+  <bean name="VFCreator" class="org.jboss.beanvalidation.deployers.ValidatorFactoryDeployer">
+    <constructor>
+      <parameter><inject bean="ValidatorFactoryFactory" /></parameter>
+    </constructor>
+    <property name="filter"><inject bean="VFDUFilter" /></property>
+  </bean>
+
+</deployment>




More information about the jboss-cvs-commits mailing list