[jboss-cvs] JBossAS SVN: r97793 - in projects/kernel/trunk/kernel/src: main/java/org/jboss/kernel/plugins/annotations and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Dec 14 12:14:45 EST 2009


Author: kabir.khan at jboss.com
Date: 2009-12-14 12:14:43 -0500 (Mon, 14 Dec 2009)
New Revision: 97793

Added:
   projects/kernel/trunk/kernel/src/main/java/org/jboss/beans/metadata/plugins/ContextualInjectionDependencyItem.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/MetaAnnotationPlugin.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/SuppliedQualifierAnnotationPlugin.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedBeanA.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedBeanB.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedBeanC.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedIgnoreTargetAllBean.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedTargetAllBean.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/Qualifier1.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/Qualifier2.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/Qualifier3.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/test/QualifiersAnnotatedTestCase.java
   projects/kernel/trunk/kernel/src/test/resources/org/jboss/test/kernel/qualifiers/test/QualifiersAnnotatedTestCase#testXmlInjectAnnotationBeanQualifierAnnotationss.xml
Removed:
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/QualifiedClassDependencyItem.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/QualifiersMdrUtil.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchClassContextDependencyItem.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchQualifiedClassDependencyItem.java
Modified:
   projects/kernel/trunk/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectQualifierMetaData.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractBeanAnnotationAdapter.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractParameterAnnotationPlugin.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BaseMetaDataAnnotationPlugin.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/InjectAnnotationPlugin.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/InjectFieldAnnotationPlugin.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/InjectableMemberAnnotationPlugin.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassAndQualifierKey.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/InstantiateAction.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/KernelScopeInfo.java
   projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/PreInstallAction.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/MockInjectPlugin.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/SimpleBeanMetaDataAnnotationAdapter.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/deployment/support/container/EJBAnnotationPlugin.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/test/BeanQualifiersTestCase.java
   projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/test/QualifiersTestSuite.java
Log:
[JBKERNEL-63] Support qualifiers coming from annotations

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectQualifierMetaData.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectQualifierMetaData.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectQualifierMetaData.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -21,6 +21,8 @@
 */ 
 package org.jboss.beans.metadata.plugins;
 
+import java.util.Set;
+
 import javax.xml.bind.annotation.XmlType;
 
 import org.jboss.kernel.plugins.dependency.QualifiersMdrUtil;
@@ -38,6 +40,13 @@
    
    public AbstractInjectQualifierMetaData()
    {
+      this(null);
+   }
+   
+   public AbstractInjectQualifierMetaData(Set<Object> qualifiers)
+   {
       internalSetClassName(QualifiersMdrUtil.REQUIRED_QUALIFIER_KEY);
+      setEnabled(qualifiers);
    }
+
 }

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -21,6 +21,7 @@
 */
 package org.jboss.beans.metadata.plugins;
 
+import java.lang.annotation.Annotation;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -39,17 +40,13 @@
 import org.jboss.beans.metadata.spi.LifecycleMetaData;
 import org.jboss.beans.metadata.spi.MetaDataVisitor;
 import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
-import org.jboss.beans.metadata.spi.ParameterMetaData;
 import org.jboss.beans.metadata.spi.PropertyMetaData;
 import org.jboss.beans.metadata.spi.RelatedClassMetaData;
 import org.jboss.dependency.plugins.AttributeCallbackItem;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.DependencyItem;
 import org.jboss.kernel.plugins.dependency.ClassAndQualifierKey;
 import org.jboss.kernel.plugins.dependency.QualifiersMdrUtil;
-import org.jboss.kernel.plugins.dependency.SearchClassContextDependencyItem;
-import org.jboss.kernel.plugins.dependency.SearchQualifiedClassDependencyItem;
 import org.jboss.reflect.spi.TypeInfo;
 import org.jboss.util.JBossStringBuilder;
 
@@ -69,20 +66,22 @@
 
    protected FromContext fromContext;
    
-   /** Used as the key to get the injected context when qualifiers are present */
-   protected ClassAndQualifierKey classAndQualifierMatcher;
-   
+   ContextualInjectionDependencyItem item = null;
+
    /** If qualifiers are used, true if we should ignore the qualifiers on the bean and only take into account the qualifiers on this injection point*/ 
    protected boolean ignoreBeanQualifiers;
    
    /** Qualifiers specified on the injection point. If not present the context's wanted qualifiers from the MDR metadata is used */
    protected Set<RelatedClassMetaData> qualifiers;
+   
+   /** The parent nodes, with the lowest node first */
+   protected List<MetaDataVisitorNode> parentNodes;
 
    /**
     * Simplyifies things with AutowireType.BY_NAME
     */
    protected AbstractPropertyMetaData propertyMetaData;
-
+   
    /**
     * Create a new injection value
     */
