openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r904774 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/ main/java/org/apache/webbeans/container/ main/java/org/apache/webbeans/context/creational/ main/java/org/apache/webbeans/decorator/ main/java/org/a...
Date Sat, 30 Jan 2010 12:58:23 GMT
Author: gerdogdu
Date: Sat Jan 30 12:58:21 2010
New Revision: 904774

URL: http://svn.apache.org/viewvc?rev=904774&view=rev
Log:
[OWB-244] OWB injects a new object for @disposes injection point for dependent scope.

Added:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/WrappedCreationalContext.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/DependentBeanProxy.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/DependentMethodBeanTest.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DependentBean.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/RequestBean.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/DependentModel.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/RequestModel.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularConstructorOrProducerMethodParameterBean.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularNormalInConstructor.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/tests/CircularInjectionIntoConstructorTest.java   (with props)
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java?rev=904774&r1=904773&r2=904774&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractBean.java Sat Jan 30 12:58:21 2010
@@ -151,11 +151,17 @@
     /**
      * {@inheritDoc}
      */
+    @SuppressWarnings("unchecked")
     public T create(CreationalContext<T> creationalContext)
     {
         T instance = null;
         try
-        {            
+        {  
+            if(!(creationalContext instanceof CreationalContextImpl))
+            {                
+                creationalContext = CreationalContextFactory.getInstance().wrappedCreationalContext(creationalContext, this); 
+            }
+            
             instance = createInstance(creationalContext);
         }
         catch (Exception re)
@@ -397,42 +403,6 @@
         return returnType;
     }
 
-    /**
-     * Gets the dependent bean instance.
-     * 
-     * @param dependentComponent dependent web beans bean
-     * @return the dependent bean instance
-     */
-    public Object getDependent(Bean<?> dependentComponent, InjectionPoint injectionPoint, CreationalContext<?> creational)
-    {
-        Object object = null;
-        
-        //Setting injection point owner
-        @SuppressWarnings("unchecked")
-        AbstractBean<Object> dependent = (AbstractBean<Object>)dependentComponent;
-        dependent.setDependentOwnerInjectionPoint(injectionPoint);        
-        
-        @SuppressWarnings("unchecked")
-        CreationalContextImpl<Object> dependentCreational = (CreationalContextImpl<Object>)CreationalContextFactory.getInstance().getCreationalContext(dependentComponent);
-        
-        if(creational instanceof CreationalContextImpl)
-        {
-            dependentCreational.setOwnerCreational((CreationalContextImpl<?>)creational);   
-        }
-        
-        //Get dependent instance
-        object = BeanManagerImpl.getManager().getReference(dependent, injectionPoint.getType(), dependentCreational);
-        
-        if(creational instanceof CreationalContextImpl)
-        {
-            CreationalContextImpl<?> cc = (CreationalContextImpl<?>)creational;
-            
-            //Put this into the dependent map
-            cc.addDependent(dependent, object, dependentCreational);    
-        }
-        
-        return object;
-    }
     
     /**
      * {@inheritDoc}

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java?rev=904774&r1=904773&r2=904774&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/BaseBean.java Sat Jan 30 12:58:21 2010
@@ -18,7 +18,6 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.Decorator;
@@ -162,14 +161,6 @@
     public abstract Class<T> getReturnType();
 
     /**
-     * Gets dependent bean at given injection point.
-     * @param dependentBean dependent bean
-     * @param injectionPoint injection point of dependent bean
-     * @return dependent bean
-     */
-    public abstract Object getDependent(Bean<?> dependentBean,InjectionPoint injectionPoint, CreationalContext<?> creational);
-
-    /**
      * Gets interceptor stack of bean instance.
      * @return interceptor stack
      */

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java?rev=904774&r1=904773&r2=904774&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java Sat Jan 30 12:58:21 2010
@@ -25,12 +25,11 @@
 
 public class InjectionPointBean extends AbstractBean<InjectionPoint>
 {
-    private InjectionPoint injectionPoint = null;
+    public static ThreadLocal<InjectionPoint> local = new ThreadLocal<InjectionPoint>();
     
-    public InjectionPointBean(InjectionPoint injectionPoint)
+    public InjectionPointBean()
     {
         super(WebBeansType.INJECTIONPOINT,InjectionPoint.class);
-        this.injectionPoint = injectionPoint;
         
         addQualifier(new DefaultLiteral());
         setImplScopeType(new DependentScopeLiteral());
@@ -41,13 +40,20 @@
     @Override
     protected InjectionPoint createInstance(CreationalContext<InjectionPoint> creationalContext)
     {
-        return injectionPoint;
+        try
+        {
+            return local.get();
+            
+        }finally
+        {
+            local.remove();
+        }
     }
 
     @Override
     protected void destroyInstance(InjectionPoint instance, CreationalContext<InjectionPoint> creationalContext)
     {
-        this.injectionPoint = null;
+        local.remove();
     }
     
     

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=904774&r1=904773&r2=904774&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java Sat Jan 30 12:58:21 2010
@@ -37,7 +37,6 @@
 import javax.enterprise.context.spi.Context;
 import javax.enterprise.context.spi.Contextual;
 import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Event;
 import javax.enterprise.inject.AmbiguousResolutionException;
 import javax.enterprise.inject.Default;
 import javax.enterprise.inject.Stereotype;
@@ -572,7 +571,7 @@
     {
         if(ClassUtil.isTypeVariable(beanType))
         {
-            throw new WebBeansConfigurationException("Exception in getBeans method. Bean type can not be TypeVariable");
+            throw new IllegalArgumentException("Exception in getBeans method. Bean type can not be TypeVariable for bean type : " + beanType);
         }
         
         AnnotationUtil.checkQualifierConditions(bindings);
@@ -597,48 +596,45 @@
      * {@inheritDoc}
      */
     @Override
-    public Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?> creationalContext)
+    public Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?> ownerCreationalContext)
     {
+        //Injected instance
         Object instance = null;
         
+        //Injection point is null
         if(injectionPoint == null)
         {
             return null;
         }
-                
-        Annotation[] bindings = new Annotation[injectionPoint.getQualifiers().size()];
-        bindings = injectionPoint.getQualifiers().toArray(bindings);
         
+        //Owner bean creational context
+        CreationalContextImpl<?> ownerCreationalContextImpl = (CreationalContextImpl<?>)ownerCreationalContext;
+                                
         //Find the injection point Bean
-        Bean<?> bean = injectionResolver.getInjectionPointBean(injectionPoint);
+        Bean<Object> injectedBean = (Bean<Object>)injectionResolver.getInjectionPointBean(injectionPoint);
+        CreationalContextImpl<Object> injectedCreational = (CreationalContextImpl<Object>)createCreationalContext(injectedBean);
         
-        boolean isImpl = false;
-        if(creationalContext != null && (creationalContext instanceof CreationalContextImpl))
-        {
-            CreationalContextImpl<?> creationalContextImpl = (CreationalContextImpl<?>)creationalContext;            
-            instance = WebBeansUtil.getObjectFromCreationalContext(bean, creationalContextImpl);
-            isImpl = true;
-        }
-                
-        if(instance == null)
-        {
-            CreationalContextImpl<?> injectedCreational = (CreationalContextImpl<?>)createCreationalContext(bean);
+        if(WebBeansUtil.isDependent(injectedBean))
+        {        
+            injectedCreational.setOwnerCreational((CreationalContextImpl<?>)ownerCreationalContext);            
+            //Creating a new creational context for target bean instance
+            instance = getReference(injectedBean, injectionPoint.getType(), injectedCreational);
             
-            if(injectionPoint.getBean().getScope() != Dependent.class)
+            //Add this dependent into bean dependent list
+            ownerCreationalContextImpl.addDependent(injectedBean, instance, injectedCreational);
+        }
+        
+        else
+        {   //Look for creational stack
+            instance = WebBeansUtil.getObjectFromCreationalContext(injectedBean, ownerCreationalContextImpl);
+            //No in stack, create new
+            if(instance == null)
             {
-                if(isImpl)
-                {
-                    injectedCreational.setOwnerCreational((CreationalContextImpl<?>)creationalContext);
-                }
-   
+                instance = getReference(injectedBean, injectionPoint.getType(), injectedCreational);
             }
-            
-            //Creating a new creational context for target bean instance
-            instance = getReference(bean, injectionPoint.getType(), injectedCreational);
         }
-        
-        return instance;
 
+        return instance;
     }
 
     /**
@@ -885,15 +881,7 @@
         this.injectionResolver.checkInjectionPointType(injectionPoint);
         
         Class<?> rawType = ClassUtil.getRawTypeForInjectionPoint(injectionPoint);
-        
-        //Comment out while testing TCK Events Test --- WBTCK27 jira./////
-        //Hack for EntityManager --> Solve in M3!!!!
-        if(rawType.equals(Event.class) || rawType.getSimpleName().equals("EntityManager"))
-        {
-            return;
-        }
-        /////////////////////////////////////////////////////////////////
-        
+                
         // check for InjectionPoint injection
         if (rawType.equals(InjectionPoint.class))
         {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java?rev=904774&r1=904773&r2=904774&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextFactory.java Sat Jan 30 12:58:21 2010
@@ -58,4 +58,10 @@
     {        
         return new CreationalContextImpl<T>(contextual);   
     }        
+    
+    public CreationalContext<T> wrappedCreationalContext(CreationalContext<T> creationalContext, Contextual<T> contextual)
+    {
+        return new WrappedCreationalContext<T>(contextual, creationalContext);
+    }
+    
 }
\ No newline at end of file

Added: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/WrappedCreationalContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/WrappedCreationalContext.java?rev=904774&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/WrappedCreationalContext.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/WrappedCreationalContext.java Sat Jan 30 12:58:21 2010
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.context.creational;
+
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+
+class WrappedCreationalContext<T> extends CreationalContextImpl<T> implements CreationalContext<T>
+{
+    private CreationalContext<T> wrapped = null;    
+
+    WrappedCreationalContext(Contextual<T> contextual, CreationalContext<T> creationalContext)
+    {
+        super(contextual);
+        this.wrapped = creationalContext;
+    }
+
+    @Override
+    public void push(T instance)
+    {
+        super.push(instance);
+        wrapped.push(instance);        
+    }
+
+    @Override
+    public void release()
+    {
+        super.release();
+        wrapped.release();
+    }
+    
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/WrappedCreationalContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java?rev=904774&r1=904773&r2=904774&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java Sat Jan 30 12:58:21 2010
@@ -69,9 +69,6 @@
     /** Wrapped bean*/
     private AbstractBean<T> wrappedBean;
     
-    /**Creational context*/
-    private CreationalContext<Object> creationalContext;
-
     /**
      * Creates a new decorator bean instance with the given wrapped bean.
      * @param delegateComponent delegate bean instance
@@ -247,7 +244,7 @@
         return proxy;        
     }
 
-    public void setInjections(Object proxy)
+    public void setInjections(Object proxy, CreationalContext<?> cretionalContext)
     {
         // Set injected fields
         ManagedBean<T> delegate = (ManagedBean<T>) this.wrappedBean;
@@ -259,14 +256,14 @@
 
             if (!isDecorates)
             {
-                injectField(injectedField, proxy);
+                injectField(injectedField, proxy, cretionalContext);
             }
         }
         
         Set<Method> injectedMethods = delegate.getInjectedFromSuperMethods();
         for (Method injectedMethod : injectedMethods)
         {
-            injectMethod(injectedMethod, proxy);
+            injectMethod(injectedMethod, proxy, cretionalContext);
         }        
 
         injectedFields = delegate.getInjectedFields();
@@ -276,27 +273,27 @@
 
             if (!isDecorates)
             {
-                injectField(injectedField, proxy);
+                injectField(injectedField, proxy, cretionalContext);
             }
         }
         
         injectedMethods = delegate.getInjectedMethods();
         for (Method injectedMethod : injectedMethods)
         {
-            injectMethod(injectedMethod, proxy);
+            injectMethod(injectedMethod, proxy, cretionalContext);
         }        
     }
     
-    private void injectField(Field field, Object instance)
+    private void injectField(Field field, Object instance, CreationalContext<?> creationalContext)
     {
-        InjectableField f = new InjectableField(field, instance, this.wrappedBean, this.creationalContext);
+        InjectableField f = new InjectableField(field, instance, this.wrappedBean, creationalContext);
         f.doInjection();        
     }
 
     @SuppressWarnings("unchecked")
-    private void injectMethod(Method method, Object instance)
+    private void injectMethod(Method method, Object instance, CreationalContext<?> creationalContext)
     {
-        InjectableMethods m = new InjectableMethods(method, instance, this.wrappedBean, this.creationalContext);
+        InjectableMethods m = new InjectableMethods(method, instance, this.wrappedBean, creationalContext);
         m.doInjection();        
     }
     

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java?rev=904774&r1=904773&r2=904774&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecoratorConfig.java Sat Jan 30 12:58:21 2010
@@ -22,6 +22,8 @@
 import java.util.List;
 import java.util.Set;
 
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.Decorator;
 
 import org.apache.webbeans.annotation.DefaultLiteral;
@@ -84,13 +86,14 @@
         List<Object> decoratorStack = new ArrayList<Object>();
         List<Decorator<?>> decoratorList = component.getDecorators();        
         Iterator<Decorator<?>> itList = decoratorList.iterator();
-
+        BeanManager manager = BeanManagerImpl.getManager();
         while (itList.hasNext())
         {
             WebBeansDecorator<?> decorator = (WebBeansDecorator<?>) itList.next();
+            CreationalContext<?> creationalContext = manager.createCreationalContext(decorator);
+            Object decoratorInstance = manager.getReference(decorator, decorator.getBeanClass(), creationalContext);
             
-            Object decoratorInstance = BeanManagerImpl.getManager().getInstance(decorator,null);
-            decorator.setInjections(decoratorInstance);
+            decorator.setInjections(decoratorInstance, creationalContext);
             decorator.setDelegate(decoratorInstance, delegate);
             decoratorStack.add(decoratorInstance);
         }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=904774&r1=904773&r2=904774&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java Sat Jan 30 12:58:21 2010
@@ -19,20 +19,19 @@
 import java.lang.reflect.Type;
 import java.util.List;
 
-import javax.enterprise.context.Dependent;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.event.Event;
 import javax.enterprise.inject.Instance;
 import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.InjectionPoint;
 
 import org.apache.webbeans.component.AbstractBean;
 import org.apache.webbeans.component.EventBean;
+import org.apache.webbeans.component.InjectionPointBean;
 import org.apache.webbeans.component.InstanceBean;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.container.InjectionResolver;
-import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 
@@ -49,11 +48,13 @@
  */
 public abstract class AbstractInjectable implements Injectable
 {
+    private static final WebBeansLogger logger = WebBeansLogger.getLogger(AbstractInjectable.class);
+    
     /** Owner bean of the injection point*/
-    protected AbstractBean<?> injectionOwnerComponent;
+    protected AbstractBean<?> injectionOwnerBean;
     
     /**Creational context instance that is passed to bean's create*/
-    protected CreationalContext<?> creationalContext;
+    protected CreationalContext<?> injectionOwnerCreationalContext;
     
     /**Field, method or constructor injection*/
     protected Member injectionMember;
@@ -64,10 +65,10 @@
      * @param bean owner bean
      * @param creaitonalContext creational context instance
      */
-    protected AbstractInjectable(AbstractBean<?> bean, CreationalContext<?> creaitonalContext)
+    protected AbstractInjectable(AbstractBean<?> injectionOwnerBean, CreationalContext<?> injectionOwnerCreationalContext)
     {
-        this.injectionOwnerComponent = bean;
-        this.creationalContext = creaitonalContext;
+        this.injectionOwnerBean = injectionOwnerBean;
+        this.injectionOwnerCreationalContext = injectionOwnerCreationalContext;
     }
 
     /**
@@ -75,18 +76,11 @@
      * @param injectionPoint injection point definition  
      * @return current bean instance in the resolved bean scope
      */
-    @SuppressWarnings("unchecked")
     public <T> Object inject(InjectionPoint injectionPoint)
     {
+        logger.debug("Injected into bean : " + this.injectionOwnerBean.toString() + " with injection point : " + injectionPoint);
         Object injected = null;
-        
-        if(injectionPoint.getType().equals(InjectionPoint.class))
-        {
-            //Try to inject dependent owner injection point
-            //If this injection owner is dependent object then its
-            //dependentOwnerInjectionPoint can not be null.
-            return injectDependentOwnerInjectionPoint();
-        }
+        Bean<?> injectedBean = (Bean<?>)InjectionResolver.getInstance().getInjectionPointBean(injectionPoint);        
         
         if(isInstanceProviderInjection(injectionPoint))
         {
@@ -96,63 +90,20 @@
         else if(isEventProviderInjection(injectionPoint))
         {
             EventBean.local.set(injectionPoint);
-        }
+        }        
         
-        //Get injection point Bean to look for @Dependent
-        Bean<?> injectedBean = InjectionResolver.getInstance().getInjectionPointBean(injectionPoint);
+        injected = BeanManagerImpl.getManager().getInjectableReference(injectionPoint, this.injectionOwnerCreationalContext);
         
-        boolean dependent = false;
-        
-        //Managed @Dependence instances
-        if (injectedBean.getScope().equals(Dependent.class))
-        {
-            dependent = true;
-        }
-        
-        if(dependent && (WebBeansUtil.isManagedBean(this.injectionOwnerComponent) || 
-                WebBeansUtil.isEnterpriseBean(this.injectionOwnerComponent)))
-        {
-            injected = injectForBeanDependent(injectedBean,injectionPoint);   
-        }                 
-        else
+        //Injection for dependent instance InjectionPoint fields
+        if(WebBeansUtil.isDependent(injectedBean))
         {
-            injected = injectForComponent(injectionPoint);
             
-            if(dependent && WebBeansUtil.isProducerBean(this.injectionOwnerComponent))
-            {
-                if(this.creationalContext instanceof CreationalContext)
-                {
-                    CreationalContextImpl<?> cc = (CreationalContextImpl<?>)this.creationalContext;
-                    CreationalContextImpl<Object> dependentCc = (CreationalContextImpl<Object>)BeanManagerImpl.getManager().createCreationalContext((Bean<Object>)injectedBean);
-                    dependentCc.setOwnerCreational(cc);
-                    
-                    cc.addDependent((Bean<Object>)injectedBean, injected, dependentCc);                    
-                }
-            }
         }
-         
+        
 
         return injected;
     }
     
-    /**
-     * TODO Not Sure to correct!
-     * Specification 5.6.1 is not explicit! 
-     *
-     * @return the injection point of the dependent owner
-     */
-    protected Object injectDependentOwnerInjectionPoint()
-    {
-        AbstractBean<?> dependentComponent = this.injectionOwnerComponent;
-        InjectionPoint injectionPointOfOwner = dependentComponent.getDependentOwnerInjectionPoint();
-        
-        if(injectionPointOfOwner != null)
-        {
-            return injectionPointOfOwner;
-        }
-                
-        return null;        
-    }
 
     /**
      * check if any of the given resources is a resource annotation
@@ -162,34 +113,7 @@
     {
         return AnnotationUtil.hasResourceAnnotation(annotations); 
     }
-    
-    /**
-     * Return dependent scoped injection point bean instance.
-     * @param bean injected depedent scoped bean
-     * @param injectionPoint injection point
-     * @return injection point instance
-     */
-    private Object injectForBeanDependent(Bean<?> bean, InjectionPoint injectionPoint)
-    {
-        Object object = null;
-        object = this.injectionOwnerComponent.getDependent(bean,injectionPoint, this.creationalContext);
-
-        return object;
-    }
-
-    /**
-     * Returns injection point instance.
-     * @param injectionPoint injection point
-     * @return injection point instance
-     */
-    private Object injectForComponent(InjectionPoint injectionPoint)
-    {
-        BeanManager manager = BeanManagerImpl.getManager();
-        Object object = manager.getInjectableReference(injectionPoint, this.creationalContext);
-                
-        return object;
-    }
-    
+        
     /**
      * Returns injection points related with given member type of the bean.
      * @param member java member
@@ -197,7 +121,7 @@
      */
     protected List<InjectionPoint> getInjectedPoints(Member member)
     {
-        List<InjectionPoint> injectedFields = this.injectionOwnerComponent.getInjectionPoint(member);
+        List<InjectionPoint> injectedFields = this.injectionOwnerBean.getInjectionPoint(member);
         
         return injectedFields;
 
@@ -239,6 +163,15 @@
         return false;
     }
     
+    private boolean isInjectionPointInjection(InjectionPoint injectionPoint)
+    {
+        if(injectionPoint.getType().equals(InjectionPoint.class))
+        {
+            return true;
+        }
+        
+        return false;
+    }
     
     
     /**
@@ -248,7 +181,7 @@
      */
     public AbstractBean<?> getInjectionOwnerComponent()
     {
-        return injectionOwnerComponent;
+        return this.injectionOwnerBean;
     }
 
 }
\ No newline at end of file

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java?rev=904774&r1=904773&r2=904774&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java Sat Jan 30 12:58:21 2010
@@ -23,13 +23,14 @@
 import javassist.util.proxy.MethodHandler;
 import javassist.util.proxy.ProxyFactory;
 
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.BeanManager;
 import javax.interceptor.ExcludeClassInterceptors;
 import javax.interceptor.Interceptors;
 
 import org.apache.webbeans.component.AbstractBean;
 import org.apache.webbeans.config.BeansDeployer;
 import org.apache.webbeans.config.DefinitionUtil;
-import org.apache.webbeans.config.OWBLogConst;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.decorator.DelegateHandler;
 import org.apache.webbeans.decorator.WebBeansDecorator;
@@ -134,10 +135,6 @@
  */
 public abstract class InterceptorHandler implements MethodHandler, Serializable
 {
-    private static final long serialVersionUID = 1657109769733323541L;
-    
-    private transient static WebBeansLogger logger = WebBeansLogger.getLogger(InterceptorHandler.class);
-
     protected AbstractBean<?> bean = null;
 
     protected InterceptorHandler(AbstractBean<?> bean)
@@ -301,6 +298,7 @@
     public static void injectInterceptorFields(final List<InterceptorData> stack)
     {
         Iterator<InterceptorData> it = stack.iterator();
+        BeanManager manager = BeanManagerImpl.getManager();
         while (it.hasNext())
         {
             InterceptorData intData = it.next();
@@ -311,9 +309,11 @@
                 {
                     if (intData.isDefinedWithWebBeansInterceptor())
                     {
-                        Object interceptorProxy = BeanManagerImpl.getManager().getInstance(intData.getWebBeansInterceptor(),null);
-                        WebBeansInterceptor<?> interceptor = (WebBeansInterceptor<?>) intData.getWebBeansInterceptor();
-                        interceptor.setInjections(interceptorProxy);
+                        WebBeansInterceptor<?> interceptor = (WebBeansInterceptor<?>)intData.getWebBeansInterceptor();
+                        CreationalContext<?> creationalContext = manager.createCreationalContext(interceptor);
+                        Object interceptorProxy = manager.getReference(interceptor,interceptor.getBeanClass(), creationalContext);
+                        
+                        interceptor.setInjections(interceptorProxy, creationalContext);
 
                         //Setting interceptor proxy instance
                         intData.setInterceptorInstance(interceptorProxy);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=904774&r1=904773&r2=904774&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java Sat Jan 30 12:58:21 2010
@@ -74,8 +74,6 @@
     /**Delegate Bean*/
     private AbstractBean<T> delegateBean;
     
-    private CreationalContext<T> creationalContext;
-
     public WebBeansInterceptor(AbstractBean<T> delegateBean)
     {
         super(WebBeansType.INTERCEPTOR,delegateBean.getReturnType());
@@ -278,7 +276,7 @@
         return proxy;
     }
 
-    public void setInjections(Object proxy)
+    public void setInjections(Object proxy, CreationalContext<?> creationalContext)
     {
         // Set injected fields
         ManagedBean<T> delegate = (ManagedBean<T>) this.delegateBean;
@@ -286,39 +284,39 @@
         Set<Field> injectedFields = delegate.getInjectedFromSuperFields();
         for (Field injectedField : injectedFields)
         {
-            injectField(injectedField, proxy);
+            injectField(injectedField, proxy, creationalContext);
         }
 
         Set<Method> injectedMethods = delegate.getInjectedFromSuperMethods();
         for (Method injectedMethod : injectedMethods)
         {
-            injectMethod(injectedMethod, proxy);
+            injectMethod(injectedMethod, proxy, creationalContext);
         }
         
         injectedFields = delegate.getInjectedFields();
         for (Field injectedField : injectedFields)
         {
-            injectField(injectedField, proxy);            
+            injectField(injectedField, proxy, creationalContext);            
         }
         
 
         injectedMethods = delegate.getInjectedMethods();
         for (Method injectedMethod : injectedMethods)
         {
-            injectMethod(injectedMethod, proxy);            
+            injectMethod(injectedMethod, proxy, creationalContext);            
         }        
     }
     
-    private void injectField(Field field, Object instance)
+    private void injectField(Field field, Object instance, CreationalContext<?> creationalContext)
     {
-        InjectableField f = new InjectableField(field, instance, this.delegateBean, this.creationalContext);
+        InjectableField f = new InjectableField(field, instance, this.delegateBean, creationalContext);
         f.doInjection();        
     }
 
     @SuppressWarnings("unchecked")
-    private void injectMethod(Method method, Object instance)
+    private void injectMethod(Method method, Object instance, CreationalContext<?> creationalContext)
     {
-        InjectableMethods m = new InjectableMethods(method, instance, this.delegateBean, this.creationalContext);
+        InjectableMethods m = new InjectableMethods(method, instance, this.delegateBean, creationalContext);
         m.doInjection();        
     }
     

Added: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/DependentBeanProxy.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/DependentBeanProxy.java?rev=904774&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/DependentBeanProxy.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/DependentBeanProxy.java Sat Jan 30 12:58:21 2010
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.proxy;
+
+public class DependentBeanProxy
+{
+    private Object proxyInstance;
+    
+    private Object actualInstance;
+    
+    public DependentBeanProxy()
+    {
+        
+    }
+
+    /**
+     * @return the proxyInstance
+     */
+    public Object getProxyInstance()
+    {
+        return proxyInstance;
+    }
+
+    /**
+     * @param proxyInstance the proxyInstance to set
+     */
+    public void setProxyInstance(Object proxyInstance)
+    {
+        this.proxyInstance = proxyInstance;
+    }
+
+    /**
+     * @return the actualInstance
+     */
+    public Object getActualInstance()
+    {
+        return actualInstance;
+    }
+
+    /**
+     * @param actualInstance the actualInstance to set
+     */
+    public void setActualInstance(Object actualInstance)
+    {
+        this.actualInstance = actualInstance;
+    }
+    
+    
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/DependentBeanProxy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=904774&r1=904773&r2=904774&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Sat Jan 30 12:58:21 2010
@@ -787,7 +787,7 @@
      */
     public static InjectionPointBean getInjectionPointBean()
     {
-        return new InjectionPointBean(null);
+        return new InjectionPointBean();
     }
 
     /**
@@ -2285,4 +2285,14 @@
         
         return false;
     }
+    
+    public static boolean isDependent(Bean<?> bean)
+    {
+        if(bean.getScope().equals(Dependent.class))
+        {
+            return true;
+        }
+        
+        return false;
+    }
 }
\ No newline at end of file

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/DependentMethodBeanTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/DependentMethodBeanTest.java?rev=904774&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/DependentMethodBeanTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/DependentMethodBeanTest.java Sat Jan 30 12:58:21 2010
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.disposes;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import junit.framework.Assert;
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.disposes.beans.DependentBean;
+import org.apache.webbeans.newtests.disposes.beans.RequestBean;
+import org.apache.webbeans.newtests.disposes.common.RequestModel;
+import org.junit.Test;
+
+public class DependentMethodBeanTest extends AbstractUnitTest
+{
+    @Test
+    @SuppressWarnings("unchecked")
+    public void testDisposerMethod()
+    {
+        Collection<URL> beanXmls = new ArrayList<URL>();
+        
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(DependentBean.class);
+        beanClasses.add(RequestBean.class);
+        
+        startContainer(beanClasses, beanXmls);        
+
+        Bean<RequestModel> bean = (Bean<RequestModel>)getBeanManager().getBeans("rproduce").iterator().next();
+        CreationalContext<RequestModel> cc = getBeanManager().createCreationalContext(bean);
+        RequestModel model = (RequestModel) getBeanManager().getReference(bean, RequestModel.class, cc);
+        System.out.println(model.getID());
+        
+        shutDownContainer();
+        
+        Assert.assertTrue(DependentBean.OK);
+        
+    }
+
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/DependentMethodBeanTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DependentBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DependentBean.java?rev=904774&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DependentBean.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DependentBean.java Sat Jan 30 12:58:21 2010
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.disposes.beans;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.concepts.alternatives.common.Pencil;
+import org.apache.webbeans.newtests.disposes.common.DependentModel;
+import org.apache.webbeans.newtests.disposes.common.HttpHeader;
+
+@ApplicationScoped
+@Named("DependentBean")
+public class DependentBean
+{
+    public static boolean OK = false;
+
+    static int index = 0;
+    
+    static DependentModel producedModel = null;
+    
+    @Produces @Dependent @HttpHeader
+    public static DependentModel dproduce(@New DependentModel model)
+    {
+        model.setValue(true);
+        model.setId(index++);
+        if (producedModel == null) {
+        	producedModel = model;
+        }
+    	System.out.println("produced DependentModel=" + model);
+        return model;
+    }
+    
+    
+    public static void ddispose(@Disposes @HttpHeader DependentModel model, @New Pencil pencil)
+    {
+        OK = model.isValue();
+        if (OK) {
+        	OK = (model.getId() == producedModel.getId());
+        }
+    	System.out.println("disposed DependentModel=" + model + "OK=" + OK);
+    }
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/DependentBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/RequestBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/RequestBean.java?rev=904774&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/RequestBean.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/RequestBean.java Sat Jan 30 12:58:21 2010
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.disposes.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.New;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.apache.webbeans.newtests.disposes.common.RequestModel;
+
+@ApplicationScoped
+@Named("org.apache.webbeans.newtests.disposes.beans.RequestBean")
+public class RequestBean {
+
+    @Produces @RequestScoped @Named("rproduce")
+    public RequestModel rproduce(@New RequestModel rmodel)
+    {
+    	System.out.println("produced RequestModel=" + rmodel);
+    	return rmodel;
+    }
+    
+    public void rdispose(@Disposes RequestModel rmodel)
+    {
+    	System.out.println("disposed RequestModel=" + rmodel);
+    }    
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/beans/RequestBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/DependentModel.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/DependentModel.java?rev=904774&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/DependentModel.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/DependentModel.java Sat Jan 30 12:58:21 2010
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.disposes.common;
+
+public class DependentModel
+{
+    public boolean value = false;
+
+    public int id = 0;
+    
+    public DependentModel() {
+    	System.out.println(this.getClass().getSimpleName() + ".DependentModel() is invoked");
+    }
+    /**
+     * @return the value
+     */
+    public boolean isValue()
+    {
+        return value;
+    }
+
+    /**
+     * @param value the value to set
+     */
+    public void setValue(boolean value)
+    {
+        this.value = value;
+    }
+    
+    public void setId(int id) {
+    	this.id = id;
+    }
+    
+    public int getId() {
+    	return this.id;
+    }
+    
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/DependentModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/RequestModel.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/RequestModel.java?rev=904774&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/RequestModel.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/RequestModel.java Sat Jan 30 12:58:21 2010
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.disposes.common;
+
+import javax.inject.Inject;
+
+public class RequestModel {
+
+	@Inject @HttpHeader DependentModel disposeModel;
+	
+	public int getID() {
+		return disposeModel.getId();
+	}
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/disposes/common/RequestModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularConstructorOrProducerMethodParameterBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularConstructorOrProducerMethodParameterBean.java?rev=904774&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularConstructorOrProducerMethodParameterBean.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularConstructorOrProducerMethodParameterBean.java Sat Jan 30 12:58:21 2010
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.circular.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@RequestScoped
+@Named("org.apache.webbeans.newtests.injection.circular.beans.CircularConstructorOrProducerMethodParameterBean")
+public class CircularConstructorOrProducerMethodParameterBean
+{
+    private boolean SAY_HELLO = false;
+
+    private @Inject CircularNormalInConstructor A;
+    
+    public void sayHello()
+    {
+        SAY_HELLO = true;
+    }
+    
+    public boolean getSAYHELLO()
+    {
+        A.sayHello();
+        return this.SAY_HELLO;
+    }
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularConstructorOrProducerMethodParameterBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularNormalInConstructor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularNormalInConstructor.java?rev=904774&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularNormalInConstructor.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularNormalInConstructor.java Sat Jan 30 12:58:21 2010
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.circular.beans;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@RequestScoped
+@Named("org.apache.webbeans.newtests.injection.circular.beans.CircularNormalInConstructor")
+public class CircularNormalInConstructor
+{
+    CircularConstructorOrProducerMethodParameterBean B;
+    
+    private boolean SAY_HELLO = false;
+    
+    public CircularNormalInConstructor()
+    {
+        
+    }
+    
+    @Inject
+    public CircularNormalInConstructor(CircularConstructorOrProducerMethodParameterBean B)
+    {
+        this.B = B;
+    }
+    
+    public void sayHello()
+    {
+        SAY_HELLO = true;
+        
+        B.sayHello();
+    }
+    
+    public boolean getSAYHELLO()
+    {
+        return this.SAY_HELLO;
+    }
+    
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/beans/CircularNormalInConstructor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/tests/CircularInjectionIntoConstructorTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/tests/CircularInjectionIntoConstructorTest.java?rev=904774&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/tests/CircularInjectionIntoConstructorTest.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/tests/CircularInjectionIntoConstructorTest.java Sat Jan 30 12:58:21 2010
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.newtests.injection.circular.tests;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.newtests.AbstractUnitTest;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularConstructorOrProducerMethodParameterBean;
+import org.apache.webbeans.newtests.injection.circular.beans.CircularNormalInConstructor;
+import org.junit.Test;
+
+public class CircularInjectionIntoConstructorTest extends AbstractUnitTest
+{
+    public CircularInjectionIntoConstructorTest()
+    {
+        
+    }
+    
+    @Test
+    @SuppressWarnings("unchecked")
+    public void testOneNormalOneDependent()
+    {
+        Collection<URL> beanXmls = new ArrayList<URL>();
+        
+        Collection<Class<?>> beanClasses = new ArrayList<Class<?>>();
+        beanClasses.add(CircularNormalInConstructor.class);
+        beanClasses.add(CircularConstructorOrProducerMethodParameterBean.class);
+        
+        startContainer(beanClasses, beanXmls);        
+        
+        Set<Bean<?>> beans = getBeanManager().getBeans("org.apache.webbeans.newtests.injection.circular.beans.CircularNormalInConstructor");
+        Assert.assertNotNull(beans);        
+        
+        Bean<CircularNormalInConstructor> bean = (Bean<CircularNormalInConstructor>)beans.iterator().next();        
+        CreationalContext<CircularNormalInConstructor> ctx = getBeanManager().createCreationalContext(bean);
+        
+        Object reference = getBeanManager().getReference(bean, CircularNormalInConstructor.class, ctx);
+        
+        Assert.assertTrue(reference instanceof CircularNormalInConstructor);
+        
+        CircularNormalInConstructor beanInstance = (CircularNormalInConstructor)reference;
+        beanInstance.sayHello();
+        
+        beans = getBeanManager().getBeans("org.apache.webbeans.newtests.injection.circular.beans.CircularConstructorOrProducerMethodParameterBean");
+        Assert.assertNotNull(beans);        
+        Bean<CircularConstructorOrProducerMethodParameterBean> bean2 = (Bean<CircularConstructorOrProducerMethodParameterBean>)beans.iterator().next();
+                
+        CreationalContext<CircularConstructorOrProducerMethodParameterBean> ctx2 = getBeanManager().createCreationalContext(bean2);
+        
+        reference = getBeanManager().getReference(bean2, CircularConstructorOrProducerMethodParameterBean.class, ctx2);
+        
+        Assert.assertTrue(reference instanceof CircularConstructorOrProducerMethodParameterBean);
+        
+        CircularConstructorOrProducerMethodParameterBean beanInstance2 = (CircularConstructorOrProducerMethodParameterBean)reference;
+        Assert.assertTrue(beanInstance2.getSAYHELLO());
+        
+        reference = getBeanManager().getReference(bean, CircularNormalInConstructor.class, ctx);
+        
+        Assert.assertTrue(reference instanceof CircularNormalInConstructor);
+        
+        beanInstance = (CircularNormalInConstructor)reference;
+        
+        Assert.assertTrue(beanInstance.getSAYHELLO());
+        
+        shutDownContainer();
+    }
+ 
+}

Propchange: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/circular/tests/CircularInjectionIntoConstructorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java?rev=904774&r1=904773&r2=904774&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/xml/definition/XMLDefinitionTest.java Sat Jan 30 12:58:21 2010
@@ -74,7 +74,7 @@
 
         XMLManagedBean<?> compDef = getWebBeanFromXml("org/apache/webbeans/test/xml/definition/definition2.xml");
 
-        Object instance = compDef.create(null);
+        Object instance = compDef.create(CreationalContextFactory.getInstance().getCreationalContext(compDef));
 
         Assert.assertNotNull(instance);
         Assert.assertTrue(instance instanceof Definition2);



Mime
View raw message