openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r958189 - /openwebbeans/trunk/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java
Date Sat, 26 Jun 2010 06:37:38 GMT
Author: struberg
Date: Sat Jun 26 06:37:38 2010
New Revision: 958189

URL: http://svn.apache.org/viewvc?rev=958189&view=rev
Log:
OWB-400 improve WEB-INF/beans.xml detection

Modified:
    openwebbeans/trunk/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java

Modified: openwebbeans/trunk/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java?rev=958189&r1=958188&r2=958189&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java
(original)
+++ openwebbeans/trunk/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java
Sat Jun 26 06:37:38 2010
@@ -35,6 +35,7 @@ import org.osgi.service.packageadmin.Pac
 import javax.servlet.ServletContext;
 import java.io.InputStream;
 import java.net.URL;
+import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.zip.ZipEntry;
@@ -180,9 +181,28 @@ public class OsgiMetaDataScannerService 
 
         brfXmlJar.find(rfCallback);
 
-        BundleResourceFinder brfXmlWar =  new BundleResourceFinder(packageAdmin, mainBundle,
"", WEB_INF_BEANS_XML);
+        // TODO I found no other way to find WEB-INF/beanx.xml directly
+        Enumeration<URL> urls = mainBundle.findEntries("", "beans.xml", true);
+        boolean webBeansXmlFound = false;
+        while(urls != null && urls.hasMoreElements())
+        {
+            URL webBeansXml = urls.nextElement();
+            if (!webBeansXml.toExternalForm().endsWith("/" + WEB_INF_BEANS_XML))
+            {
+                continue;
+            }
+
+            if (webBeansXmlFound)
+            {
+                throw new WebBeansDeploymentException("found more than WEB-INF/beans.xml
file!" + webBeansXml); 
+            }
+
+            logger.info("adding the following WEB-INF/beans.xml URL: " + webBeansXml);
+            beanXMLs.add(webBeansXml);
+            webBeansXmlFound = true;
+
+        }
 
-        brfXmlWar.find(rfCallback);
     }
 
     @Override



Mime
View raw message