struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject svn commit: r1338643 [1/2] - in /struts/struts2/trunk: core/src/main/java/org/apache/struts2/ core/src/main/java/org/apache/struts2/config/ core/src/main/java/org/apache/struts2/dispatcher/ core/src/main/java/org/apache/struts2/util/fs/ core/src/main/j...
Date Tue, 15 May 2012 11:05:51 GMT
Author: lukaszlenart
Date: Tue May 15 11:05:50 2012
New Revision: 1338643

URL: http://svn.apache.org/viewvc?rev=1338643&view=rev
Log:
WW-3817 introduces FileManagerFactory with default implementation and refactors all the code to use the new approach

Added:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/fs/
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/fs/JBossFileManager.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/FileManagerFactory.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/DefaultFileManagerFactory.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/util/fs/
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/util/fs/DefaultFileManagerFactoryTest.java
Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java
    struts/struts2/trunk/core/src/main/resources/struts-default.xml
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreeMarkerResultTest.java
    struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java
    struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
    struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java
    struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java
    struts/struts2/trunk/plugins/embeddedjsp/src/test/java/org/apache/struts2/EmbeddedJSPResultTest.java
    struts/struts2/trunk/plugins/osgi/src/main/java/org/apache/struts2/osgi/FelixOsgiHost.java
    struts/struts2/trunk/plugins/oval/src/main/java/org/apache/struts2/oval/interceptor/DefaultOValValidationManager.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/FileManager.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/ConfigurationManager.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/URLUtil.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/classloader/ReloadingClassLoader.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/finder/ClassFinder.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/finder/UrlSet.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/DefaultFileManager.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/JBossFileRevision.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/JarEntryRevision.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java
    struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManager.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/util/DefaultFileManagerTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/util/URLUtilTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/util/UrlUtilTest2.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManagerTest.java
    struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManagerTest.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/StrutsConstants.java Tue May 15 11:05:50 2012
