openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1563738 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/util/ webbeans-impl/src/main/java/org/apache/webbeans/xml/ webbeans-impl/src/test/java/org/apache/webbeans/test/xml/ webbeans-impl/src/test/resources/org/apa...
Date Sun, 02 Feb 2014 22:34:11 GMT
Author: struberg
Date: Sun Feb  2 22:34:10 2014
New Revision: 1563738

URL: http://svn.apache.org/r1563738
Log:
OWB-928 add simple exclude rule scanning & execution

Added:
    openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_exclude.xml
      - copied, changed from r1563533, openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_discovery_none.xml
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansConstants.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/DefaultBeanArchiveInformation.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/DefaultBeanArchiveService.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/BeanArchiveServiceTest.java
    openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_discovery_none.xml
    openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_failed.xml
    openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/BeanArchiveService.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansConstants.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansConstants.java?rev=1563738&r1=1563737&r2=1563738&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansConstants.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansConstants.java
Sun Feb  2 22:34:10 2014
@@ -38,16 +38,15 @@ public final class WebBeansConstants
                                                                          "javax.persistence.PersistenceUnit",
                                                                          "javax.persistence.PersistenceContext"};
     
-    public static final String WEB_BEANS_XML_SPEC_SPECIFIC_INTERCEPTORS_ELEMENT = "interceptors";
-    
-    public static final String WEB_BEANS_XML_SPEC_SPECIFIC_DECORATORS_ELEMENT = "decorators";
-    
+    public static final String WEB_BEANS_XML_INTERCEPTORS_ELEMENT = "interceptors";
+    public static final String WEB_BEANS_XML_DECORATORS_ELEMENT = "decorators";
+    public static final String WEB_BEANS_XML_ALTERNATIVES_ELEMENT = "alternatives";
+    public static final String WEB_BEANS_XML_SCAN_ELEMENT = "scan";
+
+    public static final String WEB_BEANS_XML_CLASS = "class";
+    public static final String WEB_BEANS_XML_STEREOTYPE = "stereotype";
+    public static final String WEB_BEANS_XML_EXCLUDE = "exclude";
 
-    public static final String WEB_BEANS_XML_SPEC_SPECIFIC_BEAN_DISCOVERY_MODE_ELEMENT =
"bean-discovery-mode";
-    public static final String WEB_BEANS_XML_SPEC_SPECIFIC_ALTERNATIVES_ELEMENT = "alternatives";
-    public static final String WEB_BEANS_XML_SPEC_SPECIFIC_CLASS = "class";
-    public static final String WEB_BEANS_XML_SPEC_SPECIFIC_STEREOTYPE = "stereotype";
-    
     /**JNDI name of the {@link javax.enterprise.inject.spi.BeanManager} instance*/
     public static final String WEB_BEANS_MANAGER_JNDI_NAME = "java:comp/BeanManager";
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/DefaultBeanArchiveInformation.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/DefaultBeanArchiveInformation.java?rev=1563738&r1=1563737&r2=1563738&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/DefaultBeanArchiveInformation.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/DefaultBeanArchiveInformation.java
Sun Feb  2 22:34:10 2014
@@ -33,6 +33,13 @@ public class DefaultBeanArchiveInformati
     private List<String> alternativeClasses = new ArrayList<String>();
     private List<String> alternativeStereotypes = new ArrayList<String>();
 
+    /** Either an excluded class or an excluded .* path */
+    private List<String> excludedClasses = null;
+
+    /** Exclude all subpackages (exclude= .**) */
+    private List<String> excludedPackages = null;
+
+
 
     @Override
     public BeanDiscoveryMode getBeanDiscoveryMode()
@@ -41,9 +48,54 @@ public class DefaultBeanArchiveInformati
     }
 
     @Override
-    public boolean isExcluded(String classOrPath)
+    public boolean isClassExcluded(String clazz)
     {
-        return false; //X TODO
+        boolean isExcluded = isPackageExcluded(clazz);
+
+        if  (!isExcluded && excludedClasses != null)
+        {
+            for (String excludedClass : excludedClasses)
+            {
+                if (clazz.startsWith(excludedClass))
+                {
+                    if (clazz.length() > excludedClass.length())
+                    {
+                        int lastDotPosition = clazz.lastIndexOf('.');
+                        if (lastDotPosition > excludedClass.length())
+                        {
+                            continue;
+                        }
+                    }
+                    isExcluded = true;
+                    break;
+                }
+            }
+        }
+
+        return isExcluded;
+    }
+
+    @Override
+    public boolean isPackageExcluded(String packageName)
+    {
+        if (excludedPackages != null)
+        {
+            for (String excludedPackage : excludedPackages)
+            {
+                /*X TODO
+                 * For 'org.apache.foo.**'
+                 * the spec currently also excludes the package
+                 * 'org.apache.foobar'
+                 * Currently trying to clarify this.
+                 */
+                if (packageName.startsWith(excludedPackage))
+                {
+                    return true;
+                }
+            }
+        }
+
+        return false;
     }
 
     @Override
