[jboss-cvs] JBossAS SVN: r59200 - in projects/microcontainer/trunk: container/src/main/org/jboss/reflect/plugins container/src/main/org/jboss/reflect/plugins/introspection container/src/main/org/jboss/reflect/plugins/javassist container/src/main/org/jboss/reflect/spi kernel/src/main/org/jboss/beans/metadata/plugins kernel/src/main/org/jboss/kernel/plugins/config kernel/src/resources/xml-test/org/jboss/test/kernel/config/test kernel/src/tests/org/jboss/test/kernel/config/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Dec 21 13:22:46 EST 2006


Author: alesj
Date: 2006-12-21 13:22:23 -0500 (Thu, 21 Dec 2006)
New Revision: 59200

Added:
   projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/NullProgressionConvertor.java
   projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ProgressionConvertor.java
   projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ProgressionConvertorFactory.java
   projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/SimpleProgressionConvertor.java
   projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/NumberInfo.java
   projects/microcontainer/trunk/kernel/src/resources/xml-test/org/jboss/test/kernel/config/test/testProgressionFromOtherBean.xml
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ProgressionTestCase.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ProgressionXMLTestCase.java
Modified:
   projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ValueConvertor.java
   projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java
   projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java
   projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/PrimitiveInfo.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractValueMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/ThisValueMetaData.java
   projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/config/Configurator.java
   projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigTestSuite.java
Log:
JBMICROCONT-119; added flexible progression convertor, NumberInfo SPI class

Added: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/NullProgressionConvertor.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/NullProgressionConvertor.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/NullProgressionConvertor.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -0,0 +1,40 @@
+/*
+* 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.reflect.plugins;
+
+/**
+ * Null progression implementation - doesn't progress at all.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class NullProgressionConvertor implements ProgressionConvertor
+{
+   public boolean canProgress(Class<? extends Object> target, Class<? extends Object> source)
+   {
+      return false;
+   }
+
+   public Object doProgression(Class<? extends Object> target, Object value) throws Throwable
+   {
+      return value;
+   }
+}

Added: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ProgressionConvertor.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ProgressionConvertor.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ProgressionConvertor.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -0,0 +1,51 @@
+/*
+* 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.reflect.plugins;
+
+/**
+ * JBMICROCONT-119 issue
+ * Support integer progression, e.g. float -> int or Float -> Integer and vice versa
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public interface ProgressionConvertor
+{
+
+   /**
+    * Check if progression is supported.
+    *
+    * @param target
+    * @param source
+    * @return true, if we can progress source's value class type to target class
+    */
+   boolean canProgress(Class<? extends Object> target, Class<? extends Object> source);
+
+   /**
+    * Do the actual progression.
+    *
+    * @param target class type
+    * @param value to progress
+    * @return progressed value - it's class type now equals to target
+    */
+   Object doProgression(Class<? extends Object> target, Object value) throws Throwable;
+
+}

