[weld-commits] Weld SVN: r6407 - in core/trunk: impl/src/main/java/org/jboss/weld/manager and 2 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Sat Jun 5 15:11:47 EDT 2010


Author: pete.muir at jboss.org
Date: 2010-06-05 15:11:46 -0400 (Sat, 05 Jun 2010)
New Revision: 6407

Modified:
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
   core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java
   core/trunk/impl/src/main/java/org/jboss/weld/xml/BeansXmlElement.java
   core/trunk/impl/src/main/java/org/jboss/weld/xml/BeansXmlParser.java
   core/trunk/impl/src/main/java/org/jboss/weld/xml/EnabledClasses.java
   core/trunk/impl/src/main/java/org/jboss/weld/xml/MergedElements.java
   core/trunk/impl/src/main/java/org/jboss/weld/xml/WeldXmlException.java
   core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java
Log:
re-architect xml parsing to be a split datastructures from logic

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java	2010-06-05 17:38:24 UTC (rev 6406)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployment.java	2010-06-05 19:11:46 UTC (rev 6407)
@@ -70,7 +70,10 @@
       ServiceRegistry services = new SimpleServiceRegistry();
       services.addAll(deploymentServices.entrySet());
       services.addAll(beanDeploymentArchive.getServices().entrySet());
-      this.beanManager = BeanManagerImpl.newManager(deploymentManager, beanDeploymentArchive.getId(), services);
+      this.beanManager = BeanManagerImpl.newManager(deploymentManager, beanDeploymentArchive.getId(), services, new BeansXmlParser(services.get(ResourceLoader.class), beanDeploymentArchive.getBeansXml()).parse());
+      log.debug(ENABLED_ALTERNATIVES, this.beanManager, beanManager.getEnabledAlternativeClasses(), beanManager.getEnabledAlternativeStereotypes());
+      log.debug(ENABLED_DECORATORS, this.beanManager, beanManager.getEnabledDecoratorClasses());
+      log.debug(ENABLED_INTERCEPTORS, this.beanManager, beanManager.getEnabledInterceptorClasses());
       if (beanManager.getServices().contains(EjbServices.class))
       {
          // Must populate EJB cache first, as we need it to detect whether a
@@ -81,8 +84,6 @@
       
       // Must at the Manager bean straight away, as it can be injected during startup!
       beanManager.addBean(new BeanManagerBean(beanManager));
-      
-      parseBeansXml();
    }
    
    public BeanManagerImpl getBeanManager()
@@ -100,33 +101,6 @@
       return beanDeploymentArchive;
    }
    
-   
-   private void parseBeansXml()
-   {
-      BeansXmlParser parser = new BeansXmlParser(beanManager.getServices().get(ResourceLoader.class), getBeanDeploymentArchive().getBeansXml());
-      parser.parse();
-      
-      if (parser.getEnabledAlternativeClasses() != null)
-      {
-         beanManager.setEnabledAlternativeClasses(parser.getEnabledAlternativeClasses());
-      }
-      if (parser.getEnabledAlternativeStereotypes() != null)
-      {
-         beanManager.setEnabledAlternativeStereotypes(parser.getEnabledAlternativeStereotypes());
-      }
-      if (parser.getEnabledDecoratorClasses() != null)
-      {
-         beanManager.setEnabledDecoratorClasses(parser.getEnabledDecoratorClasses());
-      }
-      if (parser.getEnabledInterceptorClasses() != null)
-      {
-         beanManager.setEnabledInterceptorClasses(parser.getEnabledInterceptorClasses());
-      }
-      log.debug(ENABLED_ALTERNATIVES, this.beanManager, beanManager.getEnabledAlternativeClasses(), beanManager.getEnabledAlternativeStereotypes());
-      log.debug(ENABLED_DECORATORS, this.beanManager, beanManager.getEnabledDecoratorClasses());
-      log.debug(ENABLED_INTERCEPTORS, this.beanManager, beanManager.getEnabledInterceptorClasses());
-   }
-   
    // TODO Move class stuff into startContainer phase
    // TODO read EJB descriptors after reading classes
    public void deployBeans(Environment environment)

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java	2010-06-05 17:38:24 UTC (rev 6406)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/WeldBootstrap.java	2010-06-05 19:11:46 UTC (rev 6407)
@@ -98,6 +98,7 @@
 import org.jboss.weld.util.serviceProvider.DefaultServiceLoaderFactory;
 import org.jboss.weld.util.serviceProvider.ServiceLoaderFactory;
 import org.jboss.weld.ws.WSApiAbstraction;
