openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r826305 - in /incubator/openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/ main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/config/managed/ main/java/org/apache/webbeans/config/producer/ main/j...
Date Sat, 17 Oct 2009 20:41:34 GMT
Author: gerdogdu
Date: Sat Oct 17 20:41:33 2009
New Revision: 826305

URL: http://svn.apache.org/viewvc?rev=826305&view=rev
Log:
Several updates and clean up.

Removed:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/managed/
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/producer/
Modified:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.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/ManagedBeanConfigurator.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/container/BeanManagerImpl.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/ResolutionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/type/ContextTypes.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/lifecycle/WebBeansLifeCycle.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducer.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/component/decorator/clean/LargeTransactionDecorator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.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/inject/InjectedInstanceComponentTest.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/resolution/ManagerResolutionTest.java

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java?rev=826305&r1=826304&r2=826305&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java Sat Oct 17 20:41:33 2009
@@ -17,29 +17,39 @@
 package org.apache.webbeans.component;
 
 import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
+import java.lang.reflect.ParameterizedType;
 
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.TypeLiteral;
+import javax.enterprise.inject.spi.InjectionPoint;
 
 import org.apache.webbeans.inject.instance.InstanceFactory;
 
 public class InstanceBean<T> extends AbstractBean<Instance<T>>
 {
-    private Type injectedType;
+    public static ThreadLocal<InjectionPoint> local = new ThreadLocal<InjectionPoint>();
     
-    public InstanceBean(Class<Instance<T>> returnType, Type injectedType)
+    public InstanceBean()
     {
-        super(WebBeansType.INSTANCE, returnType);
-        this.injectedType = injectedType;
+        super(WebBeansType.INSTANCE, new TypeLiteral<Instance<T>>(){}.getRawType());        
     }
     
+         
     @Override
     protected Instance<T> createInstance(CreationalContext<Instance<T>> creationalContext)
     {
-        Annotation[] anns = new Annotation[getQualifiers().size()];
-        anns = getQualifiers().toArray(anns);
-        
-        return InstanceFactory.getInstance(this.injectedType, anns);
+        try
+        {
+            ParameterizedType injectedType = (ParameterizedType)local.get().getType();
+            Instance<T> instance = InstanceFactory.getInstance(injectedType.getActualTypeArguments()[0], local.get().getQualifiers().toArray(new Annotation[0])); 
+            
+            return instance;
+        }
+        finally
+        {
+            local.set(null);
+        }
     }
+    
 }
\ No newline at end of file

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=826305&r1=826304&r2=826305&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 Oct 17 20:41:33 2009
@@ -36,6 +36,9 @@
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.Specializes;
 import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.inject.Inject;
@@ -74,6 +77,7 @@
 /**
  * Defines the web beans components common properties.
  */
+@SuppressWarnings("unchecked")
 public final class DefinitionUtil
 {
     private DefinitionUtil()
@@ -130,7 +134,6 @@
                 //From parent
                 if (!found && (component instanceof IBeanHasParent))
                 {
-                    @SuppressWarnings("unchecked")
                     IBeanHasParent<T> child = (IBeanHasParent<T>) component;
                     component.setType(child.getParent().getType());
                 }
@@ -687,9 +690,6 @@
         DefinitionUtil.defineQualifiers(component, methodAnns);
         DefinitionUtil.defineName(component, methodAnns, WebBeansUtil.getProducerDefaultName(method.getName()));
 
-        //Drop from the specification
-        //WebBeansUtil.checkSteroTypeRequirements(component, methodAnns, "WebBeans producer method : " + method.getName() + " in class : " + parent.getReturnType().getName());
-
         return component;
     }
 
@@ -828,7 +828,6 @@
 
     }
 
-    @SuppressWarnings("unchecked")
     private static <T> void defineInternalInjectedFieldsRecursively(AbstractInjectionTargetBean<T> component, Class<T> clazz)
     {
         // From inheritance
@@ -937,7 +936,6 @@
         defineInternalInjectedMethodsRecursively(component, clazz);
     }
 
