[Jboss-cvs] JBossAS SVN: r55931 - in projects/microcontainer/trunk/kernel/src: main/org/jboss/beans/metadata main/org/jboss/beans/metadata/plugins main/org/jboss/beans/metadata/spi/annotations main/org/jboss/kernel/plugins main/org/jboss/kernel/plugins/dependency main/org/jboss/kernel/plugins/deployment/xml resources/org/jboss/test/kernel/inject/test resources/schema tests/org/jboss/test/kernel/inject/support tests/org/jboss/test/kernel/inject/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 15 05:31:43 EDT 2006


Author: alesj
Date: 2006-08-15 05:31:02 -0400 (Tue, 15 Aug 2006)
New Revision: 55931

Added:
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/InjectionType.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/UpdateableDependencyItem.java
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/IllegalParameterContextualInjection.xml
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/IllegalParameterContextualInjectionTestCase.java
Removed:
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/injection/
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/InjectMode.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/injection/
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnMultipleNameLooseTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnMultipleTypeLooseTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnNullNameLooseTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnNullTypeLooseTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnSingleNameLooseTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnSingleTypeLooseTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/MultipleNameLooseTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/MultipleTypeLooseTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/NullNameLooseTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/NullTypeLooseTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/SingleNameLooseTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/SingleTypeLooseTestCase.xml
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/AnnotatedNameLooseSimpleTestObject.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/AnnotatedTypeLooseSimpleTestObject.java
Modified:
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/Inject.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/InjectType.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ConfigureAction.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/DescribeAction.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelControllerContextAction.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBinding.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/InjectionHandler.java
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnMultipleTypeStrictTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/MultipleTypeStrictTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/SingleTypeStrictTestCase.xml
   projects/microcontainer/trunk/kernel/src/resources/schema/bean-deployer_1_0.xsd
   projects/microcontainer/trunk/kernel/src/resources/schema/bean-deployer_2_0.xsd
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/AnnotatedNameStrictSimpleTestObject.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/ContextualInjectionTestSuite.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/PropertyContextualInjectionTestCase.java
Log:
Rewrite - added dependency (class demand / instantiation supply) - currently only xml support.

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -359,6 +359,10 @@
    
    public Set<SupplyMetaData> getSupplies()
    {
+      if (supplies == null)
+      {
+         supplies = new HashSet<SupplyMetaData>();
+      }
       return supplies;
    }
    

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -21,16 +21,21 @@
 */
 package org.jboss.beans.metadata.plugins;
 
+import java.util.Iterator;
 import java.util.Set;
 
-import org.jboss.beans.metadata.injection.InjectionMode;
-import org.jboss.beans.metadata.injection.InjectionType;
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.info.spi.PropertyInfo;
+import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.beans.metadata.spi.MetaDataVisitor;
+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.DependencyItem;
+import org.jboss.kernel.plugins.dependency.UpdateableDependencyItem;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.kernel.plugins.injection.InjectionUtil;
 import org.jboss.reflect.spi.TypeInfo;
 import org.jboss.util.JBossStringBuilder;
 