Added: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ProgressionConvertorFactory.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ProgressionConvertorFactory.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ProgressionConvertorFactory.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -0,0 +1,74 @@
+/*
+* 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.reflect.plugins;
+
+import java.security.PrivilegedExceptionAction;
+import java.security.AccessController;
+
+import org.jboss.reflect.plugins.introspection.ReflectionUtils;
+
+/**
+ * Singleton progression instance factory.
+ * We can change the progression convertor with system property
+ * or setting the convertor class name at the singleton factory instance.
+ * This way we can still change the convertor at runtime before actual usage -
+ * in MC beans definition or other IoC - via XML.
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ProgressionConvertorFactory
+{
+   private static ProgressionConvertorFactory instance = new ProgressionConvertorFactory();
+
+   private String convertorClassName = SimpleProgressionConvertor.class.getName();
+   private ProgressionConvertor convertor;
+
+   public static ProgressionConvertorFactory getInstance()
+   {
+      return instance;
+   }
+
+   public ProgressionConvertor getConvertor() throws Throwable
+   {
+      if (convertor == null)
+      {
+         ConvertorLookup lookup = new ConvertorLookup();
+         String convertorClass = AccessController.doPrivileged(lookup);
+         convertor = (ProgressionConvertor) ReflectionUtils.newInstance(convertorClass);
+      }
+      return convertor;
+   }
+
+   public void setConvertorClassName(String convertorClassName)
+   {
+      this.convertorClassName = convertorClassName;
+   }
+
+   private class ConvertorLookup implements PrivilegedExceptionAction<String>
+   {
+      public String run() throws Exception
+      {
+         return System.getProperty("org.jboss.reflect.plugins.progressionConvertor", convertorClassName);
+      }
+   }
+
+}

Added: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/SimpleProgressionConvertor.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/SimpleProgressionConvertor.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/SimpleProgressionConvertor.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -0,0 +1,110 @@
+/*
+* 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.reflect.plugins;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+import java.math.BigInteger;
+import java.math.BigDecimal;
+
+/**
+ * Simple progression code.
+ * @see javax.management.monitor.GaugeMonitor
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class SimpleProgressionConvertor implements ProgressionConvertor
+{
+
+   public boolean canProgress(Class<? extends Object> target, Class<? extends Object> source)
+   {
+      // see progression comment
+      if (target == null || source == null || BigInteger.class == target || BigDecimal.class == target)
+      {
+         return false;
+      }
+      // ipnbX = is primitive non boolean X
+      boolean ipnbt = target.isPrimitive() && target != Boolean.TYPE;
+      boolean ipnbs = source.isPrimitive() && source != Boolean.TYPE;
+      return (ipnbt || Number.class.isAssignableFrom(target)) && (ipnbs || Number.class.isAssignableFrom(source));
+   }
+
+   public Object doProgression(Class<? extends Object> target, Object value) throws Throwable
+   {
+      if (value == null || target == value.getClass())
+      {
+         return value;
+      }
+      if (canProgress(target, value.getClass()) == false)
+      {
+         throw new IllegalArgumentException("This convertor only handles Numbers: " + target + "/" + value);
+      }
+
+      Number source = (Number) value;
+      // set the right value
+      if (Byte.class == target || byte.class == target)
+      {
+         return source.byteValue();
+      }
+      else if (Double.class == target || double.class == target)
+      {
+         return source.doubleValue();
+      }
+      else if (Float.class == target || float.class == target)
+      {
+         return source.floatValue();
+      }
+      else if (Integer.class == target || int.class == target)
+      {
+         return source.intValue();
+      }
+      else if (Long.class == target || long.class == target)
+      {
+         return source.longValue();
+      }
+      else if (Short.class == target || short.class == target)
+      {
+         return source.shortValue();
+      }
+      else if (AtomicInteger.class == target)
+      {
+         return new AtomicInteger(source.intValue());
+      }
+      else if (AtomicLong.class == target)
+      {
+         return new AtomicLong(source.longValue());
+      }
+/*
+      // maybe leave this two off - with String constructor
+      if (BigInteger.class == target)
+      {
+         return new BigInteger(source.intValue());
+      }
+      else if (BigDecimal.class == target)
+      {
+         return new BigDecimal(source.doubleValue());
+      }
+*/
+      throw new IllegalArgumentException("Unsupported Number subclass: " + target);
+   }
+
+}

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ValueConvertor.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ValueConvertor.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/ValueConvertor.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -33,16 +33,19 @@
 
 /**
  * PropertyEditorHelper.
+ * <p/>
+ * TODO JBMICROCONT-118 fix the introspection assumption
  *
- * TODO JBMICROCONT-118 fix the introspection assumption
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision$
  */
 public class ValueConvertor
 {
-   /** The log */
+   /**
+    * The log
+    */
    private static final Logger log = Logger.getLogger(ValueConvertor.class);
-   
+
    static
    {
       try
@@ -54,11 +57,11 @@
          log.debug("Unable to initialise property editors", t);
       }
    }
-   
+
    /**
     * Convert a value
-    * 
-    * TODO JBMICROCONT-119 look at integer progression, e.g. Integer.longValue()
+    * <p/>
+    *
     * @param clazz the class
     * @param value the value
     * @return the value or null if there is no editor
@@ -71,7 +74,7 @@
          throw new IllegalArgumentException("Null class");
       if (value == null)
          return null;
-      
+
       Class<? extends Object> valueClass = value.getClass();
       if (clazz.isAssignableFrom(valueClass))
          return value;
@@ -97,31 +100,57 @@
       // Try a static clazz.valueOf(value)
       try
       {
-         Method method = clazz.getMethod("valueOf", new Class[] { valueClass });
+         Method method = clazz.getMethod("valueOf", valueClass);
          int modifiers = method.getModifiers();
-         if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers) 
+         if (Modifier.isPublic(modifiers) && Modifier.isStatic(modifiers)
                && clazz.isAssignableFrom(method.getReturnType()))
-            return ReflectionUtils.invoke(null, method, new Object[] { value });
+            return ReflectionUtils.invoke(null, method, new Object[]{value});
       }
       catch (Exception ignored)
       {
       }
-      
 
       // TODO JBMICROCONT-132 improve <init>(String) might not be relevent?
       if (valueClass == String.class)
       {
          try
          {
-            Constructor constructor = clazz.getConstructor(new Class[] { String.class });
+            Constructor constructor = clazz.getConstructor(valueClass);
             if (Modifier.isPublic(constructor.getModifiers()))
-               return ReflectionUtils.newInstance(constructor, new Object[] { value });
+               return ReflectionUtils.newInstance(constructor, new Object[]{value});
          }
          catch (Exception ignored)
          {
          }
       }
-      
+
       return value;
    }
+
+   /**
+    * Progress a value
+    * <p/>
+    *
+    * @param clazz the class
+    * @param value the value
+    * @return the progressed value or null if unsupported
+    * @throws Throwable for any error
+    */
+   public static Object progressValue(Class<? extends Object> clazz, Object value) throws Throwable
+   {
+      if (value != null)
+      {
+         ProgressionConvertor convertor = ProgressionConvertorFactory.getInstance().getConvertor();
+         if (convertor.canProgress(clazz, value.getClass()))
+         {
+            return convertor.doProgression(clazz, value);
+         }
+         else
+         {
+            return null;
+         }
+      }
+      return value;
+   }
+
 }

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -43,14 +43,7 @@
 import org.jboss.reflect.plugins.EnumInfoImpl;
 import org.jboss.reflect.plugins.FieldInfoImpl;
 import org.jboss.reflect.plugins.MethodInfoImpl;
