openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r754523 - in /incubator/openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/ main/java/org/apache/webbeans/component/third/ main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/config/inheritance/ ma...
Date Sat, 14 Mar 2009 21:24:34 GMT
Author: gerdogdu
Date: Sat Mar 14 21:24:30 2009
New Revision: 754523

URL: http://svn.apache.org/viewvc?rev=754523&view=rev
Log:
Updating for TCK tests.

Modified:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceComponentImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerComponentImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/BeanInheritedMetaData.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/activity/ActivityManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/Producer1ConsumerComponentTest.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/ProducerComponentTest.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/ScopeAdapterTest.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/InjectedInstanceComponentTest.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/newcomp/NewComponentTest.java

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java Sat Mar 14 21:24:30 2009
@@ -42,7 +42,6 @@
 import org.apache.webbeans.context.WebBeansContext;
 import org.apache.webbeans.context.creational.CreationalContextFactory;
 import org.apache.webbeans.deployment.DeploymentTypeManager;
-import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.intercept.InterceptorData;
 import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.WebBeansUtil;
@@ -164,13 +163,21 @@
             instance = createInstance(creationalContext);
 
         }
-        catch (RuntimeException re)
+        catch (Exception re)
         {
-            throw new CreationException(re);
-        }
-        catch (Exception e)
-        {
-            throw new WebBeansException(e);
+            Throwable throwable = ClassUtil.getRootException(re);
+            
+            if(throwable instanceof RuntimeException)
+            {
+                RuntimeException rt = (RuntimeException)throwable;
+                
+                throw rt;
+            }
+            else
+            {
+                throw new CreationException(throwable);
+            }
+            
         }
         finally
         {
@@ -546,7 +553,7 @@
         builder.append("\tAPI Types:\n");
         builder.append("\t[\n");
         
-        for(Type clazz : this.apiTypes)
+        for(Type clazz : getTypes())
         {
             if(clazz instanceof Class)
             {
@@ -565,7 +572,7 @@
         builder.append("\tBinding Types:\n");
         builder.append("\t[\n");
         
-        for(Annotation ann : this.implBindingTypes)
+        for(Annotation ann : getBindings())
         {
             builder.append("\t\t\t"+ann.annotationType().getName()+"\n");
         }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceComponentImpl.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceComponentImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceComponentImpl.java Sat Mar 14 21:24:30 2009
@@ -31,10 +31,13 @@
     
     private Type[] actualTypeArguments = new Type[0];
     
-    public InstanceComponentImpl(Class<Instance<T>> returnType, Type injectedType)
+    private Type[] injectedTypeArguments = new Type[0];
+    
+    public InstanceComponentImpl(Class<Instance<T>> returnType, Type injectedType, Type[] injectedTypeArguments)
     {
         super(WebBeansType.INSTANCE, returnType);
         configureInjectionClazz(injectedType);
+        this.injectedTypeArguments = injectedTypeArguments;
     }
     
     @SuppressWarnings("unchecked")
@@ -68,4 +71,13 @@
         
     }
 
+    /**
+     * @return the actualTypeArguments
+     */
+    public Type[] getActualTypeArguments()
+    {
+        return this.injectedTypeArguments;
+    }
+
+    
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerComponentImpl.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerComponentImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerComponentImpl.java Sat Mar 14 21:24:30 2009
@@ -15,6 +15,7 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 
@@ -136,7 +137,7 @@
     protected T createInstance(CreationalContext<T> creationalContext)
     {
         T instance = null;
-        Object parentInstance = getParentInstance();
+        Object parentInstance = null;
         boolean dependentContext = false;
         
         try
@@ -149,7 +150,12 @@
                     dependentContext = true;
                 }
             }
-
+            
+            if(!Modifier.isStatic(creatorMethod.getModifiers()))
+            {
+                parentInstance = getParentInstance();
+            }
+            
             InjectableMethods<T> m = new InjectableMethods<T>(creatorMethod, parentInstance, this,null);
             instance = m.doInjection();
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldComponent.java Sat Mar 14 21:24:30 2009
@@ -18,6 +18,7 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
 
 import javax.context.CreationalContext;
 import javax.context.Dependent;
@@ -57,7 +58,7 @@
     protected T createInstance(CreationalContext<T> creationalContext)
     {
         T instance = null;
-        Object parentInstance = getParentInstance();
+        Object parentInstance = null;
         boolean dependentContext = false;
         try
         {
@@ -75,8 +76,16 @@
             {
                 producerField.setAccessible(true);
             }
-
-            instance =  (T)producerField.get(parentInstance);
+            
+            if(Modifier.isStatic(producerField.getModifiers()))
+            {
+                instance =  (T)producerField.get(null);
+            }
+            else
+            {
+                parentInstance = getParentInstance();
+                instance =  (T)producerField.get(parentInstance);
+            }
         }
         catch(Exception e)
         {

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/third/ThirdpartyBeanImpl.java Sat Mar 14 21:24:30 2009
@@ -35,9 +35,10 @@
     public ThirdpartyBeanImpl(Bean<T> bean)
     {
         super(WebBeansType.THIRDPARTY);
+        
+        this.bean = bean;
+        
     }
-
-    
     
     @Override
     public Set<Annotation> getBindings()

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java Sat Mar 14 21:24:30 2009
@@ -35,6 +35,7 @@
 import javax.inject.DeploymentType;
 import javax.inject.Disposes;
 import javax.inject.Initializer;
+import javax.inject.Obtains;
 import javax.inject.Produces;
 import javax.inject.Realizes;
 import javax.inject.Specializes;
@@ -76,7 +77,7 @@
     {
 
     }
-
+    
     public static <T> Class<? extends Annotation> defineDeploymentType(AbstractComponent<T> component, Annotation[] beanAnnotations, String errorMessage)
     {
         boolean found = false;
@@ -134,6 +135,10 @@
                 component.setType(new ProductionLiteral());
 
             }
+            else
+            {
+                component.setType(result);
+            }
         }
 
         return component.getDeploymentType();
@@ -161,24 +166,24 @@
     public static <T> void defineProducerMethodApiTypes(AbstractComponent<T> component, Class<T> clazz)
     {
         Set<Type> types = component.getTypes();
-
+        types.add(Object.class);
+        
         if (clazz.isPrimitive() || clazz.isArray())
         {
             types.add(clazz);
-            types.add(Object.class);
 
-            if (clazz.isPrimitive())
-            {
-                types.add(ClassUtil.getPrimitiveWrapper(clazz));
-            }
+//            if (clazz.isPrimitive())
+//            {
+//                types.add(ClassUtil.getPrimitiveWrapper(clazz));
+//            }
 
         }
         else
         {
-            if (ClassUtil.isPrimitiveWrapper(clazz))
-            {
-                types.add(ClassUtil.getWrapperPrimitive(clazz));
-            }
+//            if (ClassUtil.isPrimitiveWrapper(clazz))
+//            {
+//                types.add(ClassUtil.getWrapperPrimitive(clazz));
+//            }
 
             ClassUtil.setTypeHierarchy(component.getTypes(), clazz);
         }
@@ -592,10 +597,8 @@
                 isSpecializes = true;
             }
 
-            Type[] observableTypes = AnnotationUtil.getMethodParameterGenericTypesWithGivenAnnotation(declaredMethod, Fires.class);
-            EventUtil.checkObservableMethodParameterConditions(observableTypes, "method parameter", "method : " + declaredMethod.getName() + "in class : " + clazz.getName());
-
             ProducerComponentImpl<?> newComponent = createProducerComponent(declaredMethod.getReturnType(), declaredMethod, component, isSpecializes);
+
             if (newComponent != null)
             {
                 if (isRealizes)
@@ -635,7 +638,7 @@
 
     }
 
-    private static <T> ProducerComponentImpl<T> createProducerComponent(Class<T> returnType, Method method, AbstractComponent<?> parent, boolean isSpecializes)
+    public static <T> ProducerComponentImpl<T> createProducerComponent(Class<T> returnType, Method method, AbstractComponent<?> parent, boolean isSpecializes)
     {
         ProducerComponentImpl<T> component = new ProducerComponentImpl<T>(parent, returnType);
         component.setCreatorMethod(method);
@@ -817,10 +820,6 @@
 
     private static <T> void defineInternalInjectedFields(ComponentImpl<T> component, Class<T> clazz, boolean fromSuperClazz)
     {
-        if (!WebBeansUtil.checkObservableFieldsConditions(clazz))
-        {
-            WebBeansUtil.checkObtainsFieldConditions(clazz);
-        }
 
         Field[] fields = clazz.getDeclaredFields();
         if (fields.length != 0)
@@ -864,7 +863,6 @@
                     {
                         if (!fromSuperClazz)
                         {
-                            WebBeansUtil.addInjectedImplicitEventComponent(field);
                             component.addInjectedField(field);
                             addFieldInjectionPointMetaData(component, field);
                         }
@@ -884,7 +882,6 @@
                             
                             if(!defined)
                             {
-                                WebBeansUtil.addInjectedImplicitEventComponent(field);
                                 component.addInjectedField(field);
                                 addFieldInjectionPointMetaData(component, field);                                
                             }
@@ -1107,6 +1104,7 @@
         InjectionPoint injectionPoint = InjectionPointFactory.getFieldInjectionPointData(owner, field);
         if (injectionPoint != null)
         {
+            addImplicitComponentForInjectionPoint(injectionPoint);
             owner.addInjectionPoint(injectionPoint);
         }
     }
@@ -1116,6 +1114,7 @@
         List<InjectionPoint> injectionPoints = InjectionPointFactory.getMethodInjectionPointData(owner, method);
         for (InjectionPoint injectionPoint : injectionPoints)
         {
+            addImplicitComponentForInjectionPoint(injectionPoint);
             owner.addInjectionPoint(injectionPoint);
         }
     }
@@ -1125,7 +1124,27 @@
         List<InjectionPoint> injectionPoints = InjectionPointFactory.getConstructorInjectionPointData(owner, constructor);
         for (InjectionPoint injectionPoint : injectionPoints)
         {
+            addImplicitComponentForInjectionPoint(injectionPoint);
             owner.addInjectionPoint(injectionPoint);
         }
     }
+    
+    public static void addImplicitComponentForInjectionPoint(InjectionPoint injectionPoint)
+    {
+        Annotation obtains = injectionPoint.getAnnotation(Obtains.class);
+        Annotation fires = injectionPoint.getAnnotation(Fires.class);
+                
+        //If contains the @Obtains, defines implicit component
+        if(obtains != null)
+        {
+            WebBeansUtil.checkObtainsInjectionPointConditions(injectionPoint);
+            WebBeansUtil.addInjectedImplicitInstanceComponent(injectionPoint);
+        }                                  
+        //If contains the @Fires, defines implicit component
+        else if(fires != null)
+        {
+            EventUtil.checkObservableInjectionPointConditions(injectionPoint);
+            WebBeansUtil.addInjectedImplicitEventComponent(injectionPoint);
+        }                                                                  
+    }
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java Sat Mar 14 21:24:30 2009
@@ -36,6 +36,7 @@
 import org.apache.webbeans.component.WebBeansType;
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.container.activity.ActivityManager;
 import org.apache.webbeans.decorator.DecoratorUtil;
 import org.apache.webbeans.deployment.StereoTypeManager;
 import org.apache.webbeans.deployment.StereoTypeModel;
@@ -150,24 +151,24 @@
     private void validateInjectionPoints()
     {
         logger.info("Validation injection points is started");
-        
+
         ManagerImpl manager = ManagerImpl.getManager();
         InjectionResolver resolver = InjectionResolver.getInstance();
         Set<Bean<?>> beans = manager.getBeans();
-        
-        if(beans != null && beans.size() > 0)
+
+        if (beans != null && beans.size() > 0)
         {
-            for(Bean<?> bean : beans)
+            for (Bean<?> bean : beans)
             {
                 Set<InjectionPoint> injectionPoints = bean.getInjectionPoints();
-                for(InjectionPoint injectionPoint : injectionPoints)
+                for (InjectionPoint injectionPoint : injectionPoints)
                 {
-                    //check for InjectionPoint injection
-                    if(injectionPoint.getType().equals(InjectionPoint.class))
+                    // check for InjectionPoint injection
+                    if (injectionPoint.getType().equals(InjectionPoint.class))
                     {
-                        if(injectionPoint.getAnnotations().length == 1 && injectionPoint.getAnnotations()[0].annotationType().equals(Current.class))
+                        if (injectionPoint.getAnnotations().length == 1 && injectionPoint.getAnnotations()[0].annotationType().equals(Current.class))
                         {
-                            if(!bean.getScopeType().equals(Dependent.class))
+                            if (!bean.getScopeType().equals(Dependent.class))
                             {
                                 throw new WebBeansConfigurationException("Bean " + bean + "scope can not define other scope except @Dependent to inject InjectionPoint");
                             }
@@ -175,12 +176,12 @@
                     }
                     else
                     {
-                        resolver.checkInjectionPoints(injectionPoint);   
-                    }                    
+                        resolver.checkInjectionPoints(injectionPoint);
+                    }
                 }
             }
         }
-        
+
         logger.info("Injection points are validated succesfully");
     }
 
@@ -300,10 +301,15 @@
                     {
                         String specialClassName = specialIterator.next();
                         Class<?> specialClass = ClassUtil.getClassFromName(specialClassName);
-
+                        
                         if (superClass == null)
                         {
                             superClass = specialClass.getSuperclass();
+                            
+                            if(superClass.equals(Object.class))
+                            {
+                                throw new WebBeansConfigurationException("Specalized class : " + specialClassName + " must extend another class");
+                            }
                         }
                         else
                         {
@@ -391,7 +397,7 @@
     {
         logger.info("Checking StereoTypes constraints is started");
 
-        Map<String, Set<String>> stereotypeMap = scanner.getANNOTATION_DB().getAnnotationIndex();
+        Map<String, Set<String>> stereotypeMap = scanner.getANNOTATION_DB().getClassIndex();
         if (stereotypeMap != null && stereotypeMap.size() > 0)
         {
             Set<String> stereoClassSet = stereotypeMap.keySet();
@@ -399,9 +405,9 @@
             while (steIterator.hasNext())
             {
                 String steroClassName = steIterator.next();
-
+                
                 Class<? extends Annotation> stereoClass = (Class<? extends Annotation>) ClassUtil.getClassFromName(steroClassName);
-
+                
                 if (AnnotationUtil.isStereoTypeAnnotation(stereoClass))
                 {
                     if (!XMLAnnotationTypeManager.getInstance().isStereoTypeExist(stereoClass))
@@ -426,6 +432,8 @@
             component = SimpleWebBeansConfigurator.define(clazz, WebBeansType.SIMPLE);
             if (component != null)
             {
+                ActivityManager.addBean(WebBeansUtil.createNewSimpleBeanComponent(component));
+                
                 DecoratorUtil.checkSimpleWebBeanDecoratorConditions(component);
 
                 /* I have added this into the ComponentImpl.afterCreate(); */

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansFinder.java Sat Mar 14 21:24:30 2009
@@ -100,4 +100,9 @@
             singletonMap.clear();   
         }
     }
+    
+    public static void removeInstance(String name)
+    {
+        singletonMap.remove(name);
+    }
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/BeanInheritedMetaData.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/BeanInheritedMetaData.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/BeanInheritedMetaData.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/BeanInheritedMetaData.java Sat Mar 14 21:24:30 2009
@@ -88,17 +88,20 @@
     {
         Annotation[] inheritedAnnotations = AnnotationUtil.getMetaAnnotations(inheritedClass.getDeclaredAnnotations(), annotationType);
         
-        if(inheritedAnnotations.length >0 && inheritedAnnotations[0].annotationType().isAnnotationPresent(Inherited.class))
+        if(inheritedAnnotations.length > 0)
         {
-            Annotation annotation = inheritedAnnotations[0];
-            
-            if(annotationType.equals(ScopeType.class))
+            if(inheritedAnnotations[0].annotationType().isAnnotationPresent(Inherited.class))
             {
-                this.inheritedScopeType = annotation;
-            }
-            else if(annotationType.equals(DeploymentType.class))
-            {
-                this.inheritedDeploymentType = annotation;
+                Annotation annotation = inheritedAnnotations[0];
+                
+                if(annotationType.equals(ScopeType.class))
+                {
+                    this.inheritedScopeType = annotation;
+                }
+                else if(annotationType.equals(DeploymentType.class))
+                {
+                    this.inheritedDeploymentType = annotation;
+                }                
             }
         }
         else

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java Sat Mar 14 21:24:30 2009
@@ -26,6 +26,7 @@
 import javax.inject.manager.InjectionPoint;
 
 import org.apache.webbeans.annotation.CurrentLiteral;
+import org.apache.webbeans.component.InstanceComponentImpl;
 import org.apache.webbeans.component.ObservableComponentImpl;
 import org.apache.webbeans.component.ProducerComponentImpl;
 import org.apache.webbeans.config.WebBeansFinder;
@@ -166,6 +167,11 @@
     {
         Asserts.assertNotNull(apiType, "apiType parameter can not be null");
         Asserts.assertNotNull(binding, "binding parameter can not be null");
+        
+        if(apiType.isPrimitive())
+        {
+            apiType = ClassUtil.getPrimitiveWrapper(apiType);
+        }
 
         ManagerImpl manager = ManagerImpl.getManager();
 
@@ -206,6 +212,11 @@
                 while (itComponentApiTypes.hasNext())
                 {
                     Class<?> componentApiType = (Class<?>)itComponentApiTypes.next();
+                    
+                    if(componentApiType.isPrimitive())
+                    {
+                        componentApiType = ClassUtil.getPrimitiveWrapper(componentApiType);
+                    }
 
                     if (actualTypeArguments.length > 0)
                     {
@@ -233,6 +244,19 @@
                                     break;
                                 }
                             }
+                            else if(component instanceof InstanceComponentImpl)
+                            {
+                                InstanceComponentImpl<?> instanceComponent = (InstanceComponentImpl<?>)component;
+                                actualArgs = instanceComponent.getActualTypeArguments();
+                                
+                                if (Arrays.equals(actualArgs, actualTypeArguments))
+                                {
+                                    results.add((Bean<T>) component);
+                                    break;
+                                }
+                                
+                                
+                            }
 
                             else
                             {

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java Sat Mar 14 21:24:30 2009
@@ -162,12 +162,12 @@
     {
         if(component instanceof AbstractComponent)
         {
-            getManager().components.add(component);    
+            this.components.add(component);    
         }
         else
         {
             ThirdpartyBeanImpl<?> bean = new ThirdpartyBeanImpl(component);
-            getManager().components.add(bean);
+            this.components.add(bean);
         }
         
 
@@ -432,17 +432,17 @@
 
     public Set<Bean<?>> getBeans()
     {
-        return getManager().components;
+        return this.components;
     }
 
     public Set<Interceptor> getInterceptors()
     {
-        return getManager().webBeansInterceptors;
+        return this.webBeansInterceptors;
     }
 
     public Set<Decorator> getDecorators()
     {
-        return getManager().webBeansDecorators;
+        return this.webBeansDecorators;
     }
 
     private void addContext(Class<? extends Annotation> scopeType, javax.context.Context context)

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/activity/ActivityManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/activity/ActivityManager.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/activity/ActivityManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/activity/ActivityManager.java Sat Mar 14 21:24:30 2009
@@ -17,6 +17,8 @@
 package org.apache.webbeans.container.activity;
 
 
+import javax.inject.manager.Bean;
+
 import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.container.ManagerImpl;
 
@@ -46,4 +48,8 @@
         return this.rootActivity;
     }
 
+    public static void addBean(Bean<?> bean)
+    {
+        getInstance().getRootActivity().addBean(bean);
+    }
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/DeploymentTypeManager.java Sat Mar 14 21:24:30 2009
@@ -41,17 +41,14 @@
     public static DeploymentTypeManager getInstance()
     {
         DeploymentTypeManager instance = (DeploymentTypeManager) WebBeansFinder.getSingletonInstance(WebBeansFinder.SINGLETON_DEPLOYMENT_TYPE_MANAGER);
-        
-        if (!instance.deploymentTypeMap.containsKey(Standard.class)) 
+
+        if (!instance.deploymentTypeMap.containsKey(Standard.class))
         {
             instance.deploymentTypeMap.put(Standard.class, Integer.valueOf(0));
-        }
-        
-        if (!instance.deploymentTypeMap.containsKey(Production.class)) 
-        {
             instance.deploymentTypeMap.put(Production.class, Integer.valueOf(1));
+
         }
-        
+
         return instance;
     }
 
@@ -68,7 +65,7 @@
             }
         }
     }
-    
+
     public void removeProduction()
     {
         this.deploymentTypeMap.remove(Production.class);
@@ -110,32 +107,31 @@
         Asserts.assertNotNull(deploymentType, "deploymentType parameter can not be null");
         return deploymentTypeMap.containsKey(deploymentType);
     }
-    
+
     private static class DeploymentComparator implements Comparator<DeploymentTypeObject>
     {
 
         public int compare(DeploymentTypeObject o1, DeploymentTypeObject o2)
         {
-            if(o1.getPrecedence() < o2.getPrecedence())
+            if (o1.getPrecedence() < o2.getPrecedence())
             {
                 return -1;
             }
-            else if(o1.getPrecedence() > o2.getPrecedence())
+            else if (o1.getPrecedence() > o2.getPrecedence())
             {
                 return 1;
             }
-            
+
             return 0;
         }
 
-        
     }
-    
+
     private static class DeploymentTypeObject
     {
         private int precedence;
         private Class<? extends Annotation> type;
-        
+
         public DeploymentTypeObject(Class<? extends Annotation> clazz, int precedence)
         {
             this.precedence = precedence;
@@ -173,34 +169,32 @@
         {
             this.type = type;
         }
-        
-        
+
     }
-    
+
     public List<Class<? extends Annotation>> getEnabledDeploymentTypes()
     {
         List<Class<? extends Annotation>> enabledDeploymentTypes = new ArrayList<Class<? extends Annotation>>();
-        
+
         List<DeploymentTypeObject> objects = new ArrayList<DeploymentTypeObject>();
-        
+
         Set<Class<? extends Annotation>> keys = this.deploymentTypeMap.keySet();
-        Iterator<Class<? extends Annotation>> it = keys.iterator();       
-        while(it.hasNext())
+        Iterator<Class<? extends Annotation>> it = keys.iterator();
+        while (it.hasNext())
         {
             Class<? extends Annotation> key = it.next();
             Integer value = this.deploymentTypeMap.get(key);
-            
-            objects.add(new DeploymentTypeObject(key,value));
-       }
-        
-        
+
+            objects.add(new DeploymentTypeObject(key, value));
+        }
+
         Collections.sort(objects, new DeploymentComparator());
-        
-        for(DeploymentTypeObject obj : objects)
+
+        for (DeploymentTypeObject obj : objects)
         {
             enabledDeploymentTypes.add(obj.getType());
         }
-        
+
         return enabledDeploymentTypes;
     }
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java Sat Mar 14 21:24:30 2009
@@ -34,10 +34,13 @@
 import org.apache.webbeans.context.ContextFactory;
 import org.apache.webbeans.context.creational.CreationalContextFactory;
 import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.util.AnnotationUtil;
 
 public class BeanObserverImpl<T> implements Observer<T>
 {
+    private WebBeansLogger logger = WebBeansLogger.getLogger(BeanObserverImpl.class);
+    
     private ObservesMethodsOwner<?> bean;
 
     private Method observerMethod;
@@ -109,7 +112,16 @@
         }
         catch (Exception e)
         {
-            throw new WebBeansException(e);
+            if(!getType().equals(TransactionalObserverType.NONE))
+            {
+                logger.error("Error is occured while notifying observer in class : " 
+                        + observerMethod.getDeclaringClass().getName() + " in method : " + observerMethod.getName() , e);
+                
+            }
+            else
+            {
+                throw new WebBeansException(e.getCause());   
+            }
         }
         finally
         {

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java Sat Mar 14 21:24:30 2009
@@ -27,6 +27,7 @@
 import javax.inject.Disposes;
 import javax.inject.Initializer;
 import javax.inject.Produces;
+import javax.inject.manager.InjectionPoint;
 
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.util.AnnotationUtil;
@@ -119,44 +120,27 @@
         }
     }
 
-    public static void checkObservableMethodParameterConditions(Type[] parametersType, String fieldName, String errorMessage)
-    {
-        Asserts.assertNotNull(parametersType, "parametersType parameter can not be null");
 
-        for (Type observableType : parametersType)
-        {
-            EventUtil.checkObservableFieldConditions(observableType, fieldName, errorMessage);
-        }
-
-    }
-
-    public static void checkObservableFieldConditions(Type fieldType, String fieldName, String errorMessage)
+    public static void checkObservableInjectionPointConditions(InjectionPoint injectionPoint)
     {
-        Asserts.assertNotNull(fieldType, "fieldType parameter can not be null");
-        Asserts.assertNotNull(fieldName, "fieldName parameter can not be null");
-
-        if (errorMessage == null)
-        {
-            errorMessage = "Failed on check @Observable field/method-parameter with name : " + fieldName;
-        }
 
-        if (!ClassUtil.isParametrizedType(fieldType))
+        if (!ClassUtil.isParametrizedType(injectionPoint.getType()))
         {
-            throw new WebBeansConfigurationException("@Observable field/method-parameter in " + errorMessage + " with field : " + fieldName + " must be ParametrizedType with actual type argument");
+            throw new WebBeansConfigurationException("@Observable field injection " + injectionPoint + " must be ParametrizedType with actual type argument");
         }
         else
         {
-            ParameterizedType pType = (ParameterizedType) fieldType;
+            ParameterizedType pType = (ParameterizedType) injectionPoint.getType();
             Class<?> clazz = (Class<?>) pType.getRawType();
 
             if (!clazz.equals(Event.class))
             {
-                throw new WebBeansConfigurationException("@Observable field/method-parameter in " + errorMessage + " with field : " + fieldName + " must be ParametrizedType with raw type argument javax.webbeans.Event");
+                throw new WebBeansConfigurationException("@Observable field injection " + injectionPoint +  " must be ParametrizedType with raw type argument javax.webbeans.Event");
             }
 
             if (!ClassUtil.checkParametrizedType(pType))
             {
-                throw new WebBeansConfigurationException("@Observable field/method-parameter in " + errorMessage + " with field : " + fieldName + " can not be ParametrizedType with type variable or wildcard type arguments");
+                throw new WebBeansConfigurationException("@Observable field injection " + injectionPoint + " can not be ParametrizedType with type variable or wildcard type arguments");
             }
         }
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java Sat Mar 14 21:24:30 2009
@@ -15,6 +15,7 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Method;
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
@@ -33,6 +34,7 @@
 
 import org.apache.webbeans.component.ObservesMethodsOwner;
 import org.apache.webbeans.config.WebBeansFinder;
+import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.spi.ServiceLoader;
 import org.apache.webbeans.spi.TransactionService;
@@ -90,7 +92,7 @@
 
         ObserverImpl<T> observerImpl = new ObserverImpl<T>(observer, eventType.getRawType(), annotations);
 
-        Set<ObserverImpl<?>> set = observers.get(eventType);
+        Set<ObserverImpl<?>> set = observers.get(eventType.getRawType());
         if (set == null)
         {
             set = new HashSet<ObserverImpl<?>>();
@@ -114,7 +116,11 @@
                 ObserverImpl<?> s = it.next();
                 Observer<T> ob = (Observer<T>) s.getObserver();
 
-                if (ob.equals(observer))
+                Set<Annotation> evenBindings = s.getEventBindingTypes();
+                Annotation[] anns = new Annotation[evenBindings.size()];
+                anns = evenBindings.toArray(anns);
+                
+                if (ob.equals(observer) && Arrays.equals(anns, annotations))
                 {
                     set.remove(s);
                 }
@@ -127,7 +133,7 @@
         EventUtil.checkEventType(eventType.getRawType());
         EventUtil.checkEventBindings(annotations);
 
-        if (observers.containsKey(eventType))
+        if (observers.containsKey(eventType.getRawType()))
         {
             Set<ObserverImpl<?>> set = observers.get(eventType.getRawType());
             Iterator<ObserverImpl<?>> it = set.iterator();
@@ -136,7 +142,11 @@
                 ObserverImpl<?> s = it.next();
                 Observer<T> ob = (Observer<T>) s.getObserver();
 
-                if (ob.equals(observer))
+                Set<Annotation> evenBindings = s.getEventBindingTypes();
+                Annotation[] anns = new Annotation[evenBindings.size()];
+                anns = evenBindings.toArray(anns);
+                
+                if (ob.equals(observer) && Arrays.equals(anns, annotations))
                 {
                     set.remove(s);
                 }
@@ -242,12 +252,26 @@
                 }
 
             }
-            catch (Exception e)
+            catch (WebBeansException e)
             {
-                if (!RuntimeException.class.isAssignableFrom(e.getClass()))
+                if (!RuntimeException.class.isAssignableFrom(e.getCause().getClass()))
                 {
                     throw new ObserverException("Exception is thrown while handling event object with type : " + event.getClass().getName(), e);
                 }
+                else
+                {
+                    RuntimeException rte = (RuntimeException)e.getCause();
+                    throw rte;
+                }
+            }
+            catch(RuntimeException e)
+            {
+                throw e;
+            }
+            
+            catch(Exception e)
+            {
+                throw new WebBeansException(e);
             }
         }
     }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverImpl.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ObserverImpl.java Sat Mar 14 21:24:30 2009
@@ -15,12 +15,10 @@
 
 import java.lang.annotation.Annotation;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 import javax.event.Observer;
 
-import org.apache.webbeans.util.AnnotationUtil;
 
 /**
  * Implementation of the {@link Observer} interface contract.
@@ -81,15 +79,6 @@
                     ok = false;
                     break;
                 }
-                else
-                {
-                    if (!AnnotationUtil.isAnnotationMemberExist(annot.annotationType(), annot, getAnnotation(this.eventBindingTypes,annot.annotationType())))
-                    {
-                        ok = false;
-                        break;
-                    }
-                }
-
             }            
         }
         else
@@ -108,15 +97,6 @@
                     ok = false;
                     break;
                 }
-                else
-                {
-                    if (!AnnotationUtil.isAnnotationMemberExist(annot.annotationType(), annot, getAnnotation(eventAnnots,annot.annotationType())))
-                    {
-                        ok = false;
-                        break;
-                    }
-                }
-
             }            
             
         }
@@ -125,22 +105,7 @@
 
     }
 
-    private Annotation getAnnotation(Set<Annotation> annots,Class<? extends Annotation> type)
-    {
-        Iterator<Annotation> it = annots.iterator();
-        while (it.hasNext())
-        {
-            Annotation annot = it.next();
-
-            if (annot.annotationType().equals(type))
-            {
-                return annot;
-            }
-        }
-
-        return null;
-    }
-
+    
     /**
      * Gets event binding types.
      */

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java Sat Mar 14 21:24:30 2009
@@ -22,9 +22,6 @@
 import javax.context.Dependent;
 import javax.event.Event;
 import javax.event.Fires;
-import javax.inject.Instance;
-import javax.inject.New;
-import javax.inject.Obtains;
 import javax.inject.manager.Bean;
 import javax.inject.manager.InjectionPoint;
 
@@ -95,22 +92,12 @@
                 //X TODO do we need the args too?
                 return injectResource(type, this.injectionAnnotations);
             }
-            
-            if (isNewBinding(annotations))
-            {
-                return injectForNew(type, annotations);
-            }
-
+                        
             if (isObservableBinding(annotations))
             {
                 return injectForObservable(args, annotations);
             }
-            
-            if(isObtainsBinding(annotations))
-            {
-                return injectForObtains(type, args, annotations);
-            }
-            
+                        
             InjectionPoint injectionPoint = InjectionPointFactory.getPartialInjectionPoint(this.injectionOwnerComponent, type, this.injectionMember, this.injectionAnnotations, annotations);                        
             Bean<?> component = InjectionResolver.getInstance().getInjectionPointBean(injectionPoint);
             
@@ -152,19 +139,6 @@
         return AnnotationUtil.hasResourceAnnotation(annotations);
     }
 
-    private boolean isNewBinding(Annotation... annotations)
-    {
-        if (annotations.length == 1)
-        {
-            if (annotations[0].annotationType().equals(New.class))
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
     private boolean isObservableBinding(Annotation... annotations)
     {
         for (Annotation ann : annotations)
@@ -178,20 +152,6 @@
         return false;
     }
     
-    private boolean isObtainsBinding(Annotation... annotations)
-    {
-        for (Annotation ann : annotations)
-        {
-            if (ann.annotationType().equals(Obtains.class))
-            {
-                return true;
-            }
-        }
-
-        return false;
-    }
-    
-
     /**
      * create the instance for injecting web beans resources.
      * @see AnnotationUtil#isResourceAnnotation(Class)
@@ -227,22 +187,6 @@
         return ret;
     }
     
-    private Object injectForNew(Type type, Annotation... annotations)
-    {
-        Class<?> clazz = null;
-
-        if (type instanceof ParameterizedType)
-        {
-            clazz = (Class<?>) ((ParameterizedType) type).getRawType();
-        }
-        else if (type instanceof Class)
-        {
-            clazz = (Class<?>) type;
-        }
-
-        return injectForDependent(WebBeansUtil.createNewComponent(clazz),null);
-    }
-
     private Object injectForObservable(Type[] args, Annotation... annotations)
     {
         Bean<?> bean = InjectionResolver.getInstance().implResolveByType(Event.class, args, annotations).iterator().next();
@@ -250,14 +194,6 @@
         return injectForDependent(bean,null);
     }
     
-    private <T> Object injectForObtains(Class<T> instanceType, Type[] args, Annotation...annotations)
-    {   
-        @SuppressWarnings("unchecked")
-        Class<Instance<T>> clazz = (Class<Instance<T>>)instanceType;
-        return injectForDependent(WebBeansUtil.createInstanceComponent(clazz, args[0] , annotations),null);
-        
-    }
-
     private Object injectForDependent(Bean<?> component, InjectionPoint injectionPoint)
     {
         Object object = null;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java Sat Mar 14 21:24:30 2009
@@ -23,9 +23,7 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.event.Fires;
 import javax.event.Observes;
-import javax.inject.Obtains;
 import javax.inject.manager.Bean;
 import javax.inject.manager.InjectionPoint;
 
@@ -94,10 +92,10 @@
     
     private static boolean checkFieldApplicable(Annotation[] anns)
     {
-        if(AnnotationUtil.isAnnotationExist(anns, Fires.class) || AnnotationUtil.isAnnotationExist(anns, Obtains.class))
-        {
-            return true;
-        }
+//        if(AnnotationUtil.isAnnotationExist(anns, Fires.class) || AnnotationUtil.isAnnotationExist(anns, Obtains.class))
+//        {
+//            return true;
+//        }
      
         return false;
     }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java Sat Mar 14 21:24:30 2009
@@ -17,7 +17,10 @@
 package org.apache.webbeans.inject.impl;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
 import java.lang.reflect.Member;
+import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 import java.util.HashSet;
 import java.util.Set;
@@ -115,4 +118,26 @@
         return false;
     }
 
+    public String toString()
+    {
+        StringBuffer buffer = new StringBuffer();
+        if(injectionMember instanceof Constructor)
+        {
+            Constructor<?> constructor = (Constructor<?>) this.injectionMember;
+            buffer.append("Constructor Injection with name :  " + constructor.getName() + ownerBean.toString());
+        }
+        else if(injectionMember instanceof Method)
+        {
+            Method method = (Method)this.injectionMember;
+            buffer.append("Method Injection with name :  " + method.getName() + ownerBean.toString());
+            
+        }
+        else if(injectionMember instanceof Field)
+        {
+            Field field = (Field) this.injectionMember;
+            buffer.append("Field Injection with name :  " + field.getName() + ownerBean.toString());            
+        }
+        
+        return buffer.toString();
+    }
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/instance/InstanceImpl.java Sat Mar 14 21:24:30 2009
@@ -21,6 +21,7 @@
 import java.util.HashSet;
 import java.util.Set;
 
+import javax.inject.DuplicateBindingTypeException;
 import javax.inject.Instance;
 import javax.inject.Obtains;
 import javax.inject.manager.Bean;
@@ -79,6 +80,11 @@
         {
             for(Annotation annot : annotations)
             {
+                if(this.bindingAnnotations.contains(annot))
+                {
+                    throw new DuplicateBindingTypeException("Duplicate Binding Exception, " + this.toString());
+                }
+                
                 this.bindingAnnotations.add(annot);
             }
         }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java Sat Mar 14 21:24:30 2009
@@ -622,7 +622,7 @@
 
         Integer modifier = clazz.getModifiers();
 
-        if (!isAbstract(modifier) && !isInterface(modifier) && clazz.getEnclosingClass() == null)
+        if (!isAbstract(modifier) && !isInterface(modifier))
         {
             return true;
         }
@@ -1351,5 +1351,16 @@
         }
         
     }
-    
+ 
+    public static Throwable getRootException(Throwable throwable)
+    {
+        if(throwable.getCause() == null)
+        {
+            return throwable;
+        }
+        else
+        {
+            return getRootException(throwable.getCause());
+        }
+    }
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Sat Mar 14 21:24:30 2009
@@ -57,10 +57,11 @@
 import javax.inject.Instance;
 import javax.inject.New;
 import javax.inject.NullableDependencyException;
-import javax.inject.Obtains;
 import javax.inject.Produces;
+import javax.inject.Specializes;
 import javax.inject.UnproxyableDependencyException;
 import javax.inject.manager.Bean;
+import javax.inject.manager.InjectionPoint;
 import javax.inject.manager.Interceptor;
 import javax.inject.manager.Manager;
 import javax.interceptor.AroundInvoke;
@@ -107,7 +108,6 @@
 import org.apache.webbeans.ejb.EJBUtil;
 import org.apache.webbeans.ejb.orm.ORMUtil;
 import org.apache.webbeans.event.EventImpl;
-import org.apache.webbeans.event.EventUtil;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.intercept.InterceptorData;
@@ -240,9 +240,6 @@
 
         if (result != null)
         {
-            Type[] observableTypes = AnnotationUtil.getConstructorParameterGenericTypesWithGivenAnnotation(result, Fires.class);
-            EventUtil.checkObservableMethodParameterConditions(observableTypes, "constructor parameter", "constructor : " + result.getName() + "in class : " + clazz.getName());
-
             Annotation[][] parameterAnns = result.getParameterAnnotations();
             for (Annotation[] parameters : parameterAnns)
             {
@@ -374,9 +371,6 @@
 
     public static void checkProducerMethodDisposal(Method disposalMethod, String parentImplClazzName)
     {
-        Type[] observableTypes = AnnotationUtil.getMethodParameterGenericTypesWithGivenAnnotation(disposalMethod, Fires.class);
-        EventUtil.checkObservableMethodParameterConditions(observableTypes, "method parameter", "method : " + disposalMethod.getName() + "in class : " + parentImplClazzName);
-
         if (AnnotationUtil.isMethodMultipleParameterAnnotationExist(disposalMethod, Disposes.class))
         {
             throw new WebBeansConfigurationException("Disposal method : " + disposalMethod.getName() + " in class " + parentImplClazzName + " has multiple @Disposes annotation parameter");
@@ -563,6 +557,43 @@
         return comp;
     }
 
+    public static <T> NewComponentImpl<T> createNewSimpleBeanComponent(ComponentImpl<T> component)
+    {
+        Asserts.assertNotNull(component, "component argument can not be null");
+
+        NewComponentImpl<T> comp = null;
+
+        comp = new NewComponentImpl<T>(component.getReturnType(), WebBeansType.NEW);
+        
+        DefinitionUtil.defineApiTypes(comp, component.getReturnType());
+        comp.setConstructor(component.getConstructor());
+        
+        for(Field injectedField : component.getInjectedFields())
+        {
+            comp.addInjectedField(injectedField);
+        }
+        
+        for(Method injectedMethod : component.getInjectedMethods())
+        {
+            comp.addInjectedMethod(injectedMethod);
+        }
+        
+        List<InterceptorData> interceptorList = component.getInterceptorStack();
+        if(!interceptorList.isEmpty())
+        {
+            component.getInterceptorStack().addAll(interceptorList);   
+        }
+        
+        
+        comp.setImplScopeType(new DependentScopeLiteral());
+        comp.addBindingType(new NewLiteral());
+        comp.setType(new StandardLiteral());
+        comp.setName(null);
+        
+
+        return comp;
+    }    
+    
     public static <T, K> ObservableComponentImpl<T, K> createObservableImplicitComponent(Class<T> returnType, Class<K> eventType, Annotation... annotations)
     {
         ObservableComponentImpl<T, K> component = new ObservableComponentImpl<T, K>(returnType, eventType, WebBeansType.OBSERVABLE);
@@ -607,16 +638,18 @@
         return managerComponent;
     }
     
-    public static <T> InstanceComponentImpl<T> createInstanceComponent(Class<Instance<T>> clazz, Type injectedType, Annotation...obtainsBindings)
+    public static <T> InstanceComponentImpl<T> createInstanceComponent(ParameterizedType instance,Class<Instance<T>> clazz, Type injectedType, Annotation...obtainsBindings)
     {
-        InstanceComponentImpl<T> instanceComponent = new InstanceComponentImpl<T>(clazz,injectedType);
+        InstanceComponentImpl<T> instanceComponent = new InstanceComponentImpl<T>(clazz,injectedType, instance.getActualTypeArguments());
         
         instanceComponent.addApiType(clazz);
-        instanceComponent.addApiType(InstanceComponentImpl.class);
         instanceComponent.addApiType(Object.class);
         
         DefinitionUtil.defineBindingTypes(instanceComponent, obtainsBindings);
         instanceComponent.setImplScopeType(new DependentScopeLiteral());
+        instanceComponent.setType(new StandardLiteral());
+        instanceComponent.setName(null);
+        
         
         return instanceComponent;
     }
@@ -1068,10 +1101,17 @@
 
     public static String getSimpleWebBeanDefaultName(String clazzName)
     {
-        StringBuffer name = new StringBuffer(clazzName);
-        name.setCharAt(0, Character.toLowerCase(name.charAt(0)));
+        Asserts.assertNotNull(clazzName);
+        
+        if(clazzName.length() > 0)
+        {
+            StringBuffer name = new StringBuffer(clazzName);
+            name.setCharAt(0, Character.toLowerCase(name.charAt(0)));
 
-        return name.toString();
+            return name.toString();            
+        }
+        
+        return clazzName;
     }
 
     public static String getProducerDefaultName(String methodName)
@@ -1182,54 +1222,72 @@
     {
         Asserts.nullCheckForClass(specializedClass);
 
-        Bean<?> parent = null;
-        Bean<?> child = null;
+        Bean<?> superBean = null;
+        Bean<?> specialized = null;
         Set<Bean<?>> resolvers = null;
-        if ((resolvers = isConfiguredWebBeans(specializedClass)) != null)
-        {
-            parent = resolvers.iterator().next();
-            Class<?> superClass = specializedClass.getSuperclass();
-            
-            resolvers = isConfiguredWebBeans(superClass);
+        
+        if ((resolvers = isConfiguredWebBeans(specializedClass,true)) != null)
+        {            
+            if(resolvers.isEmpty())
+            {
+                throw new InconsistentSpecializationException("Specialized bean for class : " + specializedClass + " is not enabled in the deployment.");
+            }
             
-            if(resolvers.size() > 2)
+            if(resolvers.size() > 1)
             {
-                throw new WebBeansConfigurationException("There are more than bean for specialized component class : " + specializedClass);
+                throw new InconsistentSpecializationException("More than one specialized bean for class : " + specializedClass + " is enabled in the deployment.");
             }
             
-            resolvers.remove(parent);             
+                                   
+            specialized = resolvers.iterator().next();
+            
+            Class<?> superClass = specializedClass.getSuperclass();
+            
+            resolvers = isConfiguredWebBeans(superClass,false);
             
-            if ((child = resolvers.iterator().next()) != null)
+            for(Bean<?> candidates : resolvers)
+            {
+                AbstractComponent<?> candidate = (AbstractComponent<?>)candidates;
+                
+                if(candidate.getReturnType().equals(superClass))
+                {
+                    superBean = candidates;
+                    break;
+                }
+            }
+                        
+            if (superBean != null)
             {
-                int res = DeploymentTypeManager.getInstance().comparePrecedences(parent.getDeploymentType(), child.getDeploymentType());
+                int res = DeploymentTypeManager.getInstance().comparePrecedences(specialized.getDeploymentType(), superBean.getDeploymentType());
                 if (res <= 0)
                 {
                     throw new InconsistentSpecializationException("@Specializes exception. Class : " + specializedClass.getName() + " must have higher deployment type precedence from the class : " + superClass.getName());
                 }
                 
-                AbstractComponent<?> comp = (AbstractComponent<?>)parent;
+                AbstractComponent<?> comp = (AbstractComponent<?>)specialized;
 
-                if(child.getName() != null)
+                if(superBean.getName() != null)
                 {
                     if(comp.getName() != null)
                     {
                         throw new DefinitionException("@Specialized Class : " + specializedClass.getName() + " may not explicitly declare a bean name");
                     }                    
                     
-                    comp.setName(child.getName());
+                    comp.setName(superBean.getName());
                 }
                                 
-                parent.getBindings().addAll(child.getBindings());
+                specialized.getBindings().addAll(superBean.getBindings());
             }
+            
             else
             {
-                throw new WebBeansConfigurationException("@Specializes exception. WebBean component class : " + specializedClass.getName() + " does not extends other WebBeans it specialize");
+                throw new InconsistentSpecializationException("WebBean component class : " + specializedClass.getName() + " is not enabled for specialized by the " + specializedClass + " class");
             }
         }
 
     }
 
-    public static Set<Bean<?>> isConfiguredWebBeans(Class<?> clazz)
+    public static Set<Bean<?>> isConfiguredWebBeans(Class<?> clazz,boolean annotate)
     {   
         Asserts.nullCheckForClass(clazz);
         
@@ -1240,10 +1298,30 @@
 
         while (it.hasNext())
         {
-            Bean<?> bean = it.next();
+            AbstractComponent<?> bean = (AbstractComponent<?>)it.next();
+            
             if (bean.getTypes().contains(clazz))
             {
-                beans.add(bean);
+                if(annotate)
+                {
+                    if(bean.getReturnType().isAnnotationPresent(Specializes.class))
+                    {
+                        if(!(bean instanceof NewComponentImpl))
+                        {
+                            if(DeploymentTypeManager.getInstance().isDeploymentTypeEnabled(bean.getDeploymentType()))
+                            {
+                                beans.add(bean);    
+                            }                            
+                        }                           
+                    }                                    
+                }
+                else
+                {
+                    if(DeploymentTypeManager.getInstance().isDeploymentTypeEnabled(bean.getDeploymentType()))
+                    {
+                        beans.add(bean);   
+                    }
+                }
             }
         }
 
@@ -1252,7 +1330,8 @@
 
     public static void checkSteroTypeRequirements(Component<?> component, Annotation[] anns, String errorMessage)
     {
-        Annotation[] stereoTypes = getComponentStereoTypes(component);
+        Set<Class<? extends Annotation>> allSupportedScopes = new HashSet<Class<? extends Annotation>>();
+        Annotation[] stereoTypes = getComponentStereoTypes(component);        
         for (Annotation stereoType : stereoTypes)
         {
             IStereoTypeModel model = StereoTypeManager.getInstance().getStereoTypeModel(stereoType.annotationType().getName());
@@ -1276,13 +1355,19 @@
             {
                 if (!suppScopes.isEmpty())
                 {
-                    if (!suppScopes.contains(component.getScopeType()))
-                    {
-                        throw new WebBeansConfigurationException(errorMessage + " must contains all required scope types in the @Stereotype annotation " + model.getName());
-                    }
+                    allSupportedScopes.addAll(suppScopes);
                 }
             }
         }
+        
+        if(allSupportedScopes.size() > 0)
+        {
+            if (!allSupportedScopes.contains(component.getScopeType()))
+            {
+                throw new WebBeansConfigurationException(errorMessage + " must contains at least one required scope types in its @Stereotype annotations");
+            }            
+        }        
+
     }
 
     public static void checkUnproxiableApiType(Bean<?> bean, ScopeType scopeType)
@@ -1306,7 +1391,7 @@
             }
         }
 
-        if (superClass != null)
+        if (superClass != null && !superClass.equals(Object.class))
         {
             Constructor<?> cons = ClassUtil.isContaintNoArgConstructor(superClass);
 
@@ -1434,9 +1519,6 @@
         Asserts.assertNotNull(method, "method parameter can not be null");
         Asserts.nullCheckForClass(clazz);
 
-        Type[] observableTypes = AnnotationUtil.getMethodParameterGenericTypesWithGivenAnnotation(method, Fires.class);
-        EventUtil.checkObservableMethodParameterConditions(observableTypes, "method parameter", "method : " + method.getName() + "in class : " + clazz.getName());
-
         if (AnnotationUtil.isMethodParameterAnnotationExist(method, Disposes.class) || AnnotationUtil.isMethodParameterAnnotationExist(method, Observes.class))
         {
             throw new WebBeansConfigurationException("Initializer method parameters in method : " + method.getName() + " in class : " + clazz.getName() + " can not be annotated with @Disposes or @Observers");
@@ -1507,68 +1589,36 @@
         }
 
     }
-
-    public static <T> boolean checkObservableFieldsConditions(Class<T> clazz)
-    {
-        Asserts.nullCheckForClass(clazz);
-
-        boolean ok = false;
-        Field[] candidateFields = AnnotationUtil.getClazzFieldsWithGivenAnnotation(clazz, Fires.class);
-
-        for (Field candidateField : candidateFields)
-        {
-            if(!ok)
-            {
-                ok = true;
-            }
-            EventUtil.checkObservableFieldConditions(candidateField.getGenericType(), candidateField.getName(), clazz.getName());
-        }
-
-        return ok; 
-    }
     
     /**
      * Check bean <code>Obtains</code> field injection conditions.
      * @param <T> bean class type
      * @param clazz bean class
      */
-    public static <T> void checkObtainsFieldConditions(Class<T> clazz)
-    {
-        Asserts.assertNotNull(clazz);
-        
-        Field[] candidateFields = AnnotationUtil.getClazzFieldsWithGivenAnnotation(clazz, Obtains.class);
-
-        for (Field candidateField : candidateFields)
-        {
-            Type fieldType = candidateField.getGenericType();
+    public static <T> void checkObtainsInjectionPointConditions(InjectionPoint injectionPoint)
+    {        
             Class<?> rawType = null;
-            if(ClassUtil.isParametrizedType(fieldType))
+            if(ClassUtil.isParametrizedType(injectionPoint.getType()))
             {
-                ParameterizedType pt = (ParameterizedType)fieldType;
+                ParameterizedType pt = (ParameterizedType)injectionPoint.getType();
                 
                 rawType = (Class<?>) pt.getRawType();
                 if(!(rawType.equals(Instance.class)))
                 {
-                    throw new DefinitionException("@Obtains field with name : " + candidateField.getName() + " " +
-                            "in bean class : " + clazz.getName() + " must have type javax.inject.Instance");
+                    throw new DefinitionException("@Obtains field injection " + injectionPoint.toString() + " must have type javax.inject.Instance");
                 }                
                 else
-                {
-                    
+                {                    
                     if(!ClassUtil.checkParametrizedType(pt))
                     {
-                        throw new DefinitionException("@Obtains field with name : " + candidateField.getName() + " " +
-                                "in bean class : " + clazz.getName() + " must not have TypeVariable or WildCard generic type argument");                        
+                        throw new DefinitionException("@Obtains field injection " + injectionPoint.toString() + " must not have TypeVariable or WildCard generic type argument");
                     }                    
                 }                                
             }
             else
             {
-                throw new DefinitionException("@Obtains field with name : " + candidateField.getName() + " " +
-                		"in bean class : " + clazz.getName() + " must be defined as ParameterizedType with actual type argument");
-            }
-        }
-        
+                throw new DefinitionException("@Obtains field injection " + injectionPoint.toString() + " must be defined as ParameterizedType with actual type argument");
+            }        
     }
 
     public static <T> void checkPassivationScope(AbstractComponent<T> component, ScopeType scope)
@@ -1683,13 +1733,13 @@
         return false;
     }
     
-    public static void addInjectedImplicitEventComponent(Field field)
+    public static void addInjectedImplicitEventComponent(InjectionPoint injectionPoint)
     {
-        Annotation[] anns = field.getAnnotations();
+        Annotation[] anns = injectionPoint.getAnnotations();
         
         if(AnnotationUtil.isAnnotationExist(anns, Fires.class))
         {
-            Type type = field.getGenericType();
+            Type type = injectionPoint.getType();
             
             Type[] args = new Type[0];
             
@@ -1702,8 +1752,26 @@
             
             clazz = (Class<?>)args[0];
             
-            Bean<?> bean = createObservableImplicitComponent(EventImpl.class, clazz, AnnotationUtil.getBindingAnnotations(field.getDeclaredAnnotations()));
-            ActivityManager.getInstance().getRootActivity().addBean(bean);                  
+            Annotation[] bindings = new Annotation[injectionPoint.getBindings().size()];
+            bindings = injectionPoint.getBindings().toArray(bindings);
+            
+            Bean<?> bean = createObservableImplicitComponent(EventImpl.class, clazz, bindings);
+            ActivityManager.addBean(bean);                  
         }      
     }
+    
+    @SuppressWarnings("unchecked")
+    public static <T> void addInjectedImplicitInstanceComponent(InjectionPoint injectionPoint)
+    {
+        ParameterizedType genericType = (ParameterizedType)injectionPoint.getType();
+        
+        Class<Instance<T>> clazz = (Class<Instance<T>>)genericType.getRawType();
+        
+        Annotation[] bindings = new Annotation[injectionPoint.getBindings().size()];
+        bindings = injectionPoint.getBindings().toArray(bindings);
+        
+        Bean<Instance<T>> bean = createInstanceComponent(genericType,clazz, genericType.getActualTypeArguments()[0], bindings);
+        ActivityManager.addBean(bean);
+        
+    }
  }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java Sat Mar 14 21:24:30 2009
@@ -32,35 +32,32 @@
 import javax.inject.manager.Manager;
 
 import org.apache.webbeans.component.AbstractComponent;
+import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.container.ManagerImpl;
 import org.apache.webbeans.container.activity.ActivityManager;
 
 public class MockManager implements Manager
 {
-    private static MockManager instance = new MockManager();
-
     private ManagerImpl manager = null;
 
     private List<AbstractComponent<?>> componentList = new ArrayList<AbstractComponent<?>>();
 
-    private MockManager()
+    public MockManager()
     {
         this.manager = new ManagerImpl();
         ActivityManager.getInstance().setRootActivity(this.manager);
     }
 
-    public static MockManager getInstance()
-    {
-        return instance;
-    }
 
     public void clear()
     {
-        componentList.clear();
-        if(manager != null)
-        {
-            manager.getBeans().clear();   
-        }
+        componentList.clear();        
+        
+        WebBeansFinder.removeInstance(WebBeansFinder.SINGLETON_NOTIFICATION_MANAGER);
+        
+        this.manager = new ManagerImpl();        
+     
+        ActivityManager.getInstance().setRootActivity(this.manager);        
     }
 
     public List<AbstractComponent<?>> getComponents()
@@ -128,6 +125,7 @@
         return manager.getInstanceToInject(injectionPoint, context);
     }
     
+    @SuppressWarnings("unchecked")
     public Object getInstanceToInject(InjectionPoint injectionPoint)
     {
        return manager.getInstanceToInject(injectionPoint);

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/servlet/TestContext.java Sat Mar 14 21:24:30 2009
@@ -23,7 +23,10 @@
 import javax.context.Context;
 import javax.context.Dependent;
 import javax.decorator.Decorator;
+import javax.inject.Obtains;
 import javax.inject.Production;
+import javax.inject.manager.Bean;
+import javax.inject.manager.InjectionPoint;
 import javax.inject.manager.Manager;
 import javax.interceptor.Interceptor;
 import javax.servlet.ServletContext;
@@ -108,7 +111,7 @@
     {
         this.clazzName = clazzName;
         TestContext.testContexts.add(this);
-        this.manager = MockManager.getInstance();
+        this.manager = new MockManager();
         this.xmlConfigurator = new WebBeansXMLConfigurator();
     }
 
@@ -184,6 +187,20 @@
         initializeStereoType(StereoWithSessionScope2.class);
 
     }
+    
+    protected void addInstanceImplicitBean(Bean<?> bean)
+    {
+        Set<InjectionPoint> injectionPoints = bean.getInjectionPoints();
+        for(InjectionPoint injectionPoint : injectionPoints)
+        {
+            //If contains the @Obtains, defines implicit component
+            if(injectionPoint.getAnnotation(Obtains.class) != null)
+            {
+                WebBeansUtil.addInjectedImplicitInstanceComponent(injectionPoint);
+            }                                    
+        }
+
+    }
 
     /**
      * Default stereo types
@@ -298,6 +315,7 @@
 
         if (bean != null)
         {
+            manager.addBean(WebBeansUtil.createNewSimpleBeanComponent(bean));
             DecoratorUtil.checkSimpleWebBeanDecoratorConditions(bean);
             // DefinitionUtil.defineSimpleWebBeanInterceptorStack(bean);
 
@@ -443,7 +461,8 @@
      */
     protected void clear()
     {
-        manager.clear();
+        this.manager.clear();
+        
     }
 
     /**

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/Producer1ConsumerComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/Producer1ConsumerComponentTest.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/Producer1ConsumerComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/Producer1ConsumerComponentTest.java Sat Mar 14 21:24:30 2009
@@ -71,7 +71,7 @@
         ContextFactory.initRequestContext(null);
         ContextFactory.initApplicationContext(null);
 
-        Assert.assertEquals(4, getDeployedComponents());
+        Assert.assertEquals(7, getDeployedComponents());
 
         Object obj = getManager().getInstance(comps.get(0));
         

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/ProducerComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/ProducerComponentTest.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/ProducerComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/ProducerComponentTest.java Sat Mar 14 21:24:30 2009
@@ -69,7 +69,7 @@
     {
         clear();
         defineSimpleWebBean(Producer1.class);
-        Assert.assertEquals(2, getDeployedComponents());
+        Assert.assertEquals(3, getDeployedComponents());
 
     }
 
@@ -78,7 +78,7 @@
     {
         clear();
         defineSimpleWebBean(Producer2.class);
-        Assert.assertEquals(3, getDeployedComponents());
+        Assert.assertEquals(4, getDeployedComponents());
     }
 
     @Test
@@ -87,7 +87,7 @@
         clear();
         defineSimpleWebBean(Producer3.class);
 
-        Assert.assertEquals(5, getDeployedComponents());
+        Assert.assertEquals(6, getDeployedComponents());
     }
 
     @Test
@@ -97,7 +97,7 @@
         defineSimpleWebBean(ParametrizedProducer.class);
 
         ContextFactory.initRequestContext(null);
-        Assert.assertEquals(3, getDeployedComponents());
+        Assert.assertEquals(4, getDeployedComponents());
 
         TypeLiteral<List<ParametrizedModel1>> model1 = new TypeLiteral<List<ParametrizedModel1>>()
         {

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/ScopeAdapterTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/ScopeAdapterTest.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/ScopeAdapterTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/ScopeAdapterTest.java Sat Mar 14 21:24:30 2009
@@ -70,7 +70,7 @@
 
         List<AbstractComponent<?>> comps = getComponents();
 
-        Assert.assertEquals(4, getDeployedComponents());
+        Assert.assertEquals(7, getDeployedComponents());
 
         getManager().getInstance(comps.get(0));
         getManager().getInstance(comps.get(1));

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/InjectedInstanceComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/InjectedInstanceComponentTest.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/InjectedInstanceComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/inject/InjectedInstanceComponentTest.java Sat Mar 14 21:24:30 2009
@@ -16,6 +16,7 @@
  */
 package org.apache.webbeans.test.unittests.inject;
 
+
 import javax.inject.Instance;
 import javax.inject.manager.Bean;
 
@@ -49,6 +50,7 @@
         getManager().getInstance(bean);
         
         Bean<InstanceInjectedComponent> injectedBean = defineSimpleWebBean(InstanceInjectedComponent.class);
+                
         InstanceInjectedComponent instance = getManager().getInstance(injectedBean);
         
         Assert.assertNotNull(instance);

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/newcomp/NewComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/newcomp/NewComponentTest.java?rev=754523&r1=754522&r2=754523&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/newcomp/NewComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/newcomp/NewComponentTest.java Sat Mar 14 21:24:30 2009
@@ -90,7 +90,7 @@
         defineSimpleWebBean(ProducerNewComponent.class);
 
         ContextFactory.initRequestContext(null);
-        Assert.assertEquals(3, getDeployedComponents());
+        Assert.assertEquals(5, getDeployedComponents());
 
         IPayment payment = (IPayment) getManager().getInstanceByName("paymentProducer");
         Assert.assertNotNull(payment);



Mime
View raw message