@@ -242,8 +241,10 @@
       // by class type
       if (getUnderlyingValue() == null)
       {
-         Object key = classAndQualifierMatcher == null ? info.getType() : classAndQualifierMatcher;
-         ControllerContext lookup = getControllerContext(key, ControllerState.INSTALLED);
+         ControllerContext lookup = null;
+         if (item != null)
+            lookup = item.getControllerContext(context.getController());
+
          if (lookup == null)
          {
             if (InjectOption.STRICT.equals(injectionOption))
@@ -270,8 +271,7 @@
    {
       if (getUnderlyingValue() == null)
       {
-         Object key = classAndQualifierMatcher == null ? info.getType() : classAndQualifierMatcher;
-         ControllerContext lookup = getControllerContext(key, ControllerState.INSTALLED);
+         ControllerContext lookup = item.getControllerContext(context.getController());
          if (lookup != null)
          {
             ungetTarget(context, lookup);
@@ -380,7 +380,7 @@
                      {
                         whenRequired = visitor.getContextState();
                      }
-                     DependencyItem item = createDependencyItem(visitor, injectionClass, whenRequired);
+                     item = createDependencyItem(visitor, injectionClass, whenRequired);
                      visitor.addDependency(item);
                   }
                   else
@@ -406,69 +406,116 @@
       super.describeVisit(visitor);
    }
 
-   private DependencyItem createDependencyItem(MetaDataVisitor visitor, Class<?> injectionClass, ControllerState whenRequired)
+   private ContextualInjectionDependencyItem createDependencyItem(MetaDataVisitor visitor, Class<?> injectionClass, ControllerState whenRequired) throws Exception
    {
-      boolean hasQualifiers = qualifiers != null && qualifiers.size() > 0;
-      QualifierPoint type = determineInjectionPointType(visitor);
-      if (!hasQualifiers)
+      initializeParents(visitor);
+      QualifierPoint point = determineQualifierPoint();
+      
+      Set<Object> allQualifiers = getAllQualifiers();
+      boolean hasQualifiers = allQualifiers != null && allQualifiers.size() > 0;
+      if (!hasQualifiers && point != null)
       {
-         hasQualifiers = QualifiersMdrUtil.hasWantedQualifiersInParentMdrOrBeanMetaData(context, type);
+         hasQualifiers = QualifiersMdrUtil.hasWantedQualifiersInParentMdrOrBeanMetaData(context, point);
       }
-      
+
       if (!hasQualifiers)
-         return new SearchClassContextDependencyItem(
-               context.getName(),
-               injectionClass,
-               whenRequired,
-               dependentState,
-               search);
+         return new ContextualInjectionDependencyItem(this, context.getName(), injectionClass, whenRequired, dependentState, search);
       else
       {
-         Set<Object> qualifierObjects = null;
-         
-         if (qualifiers != null && qualifiers.size() > 0)
+         ClassAndQualifierKey classAndQualifierMatcher = createClassAndQualifierMatcher(injectionClass, allQualifiers);
+         return new ContextualInjectionDependencyItem(this, context.getName(), classAndQualifierMatcher, whenRequired, dependentState, search);
+      }
+   }
+
+   private Set<Object> getAllQualifiers() throws Exception
+   {
+      Set<Annotation> qualifierAnnotations = null;
+      if (context.getBeanInfo() != null)
+      {
+         qualifierAnnotations = QualifiersMdrUtil.getQualifiersFromAnnotationsForInjectionPointParents(context, parentNodes);
+      }
+      
+      Set<Object> allQualifiers = null;
+      if ((qualifierAnnotations != null && qualifierAnnotations.size() > 0) || (qualifiers != null && qualifiers.size() > 0))
+      {
+         allQualifiers = new HashSet<Object>();
+         if (qualifiers!= null && qualifiers.size() > 0)
          {
-            qualifierObjects = new HashSet<Object>(qualifiers.size());
+            allQualifiers = new HashSet<Object>(qualifiers.size());
             for (RelatedClassMetaData rcmd : qualifiers)
-               qualifierObjects.addAll(rcmd.getEnabled());
+               allQualifiers.addAll(rcmd.getEnabled());
+            
          }
-         
-         classAndQualifierMatcher = new ClassAndQualifierKey(dependentState, context, ignoreBeanQualifiers, type, qualifierObjects, injectionClass);
-         return new SearchQualifiedClassDependencyItem(context.getName(), 
-               classAndQualifierMatcher,
-               whenRequired, 
-               dependentState, 
-               search);
+
+         if (qualifierAnnotations != null && qualifierAnnotations.size() > 0)
+            allQualifiers.addAll(qualifierAnnotations);
       }
+      return allQualifiers;
    }
    
-   private QualifierPoint determineInjectionPointType(MetaDataVisitor visitor)
+   private void initializeParents(MetaDataVisitor visitor)
    {
-      List<MetaDataVisitorNode> popped = new ArrayList<MetaDataVisitorNode>();
+      parentNodes = new ArrayList<MetaDataVisitorNode>();
       try
       {
-         MetaDataVisitorNode node = visitor.visitorNodeStack().peek();
+         MetaDataVisitorNode node = visitor.visitorNodeStack().pop();
+         parentNodes.add(node);
          while (node != null && visitor.visitorNodeStack().size() > 0)
          {
-            if (visitor.visitorNodeStack().peek() instanceof ConstructorMetaData)
-               return QualifierPoint.CONSTRUCTOR;
-            else if (visitor.visitorNodeStack().peek() instanceof LifecycleMetaData)
-               return QualifierPoint.METHOD;
-            else if (visitor.visitorNodeStack().peek() instanceof PropertyMetaData)
-               return QualifierPoint.PROPERTY;
-               
-            node = visitor.visitorNodeStack().pop();
-            popped.add(node);
+            parentNodes.add(visitor.visitorNodeStack().pop());
          }
       }
       finally
       {
-         for (int i = popped.size() - 1 ; i >= 0 ; i--)
-            visitor.visitorNodeStack().push(popped.get(i));
+         for (int i = parentNodes.size() - 1 ; i >= 0 ; i--)
+            visitor.visitorNodeStack().push(parentNodes.get(i));
       }
-      throw new IllegalStateException("Unable to determine type of " + visitor.visitorNodeStack().peek() + " for " + context);
    }
    
+   /** 
+    * Get the parent nodes, with the lowest node first 
+    *
+    * @return the parent nodes 
+    */
+   List<MetaDataVisitorNode> getParents()
+   {
+      return parentNodes;
+   }
+   
+   /**
+    * Create a class and qualifier key for qualified contextual injection
+    * 
+    * @param injectionClass the class
+    * @return the created key
+    */
+   ClassAndQualifierKey createClassAndQualifierMatcher(Class<?> injectionClass, Set<Object> allQualifiers) throws Exception 
+   {
+      QualifierPoint point = determineQualifierPoint();
+      if (point == null)
+         throw new IllegalArgumentException("Null qualifier point for " + context + ". Parents: " + parentNodes);
+
+      return new ClassAndQualifierKey(dependentState, context, ignoreBeanQualifiers, point, parentNodes, allQualifiers, injectionClass);
+   }
+   
+   /**
+    * Determine the qualifier point type from the list of parents
+    * 
+    * @return the qualifer point type
+    */
+   QualifierPoint determineQualifierPoint()
+   {
+      for (MetaDataVisitorNode node : parentNodes)
+      {
+         if (node instanceof ConstructorMetaData)
+            return QualifierPoint.CONSTRUCTOR;
+         else if (node instanceof LifecycleMetaData)
+            return QualifierPoint.METHOD;
+         else if (node instanceof PropertyMetaData)
+            return QualifierPoint.PROPERTY;
+      }
+      return null;
+   }
+   
    public void toString(JBossStringBuilder buffer)
    {
       super.toString(buffer);

Added: projects/kernel/trunk/kernel/src/main/java/org/jboss/beans/metadata/plugins/ContextualInjectionDependencyItem.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/beans/metadata/plugins/ContextualInjectionDependencyItem.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/beans/metadata/plugins/ContextualInjectionDependencyItem.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,115 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.beans.metadata.plugins;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
+import org.jboss.dependency.plugins.AbstractDependencyItem;
+import org.jboss.dependency.spi.Controller;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.dependency.spi.graph.LookupStrategy;
+import org.jboss.dependency.spi.graph.SearchInfo;
+import org.jboss.kernel.plugins.dependency.ClassAndQualifierKey;
+
+/**
+ * A dependency item for looking up by class, or by class and qualifiers
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class ContextualInjectionDependencyItem extends AbstractDependencyItem
+{
+   private LookupType type;
+   
+   private final SearchInfo search;
+   
+   private final AbstractInjectionValueMetaData injectionValueMetaData;
+
+   public ContextualInjectionDependencyItem(AbstractInjectionValueMetaData injectionValueMetaData, Object name, Class<?> demandClass, ControllerState whenRequired, ControllerState dependentState, SearchInfo search)
+   {
+      super(name, demandClass, whenRequired, dependentState);
+      this.type = LookupType.CLASS;
+      this.search = search;
+      this.injectionValueMetaData = injectionValueMetaData;
+   }
+
+   public ContextualInjectionDependencyItem(AbstractInjectionValueMetaData injectionValueMetaData, Object name, ClassAndQualifierKey key, ControllerState whenRequired, ControllerState dependentState, SearchInfo search)
+   {
+      super(name, key, whenRequired, dependentState);
+      this.type = LookupType.KEY;
+      this.search = search;
+      this.injectionValueMetaData = injectionValueMetaData;
+   }
+
+   public void addQualifierAnnotations(Set<Annotation> qualifiers) throws Exception
+   {
+      if (type == LookupType.CLASS)
+      {
+         super.setIDependOn(injectionValueMetaData.createClassAndQualifierMatcher((Class<?>)getIDependOn(), null));
+      }
+      ((ClassAndQualifierKey)getIDependOn()).addQualifiersFromAnnotations(qualifiers);
+   }
+   
+   /**
+    * Get controller context.
+    *
+    * @param controller the controller
+    * @return controller context
+    */
+   protected ControllerContext getControllerContext(Controller controller)
+   {
+      LookupStrategy strategy = search.getStrategy();
+      return strategy.getContext(controller, getIDependOn(), ControllerState.INSTALLED);
+   }
+
+   public List<MetaDataVisitorNode> getParents()
+   {
+      return injectionValueMetaData.getParents();
+   }
+   
+   /**
+    * Get the injectionValueMetaData
+    * @return the injectionValueMetaData
+    */
+   public AbstractInjectionValueMetaData getInjectionValueMetaData()
+   {
+      return injectionValueMetaData;
+   }
+
+   /**
+    * Get the search
+    * @return the search
+    */
+   public SearchInfo getSearch()
+   {
+      return search;
+   }
+   
+   private enum LookupType
+   {
+      CLASS, KEY
+   }
+}
\ No newline at end of file

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractBeanAnnotationAdapter.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractBeanAnnotationAdapter.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractBeanAnnotationAdapter.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -65,7 +65,7 @@
       KernelMetaDataRepository repository = kernel.getMetaDataRepository();
       MetaData retrieval = repository.getMetaData(context);
       BeanInfo info = context.getBeanInfo();
-
+      
       handleAnnotations(info, retrieval, visitor, isApplyPhase);
    }
 

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractParameterAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractParameterAnnotationPlugin.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/AbstractParameterAnnotationPlugin.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -144,7 +144,7 @@
          return handleParameterlessInfo(info, annotation, beanMetaData);
       }
 
-      TypeInfo[] typeInfos = new TypeInfo[parameters.length];
+       TypeInfo[] typeInfos = new TypeInfo[parameters.length];
       for(int i=0; i < parameters.length; i++)
          typeInfos[i] = parameters[i].getParameterType();
 

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BaseMetaDataAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BaseMetaDataAnnotationPlugin.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BaseMetaDataAnnotationPlugin.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -196,6 +196,15 @@
    {
       return annotation;
    }
+   
+   protected void addTypes(ElementType...elementTypes)
+   {
+      if (types == null)
+         types = new HashSet<ElementType>();
+      
+      for (ElementType type : elementTypes)
+         types.add(type);
+   }
 
    protected void toString(JBossStringBuilder buffer)
    {

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/BasicBeanAnnotationAdapter.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -94,6 +94,8 @@
       addAnnotationPlugin(InstallFieldCallbackAnnotationPlugin.INSTANCE);
       addAnnotationPlugin(UninstallFieldCallbackAnnotationPlugin.INSTANCE);
       
+      //Qualifiers
+      addMetaAnnotationPlugin(SuppliedQualifierAnnotationPlugin.INSTANCE);
    }
 
    @SuppressWarnings("unchecked")

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/CommonAnnotationAdapter.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -34,6 +34,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.Map.Entry;
 
 import org.jboss.beans.info.spi.BeanInfo;
 import org.jboss.beans.info.spi.PropertyInfo;
@@ -65,7 +66,6 @@
    protected Logger log = Logger.getLogger(getClass());
 
    /** The annotation plugins */
-   //private final Map<ElementType, Set<T>> pluginsMap = new HashMap<ElementType, Set<T>>();
    private final Map<ElementType, Map<Class<? extends Annotation>, Set<T>>> pluginsMap = new HashMap<ElementType, Map<Class<? extends Annotation>, Set<T>>>();
    
 
@@ -75,6 +75,9 @@
    /** The method annotation plugin filter */
    private static final AnnotationPluginFilter METHOD_FILTER = new MethodAnnotationPluginFilter();
    
+   /** The meta annotations plugins that pick out things like qualifiers */
+   private final Map<ElementType, Map<Class<? extends Annotation>, Set<T>>> metaAnnotationsPluginsMap = new HashMap<ElementType, Map<Class<? extends Annotation>, Set<T>>>();
+   
    /**
     * Add the annotation plugin.
     * Breaks down the plugin usage into
@@ -155,7 +158,78 @@
          }
       }
    }
+   
+   public void addMetaAnnotationPlugin(T plugin)
+   {
+      if (plugin == null)
+         throw new IllegalArgumentException("Null plugin.");
+      if (plugin instanceof MetaAnnotationPlugin == false)
+         throw new IllegalArgumentException("Not a MetaAnnotationPlugin");
 
+      Class<? extends Annotation> annotation = ((MetaAnnotationPlugin<?, ?>)plugin).getMetaAnnotation();
+      if (annotation == null)
+         throw new IllegalArgumentException("Null annotation class: " + plugin);
+
+      if (annotation.getAnnotation(Target.class) == null)
+         log.warn("Annotation " + annotation + " missing @Target annotation!");
+      if (annotation.getAnnotation(Retention.class) == null)
+         log.warn("Annotation " + annotation + " missing @Retention annotation!");
+
+      Set<ElementType> supported = plugin.getSupportedTypes();
+      if (supported == null || supported.isEmpty())
+         throw new IllegalArgumentException("Null or empty support types: " + plugin);
+
+      synchronized (metaAnnotationsPluginsMap)
+      {
+         for (ElementType type : supported)
+         {
+            Map<Class<? extends Annotation>, Set<T>> pluginsForType = metaAnnotationsPluginsMap.get(type);
+            if (pluginsForType == null)
+            {
+               pluginsForType = new HashMap<Class<? extends Annotation>, Set<T>>();
+               metaAnnotationsPluginsMap.put(type, pluginsForType);
+            }
+            Set<T> plugins = pluginsForType.get(((MetaAnnotationPlugin<?, ?>)plugin).getMetaAnnotation());
+            if (plugins == null)
+            {
+               plugins = new HashSet<T>();
+               pluginsForType.put(((MetaAnnotationPlugin<?, ?>)plugin).getMetaAnnotation(), plugins);
+            }
+            plugins.add(plugin);
+         }
+      }
+   }
+   
+   public void removeMetaAnnotationPlugin(T plugin)
+   {
+      if (plugin == null)
+         return;
+
+      Set<ElementType> supported = plugin.getSupportedTypes();
+      if (supported == null || supported.isEmpty())
+         throw new IllegalArgumentException("Null or empty support types: " + plugin);
+
+      synchronized (metaAnnotationsPluginsMap)
+      {
+         for (ElementType type : supported)
+         {
+            Map<Class<? extends Annotation>, Set<T>> pluginsForType = metaAnnotationsPluginsMap.get(type);
+            if (pluginsForType != null)
+            {
+               Set<T> plugins = pluginsForType.remove(((MetaAnnotationPlugin<?, ?>)plugin).getMetaAnnotation());
+               if (plugins != null)
+               {
+                  plugins.remove(plugin);
+                  if (plugins.isEmpty())
+                     pluginsForType.remove(((MetaAnnotationPlugin<?, ?>)plugin).getMetaAnnotation());
+               }
+               if (pluginsForType.isEmpty())
+                  metaAnnotationsPluginsMap.remove(type);
+            }
+         }
+      }
+   }
+
    /**
     * Apply plugin.
     *
@@ -280,6 +354,26 @@
                cleanPlugin(plugin, annotation, classInfo, retrieval, handle);
          }
       }
+      
+      //Meta annotations on class
+      Map<Class<? extends Annotation>, Set<T>> metaAnnotationsForType = metaAnnotationsPluginsMap.get(ElementType.TYPE);
+      if (metaAnnotationsForType != null)
+      {
+         for (Entry<Class<? extends Annotation>, Set<T>> entry : metaAnnotationsForType.entrySet())
+         {
+            for (Annotation annotation : retrieval.getAnnotationsAnnotatedWith(entry.getKey()))
+            {
+               for (T plugin : entry.getValue())
+               {
+                  if (isApplyPhase)
+                     applyPlugin(plugin, annotation, classInfo, retrieval, handle);
+                  else
+                     cleanPlugin(plugin, annotation, classInfo, retrieval, handle);
+               }
+            }
+         }
+      }
+      
       // constructors
       Set<ConstructorInfo> constructors = info.getConstructors();
       if (constructors != null && constructors.isEmpty() == false)
@@ -299,7 +393,7 @@
                      else
                         cleanPlugin(plugin, annotation, ci, cmdr, handle);
                   }
-               }  
+               }
             }
             else if (trace)
                log.trace("No annotations for " + ci);
@@ -307,6 +401,7 @@
       }
       else if (trace)
          log.trace("No constructors");
+      
 
       // properties
       Set<MethodInfo> visitedMethods = new HashSet<MethodInfo>();

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/InjectAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/InjectAnnotationPlugin.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/InjectAnnotationPlugin.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -38,6 +38,7 @@
       super(Inject.class);
    }
 
+   @Override
    public ValueMetaData createValueMetaData(Inject annotation)
    {
       return ValueUtil.createValueMetaData(annotation);

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/InjectFieldAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/InjectFieldAnnotationPlugin.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/InjectFieldAnnotationPlugin.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -38,6 +38,7 @@
       super(Inject.class);
    }
 
+   @Override
    public ValueMetaData createValueMetaData(Inject annotation)
    {
       return ValueUtil.createValueMetaData(annotation);

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/InjectableMemberAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/InjectableMemberAnnotationPlugin.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/InjectableMemberAnnotationPlugin.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -190,6 +190,7 @@
       return createValueMetaData(annotation, null);
    }
 
+
    /**
     * Create value meta data.
     *

Added: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/MetaAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/MetaAnnotationPlugin.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/MetaAnnotationPlugin.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,36 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.kernel.plugins.annotations;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.reflect.spi.AnnotatedInfo;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface MetaAnnotationPlugin<T extends AnnotatedInfo, Q extends Annotation> extends AnnotationPlugin<T, Annotation>
+{
+   Class<Q> getMetaAnnotation();
+}

Added: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/SuppliedQualifierAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/SuppliedQualifierAnnotationPlugin.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/SuppliedQualifierAnnotationPlugin.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,93 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.kernel.plugins.annotations;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.ElementType;
+import java.util.List;
+
+import javax.inject.Qualifier;
+
+import org.jboss.beans.metadata.api.model.QualifierType;
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
+import org.jboss.kernel.plugins.dependency.QualifiersMdrUtil;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.reflect.spi.ClassInfo;
+
+/**
+ * Bean annotation plugin.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SuppliedQualifierAnnotationPlugin extends ClassAnnotationPlugin<Annotation> implements MetaAnnotationPlugin<ClassInfo, Qualifier>
+{
+   public static final SuppliedQualifierAnnotationPlugin INSTANCE = new SuppliedQualifierAnnotationPlugin();
+
+   protected SuppliedQualifierAnnotationPlugin()
+   {
+      super(Annotation.class);
+      addTypes(ElementType.TYPE);
+   }
+
+   protected boolean isElementTypeSupported(ElementType type)
+   {
+      return true;
+   }
+   
+   @Override
+   protected boolean isCleanup()
+   {
+      return true;
+   }
+
+   @Override
+   protected List<? extends MetaDataVisitorNode> internalApplyAnnotation(ClassInfo info, MetaData retrieval, Annotation annotation, KernelControllerContext context) throws Throwable
+   {
+      if (context != null)
+      {
+         MetaDataRetrieval instanceMetaData = context.getKernel().getMetaDataRepository().getMetaDataRepository().getMetaDataRetrieval(context.getScopeInfo().getMutableScope());
+         QualifiersMdrUtil.addQualifiersToMdrRetrieval(instanceMetaData, QualifierType.SUPPLIED, null, annotation);
+      }  
+
+      // we don't put bmd back to be inspected
+      // since the changes we apply *here* don't really
+      // trigger any change in metadata - all enums
+      return null;
+   }
+
+   @Override
+   protected void internalCleanAnnotation(ClassInfo info, MetaData retrieval, Annotation annotation, KernelControllerContext context) throws Throwable
+   {
+      if (context != null)
+      {
+         MetaDataRetrieval instanceMetaData = context.getKernel().getMetaDataRepository().getMetaDataRepository().getMetaDataRetrieval(context.getScopeInfo().getMutableScope());
+         QualifiersMdrUtil.removeQualifiersFromMdrRetrieval(instanceMetaData, QualifierType.SUPPLIED, null, annotation);
+      }  
+   }
+
+   public Class<Qualifier> getMetaAnnotation()
+   {
+      return Qualifier.class;
+   }
+}
\ No newline at end of file

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/annotations/ValueUtil.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -209,6 +209,7 @@
          injection.setWhenRequiredState(new ControllerState(annotation.whenRequired()));
       if (isAttributePresent(annotation.search()))
          injection.setSearch(org.jboss.dependency.plugins.graph.Search.getInstance(annotation.search()));
+      injection.setIgnoreBeanQualifiers(annotation.ignoreBeanQualifiers());
       injection.setInjectionOption(annotation.option());
       injection.setInjectionType(annotation.type());
       if (FromContext.NOOP.equals(annotation.fromContext()) == false)

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassAndQualifierKey.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassAndQualifierKey.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/ClassAndQualifierKey.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -21,6 +21,7 @@
 */ 
 package org.jboss.kernel.plugins.dependency;
 
+import java.lang.annotation.Annotation;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
@@ -28,6 +29,7 @@
 import java.util.Set;
 
 import org.jboss.beans.metadata.api.model.QualifierPoint;
+import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.kernel.spi.dependency.KernelController;
@@ -62,26 +64,49 @@
    /** The injection point type that this lookup will be done for */
    protected final QualifierPoint injectionPointType;
    
+   /** The parent nodes, with the lowest node first */
+   protected final List<MetaDataVisitorNode> parentNodes;
+   
    /**
     * Constructor
     * 
     * @param dependentState the state the dependency must be in
     * @param context the controller context owning this dependency
     * @param ignoreBeanQualifiers if injection point qualifiers are specified, set this to true to ignore any qualifiers from bean level
-    * @param injectionPointType the injection point type that this lookup will be done for
+    * @param parentNodes the nodes containing the injection. Lowest level come first in the list
     * @param injectionPointQualifiers the qualifiers applying only to this injection point
     * @param type the type of class we are looking for
     * 
     */
-   public ClassAndQualifierKey(ControllerState dependentState, KernelControllerContext context, boolean ignoreBeanQualifiers, QualifierPoint injectionPointType, Set<Object> injectionPointQualifiers, Class<?> type)
+   public ClassAndQualifierKey(ControllerState dependentState, KernelControllerContext context, boolean ignoreBeanQualifiers, QualifierPoint injectionPointType, List<MetaDataVisitorNode> parentNodes, Set<Object> injectionPointQualifiers, Class<?> type)
    {
       this.dependentState = dependentState == null ? ControllerState.INSTALLED : dependentState;
       this.context = context;
-      this.injectionPointQualifiers = injectionPointQualifiers != null && injectionPointQualifiers.size() > 0 ? injectionPointQualifiers : null;
+      this.injectionPointQualifiers = injectionPointQualifiers != null && injectionPointQualifiers.size() > 0 ? injectionPointQualifiers : new HashSet<Object>();
       this.type = type;
       this.ignoreBeanQualifiers = ignoreBeanQualifiers;
+      this.parentNodes = parentNodes;
       this.injectionPointType = injectionPointType;
    }
+
+   /**
+    * Get the parentNodes
+    * @return the parentNodes
+    */
+   public List<MetaDataVisitorNode> getParentNodes()
+   {
+      return parentNodes;
+   }
+
+   /**
+    * Add qualifiers coming from injection point annotations
+    * 
+    * @param annotations the qualifier annotations
+    */
+   public void addQualifiersFromAnnotations(Set<Annotation> annotations)
+   {
+      injectionPointQualifiers.addAll(annotations);
+   }
    
    /**
     * Look for a context in the controller that most closely matches the type

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/InstantiateAction.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/InstantiateAction.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/InstantiateAction.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -91,7 +91,7 @@
             // re-register
             repository.addMetaData(context);
 
-            QualifiersMdrUtil.addQualifiersToMdr(context);
+            QualifiersMdrUtil.populateQualifiersForContext(context);
             
             // handle custom annotations
             applyAnnotations(context);

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/KernelScopeInfo.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/KernelScopeInfo.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/KernelScopeInfo.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -50,12 +50,10 @@
 import org.jboss.metadata.spi.scope.ScopeKey;
 import org.jboss.metadata.spi.signature.ConstructorParametersSignature;
 import org.jboss.metadata.spi.signature.ConstructorSignature;
-import org.jboss.metadata.spi.signature.DeclaredMethodSignature;
 import org.jboss.metadata.spi.signature.FieldSignature;
 import org.jboss.metadata.spi.signature.MethodParametersSignature;
 import org.jboss.metadata.spi.signature.MethodSignature;
 import org.jboss.metadata.spi.signature.Signature;
-import org.jboss.reflect.spi.ClassInfo;
 import org.jboss.reflect.spi.ConstructorInfo;
 import org.jboss.reflect.spi.FieldInfo;
 import org.jboss.reflect.spi.MethodInfo;

Modified: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/PreInstallAction.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/PreInstallAction.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/PreInstallAction.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -107,7 +107,7 @@
             removeMetaData(context);
             throw t;
          }
-         QualifiersMdrUtil.addQualifiersToMdr(context);
+         QualifiersMdrUtil.populateQualifiersForContext(context);
       }
    }
 

Deleted: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/QualifiedClassDependencyItem.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/QualifiedClassDependencyItem.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/QualifiedClassDependencyItem.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -1,72 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.kernel.plugins.dependency;
-
-import org.jboss.dependency.plugins.AbstractDependencyItem;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.Controller;
-import org.jboss.util.JBossStringBuilder;
-
-/**
- * A qualified class dependant dependencyItem.
- *
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- */
-public abstract class QualifiedClassDependencyItem extends AbstractDependencyItem
-{
-   public QualifiedClassDependencyItem(Object name, ClassAndQualifierKey classAndQualifierMatcher, ControllerState whenRequired, ControllerState dependentState)
-   {
-      super(name, classAndQualifierMatcher, whenRequired, dependentState);
-   }
-
-   @SuppressWarnings("unchecked")
-   protected Class<?> getDemandClass()
-   {
-      return (Class)getIDependOn();
-   }
-
-   /**
-    * Clear the class reference.
-    *  
-    * @param controller the controller
-    */
-   public void clear(Controller controller)
-   {
-      setIDependOn(null);
-   }
-
-   public void toString(JBossStringBuilder buffer)
-   {
-      super.toString(buffer);
-      buffer.append(" demandClassQualifier=").append(getIDependOn());
-   }
-
-   public void toShortString(JBossStringBuilder buffer)
-   {
-      buffer.append(getName()).append(" demandClassQualifier ").append(getIDependOn());
-   }
-
-   public String toHumanReadableString()
-   {
-      return getIDependOn() + " (NOTE: using autowiring to resolve this dependency)";
-   }
-}

Deleted: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/QualifiersMdrUtil.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/QualifiersMdrUtil.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/QualifiersMdrUtil.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -1,592 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors. 
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/ 
-package org.jboss.kernel.plugins.dependency;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.jboss.beans.metadata.api.model.QualifierPoint;
-import org.jboss.beans.metadata.api.model.QualifierType;
-import org.jboss.beans.metadata.plugins.AbstractBeanQualifierMetaData;
-import org.jboss.beans.metadata.spi.RelatedClassMetaData;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.spi.MetaData;
-import org.jboss.metadata.spi.MutableMetaData;
-import org.jboss.metadata.spi.repository.MetaDataRepository;
-import org.jboss.metadata.spi.repository.MutableMetaDataRepository;
-import org.jboss.metadata.spi.retrieval.MetaDataItem;
-import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
-import org.jboss.metadata.spi.scope.ScopeKey;
-import org.jboss.util.JBossObject;
-import org.jboss.util.collection.ConcurrentSet;
-
-/**
- * Utility class to access the MDR for qualifiers.<p>
- * 
- * Supplied qualifiers are stored under the key {@link #SUPPLIED_QUALIFIER_KEY}.</p>
- * 
- * Wanted qualifiers are split into optional (key prefix: {@link #OPTIONAL_QUALIFIER_KEY}) 
- * or required (key prefix: {@link #REQUIRED_QUALIFIER_KEY}). They can apply to a sub-set of the following injection points. Property 
- * (key suffix {@link #PROPERTY_SUFFIX}), method (key suffix: {@link #METHOD_SUFFIX}), constructor (key suffix: {@link #CONSTRUCTOR_SUFFIX}).
- * The full MDR key is the <i><b>key prefix</b> + <b>key suffix</b></i>. If there is no injection point specified the qualifiers will be applied
- * to property, method and constructor.  
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class QualifiersMdrUtil
-{
-   private final static Logger log = Logger.getLogger(QualifiersMdrUtil.class);
-   
-   private final static MDRStrategy SUPPLIED_MDR = new SuppliedMDRStrategy();
-   
-   private final static MDRStrategy WANTED_MDR = new WantedMDRStrategy();
-
-   /** The key under which we will store a contexts supplied qualifier metadata */
-   public final static String SUPPLIED_QUALIFIER_KEY = QualifiersMdrUtil.class.getSimpleName() + "#SUPPLIED_QUALIFIERS";
-
-   /** The key under which we will store a contexts wanted qualifier metadata */
-   public final static String REQUIRED_QUALIFIER_KEY = QualifiersMdrUtil.class.getSimpleName() + "#REQUIRED_QUALIFIERS";
-   
-   /** The key under which we will store a contexts required qualifier metadata */
-   public final static String OPTIONAL_QUALIFIER_KEY = QualifiersMdrUtil.class.getSimpleName() + "#OPTIONAL_QUALIFIERS";
-   
-   public final static String CONSTRUCTOR_SUFFIX = "#CONSTRUCTOR";
-   
-   public final static String PROPERTY_SUFFIX = "#PROPERTY";
-   
-   public final static String METHOD_SUFFIX = "#METHOD";
-   
-   /**
-    * Get the wanted qualifiers defined from the bean's metadata or in the Mdr.
-    * This method is used when creating injection values, which is before the Mdr
-    * has been set up for a context.
-    * 
-    * @param context the context we want to check
-    * @param point the injection point we want to narrow down qualifiers for
-    * @return true if the bean metadata or the Mdr contains qualifiers
-    */
-   public static boolean hasWantedQualifiersInParentMdrOrBeanMetaData(KernelControllerContext context, QualifierPoint point)
-   {
-      Set<RelatedClassMetaData> related = context.getBeanMetaData().getRelated();
-      if (related == null)
-         return false;
-      if (related.size() == 0)
-         return false;
-      
-      Set<RelatedClassMetaData> md = null; 
-      for (RelatedClassMetaData rcmd : related)
-      {
-         if (rcmd.getClassName().equals(REQUIRED_QUALIFIER_KEY) || rcmd.getClassName().equals(OPTIONAL_QUALIFIER_KEY))
-         {
-            if (md == null)
-               md = new HashSet<RelatedClassMetaData>();
-            md.add(rcmd);
-         }
-      }
-      
-      if (md != null && md.size() > 0)
-         return true;
-
-      MetaDataRepository repository = context.getKernel().getMetaDataRepository().getMetaDataRepository();
-      ScopeKey key = context.getScopeInfo().getScope();
-      while (key != null)
-      {
-         MetaData metaData = repository.getMetaData(key);
-         if (metaData != null)
-         {
-            if (metaData.getMetaData(WANTED_MDR.getKey(REQUIRED_QUALIFIER_KEY, point)) != null)
-               return true;
-            if (metaData.getMetaData(WANTED_MDR.getKey(OPTIONAL_QUALIFIER_KEY, point)) != null)
-               return true;
-         }
-         key = key.getParent();
-      }
-      
-      return false;
-   }
-   
-   
-   /**
-    * Adds the qualifiers for a context's bean metadata to the context's MDR metadata. 
-    * 
-    * @param context the context 
-    */
-   public static void addQualifiersToMdr(KernelControllerContext context)
-   {
-      try
-      {
-         Set<RelatedClassMetaData> qualifiers = context.getBeanMetaData().getRelated();
-         
-         if (qualifiers != null && qualifiers.size() > 0)
-         {
-            MetaDataRetrieval retrieval = context.getKernel().getMetaDataRepository().getMetaDataRepository().getMetaDataRetrieval(context.getScopeInfo().getMutableScope());
-            if (retrieval instanceof MutableMetaData == false)
-            {
-               log.warn("Can not add qualifier to non mutable metadata" + context +  ":" + retrieval);
-               return;
-            }
-   
-            Set<RelatedClassMetaData> suppliedMetaData = new HashSet<RelatedClassMetaData>();
-            Set<RelatedClassMetaData> requiredMetaData = new HashSet<RelatedClassMetaData>();
-            Set<RelatedClassMetaData> optionalMetaData = new HashSet<RelatedClassMetaData>();
-   
-            splitRelatedClassMetaData(qualifiers, suppliedMetaData, requiredMetaData, optionalMetaData);
-            
-            for (RelatedClassMetaData rcmd : qualifiers)
-            {
-               if (JBossObject.equals(SUPPLIED_QUALIFIER_KEY, rcmd.getClassName()))
-                  SUPPLIED_MDR.addQualifiersToSetInMdr(suppliedMetaData, rcmd.getClassName(), retrieval);
-               else if (JBossObject.equals(REQUIRED_QUALIFIER_KEY, rcmd.getClassName()))
-                  WANTED_MDR.addQualifiersToSetInMdr(requiredMetaData, rcmd.getClassName(), retrieval);
-               else if (JBossObject.equals(OPTIONAL_QUALIFIER_KEY, rcmd.getClassName()))
-                  WANTED_MDR.addQualifiersToSetInMdr(optionalMetaData, rcmd.getClassName(), retrieval);
-            }
-         }
-      }
-      catch(Exception e)
-      {
-         e.printStackTrace();
-      }
-   }
-
-   /**
-    * Add qualifiers to a MDR metadata retrieval
-    * 
-    * @param retrieval the retrieval to add the data to. If it is not an instance of MutableMetaDataRetrieval no qualifiers will be added, but no error will be thrown
-    * @param type the type of qualifier to add
-    * @param point the injection point type to add this qualifier to. If it is null, it is added for constructors, fields and properties
-    * @param qualifiers the qualfiers to add to the retrieval
-    */
-   public static void addQualifiersToMdrRetrieval(MetaDataRetrieval retrieval, QualifierType type, QualifierPoint point, Set<Object> qualifiers)
-   {
-      switch (type)
-      {
-         case SUPPLIED:
-            SUPPLIED_MDR.addQualifiersToMdrRetrieval(retrieval, type, point, qualifiers);
-            break;
-         case REQUIRED:
-         case OPTIONAL:
-            WANTED_MDR.addQualifiersToMdrRetrieval(retrieval, type, point, qualifiers);
-            break;
-         default:
-            throw new IllegalArgumentException("Unhandled type " + type);
-      }
-   }
-   
-   /**
-    * Removes the qualifiers for a context's bean metadata from the context's MDR metadata. 
-    * 
-    * @param context the context 
-    */
-   public static void removeQualifiersFromMdr(KernelControllerContext context)
-   {
-      Set<RelatedClassMetaData> qualifiers =  context.getBeanMetaData().getRelated();
-      
-      if (qualifiers != null && qualifiers.size() > 0)
-      {
-         MetaDataRetrieval retrieval = context.getKernel().getMetaDataRepository().getMetaDataRepository().getMetaDataRetrieval(context.getScopeInfo().getMutableScope());
-         if (retrieval instanceof MutableMetaData == false)
-         {
-            log.warn("Can not remove qualifier from non mutable metadata" + context +  ":" + retrieval);
-            return;
-         }
-         
-         Set<RelatedClassMetaData> suppliedMetaData = new HashSet<RelatedClassMetaData>();
-         Set<RelatedClassMetaData> requiredMetaData = new HashSet<RelatedClassMetaData>();
-         Set<RelatedClassMetaData> optionalMetaData = new HashSet<RelatedClassMetaData>();
-
-         splitRelatedClassMetaData(qualifiers, suppliedMetaData, requiredMetaData, optionalMetaData);
-
-         for (RelatedClassMetaData rcmd : qualifiers)
-         {
-            if (JBossObject.equals(SUPPLIED_QUALIFIER_KEY, rcmd.getClassName()))
-               SUPPLIED_MDR.removeQualifiersFromSetInMdr(suppliedMetaData, rcmd.getClassName(), retrieval);
-            else if (JBossObject.equals(REQUIRED_QUALIFIER_KEY, rcmd.getClassName()))
-                  WANTED_MDR.removeQualifiersFromSetInMdr(requiredMetaData, rcmd.getClassName(), retrieval);
-            else if (JBossObject.equals(OPTIONAL_QUALIFIER_KEY, rcmd.getClassName()))
-               WANTED_MDR.removeQualifiersFromSetInMdr(optionalMetaData, rcmd.getClassName(), retrieval);
-         }
-      }
-   }
-   
-   /**
-    * Gets all the supplied qualifiers for the context from the MDR. The returned set combines the qualifiers 
-    * found at all scope levels
-    * 
-    * @param context the context 
-    * @return the found qualifiers
-    */
-   public static Set<Object> mergeSuppliedQualifiersFromMdr(ControllerContext context)
-   {
-      return SUPPLIED_MDR.mergeQualifiersFromMdr(context, QualifierType.SUPPLIED, null);
-   }
-   
-   /**
-    * Gets all the required qualifiers for the context from the MDR. The returned set combines the qualifiers 
-    * found at all scope levels
-    * 
-    * @param context the context 
-    * @return the found qualifiers
-    */
-   public static Set<Object> mergeRequiredQualifiersFromMdr(ControllerContext context, QualifierPoint point)
-   {
-      return WANTED_MDR.mergeQualifiersFromMdr(context, QualifierType.REQUIRED, point);
-   }
-   
-   /**
-    * Gets all the optional qualifiers for the context from the MDR. The returned set combines the qualifiers 
-    * found at all scope levels
-    * 
-    * @param context the context 
-    * @return the found qualifiers
-    */
-   public static Set<Object> mergeOptionalQualifiersFromMdr(ControllerContext context, QualifierPoint point)
-   {
-      return WANTED_MDR.mergeQualifiersFromMdr(context, QualifierType.OPTIONAL, point);
-   }
-
-   /**
-    * Get an MDR key for the supplied type and the type of injection point
-    * 
-    * @param type the type
-    * @param point the point
-    * @return the key
-    */
-   public static String getKey(QualifierType type, QualifierPoint point)
-   {
-      switch (type)
-      {
-         case OPTIONAL :
-         case REQUIRED :
-            return WANTED_MDR.getKey(type, point);
-         case SUPPLIED :
-            return SUPPLIED_MDR.getKey(type, point);
-         default:
-            throw new IllegalArgumentException("Unhandled type " + type);
-      }
-   }
-   
-   private static void splitRelatedClassMetaData(Set<RelatedClassMetaData> related, Set<RelatedClassMetaData> suppliedMetaData, Set<RelatedClassMetaData> requiredMetaData, Set<RelatedClassMetaData> optionalMetaData)
-   {
-      for (RelatedClassMetaData rcmd : related)
-      {
-         if (JBossObject.equals(SUPPLIED_QUALIFIER_KEY, rcmd.getClassName()))
-            suppliedMetaData.add(rcmd);
-         else if (JBossObject.equals(REQUIRED_QUALIFIER_KEY, rcmd.getClassName()))
-            requiredMetaData.add(rcmd);
-         else if (JBossObject.equals(OPTIONAL_QUALIFIER_KEY, rcmd.getClassName()))
-            optionalMetaData.add(rcmd);
-      }
-   }        
-   
-   private static abstract class MDRStrategy
-   {
-      abstract void addQualifiersToSetInMdr(Set<RelatedClassMetaData> relateds, String keyRoot, MetaDataRetrieval retrieval);
-
-      abstract void addQualifiersToMdrRetrieval(MetaDataRetrieval retrieval, QualifierType type, QualifierPoint point, Set<Object> qualifiers);
-
-      abstract void removeQualifiersFromSetInMdr(Set<RelatedClassMetaData> relateds, String keyRoot, MetaDataRetrieval retrieval);
-      
-      abstract Set<Object> mergeQualifiersFromMdr(ControllerContext context, QualifierType type, QualifierPoint point);
-      
-      abstract String getKey(String className, QualifierPoint point);
-
-      abstract String getKey(QualifierType type, QualifierPoint point);
-
-      Set<Object> addQualifiersToSetInMdr(Set<Object> qualifierSet, MetaDataRetrieval retrieval, Set<Object> qualifiersToAdd, String key)
-      {
-         if (qualifierSet == null)
-            qualifierSet = getQualifiersSetInMdr(retrieval, key, true); 
-         for (Object qualifier : qualifiersToAdd)
-            qualifierSet.add(qualifier);
-         
-         return qualifierSet;
-      }
-      
-      Set<Object> mergeQualifiersFromMdr(ControllerContext context, String key)
-      {
-         if (context instanceof KernelControllerContext == false)
-            return null;
-         
-         MutableMetaDataRepository repository = ((KernelControllerContext)context).getKernel().getMetaDataRepository().getMetaDataRepository();
-         ScopeKey scope = context.getScopeInfo().getScope();
-
-         Set<Object> set = null;
-         while (scope != null)
-         {
-            MetaData metaData = repository.getMetaData(scope);
-            if (metaData != null)
-            {
-               Set<Object> entry = metaData.getMetaData(key, Set.class);
-               if (entry != null)
-               {
-                  if (set == null)
-                     set = entry;
-                  else
-                  {
-                     set = new HashSet<Object>(set);
-                     set.addAll(entry);
-                  }
-               }
-            }         
-            scope = scope.getParent();
-         }
-         return set;
-      }
-
-      void removeEmptyQualifiersSetFromMdr(Set<Object> set, String keyRoot, MetaDataRetrieval retrieval, QualifierPoint point)
-      {
-         if (set != null && set.size() == 0)
-            ((MutableMetaData)retrieval).removeMetaData(getKey(keyRoot, point), Set.class);
-      }
-      
-      String typeToKeyRoot(QualifierType type)
-      {
-         switch (type)
-         {
-            case OPTIONAL:
-               return OPTIONAL_QUALIFIER_KEY;
-            case REQUIRED:
-               return REQUIRED_QUALIFIER_KEY;
-            case SUPPLIED:
-               return SUPPLIED_QUALIFIER_KEY;
-            default:
-               throw new IllegalArgumentException("Unhandled type " + type);
-         }
-      }
-      
-      Set<Object> getQualifiersSetInMdr(MetaDataRetrieval retrieval, String key, boolean create)
-      {
-         MetaDataItem<?> item = retrieval.retrieveMetaData(key);
-         //TODO - The following is not threadsafe
-         Set<Object> set = null;
-         if (item == null)
-         {
-            if (create)
-            {
-               set = new ConcurrentSet<Object>();
-               ((MutableMetaData)retrieval).addMetaData(key, set, Set.class);
-            }
-            else
-            {
-               return null;
-            }
-         }
-         else
-         {
-            set = (Set<Object>)item.getValue();
-         }
-         return set;
-      }
-   }
-   
-   private static class SuppliedMDRStrategy extends MDRStrategy
-   {
-      @Override
-      void addQualifiersToSetInMdr(Set<RelatedClassMetaData> relateds, String keyRoot, MetaDataRetrieval retrieval)
-      {
-         if (keyRoot.equals(SUPPLIED_QUALIFIER_KEY) == false)
-            throw new IllegalArgumentException("Wrong key " + keyRoot);
-         Set<Object> set = null;
-         for (RelatedClassMetaData rcmd : relateds)
-         {
-            set = addQualifiersToSetInMdr(set, retrieval, rcmd.getEnabled(), keyRoot);
-         }         
-      }
-
-      @Override
-      void addQualifiersToMdrRetrieval(MetaDataRetrieval retrieval, QualifierType type, QualifierPoint point, Set<Object> qualifiers)
-      {
-         if (type != QualifierType.SUPPLIED)
-            throw new IllegalArgumentException("Wrong type " + type);
-         if (point != null)
-            throw new IllegalArgumentException("Injection poing passed in for supplied qualifier");
-
-         addQualifiersToSetInMdr(null, retrieval, qualifiers, SUPPLIED_QUALIFIER_KEY);
-      }
-      
-      @Override
-      void removeQualifiersFromSetInMdr(Set<RelatedClassMetaData> relateds, String keyRoot, MetaDataRetrieval retrieval)
-      {
-         if (relateds == null || relateds.size() == 0)
-            return;
-         
-         if (keyRoot.equals(keyRoot) == false)
-            throw new IllegalArgumentException("Wrong key " + keyRoot);
-         
-         Set<Object> set = getQualifiersSetInMdr(retrieval, keyRoot, false);
-         if (set != null)
-         {
-            for (RelatedClassMetaData rcmd : relateds)
-            {
-               if (rcmd.getEnabled() != null && rcmd.getEnabled().size() > 0)
-               {
-                  set.removeAll(rcmd.getEnabled());
-               }
-            }
-         }
-         removeEmptyQualifiersSetFromMdr(set, keyRoot, retrieval, null);
-      }
-      
-      @Override
-      Set<Object> mergeQualifiersFromMdr(ControllerContext context, QualifierType type, QualifierPoint point)
-      {
-         return super.mergeQualifiersFromMdr(context, typeToKeyRoot(type));
-      }
-
-      @Override
-      public String getKey(QualifierType type, QualifierPoint point)
-      {
-         return typeToKeyRoot(type);
-      }
-
-      @Override
-      String getKey(String className, QualifierPoint point)
-      {
-         return className;
-      }
-   }
-   
-   private static class WantedMDRStrategy extends MDRStrategy
-   {
-      @Override
-      void addQualifiersToSetInMdr(Set<RelatedClassMetaData> relateds, String keyRoot, MetaDataRetrieval retrieval)
-      {
-         Set<Object> constructorSet = null;
-         Set<Object> methodSet = null;
-         Set<Object> propertySet = null;
-         for (RelatedClassMetaData rcmd : relateds)
-         {
-            if (rcmd instanceof AbstractBeanQualifierMetaData)
-            {
-               AbstractBeanQualifierMetaData aqmd = (AbstractBeanQualifierMetaData)rcmd;
-               if (aqmd.getPoints() != null && aqmd.getPoints().size() > 0)
-               {
-                  constructorSet = addQualifiersToSetInMdrIfHasCorrectType(constructorSet, retrieval, aqmd, QualifierPoint.CONSTRUCTOR);
-                  methodSet = addQualifiersToSetInMdrIfHasCorrectType(methodSet, retrieval, aqmd, QualifierPoint.METHOD);
-                  propertySet = addQualifiersToSetInMdrIfHasCorrectType(propertySet, retrieval, aqmd, QualifierPoint.PROPERTY);
-                  continue;
-               }
-            }
-
-            constructorSet = addQualifiersToSetInMdr(constructorSet, retrieval, rcmd, QualifierPoint.CONSTRUCTOR);
-            methodSet = addQualifiersToSetInMdr(methodSet, retrieval, rcmd, QualifierPoint.METHOD);
-            propertySet = addQualifiersToSetInMdr(propertySet, retrieval, rcmd, QualifierPoint.PROPERTY);
-         }
-      }
-
-      private Set<Object> addQualifiersToSetInMdrIfHasCorrectType(Set<Object> qualifierSet, MetaDataRetrieval retrieval, AbstractBeanQualifierMetaData aqmd, QualifierPoint point)
-      {
-         
-         if (aqmd.getPoints().contains(point))
-            return addQualifiersToSetInMdr(qualifierSet, retrieval, aqmd, point);
-         return qualifierSet;
-      }
-
-      private Set<Object> addQualifiersToSetInMdr(Set<Object> qualifierSet, MetaDataRetrieval retrieval, RelatedClassMetaData rcmd, QualifierPoint point)
-      {
-         return addQualifiersToSetInMdr(qualifierSet, retrieval, rcmd.getEnabled(), getKey(rcmd.getClassName(), point));
-      }
-      
-      @Override
-      void addQualifiersToMdrRetrieval(MetaDataRetrieval retrieval, QualifierType type, QualifierPoint point, Set<Object> qualifiers)
-      {
-         if (point == null)
-         {
-            addQualifiersToSetInMdr(null, retrieval, qualifiers, getKey(type, QualifierPoint.CONSTRUCTOR));
-            addQualifiersToSetInMdr(null, retrieval, qualifiers, getKey(type, QualifierPoint.METHOD));
-            addQualifiersToSetInMdr(null, retrieval, qualifiers, getKey(type, QualifierPoint.PROPERTY ));
-         }
-         else
-         {
-            addQualifiersToSetInMdr(null, retrieval, qualifiers, getKey(type, point));
-         }
-      }
-
-      @Override
-      void removeQualifiersFromSetInMdr(Set<RelatedClassMetaData> relateds, String keyRoot, MetaDataRetrieval retrieval)
-      {
-         if (relateds == null || relateds.size() == 0)
-            return;
-         
-         Set<Object> constructorSet = getQualifiersSetInMdr(retrieval, getKey(keyRoot, QualifierPoint.CONSTRUCTOR), false);
-         Set<Object> methodSet = getQualifiersSetInMdr(retrieval, getKey(keyRoot, QualifierPoint.METHOD), false);
-         Set<Object> propertySet = getQualifiersSetInMdr(retrieval, getKey(keyRoot, QualifierPoint.PROPERTY), false);
-         for (RelatedClassMetaData rcmd : relateds)
-         {
-            if (rcmd.getEnabled() != null && rcmd.getEnabled().size() > 0)
-            {
-               if (rcmd instanceof AbstractBeanQualifierMetaData)
-               {
-                  AbstractBeanQualifierMetaData aqmd = (AbstractBeanQualifierMetaData)rcmd;
-                  if (aqmd.getPoints() != null && aqmd.getPoints().size() > 0)
-                  {
-                     if (aqmd.getPoints().contains(QualifierPoint.CONSTRUCTOR) && constructorSet != null)
-                        constructorSet.removeAll(aqmd.getEnabled());
-                     else if (aqmd.getPoints().contains(QualifierPoint.METHOD) && methodSet != null)
-                        methodSet.removeAll(aqmd.getEnabled());
-                     else if (aqmd.getPoints().contains(QualifierPoint.PROPERTY) && propertySet != null)
-                        propertySet.removeAll(aqmd.getEnabled());
-                  }
-               }
-            }
-         }
-         removeEmptyQualifiersSetFromMdr(constructorSet, keyRoot, retrieval, QualifierPoint.CONSTRUCTOR);
-         removeEmptyQualifiersSetFromMdr(methodSet, keyRoot, retrieval, QualifierPoint.METHOD);
-         removeEmptyQualifiersSetFromMdr(propertySet, keyRoot, retrieval, QualifierPoint.PROPERTY);
-      }
-
-      @Override
-      Set<Object> mergeQualifiersFromMdr(ControllerContext context, QualifierType type, QualifierPoint point)
-      {
-         return super.mergeQualifiersFromMdr(context, getKey(typeToKeyRoot(type), point));
-      }
-
-      @Override
-      public String getKey(QualifierType type, QualifierPoint point)
-      {
-         return getKey(typeToKeyRoot(type), point);
-      }
-      
-      String getKey(String className, QualifierPoint point)
-      {
-         if (point == null)
-            throw new IllegalArgumentException("Null point for required/optional qualifier");
-       
-         switch (point)
-         {
-            case CONSTRUCTOR :
-               return className + CONSTRUCTOR_SUFFIX;
-            case METHOD :
-               return className + METHOD_SUFFIX;
-            case PROPERTY :
-               return className + PROPERTY_SUFFIX;
-            default :
-               throw new IllegalArgumentException("Unknown point " + point);
-         }
-    }
-
-   }
-}