-import org.jboss.reflect.spi.AnnotationInfo;
-import org.jboss.reflect.spi.AnnotationValue;
-import org.jboss.reflect.spi.ArrayInfo;
-import org.jboss.reflect.spi.ClassInfo;
-import org.jboss.reflect.spi.InterfaceInfo;
-import org.jboss.reflect.spi.PrimitiveInfo;
-import org.jboss.reflect.spi.TypeInfo;
-import org.jboss.reflect.spi.TypeInfoFactory;
+import org.jboss.reflect.spi.*;
 import org.jboss.util.collection.temp.WeakTypeCache;
 
 /**
@@ -169,7 +162,7 @@
          infos[i] = new ReflectFieldInfoImpl(annotations, fields[i].getName(), getTypeInfo(fields[i].getGenericType()), fields[i].getModifiers(), (ClassInfo) getTypeInfo(fields[i].getDeclaringClass()));
          infos[i].setField(fields[i]);
       }
-      
+
       return infos;
    }
 
@@ -261,6 +254,16 @@
       if (primitive != null)
          return primitive;
 
+      NumberInfo number = NumberInfo.valueOf(clazz.getName());
+      if (number != null)
+      {
+         if (number.isInitialized() == false)
+         {
+            number.setDelegate(get(clazz));
+         }
+         return number;
+      }
+
       return get(clazz);
    }
 
@@ -277,6 +280,16 @@
          TypeInfo primitive = PrimitiveInfo.valueOf(((Class) type).getName());
          if (primitive != null)
             return primitive;
+
+         NumberInfo number = NumberInfo.valueOf(((Class) type).getName());
+         if (number != null)
+         {
+            if (number.isInitialized() == false)
+            {
+               number.setDelegate(get(type));
+            }
+            return number;
+         }
       }
 
       return get(type);
@@ -291,6 +304,22 @@
       if (primitive != null)
          return primitive;
 
+      NumberInfo number = NumberInfo.valueOf(name);
+      if (number != null)
+      {
+         if (number.isInitialized() == false)
+         {
+            number.setDelegate(resolveComplexTypeInfo(cl, name));
+         }
+         return number;
+      }
+
+      return resolveComplexTypeInfo(cl, name);
+   }
+
+   private TypeInfo resolveComplexTypeInfo(ClassLoader cl, String name)
+         throws ClassNotFoundException
+   {
       if (cl == null)
          cl = Thread.currentThread().getContextClassLoader();
 
@@ -308,8 +337,8 @@
       }
       else if (clazz.isEnum())
       {
-         EnumInfoImpl enumInfoImpl = new EnumInfoImpl(clazz.getName(), clazz.getModifiers()); 
-         result = enumInfoImpl; 
+         EnumInfoImpl enumInfoImpl = new EnumInfoImpl(clazz.getName(), clazz.getModifiers());
+         result = enumInfoImpl;
          Field[] fields = clazz.getFields();
          EnumConstantInfoImpl[] constants = new EnumConstantInfoImpl[fields.length];
          int i = 0;

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/plugins/javassist/JavassistTypeInfoFactoryImpl.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -37,11 +37,7 @@
 import org.jboss.reflect.plugins.AnnotationValueFactory;
 import org.jboss.reflect.plugins.AnnotationValueImpl;
 import org.jboss.reflect.plugins.EnumConstantInfoImpl;
-import org.jboss.reflect.spi.AnnotationInfo;
-import org.jboss.reflect.spi.AnnotationValue;
-import org.jboss.reflect.spi.PrimitiveInfo;
-import org.jboss.reflect.spi.TypeInfo;
-import org.jboss.reflect.spi.TypeInfoFactory;
+import org.jboss.reflect.spi.*;
 import org.jboss.util.JBossStringBuilder;
 import org.jboss.util.collection.WeakClassCache;
 
@@ -57,11 +53,11 @@
    static final AnnotationValue[] NO_ANNOTATIONS = new AnnotationValue[0];
    /**
     * Raise NoClassDefFoundError for javassist not found
-    * 
+    *
     * @param name the name
     * @param e the not found error
     * @return never
-    * @throws NoClassDefFoundError always 
+    * @throws NoClassDefFoundError always
     */
    public static NoClassDefFoundError raiseClassNotFound(String name, NotFoundException e) throws NoClassDefFoundError
    {
@@ -73,11 +69,11 @@
 
    /**
     * Raise NoClassDefFoundError for javassist not found
-    * 
+    *
     * @param name the name
     * @param e the not found error
     * @return never
-    * @throws NoClassDefFoundError always 
+    * @throws NoClassDefFoundError always
     */
    public static NoClassDefFoundError raiseClassNotFound(String name, ClassNotFoundException e) throws NoClassDefFoundError
    {
@@ -88,11 +84,11 @@
 
    /**
     * Raise NoClassDefFoundError for javassist not found
-    * 
+    *
     * @param name the name
     * @param e the not found error
     * @return never
-    * @throws NoClassDefFoundError always 
+    * @throws NoClassDefFoundError always
     */
    public static NoClassDefFoundError raiseMethodNotFound(String name, NotFoundException e) throws NoClassDefFoundError
    {
@@ -104,11 +100,11 @@
 
    /**
     * Raise NoClassDefFoundError for javassist not found
-    * 
+    *
     * @param name the name
     * @param e the not found error
     * @return never
-    * @throws NoClassDefFoundError always 
+    * @throws NoClassDefFoundError always
     */
    public static NoClassDefFoundError raiseFieldNotFound(String name, NotFoundException e) throws NoClassDefFoundError
    {
@@ -156,7 +152,7 @@
             return enumInfo;
          }
 
-         
+
          return new JavassistTypeInfo(this, ctClass, clazz);
       }
       catch (NotFoundException e)
@@ -167,7 +163,7 @@
 
    /**
     * Get the type info
-    * 
+    *
     * @param ctClass the ctClass
     * @return the typeinfo
     */
@@ -186,7 +182,7 @@
 
    /**
     * Convert name
-    * 
+    *
     * @param clazz the class
     * @return the converted name
     */
@@ -226,7 +222,7 @@
 
    /**
     * Get the CtClass
-    * 
+    *
     * @param name the name
     * @return the CtClass
     */
@@ -256,6 +252,16 @@
       if (primitive != null)
          return primitive;
 
+      NumberInfo number = NumberInfo.valueOf(clazz.getName());
+      if (number != null)
+      {
+         if (number.isInitialized() == false)
+         {
+            number.setDelegate((TypeInfo) get(clazz));
+         }
+         return number;
+      }
+
       return (TypeInfo) get(clazz);
    }
 
@@ -270,6 +276,16 @@
       if (primitive != null)
          return primitive;
 
+      NumberInfo number = NumberInfo.valueOf(name);
+      if (number != null)
+      {
+         if (number.isInitialized() == false)
+         {
+            number.setDelegate((TypeInfo) get(cl.loadClass(name)));
+         }
+         return number;
+      }
+
       Class clazz = cl.loadClass(name);
       return getTypeInfo(clazz);
    }
