openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1151773 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/ webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/ webbeans-impl/src/main/j...
Date Thu, 28 Jul 2011 09:32:37 GMT
Author: struberg
Date: Thu Jul 28 09:32:34 2011
New Revision: 1151773

URL: http://svn.apache.org/viewvc?rev=1151773&view=rev
Log:
OWB-599 move ScannerService#getBeansXml() back to Set<URL>

this was needed since a few containers could not open the 
URL.toExternalForm they created themselfs...

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/BeansXmlAnnotationDB.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/test/OpenWebBeansTestMetaDataDiscoveryService.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/Alternative4Test.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/Alternative5Test.java
    openwebbeans/trunk/webbeans-osgi/src/main/java/org/apache/webbeans/osgi/scanner/OsgiMetaDataScannerService.java
    openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
    openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java
    openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java
    openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/scanner/WebScannerService.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1151773&r1=1151772&r2=1151773&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
Thu Jul 28 09:32:34 2011
@@ -560,28 +560,28 @@ public class BeansDeployer
     {
         logger.debug("Deploying configurations from XML files has started.");
 
-        Set<String> xmlLocations = scanner.getBeanXmls();
-        Iterator<String> it = xmlLocations.iterator();
+        Set<URL> xmlLocations = scanner.getBeanXmls();
+        Iterator<URL> it = xmlLocations.iterator();
 
         while (it.hasNext())
         {
-            String fileName = it.next();
+            URL url = it.next();
 
             if (logger.wblWillLogDebug())
             {
-                logger.debug("OpenWebBeans BeansDeployer configuring filename: " + fileName);
+                logger.debug("OpenWebBeans BeansDeployer configuring: " + url.toExternalForm());
             }
 
             InputStream fis = null;
             try
             {
-                fis = new URL(fileName).openStream();
+                fis = url.openStream();
 
-                this.xmlConfigurator.configure(fis, fileName, scanner);
+                this.xmlConfigurator.configure(fis, url.toExternalForm(), scanner);
             }
             catch (IOException e)
             {
-                throw new WebBeansDeploymentException("Error configuring: filename: " + fileName
, e);
+                throw new WebBeansDeploymentException("Error configuring: filename: " + url.toExternalForm()
, e);
             }
             finally
             {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java?rev=1151773&r1=1151772&r2=1151773&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/scanner/AbstractMetaDataDiscovery.java
Thu Jul 28 09:32:34 2011
@@ -45,7 +45,7 @@ public abstract class AbstractMetaDataDi
     public static final String META_INF_BEANS_XML = "META-INF/beans.xml";
 
     /** Location of the beans.xml files. */
-    private final Set<String> webBeansXmlLocations = new HashSet<String>();
+    private final Set<URL> webBeansXmlLocations = new HashSet<URL>();
 
     //private Map<String, InputStream> EJB_XML_LOCATIONS = new HashMap<String, InputStream>();
 
@@ -126,10 +126,10 @@ public abstract class AbstractMetaDataDi
             while (urls.hasMoreElements())
             {
                 URL url = urls.nextElement();
-                String urlString = url.toString();
 
-                addWebBeansXmlLocation(urlString);
+                addWebBeansXmlLocation(url);
 
+                String urlString = url.toString();
                 int idx = urlString.lastIndexOf(resourceName);
                 urlString = urlString.substring(0, idx);
 
@@ -180,15 +180,15 @@ public abstract class AbstractMetaDataDi
 
     /**
      * add the given beans.xml path to the locations list 
-     * @param beansXmlLocation location path
+     * @param beansXmlUrl location path
      */
-    protected void addWebBeansXmlLocation(String beansXmlLocation)
+    protected void addWebBeansXmlLocation(URL beansXmlUrl)
     {
         if(this.logger.wblWillLogInfo())
         {
-            this.logger.info("added beans.xml marker: " + beansXmlLocation);
+            this.logger.info("added beans.xml marker: " + beansXmlUrl.toExternalForm());
         }
-        webBeansXmlLocations.add(beansXmlLocation);
+        webBeansXmlLocations.add(beansXmlUrl);
     }
 
     /* (non-Javadoc)
@@ -241,7 +241,7 @@ public abstract class AbstractMetaDataDi
     * @see org.apache.webbeans.corespi.ScannerService#getBeanXmls()
     */
     @Override
-    public Set<String> getBeanXmls()
+    public Set<URL> getBeanXmls()
     {
         return Collections.unmodifiableSet(webBeansXmlLocations);
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/BeansXmlAnnotationDB.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/BeansXmlAnnotationDB.java?rev=1151773&r1=1151772&r2=1151773&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/BeansXmlAnnotationDB.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/corespi/se/BeansXmlAnnotationDB.java
Thu Jul 28 09:32:34 2011
@@ -19,6 +19,7 @@
 package org.apache.webbeans.corespi.se;
 
 import java.io.IOException;
+import java.net.URL;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -121,11 +122,11 @@ public class BeansXmlAnnotationDB extend
     {
         String beanXmlUrl;
         boolean isMatchFound;
-        Iterator<String> it = scannerService.getBeanXmls().iterator();
+        Iterator<URL> it = scannerService.getBeanXmls().iterator();
         while (it.hasNext())
         {
             isMatchFound = false;
-            beanXmlUrl = it.next();
+            beanXmlUrl = it.next().toExternalForm();
             
             //See if mapping was already assigned for this beans.xml
             if(beansXmlResources.containsValue(beanXmlUrl))

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/test/OpenWebBeansTestMetaDataDiscoveryService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/test/OpenWebBeansTestMetaDataDiscoveryService.java?rev=1151773&r1=1151772&r2=1151773&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/test/OpenWebBeansTestMetaDataDiscoveryService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/test/OpenWebBeansTestMetaDataDiscoveryService.java
Thu Jul 28 09:32:34 2011
@@ -19,12 +19,14 @@
 package org.apache.webbeans.lifecycle.test;
 
 import java.io.IOException;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Collection;
 
 import javassist.ClassPool;
 
 import org.apache.webbeans.corespi.scanner.AbstractMetaDataDiscovery;
+import org.apache.webbeans.exception.WebBeansDeploymentException;
 import org.apache.webbeans.util.Asserts;
 
 /**
@@ -68,9 +70,16 @@ public class OpenWebBeansTestMetaDataDis
     {
         if(xmls != null)
         {
-            for(String xml : xmls)
+            for(String url : xmls)
             {
-                addBeanXml(xml);
+                try
+                {
+                    addBeanXml(new URL(url));
+                }
+                catch (MalformedURLException e)
+                {
+                    throw new WebBeansDeploymentException("could not convert to URL: " +
url, e);
+                }
             }
         }
     }
@@ -98,13 +107,13 @@ public class OpenWebBeansTestMetaDataDis
     
     /**
      * Adds new beans.xml url for scanning.
-     * @param beansXmlPath new beans.xml path
+     * @param url new xml url
      */
-    private void addBeanXml(String beansXmlPath)
+    private void addBeanXml(URL url)
     {
-        Asserts.assertNotNull(beansXmlPath);
+        Asserts.assertNotNull(url);
         
-        addWebBeansXmlLocation(beansXmlPath);
+        addWebBeansXmlLocation(url);
     }
     
 

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/Alternative4Test.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/Alternative4Test.java?rev=1151773&r1=1151772&r2=1151773&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/Alternative4Test.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/Alternative4Test.java
Thu Jul 28 09:32:34 2011
@@ -38,7 +38,7 @@ import org.apache.webbeans.newtests.conc
 import org.junit.Test;
 
 public class Alternative4Test  extends AbstractUnitTest {
-	
+
     @Test
     @SuppressWarnings("unchecked")
     public void testDisposerMethodInAlternativeBean()

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/Alternative5Test.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/Alternative5Test.java?rev=1151773&r1=1151772&r2=1151773&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/Alternative5Test.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/concepts/alternatives/tests/Alternative5Test.java
Thu Jul 28 09:32:34 2011
@@ -38,14 +38,13 @@ import org.apache.webbeans.newtests.conc
 import org.junit.Test;
 
 public class Alternative5Test extends AbstractUnitTest  {
-	
+
     private static final String PACKAGE_NAME = Alternative5Test.class.getPackage().getName();
     
     @Test
     @SuppressWarnings("unchecked")
     public void testDisposerMethodInAlternativeBean()
     {
-     	
         Collection<String> beanXmls = new ArrayList<String>();
         beanXmls.add(getXmlPath(PACKAGE_NAME, "AlternativeTest5"));
         

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=1151773&r1=1151772&r2=1151773&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
Thu Jul 28 09:32:34 2011
@@ -65,7 +65,7 @@ public class OsgiMetaDataScannerService 
     private Set<Class<?>> beanClasses = new HashSet<Class<?>>();
 
     /** the paths of all META-INF/beans.xml files */
-    private Set<String> beanXMLs = new HashSet<String>();
+    private Set<URL> beanXMLs = new HashSet<URL>();
 
     /**contains all the JARs we found with valid beans.xml in it */
     private Set<String> beanArchiveJarNames = new HashSet<String>();
@@ -84,7 +84,7 @@ public class OsgiMetaDataScannerService 
     public void release()
     {
         beanClasses = new HashSet<Class<?>>();
-        beanXMLs = new HashSet<String>();
+        beanXMLs = new HashSet<URL>();
         beanArchiveJarNames = new HashSet<String>();
         classAnnotations.clear();
     }
@@ -222,17 +222,16 @@ public class OsgiMetaDataScannerService 
             public void foundInDirectory(Bundle bundle, String basePath, URL url) throws
Exception
             {
                 logger.info("adding the following beans.xml URL: " + url);
-                beanXMLs.add(url.toExternalForm());
+                beanXMLs.add(url);
             }
 
             public void foundInJar(Bundle bundle, String jarName, ZipEntry entry, InputStream
in) throws Exception
             {
                 URL jarURL = bundle.getEntry(jarName);
-                String beansUrlPath = "jar:" + jarURL.toString() + "!/" + entry.getName();
 
-                logger.info("adding the following beans.xml URL: " + beansUrlPath);
+                logger.info("adding the following beans.xml URL: " + jarURL.toExternalForm());
 
-                beanXMLs.add(beansUrlPath);
+                beanXMLs.add(jarURL);
                 beanArchiveJarNames.add(jarName);
             }
 
@@ -257,13 +256,13 @@ public class OsgiMetaDataScannerService 
             }
 
             logger.info("adding the following WEB-INF/beans.xml URL: " + webBeansXml);
-            beanXMLs.add(webBeansXml.toExternalForm());
+            beanXMLs.add(webBeansXml);
             webBeansXmlFound = true;
         }
     }
 
     @Override
-    public Set<String> getBeanXmls()
+    public Set<URL> getBeanXmls()
     {
         return beanXMLs;
     }

Modified: openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java?rev=1151773&r1=1151772&r2=1151773&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
(original)
+++ openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/StandaloneContainersImpl.java
Thu Jul 28 09:32:34 2011
@@ -19,7 +19,6 @@
 package org.apache.webbeans.test.tck;
 
 import java.net.URL;
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Properties;
@@ -97,7 +96,7 @@ public class StandaloneContainersImpl im
 
     }
 
-    public boolean deployInternal(Iterable<Class<?>> classes, Iterable<String>
beansXmls)
+    public boolean deployInternal(Iterable<Class<?>> classes, Iterable<URL>
beansXmls)
     {
         try
         {
@@ -135,7 +134,7 @@ public class StandaloneContainersImpl im
                 discovery.addBeanClass(it.next());
             }
 
-            Iterator<String> itUrl = beansXmls.iterator();
+            Iterator<URL> itUrl = beansXmls.iterator();
             while (itUrl.hasNext())
             {
                 discovery.addBeanXml(itUrl.next());
@@ -212,16 +211,7 @@ public class StandaloneContainersImpl im
             return false;
         }
 
-        Collection<String> xmlPaths = new ArrayList<String>();
-        if (xmls != null)
-        {
-            for(URL url : xmls)
-            {
-                xmlPaths.add(url.toExternalForm());
-            }
-        }
-
-        return deployInternal(classes, xmlPaths);
+        return deployInternal(classes, xmls);
     }
 
     /**

Modified: openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java?rev=1151773&r1=1151772&r2=1151773&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java
(original)
+++ openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/mock/TCKMetaDataDiscoveryImpl.java
Thu Jul 28 09:32:34 2011
@@ -54,7 +54,7 @@ public class TCKMetaDataDiscoveryImpl ex
         }
     }
     
-    public void addBeanXml(String url)
+    public void addBeanXml(URL url)
     {
         Asserts.assertNotNull(url);
         addWebBeansXmlLocation(url);

Modified: openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java?rev=1151773&r1=1151772&r2=1151773&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java
(original)
+++ openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/ScannerService.java
Thu Jul 28 09:32:34 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.webbeans.spi;
 
+import java.net.URL;
 import java.util.Set;
 
 
@@ -59,9 +60,9 @@ public interface ScannerService
     /**
      * Gets xml configuration files that are occured
      * in the deployment archives.
-     * @return the locations of the beans.xml files. 
+     * @return the URL of the beans.xml files.
      */
-    public Set<String> getBeanXmls();
+    public Set<URL> getBeanXmls();
     
     /**
      * Gets beans classes that are found in the

Modified: openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/scanner/WebScannerService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/scanner/WebScannerService.java?rev=1151773&r1=1151772&r2=1151773&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/scanner/WebScannerService.java
(original)
+++ openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/scanner/WebScannerService.java
Thu Jul 28 09:32:34 2011
@@ -172,7 +172,7 @@ public class WebScannerService extends A
 
         if (url != null)
         {
-            addWebBeansXmlLocation(url.toExternalForm());
+            addWebBeansXmlLocation(url);
             URL resourceUrl = WarUrlFinder.findWebInfClassesPath(this.servletContext);
 
             if (resourceUrl == null)



Mime
View raw message