-    @SuppressWarnings("unchecked")
     private static <T> void defineInternalInjectedMethodsRecursively(AbstractInjectionTargetBean<T> component, Class<T> clazz)
     {
         // From inheritance
@@ -971,9 +969,10 @@
 
             if (isInitializer)
             {
+                //Do not support static
                 if(ClassUtil.isStatic(method.getModifiers()))
                 {
-                    throw new WebBeansConfigurationException("Initializer method : " + method.getName() + " in class : " + clazz.getName() + " can not be static!");
+                    continue;
                 }
                 
                 checkForInjectedInitializerMethod(component, clazz, method);
@@ -1102,7 +1101,6 @@
 
     }
 
-    @SuppressWarnings("unchecked")
     private static <T> void createObserverMethods(InjectionTargetBean<T> component, Class<?> clazz, Method[] candidateMethods)
     {
 
@@ -1160,12 +1158,105 @@
     {
         if(WebBeansUtil.checkObtainsInjectionPointConditions(injectionPoint))
         {
-            WebBeansUtil.addInjectedImplicitInstanceComponent(injectionPoint);
-        }
-        
+            //Do nothing
+        }        
         else if(EventUtil.checkObservableInjectionPointConditions(injectionPoint))
         {            
             WebBeansUtil.addInjectedImplicitEventComponent(injectionPoint);
         }
     }
+    
+    public static <X> Set<ProducerMethodBean<?>> defineProducerMethods(AbstractBean<X> bean, AnnotatedType<X> annotatedType)
+    {
+        Set<ProducerMethodBean<?>> producerComponents = new HashSet<ProducerMethodBean<?>>();
+        Set<AnnotatedMethod<? super X>> annotatedMethods = annotatedType.getMethods();
+        
+        for(AnnotatedMethod annotatedMethod: annotatedMethods)
+        {
+            createProducerBeansFromAnnotatedType(bean, producerComponents, annotatedMethod, bean.getReturnType(), false);
+        }
+        
+        return producerComponents;
+    }
+    
+    private static <X> void createProducerBeansFromAnnotatedType(AbstractBean<X> bean, Set<ProducerMethodBean<?>> producerComponents, AnnotatedMethod<X> annotatedMethod, Class<?> clazz, boolean isSpecializes)
+    {
+        Annotation[] anns = annotatedMethod.getAnnotations().toArray(new Annotation[0]);
+        
+        List<AnnotatedParameter<X>> parameters = annotatedMethod.getParameters();
+        // Producer Method
+        if (AnnotationUtil.hasAnnotation(anns, Produces.class))
+        {
+            for(AnnotatedParameter<X> parameter : parameters)
+            {
+                Annotation[] parameterAnns = parameter.getAnnotations().toArray(new Annotation[0]);
+                if (AnnotationUtil.hasAnnotation(anns, Inject.class) || AnnotationUtil.hasAnnotation(parameterAnns, Disposes.class) || AnnotationUtil.hasAnnotation(parameterAnns, Observes.class))
+                {
+                    throw new WebBeansConfigurationException("Producer Method Bean with name : " + annotatedMethod.getJavaMember().getName() + " in bean class : " + clazz + " can not be annotated with" + " @Initializer/@Destructor annotation or has a parameter annotated with @Disposes/@Observes");
+                }
+                
+            }
+            
+            if (AnnotationUtil.hasAnnotation(anns, Specializes.class))
+            {
+                if (ClassUtil.isStatic(annotatedMethod.getJavaMember().getModifiers()))
+                {
+                    throw new WebBeansConfigurationException("Specializing producer method : " + annotatedMethod.getJavaMember().getName() + " in class : " + clazz.getName() + " can not be static");
+                }
+
+                isSpecializes = true;
+            }
+
+            ProducerMethodBean<?> newComponent = createProducerBeanFromAnnotatedType((Class<X>)annotatedMethod.getJavaMember().getReturnType(), annotatedMethod, bean, isSpecializes);
+            if (newComponent != null)
+            {
+                producerComponents.add(newComponent);
+                addMethodInjectionPointMetaData(newComponent, annotatedMethod.getJavaMember());
+            }
+        }
+
+    }
+
+    public static <X> ProducerMethodBean<X> createProducerBeanFromAnnotatedType(Class<X> returnType, AnnotatedMethod<X> method, AbstractBean<?> parent, boolean isSpecializes)
+    {
+        ProducerMethodBean<X> bean = new ProducerMethodBean<X>(parent, returnType);
+        bean.setCreatorMethod(method.getJavaMember());
+
+        if (isSpecializes)
+        {
+            WebBeansUtil.configureProducerSpecialization(bean, method.getJavaMember(), parent.getReturnType().getSuperclass());
+        }
+
+        if (returnType.isPrimitive())
+        {
+            bean.setNullable(false);
+        }
+
+        Annotation[] anns = method.getAnnotations().toArray(new Annotation[0]);
+        
+        defineSerializable(bean);
+        defineStereoTypes(bean, anns);
+
+        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
+        
+        if(!useAlternative)
+        {
+            Class<? extends Annotation> deploymentType = DefinitionUtil.defineDeploymentType(bean, anns, "There are more than one @DeploymentType annotation in the bean class : " + bean.getReturnType().getName());
+
+            // Check if the deployment type is enabled.
+            if (!DeploymentTypeManager.getInstance().isDeploymentTypeEnabled(deploymentType))
+            {
+                return null;
+            }            
+        }
+
+        DefinitionUtil.defineProducerMethodApiTypes(bean, method.getBaseType(), anns);
+        DefinitionUtil.defineScopeType(bean, anns, "Bean producer method : " + method.getJavaMember().getName() + " in class " + parent.getReturnType().getName() + " must declare default @Scope annotation");
+        WebBeansUtil.checkProducerGenericType(bean,method.getJavaMember());        
+        DefinitionUtil.defineQualifiers(bean, anns);
+        DefinitionUtil.defineName(bean, anns, WebBeansUtil.getProducerDefaultName(method.getJavaMember().getName()));
+
+        return bean;
+    }
+    
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java?rev=826305&r1=826304&r2=826305&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java Sat Oct 17 20:41:33 2009
@@ -16,6 +16,7 @@
 
 import javax.decorator.Decorator;
 import javax.enterprise.context.NormalScope;
+import javax.enterprise.inject.spi.AnnotatedType;
 import javax.interceptor.Interceptor;
 
 import org.apache.webbeans.component.ManagedBean;
@@ -163,4 +164,51 @@
 
         return component;
     }