@@ -279,7 +295,7 @@
       if (type instanceof Class)
          return getTypeInfo((Class) type);
 
-      // TODO JBMICROCONT-129 getTypeInfo
+      // TODO JBMICROCONT-129 getTypeInfo + NumberInfo
       throw new org.jboss.util.NotImplementedException("getTypeInfo");
    }
 

Added: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/NumberInfo.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/NumberInfo.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/NumberInfo.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -0,0 +1,276 @@
+/*
+* 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.reflect.spi;
+
+import java.io.ObjectStreamException;
+import java.util.HashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.jboss.util.JBossStringBuilder;
+
+/**
+ * Number info
+ *
+ * @author <a href="mailto:ales.justin at jboss.com">Ales Justin</a>
+ */
+public class NumberInfo extends PrimitiveInfo implements ClassInfo
+{
+   /** serialVersionUID */
+   private static final long serialVersionUID = 1L;
+
+   /** The byte info */
+   public static final NumberInfo BYTE_OBJECT = new NumberInfo(0, Byte.class);
+
+   /** The double info */
+   public static final NumberInfo DOUBLE_OBJECT = new NumberInfo(1, Double.class);
+
+   /** The float info */
+   public static final NumberInfo FLOAT_OBJECT = new NumberInfo(2, Float.class);
+
+   /** The int info */
+   public static final NumberInfo INT_OBJECT = new NumberInfo(3, Integer.class);
+
+   /** The long info */
+   public static final NumberInfo LONG_OBJECT = new NumberInfo(4, Long.class);
+
+   /** The short info */
+   public static final NumberInfo SHORT_OBJECT = new NumberInfo(5, Short.class);
+
+   /** The atomic int info */
+   public static final NumberInfo ATOMIC_INT = new NumberInfo(6, AtomicInteger.class);
+
+   /** The atomic long info */
+   public static final NumberInfo ATOMIC_LONG = new NumberInfo(7, AtomicLong.class);
+
+   /** The primitives */
+   private static final NumberInfo[] values = {
+         BYTE_OBJECT,
+         DOUBLE_OBJECT,
+         FLOAT_OBJECT,
+         INT_OBJECT,
+         LONG_OBJECT,
+         SHORT_OBJECT,
+         ATOMIC_INT,
+         ATOMIC_LONG
+   };
+
+   /** The primitives */
+   private static final HashMap<String, NumberInfo> map = new HashMap<String, NumberInfo>();
+
+   static
+   {
+      map.put(Byte.class.getName(), NumberInfo.BYTE_OBJECT);
+      map.put(Double.class.getName(), NumberInfo.DOUBLE_OBJECT);
+      map.put(Float.class.getName(), NumberInfo.FLOAT_OBJECT);
+      map.put(Integer.class.getName(), NumberInfo.INT_OBJECT);
+      map.put(Long.class.getName(), NumberInfo.LONG_OBJECT);
+      map.put(Short.class.getName(), NumberInfo.SHORT_OBJECT);
+      map.put(AtomicInteger.class.getName(), NumberInfo.ATOMIC_INT);
+      map.put(AtomicLong.class.getName(), NumberInfo.ATOMIC_LONG);
+   }
+
+   private transient ClassInfo delegate;
+
+   /**
+    * Get the primitive info for a type
+    *
+    * @param name the name
+    * @return the info
+    */
+   public static NumberInfo valueOf(String name)
+   {
+      return map.get(name);
+   }
+
+   /**
+    * Create a new number info
+    *
+    * @param ordinal the oridinal
+    * @param type the class
+    */
+   protected NumberInfo(int ordinal, Class<? extends Object> type)
+   {
+      super(type.getName(), ordinal, type);
+   }
+
+   public void setDelegate(TypeInfo info)
+   {
+      if (info instanceof ClassInfo == false)
+      {
+         throw new IllegalArgumentException("Should be of classType instance: " + info);
+      }
+      delegate = (ClassInfo) info;
+   }
+
+   public boolean isInitialized()
+   {
+      return (delegate != null);
+   }
+
+   public boolean equals(Object obj)
+   {
+      if (obj == this)
+         return true;
+      if (obj == null)
+         return false;
+      if (!(obj instanceof NumberInfo))
+         return false;
+      if (!obj.getClass().equals(this.getClass()))
+         return false;
+      NumberInfo other = (NumberInfo) obj;
+      return other.ordinal == this.ordinal;
+   }
+
+   Object readResolve() throws ObjectStreamException
+   {
+      return values[ordinal];
+   }
+
+   // --- delegate
+
+   public ConstructorInfo getDeclaredConstructor(TypeInfo[] parameters)
+   {
+      return delegate.getDeclaredConstructor(parameters);
+   }
+
+   public ConstructorInfo[] getDeclaredConstructors()
+   {
+      return delegate.getDeclaredConstructors();
+   }
+
+   public FieldInfo getDeclaredField(String name)
+   {
+      return delegate.getDeclaredField(name);
+   }
+
+   public FieldInfo[] getDeclaredFields()
+   {
+      return delegate.getDeclaredFields();
+   }
+
+   public MethodInfo getDeclaredMethod(String name, TypeInfo[] parameters)
+   {
+      return delegate.getDeclaredMethod(name, parameters);
+   }
+
+   public MethodInfo[] getDeclaredMethods()
+   {
+      return delegate.getDeclaredMethods();
+   }
+
+   public InterfaceInfo[] getGenericInterfaces()
+   {
+      return delegate.getGenericInterfaces();
+   }
+
+   public ClassInfo getGenericSuperclass()
+   {
+      return delegate.getGenericSuperclass();
+   }
+
+   public InterfaceInfo[] getInterfaces()
+   {
+      return delegate.getInterfaces();
+   }
+
+   public ClassInfo getSuperclass()
+   {
+      return delegate.getSuperclass();
+   }
+
+   public boolean isInterface()
+   {
+      return delegate.isInterface();
+   }
+
+   public AnnotationValue getAnnotation(String name)
+   {
+      return delegate.getAnnotation(name);
+   }
+
+   public AnnotationValue[] getAnnotations()
+   {
+      return delegate.getAnnotations();
+   }
+
+   public boolean isAnnotationPresent(String name)
+   {
+      return delegate.isAnnotationPresent(name);
+   }
+
+   public int getModifiers()
+   {
+      return delegate.getModifiers();
+   }
+
+   public boolean isPublic()
+   {
+      return delegate.isPublic();
+   }
+
+   public boolean isStatic()
+   {
+      return delegate.isStatic();
+   }
+
+   public boolean isPrimitive()
+   {
+      return delegate.isPrimitive();
+   }
+
+   public TypeInfo[] getActualTypeArguments()
+   {
+      return delegate.getActualTypeArguments();
+   }
+
+   public TypeInfo getOwnerType()
+   {
+      return delegate.getOwnerType();
+   }
+
+   public ClassInfo getRawType()
+   {
+      return delegate;
+   }
+
+   protected int getHashCode()
+   {
+      return delegate.hashCode();
+   }
+
+   public String toShortString()
+   {
+      return name;
+   }
+
+   public void toShortString(JBossStringBuilder builder)
+   {
+      builder.append(name);
+   }
+  
+   public Object clone()
+   {
+      return this;
+   }
+
+}

