[jboss-cvs] JBossAS SVN: r92748 - in branches/Branch_5_x: thirdparty and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Aug 24 12:14:37 EDT 2009
Author: alesj
Date: 2009-08-24 12:14:35 -0400 (Mon, 24 Aug 2009)
New Revision: 92748
Added:
branches/Branch_5_x/tomcat/src/main/org/jboss/web/validation/
branches/Branch_5_x/tomcat/src/main/org/jboss/web/validation/ValidatorFactoryVDFConnector.java
Modified:
branches/Branch_5_x/component-matrix/pom.xml
branches/Branch_5_x/thirdparty/pom.xml
branches/Branch_5_x/tomcat/build.xml
branches/Branch_5_x/tomcat/pom.xml
branches/Branch_5_x/tomcat/src/main/org/jboss/web/jsf/integration/config/JBossJSFConfigureListener.java
Log:
[JBAS-7178]; get ValidatorFactory from MC's VDF.
Modified: branches/Branch_5_x/component-matrix/pom.xml
===================================================================
--- branches/Branch_5_x/component-matrix/pom.xml 2009-08-24 15:48:16 UTC (rev 92747)
+++ branches/Branch_5_x/component-matrix/pom.xml 2009-08-24 16:14:35 UTC (rev 92748)
@@ -86,6 +86,7 @@
<version.org.jboss.logbridge>1.0.0.GA</version.org.jboss.logbridge>
<version.org.jboss.logmanager>1.0.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>1.0.1.GA</version.org.jboss.metadata>
<version.org.jboss.microcontainer>2.0.8.GA</version.org.jboss.microcontainer>
@@ -1879,7 +1880,67 @@
<version>${version.org.jboss.microcontainer}</version>
</dependency>
- <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: branches/Branch_5_x/thirdparty/pom.xml
===================================================================
--- branches/Branch_5_x/thirdparty/pom.xml 2009-08-24 15:48:16 UTC (rev 92747)
+++ branches/Branch_5_x/thirdparty/pom.xml 2009-08-24 16:14:35 UTC (rev 92748)
@@ -2026,6 +2026,10 @@
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.jboss.mc-int</groupId>
+ <artifactId>jboss-mc-int-servlet</artifactId>
+ </dependency>
</dependencies>
<profiles>
Modified: branches/Branch_5_x/tomcat/build.xml
===================================================================
--- branches/Branch_5_x/tomcat/build.xml 2009-08-24 15:48:16 UTC (rev 92747)
+++ branches/Branch_5_x/tomcat/build.xml 2009-08-24 16:14:35 UTC (rev 92748)
@@ -61,6 +61,7 @@
<path refid="jgroups.jgroups.classpath"/>
<path refid="jboss.common.core.classpath"/>
<path refid="jboss.common.logging.spi.classpath"/>
+ <path refid="org.jboss.mc.int.classpath"/>
<path refid="org.jboss.ws.native.classpath"/>
<path refid="org.jboss.ws.classpath"/>
<path refid="jboss.jbossxb.classpath"/>
@@ -69,7 +70,7 @@
<path refid="jboss.jboss.cl.classpath"/>
<path refid="jboss.jboss.deployers.classpath"/>
<path refid="jboss.jboss.man.classpath"/>
- <path refid="jboss.jboss.mdr.classpath"/>
+ <path refid="jboss.jboss.mdr.classpath"/>
<path refid="jboss.microcontainer.classpath"/>
<path refid="jboss.jboss.vfs.classpath"/>
<path refid="jboss.integration.classpath"/>
Modified: branches/Branch_5_x/tomcat/pom.xml
===================================================================
--- branches/Branch_5_x/tomcat/pom.xml 2009-08-24 15:48:16 UTC (rev 92747)
+++ branches/Branch_5_x/tomcat/pom.xml 2009-08-24 16:14:35 UTC (rev 92748)
@@ -258,6 +258,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: branches/Branch_5_x/tomcat/src/main/org/jboss/web/jsf/integration/config/JBossJSFConfigureListener.java
===================================================================
--- branches/Branch_5_x/tomcat/src/main/org/jboss/web/jsf/integration/config/JBossJSFConfigureListener.java 2009-08-24 15:48:16 UTC (rev 92747)
+++ branches/Branch_5_x/tomcat/src/main/org/jboss/web/jsf/integration/config/JBossJSFConfigureListener.java 2009-08-24 16:14:35 UTC (rev 92748)
@@ -21,18 +21,23 @@
*/
package org.jboss.web.jsf.integration.config;
-import com.sun.faces.config.ConfigureListener;
import javax.faces.validator.BeanValidator;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.validation.Validation;
+import javax.validation.ValidatorFactory;
+
+import com.sun.faces.config.ConfigureListener;
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
{
@@ -73,10 +78,22 @@
}
}
- 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);
}
// This method accounts for a peculiar problem with Jasper that pops up from time
@@ -85,7 +102,6 @@
// be loaded before JSF is initialized.
private static void initializeJspRuntime()
{
-
try
{
Class.forName("org.apache.jasper.compiler.JspRuntimeContext");
@@ -110,5 +126,4 @@
// ignore - this is a good thing
}
}
-
}
Copied: branches/Branch_5_x/tomcat/src/main/org/jboss/web/validation/ValidatorFactoryVDFConnector.java (from rev 92740, branches/Branch_5_x/tomcat/src/main/org/jboss/web/jsf/integration/config/JBossJSFConfigureListener.java)
===================================================================
--- branches/Branch_5_x/tomcat/src/main/org/jboss/web/validation/ValidatorFactoryVDFConnector.java (rev 0)
+++ branches/Branch_5_x/tomcat/src/main/org/jboss/web/validation/ValidatorFactoryVDFConnector.java 2009-08-24 16:14:35 UTC (rev 92748)
@@ -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
Property changes on: branches/Branch_5_x/tomcat/src/main/org/jboss/web/validation/ValidatorFactoryVDFConnector.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list