@@ -97,13 +149,23 @@ public class DefaultBeanArchiveInformati
         this.decorators = decorators;
     }
 
-    public void setAlternativeClasses(List<String> alternativeClasses)
+    public void addClassExclude(String classOrPath)
     {
-        this.alternativeClasses = alternativeClasses;
+        if (excludedClasses == null)
+        {
+            excludedClasses = new ArrayList<String>();
+        }
+
+        excludedClasses.add(classOrPath);
     }
 
-    public void setAlternativeStereotypes(List<String> alternativeStereotypes)
+    public void addPackageExclude(String packageName)
     {
-        this.alternativeStereotypes = alternativeStereotypes;
+        if (excludedPackages == null)
+        {
+            excludedPackages = new ArrayList<String>();
+        }
+
+        excludedPackages.add(packageName);
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/DefaultBeanArchiveService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/DefaultBeanArchiveService.java?rev=1563738&r1=1563737&r2=1563738&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/DefaultBeanArchiveService.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/DefaultBeanArchiveService.java
Sun Feb  2 22:34:10 2014
@@ -27,6 +27,7 @@ import java.io.InputStream;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -35,6 +36,7 @@ import org.apache.webbeans.exception.Web
 import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.logger.WebBeansLoggerFacade;
 import org.apache.webbeans.spi.BeanArchiveService;
+import org.apache.webbeans.util.UrlSet;
 import org.apache.webbeans.util.WebBeansConstants;
 import org.w3c.dom.Element;
 
@@ -50,6 +52,8 @@ public class DefaultBeanArchiveService i
      */
     private Map<String, BeanArchiveInformation> beanArchiveInformations = new HashMap<String,
BeanArchiveInformation>();
 
+    private UrlSet registeredBeanArchives = new UrlSet();
+
 
     @Override
     public BeanArchiveInformation getBeanArchiveInformation(URL beansXmlUrl)
@@ -61,11 +65,18 @@ public class DefaultBeanArchiveService i
         {
             bdaInfo = readBeansXml(beansXmlUrl, beansXmlLocation);
             beanArchiveInformations.put(beansXmlLocation, bdaInfo);
+            registeredBeanArchives.add(beansXmlUrl);
         }
 
         return bdaInfo;
     }
 
+    @Override
+    public Set<URL> getRegisteredBeanArchives()
+    {
+        return registeredBeanArchives;
+    }
+
     /**
      * This method exists for extensibility reasons.
      */
@@ -135,8 +146,10 @@ public class DefaultBeanArchiveService i
                     throw new WebBeansConfigurationException("beans.xml must have a <beans>
root element, but has: " + webBeansRoot.getLocalName());
                 }
 
-                String version = webBeansRoot.getAttribute("version");
-                bdaInfo.setVersion((version != null && version.length() > 0) ?
version : null);
+                bdaInfo.setVersion(getTrimmedAttribute(webBeansRoot, "version"));
+
+                String beanDiscoveryMode = getTrimmedAttribute(webBeansRoot, "bean-discovery-mode");
+                bdaInfo.setBeanDiscoveryMode(beanDiscoveryMode != null ? BeanDiscoveryMode.valueOf(beanDiscoveryMode.toUpperCase())
: null);
 
                 readBeanChildren(bdaInfo, webBeansRoot);
             }