Modified: projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/PrimitiveInfo.java
===================================================================
--- projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/PrimitiveInfo.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/container/src/main/org/jboss/reflect/spi/PrimitiveInfo.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -146,6 +146,11 @@
    
    public Object convertValue(Object value) throws Throwable
    {
+      Object progressResult = ValueConvertor.progressValue(type, value);
+      if (progressResult != null)
+      {
+         return progressResult;
+      }
       return ValueConvertor.convertValue(type, value);
    }
 

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-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractBeanMetaData.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -506,6 +506,7 @@
          throw new IllegalArgumentException("Bean not yet installed: " + name);
       }
       Object target = context.getTarget();
+      // TODO - add progression here as well?
       if (info != null && info.getType().isAssignableFrom(target.getClass()) == false)
       {
          throw new ClassCastException(target + " is not a " + info);

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractDependencyValueMetaData.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -150,9 +150,9 @@
          BeanInfo beanInfo = configurator.getBeanInfo(result.getClass());
          TargettedJoinpoint joinpoint = configurator.getPropertyGetterJoinPoint(beanInfo, property);
          joinpoint.setTarget(result);
-         return joinpoint.dispatch();
+         result = joinpoint.dispatch();
       }
-      return result;
+      return info != null ? info.convertValue(result) : result;
    }
 
    public void initialVisit(MetaDataVisitor visitor)

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-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractInjectionValueMetaData.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -102,6 +102,7 @@
          {
             throw new IllegalArgumentException("Possible multiple matching beans, see log for info.");
          }