+    
+    @SuppressWarnings("unchecked")
+    public static <T> ManagedBean<T> defineFromAnnotatedType(AnnotatedType<T> annotatedType) throws WebBeansConfigurationException
+    {
+        Class<T> javaClazz = annotatedType.getJavaClass();
+        ManagedBean<T> component = new ManagedBean<T>(javaClazz, WebBeansType.MANAGED);
+        
+        boolean useAlternative = OpenWebBeansConfiguration.getInstance().useAlternativeOrDeploymentType();
+        
+        if(useAlternative)
+        {
+            WebBeansUtil.setBeanEnableFlag(component);   
+        }
+        
+        Annotation[] clazzAnns = annotatedType.getAnnotations().toArray(new Annotation[0]);
+        
+        DefinitionUtil.defineSerializable(component);
+        DefinitionUtil.defineStereoTypes(component, clazzAnns);
+        
+        //Use @DeploymentType instead of using @Alternative
+        if(!useAlternative)
+        {
+            Class<? extends Annotation> deploymentType = DefinitionUtil.defineDeploymentType(component, clazzAnns, "There are more than one @DeploymentType annotation in Simple WebBean Component implementation class : " + component.getReturnType().getName());
+
+            // Check if the deployment type is enabled.
+            if (!WebBeansUtil.isDeploymentTypeEnabled(deploymentType))
+            {
+                return null;
+            }            
+        }
+        
+
+        DefinitionUtil.defineApiTypes(component, javaClazz);
+        DefinitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean Component implementation class : " + javaClazz.getName() + " stereotypes must declare same @Scope annotations");
+        
+        WebBeansUtil.checkGenericType(component);
+        WebBeansUtil.checkPassivationScope(component, component.getScope().getAnnotation(NormalScope.class));
+        DefinitionUtil.defineQualifiers(component, clazzAnns);
+        DefinitionUtil.defineName(component, clazzAnns, WebBeansUtil.getSimpleWebBeanDefaultName(javaClazz.getSimpleName()));
+
+        Constructor<T> constructor = WebBeansUtil.defineConstructor(annotatedType.getConstructors().toArray(new Constructor[0]), javaClazz);
+        component.setConstructor(constructor);
+        DefinitionUtil.addConstructorInjectionPointMetaData(component, constructor);
+
+
+        return component;
+    }    
 }