@@ -41,10 +46,8 @@
  */
 public class AbstractInjectionValueMetaData extends AbstractDependencyValueMetaData
 {
-   protected InjectionMode injectionMode = InjectionMode.BY_TYPE;
+   protected InjectionType injectionType = InjectionType.BY_CLASS;
 
-   protected InjectionType injectionType = InjectionType.STRICT;
-
    protected AbstractPropertyMetaData propertyMetaData;
 
    /**
@@ -75,16 +78,6 @@
       super(value, property);
    }
 
-   public InjectionMode getInjectionMode()
-   {
-      return injectionMode;
-   }
-
-   public void setInjectionMode(InjectionMode injectionMode)
-   {
-      this.injectionMode = injectionMode;
-   }
-
    public InjectionType getInjectionType()
    {
       return injectionType;
@@ -109,20 +102,29 @@
    {
       if (value == null)
       {
+         // this is by class injection
          ControllerState state = dependentState;
          if (state == null)
          {
             state = ControllerState.INSTALLED;
          }
          // what else to use here - if not info.getType?
-         return InjectionUtil.resolveInjection(
-               controller,
-               info.getType(),
-               null, // should not be used - value set before, see visit(MDV visitor)
-               state,
-               getInjectionMode(),
-               getInjectionType(),
-               this);
+         Set contexts = controller.getInstantiatedContexts(info.getType());
+         int numberOfMatchingBeans = 0;
+         if (contexts != null)
+         {
+            numberOfMatchingBeans = contexts.size();
+         }
+         if (numberOfMatchingBeans != 1)
+         {
+            throw new Error(
+                  "Should not be here, illegas size of matching contexts ("
+                        + numberOfMatchingBeans + ") - dependency failed! " + this);
+         }
+         ControllerContext context = (ControllerContext) contexts.iterator().next();
+         // todo - should we do this?
+         controller.change(context, state);
+         return context.getTarget();
       }
       return super.getValue(info, cl);
    }
@@ -139,26 +141,31 @@
             log.warn("Ignoring property - contextual injection: " + this);
          }
 
-         if (InjectionMode.BY_NAME.equals(injectionMode))
+         if (InjectionType.BY_NAME.equals(injectionType))
          {
             if (propertyMetaData == null)
             {
-               throw new IllegalArgumentException("Illegal usage of mode ByName - injection not used with property = " + this);
+               throw new IllegalArgumentException("Illegal usage of type ByName - injection not used with property = " + this);
             }
             setValue(propertyMetaData.getName());
          }
-         else if (InjectionMode.BY_TYPE.equals(injectionMode))
+         else if (InjectionType.BY_CLASS.equals(injectionType))
          {
             // set controller
-            KernelControllerContext controllerContext = visitor.getControllerContext();
-            controller = (KernelController) controllerContext.getController();
+            KernelControllerContext context = visitor.getControllerContext();
+            controller = (KernelController) context.getController();
+            if (propertyMetaData != null)
+            {
+               DependencyItem item = new PropertyPlaceholderDependencyItem(context.getName(), propertyMetaData.getName());
+               visitor.addDependency(item);
+            }
             visitor.visit(this); // as in AbstractValueMetaData
             // skip AbstractDependencyVMD.visit() - no value defined
             return;
          }
          else
          {
-            throw new IllegalArgumentException("Unknown injection mode=" + injectionMode);
+            throw new IllegalArgumentException("Unknown injection type=" + injectionType);
          }
       }
       super.visit(visitor);
@@ -167,11 +174,74 @@
    public void toString(JBossStringBuilder buffer)
    {
       super.toString(buffer);
-      if (injectionMode != null)
-         buffer.append(" injectionMode=").append(injectionMode);
       if (injectionType != null)
          buffer.append(" injectionType=").append(injectionType);
       if (propertyMetaData != null)
          buffer.append(" propertyMetaData=").append(propertyMetaData.getName()); //else overflow - indefinite recursion
    }
+
+   public class PropertyPlaceholderDependencyItem extends AbstractDependencyItem implements UpdateableDependencyItem
+   {
+      private String propertyName;
+      private Class demandClass;
+
+      public PropertyPlaceholderDependencyItem(Object name, String propertyName)
+      {
+         super(name, null, ControllerState.CONFIGURED, dependentState);
+         this.propertyName = propertyName;
+      }
+
+      public void update(BeanMetaData metaData, BeanInfo info)
+      {
+         Set propertyInfos = info.getProperties();
+         if (propertyInfos != null)
+         {
+            for (Iterator it = propertyInfos.iterator(); it.hasNext();)
+            {
+               PropertyInfo pi = (PropertyInfo) it.next();
+               if (propertyName.equals(pi.getName()))
+               {
+                  demandClass = pi.getType().getType();
+                  break;
+               }
+            }
+         }
+      }
+
+      public boolean resolve(Controller controller)
+      {
+         if (demandClass != null)
+         {
+            ControllerContext context = controller.getInstalledContext(demandClass);
+            if (context != null)
+            {
+               setIDependOn(context.getName());
+               addDependsOnMe(controller, context);
+               setResolved(true);
+            }
+            else
+            {
+               setResolved(false);
+            }
+         }
+         else
+         {
+            setResolved(true);
+         }
+         return isResolved();
+      }
+
+      public void toString(JBossStringBuilder buffer)
+      {
+         super.toString(buffer);
+         buffer.append(" demandClass=").append(demandClass);
+      }
+
+      public void toShortString(JBossStringBuilder buffer)
+      {
+         buffer.append(getName()).append(" demands ").append(demandClass);
+      }
+
+   }
+
 }

Copied: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/InjectionType.java (from rev 55872, projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/injection/InjectionType.java)
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/injection/InjectionType.java	2006-08-14 13:24:38 UTC (rev 55872)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/InjectionType.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -0,0 +1,81 @@
+/*
+* 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.beans.metadata.plugins;
+
+import org.jboss.util.JBossObject;
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
+ */
+public class InjectionType extends JBossObject
+{
+   /** Strict */
+   public static final InjectionType BY_CLASS = new InjectionType("ByClass");
+
+   /** Loose */
+   public static final InjectionType BY_NAME = new InjectionType("ByName");
+
+   /** The type string */
+   protected final String typeString;
+
+   /**
+    * Create a new state
+    *
+    * @param modeString the string representation
+    */
+   public InjectionType(String typeString)
+   {
+      if (typeString == null)
+         throw new IllegalArgumentException("Null type string");
+      this.typeString = typeString;
+   }
+
+   /**
+    * Get the state string
+    *
+    * @return the state string
+    */
+   public String getTypeString()
+   {
+      return typeString;
+   }
+
+   public boolean equals(Object object)
+   {
+      if (object == null || object instanceof InjectionType == false)
+         return false;
+      InjectionType other = (InjectionType) object;
+      return typeString.equals(other.getTypeString());
+   }
+
+   public void toString(JBossStringBuilder buffer)
+   {
+      buffer.append(typeString);
+   }
+
+   protected int getHashCode()
+   {
+      return typeString.hashCode();
+   }
+
+}

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/Inject.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/Inject.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/Inject.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -43,8 +43,6 @@
 
    String state() default "Installed";
 
-   InjectMode mode() default InjectMode.BY_TYPE;
+   InjectType type() default InjectType.BY_CLASS;
 
-   InjectType type() default InjectType.STRICT;
-
 }

