openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r773733 - 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/inheritance/ main/java/org/apache/webbeans/container/ main/jav...
Date Mon, 11 May 2009 23:57:35 GMT
Author: gerdogdu
Date: Mon May 11 23:57:34 2009
New Revision: 773733

URL: http://svn.apache.org/viewvc?rev=773733&view=rev
Log:
Update for M2 after testing. Correction of some bugs in the context tests.

Added:
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ClassTest.java   (with props)
Modified:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractObservesComponent.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewComponentImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerComponentImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/AbstractBeanInheritedMetaData.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ResolutionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/xml/XMLInjectionPointModel.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataComparator.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/InjectedTypeLiteralComponent.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java Mon May 11 23:57:34 2009
@@ -14,8 +14,6 @@
 package org.apache.webbeans.component;
 
 import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
@@ -26,10 +24,7 @@
 import java.util.Set;
 import java.util.WeakHashMap;
 
-import javax.context.Context;
-import javax.context.Contextual;
 import javax.context.CreationalContext;
-import javax.context.Dependent;
 import javax.inject.CreationException;
 import javax.inject.manager.Bean;
 import javax.inject.manager.InjectionPoint;
@@ -38,13 +33,9 @@
 import org.apache.webbeans.config.inheritance.IBeanInheritedMetaData;
 import org.apache.webbeans.container.ManagerImpl;
 import org.apache.webbeans.context.ContextFactory;
-import org.apache.webbeans.context.DependentContext;
-import org.apache.webbeans.context.WebBeansContext;
-import org.apache.webbeans.context.creational.CreationalContextFactory;
 import org.apache.webbeans.deployment.DeploymentTypeManager;
 import org.apache.webbeans.intercept.InterceptorData;
 import org.apache.webbeans.util.ClassUtil;
-import org.apache.webbeans.util.WebBeansUtil;
 
 /**
  * Abstract implementation of the {@link Component} contract. There are several
@@ -108,7 +99,11 @@
     /**Beans injection points*/
     protected Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
     
+    /**Bean inherited meta data*/
     protected IBeanInheritedMetaData inheritedMetaData;
+    
+    /**Tracks dependent injection point owner, can be null*/
+    protected InjectionPoint dependentOwnerInjectionPoint;
 
     /**
      * Constructor definiton. Each subclass redefines its own constructor with
@@ -207,15 +202,25 @@
         boolean dependentContext = false;
         try
         {
+            //Check dependent context
             if(!ContextFactory.checkDependentContextActive())
             {
                 ContextFactory.activateDependentContext();
                 dependentContext = true;
             }
             
-
+            //Destroy instance
             destroyInstance(instance);
+            
+            //Destory dependent instances
             destroyDependents();
+            
+            //Clear Decorator and Interceptor Stack
+            this.decoratorStack.clear();
+            this.interceptorStack.clear();
+            
+            //Reset it
+            this.dependentOwnerInjectionPoint = null;
 
         }
         finally
@@ -223,18 +228,7 @@
             if(dependentContext)
             {
                 ContextFactory.passivateDependentContext();
-            }
-            
-            if(WebBeansUtil.isScopeTypeNormal(getScopeType()))
-            {                
-                Context context = getManager().getContext(getScopeType());
-                
-                if(context instanceof WebBeansContext)
-                {
-                    WebBeansContext webBeansContext = (WebBeansContext) context;
-                    webBeansContext.remove(this);
-                }                   
-            }                        
+            }            
         }
 
     }
@@ -432,30 +426,18 @@
      * @param dependentComponent dependent web beans component
      * @return the dependent component instance
      */
-    @SuppressWarnings("unchecked")
     public Object getDependent(Bean<?> dependentComponent, InjectionPoint injectionPoint)
     {
         Object object = null;
         
-        DependentContext context = (DependentContext) getManager().getContext(Dependent.class);
-        object = context.get((Contextual<T>)dependentComponent,(CreationalContext<T>)CreationalContextFactory.getInstance().getCreationalContext(dependentComponent));
-        
-        //Inject the InjectionPoints
-        Set<InjectionPoint> injectionPoints = dependentComponent.getInjectionPoints();
-        for(InjectionPoint points : injectionPoints)
-        {
-            if(points.getType().equals(InjectionPoint.class))
-            {
-                Member member = points.getMember();
-                if(member instanceof Field)
-                {
-                    Field field = (Field) member;
-                    ClassUtil.setField(object, field, getManager().getInstance(new InjectionPointComponentImpl(injectionPoint)));
-                }
-            }
-            
-        }
+        //Setting injection point owner
+        AbstractComponent<?> dependent = (AbstractComponent<?>)dependentComponent;
+        dependent.setDependentOwnerInjectionPoint(injectionPoint);        
         
+        //Get dependent instance
+        object = ManagerImpl.getManager().getInstance(dependentComponent);
+                
+        //Put this into the dependent map
         this.dependentObjects.put(object, dependentComponent);
 
         return object;
@@ -546,6 +528,23 @@
         return this.injectionPoints;
     }
     