\ 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=826305&r1=826304&r2=826305&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 Oct 17 20:41:33 2009
@@ -120,13 +120,16 @@
             if (!deployed)
             {
                 // Register Manager built-in component
-                BeanManagerImpl.getManager().addBean(WebBeansUtil.getManagerComponent());
+                BeanManagerImpl.getManager().addBean(WebBeansUtil.getManagerBean());
 
                 // Register Conversation built-in component
-                BeanManagerImpl.getManager().addBean(WebBeansUtil.getConversationComponent());
+                BeanManagerImpl.getManager().addBean(WebBeansUtil.getConversationBean());
                 
                 // Register InjectionPoint bean
-                BeanManagerImpl.getManager().addBean(WebBeansUtil.getInjectionPointComponent());
+                BeanManagerImpl.getManager().addBean(WebBeansUtil.getInjectionPointBean());
+                
+                //Register Instance Bean
+                BeanManagerImpl.getManager().addBean(WebBeansUtil.getInstanceBean());
                 
                 //Load Extensions
                 ExtensionLoader.getInstance().loadExtensionServices();
@@ -722,7 +725,7 @@
             
             if (addBeans)
             {                
-                BeanManagerImpl.getManager().addBean(WebBeansUtil.createNewSimpleBeanComponent(managedBean));                
+                BeanManagerImpl.getManager().addBean(WebBeansUtil.createNewBean(managedBean));                
                 DecoratorUtil.checkManagedBeanDecoratorConditions(managedBean);
                 BeanManagerImpl.getManager().addBean(managedBean);
                 BeanManagerImpl.getManager().getBeans().addAll(producerMethods);

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=826305&r1=826304&r2=826305&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java Sat Oct 17 20:41:33 2009
@@ -60,7 +60,10 @@
 import org.apache.webbeans.component.AbstractBean;
 import org.apache.webbeans.component.EnterpriseBeanMarker;
 import org.apache.webbeans.component.JmsBeanMarker;
+import org.apache.webbeans.component.ManagedBean;
+import org.apache.webbeans.component.WebBeansType;
 import org.apache.webbeans.component.third.ThirdpartyBeanImpl;
+import org.apache.webbeans.config.ManagedBeanConfigurator;
 import org.apache.webbeans.config.OpenWebBeansConfiguration;
 import org.apache.webbeans.container.activity.ActivityManager;
 import org.apache.webbeans.context.ContextFactory;
@@ -79,6 +82,7 @@
 import org.apache.webbeans.plugins.OpenWebBeansJmsPlugin;
 import org.apache.webbeans.plugins.PluginLoader;
 import org.apache.webbeans.portable.AnnotatedElementFactory;
+import org.apache.webbeans.portable.creation.InjectionTargetProducer;
 import org.apache.webbeans.proxy.JavassistProxyFactory;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
@@ -915,8 +919,9 @@
     @Override
     public <T> InjectionTarget<T> createInjectionTarget(AnnotatedType<T> type)
     {
-        // TODO Auto-generated method stub
-        return null;
+        ManagedBean<T> bean = ManagedBeanConfigurator.define(type.getJavaClass(), WebBeansType.MANAGED);
+        
+        return new InjectionTargetProducer<T>(bean);
     }
 
     @Override

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=826305&r1=826304&r2=826305&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 Oct 17 20:41:33 2009
@@ -21,9 +21,11 @@
 import java.util.Iterator;
 import java.util.Set;
 
+import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;
 
+import org.apache.webbeans.annotation.AnyLiteral;
 import org.apache.webbeans.annotation.DefaultLiteral;
 import org.apache.webbeans.component.AbstractBean;
 import org.apache.webbeans.config.OpenWebBeansConfiguration;
@@ -160,23 +162,38 @@
         Type type = injectionPoint.getType();
         
         Class<?> clazz = null;
-        
+        boolean injectInstanceProvider = false;
         if (type instanceof ParameterizedType)
         {
             ParameterizedType pt = (ParameterizedType) type;            
             clazz = (Class<?>) pt.getRawType();
+                        
+            if(clazz.isAssignableFrom(Instance.class))
+            {
+                injectInstanceProvider = true;
+            }
+            
         }
         else
         {
             clazz = (Class<?>) type;
         }
         
-        Annotation[] qualifiers = new Annotation[injectionPoint.getQualifiers().size()];
-        qualifiers = injectionPoint.getQualifiers().toArray(qualifiers);
+        Annotation[] qualifiers = new Annotation[1]; 
+            
+        if(injectInstanceProvider)
+        {
+            qualifiers[0] = new AnyLiteral();
+        }
+        else
+        {
+            qualifiers = new Annotation[injectionPoint.getQualifiers().size()];
+            qualifiers = injectionPoint.getQualifiers().toArray(qualifiers);            
+        }
 
         Set<Bean<?>> beanSet = implResolveByType(type, qualifiers);
 
-        ResolutionUtil.checkResolvedBeans(beanSet, clazz, qualifiers);
+        ResolutionUtil.checkResolvedBeans(beanSet, clazz, qualifiers);   
 
         return beanSet.iterator().next();
         

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java?rev=826305&r1=826304&r2=826305&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java Sat Oct 17 20:41:33 2009
@@ -69,35 +69,37 @@
 
     public static void checkResolvedBeans(Set<Bean<?>> resolvedSet, Class<?> type, Annotation[] qualifiers)
     {
-        if (resolvedSet.isEmpty())
+        StringBuffer qualifierMessage = new StringBuffer("[");
+        
+        int i = 0;
+        for(Annotation annot : qualifiers)
         {
-            StringBuffer message = new StringBuffer("Api type [" + type.getName() + "] is not found with the qualifiers [");
+            i++;            
+            qualifierMessage.append(annot);
             
-            int i = 0;
-            for(Annotation annot : qualifiers)
-            {
-                i++;
-                
-                message.append(annot);
-                
-                if(i != qualifiers.length)
-                {
-                    message.append(",");   
-                }
+            if(i != qualifiers.length)
+            {                
+                qualifierMessage.append(",");
             }
-            
-            message.append("]");
+        }
+        
+        qualifierMessage.append("]");
+        
+        if (resolvedSet.isEmpty())
+        {
+            StringBuffer message = new StringBuffer("Api type [" + type.getName() + "] is not found with the qualifiers ");            
+            message.append(qualifierMessage);
             
             throw new UnsatisfiedResolutionException(message.toString());
         }
 
         if (resolvedSet.size() > 1)
         {
-            throw new AmbiguousResolutionException("There is more than one api type with : " + type.getName());
+            throw new AmbiguousResolutionException("There is more than one api type with : " + type.getName() + " with qualifiers : " + qualifierMessage);
         }
 
         Bean<?> bean = resolvedSet.iterator().next();
         WebBeansUtil.checkUnproxiableApiType(bean, bean.getScope());
 
-    }
+    }    
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java?rev=826305&r1=826304&r2=826305&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/AbstractContext.java Sat Oct 17 20:41:33 2009
@@ -118,6 +118,10 @@
         {
             this.scopeType = ConversationScoped.class;
         }
+        else if (type.equals(ContextTypes.SINGLETON))
+        {
+            this.scopeType = ConversationScoped.class;
+        }
         else
         {
             throw new IllegalArgumentException("Not known scope type : " + type.toString());

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java?rev=826305&r1=826304&r2=826305&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java Sat Oct 17 20:41:33 2009
@@ -24,6 +24,7 @@
 import javax.enterprise.context.RequestScoped;
 import javax.enterprise.context.SessionScoped;
 import javax.enterprise.context.spi.Context;
+import javax.inject.Singleton;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletRequestEvent;
 import javax.servlet.http.HttpServletRequest;
@@ -47,6 +48,8 @@
     private static ThreadLocal<ApplicationContext> applicationContext = null;
 
     private static ThreadLocal<ConversationContext> conversationContext = null;
+    
+    private static ThreadLocal<SingletonContext> singletonContext = null;
 
     private static ThreadLocal<DependentContext> dependentContext = null;
 
@@ -63,6 +66,7 @@
         applicationContext = new ThreadLocal<ApplicationContext>();
         conversationContext = new ThreadLocal<ConversationContext>();
         dependentContext = new ThreadLocal<DependentContext>();
+        singletonContext = new ThreadLocal<SingletonContext>();
     }
 
     private ContextFactory()
@@ -230,6 +234,30 @@
         sessionCtxManager.destroyAllSessions();
         conversationManager.destroyAllConversations();
     }
+    
+    public static void initSingletonContext()
+    {
+        SingletonContext context = new SingletonContext();
+        context.setActive(true);
+        
+        singletonContext.set(context);
+    }
+    
+    public static void destroySingletonContext()
+    {
+        if (singletonContext != null)
+        {
+            SingletonContext context = getSingletonContext();
+
+            if (context != null)
+            {
+                context.destroy();
+            }
+            
+            singletonContext.remove();            
+        }
+        
+    }
 
     public static void initConversationContext(ConversationContext context)
     {
@@ -281,7 +309,7 @@
     {
         WebBeansContext context = null;
 
-        switch (type.getName())
+        switch (type.getCardinal())
         {
             case 0:
                 context = getRequestContext();
@@ -304,7 +332,7 @@
                 break;
             
             default:
-                throw new IllegalArgumentException("There is no such a standard context with name id=" + type.getName());
+                throw new IllegalArgumentException("There is no such a standard context with context id=" + type.getCardinal());
         }
 
         return context;
@@ -340,6 +368,10 @@
         {
             context = getDependentContext();
         }
+        else if (scopeType.equals(Singleton.class))
+        {
+            context = getSingletonContext();
+        }
         
         return context;
     }
@@ -360,11 +392,16 @@
         return sessionContext.get();
     }
 
-     private static ApplicationContext getApplicationContext()
+    private static ApplicationContext getApplicationContext()
     {
         return applicationContext.get();
     }
 
+    private static SingletonContext getSingletonContext()
+    {
+        return singletonContext.get();
+    }
+
     /*
      * Get current conversation ctx.
      */

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/type/ContextTypes.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/type/ContextTypes.java?rev=826305&r1=826304&r2=826305&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/type/ContextTypes.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/type/ContextTypes.java Sat Oct 17 20:41:33 2009
@@ -27,6 +27,7 @@
  *  <li>Session Context</li>
  *  <li>Application Context</li>
  *  <li>Conversation Context</li>
+ *  <li>Singleton Context</li>
  * </ul>
  * 
  * </p>
@@ -34,7 +35,12 @@
  */
 public enum ContextTypes
 {
-    REQUEST(0), SESSION(1), APPLICATION(2), CONVERSATION(3), DEPENDENT(4);
+    REQUEST(0), 
+    SESSION(1), 
+    APPLICATION(2), 
+    CONVERSATION(3), 
+    DEPENDENT(4),
+    SINGLETON(5);
 
     int name;
 
@@ -43,29 +49,32 @@
         this.name = name;
     }
 
-    public int getName()
+    public int getCardinal()
     {
         return name;
     }
 
-    public String getTypeName()
+    public String getContextName()
     {
-        switch (getName())
+        switch (getCardinal())
         {
-        case 0:
-            return "request";
-
-        case 1:
-            return "session";
-
-        case 2:
-            return "application";
-
-        case 3:
-            return "conversation";
-
-        case 4:
-            return "dependent";
+            case 0:
+                return "request";
+    
+            case 1:
+                return "session";
+    
+            case 2:
+                return "application";
+    
+            case 3:
+                return "conversation";
+    
+            case 4:
+                return "dependent";
+            
+            case 5:
+                return "singleton";
 
         }
 

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=826305&r1=826304&r2=826305&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 Oct 17 20:41:33 2009
@@ -15,14 +15,18 @@
 
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Member;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
 import java.util.List;
 
 import javax.enterprise.context.Dependent;
 import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;
 
 import org.apache.webbeans.component.AbstractBean;
+import org.apache.webbeans.component.InstanceBean;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.util.AnnotationUtil;
@@ -77,6 +81,11 @@
             return injectDependentOwnerInjectionPoint();
         }
         
+        if(isInstanceProviderInjection(injectionPoint))
+        {
+            InstanceBean.local.set(injectionPoint);
+        }
+        
         //Get injection point Bean to look for @Dependent
         Bean<?> component = InjectionResolver.getInstance().getInjectionPointBean(injectionPoint);
         
@@ -160,6 +169,25 @@
 
     }
 