Deleted: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/InjectMode.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/InjectMode.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/InjectMode.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,44 +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.beans.metadata.spi.annotations;
-
-/**
- * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
- */
-public enum InjectMode
-{
-   BY_TYPE("ByType"),
-   BY_NAME("ByName");
-
-   private String modeString;
-
-   InjectMode(String modeString)
-   {
-      this.modeString = modeString;
-   }
-
-   public String toString()
-   {
-      return modeString;
-   }
-
-}

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/InjectType.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/InjectType.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/spi/annotations/InjectType.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -26,8 +26,8 @@
  */
 public enum InjectType
 {
-   STRICT("Strict"),
-   LOOSE("Loose");
+   BY_CLASS("ByClass"),
+   BY_NAME("ByName");
 
    private String typeString;
 

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ConfigureAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ConfigureAction.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/ConfigureAction.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -25,22 +25,12 @@
 import java.util.Set;
 
 import org.jboss.beans.info.spi.BeanInfo;
-import org.jboss.beans.info.spi.PropertyInfo;
-import org.jboss.beans.metadata.injection.InjectionMode;
-import org.jboss.beans.metadata.injection.InjectionType;
 import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.ControllerState;
 import org.jboss.joinpoint.spi.TargettedJoinpoint;
 import org.jboss.kernel.Kernel;
-import org.jboss.kernel.plugins.injection.InjectionUtil;
 import org.jboss.kernel.spi.config.KernelConfigurator;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.kernel.spi.dependency.KernelControllerContext;
-import org.jboss.reflect.spi.AnnotationValue;
-import org.jboss.reflect.spi.EnumValue;
-import org.jboss.reflect.spi.MethodInfo;
-import org.jboss.reflect.spi.StringValue;
 
 /**
  * ConfigureAction.
@@ -58,11 +48,9 @@
 
       Object object = context.getTarget();
       BeanInfo info = context.getBeanInfo();
-      // todo injectWherePossible - alesj
       BeanMetaData metaData = context.getBeanMetaData();
       Set joinPoints = configurator.getPropertySetterJoinPoints(info, metaData);
       setAttributes(context, object, joinPoints, false);
-      resolveInjections(controller, info, object);
    }
 
    public void uninstallAction(KernelControllerContext context)
@@ -78,7 +66,6 @@
       {
          Set joinPoints = configurator.getPropertyNullerJoinPoints(info, metaData);
          setAttributes(context, object, joinPoints, true);
-         nullifyInjections(controller, info, object, true);
       }
       catch (Throwable t)
       {
@@ -125,108 +112,4 @@
       }
    }
 
-   protected void resolveInjections(KernelController controller, BeanInfo info, Object target) throws Throwable
-   {
-      Set<PropertyInfo> propertys = info.getProperties();
-      for (PropertyInfo pi : propertys)
-      {
-         MethodInfo setter = pi.getSetter();
-         if (setter != null)
-         {
-            // todo - better annotation handling ... multiple annotaions; alesj
-            AnnotationValue annotation = setter.getAnnotation("org.jboss.beans.metadata.spi.annotations.Inject");
-            if (annotation != null)
-            {
-               StringValue beanValue = (StringValue) annotation.getValue("bean");
-               StringValue propertyValue = (StringValue) annotation.getValue("property");
-               StringValue stateValue = (StringValue) annotation.getValue("state");
-               EnumValue modeValue = (EnumValue) annotation.getValue("mode");
-               EnumValue typeValue = (EnumValue) annotation.getValue("type");
-
-               String value = beanValue.getValue();
-               String bean = (value != null && value.length() > 0 ? value : null);
-               value = propertyValue.getValue();
-               String property = (value != null && value.length() > 0 ? value : null);
-               ControllerState state = new ControllerState(stateValue.getValue());
-               InjectionMode injectionMode = new InjectionMode(modeValue.getValue());
-               InjectionType injectionType = new InjectionType(typeValue.getValue());
-
-               Object result = null;
-               if (bean != null)
-               {
-                  ControllerContext context = controller.getContext(bean, state);
-                  if (context != null && context.getTarget() != null)
-                  {
-                     result = getResult(controller, context.getTarget(), property);
-                  }
-               }
-               else
-               {
-                  // check for property
-                  if (property != null)
-                  {
-                     log.warn("Ignoring property - contextual injection: " + pi);
-                  }
-                  result = InjectionUtil.resolveInjection(
-                        controller,
-                        pi.getType().getType(),
-                        pi.getName(),
-                        state,
-                        injectionMode,
-                        injectionType,
-                        pi
-                  );
-               }
-               setter.invoke(target, new Object[]{result});
-            }
-         }
-      }
-   }
-
-   protected Object getResult(KernelController controller, Object target, String property) throws Throwable
-   {
-      if (property != null)
-      {
-         KernelConfigurator configurator = controller.getKernel().getConfigurator();
-         BeanInfo beanInfo = configurator.getBeanInfo(target.getClass());
-         TargettedJoinpoint joinpoint = configurator.getPropertyGetterJoinPoint(beanInfo, property);
-         joinpoint.setTarget(target);
-         return joinpoint.dispatch();
-      }
-      return target;
-   }
-
-   protected void nullifyInjections(KernelController controller, BeanInfo info, Object target, boolean ignoreErrors) throws Throwable
-   {
-      Set<PropertyInfo> propertys = info.getProperties();
-      for (PropertyInfo pi : propertys)
-      {
-         MethodInfo setter = pi.getSetter();
-         if (setter != null)
-         {
-            // todo - better annotation handling ... multiple annotaions; alesj
-            AnnotationValue annotation = setter.getAnnotation("org.jboss.beans.metadata.spi.annotations.Inject");
-            if (annotation != null)
-            {
-               try
-               {
-                  setter.invoke(target, new Object[]{null});
-               }
-               catch (Throwable t)
-               {
-                  if (ignoreErrors)
-                  {
-                     if (log.isTraceEnabled())
-                        log.trace("Ignored for " + pi, t);
-                  }
-                  else
-                  {
-                     throw t;
-                  }
-               }
-            }
-         }
-      }
-   }
-
 }
\ No newline at end of file

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/DescribeAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/DescribeAction.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/DescribeAction.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -26,8 +26,10 @@
 import java.util.Set;
 
 import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.beans.metadata.plugins.AbstractSupplyMetaData;
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.beans.metadata.spi.PropertyMetaData;
+import org.jboss.beans.metadata.spi.SupplyMetaData;
 import org.jboss.dependency.plugins.AbstractDependencyItem;
 import org.jboss.dependency.spi.ControllerContext;
 import org.jboss.dependency.spi.ControllerState;
@@ -60,10 +62,19 @@
          BeanInfo info = configurator.getBeanInfo(metaData);
          context.setBeanInfo(info);
 
+         addClassSuppliers(metaData, info);
+
          info = addAnnotations(context, metaData, info);
 
+         DependencyInfo depends = context.getDependencyInfo();
+         // update 'placeholder' item with more info
+         Set updateableItems = depends.getIDependOn(UpdateableDependencyItem.class);
+         for(Iterator it = updateableItems.iterator(); it.hasNext();)
+         {
+            UpdateableDependencyItem updateableItem = (UpdateableDependencyItem) it.next();
+            updateableItem.update(metaData, info);
+         }
          // add custom dependencies (e.g. AOP layer).
-         DependencyInfo depends =   context.getDependencyInfo();
          List dependencies = info.getDependencies();
          if (dependencies != null)
          {
@@ -76,7 +87,7 @@
          }
       }
    }
-   
+
    public void uninstallAction(KernelControllerContext context)
    {
       context.setMetaDataContext(null);
@@ -166,4 +177,32 @@
       
       return metaCtx;
    }
+
+   /**
+    * Adds classes to supply for contextual injection.
+    *
+    * @param metaData
+    * @param info
+    */
+   private void addClassSuppliers(BeanMetaData metaData, BeanInfo info)
+   {
+      traverseBeanClass(metaData, info.getClassInfo().getType());
+   }
+
+   private void traverseBeanClass(BeanMetaData metaData, Class clazz)
+   {
+      if (clazz == null || clazz == Object.class)
+      {
+         return;
+      }
+      Set<SupplyMetaData> supplies = metaData.getSupplies();
+      supplies.add(new AbstractSupplyMetaData(clazz));
+      traverseBeanClass(metaData, clazz.getSuperclass());
+      Class[] intfaces = clazz.getInterfaces();
+      for(Class intface : intfaces)
+      {
+         traverseBeanClass(metaData, intface);
+      }
+   }
+
 }