+    /**
+     * @return the dependentOwnerInjectionPoint
+     */
+    public InjectionPoint getDependentOwnerInjectionPoint()
+    {
+        return dependentOwnerInjectionPoint;
+    }
+
+    /**
+     * @param dependentOwnerInjectionPoint the dependentOwnerInjectionPoint to set
+     */
+    public void setDependentOwnerInjectionPoint(InjectionPoint dependentOwnerInjectionPoint)
+    {
+        this.dependentOwnerInjectionPoint = dependentOwnerInjectionPoint;
+    }
+    
+    
     public String toString()
     {
         StringBuilder builder = new StringBuilder();
@@ -582,5 +581,4 @@
         
         return builder.toString();
     }
-
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractObservesComponent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractObservesComponent.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractObservesComponent.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractObservesComponent.java Mon May 11 23:57:34 2009
@@ -84,7 +84,7 @@
 
         if (WebBeansUtil.isContainsInterceptorMethod(getInterceptorStack(), InterceptorType.POST_CONSTRUCT))
         {
-            InvocationContextImpl impl = new InvocationContextImpl(instance, null, null, WebBeansUtil.getInterceptorMethods(getInterceptorStack(), InterceptorType.POST_CONSTRUCT), InterceptorType.POST_CONSTRUCT);
+            InvocationContextImpl impl = new InvocationContextImpl(null,instance, null, null, WebBeansUtil.getInterceptorMethods(getInterceptorStack(), InterceptorType.POST_CONSTRUCT), InterceptorType.POST_CONSTRUCT);
             try
             {
                 impl.proceed();

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ComponentImpl.java Mon May 11 23:57:34 2009
@@ -63,10 +63,10 @@
 
         T instance = ic.doInjection();
         
-        if(WebBeansUtil.isScopeTypeNormal(getScopeType()))
-        {
-            creationalContext.push(instance);   
-        }
+//        if(WebBeansUtil.isScopeTypeNormal(getScopeType()))
+//        {
+//            creationalContext.push(instance);   
+//        }
         
         return instance;
     }
@@ -78,7 +78,7 @@
     {
         if (WebBeansUtil.isContainsInterceptorMethod(getInterceptorStack(), InterceptorType.PRE_DESTROY))
         {
-            InvocationContextImpl impl = new InvocationContextImpl(instance, null, null, WebBeansUtil.getInterceptorMethods(getInterceptorStack(), InterceptorType.PRE_DESTROY), InterceptorType.PRE_DESTROY);
+            InvocationContextImpl impl = new InvocationContextImpl(null,instance, null, null, WebBeansUtil.getInterceptorMethods(getInterceptorStack(), InterceptorType.PRE_DESTROY), InterceptorType.PRE_DESTROY);
             try
             {
                 impl.proceed();

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewComponentImpl.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewComponentImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewComponentImpl.java Mon May 11 23:57:34 2009
@@ -18,12 +18,11 @@
 
 /**
  * Component definition with {@link New} binding annotation.
+ * 
  * <p>
  * It is defined as concrete java class component.
  * </p>
  * 
- * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
- * @since 1.0
  */
 public class NewComponentImpl<T> extends ComponentImpl<T>
 {

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerComponentImpl.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerComponentImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerComponentImpl.java Mon May 11 23:57:34 2009
@@ -156,7 +156,8 @@
                 parentInstance = getParentInstance();
             }
             
-            InjectableMethods<T> m = new InjectableMethods<T>(creatorMethod, parentInstance, this,null);
+            InjectableMethods<T> m = new InjectableMethods<T>(creatorMethod, parentInstance, this, null);
+            
             instance = m.doInjection();
 
         }
@@ -221,6 +222,7 @@
 
 
                 InjectableMethods<T> m = new InjectableMethods<T>(disposalMethod, parentInstance, this,null);
+                
                 m.doInjection();
 
             }

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=773733&r1=773732&r2=773733&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 Mon May 11 23:57:34 2009
@@ -855,7 +855,7 @@
                 // Injected fields can not be @Decorates or @Produces
                 if (AnnotationUtil.isAnnotationExist(anns, Produces.class) || AnnotationUtil.isAnnotationExist(anns, Decorates.class))
                 {
-                    return;
+                    continue;
                 }
 
                 Annotation[] bindingAnns = AnnotationUtil.getBindingAnnotations(anns);

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/SimpleWebBeansConfigurator.java Mon May 11 23:57:34 2009
@@ -1,15 +1,12 @@
 /*
- * 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.
+ * 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.config;
 
@@ -54,8 +51,7 @@
      * Checks the implementation class for checking conditions.
      * 
      * @param clazz implementation class
-     * @throws WebBeansConfigurationException if any configuration exception
-     *             occurs
+     * @throws WebBeansConfigurationException if any configuration exception occurs
      */
     public static void checkSimpleWebBeanCondition(Class<?> clazz) throws WebBeansConfigurationException
     {
@@ -78,13 +74,11 @@
     }
 
     /**
-     * Returns true if this class can be candidate for simple web bean, false
-     * otherwise.
+     * Returns true if this class can be candidate for simple web bean, false otherwise.
      * 
      * @param clazz implementation class
      * @return true if this class can be candidate for simple web bean
-     * @throws WebBeansConfigurationException if any configuration exception
-     *             occurs
+     * @throws WebBeansConfigurationException if any configuration exception occurs
      */
     public static boolean isSimpleWebBean(Class<?> clazz) throws WebBeansConfigurationException
     {
@@ -106,8 +100,7 @@
      * 
      * @param clazz Simple WebBean Component implementation class
      * @return the newly created Simple WebBean Component
-     * @throws WebBeansConfigurationException if any configuration exception
-     *             occurs
+     * @throws WebBeansConfigurationException if any configuration exception occurs
      */
     public static <T> ComponentImpl<T> define(Class<T> clazz, WebBeansType type) throws WebBeansConfigurationException
     {

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=773733&r1=773732&r2=773733&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 Mon May 11 23:57:34 2009
@@ -19,18 +19,19 @@
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.net.URL;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
 import javax.context.Dependent;
 import javax.context.ScopeType;
-import javax.decorator.Decorator;
 import javax.event.Event;
 import javax.inject.Current;
 import javax.inject.InconsistentSpecializationException;
 import javax.inject.Specializes;
 import javax.inject.manager.Bean;
+import javax.inject.manager.Decorator;
 import javax.inject.manager.InjectionPoint;
 import javax.inject.manager.Manager;
 import javax.interceptor.Interceptor;
@@ -44,10 +45,12 @@
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.container.ManagerImpl;
 import org.apache.webbeans.decorator.DecoratorUtil;
+import org.apache.webbeans.decorator.WebBeansDecorator;
 import org.apache.webbeans.deployment.StereoTypeManager;
 import org.apache.webbeans.deployment.StereoTypeModel;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.exception.WebBeansDeploymentException;
+import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.spi.JNDIService;
 import org.apache.webbeans.spi.ServiceLoader;
@@ -159,37 +162,73 @@
     
     private void validateInjectionPoints()
     {
-        logger.info("Validation injection points is started");
+        logger.info("Validation of injection points are started");
 
-        ManagerImpl manager = ManagerImpl.getManager();
-        InjectionResolver resolver = InjectionResolver.getInstance();
-        Set<Bean<?>> beans = manager.getBeans();
+        ManagerImpl manager = ManagerImpl.getManager();        
+        Set<Bean<?>> beans = new HashSet<Bean<?>>();
+        
+        //Adding decorators to validate
+        Set<Decorator> decorators = manager.getDecorators();
+        for(Decorator decorator : decorators)
+        {
+            WebBeansDecorator wbDec = (WebBeansDecorator)decorator;
+            beans.add(wbDec.getDelegateComponent());
+        }
+        
+        
+        logger.info("Validation of the decorator's injection points are started");
+        
+        //Validate Decorators
+        validate(beans);
+        
+        beans.clear();
+        
+        //Adding interceptors to validate
+        Set<javax.inject.manager.Interceptor> interceptors = manager.getInterceptors();
+        for(javax.inject.manager.Interceptor interceptor : interceptors)
+        {
+            WebBeansInterceptor wbInt = (WebBeansInterceptor)interceptor;
+            beans.add(wbInt.getDelegate());
+        }
+        
+        logger.info("Validation of the interceptor's injection points are started");
+        
+        //Validate Interceptors
+        validate(beans);
+        
+        beans.clear();
+        
+        //Validate Others
+        validate(beans);
+                
 
+        logger.info("All injection points are validated succesfully");
+    }
+    
+
+    private void validate(Set<Bean<?>> beans)
+    {
+        InjectionResolver resolver = ManagerImpl.getManager().getInjectionResolver();
+        
         if (beans != null && beans.size() > 0)
         {
             for (Bean<?> bean : beans)
             {
+                //Bean injection points
                 Set<InjectionPoint> injectionPoints = bean.getInjectionPoints();
+                                
                 for (InjectionPoint injectionPoint : injectionPoints)
                 {
-                    Type type = injectionPoint.getType();
-                    Class<?> rawType = null;
+                    //Check for correct injection type
+                    resolver.checkInjectionPointType(injectionPoint);
                     
-                    if(type instanceof Class)
-                    {
-                        rawType = (Class<?>) type;
-                    }
-                    else
-                    {
-                        ParameterizedType pt = (ParameterizedType)type;
-                        rawType = (Class<?>)pt.getRawType();
-                    }
+                    Class<?> rawType = 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;
+                        continue;
                     }
                     /////////////////////////////////////////////////////////////////
                     
@@ -211,8 +250,31 @@
                 }
             }
         }
-
-        logger.info("Injection points are validated succesfully");
+        
+    }
+    
+    /**
+     * Returns injection point raw type.
+     * 
+     * @param injectionPoint injection point definition
+     * @return injection point raw type
+     */
+    private Class<?> getRawTypeForInjectionPoint(InjectionPoint injectionPoint)
+    {
+        Class<?> rawType = null;
+        Type type = injectionPoint.getType();
+        
+        if(type instanceof Class)
+        {
+            rawType = (Class<?>) type;
+        }
+        else if(type instanceof ParameterizedType)
+        {
+            ParameterizedType pt = (ParameterizedType)type;            
+            rawType = (Class<?>)pt.getRawType();                                                
+        }
+        
+        return rawType;
     }
 
     protected void deployFromClassPath(MetaDataDiscoveryService scanner) throws ClassNotFoundException
@@ -233,7 +295,7 @@
                 Class<?> implClass = ClassUtil.getClassFromName(componentClassName);
 
                 //It must not be @Interceptor or @Decorator
-                if(AnnotationUtil.isAnnotationExistOnClass(implClass, Decorator.class) ||
+                if(AnnotationUtil.isAnnotationExistOnClass(implClass, javax.decorator.Decorator.class) ||
                         AnnotationUtil.isAnnotationExistOnClass(implClass, Interceptor.class))
                 {
                     continue;
@@ -325,7 +387,7 @@
         logger.info("Configuring the Decorators is started");
 
         Map<String, Set<String>> annotIndex = scanner.getAnnotationIndex();
-        Set<String> classes = annotIndex.get(Decorator.class.getName());
+        Set<String> classes = annotIndex.get(javax.decorator.Decorator.class.getName());
 
         if (classes != null)
         {
@@ -490,7 +552,7 @@
         StereoTypeModel model = new StereoTypeModel(Model.class);
         StereoTypeManager.getInstance().addStereoTypeModel(model);
         
-        model = new StereoTypeModel(Decorator.class);
+        model = new StereoTypeModel(javax.decorator.Decorator.class);
         StereoTypeManager.getInstance().addStereoTypeModel(model);
         
         model = new StereoTypeModel(Interceptor.class);
@@ -501,7 +563,7 @@
     {
         ComponentImpl<T> component = null;
 
-        if (!AnnotationUtil.isAnnotationExistOnClass(clazz, Interceptor.class) && !AnnotationUtil.isAnnotationExistOnClass(clazz, Decorator.class))
+        if (!AnnotationUtil.isAnnotationExistOnClass(clazz, Interceptor.class) && !AnnotationUtil.isAnnotationExistOnClass(clazz, javax.decorator.Decorator.class))
         {
             component = SimpleWebBeansConfigurator.define(clazz, WebBeansType.SIMPLE);
             if (component != null)

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/AbstractBeanInheritedMetaData.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/AbstractBeanInheritedMetaData.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/AbstractBeanInheritedMetaData.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/inheritance/AbstractBeanInheritedMetaData.java Mon May 11 23:57:34 2009
@@ -37,14 +37,24 @@
     /**Inherited binding types*/
     protected Set<Annotation> inheritedBindingTypes = new HashSet<Annotation>();
     
+    /**Inherited stereotypes*/
     protected Set<Annotation> inheritedStereoTypes = new HashSet<Annotation>();
     
+    /**Inherited interceptor binding types*/
     protected Set<Annotation> inheritedInterceptorBindingTypes = new HashSet<Annotation>();
     
+    /**Inherited scope type*/
     protected Annotation inheritedScopeType = null;
     
+    /**Inherited deployment type*/
     protected Annotation inheritedDeploymentType = null;
     
+    /**
+     * Create a new bean inherited data.
+     * 
+     * @param component webbeans component
+     * @param inheritedClazz inherited class
+     */
     protected AbstractBeanInheritedMetaData(AbstractComponent<T> component, Class<?> inheritedClazz)
     {
         this.component = component;

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=773733&r1=773732&r2=773733&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 Mon May 11 23:57:34 2009
@@ -55,7 +55,47 @@
         
         return instance;
     }
+    
+    /**
+     * Check the type of the injection point.
+     * <p>
+     * Injection point type can not be wildcard or type variable type.
+     * </p>
+     * 
+     * @param injectionPoint injection point
+     * @throws WebBeansConfigurationException if not obey the rule
+     */
+    public void checkInjectionPointType(InjectionPoint injectionPoint)
+    {
+        Type type = injectionPoint.getType();
+        
+        if(type instanceof Class)
+        {
+            return;
+        }
+        else if(type instanceof ParameterizedType)
+        {
+            ParameterizedType pt = (ParameterizedType)type;
+            
+            if(!ClassUtil.checkParametrizedType(pt))
+            {
+                throw new WebBeansConfigurationException("Injection point type : " + injectionPoint + " can not contain generic definitions!");
+            }                                                                                    
+        }
+        else
+        {
+            throw new WebBeansConfigurationException("Injection point type : " + injectionPoint + " can not contain generic definitions!");
+        }
+        
+    }
 
+    /**
+     * Check that bean exist in the deployment for given
+     * injection point definition.
+     * 
+     * @param injectionPoint injection point
+     * @throws If bean is not avialable in the current deployment for given injection
+     */
     public void checkInjectionPoints(InjectionPoint injectionPoint)
     {
         Type type = injectionPoint.getType();
@@ -87,7 +127,7 @@
         
         Set<Bean<Object>> beanSet = implResolveByType(clazz, args ,bindingTypes);
         
-        ResolutionUtil.checkResolvedBeans(beanSet, clazz);
+        ResolutionUtil.checkResolvedBeans(beanSet, clazz, bindingTypes);
         
         Bean<Object> bean = beanSet.iterator().next();
         

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java Mon May 11 23:57:34 2009
@@ -261,7 +261,7 @@
     
     public void fireEvent(Object event, Annotation... bindings)
     {
-        if (ClassUtil.isParametrized(event.getClass()))
+        if (ClassUtil.isDefinitionConstainsTypeVariables(event.getClass()))
         {
             throw new IllegalArgumentException("Event class : " + event.getClass().getName() + " can not be defined as generic type");
         }
@@ -418,6 +418,8 @@
                 dependentContext = true;
             }            
 
+            CreationalContext<T> creationalContext = CreationalContextFactory.getInstance().getCreationalContext(bean);
+            
             /* @ScopeType is normal */
             if (WebBeansUtil.isScopeTypeNormal(bean.getScopeType()))
             {
@@ -428,15 +430,18 @@
                 else
                 {
                     instance = (T) JavassistProxyFactory.createNewProxyInstance(bean);
-
                     this.proxyMap.put(bean, instance);
                 }
+                
+                //Push proxy instance into the creational context
+                creationalContext.push(instance);
+                
             }
             /* @ScopeType is not normal */
             else
             {
                 context = getContext(bean.getScopeType());
-                instance = (T)context.get(bean, CreationalContextFactory.getInstance().getCreationalContext(bean));
+                instance = (T)context.get(bean, creationalContext);                                
             }
 
         }

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=773733&r1=773732&r2=773733&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 Mon May 11 23:57:34 2009
@@ -50,11 +50,28 @@
         AnnotationUtil.checkBindingTypeConditions(bindingTypes);
     }
 
-    public static <T> void checkResolvedBeans(Set<Bean<T>> resolvedSet, Class<?> type)
+    public static <T> void checkResolvedBeans(Set<Bean<T>> resolvedSet, Class<?> type, Annotation...bindingTypes)
     {
         if (resolvedSet.isEmpty())
         {
-            throw new UnsatisfiedDependencyException("Api type : " + type.getName() + " is not found");
+            StringBuffer message = new StringBuffer("Api type [" + type.getName() + "] is not found with the binding types [");
+            
+            int i = 0;
+            for(Annotation annot : bindingTypes)
+            {
+                i++;
+                
+                message.append(annot);
+                
+                if(i != bindingTypes.length)
+                {
+                    message.append(",");   
+                }
+            }
+            
+            message.append("]");
+            
+            throw new UnsatisfiedDependencyException(message.toString());
         }
 
         if (resolvedSet.size() > 1)

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/CreationalContextImpl.java Mon May 11 23:57:34 2009
@@ -37,6 +37,7 @@
     protected CreationalContextImpl<T> getCreationalContextImpl(Bean<T> incompleteBean)
     {
         CreationalContextImpl<T> impl = new CreationalContextImpl<T>();        
+        
         impl.incompleteBean = incompleteBean;
         impl.incompleteInstancesMap = this.incompleteInstancesMap;
         

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java Mon May 11 23:57:34 2009
@@ -47,7 +47,7 @@
     {
         Asserts.assertNotNull(eventType, "eventType parameter can not be null");
 
-        if (ClassUtil.isParametrized(eventType))
+        if (ClassUtil.isDefinitionConstainsTypeVariables(eventType))
         {
             throw new IllegalArgumentException("Event type : " + eventType.getName() + " can not be generic");
         }
@@ -192,7 +192,7 @@
             eventType = (Class<?>) type;
         }
 
-        if (ClassUtil.isParametrized(eventType))
+        if (ClassUtil.isDefinitionConstainsTypeVariables(eventType))
         {
             throw new WebBeansConfigurationException("Observer method : " + candidateObserverMethod.getName() + " in class : " + clazz.getName() + " can not defined as generic");
         }
@@ -231,7 +231,7 @@
                             throw new WebBeansConfigurationException("@Observable field injection " + injectionPoint.toString() + " actual type argument can not be Parametrized, Wildcard type or Type variable");                            
                         }
                                                 
-                        if(ClassUtil.isParametrized((Class<?>)actualArgument))
+                        if(ClassUtil.isDefinitionConstainsTypeVariables((Class<?>)actualArgument))
                         {
                             throw new WebBeansConfigurationException("@Observable field injection " + injectionPoint.toString() + " must not have TypeVariable or WildCard generic type argument");                            
                         }

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=773733&r1=773732&r2=773733&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 Mon May 11 23:57:34 2009
@@ -74,7 +74,10 @@
         
         if(type.equals(InjectionPoint.class))
         {
-            return null;
+            //Try to inject dependent owner injection point
+            //If this injection owner is dependent object then its
+            //dependentOwnerInjectionPoint can not be null.
+            return injectDependentOwnerInjectionPoint();
         }
         
         if(!ContextFactory.checkDependentContextActive())
@@ -94,8 +97,11 @@
             {
                 return injectForObservable(args, annotations);
             }
-                        
+            
+            //Find injection point for injecting instance
             InjectionPoint injectionPoint = InjectionPointFactory.getPartialInjectionPoint(this.injectionOwnerComponent, type, this.injectionMember, this.injectionAnnotations, annotations);                        
+            
+            //Get injection point Bean component
             Bean<?> component = InjectionResolver.getInstance().getInjectionPointBean(injectionPoint);
             
 
@@ -126,6 +132,25 @@
         }
 
     }
+    
+    /**
+     * TODO Not Sure to correct!
+     * Specification 5.6.1 is not explicit! 
+     *
+     * @return the injection point of the dependent owner
+     */
+    protected Object injectDependentOwnerInjectionPoint()
+    {
+        AbstractComponent<?> 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

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/xml/XMLInjectionPointModel.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/xml/XMLInjectionPointModel.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/xml/XMLInjectionPointModel.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/xml/XMLInjectionPointModel.java Mon May 11 23:57:34 2009
@@ -85,7 +85,7 @@
             this.actualTypeArguments = actualTypeArguments;
         }
 
-        if (ClassUtil.isParametrized(this.injectionClassType))
+        if (ClassUtil.isDefinitionConstainsTypeVariables(this.injectionClassType))
         {
             this.parametrized = true;
         }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataComparator.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataComparator.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataComparator.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataComparator.java Mon May 11 23:57:34 2009
@@ -16,8 +16,17 @@
 import java.io.Serializable;
 import java.util.Comparator;
 
+import javax.inject.manager.Manager;
+
 import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
 
+/**
+ * Uses {@link InterceptorComparator}.
+ * 
+ * @see InterceptorComparator
+ * @see Manager#resolveInterceptors(javax.inject.manager.InterceptionType, java.lang.annotation.Annotation...)
+ */
+@Deprecated
 public class InterceptorDataComparator implements Comparator<InterceptorData>, Serializable
 {
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java Mon May 11 23:57:34 2009
@@ -16,7 +16,6 @@
 import java.io.Serializable;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
@@ -48,6 +47,8 @@
     private transient Method calledMethod = null;
 
     private transient boolean isSameDecMethod = false;
+    
+    private transient boolean isInDecoratorCall = false;
 
     public InterceptorHandler(AbstractComponent<?> component)
     {
@@ -58,38 +59,32 @@
     public Object invoke(Object instance, Method method, Method proceed, Object[] arguments) throws Exception
     {
         Context webbeansContext = ManagerImpl.getManager().getContext(component.getScopeType());
+        
         Object webbeansInstance = webbeansContext.get((Contextual<Object>)this.component, (CreationalContext<Object>)CreationalContextFactory.getInstance().getCreationalContext(this.component));
 
         if (!ClassUtil.isObjectMethod(method.getName()) && InterceptorUtil.isWebBeansBusinessMethod(method))
         {
-            if (this.calledMethod == null)
-            {
-                this.calledMethod = method;
-            }
-            else if (this.calledMethod.equals(method))
-            {
-                this.isSameDecMethod = true;
-            }
-            else
-            {
-                this.calledMethod = method;
-                this.isSameDecMethod = false;
-            }
+            checkDecoratorStackForSameDecorator(method);
 
             // Run around invoke chain
             List<InterceptorData> stack = component.getInterceptorStack();
 
-            Collections.sort(stack, new InterceptorDataComparator());
-
+            //EJB specific interceptor stack
             filterEJBInterceptorStackList(stack, method);
+            
+            //WebBeans specific interceptor stack
             filterWebBeansInterceptorStackList(stack, method);
 
+            //Call Around Invokes
             if (WebBeansUtil.isContainsInterceptorMethod(stack, InterceptorType.AROUND_INVOKE))
             {
-                callAroundInvokes(instance, proceed, arguments, WebBeansUtil.getInterceptorMethods(stack, InterceptorType.AROUND_INVOKE));
+                callAroundInvokes(method, arguments, WebBeansUtil.getInterceptorMethods(stack, InterceptorType.AROUND_INVOKE));
             }
 
+            //Gets component decorator stack
             List<Object> decorators = component.getDecoratorStack();
+            
+            //Call decarators
             callDecorators(decorators, method, arguments);
 
         }
@@ -101,14 +96,47 @@
 
         return method.invoke(webbeansInstance, arguments);
     }
+    
+    private void checkDecoratorStackForSameDecorator(Method method)
+    {
+        if(this.isInDecoratorCall)
+        {
+            if (this.calledMethod == null)
+            {
+                this.calledMethod = method;
+            }
+            
+            else if (this.calledMethod.equals(method))
+            {
+                this.isSameDecMethod = true;
+            }
+            
+            else
+            {
+                this.calledMethod = method;
+                this.isSameDecMethod = false;
+            }            
+        }
+        else
+        {
+            this.calledMethod = null;
+        }
+    }
 
     private void callDecorators(List<Object> decorators, Method method, Object[] arguments)
     {
 
         Iterator<Object> itDec = decorators.iterator();
+        
         while (itDec.hasNext())
         {
+            if(!this.isInDecoratorCall)
+            {
+                this.isInDecoratorCall = true;
+            }
+            
             Object decorator = itDec.next();
+            
             try
             {
                 Method decMethod = decorator.getClass().getMethod(method.getName(), method.getParameterTypes());
@@ -147,13 +175,17 @@
                 logger.error("Method illegal access for method " + method.getName() + " for  decorator class : " + decorator.getClass().getName());
                 throw new WebBeansException(e);
             }
+            finally
+            {
+                this.isInDecoratorCall = false;
+            }
 
         }
     }
 
-    private <T> void callAroundInvokes(Object instance, Method proceed, Object[] arguments, List<InterceptorData> stack) throws Exception
+    private <T> void callAroundInvokes(Method proceed, Object[] arguments, List<InterceptorData> stack) throws Exception
     {
-        InvocationContextImpl impl = new InvocationContextImpl(instance, proceed, arguments, stack, InterceptorType.AROUND_INVOKE);
+        InvocationContextImpl impl = new InvocationContextImpl(this.component, null,proceed, arguments, stack, InterceptorType.AROUND_INVOKE);
 
         impl.proceed();
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java Mon May 11 23:57:34 2009
@@ -19,8 +19,15 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.context.Context;
+import javax.context.Contextual;
+import javax.context.CreationalContext;
+import javax.inject.manager.Bean;
 import javax.interceptor.InvocationContext;
 
+import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.context.creational.CreationalContextFactory;
+
 /**
  * Implementation of the {@link InvocationContext} interface.
  * 
@@ -49,7 +56,8 @@
 
     /** Used for numbering interceptors */
     private int currentMethod = 1;
-
+    
+    
     /**
      * Initializes the context.
      * 
@@ -59,16 +67,33 @@
      * @param datas interceptor stack
      * @param type interceptor type
      */
-    public InvocationContextImpl(Object target, Method method, Object[] parameters, List<InterceptorData> datas, InterceptorType type)
+    public InvocationContextImpl(Bean<?> bean, Object instance, Method method, Object[] parameters, List<InterceptorData> datas, InterceptorType type)
     {
-        this.target = target;
         this.method = method;
         this.parameters = parameters;
         this.interceptorDatas = datas;
         this.type = type;
-
+        
+        if(instance == null)
+        {
+            configureTarget(bean);    
+        }
+        else
+        {
+            this.target = instance;
+        }
     }
 
+    
+    @SuppressWarnings("unchecked")
+    private void configureTarget(Bean<?> bean)
+    {
+        Context webbeansContext = ManagerImpl.getManager().getContext(bean.getScopeType());
+        
+        this.target = webbeansContext.get((Contextual<Object>)bean, (CreationalContext<Object>)CreationalContextFactory.getInstance().getCreationalContext(bean));        
+        
+    }
+    
     /*
      * (non-Javadoc)
      * @see javax.interceptor.InvocationContext#getContextData()
@@ -150,12 +175,14 @@
             }
 
             Object t = intc.getInterceptorInstance();
+            
             if (t == null)
             {
                 t = target;
             }
 
             currentMethod++;
+            
             result = method.invoke(t, new Object[] { this });
         }
         else
@@ -198,6 +225,7 @@
             if (t == null)
             {
                 t = target;
+                
                 result = method.invoke(t, new Object[] {});
             }
             else

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java Mon May 11 23:57:34 2009
@@ -605,6 +605,13 @@
         return Package.getPackage(packageName);
     }
 
+    /**
+     * Returns true if type is an instance of <code>ParameterizedType</code>
+     * else otherwise.
+     * 
+     * @param type type of the artifact
+     * @return true if type is an instance of <code>ParameterizedType</code>
+     */
     public static boolean isParametrizedType(Type type)
     {
         Asserts.assertNotNull(type, "type parameter can not be null");
@@ -616,6 +623,13 @@
         return false;
     }
     
+    /**
+     * Returns true if type is an instance of <code>WildcardType</code>
+     * else otherwise.
+     * 
+     * @param type type of the artifact
+     * @return true if type is an instance of <code>WildcardType</code>
+     */    
     public static boolean isWildCardType(Type type)
     {
         Asserts.assertNotNull(type, "type parameter can not be null");
@@ -628,6 +642,14 @@
         return false;
     }
     
+    
+    /**
+     * Returns true if type is an instance of <code>TypeVariable</code>
+     * else otherwise.
+     * 
+     * @param type type of the artifact
+     * @return true if type is an instance of <code>TypeVariable</code>
+     */    
     public static boolean isTypeVariable(Type type)
     {
         Asserts.assertNotNull(type, "type parameter can not be null");
@@ -642,6 +664,12 @@
     }
     
 
+    /**
+     * Returna true if the class is not abstract and interface.
+     *     
+     * @param clazz class type
+     * @return true if the class is not abstract and interface
+     */
     public static boolean isConcrete(Class<?> clazz)
     {
         Asserts.nullCheckForClass(clazz);
@@ -656,15 +684,31 @@
         return false;
     }
 
+    /**
+     * Returns class constructor array.
+     * 
+     * @param <T> class type arfument
+     * @param clazz class that is searched for constructor.
+     * @return class constructor array
+     */
     public static <T> Constructor<T>[] getConstructors(Class<T> clazz)
     {
         Asserts.nullCheckForClass(clazz);
+        
         return (Constructor<T>[]) clazz.getDeclaredConstructors();
     }
 
+    /**
+     * Returns true if class has a default constructor.
+     * 
+     * @param <T> type argument of class
+     * @param clazz class type
+     * @return true if class has a default constructor.
+     */
     public static <T> boolean isDefaultConstructorExist(Class<T> clazz)
     {
         Asserts.nullCheckForClass(clazz);
+        
         try
         {
             clazz.getDeclaredConstructor(new Class<?>[] {});
@@ -672,7 +716,7 @@
         }
         catch (SecurityException e)
         {
-            throw e;
+            throw new WebBeansException(e);
         }
         catch (NoSuchMethodException e)
         {
@@ -1104,9 +1148,10 @@
         }
     }
 
-    public static boolean isParametrized(Class<?> clazz)
+    public static boolean isDefinitionConstainsTypeVariables(Class<?> clazz)
     {
         Asserts.nullCheckForClass(clazz);
+        
         return (clazz.getTypeParameters().length > 0) ? true : false;
     }
 
@@ -1231,6 +1276,13 @@
 
     }
 
+    /**
+     * Return true if it does not contain type variable for wildcard type
+     * false otherwise.
+     * 
+     * @param pType parameterized type
+     * @return true if it does not contain type variable for wildcard type
+     */
     public static boolean checkParametrizedType(ParameterizedType pType)
     {
         Asserts.assertNotNull(pType, "pType argument can not be null");

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=773733&r1=773732&r2=773733&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 Mon May 11 23:57:34 2009
@@ -172,7 +172,7 @@
         Asserts.nullCheckForClass(clazz);
         int modifier = clazz.getModifiers();
 
-        if (ClassUtil.isParametrized(clazz))
+        if (ClassUtil.isDefinitionConstainsTypeVariables(clazz))
             throw new WebBeansConfigurationException("Web Beans component implementation class : " + clazz.getName() + " can not be parametrized type");
 
         if (!ClassUtil.isStatic(modifier) && ClassUtil.isInnerClazz(clazz))
@@ -238,7 +238,7 @@
             {
                 if (inAnnotation == true)// duplicate @In
                 {
-                    throw new WebBeansConfigurationException("There are more than one Constrcutor with Initializer annotation in class " + clazz.getName());
+                    throw new WebBeansConfigurationException("There are more than one Constructor with Initializer annotation in class " + clazz.getName());
                 }
                 else
                 {
@@ -538,6 +538,13 @@
         return comp;
     }
 
+    /**
+     * Returns a new managed bean from given bean.
+     * 
+     * @param <T> bean type parameter
+     * @param component managed bean
+     * @return the new bean from given managed bean
+     */
     public static <T> NewComponentImpl<T> createNewSimpleBeanComponent(ComponentImpl<T> component)
     {
         Asserts.assertNotNull(component, "component argument can not be null");
@@ -1606,7 +1613,7 @@
                             throw new WebBeansConfigurationException("@Obtains field injection " + injectionPoint.toString() + " actual type argument can not be Parametrized, Wildcard type or Type variable");                            
                         }
                                                 
-                        if(ClassUtil.isParametrized((Class<?>)actualArgument))
+                        if(ClassUtil.isDefinitionConstainsTypeVariables((Class<?>)actualArgument))
                         {
                             throw new WebBeansConfigurationException("@Obtains field injection " + injectionPoint.toString() + " must not have TypeVariable or WildCard generic type argument");                            
                         }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java Mon May 11 23:57:34 2009
@@ -86,7 +86,7 @@
 
         int modifier = clazz.getModifiers();
 
-        if (ClassUtil.isParametrized(clazz))
+        if (ClassUtil.isDefinitionConstainsTypeVariables(clazz))
         {
             throw new WebBeansConfigurationException(errorMessage + "Simple WebBeans component implementation class : " + clazz.getName() + " can not be parametrized type");
         }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/InjectedTypeLiteralComponent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/InjectedTypeLiteralComponent.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/InjectedTypeLiteralComponent.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/component/InjectedTypeLiteralComponent.java Mon May 11 23:57:34 2009
@@ -1,15 +1,12 @@
 /*
- * 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.
+ * 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.test.component;
 
@@ -25,6 +22,8 @@
 {
     private @Current
     ITypeLiteralComponent<List<String>> component;
+    
+    private @Current ITypeLiteralComponent eraseComponent;
 
     public InjectedTypeLiteralComponent()
     {
@@ -47,4 +46,20 @@
         this.component = component;
     }
 
+    /**
+     * @return the eraseComponent
+     */
+    public ITypeLiteralComponent getEraseComponent()
+    {
+        return eraseComponent;
+    }
+
+    /**
+     * @param eraseComponent the eraseComponent to set
+     */
+    public void setEraseComponent(ITypeLiteralComponent eraseComponent)
+    {
+        this.eraseComponent = eraseComponent;
+    }
+
 }

Added: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ClassTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ClassTest.java?rev=773733&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ClassTest.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ClassTest.java Mon May 11 23:57:34 2009
@@ -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.test.unittests.config;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.apache.webbeans.test.servlet.TestContext;
+import org.apache.webbeans.util.ClassUtil;
+import org.junit.Test;
+
+public class ClassTest extends TestContext
+{
+    public Map<String, ?> map = null;
+    
+    public ClassTest()
+    {
+        super(ClassTest.class.getName());
+    }
+
+    @Test
+    public void testTypeVariableTest()
+    {
+        boolean result = ClassUtil.isDefinitionConstainsTypeVariables(Map.class);
+        
+        Assert.assertEquals(true, result);
+        
+    }
+    
+    @Test
+    public void testCheckParameterizedType() throws Exception
+    {
+        
+        Field field = ClassTest.class.getField("map");
+        
+        Type type = field.getGenericType();
+        
+        if(type instanceof ParameterizedType)
+        {
+            boolean result = ClassUtil.checkParametrizedType((ParameterizedType)type);
+            
+            Assert.assertFalse(result);
+        }
+        
+        
+    }
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/config/ClassTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java?rev=773733&r1=773732&r2=773733&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/typedliteral/TypedLiteralComponentTest.java Mon May 11 23:57:34 2009
@@ -66,6 +66,8 @@
         Assert.assertNotNull(userComponent);
 
         Assert.assertTrue(tc.getComponent() instanceof TypeLiteralComponent);
+        
+        Assert.assertNotNull(tc.getEraseComponent());
 
         Assert.assertEquals("GURKAN", TypeLiteralComponent.STR);
 



Mime
View raw message