+    private boolean isInstanceProviderInjection(InjectionPoint injectionPoint)
+    {
+        Type type = injectionPoint.getType();
+        
+        if (type instanceof ParameterizedType)
+        {
+            ParameterizedType pt = (ParameterizedType) type;            
+            Class<?> clazz = (Class<?>) pt.getRawType();
+            
+            if(clazz.isAssignableFrom(Instance.class))
+            {
+                return true;
+            }
+        }
+        
+        return false;
+    }
+    
+    
     /**
      * Gets the component.
      * 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java?rev=826305&r1=826304&r2=826305&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/WebBeansLifeCycle.java Sat Oct 17 20:41:33 2009
@@ -133,7 +133,12 @@
     {
         // Initalize Application Context
         logger.info("Initializing of the application context");
+        
+        //Application Context initialization
         ContextFactory.initApplicationContext(event.getServletContext());
+        
+        //Singleton context
+        ContextFactory.initSingletonContext();
 
         this.discovery = ServiceLoader.getService(MetaDataDiscoveryService.class);
         this.discovery.init(event.getServletContext());
@@ -195,6 +200,8 @@
         service.shutdownNow();
 
         ContextFactory.destroyApplicationContext(event.getServletContext());
+        
+        ContextFactory.destroySingletonContext();
 
         jndiService.unbind(WebBeansConstants.WEB_BEANS_MANAGER_JNDI_NAME);
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducer.java?rev=826305&r1=826304&r2=826305&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducer.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducer.java Sat Oct 17 20:41:33 2009
@@ -14,6 +14,7 @@
 package org.apache.webbeans.portable.creation;
 
 import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.InjectionTarget;
 
 import org.apache.webbeans.component.AbstractInjectionTargetBean;
@@ -33,6 +34,8 @@
         super(bean);
     }
     
+    
+    
     @Override
     public void inject(T instance, CreationalContext<T> ctx)
     {

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=826305&r1=826304&r2=826305&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 Oct 17 20:41:33 2009
@@ -52,6 +52,7 @@
 import javax.enterprise.inject.New;
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.Specializes;
+import javax.enterprise.inject.TypeLiteral;
 import javax.enterprise.inject.UnproxyableResolutionException;
 import javax.enterprise.inject.spi.AnnotatedField;
 import javax.enterprise.inject.spi.AnnotatedMethod;
@@ -63,10 +64,12 @@
 import javax.enterprise.inject.stereotype.Stereotype;
 import javax.inject.Inject;
 import javax.inject.Named;
+import javax.inject.Provider;
 import javax.inject.Scope;
 import javax.interceptor.AroundInvoke;
 import javax.interceptor.InvocationContext;
 
+import org.apache.webbeans.annotation.AnyLiteral;
 import org.apache.webbeans.annotation.ApplicationScopeLiteral;
 import org.apache.webbeans.annotation.DefaultLiteral;
 import org.apache.webbeans.annotation.DependentScopeLiteral;
@@ -312,9 +315,17 @@
     public static <T> Constructor<T> defineConstructor(Class<T> clazz) throws WebBeansConfigurationException
     {
         Asserts.nullCheckForClass(clazz);
-        Constructor<T> result = null;
         Constructor<T>[] constructors = ClassUtil.getConstructors(clazz);
-
+        
+        return defineConstructor(constructors, clazz);
+        
+    }
+    
+    
+    public static <T>  Constructor<T> defineConstructor(Constructor<T>[] constructors, Class<T> clazz)
+    {
+        Constructor<T> result = null;
+        
         boolean inAnnotation = false;
         int j = 0;
 
@@ -335,7 +346,7 @@
                 }
             }
         }
-
+        
         if (result != null)
         {
             Annotation[][] parameterAnns = result.getParameterAnnotations();
@@ -373,7 +384,8 @@
             }
         }
 
-        return result;
+        return result;        
+        
     }
 
     /**
@@ -619,7 +631,7 @@
      * @param component managed bean
      * @return the new bean from given managed bean
      */