+         // TODO - add progression here, then fix BeanMetaData as well
          return context.getTarget();
       }
       return super.getValue(info, cl);

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractValueMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractValueMetaData.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/AbstractValueMetaData.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -80,7 +80,7 @@
 
    public Object getValue(TypeInfo info, ClassLoader cl) throws Throwable
    {
-      return value;
+      return info != null ? info.convertValue(value) : value;
    }
 
    public void initialVisit(MetaDataVisitor visitor)

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/ThisValueMetaData.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/ThisValueMetaData.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/beans/metadata/plugins/ThisValueMetaData.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -53,6 +53,7 @@
       ControllerContext context = controller.getContext(value, ControllerState.INSTANTIATED);
       if (context == null)
          throw new Error("Could not deference this " + this);
+      // TODO - add progression, see BeanMetaData, InjectionMetaData
       return context.getTarget();
    }
 

Modified: projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/config/Configurator.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/config/Configurator.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/kernel/src/main/org/jboss/kernel/plugins/config/Configurator.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -46,6 +46,8 @@
 import org.jboss.reflect.spi.ConstructorInfo;
 import org.jboss.reflect.spi.MethodInfo;
 import org.jboss.reflect.spi.TypeInfo;
+import org.jboss.reflect.plugins.ProgressionConvertor;
+import org.jboss.reflect.plugins.ProgressionConvertorFactory;
 
 /**
  * Configuration utilities.
@@ -71,7 +73,7 @@
          configure(result, info, metaData);
       return result;
    }
-   
+
    /**
     * Instantiate a bean
     * 
@@ -93,7 +95,7 @@
       Joinpoint joinPoint = getConstructorJoinPoint(config, info, constructor, metaData);
       return joinPoint.dispatch();
    }
-   
+
    /**
     * Get a constructor joinpoint
     * 
@@ -108,7 +110,7 @@
       throws Throwable
    {
       boolean trace = log.isTraceEnabled();
-      
+
       if (trace)
          log.trace("Get constructor joinpoint info=" + info + " constructor=" + metaData);
 
@@ -127,7 +129,7 @@
                typeInfo = info.getClassInfo();
             return new ValueJoinpoint(vmd, typeInfo, cl);
          }
-         
+
          vmd = metaData.getFactory();
          if (vmd != null)
          {
@@ -139,7 +141,7 @@
 
             // Describe the factory
             BeanInfo factoryInfo = config.getBeanInfo(factory.getClass());
-            
+
             // Find the method
             MethodJoinpoint joinPoint = findMethod(trace, factoryInfo, cl, metaData.getFactoryMethod(), parameters, false, true);
             joinPoint.setTarget(factory);
@@ -154,7 +156,7 @@
             }
             return joinPoint;
          }
-         
+
          String factoryClassName = metaData.getFactoryClass();
          if (factoryClassName != null)
          {
@@ -176,11 +178,11 @@
             }
             return joinPoint;
          }
-         
+
          // Find the constructor
          ConstructorJoinpoint joinPoint = findConstructor(trace, info, metaData, beanMetaData);
          ConstructorInfo cinfo = joinPoint.getConstructorInfo();
-         
+
          // Set the parameters
          if (cinfo != null)
          {
@@ -190,11 +192,11 @@
          }
          return joinPoint;
       }
-      
+
       // Default constructor
       return findConstructor(trace, info, metaData, beanMetaData);
    }
-   
+
    /**
     * Find a constructor
     * 
@@ -211,7 +213,7 @@
       JoinpointFactory jpf = info.getJoinpointFactory();
       return jpf.getConstructorJoinpoint(cinfo);
    }
-   
+
    /**
     * Resolve a constructor
     * 
@@ -264,7 +266,7 @@
       if (properties != null && properties.isEmpty() == false)
       {
          ClassLoader cl = getClassLoader(metaData);
-         
+
          for (Iterator i = metaData.getProperties().iterator(); i.hasNext();)
          {
             PropertyMetaData property = (PropertyMetaData) i.next();
@@ -333,13 +335,13 @@
    {
       if (trace)
          log.trace("Configuring info=" + info + " metaData=" + metaData);
-      
+
       TargettedJoinpoint joinPoint = getPropertySetterJoinPoint(trace, info, cl, metaData.getValue());
       joinPoint.setTarget(object);
-      
+
       if (trace)
          log.trace("Setting property " + joinPoint);
-      
+
       joinPoint.dispatch();
    }
 
@@ -373,7 +375,7 @@
 
       if (info == null)
          throw new IllegalArgumentException("Null property info");
-      
+
       JoinpointFactory jpf = info.getBeanInfo().getJoinpointFactory();
       MethodInfo minfo = info.getGetter();
       return getMethodJoinpoint(null, jpf, minfo.getName(), null, null);
@@ -395,13 +397,13 @@
          throw new IllegalArgumentException("Null bean info");
       if (metaData == null)
          throw new IllegalArgumentException("Null bean metadata");
-      
+
       Set<TargettedJoinpoint> result = new HashSet<TargettedJoinpoint>();
       Set<PropertyMetaData> propertys = metaData.getProperties();
       if (propertys != null && propertys.isEmpty() == false)
       {
          ClassLoader cl = getClassLoader(metaData);
-         
+
          for (Iterator i = metaData.getProperties().iterator(); i.hasNext();)
          {
             PropertyMetaData property = (PropertyMetaData) i.next();
@@ -409,7 +411,7 @@
             result.add(joinPoint);
          }
       }
-      
+
       return result;
    }
 
@@ -495,7 +497,7 @@
          throw new IllegalArgumentException("Null property info");
       if (metaData == null)
          throw new IllegalArgumentException("Null value metadata");
-      
+
       TypeInfo type = info.getType();
       Object value = metaData.getValue(type, cl);
       JoinpointFactory jpf = info.getBeanInfo().getJoinpointFactory();
@@ -505,7 +507,7 @@
       String[] parameterTypes = getParameterTypes(trace, minfo.getParameterTypes());
       return getMethodJoinpoint(null, jpf, minfo.getName(), parameterTypes, new Object[] { value });
    }
-   
+
    /**
     * Unconfigure a bean
     * 
@@ -563,16 +565,16 @@
    {
       if (trace)
          log.trace("Unconfiguring info=" + info + " metaData=" + metaData);
-      
+
       TargettedJoinpoint joinPoint = getPropertyNullerJoinPoint(info, metaData);
       joinPoint.setTarget(object);
-      
+
       if (trace)
          log.trace("Unsetting property " + joinPoint);
-      
+
       joinPoint.dispatch();
    }
-   
+
    /**
     * Get property nuller joinpoints for a bean
     * 
@@ -646,16 +648,16 @@
       boolean trace = log.isTraceEnabled();
       if (trace)
          log.trace("Get property nuller join point info=" + info + " metaData=" + metaData);
-      
+
       if (info == null)
          throw new IllegalArgumentException("Null property info");
-      
+
       JoinpointFactory jpf = info.getBeanInfo().getJoinpointFactory();
       MethodInfo minfo = info.getSetter();
       String[] parameterTypes = getParameterTypes(trace, minfo.getParameterTypes());
       return getMethodJoinpoint(null, jpf, minfo.getName(), parameterTypes, new Object[] { null });
    }
-   
+
    /**
     * Get the property info
     * 
@@ -707,10 +709,10 @@
             }
          }
       }
-      
+
       throw new JoinpointException("Property " + name + " not found for " + info);
    }
-   
+
    /**
     * Find a method
     * 
@@ -728,7 +730,7 @@
       boolean trace = log.isTraceEnabled();
       return findMethod(trace, info, cl, name, parameters, isStatic, isPublic);
    }
-   
+
    /**
     * Find a method
     * 
@@ -761,10 +763,10 @@
          Object[] params = getParameters(trace, cl, pinfos, parameters);
          joinPoint.setArguments(params);
       }
-      
+
       return joinPoint;
    }
-   
+
    /**
     * Get the parameters types
     * 
@@ -777,7 +779,7 @@
    {
       if (parameters == null)
          return null;
-      
+
       String[] paramTypes = new String[parameters.size()];
       int x = 0;
       for (Iterator i = parameters.iterator(); i.hasNext();)
@@ -787,7 +789,7 @@
       }
       return paramTypes;
    }
-   
+
    /**
     * Get the parameters types
     * 
@@ -800,14 +802,14 @@
    {
       if (parameters == null)
          return null;
-      
+
       String[] paramTypes = new String[parameters.length];
       int x = 0;
       for (int i = 0; i < parameters.length; ++i)
          paramTypes[x++] = parameters[i].getName();
       return paramTypes;
    }
-   
+
    /**
     * Get the parameters
     * 
@@ -822,7 +824,7 @@
    {
       if (parameters == null)
          return null;
-      
+
       Object[] params = new Object[parameters.size()];
       int x = 0;
       for (Iterator i = parameters.iterator(); i.hasNext();)
@@ -916,7 +918,7 @@
     * @param typeInfos the type infos
     * @return true when we can use progression
     */