@@ -171,38 +184,32 @@ public class DefaultBeanArchiveService i
         {
             Element child = elit.next();
 
-            if (WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_BEAN_DISCOVERY_MODE_ELEMENT.equalsIgnoreCase(child.getLocalName()))
-            {
-                fillScanMode(bdaInfo, child);
-            }
-            else if (WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_DECORATORS_ELEMENT.equalsIgnoreCase(child.getLocalName()))
+            if (WebBeansConstants.WEB_BEANS_XML_DECORATORS_ELEMENT.equalsIgnoreCase(child.getLocalName()))
             {
                 fillDecorators(bdaInfo, child);
             }
-            else if (WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_INTERCEPTORS_ELEMENT.equalsIgnoreCase(child.getLocalName()))
+            else if (WebBeansConstants.WEB_BEANS_XML_INTERCEPTORS_ELEMENT.equalsIgnoreCase(child.getLocalName()))
             {
                 fillInterceptors(bdaInfo, child);
             }
-            else if (WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_ALTERNATIVES_ELEMENT.equalsIgnoreCase(child.getLocalName()))
+            else if (WebBeansConstants.WEB_BEANS_XML_ALTERNATIVES_ELEMENT.equalsIgnoreCase(child.getLocalName()))
             {
                 fillAlternatives(bdaInfo, child);
             }
+            else if (WebBeansConstants.WEB_BEANS_XML_SCAN_ELEMENT.equalsIgnoreCase(child.getLocalName()))
+            {
+                fillExcludes(bdaInfo, child);
+            }
         }
     }
 
-    protected void fillScanMode(DefaultBeanArchiveInformation bdaInfo, Element beanDiscoveryModeElement)
-    {
-        String scanMode = beanDiscoveryModeElement.getTextContent().trim();
-        bdaInfo.setBeanDiscoveryMode(BeanDiscoveryMode.valueOf(scanMode.toUpperCase()));
-    }
-
     private void fillDecorators(DefaultBeanArchiveInformation bdaInfo, Element decoratorsElement)
     {
         ElementIterator elit = new ElementIterator(decoratorsElement);
         while (elit.hasNext())
         {
             Element child = elit.next();
-            if (WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_CLASS.equalsIgnoreCase(child.getLocalName()))
+            if (WebBeansConstants.WEB_BEANS_XML_CLASS.equalsIgnoreCase(child.getLocalName()))
             {
                 String clazz = child.getTextContent().trim();
                 if (clazz.isEmpty())
@@ -220,7 +227,7 @@ public class DefaultBeanArchiveService i
         while (elit.hasNext())
         {
             Element child = elit.next();
-            if (WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_CLASS.equalsIgnoreCase(child.getLocalName()))
+            if (WebBeansConstants.WEB_BEANS_XML_CLASS.equalsIgnoreCase(child.getLocalName()))
             {
                 String clazz = child.getTextContent().trim();
                 if (clazz.isEmpty())
@@ -238,7 +245,7 @@ public class DefaultBeanArchiveService i
         while (elit.hasNext())
         {
             Element child = elit.next();
-            if (WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_CLASS.equalsIgnoreCase(child.getLocalName()))
+            if (WebBeansConstants.WEB_BEANS_XML_CLASS.equalsIgnoreCase(child.getLocalName()))
             {
                 String clazz = child.getTextContent().trim();
                 if (clazz.isEmpty())
@@ -247,7 +254,7 @@ public class DefaultBeanArchiveService i
                 }
                 bdaInfo.getAlternativeClasses().add(clazz);
             }
-            if (WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_STEREOTYPE.equalsIgnoreCase(child.getLocalName()))
+            if (WebBeansConstants.WEB_BEANS_XML_STEREOTYPE.equalsIgnoreCase(child.getLocalName()))
             {
                 String stereotype = child.getTextContent().trim();
                 if (stereotype.isEmpty())
@@ -260,6 +267,37 @@ public class DefaultBeanArchiveService i
     }
 
 
+    private void fillExcludes(DefaultBeanArchiveInformation bdaInfo, Element scanElement)
+    {
+        ElementIterator elit = new ElementIterator(scanElement);
+        while (elit.hasNext())
+        {
+            Element child = elit.next();
+            if (WebBeansConstants.WEB_BEANS_XML_EXCLUDE.equalsIgnoreCase(child.getLocalName()))
+            {
+                String name = getTrimmedAttribute(child, "name");
+                if (name != null)
+                {
+                    if (name.endsWith(".*"))
+                    {
+                        // package exclude without sub-packages
+                        bdaInfo.addClassExclude(name.substring(0, name.length() - 2));
+                    }
+                    else if (name.endsWith(".**"))
+                    {
+                        // package exclude WITH sub-packages
+                        bdaInfo.addPackageExclude(name.substring(0, name.length() - 3));
+                    }
+                    else
+                    {
+                        // a simple Class
+                        bdaInfo.addClassExclude(name);
+                    }
+                }
+            }
+        }
+    }
+
     @Override
     public void release()
     {
@@ -274,7 +312,7 @@ public class DefaultBeanArchiveService i
      * @return root element of the document
      * @throws org.apache.webbeans.exception.WebBeansException if any runtime exception occurs
      */
-    private Element getBeansRootElement(InputStream xmlStream) throws WebBeansException
+    protected Element getBeansRootElement(InputStream xmlStream) throws WebBeansException
     {
         try
         {
@@ -299,4 +337,22 @@ public class DefaultBeanArchiveService i
         }
     }
 
+    /**
+     * @return the trimmed attribute value, or <code>null</code> if the attribute
does not exist or the attribute is empty
+     */
+    protected String getTrimmedAttribute(Element element, String attributeName)
+    {
+        String val = element.getAttribute(attributeName);
+        if (val != null)
+        {
+            val = val.trim();
+            if (!val.isEmpty())
+            {
+                return val;
+            }
+        }
+        return null;
+    }
+
+
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java?rev=1563738&r1=1563737&r2=1563738&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/WebBeansXMLConfigurator.java
Sun Feb  2 22:34:10 2014
@@ -213,16 +213,16 @@ public final class WebBeansXMLConfigurat
             child = (Element) node;
 
             /* <Interceptors> element decleration */
-            if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_INTERCEPTORS_ELEMENT))
+            if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_INTERCEPTORS_ELEMENT))
             {
                 configureInterceptorsElement(child,fileName,scanner);
             }
             /* <Decorators> element decleration */
-            else if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_DECORATORS_ELEMENT))
+            else if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_DECORATORS_ELEMENT))
             {
                 configureDecoratorsElement(child,fileName,scanner);
             }