-    public static <T> NewBean<T> createNewSimpleBeanComponent(ManagedBean<T> component)
+    public static <T> NewBean<T> createNewBean(ManagedBean<T> component)
     {
         Asserts.assertNotNull(component, "component argument can not be null");
 
@@ -686,7 +698,7 @@
      * Creates a new manager bean instance.
      * @return new manager bean instance
      */
-    public static BeanManagerBean getManagerComponent()
+    public static BeanManagerBean getManagerBean()
     {
         BeanManagerBean managerComponent = new BeanManagerBean();
 
@@ -708,19 +720,19 @@
      * @param obtainsBindings instance bindings
      * @return new instance bean
      */
-    public static <T> InstanceBean<T> createInstanceComponent(ParameterizedType instance,Class<Instance<T>> clazz, Type injectedType, Annotation...obtainsBindings)
+    public static <T> InstanceBean<T> getInstanceBean()
     {
-        InstanceBean<T> instanceComponent = new InstanceBean<T>(clazz,injectedType);
+        InstanceBean<T> instanceComponent = new InstanceBean<T>();
         
-        instanceComponent.addApiType(clazz);
+        instanceComponent.getTypes().add(new TypeLiteral<Instance<?>>(){}.getRawType());
+        instanceComponent.getTypes().add(new TypeLiteral<Provider<?>>(){}.getRawType());
         instanceComponent.addApiType(Object.class);
         
-        DefinitionUtil.defineQualifiers(instanceComponent, obtainsBindings);
+        instanceComponent.addQualifier(new AnyLiteral());
         instanceComponent.setImplScopeType(new DependentScopeLiteral());
         instanceComponent.setType(new StandardLiteral());
         instanceComponent.setName(null);
-        
-        
+                
         return instanceComponent;
     }
 
@@ -728,7 +740,7 @@
      * Returns new conversation bean instance.
      * @return new conversation bean
      */
-    public static ConversationBean getConversationComponent()
+    public static ConversationBean getConversationBean()
     {
         ConversationBean conversationComp = new ConversationBean();
 
@@ -747,7 +759,7 @@
      * Returns a new injected point bean instance.
      * @return new injected point bean
      */
-    public static InjectionPointBean getInjectionPointComponent()
+    public static InjectionPointBean getInjectionPointBean()
     {
         return new InjectionPointBean(null);
     }
@@ -1696,7 +1708,7 @@
             candidateClazz = (Class<?>)pt.getRawType();
         }
         
-        if(!candidateClazz.equals(Instance.class))
+        if(!candidateClazz.isAssignableFrom(Instance.class))
         {
             return false;
         }        
@@ -1711,7 +1723,7 @@
             
             Type[] typeArgs = pt.getActualTypeArguments();
             
-            if(!(rawType.equals(Instance.class)))
+            if(!(rawType.isAssignableFrom(Instance.class)))
             {
                 throw new WebBeansConfigurationException("<Instance> field injection " + injectionPoint.toString() + " must have type javax.inject.Instance");
             }                
@@ -1902,19 +1914,19 @@
     }
     
     
-    public static <T> void addInjectedImplicitInstanceComponent(InjectionPoint injectionPoint)
-    {
-        ParameterizedType genericType = (ParameterizedType)injectionPoint.getType();
-        
-        Class<Instance<T>> clazz = (Class<Instance<T>>)genericType.getRawType();
-        
-        Annotation[] qualifiers = new Annotation[injectionPoint.getQualifiers().size()];
-        qualifiers = injectionPoint.getQualifiers().toArray(qualifiers);
-        
-        Bean<Instance<T>> bean = createInstanceComponent(genericType,clazz, genericType.getActualTypeArguments()[0], qualifiers);
-        BeanManagerImpl.getManager().addBean(bean);
-        
-    }
+//    public static <T> void addInjectedImplicitInstanceComponent(InjectionPoint injectionPoint)
+//    {
+//        ParameterizedType genericType = (ParameterizedType)injectionPoint.getType();
+//        
+//        Class<Instance<T>> clazz = (Class<Instance<T>>)genericType.getRawType();
+//        
+//        Annotation[] qualifiers = new Annotation[injectionPoint.getQualifiers().size()];
+//        qualifiers = injectionPoint.getQualifiers().toArray(qualifiers);
+//        
+//        Bean<Instance<T>> bean = createInstanceComponent(genericType,clazz, genericType.getActualTypeArguments()[0], qualifiers);
+//        BeanManagerImpl.getManager().addBean(bean);
+//        
+//    }
     
     public static Bean<?> getMostSpecializedBean(BeanManager manager, Bean<?> component)
     {

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/LargeTransactionDecorator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/LargeTransactionDecorator.java?rev=826305&r1=826304&r2=826305&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/LargeTransactionDecorator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/LargeTransactionDecorator.java Sat Oct 17 20:41:33 2009
@@ -18,15 +18,12 @@
 import javax.decorator.Decorates;
 import javax.decorator.Decorator;
 import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.Default;
 
 @Decorator
 @RequestScoped
 public abstract class LargeTransactionDecorator implements Account
 {
-    @Decorates @Any @Default
-    Account account;
+    @Decorates Account account;
 
     BigDecimal depositeAmount = null;
     BigDecimal withDrawAmount = null;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java?rev=826305&r1=826304&r2=826305&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/decorator/clean/ServiceDecorator.java Sat Oct 17 20:41:33 2009
@@ -16,7 +16,6 @@
 import javax.decorator.Decorates;
 import javax.decorator.Decorator;
 import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Any;
 import javax.inject.Named;
 
 import org.apache.webbeans.test.annotation.binding.Binding1;
@@ -27,8 +26,7 @@
 @RequestScoped
 public abstract class ServiceDecorator implements IService
 {
-    @Decorates @Any @Binding1
-    IService delegate;
+    @Decorates @Binding1 IService delegate;
 
     private String delegateAttr = null;
 

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=826305&r1=826304&r2=826305&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 Oct 17 20:41:33 2009
@@ -133,7 +133,7 @@
             initInterceptors();
             initDecorators();
             initStereoTypes();
-            initDependentContext();
+            initDependentContext();            
 
             PluginLoader.getInstance().startUp();
             
@@ -201,7 +201,7 @@
             //If contains the @Obtains, defines implicit component
             if(injectionPoint.getAnnotated().getBaseType().equals(Instance.class))
             {
-                WebBeansUtil.addInjectedImplicitInstanceComponent(injectionPoint);
+                //WebBeansUtil.addInjectedImplicitInstanceComponent(injectionPoint);
             }                                    
         }
 
@@ -319,7 +319,7 @@
         bean = ManagedBeanConfigurator.define(clazz, WebBeansType.MANAGED);
         if (bean != null)
         {
-            manager.addBean(WebBeansUtil.createNewSimpleBeanComponent(bean));
+            manager.addBean(WebBeansUtil.createNewBean(bean));
             DecoratorUtil.checkManagedBeanDecoratorConditions(bean);
             // DefinitionUtil.defineSimpleWebBeanInterceptorStack(bean);
 

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=826305&r1=826304&r2=826305&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 Oct 17 20:41:33 2009
@@ -24,6 +24,7 @@
 import org.apache.webbeans.test.component.PaymentProcessorComponent;
 import org.apache.webbeans.test.component.inject.InstanceInjectedComponent;
 import org.apache.webbeans.test.servlet.TestContext;
+import org.apache.webbeans.util.WebBeansUtil;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -44,6 +45,8 @@
     @Test
     public void testInstanceInjectedComponent()
     {
+        getManager().addBean(WebBeansUtil.getInstanceBean());
+        
         ContextFactory.initRequestContext(null);
         Bean<PaymentProcessorComponent> bean =  defineSimpleWebBean(PaymentProcessorComponent.class);
         

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/resolution/ManagerResolutionTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/resolution/ManagerResolutionTest.java?rev=826305&r1=826304&r2=826305&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/resolution/ManagerResolutionTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/resolution/ManagerResolutionTest.java Sat Oct 17 20:41:33 2009
@@ -34,13 +34,13 @@
     public void beforeTest()
     {
         super.init();
-        getManager().addBean(WebBeansUtil.getManagerComponent());
+        getManager().addBean(WebBeansUtil.getManagerBean());
     }
 
     @Test
     public void testManagerResolution()
     {
-        BeanManagerBean component = WebBeansUtil.getManagerComponent();
+        BeanManagerBean component = WebBeansUtil.getManagerBean();
         BeanManager manager = getManager().getInstance(component);
 
         Assert.assertNotNull(manager);



Mime
View raw message