\ No newline at end of file

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelControllerContextAction.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelControllerContextAction.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/KernelControllerContextAction.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -21,11 +21,7 @@
 */
 package org.jboss.kernel.plugins.dependency;
 
-import java.security.AccessControlContext;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
+import java.security.*;
 
 import org.jboss.beans.metadata.spi.BeanMetaData;
 import org.jboss.dependency.plugins.spi.action.ControllerContextAction;

Added: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/UpdateableDependencyItem.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/UpdateableDependencyItem.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/dependency/UpdateableDependencyItem.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -0,0 +1,34 @@
+/*
+* 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.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.dependency.spi.DependencyItem;
+
+/**
+ * @author <a href="mailto:ales.justin at genera-lynx.com">Ales Justin</a>
+ */
+public interface UpdateableDependencyItem extends DependencyItem
+{
+   void update(BeanMetaData metaData, BeanInfo info);
+}

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBinding.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBinding.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/BeanSchemaBinding.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -39,8 +39,7 @@
 import org.jboss.beans.metadata.spi.PropertyMetaData;
 import org.jboss.beans.metadata.spi.SupplyMetaData;
 import org.jboss.beans.metadata.spi.ValueMetaData;
-import org.jboss.beans.metadata.injection.InjectionMode;
-import org.jboss.beans.metadata.injection.InjectionType;
+import org.jboss.beans.metadata.plugins.InjectionType;
 import org.jboss.dependency.spi.ControllerMode;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.kernel.plugins.deployment.AbstractKernelDeployment;