Deleted: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchClassContextDependencyItem.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchClassContextDependencyItem.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchClassContextDependencyItem.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -1,59 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.kernel.plugins.dependency;
-
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.graph.LookupStrategy;
-import org.jboss.dependency.spi.graph.SearchInfo;
-
-/**
- * A search Class context dependencyItem.
- *
- * @author <a href="ales.justin at gmail.com">Ales Justin</a>
- */
-public class SearchClassContextDependencyItem extends ClassDependencyItem
-{
-   private SearchInfo search;
-
-   public SearchClassContextDependencyItem(Object name, Class<?> demandClass, ControllerState whenRequired, ControllerState dependentState, SearchInfo search)
-   {
-      super(name, demandClass, whenRequired, dependentState);
-      if (search == null)
-         throw new IllegalArgumentException("Null search.");
-
-      this.search = search;
-   }
-
-   /**
-    * Get controller context.
-    *
-    * @param controller the controller
-    * @return controller context
-    */
-   protected ControllerContext getControllerContext(Controller controller)
-   {
-      LookupStrategy strategy = search.getStrategy();
-      return strategy.getContext(controller, getIDependOn(), ControllerState.INSTALLED);
-   }
-}
\ No newline at end of file

Deleted: projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchQualifiedClassDependencyItem.java
===================================================================
--- projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchQualifiedClassDependencyItem.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/main/java/org/jboss/kernel/plugins/dependency/SearchQualifiedClassDependencyItem.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -1,57 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source.
-* Copyright 2006, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file in the
-* distribution for a full listing of individual contributors. 
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/ 
-package org.jboss.kernel.plugins.dependency;
-
-import org.jboss.dependency.spi.Controller;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.graph.LookupStrategy;
-import org.jboss.dependency.spi.graph.SearchInfo;
-
-/**
- * 
- * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class SearchQualifiedClassDependencyItem extends QualifiedClassDependencyItem
-{
-   private SearchInfo search;
-
-   public SearchQualifiedClassDependencyItem(Object name, ClassAndQualifierKey classAndQualifierMatcher,
-         ControllerState whenRequired, ControllerState dependentState, SearchInfo search)
-   {
-      super(name, classAndQualifierMatcher, whenRequired, dependentState);
-      this.search = search;
-   }
-
-   /**
-    * Get controller context.
-    *
-    * @param controller the controller
-    * @return controller context
-    */
-   protected ControllerContext getControllerContext(Controller controller)
-   {
-      LookupStrategy strategy = search.getStrategy();
-      return strategy.getContext(controller, getIDependOn(), ControllerState.INSTALLED);
-   }
-}

