Author: rmannibucau
Date: Tue Mar 12 06:22:47 2013
New Revision: 1455416

URL: http://svn.apache.org/r1455416
Log:
TOMEE-790 trying web-inf/classes/meta-inf/resources.xml too

Modified:
    
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java

Modified: 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
URL: 
http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java?rev=1455416&r1=1455415&r2=1455416&view=diff
==============================================================================
--- 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
 (original)
+++ 
tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/config/DeploymentLoader.java
 Tue Mar 12 06:22:47 2013
@@ -96,10 +96,13 @@ public class DeploymentLoader implements
     public static final String OPENEJB_ALTDD_PREFIX = "openejb.altdd.prefix";
 
     private static final String ddDir = "META-INF/";
+
     public static final String EAR_WEBAPP_PERSISTENCE_XML_JARS = 
"ear-webapp-persistence-xml-jars";
     public static final String EAR_SCOPED_CDI_BEANS = "ear-scoped-cdi-beans_";
     public static final String RAR_URLS_KEY = "rar-urls";
     public static final String URLS_KEY = "urls";
+
+    private static final String RESOURCES_XML = "resources.xml";
     private boolean scanManagedBeans = true;
     private static final Collection<String> KNOWN_DESCRIPTORS = 
Arrays.asList("app-ctx.xml", "module.properties", "application.properties", 
"web.xml", "ejb-jar.xml", "openejb-jar.xml", "env-entries.properties", 
"beans.xml", "ra.xml", "application.xml", "application-client.xml", 
"persistence-fragment.xml", "persistence.xml", "validation.xml", 
NewLoaderLogic.EXCLUSION_FILE);
     private static String ALTDD = 
SystemInstance.get().getOptions().get(OPENEJB_ALTDD_PREFIX, (String) null);
@@ -134,7 +137,7 @@ public class DeploymentLoader implements
             if (ResourcesModule.class.equals(moduleClass)) {
                 final AppModule appModule = new AppModule(null, jarPath);
                 final ResourcesModule module = new ResourcesModule();
-                module.getAltDDs().put("resources.xml", baseUrl);
+                module.getAltDDs().put(RESOURCES_XML, baseUrl);
                 ReadDescriptors.readResourcesXml(module);
                 module.initAppModule(appModule);
                 // here module is no more useful since everything is in the 
appmodule
@@ -1481,6 +1484,24 @@ public class DeploymentLoader implements
                     }
                 }
             }
+
+            // handle some few file(s) which can be in META-INF too
+            final File webAppDdDir = new File(webInfDir, "classes/" + ddDir);
+            if (webAppDdDir.isDirectory()) {
+                final File[] files = webInfDir.listFiles();
+                if (files != null) {
+                    for (final File file : files) {
+                        final String name = file.getName();
+                        if (RESOURCES_XML.equals(name)) {
+                            if (!descriptors.containsKey(name)) {
+                                descriptors.put(name, file.toURI().toURL());
+                            } else {
+                                logger.warning("Can't have a " + name + " in 
WEB-INF and WEB-INF/classes/META-INF, second will be ignored");
+                            }
+                        }
+                    }
+                }
+            }
         }
 
         return descriptors;


Reply via email to