-            else if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_ALTERNATIVES_ELEMENT))
+            else if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_ALTERNATIVES_ELEMENT))
             {
                 configureAlternativesElement(child,fileName,scanner);
             }
@@ -408,11 +408,11 @@ public final class WebBeansXMLConfigurat
             }
             alternativesInFile.add(alternativeName);
 
-            if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_STEREOTYPE))
+            if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_STEREOTYPE))
             {
                 addAlternative(child, true,fileName,scanner);
             }
-            else if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_SPEC_SPECIFIC_CLASS))
+            else if (getName(child).equals(WebBeansConstants.WEB_BEANS_XML_CLASS))
             {
                 addAlternative(child, false,fileName,scanner);
             }

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/BeanArchiveServiceTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/BeanArchiveServiceTest.java?rev=1563738&r1=1563737&r2=1563738&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/BeanArchiveServiceTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/xml/BeanArchiveServiceTest.java
Sun Feb  2 22:34:10 2014
@@ -113,6 +113,38 @@ public class BeanArchiveServiceTest
         Assert.assertTrue(bai.getInterceptors().isEmpty());
     }
 
+    @Test
+    public void testExclude() throws Exception
+    {
+        BeanArchiveInformation bai = scanBeansXml("cdi11_exclude.xml");
+        Assert.assertEquals(BeanDiscoveryMode.ALL, bai.getBeanDiscoveryMode());
+        Assert.assertTrue(bai.getAlternativeClasses().isEmpty());
+        Assert.assertTrue(bai.getAlternativeStereotypes().isEmpty());
+        Assert.assertTrue(bai.getDecorators().isEmpty());
+        Assert.assertTrue(bai.getInterceptors().isEmpty());
+
+        Assert.assertFalse(bai.isClassExcluded("some.other.package"));
+        Assert.assertFalse(bai.isClassExcluded("some.other.Class"));
+
+        Assert.assertFalse(bai.isPackageExcluded("org.apache.webbeans"));
+        Assert.assertFalse(bai.isPackageExcluded("org.apache.webbeans.test"));
+        Assert.assertFalse(bai.isPackageExcluded("org.apache.webbeans.test.singlepackage"));
+        Assert.assertFalse(bai.isPackageExcluded("org.apache.webbeans.test.singlepackage.otherpackage"));
+
+        Assert.assertTrue(bai.isPackageExcluded("org.apache.webbeans.test.subpackage"));
+        Assert.assertTrue(bai.isPackageExcluded("org.apache.webbeans.test.subpackage.other"));
+
+        Assert.assertFalse(bai.isClassExcluded("org.apache.webbeans.test.SomeClass"));
+        Assert.assertFalse(bai.isClassExcluded("org.apache.webbeans.test.otherpackage.OtherClass"));
+
+        Assert.assertTrue(bai.isClassExcluded("org.apache.webbeans.test.singlepackage.SomeClass"));
+        Assert.assertTrue(bai.isClassExcluded("org.apache.webbeans.test.singlepackage.OtherClass"));
+        Assert.assertFalse(bai.isClassExcluded("org.apache.webbeans.test.singlepackage.otherpackage.OtherClass"));
+
+        Assert.assertTrue(bai.isClassExcluded("org.apache.webbeans.test.subpackage.SomeClass"));
+        Assert.assertTrue(bai.isClassExcluded("org.apache.webbeans.test.subpackage.OtherClass"));
+        Assert.assertTrue(bai.isClassExcluded("org.apache.webbeans.test.subpackage.otherpackage.OtherClass"));
+    }
 
 
 

