[jboss-cvs] JBossAS SVN: r88044 - in projects/spring-int/trunk: deployers and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Apr 29 23:46:27 EDT 2009


Author: marius.bogoevici
Date: 2009-04-29 23:46:26 -0400 (Wed, 29 Apr 2009)
New Revision: 88044

Added:
   projects/spring-int/trunk/deployers/src/main/java/org/jboss/spring/factory/VFSXmlWebApplicationContext.java
Modified:
   projects/spring-int/trunk/deployers/pom.xml
   projects/spring-int/trunk/pom.xml
Log:
Adding an XmlWebApplicationContext subclass for solving pattern-based resource search and classpath scanning.

Modified: projects/spring-int/trunk/deployers/pom.xml
===================================================================
--- projects/spring-int/trunk/deployers/pom.xml	2009-04-30 03:40:45 UTC (rev 88043)
+++ projects/spring-int/trunk/deployers/pom.xml	2009-04-30 03:46:26 UTC (rev 88044)
@@ -97,6 +97,10 @@
       <groupId>org.springframework</groupId>
       <artifactId>spring-core</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-web</artifactId>
+    </dependency>
   </dependencies>
   
 </project>
\ No newline at end of file

Added: projects/spring-int/trunk/deployers/src/main/java/org/jboss/spring/factory/VFSXmlWebApplicationContext.java
===================================================================
--- projects/spring-int/trunk/deployers/src/main/java/org/jboss/spring/factory/VFSXmlWebApplicationContext.java	                        (rev 0)
+++ projects/spring-int/trunk/deployers/src/main/java/org/jboss/spring/factory/VFSXmlWebApplicationContext.java	2009-04-30 03:46:26 UTC (rev 88044)
@@ -0,0 +1,61 @@
+/*
+ * 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.spring.factory;
+
+import org.jboss.spring.vfs.VFSResourceLoader;
+import org.jboss.spring.vfs.VFSServletContextResourcePatternResolver;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.ResourcePatternResolver;
+import org.springframework.web.context.support.XmlWebApplicationContext;
+
+
+/**
+ * XmlWebApplicationContext variant adding support for classpath
+ * scanning in JBoss AS 5, using the VFS file system.
+ *
+ * @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
+ */
+public class VFSXmlWebApplicationContext extends XmlWebApplicationContext
+{
+
+   @Override
+   protected ResourcePatternResolver getResourcePatternResolver()
+   {
+      return new VFSServletContextResourcePatternResolver(
+              new WebApplicationContextAwareVFSResourceLoader());
+   }
+
+   /**
+    * Customization of {@link VFSResourceLoader} that delegates to the owner class
+    * (i.e. XmlWebApplicationContext) for retrieving resources by path, allowing
+    * for ServletContextResources to be returned in this case.
+    */
+   private class WebApplicationContextAwareVFSResourceLoader extends VFSResourceLoader
+   {
+      @Override
+      protected Resource getResourceByPath(String path)
+      {
+         return VFSXmlWebApplicationContext.this.getResourceByPath(path);
+      }
+   }
+}
+

Modified: projects/spring-int/trunk/pom.xml
===================================================================
--- projects/spring-int/trunk/pom.xml	2009-04-30 03:40:45 UTC (rev 88043)
+++ projects/spring-int/trunk/pom.xml	2009-04-30 03:46:26 UTC (rev 88044)
@@ -339,6 +339,11 @@
         <version>${version.spring}</version>
       </dependency>
       <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-web</artifactId>
+        <version>${version.spring}</version>
+      </dependency>
+      <dependency>
         <groupId>org.jboss.cache</groupId>
         <artifactId>jbosscache-pojo</artifactId>
         <version>${version.jboss.pojocache}</version>




More information about the jboss-cvs-commits mailing list