@@ -974,8 +973,6 @@
                   injection.setProperty(attrs.getValue(i));
                else if ("state".equals(localName))
                   injection.setDependentState(new ControllerState(attrs.getValue(i)));
-               else if ("mode".equals(localName))
-                  injection.setInjectionMode(new InjectionMode(attrs.getValue(i)));
                else if ("type".equals(localName))
                   injection.setInjectionType(new InjectionType(attrs.getValue(i)));
             }

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/InjectionHandler.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/InjectionHandler.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/deployment/xml/InjectionHandler.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -7,14 +7,12 @@
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.namespace.QName;
 
-import org.jboss.beans.metadata.injection.InjectionMode;
-import org.jboss.beans.metadata.injection.InjectionType;
+import org.jboss.beans.metadata.plugins.InjectionType;
 import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
 import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
 import org.jboss.dependency.spi.ControllerState;
 import org.jboss.xb.binding.sunday.unmarshalling.DefaultElementHandler;
 import org.jboss.xb.binding.sunday.unmarshalling.ElementBinding;
-import org.jboss.logging.Logger;
 import org.xml.sax.Attributes;
 
 /**
@@ -51,8 +49,6 @@
             injection.setProperty(attrs.getValue(i));
          else if ("state".equals(localName))
             injection.setDependentState(new ControllerState(attrs.getValue(i)));
-         else if ("mode".equals(localName))
-            injection.setInjectionMode(new InjectionMode(attrs.getValue(i)));
          else if ("type".equals(localName))
             injection.setInjectionType(new InjectionType(attrs.getValue(i)));
       }

Deleted: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnMultipleNameLooseTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnMultipleNameLooseTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnMultipleNameLooseTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
-            xmlns="urn:jboss:bean-deployer">
-
-   <bean name="testerInterface" class="org.jboss.test.kernel.inject.support.SingletonTester"/>
-
-   <bean name="duplicateInterface" class="org.jboss.test.kernel.inject.support.DuplicateTester"/>
-
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.AnnotatedNameLooseSimpleTestObject" />
-
-</deployment>

Deleted: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnMultipleTypeLooseTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnMultipleTypeLooseTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnMultipleTypeLooseTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
-            xmlns="urn:jboss:bean-deployer">
-
-   <bean name="testerInterface" class="org.jboss.test.kernel.inject.support.SingletonTester"/>
-
-   <bean name="duplicateInterface" class="org.jboss.test.kernel.inject.support.DuplicateTester"/>
-
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.AnnotatedTypeLooseSimpleTestObject" />
-
-</deployment>

Modified: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnMultipleTypeStrictTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnMultipleTypeStrictTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnMultipleTypeStrictTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -4,10 +4,10 @@
             xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
             xmlns="urn:jboss:bean-deployer">
 
-   <bean name="testerInterface" class="org.jboss.test.kernel.inject.support.SingletonTester"/>
-
    <bean name="duplicateInterface" class="org.jboss.test.kernel.inject.support.DuplicateTester"/>
 
    <bean name="testObject" class="org.jboss.test.kernel.inject.support.AnnotatedTypeStrictSimpleTestObject" />
 
+   <bean name="testerInterface" class="org.jboss.test.kernel.inject.support.SingletonTester"/>
+
 </deployment>

Deleted: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnNullNameLooseTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnNullNameLooseTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnNullNameLooseTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
-            xmlns="urn:jboss:bean-deployer">
-
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.AnnotatedNameLooseSimpleTestObject" />
-
-</deployment>

Deleted: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnNullTypeLooseTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnNullTypeLooseTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnNullTypeLooseTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
-            xmlns="urn:jboss:bean-deployer">
-
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.AnnotatedTypeLooseSimpleTestObject" />
-
-</deployment>

Deleted: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnSingleNameLooseTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnSingleNameLooseTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnSingleNameLooseTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
-            xmlns="urn:jboss:bean-deployer">
-
-   <bean name="testerInterface" class="org.jboss.test.kernel.inject.support.DuplicateTester"/>
-
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.AnnotatedNameLooseSimpleTestObject" />
-
-</deployment>

Deleted: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnSingleTypeLooseTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnSingleTypeLooseTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/AnnSingleTypeLooseTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
-            xmlns="urn:jboss:bean-deployer">
-
-   <bean name="secondInterface" class="org.jboss.test.kernel.inject.support.DuplicateTester"/>
-
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.AnnotatedTypeLooseSimpleTestObject" />
-
-</deployment>

Added: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/IllegalParameterContextualInjection.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/IllegalParameterContextualInjection.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/IllegalParameterContextualInjection.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
+            xmlns="urn:jboss:bean-deployer">
+
+   <bean name="parameterObject1" class="org.jboss.test.kernel.inject.support.ParameterTestObject">
+      <constructor>
+         <parameter><inject/></parameter>
+      </constructor>
+   </bean>
+
+   <bean name="duplicateTester" class="org.jboss.test.kernel.inject.support.DuplicateTester"/>
+
+</deployment>

Deleted: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/MultipleNameLooseTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/MultipleNameLooseTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/MultipleNameLooseTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
-            xmlns="urn:jboss:bean-deployer">
-
-   <bean name="testerInterface" class="org.jboss.test.kernel.inject.support.SingletonTester"/>
-
-   <bean name="duplicateInterface" class="org.jboss.test.kernel.inject.support.DuplicateTester"/>
-
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.SimpleTestObject">
-      <property name="testerInterface"><inject mode="ByName" type="Loose"/></property>
-   </bean>
-
-</deployment>

Deleted: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/MultipleTypeLooseTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/MultipleTypeLooseTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/MultipleTypeLooseTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
-            xmlns="urn:jboss:bean-deployer">
-
-   <bean name="testerInterface" class="org.jboss.test.kernel.inject.support.SingletonTester"/>
-
-   <bean name="duplicateInterface" class="org.jboss.test.kernel.inject.support.DuplicateTester"/>
-
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.SimpleTestObject">
-      <property name="testerInterface"><inject type="Loose"/></property>
-   </bean>
-
-</deployment>

Modified: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/MultipleTypeStrictTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/MultipleTypeStrictTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/MultipleTypeStrictTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -4,12 +4,12 @@
             xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
             xmlns="urn:jboss:bean-deployer">
 
+   <bean name="testObject" class="org.jboss.test.kernel.inject.support.SimpleTestObject">
+      <property name="testerInterface"><inject/></property>
+   </bean>
+
    <bean name="testerInterface" class="org.jboss.test.kernel.inject.support.SingletonTester"/>
 
    <bean name="duplicateInterface" class="org.jboss.test.kernel.inject.support.DuplicateTester"/>
 
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.SimpleTestObject">
-      <property name="testerInterface"><inject/></property>
-   </bean>
-
 </deployment>

Deleted: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/NullNameLooseTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/NullNameLooseTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/NullNameLooseTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
-            xmlns="urn:jboss:bean-deployer">
-
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.SimpleTestObject">
-      <property name="testerInterface"><inject mode="ByName" type="Loose"/></property>
-   </bean>
-
-</deployment>

Deleted: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/NullTypeLooseTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/NullTypeLooseTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/NullTypeLooseTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
-            xmlns="urn:jboss:bean-deployer">
-
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.SimpleTestObject">
-      <property name="testerInterface"><inject type="Loose"/></property>
-   </bean>
-
-</deployment>

Deleted: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/SingleNameLooseTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/SingleNameLooseTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/SingleNameLooseTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
-            xmlns="urn:jboss:bean-deployer">
-
-   <bean name="testerInterface" class="org.jboss.test.kernel.inject.support.SingletonTester"/>
-
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.SimpleTestObject">
-      <property name="testerInterface"><inject mode="ByName" type="Loose"/></property>
-   </bean>
-
-</deployment>

Deleted: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/SingleTypeLooseTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/SingleTypeLooseTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/SingleTypeLooseTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
-            xmlns="urn:jboss:bean-deployer">
-
-   <bean name="duplicateInterface" class="org.jboss.test.kernel.inject.support.DuplicateTester"/>
-
-   <bean name="testObject" class="org.jboss.test.kernel.inject.support.SimpleTestObject">
-      <property name="testerInterface"><inject type="Loose"/></property>
-   </bean>
-
-</deployment>

Modified: projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/SingleTypeStrictTestCase.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/SingleTypeStrictTestCase.xml	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/org/jboss/test/kernel/inject/test/SingleTypeStrictTestCase.xml	2006-08-15 09:31:02 UTC (rev 55931)
@@ -4,10 +4,10 @@
             xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
             xmlns="urn:jboss:bean-deployer">
 
-   <bean name="duplicateInterface" class="org.jboss.test.kernel.inject.support.DuplicateTester"/>
-
    <bean name="testObject" class="org.jboss.test.kernel.inject.support.SimpleTestObject">
       <property name="testerInterface"><inject/></property>
    </bean>
 
+   <bean name="duplicateInterface" class="org.jboss.test.kernel.inject.support.DuplicateTester"/>
+
 </deployment>

Modified: projects/microcontainer/trunk/kernel/src/resources/schema/bean-deployer_1_0.xsd
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/schema/bean-deployer_1_0.xsd	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/schema/bean-deployer_1_0.xsd	2006-08-15 09:31:02 UTC (rev 55931)
@@ -271,28 +271,17 @@
               <property name="transactionManager"><inject/></property>
            </bean>
 
-           e.g. Contextual injection - finding at most one instance which matches property's class type
-           <bean name="InjectedIntoMe" ...>
-              <property name="transactionManager"><inject type="Loose"/></property>
-           </bean>
-
            e.g. Contextual injection - finding exactly one instance which matches property's name
            <bean name="InjectedIntoMe" ...>
-              <property name="transactionManager"><inject mode="ByName"/></property>
+              <property name="transactionManager"><inject type="ByName"/></property>
            </bean>
-
-           e.g. Contextual injection - finding at most one instance which matches property's name
-           <bean name="InjectedIntoMe" ...>
-              <property name="transactionManager"><inject mode="ByName" type="Loose"/></property>
-           </bean>
            ]]>
          </xsd:documentation>
       </xsd:annotation>
       <xsd:attribute name="bean" type="xsd:string" use="optional"/>
       <xsd:attribute name="property" type="xsd:string" use="optional"/>
       <xsd:attribute name="state" type="controllerStateType" use="optional"/>
-      <xsd:attribute name="mode" type="injectionModeType" use="optional" default="ByType"/>
-      <xsd:attribute name="type" type="injectionTypeType" use="optional" default="Strict"/>
+      <xsd:attribute name="type" type="injectionTypeType" use="optional" default="ByClass"/>
    </xsd:complexType>
 
    <xsd:complexType name="parameterType" mixed="true">
@@ -769,13 +758,13 @@
       </xsd:restriction>
    </xsd:simpleType>
 
-   <xsd:simpleType name="injectionModeType">
+   <xsd:simpleType name="injectionTypeType">
       <xsd:annotation>
          <xsd:documentation>
             <![CDATA[
-            You can set the type of lookup requirement - class type (ByType) or property name (ByName)
+            You can set the type of lookup requirement - class type (ByClass) or property name (ByName)
             Valid values include:
-            ByType (default)
+            ByClass (default)
             ByName
             ]]>
          </xsd:documentation>
@@ -785,23 +774,6 @@
       </xsd:restriction>
    </xsd:simpleType>
 
-   <xsd:simpleType name="injectionTypeType">
-      <xsd:annotation>
-         <xsd:documentation>
-            <![CDATA[
-            You can set what is the severity of injected bean not found.
-            When set to Strict (default) it will fail, else it will inject null.
-            Valid values include:
-            Strict
-            Loose
-            ]]>
-         </xsd:documentation>
-      </xsd:annotation>
-      <xsd:restriction base="xsd:string">
-         <xsd:whiteSpace value="collapse"/>
-      </xsd:restriction>
-   </xsd:simpleType>
-
    <!--
      WARN:
      Do not use this in the bean deployer, it won't work!

Modified: projects/microcontainer/trunk/kernel/src/resources/schema/bean-deployer_2_0.xsd
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/schema/bean-deployer_2_0.xsd	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/resources/schema/bean-deployer_2_0.xsd	2006-08-15 09:31:02 UTC (rev 55931)
@@ -327,28 +327,17 @@
               <property name="transactionManager"><inject/></property>
            </bean>
 
-           e.g. Contextual injection - finding at most one instance which matches property's class type
-           <bean name="InjectedIntoMe" ...>
-              <property name="transactionManager"><inject type="Loose"/></property>
-           </bean>
-
            e.g. Contextual injection - finding exactly one instance which matches property's name
            <bean name="InjectedIntoMe" ...>
-              <property name="transactionManager"><inject mode="ByName"/></property>
+              <property name="transactionManager"><inject type="ByName"/></property>
            </bean>
-
-           e.g. Contextual injection - finding at most one instance which matches property's name
-           <bean name="InjectedIntoMe" ...>
-              <property name="transactionManager"><inject mode="ByName" type="Loose"/></property>
-           </bean>
            ]]>
          </xsd:documentation>
       </xsd:annotation>
       <xsd:attribute name="bean" type="xsd:string" use="optional"/>
       <xsd:attribute name="property" type="xsd:string" use="optional"/>
       <xsd:attribute name="state" type="controllerStateType" use="optional"/>
-      <xsd:attribute name="mode" type="injectionModeType" use="optional" default="ByType"/>
-      <xsd:attribute name="type" type="injectionTypeType" use="optional" default="Strict"/>
+      <xsd:attribute name="type" type="injectionTypeType" use="optional" default="ByClass"/>
    </xsd:complexType>
 
    <xsd:complexType name="factoryType">
@@ -859,13 +848,13 @@
       </xsd:restriction>
    </xsd:simpleType>
 
-   <xsd:simpleType name="injectionModeType">
+   <xsd:simpleType name="injectionTypeType">
       <xsd:annotation>
          <xsd:documentation>
             <![CDATA[
-            You can set the type of lookup requirement - class type (ByType) or property name (ByName)
+            You can set the type of lookup requirement - class type (ByClass) or property name (ByName)
             Valid values include:
-            ByType (default)
+            ByClass (default)
             ByName
             ]]>
          </xsd:documentation>
@@ -875,23 +864,6 @@
       </xsd:restriction>
    </xsd:simpleType>
 
-   <xsd:simpleType name="injectionTypeType">
-      <xsd:annotation>
-         <xsd:documentation>
-            <![CDATA[
-            You can set what is the severity of injected bean not found.
-            When set to Strict (default) it will fail, else it will inject null.
-            Valid values include:
-            Strict
-            Loose
-            ]]>
-         </xsd:documentation>
-      </xsd:annotation>
-      <xsd:restriction base="xsd:string">
-         <xsd:whiteSpace value="collapse"/>
-      </xsd:restriction>
-   </xsd:simpleType>
-
    <!--
      WARN:
      Do not use this in the bean deployer, it won't work!

Deleted: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/AnnotatedNameLooseSimpleTestObject.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/AnnotatedNameLooseSimpleTestObject.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/AnnotatedNameLooseSimpleTestObject.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,40 +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.test.kernel.inject.support;
-
-import org.jboss.beans.metadata.spi.annotations.Inject;
-import org.jboss.beans.metadata.spi.annotations.InjectMode;
-import org.jboss.beans.metadata.spi.annotations.InjectType;
-
-/**
- * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
- */
-public class AnnotatedNameLooseSimpleTestObject extends AnnotatedSimpleTestObject
-{
-
-   @Inject(mode = InjectMode.BY_NAME, type = InjectType.LOOSE)
-   public void setTesterInterface(TesterInterface testerInterface)
-   {
-      this.testerInterface = testerInterface;
-   }
-
-}

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/AnnotatedNameStrictSimpleTestObject.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/AnnotatedNameStrictSimpleTestObject.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/AnnotatedNameStrictSimpleTestObject.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -22,7 +22,7 @@
 package org.jboss.test.kernel.inject.support;
 
 import org.jboss.beans.metadata.spi.annotations.Inject;