@@ -65,7 +65,7 @@ public final class StrutsConstants {
     public static final String STRUTS_OBJECTFACTORY = "struts.objectFactory";
 
     /** The com.opensymphony.xwork2.util.FileManager implementation class */
-    public static final String STRUTS_FILEMANAGER = "struts.fileManager";
+    public static final String STRUTS_FILE_MANAGER_FACTORY = "struts.fileManagerFactory";
 
     /** The com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation class */
     public static final String STRUTS_OBJECTTYPEDETERMINER = "struts.objectTypeDeterminer";

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/config/BeanSelectionProvider.java Tue May 15 11:05:50 2012
@@ -23,6 +23,7 @@ package org.apache.struts2.config;
 
 import com.opensymphony.xwork2.ActionProxyFactory;
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.TextProvider;
 import com.opensymphony.xwork2.UnknownHandlerManager;
@@ -191,10 +192,10 @@ import java.util.StringTokenizer;
  *     <td>Helper class used with URLRenderer to provide exact logic for building URLs</td>
  *   </tr>
  *   <tr>
- *     <td>com.opensymphony.xwork2.FileManager</td>
- *     <td>struts.fileManager</td>
+ *     <td>com.opensymphony.xwork2.FileManagerFactory</td>
+ *     <td>struts.fileManagerFactory</td>
  *     <td>singleton</td>
- *     <td>Used to access files on the File System as also to monitor if reload is needed,
+ *     <td>Used to create {@link FileManager} instance to access files on the File System as also to monitor if reload is needed,
  *     can be implemented / overwritten to meet specific an application server needs
  *     </td>
  *   </tr>
@@ -243,7 +244,7 @@ public class BeanSelectionProvider imple
 
     public void register(ContainerBuilder builder, LocatableProperties props) {
         alias(ObjectFactory.class, StrutsConstants.STRUTS_OBJECTFACTORY, builder, props);
-        alias(FileManager.class, StrutsConstants.STRUTS_FILEMANAGER, builder, props);
+        alias(FileManagerFactory.class, StrutsConstants.STRUTS_FILE_MANAGER_FACTORY, builder, props);
         alias(XWorkConverter.class, StrutsConstants.STRUTS_XWORKCONVERTER, builder, props);
         alias(TextProvider.class, StrutsConstants.STRUTS_XWORKTEXTPROVIDER, builder, props, Scope.DEFAULT);
         alias(ActionProxyFactory.class, StrutsConstants.STRUTS_ACTIONPROXYFACTORY, builder, props);

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java Tue May 15 11:05:50 2012
@@ -25,6 +25,7 @@ import com.opensymphony.xwork2.ActionCon
 import com.opensymphony.xwork2.ActionProxy;
 import com.opensymphony.xwork2.ActionProxyFactory;
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.Result;
 import com.opensymphony.xwork2.config.Configuration;
@@ -397,7 +398,7 @@ public class Dispatcher {
     }
 
     private void init_CheckConfigurationReloading(Container container) {
-        FileManager fileManager = container.getInstance(FileManager.class);
+        FileManager fileManager = container.getInstance(FileManagerFactory.class).getFileManager();
         fileManager.setReloadingConfigs("true".equals(container.getInstance(String.class,
                 StrutsConstants.STRUTS_CONFIGURATION_XML_RELOAD)));
     }

Added: struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/fs/JBossFileManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/fs/JBossFileManager.java?rev=1338643&view=auto
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/fs/JBossFileManager.java (added)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/util/fs/JBossFileManager.java Tue May 15 11:05:50 2012
@@ -0,0 +1,10 @@
+package org.apache.struts2.util.fs;
+
+import com.opensymphony.xwork2.util.fs.DefaultFileManager;
+
+/**
+ * TODO lukaszlenart: move implementation from DefaultFileManager
+ */
+public class JBossFileManager extends DefaultFileManager {
+
+}

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java (original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java Tue May 15 11:05:50 2012
@@ -22,6 +22,7 @@
 package org.apache.struts2.views.freemarker;
 
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
@@ -215,8 +216,8 @@ public class FreemarkerManager {
     }
 
     @Inject
-    public void setFileManager(FileManager fileManager) {
-        this.fileManager = fileManager;
+    public void setFileManagerFactory(FileManagerFactory fileManagerFactory) {
+        this.fileManager = fileManagerFactory.getFileManager();
     }
 
     public boolean getNoCharsetInContentType() {

Modified: struts/struts2/trunk/core/src/main/resources/struts-default.xml
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/resources/struts-default.xml?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/resources/struts-default.xml (original)
+++ struts/struts2/trunk/core/src/main/resources/struts-default.xml Tue May 15 11:05:50 2012
@@ -29,8 +29,8 @@
     <bean class="com.opensymphony.xwork2.ObjectFactory" name="xwork" />
     <bean type="com.opensymphony.xwork2.ObjectFactory" name="struts" class="org.apache.struts2.impl.StrutsObjectFactory" />
 
-    <bean type="com.opensymphony.xwork2.FileManager" class="com.opensymphony.xwork2.util.fs.DefaultFileManager" name="xwork"/>
-    <bean type="com.opensymphony.xwork2.FileManager" class="com.opensymphony.xwork2.util.fs.DefaultFileManager" name="struts"/>
+    <bean type="com.opensymphony.xwork2.FileManagerFactory" class="com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory" name="xwork"/>
+    <bean type="com.opensymphony.xwork2.FileManagerFactory" class="com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory" name="struts"/>
 
     <bean type="com.opensymphony.xwork2.ActionProxyFactory" name="xwork" class="com.opensymphony.xwork2.DefaultActionProxyFactory"/>
     <bean type="com.opensymphony.xwork2.ActionProxyFactory" name="struts" class="org.apache.struts2.impl.StrutsActionProxyFactory"/>

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/dispatcher/DispatcherTest.java Tue May 15 11:05:50 2012
@@ -23,7 +23,7 @@ package org.apache.struts2.dispatcher;
 
 import com.mockobjects.dynamic.C;
 import com.mockobjects.dynamic.Mock;
-import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationManager;
@@ -32,8 +32,8 @@ import com.opensymphony.xwork2.config.en
 import com.opensymphony.xwork2.config.entities.PackageConfig;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.interceptor.Interceptor;
-import com.opensymphony.xwork2.util.fs.DefaultFileManager;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
+import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
 import org.apache.struts2.StrutsConstants;
 import org.apache.struts2.StrutsTestCase;
 import org.apache.struts2.dispatcher.FilterDispatcherTest.InnerDestroyableObjectFactory;
@@ -198,9 +198,9 @@ public class DispatcherTest extends Stru
         mockContainer.expectAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), destroyedObjectFactory);
         mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
         mockConfiguration.expectAndReturn("getContainer", mockContainer.proxy());
-        FileManager fileManager = new DefaultFileManager();
-        mockContainer.expectAndReturn("getInstance", C.args(C.eq(FileManager.class)), fileManager);
-        mockContainer.expectAndReturn("getInstance", C.args(C.eq(FileManager.class)), fileManager);
+        FileManagerFactory fileManagerFactory = new DefaultFileManagerFactory(container);
+        mockContainer.expectAndReturn("getInstance", C.args(C.eq(FileManagerFactory.class)), fileManagerFactory);
+        mockContainer.expectAndReturn("getInstance", C.args(C.eq(FileManagerFactory.class)), fileManagerFactory);
         mockConfiguration.expect("destroy");
         mockConfiguration.matchAndReturn("getPackageConfigs", new HashMap<String, PackageConfig>());
         
@@ -228,7 +228,7 @@ public class DispatcherTest extends Stru
         
         Mock mockContainer = new Mock(Container.class);
         mockContainer.matchAndReturn("getInstance", C.args(C.eq(ObjectFactory.class)), new ObjectFactory());
-        mockContainer.matchAndReturn("getInstance", C.args(C.eq(FileManager.class)), new DefaultFileManager());
+        mockContainer.matchAndReturn("getInstance", C.args(C.eq(FileManagerFactory.class)), new DefaultFileManagerFactory(container));
 
         Mock mockConfiguration = new Mock(Configuration.class);
         mockConfiguration.matchAndReturn("getPackageConfigs", packageConfigs);

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreeMarkerResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreeMarkerResultTest.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreeMarkerResultTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreeMarkerResultTest.java Tue May 15 11:05:50 2012
@@ -24,8 +24,8 @@ package org.apache.struts2.views.freemar
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.mock.MockActionInvocation;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
-import com.opensymphony.xwork2.util.fs.DefaultFileManager;
 import com.opensymphony.xwork2.util.ValueStack;
+import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
 import freemarker.template.Configuration;
 import freemarker.template.TemplateExceptionHandler;
 import org.apache.struts2.ServletActionContext;
@@ -266,7 +266,7 @@ public class FreeMarkerResultTest extend
         super.setUp();
         mgr = new FreemarkerManager();
         mgr.setEncoding("UTF-8");
-        mgr.setFileManager(new DefaultFileManager());
+        mgr.setFileManagerFactory(new DefaultFileManagerFactory(container));
         stringWriter = new StringWriter();
         writer = new PrintWriter(stringWriter);
         response = new StrutsMockHttpServletResponse();

Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/freemarker/FreemarkerManagerTest.java Tue May 15 11:05:50 2012
@@ -21,7 +21,7 @@
 
 package org.apache.struts2.views.freemarker;
 
-import com.opensymphony.xwork2.util.fs.DefaultFileManager;
+import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
 import org.apache.commons.io.FileUtils;
 import org.apache.struts2.StrutsTestCase;
 import org.apache.struts2.views.jsp.StrutsMockServletContext;
@@ -34,7 +34,7 @@ public class FreemarkerManagerTest exten
     public void testIfStrutsEncodingIsSetProperty() throws Exception {
         FreemarkerManager mgr = new FreemarkerManager();
         mgr.setEncoding("UTF-8");
-        mgr.setFileManager(new DefaultFileManager());
+        mgr.setFileManagerFactory(new DefaultFileManagerFactory(container));
         StrutsMockServletContext servletContext = new StrutsMockServletContext();
         servletContext.setAttribute(FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY, null);
         freemarker.template.Configuration conf = mgr.getConfiguration(servletContext);

Modified: struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java (original)
+++ struts/struts2/trunk/plugins/convention/src/main/java/org/apache/struts2/convention/PackageBasedActionConfigBuilder.java Tue May 15 11:05:50 2012
@@ -22,6 +22,7 @@ package org.apache.struts2.convention;
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.config.Configuration;
 import com.opensymphony.xwork2.config.ConfigurationException;
@@ -296,8 +297,8 @@ public class PackageBasedActionConfigBui
     }
 
     @Inject
-    public void setFileManager(FileManager fileManager) {
-        this.fileManager = fileManager;
+    public void setFileManagerFactory(FileManagerFactory fileManagerFactory) {
+        this.fileManager = fileManagerFactory.getFileManager();
     }
 
     protected void initReloadClassLoader() {

Modified: struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java (original)
+++ struts/struts2/trunk/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java Tue May 15 11:05:50 2012
@@ -22,6 +22,8 @@ package org.apache.struts2.convention;
 
 import com.opensymphony.xwork2.ActionChainResult;
 import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.Result;
 import com.opensymphony.xwork2.config.Configuration;
@@ -37,6 +39,7 @@ import com.opensymphony.xwork2.config.im
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.inject.Scope.Strategy;
 import com.opensymphony.xwork2.ognl.OgnlReflectionProvider;
+import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
 import com.opensymphony.xwork2.util.reflection.ReflectionException;
 import junit.framework.TestCase;
 import org.apache.struts2.convention.actions.DefaultResultPathAction;
@@ -109,6 +112,14 @@ import static org.easymock.EasyMock.veri
  */
 public class PackageBasedActionConfigBuilderTest extends TestCase {
 
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        ActionContext context = new ActionContext(new HashMap<String, Object>());
+        context.setContainer(new DummyContainer());
+        ActionContext.setContext(context);
+    }
+
     public void testActionPackages() throws MalformedURLException {
         run("org.apache.struts2.convention.actions", null, null);
     }
@@ -680,6 +691,11 @@ public class PackageBasedActionConfigBui
         private ResultMapBuilder resultMapBuilder;
         private InterceptorMapBuilder interceptorMapBuilder;
         private ConventionsService conventionsService;
+        private DefaultFileManagerFactory fileManagerFactory;
+
+        public DummyContainer() {
+            fileManagerFactory = new DefaultFileManagerFactory(this);
+        }
 
         public void setActionNameBuilder(ActionNameBuilder actionNameBuilder) {
             this.actionNameBuilder = actionNameBuilder;
@@ -699,6 +715,9 @@ public class PackageBasedActionConfigBui
 
         public <T> T getInstance(Class<T> type) {
             try {
+                if (type == FileManagerFactory.class) {
+                    return (T) fileManagerFactory;
+                }
                 T obj = type.newInstance();
                 if (obj instanceof ObjectFactory) {
                     ((ObjectFactory)obj).setReflectionProvider(new OgnlReflectionProvider() {
@@ -736,10 +755,15 @@ public class PackageBasedActionConfigBui
                 return (T) actionNameBuilder;
             else if (type == ConventionsService.class)
                 return (T) conventionsService;
+            else if (type == FileManagerFactory.class)
+                return (T) fileManagerFactory;
             return null;
         }
 
         public Set<String> getInstanceNames(Class<?> type) {
+            if (type == FileManager.class) {
+                return Collections.emptySet();
+            }
             return null;
         }
 

Modified: struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java (original)
+++ struts/struts2/trunk/plugins/embeddedjsp/src/main/java/org/apache/struts2/JSPLoader.java Tue May 15 11:05:50 2012
@@ -20,7 +20,8 @@
  */
 package org.apache.struts2;
 
-import com.opensymphony.xwork2.util.URLUtil;
+import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.util.finder.ClassLoaderInterface;
 import com.opensymphony.xwork2.util.finder.ClassLoaderInterfaceDelegate;
 import com.opensymphony.xwork2.util.finder.UrlSet;
@@ -186,9 +187,10 @@ public class JSPLoader {
         //find jars
         List<URL> urls = urlSet.getUrls();
 
+        FileManager fileManager = ServletActionContext.getContext().getInstance(FileManagerFactory.class).getFileManager();
         for (URL url : urls) {
-            URL normalizedUrl = URLUtil.normalizeToFileProtocol(url);
-            File file = FileUtils.toFile((URL) ObjectUtils.defaultIfNull(normalizedUrl, url));
+            URL normalizedUrl = fileManager.normalizeToFileProtocol(url);
+            File file = FileUtils.toFile(ObjectUtils.defaultIfNull(normalizedUrl, url));
             if (file.exists())
                 classPath.add(file.getAbsolutePath());
         }

Modified: struts/struts2/trunk/plugins/embeddedjsp/src/test/java/org/apache/struts2/EmbeddedJSPResultTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/embeddedjsp/src/test/java/org/apache/struts2/EmbeddedJSPResultTest.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/embeddedjsp/src/test/java/org/apache/struts2/EmbeddedJSPResultTest.java (original)
+++ struts/struts2/trunk/plugins/embeddedjsp/src/test/java/org/apache/struts2/EmbeddedJSPResultTest.java Tue May 15 11:05:50 2012
@@ -21,11 +21,14 @@
 package org.apache.struts2;
 
 import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
 import com.opensymphony.xwork2.inject.Container;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.finder.ClassLoaderInterface;
 import com.opensymphony.xwork2.util.finder.ClassLoaderInterfaceDelegate;
+import com.opensymphony.xwork2.util.fs.DefaultFileManager;
 import junit.framework.TestCase;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.struts2.views.util.DefaultUrlHelper;
@@ -41,6 +44,7 @@ import javax.servlet.http.HttpSession;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.BrokenBarrierException;
@@ -117,7 +121,7 @@ public class EmbeddedJSPResultTest exten
         assertEquals("somethingelseText", response.getContentAsString());
     }
 
-    public void tesAbsolutePatht() throws Exception {
+    public void testAbsolutePath() throws Exception {
         result.setLocation("/org/apache/struts2/simple0.jsp");
         result.execute(null);
 
@@ -265,12 +269,19 @@ public class EmbeddedJSPResultTest exten
         //mock converter
         XWorkConverter converter = new DummyConverter();
 
+        DefaultFileManager fileManager = new DefaultFileManager();
+        fileManager.setReloadingConfigs(false);
+
         //mock container
         Container container = EasyMock.createNiceMock(Container.class);
         EasyMock.expect(container.getInstance(XWorkConverter.class)).andReturn(converter).anyTimes();
+        EasyMock.expect(container.getInstanceNames(FileManager.class)).andReturn(new HashSet<String>()).anyTimes();
+        EasyMock.expect(container.getInstance(FileManager.class)).andReturn(fileManager).anyTimes();
 
         UrlHelper urlHelper = new DefaultUrlHelper();
         EasyMock.expect(container.getInstance(UrlHelper.class)).andReturn(urlHelper).anyTimes();
+        FileManagerFactory fileManagerFactory = new DummyFileManagerFactory();
+        EasyMock.expect(container.getInstance(FileManagerFactory.class)).andReturn(fileManagerFactory).anyTimes();
 
         EasyMock.replay(container);
         stackContext.put(ActionContext.CONTAINER, container);
@@ -278,6 +289,7 @@ public class EmbeddedJSPResultTest exten
 
         actionContext.setValueStack(valueStack);
     }
+
 }
 
 //converter has a protected default constructor...meh
@@ -285,6 +297,14 @@ class DummyConverter extends XWorkConver
 
 }
 
+class DummyFileManagerFactory implements FileManagerFactory {
+
+    public FileManager getFileManager() {
+        return new DefaultFileManager();
+    }
+
+}
+
 class DummyServletCache extends ServletCache {
     public int size() {
         return cache.size();
@@ -307,7 +327,7 @@ class ServletGetRunnable implements Runn
 
     public void run() {
         ActionContext.setContext(actionContext);
-        //wait to start all therads at once..or try at least
+        //wait to start all threads at once..or try at least
         try {
             startBarrier.await();
             object = servletCache.get("org/apache/struts2/simple0.jsp");

Modified: struts/struts2/trunk/plugins/osgi/src/main/java/org/apache/struts2/osgi/FelixOsgiHost.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/osgi/src/main/java/org/apache/struts2/osgi/FelixOsgiHost.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/osgi/src/main/java/org/apache/struts2/osgi/FelixOsgiHost.java (original)
+++ struts/struts2/trunk/plugins/osgi/src/main/java/org/apache/struts2/osgi/FelixOsgiHost.java Tue May 15 11:05:50 2012
@@ -21,27 +21,24 @@
 
 package org.apache.struts2.osgi;
 
+import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.config.ConfigurationException;
-import com.opensymphony.xwork2.inject.Inject;
-import com.opensymphony.xwork2.util.URLUtil;
 import com.opensymphony.xwork2.util.finder.ResourceFinder;
 import com.opensymphony.xwork2.util.logging.Logger;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
-import com.opensymphony.xwork2.ActionContext;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.felix.framework.Felix;
 import org.apache.felix.framework.util.FelixConstants;
 import org.apache.felix.main.AutoActivator;
 import org.apache.felix.main.Main;
 import org.apache.felix.shell.ShellService;
-import org.apache.struts2.StrutsStatics;
+import org.apache.struts2.ServletActionContext;
 import org.apache.struts2.StrutsException;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleActivator;
-import org.osgi.framework.Constants;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.BundleEvent;
+import org.osgi.framework.Constants;
 import org.osgi.util.tracker.ServiceTracker;
 
 import javax.servlet.ServletContext;
@@ -337,7 +334,8 @@ public class FelixOsgiHost implements Os
     protected String getVersion(URL url) {
         if ("jar".equals(url.getProtocol())) {
             try {
-                JarFile jarFile = new JarFile(new File(URLUtil.normalizeToFileProtocol(url).toURI()));
+                FileManager fileManager = ServletActionContext.getContext().getInstance(FileManagerFactory.class).getFileManager();
+                JarFile jarFile = new JarFile(new File(fileManager.normalizeToFileProtocol(url).toURI()));
                 Manifest manifest = jarFile.getManifest();
                 if (manifest != null) {
                     String version = manifest.getMainAttributes().getValue("Bundle-Version");

Modified: struts/struts2/trunk/plugins/oval/src/main/java/org/apache/struts2/oval/interceptor/DefaultOValValidationManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/oval/src/main/java/org/apache/struts2/oval/interceptor/DefaultOValValidationManager.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/plugins/oval/src/main/java/org/apache/struts2/oval/interceptor/DefaultOValValidationManager.java (original)
+++ struts/struts2/trunk/plugins/oval/src/main/java/org/apache/struts2/oval/interceptor/DefaultOValValidationManager.java Tue May 15 11:05:50 2012
@@ -1,6 +1,7 @@
 package org.apache.struts2.oval.interceptor;
 
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
 import com.opensymphony.xwork2.util.logging.Logger;
@@ -31,8 +32,8 @@ public class DefaultOValValidationManage
     private FileManager fileManager;
 
     @Inject
-    public void setFileManager(FileManager fileManager) {
-        this.fileManager = fileManager;
+    public void setFileManagerFactory(FileManagerFactory fileManagerFactory) {
+        this.fileManager = fileManagerFactory.getFileManager();
     }
 
     public synchronized List<Configurer> getConfigurers(Class clazz, String context, boolean validateJPAAnnotations) {

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/FileManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/FileManager.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/FileManager.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/FileManager.java Tue May 15 11:05:50 2012
@@ -1,7 +1,9 @@
 package com.opensymphony.xwork2;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+import java.util.Collection;
 
 /**
  * Basic interface to access file on the File System and to monitor changes
@@ -44,4 +46,19 @@ public interface FileManager {
      */
     void monitorFile(URL fileUrl);
 
+    /**
+     * Convert URLs to URLs with "file" protocol
+     * @param url URL to convert to a jar url
+     * @return a URL to a file, or null if the URL external form cannot be parsed
+     */
+    URL normalizeToFileProtocol(URL url);
+
+    /**
+     * Indicate if given implementation supports current OS File System
+     *
+     * @return true if supports current OS File System
+     */
+    boolean support();
+
+    Collection<? extends URL> getAllPhysicalUrls(URL url) throws IOException;
 }

Added: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/FileManagerFactory.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/FileManagerFactory.java?rev=1338643&view=auto
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/FileManagerFactory.java (added)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/FileManagerFactory.java Tue May 15 11:05:50 2012
@@ -0,0 +1,10 @@
+package com.opensymphony.xwork2;
+
+/**
+ * Factory that creates FileManager, default to {@link com.opensymphony.xwork2.util.fs.DefaultFileManager}
+ */
+public interface FileManagerFactory {
+
+    FileManager getFileManager();
+
+}

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/ConfigurationManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/ConfigurationManager.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/ConfigurationManager.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/ConfigurationManager.java Tue May 15 11:05:50 2012
@@ -16,6 +16,7 @@
 package com.opensymphony.xwork2.config;
 
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
 import com.opensymphony.xwork2.config.providers.XWorkConfigurationProvider;
 import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider;
@@ -168,7 +169,7 @@ public class ConfigurationManager {
      * @param container current container used to obtain instance of {@link com.opensymphony.xwork2.util.fs.DefaultFileManager}
      */
     public synchronized void conditionalReload(Container container) {
-        FileManager fileManager = container.getInstance(FileManager.class);
+        FileManager fileManager = container.getInstance(FileManagerFactory.class).getFileManager();
         if (fileManager.isReloadingConfigs()) {
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Checking ConfigurationProviders for reload.");

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java Tue May 15 11:05:50 2012
@@ -18,6 +18,7 @@ package com.opensymphony.xwork2.config.i
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.DefaultTextProvider;
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.TextProvider;
 import com.opensymphony.xwork2.config.Configuration;
@@ -53,10 +54,11 @@ import com.opensymphony.xwork2.ognl.Ognl
 import com.opensymphony.xwork2.ognl.OgnlValueStackFactory;
 import com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor;
 import com.opensymphony.xwork2.util.CompoundRoot;
-import com.opensymphony.xwork2.util.fs.DefaultFileManager;
 import com.opensymphony.xwork2.util.PatternMatcher;
 import com.opensymphony.xwork2.util.ValueStack;
 import com.opensymphony.xwork2.util.ValueStackFactory;
+import com.opensymphony.xwork2.util.fs.DefaultFileManager;
+import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
 import com.opensymphony.xwork2.util.logging.Logger;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
@@ -269,7 +271,7 @@ public class DefaultConfiguration implem
     protected Container createBootstrapContainer() {
         ContainerBuilder builder = new ContainerBuilder();
         builder.factory(ObjectFactory.class, Scope.SINGLETON);
-        builder.factory(FileManager.class, DefaultFileManager.class, Scope.SINGLETON);
+        builder.factory(FileManagerFactory.class, DefaultFileManagerFactory.class, Scope.SINGLETON);
         builder.factory(ReflectionProvider.class, OgnlReflectionProvider.class, Scope.SINGLETON);
         builder.factory(ValueStackFactory.class, OgnlValueStackFactory.class, Scope.SINGLETON);
         builder.factory(XWorkConverter.class, Scope.SINGLETON);

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XWorkConfigurationProvider.java Tue May 15 11:05:50 2012
@@ -5,6 +5,7 @@ import com.opensymphony.xwork2.DefaultAc
 import com.opensymphony.xwork2.DefaultTextProvider;
 import com.opensymphony.xwork2.DefaultUnknownHandlerManager;
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.TextProvider;
 import com.opensymphony.xwork2.TextProviderSupport;
 import com.opensymphony.xwork2.UnknownHandlerManager;
@@ -40,10 +41,11 @@ import com.opensymphony.xwork2.ognl.acce
 import com.opensymphony.xwork2.ognl.accessor.XWorkMapPropertyAccessor;
 import com.opensymphony.xwork2.ognl.accessor.XWorkMethodAccessor;
 import com.opensymphony.xwork2.util.CompoundRoot;
-import com.opensymphony.xwork2.util.fs.DefaultFileManager;
 import com.opensymphony.xwork2.util.PatternMatcher;
 import com.opensymphony.xwork2.util.ValueStackFactory;
 import com.opensymphony.xwork2.util.WildcardHelper;
+import com.opensymphony.xwork2.util.fs.DefaultFileManager;
+import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
 import com.opensymphony.xwork2.util.location.LocatableProperties;
 import com.opensymphony.xwork2.util.reflection.ReflectionContextFactory;
 import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
@@ -89,7 +91,7 @@ public class XWorkConfigurationProvider 
                 .factory(ActionProxyFactory.class, DefaultActionProxyFactory.class, Scope.SINGLETON)
                 .factory(ObjectTypeDeterminer.class, DefaultObjectTypeDeterminer.class, Scope.SINGLETON)
                 .factory(XWorkConverter.class, Scope.SINGLETON)
-                .factory(FileManager.class, DefaultFileManager.class, Scope.SINGLETON)
+                .factory(FileManagerFactory.class, DefaultFileManagerFactory.class, Scope.SINGLETON)
                 .factory(ValueStackFactory.class, OgnlValueStackFactory.class, Scope.SINGLETON)
                 .factory(ValidatorFactory.class, DefaultValidatorFactory.class, Scope.SINGLETON)
                 .factory(ValidatorFileParser.class, DefaultValidatorFileParser.class, Scope.SINGLETON)

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java Tue May 15 11:05:50 2012
@@ -17,6 +17,7 @@ package com.opensymphony.xwork2.config.p
 
 import com.opensymphony.xwork2.Action;
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.XWorkException;
 import com.opensymphony.xwork2.config.Configuration;
@@ -113,8 +114,8 @@ public class XmlConfigurationProvider im
     }
 
     @Inject
-    public void setFileManager(FileManager fileManager) {
-        this.fileManager = fileManager;
+    public void setFileManagerFactory(FileManagerFactory fileManagerFactory) {
+        this.fileManager = fileManagerFactory.getFileManager();
     }
 
     /**

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java Tue May 15 11:05:50 2012
@@ -17,6 +17,7 @@ package com.opensymphony.xwork2.conversi
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.XWorkMessages;
 import com.opensymphony.xwork2.XWorkException;
@@ -202,8 +203,8 @@ public class XWorkConverter extends Defa
     }
 
     @Inject
-    public void setFileManager(FileManager fileManager) {
-        this.fileManager = fileManager;
+    public void setFileManagerFactory(FileManagerFactory fileManagerFactory) {
+        this.fileManager = fileManagerFactory.getFileManager();
     }
 
     public static String getConversionErrorMessage(String propertyName, ValueStack stack) {

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/URLUtil.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/URLUtil.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/URLUtil.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/URLUtil.java Tue May 15 11:05:50 2012
@@ -18,15 +18,8 @@ package com.opensymphony.xwork2.util;
 import com.opensymphony.xwork2.util.logging.Logger;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
 
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Method;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 /**
  * Helper class to extract file paths from different urls
@@ -39,36 +32,6 @@ public class URLUtil {
     public static final String JBOSS5_VFSMEMORY = "vfsmemory";
     public static final String JBOSS5_VFSFILE = "vfsfile";
 
-    private static final Pattern JAR_PATTERN = Pattern.compile("^(jar:|wsjar:|zip:|vfsfile:|code-source:)?(file:)?(.*?)(\\!/|\\.jar/)(.*)");
-    private static final int JAR_FILE_PATH = 3;
-
-    /**
-     * Convert URLs to URLs with "file" protocol
-     * @param url URL to convert to a jar url
-     * @return a URL to a file, or null if the URL external form cannot be parsed
-     */
-    public static URL normalizeToFileProtocol(URL url) {
-        String fileName = url.toExternalForm();
-        Matcher jarMatcher = JAR_PATTERN.matcher(fileName);
-        try {
-            if (isJBossUrl(url)){
-                return getJBossPhysicalUrl(url);
-            } else  if (jarMatcher.matches()) {
-                String path = jarMatcher.group(JAR_FILE_PATH);
-                return new URL("file", "", path);
-            } else {
-                //it is not a jar or zip file
-                return null;
-            }
-        } catch (MalformedURLException e) {
-            //can this ever happen?
-            return null;
-        } catch (IOException e) {
-            LOG.warn("Error opening JBoss vfs file", e);
-            return null;
-        }
-    }
-
     /**
      * Verify That the given String is in valid URL format.
      * @param url The url string to verify.
@@ -93,89 +56,4 @@ public class URLUtil {
         }
     }
 
-    /**
-     * Check if given URL is matching Jar pattern for different servers
-     * @param fileUrl
-     * @return
-     */
-    public static boolean isJarURL(URL fileUrl) {
-        Matcher jarMatcher = URLUtil.JAR_PATTERN.matcher(fileUrl.getPath());
-        return jarMatcher.matches(); 
-    }
-
-    /**
-     * Check if given URL is pointing to JBoss 5 VFS resource
-     * @param fileUrl
-     * @return
-     */
-    public static boolean isJBossUrl(URL fileUrl) {
-        final String protocol = fileUrl.getProtocol();
-        return JBOSS5_VFSZIP.equals(protocol) || JBOSS5_VFSMEMORY.equals(protocol) || JBOSS5_VFS.equals(protocol)
-                || ("true".equals(System.getProperty("jboss.vfs.forceVfsJar")) && JBOSS5_VFSFILE.equals(protocol));
-    }
-
-    /**
-     * Try to determine physical file location.
-     *
-     * @param url JBoss VFS URL
-     * @return URL pointing to physical file or original URL
-     * @throws IOException If conversion fails
-     */
-    public static URL getJBossPhysicalUrl(URL url) throws IOException {
-        Object content = url.openConnection().getContent();
-        try {
-            String s = content.getClass().toString();
-            if (s.startsWith("class org.jboss.vfs.VirtualFile")) { // JBoss 7 and probably JBoss 6
-                File physicalFile = readJBossPhysicalFile(content);
-                return physicalFile.toURI().toURL();
-            } else if (s.startsWith("class org.jboss.virtual.VirtualFile")) { // JBoss 5
-                String fileName = url.toExternalForm();
-                return new URL("file", null, fileName.substring(fileName.indexOf(":") + 1));
-            }
-        } catch (Exception e) {
-            LOG.warn("Error calling getPhysicalFile() on JBoss VirtualFile.", e);
-        }
-        return url;
-    }
-
-    public static List<URL> getAllJBossPhysicalUrls(URL url) throws IOException {
-        List<URL> urls = new ArrayList<URL>();
-        Object content = url.openConnection().getContent();
-        try {
-            if (content.getClass().toString().startsWith("class org.jboss.vfs.VirtualFile")) {
-                File physicalFile = readJBossPhysicalFile(content);
-                readFile(urls, physicalFile);
-                readFile(urls, physicalFile.getParentFile());
-            } else {
-                urls.add(url);
-            }
-        } catch (Exception e) {
-            LOG.warn("Error calling getPhysicalFile() on JBoss VirtualFile.", e);
-        }
-        return urls;
-    }
-
-    private static File readJBossPhysicalFile(Object content) throws Exception {
-        Method method = content.getClass().getDeclaredMethod("getPhysicalFile");
-        return (File) method.invoke(content);
-    }
-
-    private static void readFile(List<URL> urls, File physicalFile) throws MalformedURLException {
-        if (physicalFile.isDirectory()) {
-            for (File file : physicalFile.listFiles()) {
-                if (file.isFile()) {
-                    addIfAbsent(urls, file.toURI().toURL());
-                } else if (file.isDirectory()) {
-                    readFile(urls, file);
-                }
-            }
-        }
-    }
-
-    private static void addIfAbsent(List<URL> urls, URL fileUrl) {
-        if (!urls.contains(fileUrl)) {
-            urls.add(fileUrl);
-        }
-    }
-
 }

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/classloader/ReloadingClassLoader.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/classloader/ReloadingClassLoader.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/classloader/ReloadingClassLoader.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/classloader/ReloadingClassLoader.java Tue May 15 11:05:50 2012
@@ -15,24 +15,22 @@
  */
 package com.opensymphony.xwork2.util.classloader;
 
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
+import com.opensymphony.xwork2.XWorkException;
 import com.opensymphony.xwork2.util.logging.Logger;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
-import com.opensymphony.xwork2.util.classloader.FileResourceStore;
-import com.opensymphony.xwork2.util.URLUtil;
-import com.opensymphony.xwork2.XWorkException;
+import org.apache.commons.lang3.ObjectUtils;
 
-import java.io.InputStream;
 import java.io.File;
-import java.net.URL;
+import java.io.InputStream;
 import java.net.URISyntaxException;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-import java.util.Set;
+import java.net.URL;
 import java.util.Collections;
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.apache.commons.lang3.ObjectUtils;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * The ReloadingClassLoader uses a delegation mechanism to allow
@@ -54,8 +52,9 @@ public class ReloadingClassLoader extend
         super(pParent);
         parent = pParent;
         URL parentRoot = pParent.getResource("");
-        URL root = URLUtil.normalizeToFileProtocol(parentRoot);
-        root = (URL) ObjectUtils.defaultIfNull(root, parentRoot);
+        FileManager fileManager = ActionContext.getContext().getInstance(FileManagerFactory.class).getFileManager();
+        URL root = fileManager.normalizeToFileProtocol(parentRoot);
+        root = ObjectUtils.defaultIfNull(root, parentRoot);
         try {
             if (root != null) {
                 stores = new ResourceStore[]{new FileResourceStore(new File(root.toURI()))};

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/finder/ClassFinder.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/finder/ClassFinder.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/finder/ClassFinder.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/finder/ClassFinder.java Tue May 15 11:05:50 2012
@@ -15,16 +15,18 @@
  */
 package com.opensymphony.xwork2.util.finder;
 
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
+import com.opensymphony.xwork2.XWorkException;
 import com.opensymphony.xwork2.util.logging.Logger;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
-import com.opensymphony.xwork2.util.URLUtil;
-import com.opensymphony.xwork2.XWorkException;
+import org.apache.commons.lang3.StringUtils;
 import org.objectweb.asm.AnnotationVisitor;
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.FieldVisitor;
 import org.objectweb.asm.MethodVisitor;
 import org.objectweb.asm.commons.EmptyVisitor;
-import org.apache.commons.lang3.StringUtils;
 
 import java.io.File;
 import java.io.IOException;
@@ -37,7 +39,17 @@ import java.lang.reflect.Method;
 import java.net.JarURLConnection;
 import java.net.URL;
 import java.net.URLDecoder;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.jar.JarEntry;
 import java.util.jar.JarInputStream;
 
@@ -66,6 +78,7 @@ public class ClassFinder {
 
     private boolean extractBaseInterfaces;
     private ClassLoaderInterface classLoaderInterface;
+    private FileManager fileManager;
 
     /**
      * Creates a ClassFinder that will search the urls in the specified ClassLoaderInterface
@@ -136,6 +149,7 @@ public class ClassFinder {
     public ClassFinder(ClassLoaderInterface classLoaderInterface, Collection<URL> urls, boolean extractBaseInterfaces, Set<String> protocols, Test<String> classNameFilter) {
         this.classLoaderInterface = classLoaderInterface;
         this.extractBaseInterfaces = extractBaseInterfaces;
+        this.fileManager = ActionContext.getContext().getInstance(FileManagerFactory.class).getFileManager();
 
         List<String> classNames = new ArrayList<String>();
         for (URL location : urls) {
@@ -477,7 +491,7 @@ public class ClassFinder {
     }
 
     private List<String> jar(URL location) throws IOException {
-        URL url = URLUtil.normalizeToFileProtocol(location);
+        URL url = fileManager.normalizeToFileProtocol(location);
         if (url != null) {
             InputStream in = url.openStream();
             try {

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/finder/UrlSet.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/finder/UrlSet.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/finder/UrlSet.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/finder/UrlSet.java Tue May 15 11:05:50 2012
@@ -15,17 +15,27 @@
  */
 package com.opensymphony.xwork2.util.finder;
 
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.util.logging.Logger;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
-import com.opensymphony.xwork2.util.URLUtil;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
 
 import java.io.File;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * Use with ClassFinder to filter the Urls to be scanned, example:
@@ -46,15 +56,22 @@ public class UrlSet {
     private static final Logger LOG = LoggerFactory.getLogger(UrlSet.class);
     private final Map<String,URL> urls;
     private Set<String> protocols;
-    
+    private FileManager fileManager;
+
+    private UrlSet() {
+        this.urls = new HashMap<String,URL>();
+        this.fileManager = ActionContext.getContext().getInstance(FileManagerFactory.class).getFileManager();
+    }
 
     public UrlSet(ClassLoaderInterface classLoader) throws IOException {
-        this(getUrls(classLoader));
+        this();
+        load(getUrls(classLoader));
     }
 
     public UrlSet(ClassLoaderInterface classLoader, Set<String> protocols) throws IOException {
-        this(getUrls(classLoader, protocols));
+        this();
         this.protocols = protocols;
+        load(getUrls(classLoader, protocols));
     }
 
     public UrlSet(URL... urls){
@@ -65,20 +82,17 @@ public class UrlSet {
      * @param urls
      */
     public UrlSet(Collection<URL> urls){
-        this.urls = new HashMap<String,URL>();
+        this();
+        load(urls);
+    }
+
+    private UrlSet(Map<String, URL> urls) {
+        this.urls = urls;
+    }
+
+    private void load(Collection<URL> urls){
         for (URL location : urls) {
             try {
-//                if (location.getProtocol().equals("file")) {
-//                    try {
-//                        // See if it's actually a jar
-//                        URL jarUrl = new URL("jar", "", location.toExternalForm() + "!/");
-//                        JarURLConnection juc = (JarURLConnection) jarUrl.openConnection();
-//                        juc.getJarFile();
-//                        location = jarUrl;
-//                    } catch (IOException e) {
-//                    }
-//                    this.urls.put(location.toExternalForm(), location);
-//                }
                 this.urls.put(location.toExternalForm(), location);
             } catch (Exception e) {
                 e.printStackTrace();
@@ -86,10 +100,6 @@ public class UrlSet {
         }
     }
 
-    private UrlSet(Map<String, URL> urls) {
-        this.urls = urls;
-    }
-
     public UrlSet include(UrlSet urlSet){
         Map<String, URL> urls = new HashMap<String, URL>(this.urls);
         urls.putAll(urlSet.urls);
@@ -186,8 +196,8 @@ public class UrlSet {
                 //if it is inside a war file, get the url to the file
                 externalForm = StringUtils.substringBefore(externalForm, "/WEB-INF/classes");
                 URL warUrl = new URL(externalForm);
-                URL normalizedUrl = URLUtil.normalizeToFileProtocol(warUrl);
-                URL finalUrl = (URL) ObjectUtils.defaultIfNull(normalizedUrl, warUrl);
+                URL normalizedUrl = fileManager.normalizeToFileProtocol(warUrl);
+                URL finalUrl = ObjectUtils.defaultIfNull(normalizedUrl, warUrl);
 
                 Map<String, URL> newUrls = new HashMap<String, URL>(this.urls);
                 if ("jar".equals(finalUrl.getProtocol()) || "file".equals(finalUrl.getProtocol())) {
@@ -216,7 +226,7 @@ public class UrlSet {
         return new ArrayList<URL>(urls.values());
     }
 
-    private static List<URL> getUrls(ClassLoaderInterface classLoader) throws IOException {
+    private List<URL> getUrls(ClassLoaderInterface classLoader) throws IOException {
         List<URL> list = new ArrayList<URL>();
 
         //find jars
@@ -238,7 +248,7 @@ public class UrlSet {
         return list;
     }
 
-    private static List<URL> getUrls(ClassLoaderInterface classLoader, Set<String> protocols) throws IOException {
+    private List<URL> getUrls(ClassLoaderInterface classLoader, Set<String> protocols) throws IOException {
 
         if (protocols == null) {
             return getUrls(classLoader);
@@ -263,11 +273,7 @@ public class UrlSet {
         // Usually the "classes" dir.
         ArrayList<URL> classesList = Collections.list(classLoader.getResources(""));
         for (URL url : classesList) {
-            if (URLUtil.isJBossUrl(url)) {
-                list.addAll(URLUtil.getAllJBossPhysicalUrls(url));
-            } else {
-                list.add(url);
-            }
+            list.addAll(fileManager.getAllPhysicalUrls(url));
         }
 
         return list;

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/DefaultFileManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/DefaultFileManager.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/DefaultFileManager.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/DefaultFileManager.java Tue May 15 11:05:50 2012
@@ -16,16 +16,24 @@
 package com.opensymphony.xwork2.util.fs;
 
 import com.opensymphony.xwork2.FileManager;
-import com.opensymphony.xwork2.util.URLUtil;
 import com.opensymphony.xwork2.util.logging.Logger;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Default implementation of {@link FileManager}
@@ -34,13 +42,21 @@ public class DefaultFileManager implemen
 
     private static Logger LOG = LoggerFactory.getLogger(DefaultFileManager.class);
 
+    public static final String JBOSS5_VFS = "vfs";
+    public static final String JBOSS5_VFSZIP = "vfszip";
+    public static final String JBOSS5_VFSMEMORY = "vfsmemory";
+    public static final String JBOSS5_VFSFILE = "vfsfile";
+
+    public static final String JAR_FILE_NAME_SEPARATOR = "!/";
+    public static final String JAR_FILE_EXTENSION_END = ".jar/";
+
+    private static final Pattern JAR_PATTERN = Pattern.compile("^(jar:|wsjar:|zip:|vfsfile:|code-source:)?(file:)?(.*?)(\\!/|\\.jar/)(.*)");
+    private static final int JAR_FILE_PATH = 3;
+
     private static Map<String, Revision> files = Collections.synchronizedMap(new HashMap<String, Revision>());
 
     protected boolean reloadingConfigs = true;
 
-    static final String JAR_FILE_NAME_SEPARATOR = "!/";
-    static final String JAR_FILE_EXTENSION_END = ".jar/";
-
     public DefaultFileManager() {
     }
 
@@ -97,10 +113,10 @@ public class DefaultFileManager implemen
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Creating revision for URL: " +fileName);
             }
-            if (URLUtil.isJBossUrl(fileUrl)) {
-                revision = JBossFileRevision.build(fileUrl);
-            } else if (URLUtil.isJarURL(fileUrl)) {
-                revision = JarEntryRevision.build(fileUrl);
+            if (isJBossUrl(fileUrl)) {
+                revision = JBossFileRevision.build(fileUrl, this);
+            } else if (isJarURL(fileUrl)) {
+                revision = JarEntryRevision.build(fileUrl, this);
             } else {
                 revision = FileRevision.build(fileUrl);
             }
@@ -112,4 +128,122 @@ public class DefaultFileManager implemen
         }
     }
 
+    /**
+     * Check if given URL is matching Jar pattern for different servers
+     * @param fileUrl
+     * @return
+     */
+    protected boolean isJarURL(URL fileUrl) {
+        Matcher jarMatcher = JAR_PATTERN.matcher(fileUrl.getPath());
+        return jarMatcher.matches();
+    }
+
+
+    public URL normalizeToFileProtocol(URL url) {
+        String fileName = url.toExternalForm();
+        Matcher jarMatcher = JAR_PATTERN.matcher(fileName);
+        try {
+            if (isJBossUrl(url)){
+                return getJBossPhysicalUrl(url);
+            } else  if (jarMatcher.matches()) {
+                String path = jarMatcher.group(JAR_FILE_PATH);
+                return new URL("file", "", path);
+            } else {
+                //it is not a jar or zip file
+                return null;
+            }
+        } catch (MalformedURLException e) {
+            //can this ever happen?
+            return null;
+        } catch (IOException e) {
+            LOG.warn("Error opening JBoss vfs file", e);
+            return null;
+        }
+    }
+
+    /**
+     * Check if given URL is pointing to JBoss 5 VFS resource
+     * @param fileUrl
+     * @return
+     */
+    protected boolean isJBossUrl(URL fileUrl) {
+        final String protocol = fileUrl.getProtocol();
+        return JBOSS5_VFSZIP.equals(protocol) || JBOSS5_VFSMEMORY.equals(protocol) || JBOSS5_VFS.equals(protocol)
+                || ("true".equals(System.getProperty("jboss.vfs.forceVfsJar")) && JBOSS5_VFSFILE.equals(protocol));
+    }
+
+    /**
+     * Try to determine physical file location.
+     *
+     * @param url JBoss VFS URL
+     * @return URL pointing to physical file or original URL
+     * @throws IOException If conversion fails
+     */
+    protected URL getJBossPhysicalUrl(URL url) throws IOException {
+        Object content = url.openConnection().getContent();
+        try {
+            String s = content.getClass().toString();
+            if (s.startsWith("class org.jboss.vfs.VirtualFile")) { // JBoss 7 and probably 6
+                File physicalFile = readJBossPhysicalFile(content);
+                return physicalFile.toURI().toURL();
+            } else if (s.startsWith("class org.jboss.virtual.VirtualFile")) { // JBoss 5
+                String fileName = url.toExternalForm();
+                return new URL("file", null, fileName.substring(fileName.indexOf(":") + 1));
+            }
+        } catch (Exception e) {
+            LOG.warn("Error calling getPhysicalFile() on JBoss VirtualFile.", e);
+        }
+        return url;
+    }
+
+    public boolean support() {
+        return false; // allow other implementation to be used first
+    }
+
+    public Collection<? extends URL> getAllPhysicalUrls(URL url) throws IOException {
+        if (isJBossUrl(url)) {
+            return getAllJBossPhysicalUrls(url);
+        }
+        return Arrays.asList(url);
+    }
+
+    private List<URL> getAllJBossPhysicalUrls(URL url) throws IOException {
+        List<URL> urls = new ArrayList<URL>();
+        Object content = url.openConnection().getContent();
+        try {
+            if (content.getClass().toString().startsWith("class org.jboss.vfs.VirtualFile")) {
+                File physicalFile = readJBossPhysicalFile(content);
+                readFile(urls, physicalFile);
+                readFile(urls, physicalFile.getParentFile());
+            } else {
+                urls.add(url);
+            }
+        } catch (Exception e) {
+            LOG.warn("Error calling getPhysicalFile() on JBoss VirtualFile.", e);
+        }
+        return urls;
+    }
+
+    private File readJBossPhysicalFile(Object content) throws Exception {
+        Method method = content.getClass().getDeclaredMethod("getPhysicalFile");
+        return (File) method.invoke(content);
+    }
+
+    private void readFile(List<URL> urls, File physicalFile) throws MalformedURLException {
+        if (physicalFile.isDirectory()) {
+            for (File file : physicalFile.listFiles()) {
+                if (file.isFile()) {
+                    addIfAbsent(urls, file.toURI().toURL());
+                } else if (file.isDirectory()) {
+                    readFile(urls, file);
+                }
+            }
+        }
+    }
+
+    private void addIfAbsent(List<URL> urls, URL fileUrl) {
+        if (!urls.contains(fileUrl)) {
+            urls.add(fileUrl);
+        }
+    }
 }

Added: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/DefaultFileManagerFactory.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/DefaultFileManagerFactory.java?rev=1338643&view=auto
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/DefaultFileManagerFactory.java (added)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/DefaultFileManagerFactory.java Tue May 15 11:05:50 2012
@@ -0,0 +1,48 @@
+package com.opensymphony.xwork2.util.fs;
+
+import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
+import com.opensymphony.xwork2.inject.Container;
+import com.opensymphony.xwork2.inject.Inject;
+import com.opensymphony.xwork2.util.logging.Logger;
+import com.opensymphony.xwork2.util.logging.LoggerFactory;
+
+import java.util.Set;
+
+/**
+ * Default implementation
+ */
+public class DefaultFileManagerFactory implements FileManagerFactory {
+
+    private static final Logger LOG = LoggerFactory.getLogger(DefaultFileManagerFactory.class);
+
+    private FileManager fileManager;
+
+    @Inject
+    public DefaultFileManagerFactory(Container container) {
+        Set<String> names = container.getInstanceNames(FileManager.class);
+        if (names != null) {
+            for (String fmName : names) {
+                FileManager fm = container.getInstance(FileManager.class, fmName);
+                if (fm.support()) {
+                    if (fileManager != null) {
+                        LOG.error("More than one FileManager supports current file system, [#0] and [#1]! "
+                                + "Remove one of them from the config! Using implementation [#2]",
+                                fm.toString(), fileManager.toString(), fm.toString());
+                    }
+                    fileManager = fm;
+                }
+            }
+        }
+        if (fileManager == null) {
+            LOG.debug("Using default implementation as a FileManager.");
+            fileManager = new DefaultFileManager();
+            container.inject(fileManager);
+        }
+    }
+
+    public FileManager getFileManager() {
+        return fileManager;
+    }
+
+}

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/JBossFileRevision.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/JBossFileRevision.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/JBossFileRevision.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/JBossFileRevision.java Tue May 15 11:05:50 2012
@@ -1,6 +1,6 @@
 package com.opensymphony.xwork2.util.fs;
 
-import com.opensymphony.xwork2.util.URLUtil;
+import com.opensymphony.xwork2.FileManager;
 
 import java.io.File;
 import java.net.URISyntaxException;
@@ -15,9 +15,9 @@ class JBossFileRevision extends FileRevi
         super(file, lastUpdated);
     }
 
-    public static Revision build(URL fileUrl) {
+    public static Revision build(URL fileUrl, FileManager fileManager) {
         File file;
-        URL url = URLUtil.normalizeToFileProtocol(fileUrl);
+        URL url = fileManager.normalizeToFileProtocol(fileUrl);
         try {
             if (url != null) {
                 file = new File(url.toURI());

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/JarEntryRevision.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/JarEntryRevision.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/JarEntryRevision.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/fs/JarEntryRevision.java Tue May 15 11:05:50 2012
@@ -1,6 +1,6 @@
 package com.opensymphony.xwork2.util.fs;
 
-import com.opensymphony.xwork2.util.URLUtil;
+import com.opensymphony.xwork2.FileManager;
 import com.opensymphony.xwork2.util.logging.Logger;
 import com.opensymphony.xwork2.util.logging.LoggerFactory;
 import org.apache.commons.io.FileUtils;
@@ -43,7 +43,7 @@ class JarEntryRevision extends Revision 
         return entry != null && (lastModified < entry.getTime());
     }
 
-    public static Revision build(URL fileUrl) {
+    public static Revision build(URL fileUrl, FileManager fileManager) {
         // File within a Jar
         // Find separator index of jar filename and filename within jar
         String jarFileName = "";
@@ -64,7 +64,7 @@ class JarEntryRevision extends Revision 
             int index = separatorIndex + DefaultFileManager.JAR_FILE_NAME_SEPARATOR.length();
             String fileNameInJar = fileName.substring(index).replaceAll("%20", " ");
 
-            URL url = URLUtil.normalizeToFileProtocol(fileUrl);
+            URL url = fileManager.normalizeToFileProtocol(fileUrl);
             if (url != null) {
                 JarFile jarFile = new JarFile(FileUtils.toFile(url));
                 ZipEntry entry = jarFile.getEntry(fileNameInJar);

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/AnnotationActionValidatorManager.java Tue May 15 11:05:50 2012
@@ -20,6 +20,7 @@ import com.opensymphony.xwork2.ActionCon
 import com.opensymphony.xwork2.ActionInvocation;
 import com.opensymphony.xwork2.ActionProxy;
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
@@ -74,8 +75,8 @@ public class AnnotationActionValidatorMa
     }
 
     @Inject
-    public void setFileManager(FileManager fileManager) {
-        this.fileManager = fileManager;
+    public void setFileManagerFactory(FileManagerFactory fileManagerFactory) {
+        this.fileManager = fileManagerFactory.getFileManager();
     }
 
     public List<Validator> getValidators(Class clazz, String context) {

Modified: struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManager.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManager.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManager.java (original)
+++ struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/validator/DefaultActionValidatorManager.java Tue May 15 11:05:50 2012
@@ -17,6 +17,7 @@ package com.opensymphony.xwork2.validato
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.inject.Inject;
 import com.opensymphony.xwork2.util.ClassLoaderUtil;
 import com.opensymphony.xwork2.util.ValueStack;
@@ -66,8 +67,8 @@ public class DefaultActionValidatorManag
     }
 
     @Inject
-    public void setFileManager(FileManager fileManager) {
-        this.fileManager = fileManager;
+    public void setFileManagerFactory(FileManagerFactory fileManagerFactory) {
+        this.fileManager = fileManagerFactory.getFileManager();
     }
 
     public synchronized List<Validator> getValidators(Class clazz, String context) {

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java (original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/ConfigurationManagerTest.java Tue May 15 11:05:50 2012
@@ -20,6 +20,7 @@ package com.opensymphony.xwork2.config;
 import com.mockobjects.dynamic.C;
 import com.mockobjects.dynamic.Mock;
 import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.XWorkTestCase;
 import com.opensymphony.xwork2.config.providers.XWorkConfigurationProvider;
 import com.opensymphony.xwork2.inject.ContainerBuilder;
@@ -48,7 +49,7 @@ public class ConfigurationManagerTest ex
         configProviderMock.expect("loadPackages", C.ANY_ARGS);
         configProviderMock.expect("destroy", C.ANY_ARGS);
         configProviderMock.matchAndReturn("toString", "mock");
-        configuration.getContainer().getInstance(FileManager.class).setReloadingConfigs(true);
+        configuration.getContainer().getInstance(FileManagerFactory.class).getFileManager().setReloadingConfigs(true);
         configuration = configurationManager.getConfiguration();
         configProviderMock.verify();
 
@@ -58,7 +59,7 @@ public class ConfigurationManagerTest ex
 
     public void testNoConfigurationReload() {
         // now check that it doesn't try to reload
-        configuration.getContainer().getInstance(FileManager.class).setReloadingConfigs(false);
+        configuration.getContainer().getInstance(FileManagerFactory.class).getFileManager().setReloadingConfigs(false);
         configuration = configurationManager.getConfiguration();
 
         configProviderMock.verify();

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java (original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/ConfigurationTestBase.java Tue May 15 11:05:50 2012
@@ -15,7 +15,7 @@
  */
 package com.opensymphony.xwork2.config.providers;
 
-import com.opensymphony.xwork2.FileManager;
+import com.opensymphony.xwork2.FileManagerFactory;
 import com.opensymphony.xwork2.ObjectFactory;
 import com.opensymphony.xwork2.XWorkTestCase;
 import com.opensymphony.xwork2.config.ConfigurationProvider;
@@ -37,7 +37,7 @@ public abstract class ConfigurationTestB
 
         XmlConfigurationProvider prov = new XmlConfigurationProvider(filename, true);
         prov.setObjectFactory(container.getInstance(ObjectFactory.class));
-        prov.setFileManager(container.getInstance(FileManager.class));
+        prov.setFileManagerFactory(container.getInstance(FileManagerFactory.class));
         prov.init(configuration);
         prov.loadPackages();
         return prov;

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java (original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorParamOverridingTest.java Tue May 15 11:05:50 2012
@@ -21,7 +21,7 @@ import com.opensymphony.xwork2.config.Ru
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.config.entities.InterceptorMapping;
 import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
-import com.opensymphony.xwork2.util.fs.DefaultFileManager;
+import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -35,7 +35,7 @@ public class XmlConfigurationProviderInt
     public void testInterceptorParamOveriding() throws Exception {
         DefaultConfiguration conf = new DefaultConfiguration();
         final XmlConfigurationProvider p = new XmlConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-interceptor-param-overriding.xml");
-        p.setFileManager(new DefaultFileManager());
+        p.setFileManagerFactory(new DefaultFileManagerFactory(container));
         conf.reload(new ArrayList<ConfigurationProvider>() {
             {
                 add(new XWorkConfigurationProvider());

Modified: struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java?rev=1338643&r1=1338642&r2=1338643&view=diff
==============================================================================
--- struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java (original)
+++ struts/struts2/trunk/xwork-core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderInterceptorStackParamOverridingTest.java Tue May 15 11:05:50 2012
@@ -6,7 +6,7 @@ import com.opensymphony.xwork2.config.Ru
 import com.opensymphony.xwork2.config.entities.ActionConfig;
 import com.opensymphony.xwork2.config.entities.InterceptorMapping;
 import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
-import com.opensymphony.xwork2.util.fs.DefaultFileManager;
+import com.opensymphony.xwork2.util.fs.DefaultFileManagerFactory;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -22,7 +22,7 @@ public class XmlConfigurationProviderInt
     public void testInterceptorStackParamOveriding() throws Exception {
     	DefaultConfiguration conf = new DefaultConfiguration();
     	final XmlConfigurationProvider p = new XmlConfigurationProvider("com/opensymphony/xwork2/config/providers/xwork-test-interceptor-stack-param-overriding.xml");
-        p.setFileManager(new DefaultFileManager());
+        p.setFileManagerFactory(new DefaultFileManagerFactory(container));
     	configurationManager.addContainerProvider(p);
         conf.reload(new ArrayList<ConfigurationProvider>(){
             {



Mime
View raw message