Modified: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/MockInjectPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/MockInjectPlugin.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/MockInjectPlugin.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -25,10 +25,10 @@
 import java.util.List;
 import java.util.Set;
 
+import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.beans.metadata.spi.MetaDataVisitorNode;
 import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.beans.metadata.plugins.AbstractValueMetaData;
 import org.jboss.kernel.plugins.annotations.FieldAnnotationPlugin;
 import org.jboss.reflect.spi.FieldInfo;
 
@@ -51,6 +51,7 @@
       return new AbstractValueMetaData();
    }
 
+   @Override
    protected List<? extends MetaDataVisitorNode> internalApplyAnnotation(FieldInfo info, MockInject annotation, BeanMetaData beanMetaData) throws Throwable
    {
       fieldNames.add(info.getName());

Modified: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/SimpleBeanMetaDataAnnotationAdapter.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/SimpleBeanMetaDataAnnotationAdapter.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/annotations/support/SimpleBeanMetaDataAnnotationAdapter.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -21,11 +21,11 @@
 */
 package org.jboss.test.kernel.annotations.support;
 
-import org.jboss.kernel.spi.annotations.BeanMetaDataAnnotationAdapter;
 import org.jboss.beans.info.spi.BeanInfo;
 import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.spi.ControllerMode;
+import org.jboss.kernel.spi.annotations.BeanMetaDataAnnotationAdapter;
 import org.jboss.metadata.spi.MetaData;
-import org.jboss.dependency.spi.ControllerMode;
 
 /**
  * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>

Modified: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/deployment/support/container/EJBAnnotationPlugin.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/deployment/support/container/EJBAnnotationPlugin.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/deployment/support/container/EJBAnnotationPlugin.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -38,6 +38,7 @@
       super(EJB.class);
    }
 
+   @Override
    public ValueMetaData createValueMetaData(FieldInfo info, EJB annotation)
    {
       String name = prefix + "/";

Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedBeanA.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedBeanA.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedBeanA.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.kernel.qualifiers.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Qualifier1
+public class AnnotatedBeanA extends Bean
+{
+
+}

Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedBeanB.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedBeanB.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedBeanB.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.kernel.qualifiers.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Qualifier2
+public class AnnotatedBeanB extends Bean
+{
+
+}

Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedBeanC.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedBeanC.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedBeanC.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,33 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.kernel.qualifiers.support;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Qualifier3
+public class AnnotatedBeanC extends Bean
+{
+
+}

Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedIgnoreTargetAllBean.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedIgnoreTargetAllBean.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedIgnoreTargetAllBean.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,73 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.kernel.qualifiers.support;
+
+import org.jboss.beans.metadata.api.annotations.Constructor;
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.api.annotations.InstallMethod;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AnnotatedIgnoreTargetAllBean
+{
+   private Bean constructorBean;
+   
+   private Bean fieldBean;
+   
+   private Bean methodBean;
+
+   @Constructor
+   public AnnotatedIgnoreTargetAllBean(@Inject(ignoreBeanQualifiers=true) @Qualifier1 Bean bean)
+   {
+      constructorBean = bean;
+   }
+   
+   public Bean getConstructorBean()
+   {
+      return constructorBean;
+   }
+
+   public Bean getFieldBean()
+   {
+      return fieldBean;
+   }
+
+   @Inject(ignoreBeanQualifiers=true) @Qualifier2
+   public void setFieldBean(Bean fieldBean)
+   {
+      this.fieldBean = fieldBean;
+   }
+
+   public Bean getMethodBean()
+   {
+      return methodBean;
+   }
+
+   @InstallMethod
+   public void installBean(@Inject(ignoreBeanQualifiers=true) @Qualifier3 Bean methodBean)
+   {
+      this.methodBean = methodBean;
+   }
+}

Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedTargetAllBean.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedTargetAllBean.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/AnnotatedTargetAllBean.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,73 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.kernel.qualifiers.support;
+
+import org.jboss.beans.metadata.api.annotations.Constructor;
+import org.jboss.beans.metadata.api.annotations.Inject;
+import org.jboss.beans.metadata.api.annotations.InstallMethod;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class AnnotatedTargetAllBean
+{
+   private Bean constructorBean;
+   
+   private Bean fieldBean;
+   
+   private Bean methodBean;
+
+   @Constructor
+   public AnnotatedTargetAllBean(@Inject @Qualifier1 Bean bean)
+   {
+      constructorBean = bean;
+   }
+   
+   public Bean getConstructorBean()
+   {
+      return constructorBean;
+   }
+
+   public Bean getFieldBean()
+   {
+      return fieldBean;
+   }
+
+   @Inject @Qualifier2
+   public void setFieldBean(Bean fieldBean)
+   {
+      this.fieldBean = fieldBean;
+   }
+
+   public Bean getMethodBean()
+   {
+      return methodBean;
+   }
+
+   @InstallMethod
+   public void installBean(@Inject @Qualifier3 Bean methodBean)
+   {
+      this.methodBean = methodBean;
+   }
+}

Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/Qualifier1.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/Qualifier1.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/Qualifier1.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.kernel.qualifiers.support;
+
+import java.lang.annotation.RetentionPolicy;
+
+import java.lang.annotation.Retention;
+
+import javax.inject.Qualifier;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Qualifier
+public @interface Qualifier1 {
+
+}

Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/Qualifier2.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/Qualifier2.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/Qualifier2.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.kernel.qualifiers.support;
+
+import java.lang.annotation.RetentionPolicy;
+
+import java.lang.annotation.Retention;
+
+import javax.inject.Qualifier;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Qualifier
+public @interface Qualifier2 {
+
+}

Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/Qualifier3.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/Qualifier3.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/support/Qualifier3.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,39 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.kernel.qualifiers.support;
+
+import java.lang.annotation.RetentionPolicy;
+
+import java.lang.annotation.Retention;
+
+import javax.inject.Qualifier;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Qualifier
+public @interface Qualifier3 {
+
+}

Modified: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/test/BeanQualifiersTestCase.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/test/BeanQualifiersTestCase.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/test/BeanQualifiersTestCase.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -23,7 +23,6 @@
 
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Set;
 
 import junit.framework.Test;
@@ -110,9 +109,9 @@
    public void testContextsMDRHasQualifiersFromAllLevels() throws Throwable
    {
       MemoryMetaDataLoader loader = new MemoryMetaDataLoader(ScopeKey.DEFAULT_SCOPE);
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.SUPPLIED, null, new HashSet<Object>(Collections.singleton("supplied1")));
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.REQUIRED, null, new HashSet<Object>(Collections.singleton("wanted1")));
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.OPTIONAL, null, new HashSet<Object>(Collections.singleton("optional1")));
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.SUPPLIED, null, "supplied1");
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.REQUIRED, null, "wanted1");
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.OPTIONAL, null, "optional1");
       
       getMetaDataRepository().getMetaDataRepository().addMetaDataRetrieval(loader);
 
@@ -241,15 +240,15 @@
    public void testMdrQualifierPointsFromHigherLevel() throws Exception
    {
       MemoryMetaDataLoader loader = new MemoryMetaDataLoader(ScopeKey.DEFAULT_SCOPE);
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.REQUIRED, QualifierPoint.CONSTRUCTOR, new HashSet<Object>(Collections.singleton("rc")));
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.REQUIRED, QualifierPoint.METHOD, new HashSet<Object>(Collections.singleton("rm")));
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.REQUIRED, QualifierPoint.PROPERTY, new HashSet<Object>(Collections.singleton("rp")));
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.REQUIRED, null, new HashSet<Object>(Collections.singleton("ra")));
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.REQUIRED, QualifierPoint.CONSTRUCTOR, "rc");
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.REQUIRED, QualifierPoint.METHOD, "rm");
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.REQUIRED, QualifierPoint.PROPERTY, "rp");
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.REQUIRED, null, "ra");
 
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.OPTIONAL, QualifierPoint.CONSTRUCTOR, new HashSet<Object>(Collections.singleton("oc")));
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.OPTIONAL, QualifierPoint.METHOD, new HashSet<Object>(Collections.singleton("om")));
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.OPTIONAL, QualifierPoint.PROPERTY, new HashSet<Object>(Collections.singleton("op")));
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.OPTIONAL, null, new HashSet<Object>(Collections.singleton("oa")));
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.OPTIONAL, QualifierPoint.CONSTRUCTOR, "oc");
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.OPTIONAL, QualifierPoint.METHOD, "om");
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.OPTIONAL, QualifierPoint.PROPERTY, "op");
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.OPTIONAL, null, "oa");
       
       getMetaDataRepository().getMetaDataRepository().addMetaDataRetrieval(loader);
       
@@ -675,7 +674,7 @@
    public void testSuppliedQualifiersFromHigherLevel() throws Throwable
    {
       MemoryMetaDataLoader loader = new MemoryMetaDataLoader(ScopeKey.DEFAULT_SCOPE);
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.SUPPLIED, null, new HashSet<Object>(Collections.singleton("test")));
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.SUPPLIED, null, "test");
       getMetaDataRepository().getMetaDataRepository().addMetaDataRetrieval(loader);
 
       BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
@@ -703,7 +702,7 @@
    public void testSuppliedQualifiersFromHigherLevelAndInstance() throws Throwable
    {
       MemoryMetaDataLoader loader = new MemoryMetaDataLoader(ScopeKey.DEFAULT_SCOPE);
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.SUPPLIED, null, new HashSet<Object>(Collections.singleton("test")));
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.SUPPLIED, null, "test");
       getMetaDataRepository().getMetaDataRepository().addMetaDataRetrieval(loader);
 
       BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());
@@ -801,7 +800,7 @@
    public void testOptionalQualifiersFromHigherLevelResolvingInstanceAmbiguity() throws Throwable
    {
       MemoryMetaDataLoader loader = new MemoryMetaDataLoader(ScopeKey.DEFAULT_SCOPE);
-      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.OPTIONAL, null, new HashSet<Object>(Collections.singleton("test")));
+      QualifiersMdrUtil.addQualifiersToMdrRetrieval(loader, QualifierType.OPTIONAL, null, "test");
       getMetaDataRepository().getMetaDataRepository().addMetaDataRetrieval(loader);
 
       BeanMetaDataBuilder bean1Builder = BeanMetaDataBuilder.createBuilder("bean1", Bean.class.getName());

Added: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/test/QualifiersAnnotatedTestCase.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/test/QualifiersAnnotatedTestCase.java	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/test/QualifiersAnnotatedTestCase.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,291 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors. 
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/ 
+package org.jboss.test.kernel.qualifiers.test;
+
+import junit.framework.Test;
+
+import org.jboss.beans.metadata.api.model.QualifierType;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.kernel.plugins.dependency.QualifiersMdrUtil;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.test.kernel.junit.MicrocontainerTest;
+import org.jboss.test.kernel.qualifiers.support.AnnotatedBeanA;
+import org.jboss.test.kernel.qualifiers.support.AnnotatedBeanB;
+import org.jboss.test.kernel.qualifiers.support.AnnotatedBeanC;
+import org.jboss.test.kernel.qualifiers.support.AnnotatedIgnoreTargetAllBean;
+import org.jboss.test.kernel.qualifiers.support.AnnotatedTargetAllBean;
+import org.jboss.test.kernel.qualifiers.support.Bean;
+import org.jboss.test.kernel.qualifiers.support.TargetAllBean;
+
+/**
+ * 
+ * @author <a href="kabir.khan at jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class QualifiersAnnotatedTestCase extends MicrocontainerTest
+{
+   public QualifiersAnnotatedTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(QualifiersAnnotatedTestCase.class);
+   }
+
+   public void testAnnotationInjectBeanQualifierAnnotations() throws Throwable
+   {
+      BeanMetaDataBuilder beanABuilder = BeanMetaDataBuilder.createBuilder("beanA", AnnotatedBeanA.class.getName());
+      KernelControllerContext beanACtx = deploy(beanABuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder beanBBuilder = BeanMetaDataBuilder.createBuilder("beanB", AnnotatedBeanB.class.getName());
+      KernelControllerContext beanBCtx = deploy(beanBBuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder beanCBuilder = BeanMetaDataBuilder.createBuilder("beanC", AnnotatedBeanC.class.getName());
+      KernelControllerContext beanCCtx = deploy(beanCBuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder targetBuilder = BeanMetaDataBuilder.createBuilder("target", AnnotatedTargetAllBean.class.getName());
+      KernelControllerContext targetCtx = deploy(targetBuilder.getBeanMetaData());
+      
+      try
+      {
+         Bean beanA = assertBean("beanA", Bean.class);
+         Bean beanB = assertBean("beanB", Bean.class);
+         Bean beanC = assertBean("beanC", Bean.class);
+         AnnotatedTargetAllBean target = assertBean("target", AnnotatedTargetAllBean.class);
+         assertNotNull(target.getConstructorBean());
+         assertNotNull(target.getFieldBean());
+         assertNotNull(target.getMethodBean());
+         assertEquals(beanA, target.getConstructorBean());
+         assertEquals(beanB, target.getFieldBean());
+         assertEquals(beanC, target.getMethodBean());
+      }
+      finally
+      {
+         undeploy(targetCtx);
+         undeploy(beanACtx);
+         undeploy(beanBCtx);
+         undeploy(beanCCtx);
+      }
+   }
+   
+   
+   public void testXmlInjectAnnotationBeanQualifierAnnotationss() throws Throwable
+   {
+      Bean beanA = assertBean("beanA", Bean.class);
+      Bean beanB = assertBean("beanB", Bean.class);
+      Bean beanC = assertBean("beanC", Bean.class);
+      TargetAllBean target = assertBean("target", TargetAllBean.class);
+      assertNotNull(target.getConstructorBean());
+      assertNotNull(target.getFieldBean());
+      assertNotNull(target.getMethodBean());
+      assertEquals(beanA, target.getConstructorBean());
+      assertEquals(beanB, target.getFieldBean());
+      assertEquals(beanC, target.getMethodBean());
+   }
+   
+   public void testAnnotationInjectBeanQualifierAnnotationsIgnoringBeanLevelQualifiers() throws Throwable
+   {
+      BeanMetaDataBuilder beanABuilder = BeanMetaDataBuilder.createBuilder("beanA", AnnotatedBeanA.class.getName());
+      KernelControllerContext beanACtx = deploy(beanABuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder beanBBuilder = BeanMetaDataBuilder.createBuilder("beanB", AnnotatedBeanB.class.getName());
+      KernelControllerContext beanBCtx = deploy(beanBBuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder beanCBuilder = BeanMetaDataBuilder.createBuilder("beanC", AnnotatedBeanC.class.getName());
+      KernelControllerContext beanCCtx = deploy(beanCBuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder targetBuilder = BeanMetaDataBuilder.createBuilder("target", AnnotatedIgnoreTargetAllBean.class.getName());
+      targetBuilder.addQualifiers(QualifierType.REQUIRED, "ignored");
+      KernelControllerContext targetCtx = deploy(targetBuilder.getBeanMetaData());
+      
+      try
+      {
+         Bean beanA = assertBean("beanA", Bean.class);
+         Bean beanB = assertBean("beanB", Bean.class);
+         Bean beanC = assertBean("beanC", Bean.class);
+         AnnotatedIgnoreTargetAllBean target = assertBean("target", AnnotatedIgnoreTargetAllBean.class);
+         assertNotNull(target.getConstructorBean());
+         assertNotNull(target.getFieldBean());
+         assertNotNull(target.getMethodBean());
+         assertEquals(beanA, target.getConstructorBean());
+         assertEquals(beanB, target.getFieldBean());
+         assertEquals(beanC, target.getMethodBean());
+      }
+      finally
+      {
+         undeploy(targetCtx);
+         undeploy(beanACtx);
+         undeploy(beanBCtx);
+         undeploy(beanCCtx);
+      }
+   }
+
+   public void testAnnotationInjectBeanQualifierAnnotationsNotIgnoringBeanLevelQualifiers() throws Throwable
+   {
+      BeanMetaDataBuilder beanABuilder = BeanMetaDataBuilder.createBuilder("beanA", AnnotatedBeanA.class.getName());
+      beanABuilder.addQualifiers(QualifierType.SUPPLIED, "test", "test1");
+      KernelControllerContext beanACtx = deploy(beanABuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder beanBBuilder = BeanMetaDataBuilder.createBuilder("beanB", AnnotatedBeanB.class.getName());
+      beanBBuilder.addQualifiers(QualifierType.SUPPLIED, "test", "test2");
+      KernelControllerContext beanBCtx = deploy(beanBBuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder beanCBuilder = BeanMetaDataBuilder.createBuilder("beanC", AnnotatedBeanC.class.getName());
+      beanCBuilder.addQualifiers(QualifierType.SUPPLIED, "test", "test3");
+      KernelControllerContext beanCCtx = deploy(beanCBuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder targetBuilder = BeanMetaDataBuilder.createBuilder("target", AnnotatedTargetAllBean.class.getName());
+      targetBuilder.addQualifiers(QualifierType.REQUIRED, "test");
+      targetBuilder.addQualifiers(QualifierType.OPTIONAL, "test1", "test2", "test3");
+      KernelControllerContext targetCtx = deploy(targetBuilder.getBeanMetaData());
+      
+      try
+      {
+         Bean beanA = assertBean("beanA", Bean.class);
+         Bean beanB = assertBean("beanB", Bean.class);
+         Bean beanC = assertBean("beanC", Bean.class);
+         AnnotatedTargetAllBean target = assertBean("target", AnnotatedTargetAllBean.class);
+         assertNotNull(target.getConstructorBean());
+         assertNotNull(target.getFieldBean());
+         assertNotNull(target.getMethodBean());
+         assertEquals(beanA, target.getConstructorBean());
+         assertEquals(beanB, target.getFieldBean());
+         assertEquals(beanC, target.getMethodBean());
+      }
+      finally
+      {
+         undeploy(targetCtx);
+         undeploy(beanACtx);
+         undeploy(beanBCtx);
+         undeploy(beanCCtx);
+      }
+   }
+
+   public void testAnnotationConstructorInjectBeanQualifierAnnotationsNotIgnoringBeanLevelQualifiers() throws Throwable
+   {
+      BeanMetaDataBuilder beanABuilder = BeanMetaDataBuilder.createBuilder("beanA", AnnotatedBeanA.class.getName());
+      beanABuilder.addQualifiers(QualifierType.SUPPLIED, "test1");
+      KernelControllerContext beanACtx = deploy(beanABuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder beanBBuilder = BeanMetaDataBuilder.createBuilder("beanB", AnnotatedBeanB.class.getName());
+      beanBBuilder.addQualifiers(QualifierType.SUPPLIED, "test", "test2");
+      KernelControllerContext beanBCtx = deploy(beanBBuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder beanCBuilder = BeanMetaDataBuilder.createBuilder("beanC", AnnotatedBeanC.class.getName());
+      beanCBuilder.addQualifiers(QualifierType.SUPPLIED, "test", "test3");
+      KernelControllerContext beanCCtx = deploy(beanCBuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder targetBuilder = BeanMetaDataBuilder.createBuilder("target", AnnotatedTargetAllBean.class.getName());
+      targetBuilder.addQualifiers(QualifierType.REQUIRED, "test");
+      targetBuilder.addQualifiers(QualifierType.OPTIONAL, "test1", "test2", "test3");
+      KernelControllerContext targetCtx = deploy(targetBuilder.getBeanMetaData());
+      
+      try
+      {
+         assertBean("beanA", Bean.class);
+         assertBean("beanB", Bean.class);
+         assertBean("beanC", Bean.class);
+         assertNoBean("target");
+      }
+      finally
+      {
+         undeploy(targetCtx);
+         undeploy(beanACtx);
+         undeploy(beanBCtx);
+         undeploy(beanCCtx);
+      }
+   }
+
+   public void testAnnotationPropertyInjectBeanQualifierAnnotationsNotIgnoringBeanLevelQualifiers() throws Throwable
+   {
+      BeanMetaDataBuilder beanABuilder = BeanMetaDataBuilder.createBuilder("beanA", AnnotatedBeanA.class.getName());
+      beanABuilder.addQualifiers(QualifierType.SUPPLIED, "test", "test1");
+      KernelControllerContext beanACtx = deploy(beanABuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder beanBBuilder = BeanMetaDataBuilder.createBuilder("beanB", AnnotatedBeanB.class.getName());
+      beanBBuilder.addQualifiers(QualifierType.SUPPLIED, "test2");
+      KernelControllerContext beanBCtx = deploy(beanBBuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder beanCBuilder = BeanMetaDataBuilder.createBuilder("beanC", AnnotatedBeanC.class.getName());
+      beanCBuilder.addQualifiers(QualifierType.SUPPLIED, "test", "test3");
+      KernelControllerContext beanCCtx = deploy(beanCBuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder targetBuilder = BeanMetaDataBuilder.createBuilder("target", AnnotatedTargetAllBean.class.getName());
+      targetBuilder.addQualifiers(QualifierType.REQUIRED, "test");
+      targetBuilder.addQualifiers(QualifierType.OPTIONAL, "test1", "test2", "test3");
+      KernelControllerContext targetCtx = deploy(targetBuilder.getBeanMetaData());
+      
+      try
+      {
+         assertBean("beanA", Bean.class);
+         assertBean("beanB", Bean.class);
+         assertBean("beanC", Bean.class);
+         assertNoBean("target");
+      }
+      finally
+      {
+         undeploy(targetCtx);
+         undeploy(beanACtx);
+         undeploy(beanBCtx);
+         undeploy(beanCCtx);
+      }
+   }
+
+   public void testAnnotationMethodInjectBeanQualifierAnnotationsNotIgnoringBeanLevelQualifiers() throws Throwable
+   {
+      BeanMetaDataBuilder beanABuilder = BeanMetaDataBuilder.createBuilder("beanA", AnnotatedBeanA.class.getName());
+      beanABuilder.addQualifiers(QualifierType.SUPPLIED, "test", "test1");
+      KernelControllerContext beanACtx = deploy(beanABuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder beanBBuilder = BeanMetaDataBuilder.createBuilder("beanB", AnnotatedBeanB.class.getName());
+      beanBBuilder.addQualifiers(QualifierType.SUPPLIED, "test", "test2");
+      KernelControllerContext beanBCtx = deploy(beanBBuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder beanCBuilder = BeanMetaDataBuilder.createBuilder("beanC", AnnotatedBeanC.class.getName());
+      beanCBuilder.addQualifiers(QualifierType.SUPPLIED, "test3");
+      KernelControllerContext beanCCtx = deploy(beanCBuilder.getBeanMetaData());
+      
+      BeanMetaDataBuilder targetBuilder = BeanMetaDataBuilder.createBuilder("target", AnnotatedTargetAllBean.class.getName());
+      targetBuilder.addQualifiers(QualifierType.REQUIRED, "test");
+      targetBuilder.addQualifiers(QualifierType.OPTIONAL, "test1", "test2", "test3");
+      KernelControllerContext targetCtx = deploy(targetBuilder.getBeanMetaData());
+      
+      try
+      {
+         assertBean("beanA", Bean.class);
+         assertBean("beanB", Bean.class);
+         assertBean("beanC", Bean.class);
+         assertNoBean("target");
+      }
+      finally
+      {
+         undeploy(targetCtx);
+         undeploy(beanACtx);
+         undeploy(beanBCtx);
+         undeploy(beanCCtx);
+      }
+   }
+}
+
+

Modified: projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/test/QualifiersTestSuite.java
===================================================================
--- projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/test/QualifiersTestSuite.java	2009-12-14 16:16:18 UTC (rev 97792)
+++ projects/kernel/trunk/kernel/src/test/java/org/jboss/test/kernel/qualifiers/test/QualifiersTestSuite.java	2009-12-14 17:14:43 UTC (rev 97793)
@@ -42,6 +42,7 @@
       suite.addTest(BeanQualifiersTestCase.suite());
       suite.addTest(InjectionPointQualifiersTestCase.suite());
       suite.addTest(QualifiersXmlTestCase.suite());
+      suite.addTest(QualifiersAnnotatedTestCase.suite());
 
       return suite;
    }

Added: projects/kernel/trunk/kernel/src/test/resources/org/jboss/test/kernel/qualifiers/test/QualifiersAnnotatedTestCase#testXmlInjectAnnotationBeanQualifierAnnotationss.xml
===================================================================
--- projects/kernel/trunk/kernel/src/test/resources/org/jboss/test/kernel/qualifiers/test/QualifiersAnnotatedTestCase#testXmlInjectAnnotationBeanQualifierAnnotationss.xml	                        (rev 0)
+++ projects/kernel/trunk/kernel/src/test/resources/org/jboss/test/kernel/qualifiers/test/QualifiersAnnotatedTestCase#testXmlInjectAnnotationBeanQualifierAnnotationss.xml	2009-12-14 17:14:43 UTC (rev 97793)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+   
+   <bean name="beanA" class="org.jboss.test.kernel.qualifiers.support.Bean">
+      <annotation>@org.jboss.test.kernel.qualifiers.support.Qualifier1</annotation>
+   </bean>
+
+   <bean name="beanB" class="org.jboss.test.kernel.qualifiers.support.Bean">
+      <annotation>@org.jboss.test.kernel.qualifiers.support.Qualifier2</annotation>
+   </bean>
+
+   <bean name="beanC" class="org.jboss.test.kernel.qualifiers.support.Bean">
+      <annotation>@org.jboss.test.kernel.qualifiers.support.Qualifier3</annotation>
+   </bean>
+
+   <bean name="target" class="org.jboss.test.kernel.qualifiers.support.TargetAllBean">
+      <constructor>
+         <parameter>
+            <annotation>@org.jboss.test.kernel.qualifiers.support.Qualifier1</annotation>
+            <inject/>
+         </parameter>
+      </constructor>
+      <property name="fieldBean">
+         <annotation>@org.jboss.beans.metadata.api.annotations.Inject</annotation>
+         <annotation>@org.jboss.test.kernel.qualifiers.support.Qualifier2</annotation>
+         <inject/>
+      </property>
+      <install method="installBean">
+         <parameter>
+            <annotation>@org.jboss.beans.metadata.api.annotations.Inject</annotation>
+            <annotation>@org.jboss.test.kernel.qualifiers.support.Qualifier3</annotation>
+            <inject/>
+         </parameter>
+      </install>
+   </bean>
+   
+</deployment>




More information about the jboss-cvs-commits mailing list