-import org.jboss.beans.metadata.spi.annotations.InjectMode;
+import org.jboss.beans.metadata.spi.annotations.InjectType;
 
 /**
  * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
@@ -30,7 +30,7 @@
 public class AnnotatedNameStrictSimpleTestObject extends AnnotatedSimpleTestObject
 {
 
-   @Inject(mode = InjectMode.BY_NAME)
+   @Inject(type = InjectType.BY_NAME)
    public void setTesterInterface(TesterInterface testerInterface)
    {
       this.testerInterface = testerInterface;

Deleted: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/AnnotatedTypeLooseSimpleTestObject.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/AnnotatedTypeLooseSimpleTestObject.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/support/AnnotatedTypeLooseSimpleTestObject.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -1,39 +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.test.kernel.inject.support;
-
-import org.jboss.beans.metadata.spi.annotations.Inject;
-import org.jboss.beans.metadata.spi.annotations.InjectType;
-
-/**
- * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
- */
-public class AnnotatedTypeLooseSimpleTestObject extends AnnotatedSimpleTestObject
-{
-
-   @Inject(type = InjectType.LOOSE)
-   public void setTesterInterface(TesterInterface testerInterface)
-   {
-      this.testerInterface = testerInterface;
-   }
-
-}

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/ContextualInjectionTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/ContextualInjectionTestSuite.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/ContextualInjectionTestSuite.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -42,6 +42,7 @@
       TestSuite suite = new TestSuite("Contextal injection Tests");
 
       suite.addTest(ParameterContextualInjectionTestCase.suite());