-   public static boolean progression(ClassLoader cl, String[] typeNames, TypeInfo[] typeInfos)
+   public static boolean progression(ClassLoader cl, String[] typeNames, TypeInfo[] typeInfos) throws Throwable
    {
       if (cl == null)
          return false;
@@ -924,7 +926,20 @@
       if (simpleCheck(typeNames, typeInfos) == false)
          return false;
 
-      // JBMICROCONT-119: todo - write this + actual progression code at value injection
+      // convertor
+      ProgressionConvertor convertor = ProgressionConvertorFactory.getInstance().getConvertor();
+
+      for (int i = 0; i < typeNames.length; ++i)
+      {
+         if (typeNames[i] != null)
+         {
+            Class clazz = Class.forName(typeNames[i], true, cl);
+            if (convertor.canProgress(typeInfos[i].getType(), clazz) == false)
+            {
+               return false;
+            }
+         }
+      }
       return false;
    }
 
@@ -934,14 +949,14 @@
    private static class ValueJoinpoint implements Joinpoint
    {
       /** The value metadata */
-      private ValueMetaData vmd; 
-      
+      private ValueMetaData vmd;
+
       /** The type info */
       private TypeInfo info;
-      
+
       /** The classloader */
       private ClassLoader cl;
-      
+
       /**
        * Create a new ValueJoinpoint.
        * 
@@ -955,7 +970,7 @@
          this.info = info;
          this.cl = cl;
       }
-      
+
       public Object dispatch() throws Throwable
       {
          return vmd.getValue(info, cl);
@@ -977,6 +992,6 @@
             throw new Error(e);
          }
       }
-      
+
    }
 }

Added: projects/microcontainer/trunk/kernel/src/resources/xml-test/org/jboss/test/kernel/config/test/testProgressionFromOtherBean.xml
===================================================================
--- projects/microcontainer/trunk/kernel/src/resources/xml-test/org/jboss/test/kernel/config/test/testProgressionFromOtherBean.xml	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/kernel/src/resources/xml-test/org/jboss/test/kernel/config/test/testProgressionFromOtherBean.xml	2006-12-21 18:22:23 UTC (rev 59200)
@@ -0,0 +1,19 @@
+<?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="FromBean" class="org.jboss.test.kernel.config.support.SimpleBean">
+      <property name="adouble">123.456</property>
+      <property name="AFloat" class="java.lang.Float">987.6543</property>
+      <property name="anInt">314159</property>
+   </bean>
+
+   <bean name="SimpleBean" class="org.jboss.test.kernel.config.support.SimpleBean">
+      <property name="anint"><inject bean="FromBean" property="adouble" /></property>
+      <property name="AShort"><inject bean="FromBean" property="AFloat" /></property>
+      <property name="AFloat"><inject bean="FromBean" property="anInt" /></property>
+   </bean>
+
+</deployment>

Modified: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigTestSuite.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigTestSuite.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ConfigTestSuite.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -62,7 +62,9 @@
       suite.addTest(ArrayXMLTestCase.suite());
       suite.addTest(MapTestCase.suite());
       suite.addTest(MapXMLTestCase.suite());
-      
+      suite.addTest(ProgressionTestCase.suite());
+      suite.addTest(ProgressionXMLTestCase.suite());
+
       return suite;
    }
 }

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ProgressionTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ProgressionTestCase.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ProgressionTestCase.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -0,0 +1,74 @@
+/*
+* 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.test.kernel.config.test;
+
+import junit.framework.Test;
+import org.jboss.beans.metadata.plugins.AbstractBeanMetaData;
+import org.jboss.beans.metadata.plugins.AbstractPropertyMetaData;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.config.KernelConfigurator;
+import org.jboss.test.kernel.config.support.SimpleBean;
+
+/**
+ * Progression Test Case.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ProgressionTestCase extends AbstractKernelConfigTest
+{
+   public static Test suite()
+   {
+      return suite(ProgressionTestCase.class);
+   }
+
+   public ProgressionTestCase(String name)
+   {
+      super(name);
+   }
+
+   public ProgressionTestCase(String name, boolean xmltest)
+   {
+      super(name, xmltest);
+   }
+
+   public void testProgressionFromOtherBean() throws Throwable
+   {
+      SimpleBean bean = instantiateProgressionBeans();
+      assertEquals(123, bean.getAnint());
+      assertEquals((short)987, bean.getAShort().shortValue());
+      assertEquals(314159f, bean.getAFloat().floatValue());
+   }
+
+   protected SimpleBean instantiateProgressionBeans() throws Throwable
+   {
+      Kernel kernel = bootstrap();
+      KernelConfigurator configurator = kernel.getConfigurator();
+
+      AbstractBeanMetaData bmd = new AbstractBeanMetaData(SimpleBean.class.getName());
+      bmd.addProperty(new AbstractPropertyMetaData("anint", 123.456));
+      bmd.addProperty(new AbstractPropertyMetaData("AShort", 987.6543));
+      bmd.addProperty(new AbstractPropertyMetaData("AFloat", 314159));
+
+      return (SimpleBean) instantiateAndConfigure(configurator, bmd);
+   }
+
+}

Added: projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ProgressionXMLTestCase.java
===================================================================
--- projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ProgressionXMLTestCase.java	2006-12-21 16:01:30 UTC (rev 59199)
+++ projects/microcontainer/trunk/kernel/src/tests/org/jboss/test/kernel/config/test/ProgressionXMLTestCase.java	2006-12-21 18:22:23 UTC (rev 59200)
@@ -0,0 +1,51 @@
+/*
+* 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.test.kernel.config.test;
+
+import junit.framework.Test;
+import org.jboss.test.kernel.config.support.SimpleBean;
+import org.jboss.test.kernel.config.support.XMLUtil;
+
+/**
+ * Progression XML Test Case.
+ *
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
+ */
+public class ProgressionXMLTestCase extends ProgressionTestCase
+{
+   public static Test suite()
+   {
+      return suite(ProgressionXMLTestCase.class);
+   }
+
+   public ProgressionXMLTestCase(String name)
+   {
+      super(name, true);
+   }
+
+   protected SimpleBean instantiateProgressionBeans() throws Throwable
+   {
+      XMLUtil util = bootstrapXML(true);
+      return (SimpleBean) util.getBean("SimpleBean");
+   }
+
+}




More information about the jboss-cvs-commits mailing list