+import org.jboss.weld.xml.EnabledClasses;
 import org.slf4j.cal10n.LocLogger;
 
 /**
@@ -291,7 +292,7 @@
          deploymentServices.add(TypeStore.class, implementationServices.get(TypeStore.class));
 
          this.environment = environment;
-         this.deploymentManager = BeanManagerImpl.newRootManager("deployment", deploymentServices);
+         this.deploymentManager = BeanManagerImpl.newRootManager("deployment", deploymentServices, new EnabledClasses());
 
          Container.initialize(deploymentManager, ServiceRegistries.unmodifiableServiceRegistry(deployment.getServices()));
          Container.instance().setState(ContainerState.STARTING);

Modified: core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java	2010-06-05 17:38:24 UTC (rev 6406)
+++ core/trunk/impl/src/main/java/org/jboss/weld/manager/BeanManagerImpl.java	2010-06-05 19:11:46 UTC (rev 6407)
@@ -116,6 +116,7 @@
 import org.jboss.weld.util.collections.IterableToIteratorFunction;
 import org.jboss.weld.util.reflection.HierarchyDiscovery;
 import org.jboss.weld.util.reflection.Reflections;
+import org.jboss.weld.xml.EnabledClasses;
 
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Iterators;
@@ -168,10 +169,7 @@
     * archive accessibility, and the configuration for this bean deployment
     * archive
     */
-   private transient Collection<Class<?>> enabledAlternativeClasses;
-   private transient Collection<Class<? extends Annotation>> enabledAlternativeStereotypes;
-   private transient List<Class<?>> enabledDecoratorClasses;
-   private transient List<Class<?>> enabledInterceptorClasses;
+   private transient final EnabledClasses enabledClasses;
    private transient final Set<CurrentActivity> currentActivities;   
 
    /*
@@ -234,7 +232,7 @@
     * @param serviceRegistry
     * @return
     */
-   public static BeanManagerImpl newRootManager(String id, ServiceRegistry serviceRegistry)
+   public static BeanManagerImpl newRootManager(String id, ServiceRegistry serviceRegistry, EnabledClasses enabledClasses)
    {  
       ListMultimap<Class<? extends Annotation>, Context> contexts = Multimaps.newListMultimap(new ConcurrentHashMap<Class<? extends Annotation>, Collection<Context>>(), CopyOnWriteArrayListSupplier.<Context>instance());
 
@@ -251,10 +249,7 @@
             contexts, 
             new CopyOnWriteArraySet<CurrentActivity>(), 
             new HashMap<Contextual<?>, Contextual<?>>(), 
-            new ArrayList<Class<?>>(),
-            new ArrayList<Class<? extends Annotation>>(),
-            new ArrayList<Class<?>>(),
-            new ArrayList<Class<?>>(), 
+            enabledClasses,
             id,
             new AtomicInteger());
    }
@@ -265,7 +260,7 @@
     * @param serviceRegistry
     * @return
     */
-   public static BeanManagerImpl newManager(BeanManagerImpl rootManager, String id, ServiceRegistry services)
+   public static BeanManagerImpl newManager(BeanManagerImpl rootManager, String id, ServiceRegistry services, EnabledClasses enabledClasses)
    {  
       return new BeanManagerImpl(
             services, 
@@ -280,10 +275,7 @@
             rootManager.getContexts(), 
             new CopyOnWriteArraySet<CurrentActivity>(), 
             new HashMap<Contextual<?>, Contextual<?>>(), 
-            new ArrayList<Class<?>>(),
-            new ArrayList<Class<? extends Annotation>>(),
-            new ArrayList<Class<?>>(),
-            new ArrayList<Class<?>>(),
+            enabledClasses,
             id,
             new AtomicInteger());
    }