+      suite.addTest(IllegalParameterContextualInjectionTestCase.suite());
       suite.addTest(PropertyContextualInjectionTestCase.suite());
 
       return suite;

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/IllegalParameterContextualInjectionTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/IllegalParameterContextualInjectionTestCase.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/IllegalParameterContextualInjectionTestCase.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -0,0 +1,53 @@
+/*
+ * 
+ */
+
+package org.jboss.test.kernel.inject.test;
+
+import org.jboss.test.kernel.junit.MicrocontainerTest;
+import org.jboss.test.kernel.inject.support.ParameterTestObject;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+
+import junit.framework.Test;
+
+/**
+ * @author <a href="mailto:ales.justin at gmail.com">Ales Justin</a>
+ */
+public class IllegalParameterContextualInjectionTestCase extends MicrocontainerTest
+{
+   public IllegalParameterContextualInjectionTestCase(String name)
+   {
+      super(name);
+   }
+
+   public static Test suite()
+   {
+      return suite(IllegalParameterContextualInjectionTestCase.class);
+   }
+
+   public void testContextualInjection() throws Throwable
+   {
+      KernelDeployment deployment = null;
+      try
+      {
+         deployment = deploy("IllegalParameterContextualInjection.xml");
+         validate();
+
+         ParameterTestObject pto = (ParameterTestObject) getBean("parameterObject1");
+         assertNotNull(pto.getDuplicateTester());
+
+      }
+      catch(Throwable t)
+      {
+         getLog().info("Expected throwable: " + t);
+      }
+      finally
+      {
+         if (deployment != null)
+         {
+            undeploy(deployment);
+         }
+      }
+   }
+
+}

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/PropertyContextualInjectionTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/PropertyContextualInjectionTestCase.java	2006-08-15 03:00:56 UTC (rev 55930)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/inject/test/PropertyContextualInjectionTestCase.java	2006-08-15 09:31:02 UTC (rev 55931)
@@ -34,7 +34,7 @@
    private static final String[] PREFIX = new String[]{"", "Ann"};
    private static final String[] NUMBER = new String[]{"Single", "Multiple", "Null"};
    private static final String[] MODE = new String[]{"Type", "Name"};
-   private static final String[] TYPE = new String[]{"Loose", "Strict"};
+   private static final String[] TYPE = new String[]{"Strict"};
    private static final String TEST_CASE_SUFFIX = "TestCase.xml";
 
    public PropertyContextualInjectionTestCase(String name)




More information about the jboss-cvs-commits mailing list