Modified: openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_discovery_none.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_discovery_none.xml?rev=1563738&r1=1563737&r2=1563738&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_discovery_none.xml
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_discovery_none.xml
Sun Feb  2 22:34:10 2014
@@ -17,7 +17,5 @@ KIND, either express or implied.  See th
 specific language governing permissions and limitations
 under the License.
 -->
-<beans version="1.1">
-    <!-- this file has no bean-discovery-mode, thus we need to fail with version=1.1 -->
-    <bean-discovery-mode>none</bean-discovery-mode>
+<beans version="1.1" bean-discovery-mode="none">
 </beans>

Copied: openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_exclude.xml
(from r1563533, openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_discovery_none.xml)
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_exclude.xml?p2=openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_exclude.xml&p1=openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_discovery_none.xml&r1=1563533&r2=1563738&rev=1563738&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_discovery_none.xml
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_exclude.xml
Sun Feb  2 22:34:10 2014
@@ -17,7 +17,15 @@ KIND, either express or implied.  See th
 specific language governing permissions and limitations
 under the License.
 -->
-<beans version="1.1">
-    <!-- this file has no bean-discovery-mode, thus we need to fail with version=1.1 -->
-    <bean-discovery-mode>none</bean-discovery-mode>
+<beans>
+    <scan>
+        <!-- a single class exclude-->
+        <exclude name="org.apache.webbeans.test.ExcludedClass"/>
+
+        <!-- exclude all classes of a single package, without excluding subpackages -->
+        <exclude name="org.apache.webbeans.test.singlepackage.*"/>
+
+        <!-- exclude all classes of a single package, and also exclude all subpackages
-->
+        <exclude name="org.apache.webbeans.test.subpackage.**"/>
+    </scan>
 </beans>

Modified: openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_failed.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_failed.xml?rev=1563738&r1=1563737&r2=1563738&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_failed.xml
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/resources/org/apache/webbeans/test/xml/strict/cdi11_failed.xml
Sun Feb  2 22:34:10 2014
@@ -17,6 +17,5 @@ KIND, either express or implied.  See th
 specific language governing permissions and limitations
 under the License.
 -->
-<beans version="1.1">
-    <!-- this file has no bean-discovery-mode, thus we need to fail with version=1.1 -->
+<beans version="1.1"> <!-- this file has no bean-discovery-mode, thus we need to
fail with version=1.1 -->
 </beans>

Modified: openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/BeanArchiveService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/BeanArchiveService.java?rev=1563738&r1=1563737&r2=1563738&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/BeanArchiveService.java
(original)
+++ openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/BeanArchiveService.java
Sun Feb  2 22:34:10 2014
@@ -20,6 +20,7 @@ package org.apache.webbeans.spi;
 
 import java.net.URL;
 import java.util.List;
+import java.util.Set;
 
 /**
  * This Service returns information about scanned beans.xml files.
@@ -76,12 +77,14 @@ public interface BeanArchiveService
         BeanDiscoveryMode getBeanDiscoveryMode();
 
         /**
-         * If a package is excluded, then you do not need to recurse into it.
-         *
-         * @param classOrPath either a class name or a package name.
-         * @return whether the given path is excluded or not
+         * @return whether the given class is excluded from scanning or not
          */
-        boolean isExcluded(String classOrPath);
+        boolean isClassExcluded(String clazz);
+
+        /**
+         * @return whether the given package is excluded from scanning or not
+         */
+        boolean isPackageExcluded(String packageName);
 
         /**
          * @return the class name of the Interceptors defined in the beans.xml
@@ -121,6 +124,15 @@ public interface BeanArchiveService
 
 
     /**
+     * This method is useful to later on know which JARs and ClassPath entries
+     * did get scanned.
+     * Please note that we use a special UrlSet internally which only holds
+     * the externalForm as key and thus does no DNS resolving via the URL.
+     * @return a Set of all registered Bean Archives.
+     */
+    Set<URL> getRegisteredBeanArchives();
+
+    /**
      * Release the gathered information to free up memory.
      * This should get called at the end of the deployment phase.
      */



Mime
View raw message