@@ -319,10 +311,7 @@
             parentManager.getContexts(), 
             parentManager.getCurrentActivities(), 
             parentManager.getSpecializedBeans(),
-            parentManager.getEnabledAlternativeClasses(),
-            parentManager.getEnabledAlternativeStereotypes(),
-            parentManager.getEnabledDecoratorClasses(),
-            parentManager.getEnabledInterceptorClasses(),
+            parentManager.getEnabledClasses(),
             new StringBuilder().append(parentManager.getChildIds().incrementAndGet()).toString(),
             parentManager.getChildIds());
    }
@@ -346,10 +335,7 @@
          ListMultimap<Class<? extends Annotation>, Context> contexts, 
          Set<CurrentActivity> currentActivities, 
          Map<Contextual<?>, Contextual<?>> specializedBeans, 
-         Collection<Class<?>> enabledAlternativeClasses,
-         Collection<Class<? extends Annotation>> enabledAlternativeStereotypes,
-         List<Class<?>> enabledDecoratorClasses,
-         List<Class<?>> enabledInterceptorClasses,
+         EnabledClasses enabledClasses,
          String id,
          AtomicInteger childIds)
    {
@@ -364,10 +350,7 @@
       this.currentActivities = currentActivities;
       this.specializedBeans = specializedBeans;
       this.observers = observers;
-      this.enabledAlternativeClasses = enabledAlternativeClasses;
-      this.enabledAlternativeStereotypes = enabledAlternativeStereotypes;
-      setEnabledDecoratorClasses(enabledDecoratorClasses);
-      setEnabledInterceptorClasses(enabledInterceptorClasses);
+      this.enabledClasses = enabledClasses;
       this.namespaces = namespaces;
       this.id = id;
       this.childIds = new AtomicInteger();
@@ -483,7 +466,7 @@
     */
    public Collection<Class<?>> getEnabledAlternativeClasses()
    {
-      return Collections.unmodifiableCollection(enabledAlternativeClasses);
+      return getEnabledClasses().getEnabledAlternativeClasses();
    }
    
    /**
@@ -491,9 +474,14 @@
     */
    public Collection<Class<? extends Annotation>> getEnabledAlternativeStereotypes()
    {
-      return Collections.unmodifiableCollection(enabledAlternativeStereotypes);
+      return getEnabledClasses().getEnabledAlternativeStereotypes();
    }
    
+   private EnabledClasses getEnabledClasses()
+   {
+      return enabledClasses;
+   }
+   
    public boolean isBeanEnabled(Bean<?> bean)
    {
       return Beans.isBeanEnabled(bean, getEnabledAlternativeClasses(), getEnabledAlternativeStereotypes());   
@@ -504,7 +492,7 @@
     */
    public List<Class<?>> getEnabledDecoratorClasses()
    {
-      return Collections.unmodifiableList(enabledDecoratorClasses);
+      return getEnabledClasses().getEnabledDecoratorClasses();
    }
    
    /**
@@ -512,29 +500,9 @@
     */
    public List<Class<?>> getEnabledInterceptorClasses()
    {
-      return Collections.unmodifiableList(enabledInterceptorClasses);
+      return getEnabledClasses().getEnabledInterceptorClasses();
    }
-
-   public void setEnabledAlternativeClasses(Collection<Class<?>> enabledAlternativeClasses)
-   {
-      this.enabledAlternativeClasses = enabledAlternativeClasses;
-   }
    
-   public void setEnabledAlternativeStereotypes(Collection<Class<? extends Annotation>> enabledAlternativeSterotypes)
-   {
-      this.enabledAlternativeStereotypes = enabledAlternativeSterotypes;
-   }
-   
-   public void setEnabledDecoratorClasses(List<Class<?>> enabledDecoratorClasses)
-   {
-      this.enabledDecoratorClasses = enabledDecoratorClasses;
-   }
-   
-   public void setEnabledInterceptorClasses(List<Class<?>> enabledInterceptorClasses)
-   {
-      this.enabledInterceptorClasses = enabledInterceptorClasses;
-   }
-   
    public Set<Bean<?>> getBeans(Type beanType, Annotation... qualifiers)
    {
       return beanResolver.resolve(new ResolvableBuilder(beanType).addQualifiers(qualifiers).create());
@@ -1202,10 +1170,6 @@
       this.currentActivities.clear();
       this.decoratorResolver.clear();
       this.decorators.clear();
-      this.enabledDecoratorClasses.clear();
-      this.enabledInterceptorClasses.clear();
-      this.enabledAlternativeClasses.clear();
-      this.enabledAlternativeStereotypes.clear();
       this.enterpriseBeans.clear();
       this.interceptorResolver.clear();
       this.interceptors.clear();

Modified: core/trunk/impl/src/main/java/org/jboss/weld/xml/BeansXmlElement.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/xml/BeansXmlElement.java	2010-06-05 17:38:24 UTC (rev 6406)
+++ core/trunk/impl/src/main/java/org/jboss/weld/xml/BeansXmlElement.java	2010-06-05 19:11:46 UTC (rev 6407)
@@ -34,10 +34,10 @@
  * @author Nicklas Karlsson
  * 
  */
-public class BeansXmlElement
+class BeansXmlElement
 {
-   private URL file;
-   private Element element;
+   private final URL file;
+   private final Element element;
 
    BeansXmlElement(URL file, Element element)
    {

Modified: core/trunk/impl/src/main/java/org/jboss/weld/xml/BeansXmlParser.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/xml/BeansXmlParser.java	2010-06-05 17:38:24 UTC (rev 6406)
+++ core/trunk/impl/src/main/java/org/jboss/weld/xml/BeansXmlParser.java	2010-06-05 19:11:46 UTC (rev 6407)
@@ -22,9 +22,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.lang.annotation.Annotation;
 import java.net.URL;
-import java.util.List;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -47,35 +45,14 @@
    
    private final Iterable<URL> beansXmls;
    private final ResourceLoader resourceLoader;
-   private EnabledClasses enabledClasses = null;
 
-   public List<Class<?>> getEnabledAlternativeClasses()
+   public BeansXmlParser(ResourceLoader resourceLoader, Iterable<URL> beansXmls)
    {
-      return enabledClasses.getEnabledAlternativeClasses();
-   }
-
-   public List<Class<? extends Annotation>> getEnabledAlternativeStereotypes()
-   {
-      return enabledClasses.getEnabledAlternativeStereotypes();
-   }
-
-   public List<Class<?>> getEnabledDecoratorClasses()
-   {
-      return enabledClasses.getEnabledDecoratorClasses();
-   }
-
-   public List<Class<?>> getEnabledInterceptorClasses()
-   {
-      return enabledClasses.getEnabledInterceptorClasses();
-   }
-
-   public BeansXmlParser(ResourceLoader resourceLoader, Iterable<URL> beansXml)
-   {
-      this.beansXmls = beansXml;
+      this.beansXmls = beansXmls;
       this.resourceLoader = resourceLoader;
    }
 
-   public void parse()
+   public EnabledClasses parse()
    {
       DocumentBuilder documentBuilder = createDocumentBuilder();
       MergedElements mergedElements = new MergedElements();
@@ -96,7 +73,7 @@
          }
          
       }
-      enabledClasses = EnabledClasses.of(mergedElements, resourceLoader);
+      return new EnabledClasses(resourceLoader, mergedElements);
    }
 
    private Document loadDocument(DocumentBuilder documentBuilder, URL beansXml)

Modified: core/trunk/impl/src/main/java/org/jboss/weld/xml/EnabledClasses.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/xml/EnabledClasses.java	2010-06-05 17:38:24 UTC (rev 6406)
+++ core/trunk/impl/src/main/java/org/jboss/weld/xml/EnabledClasses.java	2010-06-05 19:11:46 UTC (rev 6407)
@@ -18,7 +18,7 @@
 
 import java.lang.annotation.Annotation;
 import java.util.ArrayList;
-import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
 import org.jboss.weld.resources.spi.ResourceLoader;
@@ -30,77 +30,64 @@
  */
 public class EnabledClasses
 {
-   private List<Class<? extends Annotation>> enabledAlternativeStereotypes;
-   private List<Class<?>> enabledAlternativeClasses;
-   private List<Class<?>> enabledDecoratorClasses;
-   private List<Class<?>> enabledInterceptorClasses;
-   private ResourceLoader resourceLoader;
+   
+   private final List<Class<? extends Annotation>> enabledAlternativeStereotypes;
+   private final List<Class<?>> enabledAlternativeClasses;
+   private final List<Class<?>> enabledDecoratorClasses;
+   private final List<Class<?>> enabledInterceptorClasses;
 
-   private EnabledClasses(MergedElements beanXmlElements, ResourceLoader resourceLoader)
+   public EnabledClasses()
    {
-      enabledAlternativeStereotypes = new ArrayList<Class<? extends Annotation>>();
-      enabledAlternativeClasses = new ArrayList<Class<?>>();
-      enabledDecoratorClasses = new ArrayList<Class<?>>();
-      enabledInterceptorClasses = new ArrayList<Class<?>>();
-      this.resourceLoader = resourceLoader;
-      process(beanXmlElements);
+      this.enabledAlternativeClasses = new ArrayList<Class<?>>();
+      this.enabledAlternativeStereotypes = new ArrayList<Class<? extends Annotation>>();
+      this.enabledDecoratorClasses = new ArrayList<Class<?>>();
+      this.enabledInterceptorClasses = new ArrayList<Class<?>>();
    }
-
-   public static EnabledClasses of(MergedElements beanXmlElements, ResourceLoader resourceLoader)
+   
+   EnabledClasses(ResourceLoader resourceLoader, MergedElements beanXmlElements)
    {
-      return new EnabledClasses(beanXmlElements, resourceLoader);
-   }
-
-   private void process(MergedElements beanXmlElements)
-   {
-      processAlternatives(beanXmlElements.getAlternativesElements());
-      enabledDecoratorClasses.addAll(getClassesInElements(beanXmlElements.getDecoratorsElements()));
-      enabledInterceptorClasses.addAll(getClassesInElements(beanXmlElements.getInterceptorsElements()));
-   }
-
-   private void processAlternatives(List<BeansXmlElement> alternativesElements)
-   {
-      Collection<Class<?>> classes = getClassesInElements(alternativesElements);
-      for (Class<?> clazz : classes)
+      this();
+      for (BeansXmlElement element : beanXmlElements.getAlternativesElements())
       {
-         if (clazz.isAnnotation())
+         for (Class<?> clazz : element.getClasses(resourceLoader))
          {
-            enabledAlternativeStereotypes.add(clazz.asSubclass(Annotation.class));
+            if (clazz.isAnnotation())
+            {
+               this.enabledAlternativeStereotypes.add(clazz.asSubclass(Annotation.class));
+            }
+            else
+            {
+               this.enabledAlternativeClasses.add(clazz);
+            }
          }
-         else
-         {
-            enabledAlternativeClasses.add(clazz);
-         }
       }
-   }
-
-   private Collection<Class<?>> getClassesInElements(List<BeansXmlElement> elements)
-   {
-      List<Class<?>> classes = new ArrayList<Class<?>>();
-      for (BeansXmlElement element : elements)
+      for (BeansXmlElement element : beanXmlElements.getDecoratorsElements())
       {
-         classes.addAll(element.getClasses(resourceLoader));
+         this.enabledDecoratorClasses.addAll(element.getClasses(resourceLoader));
       }
-      return classes;
+      for (BeansXmlElement element : beanXmlElements.getInterceptorsElements())
+      {
+         this.enabledInterceptorClasses.addAll(element.getClasses(resourceLoader));
+      }
    }
 
    public List<Class<? extends Annotation>> getEnabledAlternativeStereotypes()
    {
-      return enabledAlternativeStereotypes;
+      return Collections.unmodifiableList(enabledAlternativeStereotypes);
    }
 
    public List<Class<?>> getEnabledAlternativeClasses()
    {
-      return enabledAlternativeClasses;
+      return Collections.unmodifiableList(enabledAlternativeClasses);
    }
 
    public List<Class<?>> getEnabledDecoratorClasses()
    {
-      return enabledDecoratorClasses;
+      return Collections.unmodifiableList(enabledDecoratorClasses);
    }
 
    public List<Class<?>> getEnabledInterceptorClasses()
    {
-      return enabledInterceptorClasses;
+      return Collections.unmodifiableList(enabledInterceptorClasses);
    }
 }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/xml/MergedElements.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/xml/MergedElements.java	2010-06-05 17:38:24 UTC (rev 6406)
+++ core/trunk/impl/src/main/java/org/jboss/weld/xml/MergedElements.java	2010-06-05 19:11:46 UTC (rev 6407)
@@ -22,6 +22,7 @@
 
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.jboss.weld.logging.messages.XmlMessage;
@@ -34,11 +35,18 @@
  * @author Nicklas Karlsson
  * 
  */
-public class MergedElements
+class MergedElements
 {
-   private List<BeansXmlElement> alternativesElements = new ArrayList<BeansXmlElement>();
-   private List<BeansXmlElement> decoratorsElements = new ArrayList<BeansXmlElement>();
-   private List<BeansXmlElement> interceptorsElements = new ArrayList<BeansXmlElement>();
+   private List<BeansXmlElement> alternativesElements;
+   private List<BeansXmlElement> decoratorsElements;
+   private List<BeansXmlElement> interceptorsElements;
+   
+   public MergedElements()
+   {
+      this.alternativesElements = new ArrayList<BeansXmlElement>();
+      this.decoratorsElements = new ArrayList<BeansXmlElement>();
+      this.interceptorsElements = new ArrayList<BeansXmlElement>();
+   }
 
 
    public void merge(URL url, Document beansXmlDocument, String namespace)
@@ -68,17 +76,17 @@
    
    public List<BeansXmlElement> getAlternativesElements()
    {
-      return alternativesElements;
+      return Collections.unmodifiableList(alternativesElements);
    }
 
    public List<BeansXmlElement> getDecoratorsElements()
    {
-      return decoratorsElements;
+      return Collections.unmodifiableList(decoratorsElements);
    }
 
    public List<BeansXmlElement> getInterceptorsElements()
    {
-      return interceptorsElements;
+      return Collections.unmodifiableList(interceptorsElements);
    }
 
 }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/xml/WeldXmlException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/xml/WeldXmlException.java	2010-06-05 17:38:24 UTC (rev 6406)
+++ core/trunk/impl/src/main/java/org/jboss/weld/xml/WeldXmlException.java	2010-06-05 19:11:46 UTC (rev 6407)
@@ -17,45 +17,24 @@
 
 package org.jboss.weld.xml;
 
-import javax.enterprise.inject.InjectionException;
-
-import org.jboss.weld.exceptions.WeldExceptionKeyMessage;
-import org.jboss.weld.exceptions.WeldExceptionMessage;
-import org.jboss.weld.exceptions.WeldExceptionStringMessage;
-
 /**
  * Used for exceptions from the Weld XML parser and provides localization
  * support.
  * 
  * @author David Allen
  */
-public class WeldXmlException extends InjectionException
+public class WeldXmlException extends org.jboss.weld.exceptions.InjectionException
 {
 
-   private static final long    serialVersionUID = 2L;
+   private static final long serialVersionUID = 2L;
 
-   private WeldExceptionMessage message;
-
    public WeldXmlException(Throwable throwable)
    {
       super(throwable);
-      message = new WeldExceptionStringMessage(throwable.getLocalizedMessage());
    }
 
    public <E extends Enum<?>> WeldXmlException(E key, Object... args)
    {
-      message = new WeldExceptionKeyMessage(key, args);
+      super(key, args);
    }
-
-   @Override
-   public String getLocalizedMessage()
-   {
-      return getMessage();
-   }
-
-   @Override
-   public String getMessage()
-   {
-      return message.getAsString();
-   }
 }

Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java	2010-06-05 17:38:24 UTC (rev 6406)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java	2010-06-05 19:11:46 UTC (rev 6407)
@@ -36,6 +36,7 @@
 import org.jboss.weld.resources.ClassTransformer;
 import org.jboss.weld.serialization.ContextualStoreImpl;
 import org.jboss.weld.serialization.spi.ContextualStore;
+import org.jboss.weld.xml.EnabledClasses;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -68,9 +69,9 @@
    @Test
    public void testAccessibleDynamicallySingleLevel()
    {
-      BeanManagerImpl root = BeanManagerImpl.newRootManager("root", services);
+      BeanManagerImpl root = BeanManagerImpl.newRootManager("root", services, new EnabledClasses());
       Container.initialize(root, services);
-      BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services);
+      BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services, new EnabledClasses());
       addBean(root, Cow.class);
       assert root.getBeans(Cow.class).size() == 1;
       assert child.getBeans(Cow.class).size() == 0;
@@ -85,12 +86,12 @@
    @Test
    public void testAccessibleThreeLevelsWithMultiple()
    {
-      BeanManagerImpl root = BeanManagerImpl.newRootManager("root", services);
+      BeanManagerImpl root = BeanManagerImpl.newRootManager("root", services, new EnabledClasses());
       Container.initialize(root, services);
-      BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services);
-      BeanManagerImpl child1 = BeanManagerImpl.newRootManager("child1", services);
-      BeanManagerImpl grandchild = BeanManagerImpl.newRootManager("grandchild", services);
-      BeanManagerImpl greatGrandchild = BeanManagerImpl.newRootManager("greatGrandchild", services);
+      BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services, new EnabledClasses());
+      BeanManagerImpl child1 = BeanManagerImpl.newRootManager("child1", services, new EnabledClasses());
+      BeanManagerImpl grandchild = BeanManagerImpl.newRootManager("grandchild", services, new EnabledClasses());
+      BeanManagerImpl greatGrandchild = BeanManagerImpl.newRootManager("greatGrandchild", services, new EnabledClasses());
       child.addAccessibleBeanManager(root);
       grandchild.addAccessibleBeanManager(child1);
       grandchild.addAccessibleBeanManager(child);
@@ -127,10 +128,10 @@
    @Test
    public void testSameManagerAddedTwice()
    {
-      BeanManagerImpl root = BeanManagerImpl.newRootManager("root", services);
+      BeanManagerImpl root = BeanManagerImpl.newRootManager("root", services, new EnabledClasses());
       Container.initialize(root, services);
-      BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services);
-      BeanManagerImpl grandchild = BeanManagerImpl.newRootManager("grandchild", services);
+      BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services, new EnabledClasses());
+      BeanManagerImpl grandchild = BeanManagerImpl.newRootManager("grandchild", services, new EnabledClasses());
       grandchild.addAccessibleBeanManager(child);
       child.addAccessibleBeanManager(root);
       grandchild.addAccessibleBeanManager(root);
@@ -151,10 +152,10 @@
    @Test
    public void testCircular()
    {
-      BeanManagerImpl root = BeanManagerImpl.newRootManager("root", services);
+      BeanManagerImpl root = BeanManagerImpl.newRootManager("root", services, new EnabledClasses());
       Container.initialize(root, services);
-      BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services);
-      BeanManagerImpl grandchild = BeanManagerImpl.newRootManager("grandchild", services);
+      BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services, new EnabledClasses());
+      BeanManagerImpl grandchild = BeanManagerImpl.newRootManager("grandchild", services, new EnabledClasses());
       grandchild.addAccessibleBeanManager(child);
       child.addAccessibleBeanManager(root);
       grandchild.addAccessibleBeanManager(root);



More information about the weld-commits mailing list