openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r909647 [1/2] - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/ main/java/org/apache/webbeans/component/creation/ main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/container/ main/java/or...
Date Fri, 12 Feb 2010 23:00:57 GMT
Author: gerdogdu
Date: Fri Feb 12 23:00:52 2010
New Revision: 909647

URL: http://svn.apache.org/viewvc?rev=909647&view=rev
Log:
[OWB-274] interceptor and decorator don't read re-Annotated meta data

Added:
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/InterceptorExtension.java   (with props)
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/NotAnnotatedBean.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/AbstractInjectionTargetBean.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/ConversationBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.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/ContextFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/WrappedCreationalContext.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.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/decorator/xml/WebBeansXMLDecorator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansPassivationException.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.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/InterceptorUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/NormalScopedBeanInterceptorHandler.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.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/portable/creation/DefaultInjectionTargetImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/JavassistProxyFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleInterceptor.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/lifecycle/LifecycleTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/TestContext.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/exception/ExceptionComponentTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/intercept/EJBInterceptorExceptionComponentTest.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=909647&r1=909646&r2=909647&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 Fri Feb 12 23:00:52 2010
@@ -24,18 +24,15 @@
 
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.CreationException;
+import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.Decorator;
 import javax.enterprise.inject.spi.InjectionPoint;
 
-import org.apache.webbeans.config.inheritance.BeanInheritedMetaData;
-import org.apache.webbeans.config.inheritance.IBeanInheritedMetaData;
 import org.apache.webbeans.config.OWBLogConst;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.context.creational.CreationalContextFactory;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
 import org.apache.webbeans.inject.AlternativesManager;
-import org.apache.webbeans.intercept.InterceptorData;
 import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.util.ClassUtil;
 
@@ -82,15 +79,6 @@
     /**This bean is enabled or disabled*/
     protected boolean enabled = true;
     
-    /**
-     * Holds the all of the interceptor related data, contains around-invoke,
-     * post-construct and pre-destroy
-     */
-    protected List<InterceptorData> interceptorStack = new ArrayList<InterceptorData>();
-
-    /**Decorators*/
-    protected List<Decorator<?>> decorators = new ArrayList<Decorator<?>>();
-
     /** The bean is serializable or not */
     protected boolean serializable;
 
@@ -100,9 +88,10 @@
     /**Beans injection points*/
     protected Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
     
-    /**Bean inherited meta data*/
-    protected IBeanInheritedMetaData inheritedMetaData;
-        
+    /**Annotated type for bean*/
+    protected AnnotatedType<T> annotatedType;
+    
+            
     /**
      * Constructor definiton. Each subclass redefines its own constructor with
      * calling this.
@@ -132,22 +121,6 @@
     /**
      * {@inheritDoc}
      */
-    public IBeanInheritedMetaData getInheritedMetaData()
-    {
-        return this.inheritedMetaData;
-    }
-    
-    /**
-     * Sets inherited meta data.
-     */
-    protected void setInheritedMetaData()
-    {
-        this.inheritedMetaData = new BeanInheritedMetaData<T>(this);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
     @SuppressWarnings("unchecked")
     public T create(CreationalContext<T> creationalContext)
     {
@@ -423,15 +396,6 @@
     {
         return returnType;
     }
-
-    
-    /**
-     * {@inheritDoc}
-     */
-    public List<InterceptorData> getInterceptorStack()
-    {
-        return this.interceptorStack;
-    }
     
     /**
      * {@inheritDoc}
@@ -462,6 +426,17 @@
         return this.nullable;
     }
 
+    public void setAnnotatedType(AnnotatedType<T> annotatedType)
+    {
+        this.annotatedType = annotatedType;
+    }
+    
+    
+    public AnnotatedType<T> getAnnotatedType()
+    {
+        return this.annotatedType;
+    }
+    
     /**
      * {@inheritDoc}
      */
@@ -560,12 +535,7 @@
         return this.enabled;
     }
     
-    
-    public List<Decorator<?>> getDecorators()
-    {
-        return this.decorators;
-    }
-    
+        
     /**
      * {@inheritDoc}
      */    

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java Fri Feb 12 23:00:52 2010
@@ -15,21 +15,27 @@
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 import javax.decorator.Delegate;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.InjectionTarget;
 
 import org.apache.webbeans.annotation.DefaultLiteral;
 import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.inheritance.BeanInheritedMetaData;
+import org.apache.webbeans.config.inheritance.IBeanInheritedMetaData;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
 import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.inject.InjectableField;
 import org.apache.webbeans.inject.InjectableMethods;
+import org.apache.webbeans.intercept.InterceptorData;
 import org.apache.webbeans.intercept.InterceptorHandler;
 import org.apache.webbeans.intercept.InterceptorType;
 import org.apache.webbeans.intercept.InvocationContextImpl;
@@ -40,7 +46,7 @@
 import org.apache.webbeans.util.WebBeansUtil;
 
 /**
- * Abstract class for owning observer methods.
+ * Abstract class for injection target beans.
  * 
  * @version $Rev$ $Date$
  * @param <T> bean class
@@ -66,13 +72,26 @@
     private Set<Method> injectedFromSuperMethods = new HashSet<Method>();
     
     /**
+     * Holds the all of the interceptor related data, contains around-invoke,
+     * post-construct and pre-destroy
+     */
+    protected List<InterceptorData> interceptorStack = new ArrayList<InterceptorData>();
+
+    /**Decorators*/
+    protected List<Decorator<?>> decorators = new ArrayList<Decorator<?>>();
+    
+    /**Bean inherited meta data*/
+    protected IBeanInheritedMetaData inheritedMetaData;    
+    
+    
+    /**
      * InjectionTargt instance. If this is not null, it is used for creating
      * instance.
      * 
      * @see InjectionTarget
      */
     protected InjectionTarget<T> injectionTarget;
-
+    
     /**
      * Creates a new observer owner component.
      * 
@@ -164,7 +183,10 @@
      * @param creationalContext creational context
      * @return bean instance
      */
-    abstract protected T createComponentInstance(CreationalContext<T> creationalContext);
+    protected T createComponentInstance(CreationalContext<T> creationalContext)
+    {
+        return null;
+    }
 
     /**
      * Sub-classes must override this method to destroy bean instance.
@@ -493,8 +515,38 @@
     {
         this.injectionTarget = injectionTarget;
     }
+        
+    /**
+     * {@inheritDoc}
+     */
+    public List<InterceptorData> getInterceptorStack()
+    {
+        return this.interceptorStack;
+    }
+    
+    public List<Decorator<?>> getDecoratorStack()
+    {
+        return this.decorators;
+    }
 
     /**
+     * {@inheritDoc}
+     */
+    public IBeanInheritedMetaData getInheritedMetaData()
+    {
+        return this.inheritedMetaData;
+    }
+    
+    /**
+     * Sets inherited meta data.
+     */
+    public void setInheritedMetaData()
+    {
+        this.inheritedMetaData = new BeanInheritedMetaData<T>(this);
+    }
+    
+    
+    /**
      * Returns injection target.
      * 
      * @return injection target

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=909647&r1=909646&r2=909647&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 Fri Feb 12 23:00:52 2010
@@ -20,9 +20,6 @@
 
 import javax.enterprise.inject.spi.*;
 
-import org.apache.webbeans.config.inheritance.IBeanInheritedMetaData;
-import org.apache.webbeans.intercept.InterceptorData;
-
 /**
  * OWB specific extension of the {@link Bean} interface.
  * It is used internally. Do not use it. Instead use {@link AbstractBean}
@@ -55,14 +52,7 @@
     {
         return manager;
     }
-    
-    /**
-     * Returns bean's inherited meta data.
-     * 
-     * @return inherited meta data.
-     */
-    public abstract IBeanInheritedMetaData getInheritedMetaData();
-    
+        
     /**
      * Returns scope type annotation.
      * 
@@ -76,6 +66,19 @@
      * @param scopeType bean scope type annotation
      */
     public abstract void setImplScopeType(Annotation scopeType);
+    
+    /**
+     * Sets annotated type.
+     * @param annotatedType annotated type
+     */
+    public abstract void setAnnotatedType(AnnotatedType<T> annotatedType);    
+    
+    /**
+     * Gets annotated type.
+     * @return annotated type
+     */
+    public abstract AnnotatedType<T> getAnnotatedType();
+    
 
     /**
      * Returns bean type.
@@ -158,18 +161,6 @@
     public abstract Class<T> getReturnType();
 
     /**
-     * Gets interceptor stack of bean instance.
-     * @return interceptor stack
-     */
-    public abstract List<InterceptorData> getInterceptorStack();
-
-    /**
-     * Gets decorator stack of bean instance.
-     * @return decorator stack
-     */
-    public abstract List<Decorator<?>> getDecorators();
-
-    /**
      * Sets serializable flag.
      * @param serializable flag
      */

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ConversationBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ConversationBean.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ConversationBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ConversationBean.java Fri Feb 12 23:00:52 2010
@@ -26,7 +26,7 @@
  * @version $Rev$ $Date$
  *
  */
-public class ConversationBean extends AbstractBean<Conversation>
+public class ConversationBean extends AbstractInjectionTargetBean<Conversation>
 {
     /**
      * Default constructor.

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java Fri Feb 12 23:00:52 2010
@@ -41,6 +41,7 @@
      * @param eventType event type
      * @param definedType webbeans type
      */
+    @SuppressWarnings("serial")
     public EventBean()
     {
         super(WebBeansType.OBSERVABLE,new TypeLiteral<Event<T>>(){}.getRawType());

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java Fri Feb 12 23:00:52 2010
@@ -13,14 +13,20 @@
  */
 package org.apache.webbeans.component;
 
+import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.util.List;
 import java.util.Set;
 
 import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.apache.webbeans.config.inheritance.IBeanInheritedMetaData;
+import org.apache.webbeans.intercept.InterceptorData;
 
 /**
- * Defines contract for beans that coud have observable
- * method.
+ * Defines contract for injection target beans.
  * 
  * @version $Rev$ $Date$
  *
@@ -81,8 +87,44 @@
      * @param creationalContext creational context
      */
     public void injectSuperMethods(T instance, CreationalContext<T> creationalContext);
+        
+    public void setInjectionTarget(InjectionTarget<T> injectionTarget);
+    
+    public InjectionTarget<T> getInjectionTarget();
+    
+    public Set<Field> getInjectedFields();
+
+    public void addInjectedField(Field field);
+    
+    public Set<Field> getInjectedFromSuperFields();
+
+    public void addInjectedFieldToSuper(Field field);    
+
+    public Set<Method> getInjectedMethods();
+
+    public void addInjectedMethod(Method method);
+
+    public Set<Method> getInjectedFromSuperMethods();
 
+    public void addInjectedMethodToSuper(Method method);
     
+    public IBeanInheritedMetaData getInheritedMetaData();
+    
+    public void setInheritedMetaData();
+    
+    
+    /**
+     * Gets interceptor stack of bean instance.
+     * @return interceptor stack
+     */
+    public List<InterceptorData> getInterceptorStack();
+    
+    /**
+     * Gets decorator stack of bean instance.
+     * @return decorator stack
+     */
+    public List<Decorator<?>> getDecoratorStack();
+
     /**
      * Calls post constrcut method.
      * 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java Fri Feb 12 23:00:52 2010
@@ -30,6 +30,7 @@
 {
     public static ThreadLocal<InjectionPoint> local = new ThreadLocal<InjectionPoint>();
     
+    @SuppressWarnings("serial")
     public InstanceBean()
     {
         super(WebBeansType.INSTANCE, new TypeLiteral<Instance<T>>(){}.getRawType());        

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java Fri Feb 12 23:00:52 2010
@@ -19,8 +19,6 @@
 package org.apache.webbeans.component.creation;
 
 import org.apache.webbeans.component.ManagedBean;
-import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
-import org.apache.webbeans.util.WebBeansUtil;
 
 public class AnnotatedTypeBeanCreatorImpl<T> extends ManagedBeanCreatorImpl<T>
 {
@@ -30,19 +28,4 @@
         super(managedBean);
         setMetaDataProvider(MetaDataProvider.THIRDPARTY);
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.webbeans.component.creation.ManagedBeanCreatorImpl#checkCreateConditions()
-     */
-    @Override
-    public void checkCreateConditions()
-    {
-        WebBeansAnnotatedTypeUtil.checkManagedBeanCondition(getAnnotatedType());
-        WebBeansUtil.checkGenericType(getBean());
-        //Check Unproxiable
-        WebBeansUtil.checkUnproxiableApiType(getBean(), getBean().getScope());                    
-    }
-    
-    
-
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreator.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreator.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreator.java Fri Feb 12 23:00:52 2010
@@ -28,9 +28,5 @@
      * Define managed bean constructor.
      */
     public void defineConstructor();
-    
-    public void defineInterceptorStack();    
-    
-    public void defineDecoratorStack();    
-    
+        
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java Fri Feb 12 23:00:52 2010
@@ -18,10 +18,8 @@
 import javax.enterprise.inject.spi.AnnotatedConstructor;
 
 import org.apache.webbeans.component.ManagedBean;
-import org.apache.webbeans.component.WebBeansType;
 import org.apache.webbeans.config.DefinitionUtil;
 import org.apache.webbeans.config.ManagedBeanConfigurator;
-import org.apache.webbeans.decorator.WebBeansDecoratorConfig;
 import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 
@@ -52,10 +50,18 @@
     @Override
     public void checkCreateConditions()
     {
-        ManagedBeanConfigurator.checkManagedBeanCondition(getBean().getReturnType());
+        if(isDefaultMetaDataProvider())
+        {
+            ManagedBeanConfigurator.checkManagedBeanCondition(getBean().getReturnType());                        
+        }
+        else
+        {
+            WebBeansAnnotatedTypeUtil.checkManagedBeanCondition(getAnnotatedType());
+        }
+        
         WebBeansUtil.checkGenericType(getBean());
         //Check Unproxiable
-        WebBeansUtil.checkUnproxiableApiType(getBean(), getBean().getScope());                    
+        WebBeansUtil.checkUnproxiableApiType(getBean(), getBean().getScope());                                
     }
 
 
@@ -90,23 +96,4 @@
         return (ManagedBean<T>)super.getBean();
     }
 
-
-    @Override
-    public void defineDecoratorStack()
-    {
-        if(getBean().getWebBeansType().equals(WebBeansType.MANAGED))
-        {
-            WebBeansDecoratorConfig.configureDecarotors(getBean());   
-        }
-    }
-
-
-    @Override
-    public void defineInterceptorStack()
-    {
-        if(getBean().getWebBeansType().equals(WebBeansType.MANAGED))
-        {
-            DefinitionUtil.defineBeanInterceptorStack(getBean());            
-        }                
-    }
 }
\ No newline at end of file

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java Fri Feb 12 23:00:52 2010
@@ -17,41 +17,35 @@
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
 import java.net.URL;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.Set;
 
 import javax.enterprise.context.NormalScope;
 import javax.enterprise.inject.Model;
 import javax.enterprise.inject.Specializes;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedMethod;
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.Decorator;
 import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.ObserverMethod;
-import javax.enterprise.inject.spi.Producer;
 import javax.interceptor.Interceptor;
 
 import org.apache.webbeans.WebBeansConstants;
 import org.apache.webbeans.component.AbstractBean;
+import org.apache.webbeans.component.AbstractInjectionTargetBean;
+import org.apache.webbeans.component.EnterpriseBeanMarker;
 import org.apache.webbeans.component.ManagedBean;
-import org.apache.webbeans.component.ProducerFieldBean;
-import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.component.NewBean;
 import org.apache.webbeans.component.WebBeansType;
 import org.apache.webbeans.component.creation.ManagedBeanCreatorImpl;
 import org.apache.webbeans.component.creation.BeanCreator.MetaDataProvider;
 import org.apache.webbeans.config.OWBLogConst;
 import org.apache.webbeans.container.BeanManagerImpl;
-import org.apache.webbeans.decorator.DecoratorUtil;
 import org.apache.webbeans.decorator.WebBeansDecorator;
+import org.apache.webbeans.decorator.WebBeansDecoratorConfig;
 import org.apache.webbeans.deployment.StereoTypeManager;
 import org.apache.webbeans.deployment.StereoTypeModel;
-import org.apache.webbeans.event.ObserverMethodImpl;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.exception.WebBeansDeploymentException;
 import org.apache.webbeans.exception.inject.InconsistentSpecializationException;
@@ -60,17 +54,14 @@
 import org.apache.webbeans.portable.AnnotatedElementFactory;
 import org.apache.webbeans.portable.events.ExtensionLoader;
 import org.apache.webbeans.portable.events.ProcessAnnotatedTypeImpl;
-import org.apache.webbeans.portable.events.ProcessBeanImpl;
-import org.apache.webbeans.portable.events.ProcessInjectionTargetImpl;
-import org.apache.webbeans.portable.events.ProcessProducerImpl;
 import org.apache.webbeans.portable.events.discovery.AfterBeanDiscoveryImpl;
 import org.apache.webbeans.portable.events.discovery.AfterDeploymentValidationImpl;
 import org.apache.webbeans.portable.events.discovery.BeforeBeanDiscoveryImpl;
-import org.apache.webbeans.portable.events.generics.GProcessManagedBean;
 import org.apache.webbeans.spi.JNDIService;
 import org.apache.webbeans.spi.ScannerService;
 import org.apache.webbeans.spi.ServiceLoader;
 import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 import org.apache.webbeans.xml.WebBeansXMLConfigurator;
 import org.apache.webbeans.xml.XMLAnnotationTypeManager;
@@ -141,12 +132,6 @@
                 //Checking stereotype conditions
                 checkStereoTypes(scanner);
                 
-                //Configure Interceptors
-                configureInterceptors(scanner);
-                
-                //Configure Decorators
-                configureDecorators(scanner);
-                
                 //Configure Default Beans
                 configureDefaultBeans();
                                 
@@ -189,6 +174,9 @@
         }
     }
     
+    /**
+     * Configure Default Beans.
+     */
     private void configureDefaultBeans()
     {
         BeanManagerImpl beanManager = BeanManagerImpl.getManager();
@@ -252,7 +240,7 @@
         for(Decorator decorator : decorators)
         {
             WebBeansDecorator wbDec = (WebBeansDecorator)decorator;
-            beans.add(wbDec.getDelegateComponent());
+            beans.add(wbDec);
         }
         
         
@@ -268,7 +256,7 @@
         for(javax.enterprise.inject.spi.Interceptor interceptor : interceptors)
         {
             WebBeansInterceptor wbInt = (WebBeansInterceptor)interceptor;
-            beans.add(wbInt.getDelegate());
+            beans.add(wbInt);
         }
         
         logger.info(OWBLogConst.INFO_0015);
@@ -300,6 +288,15 @@
         {
             for (Bean<?> bean : beans)
             {
+                //Configure decorator and interceptor stack for ManagedBeans
+                if((bean instanceof AbstractInjectionTargetBean) && 
+                        !(bean instanceof NewBean) &&
+                        !(bean instanceof EnterpriseBeanMarker))
+                {
+                    WebBeansDecoratorConfig.configureDecarotors((AbstractInjectionTargetBean<Object>)bean);
+                    DefinitionUtil.defineBeanInterceptorStack((AbstractInjectionTargetBean<Object>)bean);
+                }
+                
                 //Bean injection points
                 Set<InjectionPoint> injectionPoints = bean.getInjectionPoints();
                                 
@@ -342,16 +339,8 @@
         {
             for(Class<?> implClass : classIndex)
             {
-                //It must not be @Interceptor or @Decorator
-                if(AnnotationUtil.hasClassAnnotation(implClass, javax.decorator.Decorator.class) ||
-                        AnnotationUtil.hasClassAnnotation(implClass, Interceptor.class))
-                {
-                    continue;
-                }
-                
                 if (ManagedBeanConfigurator.isManagedBean(implClass))
                 {
-                    logger.info(OWBLogConst.INFO_0018, new Object[]{implClass.getName()});
                     defineManagedBean(implClass);
                 }
                 else if(this.discoverEjb)
@@ -418,57 +407,11 @@
         logger.info(OWBLogConst.INFO_0022);
     }
     
-    /**
-     * Discovers and deploys interceptors.
-     * 
-     * @param scanner discovery scanner
-     * @throws ClassNotFoundException if class not found
-     */
-    protected void configureInterceptors(ScannerService scanner) throws ClassNotFoundException
-    {
-        logger.info(OWBLogConst.INFO_0023);
-
-        // Interceptors Set
-        Set<Class<?>> beanClasses = scanner.getBeanClasses();
-
-        for (Class<?> interceptorClazz : beanClasses)
-        {
-            if(AnnotationUtil.hasClassAnnotation(interceptorClazz, Interceptor.class))
-            {
-                logger.info(OWBLogConst.INFO_0024, new Object[]{interceptorClazz});
-                defineInterceptor(interceptorClazz);                
-            }
-        }
-
-        logger.info(OWBLogConst.INFO_0025);
-
-    }
 
     /**
-     * Discovers and deploys decorators.
-     * 
-     * @param scanner discovery scanner
-     * @throws ClassNotFoundException if class not found
+     * Checks specialization.
+     * @param scanner scanner instance
      */
-    protected void configureDecorators(ScannerService scanner) throws ClassNotFoundException
-    {
-        logger.info(OWBLogConst.INFO_0026);
-
-        Set<Class<?>> beanClasses = scanner.getBeanClasses();
-
-        for (Class<?> decoratorClazz : beanClasses)
-        {
-            if(AnnotationUtil.hasClassAnnotation(decoratorClazz, javax.decorator.Decorator.class))
-            {
-                logger.info(OWBLogConst.INFO_0027, new Object[]{decoratorClazz});
-                defineDecorator(decoratorClazz);                
-            }
-        }
-
-        logger.info(OWBLogConst.INFO_0028);
-
-    }
-
     protected void checkSpecializations(ScannerService scanner)
     {
         logger.info(OWBLogConst.INFO_0029);
@@ -518,7 +461,12 @@
         logger.info(OWBLogConst.INFO_0030);
     }
 
-    private void checkXMLSpecializations()
+    
+    /**
+     * Check xml specializations.
+     * NOTE : Currently XML is not used in configuration.
+     */
+    protected void checkXMLSpecializations()
     {
         // Check XML specializations
         Set<Class<?>> clazzes = XMLSpecializesManager.getInstance().getXMLSpecializationClasses();
@@ -547,6 +495,9 @@
         }
     }
 
+    /**
+     * Check passivations.
+     */
     protected void checkPassivationScopes()
     {
         Set<Bean<?>> beans = BeanManagerImpl.getManager().getBeans();
@@ -565,13 +516,7 @@
                     {
                         if (scope.passivating())
                         {
-                            // TODO  Check constructor
-
-                            // TODO Check non-transient fields
-
-                            // TODO Check initializer methods
-
-                            // TODO Check producer methods
+                            // TODO
                         }                        
                     }
                 }
@@ -579,6 +524,10 @@
         }
     }
 
+    /**
+     * Check steretypes.
+     * @param scanner scanner instance
+     */
     protected void checkStereoTypes(ScannerService scanner)
     {
         logger.info(OWBLogConst.INFO_0031);
@@ -609,6 +558,9 @@
         logger.info(OWBLogConst.INFO_0032);
     }
 
+    /**
+     * Adds default stereotypes.
+     */
     protected void addDefaultStereoTypes()
     {
         StereoTypeModel model = new StereoTypeModel(Model.class);
@@ -622,166 +574,68 @@
     }
     
     /**
-     * Defines and creates a new {@link ManagedBean}.
-     * 
-     * <p>
-     * It fires each event that is defined in the specification
-     * section 11.5, <b>Container Lifecycle Events</b>
-     * </p>
-     * 
-     * @param <T> bean class
-     * @param clazz managed bean class
+     * Defines and configures managed bean.
+     * @param <T> type info
+     * @param clazz bean class
      */
     protected <T> void defineManagedBean(Class<T> clazz)
     {
-        if (!AnnotationUtil.hasClassAnnotation(clazz, Interceptor.class) && !AnnotationUtil.hasClassAnnotation(clazz, javax.decorator.Decorator.class))
+        AnnotatedType<T> annotatedType = AnnotatedElementFactory.newAnnotatedType(clazz);
+        
+        //Fires ProcessAnnotatedType
+        ProcessAnnotatedTypeImpl<T> processAnnotatedEvent = WebBeansUtil.fireProcessAnnotatedTypeEvent(annotatedType);      
+        
+        ManagedBean<T> managedBean = new ManagedBean<T>(clazz,WebBeansType.MANAGED);                  
+        ManagedBeanCreatorImpl<T> managedBeanCreator = new ManagedBeanCreatorImpl<T>(managedBean);
+        
+        if(processAnnotatedEvent.isVeto())
         {
-
-            AnnotatedType<T> annotatedType = AnnotatedElementFactory.newAnnotatedType(clazz);
-            
-            //Fires ProcessAnnotatedType
-            ProcessAnnotatedTypeImpl<T> processAnnotatedEvent = WebBeansUtil.fireProcessAnnotatedTypeEvent(annotatedType);      
-            
-            ManagedBean<T> managedBean = new ManagedBean<T>(clazz,WebBeansType.MANAGED);                  
-            ManagedBeanCreatorImpl<T> managedBeanCreator = new ManagedBeanCreatorImpl<T>(managedBean);
-            
-            if(processAnnotatedEvent.isVeto())
-            {
-                return;
-            }
-            
-            if(processAnnotatedEvent.isSet())
-            {
-                managedBeanCreator.setAnnotatedType(processAnnotatedEvent.getAnnotatedType());
-                managedBeanCreator.setMetaDataProvider(MetaDataProvider.THIRDPARTY);
-            }
-            
-            managedBeanCreator.defineSerializable();
-
-            //Define meta-data
-            managedBeanCreator.defineStereoTypes();
-            //Scope type
-            managedBeanCreator.defineScopeType(logger.getTokenString(OWBLogConst.TEXT_MB_IMPL) + clazz.getName() + logger.getTokenString(OWBLogConst.TEXT_SAME_SCOPE));                                                            
-            //Check for Enabled via Alternative
-            WebBeansUtil.setInjectionTargetBeanEnableFlag(managedBean);
-            
-            managedBeanCreator.defineApiType();                        
-            managedBeanCreator.checkCreateConditions();
-            managedBeanCreator.defineQualifier();
-            managedBeanCreator.defineName(WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
-            managedBeanCreator.defineConstructor();            
-            Set<ProducerMethodBean<?>> producerMethods = managedBeanCreator.defineProducerMethods();       
-            Set<ProducerFieldBean<?>> producerFields = managedBeanCreator.defineProducerFields();           
-            managedBeanCreator.defineInjectedFields();
-            managedBeanCreator.defineInjectedMethods();
-            managedBeanCreator.defineDecoratorStack();
-            managedBeanCreator.defineInterceptorStack();
-            
-            Set<ObserverMethod<?>> observerMethods = new HashSet<ObserverMethod<?>>();
-            if(managedBean.isEnabled())
-            {
-                observerMethods = managedBeanCreator.defineObserverMethods();
-            }
-                                    
-            //Fires ProcessInjectionTarget
-            ProcessInjectionTargetImpl<T> processInjectionTargetEvent = WebBeansUtil.fireProcessInjectionTargetEvent(managedBean);    
-            WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessInjectionTarget event observers. Look at logs for further details");
-            
-            if(processInjectionTargetEvent.isSet())
-            {
-                managedBeanCreator.setInjectedTarget(processInjectionTargetEvent.getInjectionTarget());
-            }
-            
-            Map<ProducerMethodBean<?>,AnnotatedMethod<?>> annotatedMethods = new HashMap<ProducerMethodBean<?>, AnnotatedMethod<?>>(); 
-            for(ProducerMethodBean<?> producerMethod : producerMethods)
+            return;
+        }
+        
+        boolean annotationTypeSet = false;
+        if(processAnnotatedEvent.isSet())
+        {
+            annotationTypeSet = true;
+            managedBean.setAnnotatedType(annotatedType);
+            annotatedType = processAnnotatedEvent.getAnnotatedType();
+            managedBeanCreator.setAnnotatedType(annotatedType);
+            managedBeanCreator.setMetaDataProvider(MetaDataProvider.THIRDPARTY);
+        }
+        
+        //Decorator
+        if(WebBeansAnnotatedTypeUtil.isAnnotatedTypeDecorator(annotatedType))
+        {
+            logger.info(OWBLogConst.INFO_0027, new Object[]{annotatedType.getJavaClass().getName()});
+            if(annotationTypeSet)
             {
-                AnnotatedMethod<?> method = AnnotatedElementFactory.newAnnotatedMethod(producerMethod.getCreatorMethod(), producerMethod.getParent().getReturnType());
-                ProcessProducerImpl<?, ?> producerEvent = WebBeansUtil.fireProcessProducerEventForMethod(producerMethod,method);                
-                WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducer event observers for ProducerMethods. Look at logs for further details");
-
-                annotatedMethods.put(producerMethod, method);
-                
-                if(producerEvent.isProducerSet())
-                {
-                    producerMethod.setProducer((Producer)managedBeanCreator);
-                }
-                
-                producerEvent.setProducerSet(false);
+                WebBeansAnnotatedTypeUtil.defineDecorator(annotatedType);
             }
-            
-            Map<ProducerFieldBean<?>,AnnotatedField<?>> annotatedFields = new HashMap<ProducerFieldBean<?>, AnnotatedField<?>>();
-            for(ProducerFieldBean<?> producerField : producerFields)
+            else
             {
-                AnnotatedField<?> field = AnnotatedElementFactory.newAnnotatedField(producerField.getCreatorField(), producerField.getParent().getReturnType());
-                ProcessProducerImpl<?, ?> producerEvent = WebBeansUtil.fireProcessProducerEventForField(producerField, field);
-                WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducer event observers for ProducerFields. Look at logs for further details");
-                
-                annotatedFields.put(producerField, field);
-                
-                if(producerEvent.isProducerSet())
-                {
-                    producerField.setProducer((Producer) managedBeanCreator);
-                }
-                
-                producerEvent.setProducerSet(false);
+                WebBeansUtil.defineDecorator(managedBeanCreator, annotatedType);
             }
-
-            Map<ObserverMethod<?>,AnnotatedMethod<?>> observerMethodsMap = new HashMap<ObserverMethod<?>, AnnotatedMethod<?>>(); 
-            for(ObserverMethod<?> observerMethod : observerMethods)
+        }
+        //Interceptor
+        else if(WebBeansAnnotatedTypeUtil.isAnnotatedTypeInterceptor(annotatedType))
+        {
+            logger.info(OWBLogConst.INFO_0024, new Object[]{annotatedType.getJavaClass().getName()});
+            if(annotationTypeSet)
             {
-                ObserverMethodImpl<?> impl = (ObserverMethodImpl<?>)observerMethod;
-                AnnotatedMethod<?> method = AnnotatedElementFactory.newAnnotatedMethod(impl.getObserverMethod(), impl.getBeanClass());
-                
-                observerMethodsMap.put(observerMethod, method);
+                WebBeansAnnotatedTypeUtil.defineInterceptor(annotatedType);
             }
-            
-            //Fires ProcessManagedBean
-            ProcessBeanImpl<T> processBeanEvent = new GProcessManagedBean(managedBean,annotatedType);            
-            BeanManagerImpl.getManager().fireEvent(processBeanEvent, new Annotation[0]);            
-            WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessManagedBean event observers for managed beans. Look at logs for further details");
-            
-            //Fires ProcessProducerMethod
-            WebBeansUtil.fireProcessProducerMethodBeanEvent(annotatedMethods);            
-            WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducerMethod event observers for producer method beans. Look at logs for further details");            
-            
-            //Fires ProcessProducerField
-            WebBeansUtil.fireProcessProducerFieldBeanEvent(annotatedFields);
-            WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducerField event observers for producer field beans. Look at logs for further details");            
-            
-            //Fire ObservableMethods
-            WebBeansUtil.fireProcessObservableMethodBeanEvent(observerMethodsMap);
-            WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessObserverMethod event observers for observer methods. Look at logs for further details");
-            
-            //Set InjectionTarget that is used by the container to inject dependencies!
-            if(managedBeanCreator.isInjectionTargetSet())
+            else
             {
-                managedBean.setInjectionTarget(managedBeanCreator);   
+                WebBeansUtil.defineInterceptor(managedBeanCreator, annotatedType);
             }
-            
-            BeanManagerImpl.getManager().addBean(WebBeansUtil.createNewBean(managedBean));                
-            DecoratorUtil.checkManagedBeanDecoratorConditions(managedBean);
-            BeanManagerImpl.getManager().addBean(managedBean);
-            BeanManagerImpl.getManager().getBeans().addAll(producerMethods);
-            managedBeanCreator.defineDisposalMethods();//Define disposal method after adding producers
-            BeanManagerImpl.getManager().getBeans().addAll(producerFields);
+        }
+        else
+        {
+            logger.info(OWBLogConst.INFO_0018, new Object[]{annotatedType.getJavaClass().getName()});
+            WebBeansUtil.defineManagedBean(managedBeanCreator, annotatedType);   
         }
     }
-
-    /**
-     * Defines the new interceptor with given class.
-     * 
-     * @param clazz interceptor class
-     */
-    protected <T> void defineInterceptor(Class<T> clazz)
-    {
-        WebBeansUtil.defineInterceptors(clazz);
-    }
-
-    protected <T> void defineDecorator(Class<T> clazz)
-    {
-        WebBeansUtil.defineDecorators(clazz);
-    }
-
+    
     /**
      * Defines enterprise bean via plugin.
      * @param <T> bean class type

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java Fri Feb 12 23:00:52 2010
@@ -239,7 +239,13 @@
         }
         
         // Adding inherited qualifiers
-        IBeanInheritedMetaData inheritedMetaData = component.getInheritedMetaData();
+        IBeanInheritedMetaData inheritedMetaData = null;
+        
+        if(component instanceof InjectionTargetBean)
+        {
+            inheritedMetaData = ((InjectionTargetBean<?>) component).getInheritedMetaData();
+        }
+        
         if (inheritedMetaData != null)
         {
             Set<Annotation> inheritedTypes = inheritedMetaData.getInheritedQualifiers();
@@ -382,7 +388,13 @@
         }
         
         // Adding inherited qualifiers
-        IBeanInheritedMetaData inheritedMetaData = component.getInheritedMetaData();
+        IBeanInheritedMetaData inheritedMetaData = null;
+        
+        if(component instanceof InjectionTargetBean)
+        {
+            inheritedMetaData = ((InjectionTargetBean<?>) component).getInheritedMetaData();
+        }
+        
         if (inheritedMetaData != null)
         {
             Set<Annotation> inheritedTypes = inheritedMetaData.getInheritedStereoTypes();        
@@ -410,7 +422,11 @@
     public static void defineDefaultScopeType(BaseBean<?> component, String exceptionMessage)
     {
         // Frist look for inherited scope
-        IBeanInheritedMetaData metaData = component.getInheritedMetaData();
+        IBeanInheritedMetaData metaData = null;
+        if(component instanceof InjectionTargetBean)
+        {
+            metaData = ((InjectionTargetBean<?>)component).getInheritedMetaData();
+        }
         boolean found = false;
         if (metaData != null)
         {
@@ -1021,12 +1037,12 @@
      * Configure bean instance interceptor stack.
      * @param bean bean instance
      */
-    public static void defineBeanInterceptorStack(AbstractBean<?> bean)
+    public static void defineBeanInterceptorStack(AbstractInjectionTargetBean<?> bean)
     {
         Asserts.assertNotNull(bean, "bean parameter can no be null");
 
         // @javax.interceptor.Interceptors
-        EJBInterceptorConfig.configure(bean.getReturnType(), bean.getInterceptorStack());
+        EJBInterceptorConfig.configure(((AbstractBean)bean).getReturnType(), bean.getInterceptorStack());
 
         // @javax.webbeans.Interceptor
         WebBeansInterceptorConfig.configure(bean, bean.getInterceptorStack());

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java Fri Feb 12 23:00:52 2010
@@ -15,7 +15,6 @@
 import java.util.Set;
 
 import javax.decorator.Decorator;
-import javax.enterprise.inject.spi.AnnotatedType;
 import javax.interceptor.Interceptor;
 
 import org.apache.webbeans.component.ManagedBean;
@@ -145,34 +144,5 @@
         DefinitionUtil.defineObserverMethods(component, clazz);
 
         return component;
-    }
-    
-    @SuppressWarnings("unchecked")
-    public static <T> ManagedBean<T> defineFromAnnotatedType(AnnotatedType<T> annotatedType) throws WebBeansConfigurationException
-    {
-        Class<T> javaClazz = annotatedType.getJavaClass();
-        ManagedBean<T> component = new ManagedBean<T>(javaClazz, WebBeansType.MANAGED);
-        
-        WebBeansUtil.setInjectionTargetBeanEnableFlag(component);   
-        
-        Annotation[] clazzAnns = annotatedType.getAnnotations().toArray(new Annotation[0]);
-        
-        DefinitionUtil.defineSerializable(component);
-        DefinitionUtil.defineStereoTypes(component, clazzAnns);
-        
-        DefinitionUtil.defineApiTypes(component, javaClazz);
-        DefinitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean Component implementation class : " + javaClazz.getName() + " stereotypes must declare same @Scope annotations");
-        
-        WebBeansUtil.checkGenericType(component);
-        WebBeansUtil.checkPassivationScope(component, component.getScope());
-        DefinitionUtil.defineQualifiers(component, clazzAnns);
-        DefinitionUtil.defineName(component, clazzAnns, WebBeansUtil.getManagedBeanDefaultName(javaClazz.getSimpleName()));
-
-        Constructor<T> constructor = WebBeansUtil.defineConstructor(annotatedType.getConstructors().toArray(new Constructor[0]), javaClazz);
-        component.setConstructor(constructor);
-        DefinitionUtil.addConstructorInjectionPointMetaData(component, constructor);
-
-
-        return component;
     }    
 }
\ No newline at end of file

Modified: 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=909647&r1=909646&r2=909647&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 Fri Feb 12 23:00:52 2010
@@ -744,7 +744,7 @@
                 }
                 else
                 {
-                    instance = JavassistProxyFactory.createNormalScopedBeanProxy(bean,creationalContext);
+                    instance = JavassistProxyFactory.createNormalScopedBeanProxy((AbstractBean<?>)bean,creationalContext);
                     
                     this.proxyMap.put(bean, instance);   
 
@@ -769,7 +769,7 @@
             
             
             instance = context.get((Bean<Object>)bean, (CreationalContext<Object>)creationalContext);     
-            instance = JavassistProxyFactory.createDependentScopedBeanProxy(bean, instance);
+            instance = JavassistProxyFactory.createDependentScopedBeanProxy((AbstractBean<?>)bean, instance);
         }
         
         return instance;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java Fri Feb 12 23:00:52 2010
@@ -93,8 +93,6 @@
         rq.setActive(true);
 
         requestContext.set(rq);// set thread local
-        RequestContext rq2 = requestContext.get();
-        
         if(event != null)
         {
             HttpServletRequest request = (HttpServletRequest) event.getServletRequest();

Modified: 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=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/WrappedCreationalContext.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/creational/WrappedCreationalContext.java Fri Feb 12 23:00:52 2010
@@ -23,6 +23,8 @@
 
 class WrappedCreationalContext<T> extends CreationalContextImpl<T> implements CreationalContext<T>
 {
+    private static final long serialVersionUID = 3580925478881669439L;
+    
     private CreationalContext<T> wrapped = null;    
 
     WrappedCreationalContext(Contextual<T> contextual, CreationalContext<T> creationalContext)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorUtil.java Fri Feb 12 23:00:52 2010
@@ -23,6 +23,7 @@
 import java.util.Set;
 
 import javax.decorator.Delegate;
+import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Produces;
 import javax.enterprise.inject.spi.Decorator;
 
@@ -68,6 +69,11 @@
             {
                 throw new WebBeansConfigurationException("Decorator class : " + decoratorClazz + " can not have producer methods but it has one with name : " + method.getName());
             }
+            
+            if(AnnotationUtil.hasMethodParameterAnnotation(method, Observes.class))
+            {
+                throw new WebBeansConfigurationException("Decorator class : " + decoratorClazz + " can not have observer methods but it has one with name : " + method.getName());
+            }
         }
         
         Set<Type> decoratorSet = new HashSet<Type>();

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=909647&r1=909646&r2=909647&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 Fri Feb 12 23:00:52 2010
@@ -32,6 +32,7 @@
 import javax.inject.Inject;
 
 import org.apache.webbeans.component.AbstractBean;
+import org.apache.webbeans.component.AbstractInjectionTargetBean;
 import org.apache.webbeans.component.ManagedBean;
 import org.apache.webbeans.component.WebBeansType;
 import org.apache.webbeans.config.OWBLogConst;
@@ -54,7 +55,7 @@
  *
  * @param <T> decorator type info
  */
-public class WebBeansDecorator<T> extends AbstractBean<T> implements Decorator<T>
+public class WebBeansDecorator<T> extends AbstractInjectionTargetBean<T> implements Decorator<T>
 {
     private static WebBeansLogger logger = WebBeansLogger.getLogger(WebBeansDecorator.class);
 
@@ -73,13 +74,13 @@
     protected Field delegateField;
 
     /** Wrapped bean*/
-    private AbstractBean<T> wrappedBean;
+    private AbstractInjectionTargetBean<T> wrappedBean;
     
     /**
      * Creates a new decorator bean instance with the given wrapped bean.
      * @param delegateComponent delegate bean instance
      */
-    public WebBeansDecorator(AbstractBean<T> wrappedBean)
+    public WebBeansDecorator(AbstractInjectionTargetBean<T> wrappedBean)
     {
         super(WebBeansType.DECORATOR,wrappedBean.getReturnType());
         
@@ -172,6 +173,29 @@
             this.delegateField = fields[0];
         }
         
+        Type fieldType = this.delegateField.getGenericType();
+        if (!ClassUtil.isInterface(ClassUtil.getClazz(fieldType).getModifiers()))
+        {
+            throw new WebBeansConfigurationException("Decorator bean : " + toString() + " delegate attribute type must be interface");
+        }
+
+        for (Type decType : this.decoratedTypes)
+        {
+            if (!(ClassUtil.getClass(decType)).isAssignableFrom(ClassUtil.getClass(fieldType)))
+            {
+                throw new WebBeansConfigurationException("Decorator : " + toString() + " delegate attribute must implement all of the decorator decorated types.");
+            }
+            else
+            {
+                if(ClassUtil.isParametrizedType(decType) && ClassUtil.isParametrizedType(fieldType))
+                {                    
+                    if(!fieldType.equals(decType))
+                    {
+                        throw new WebBeansConfigurationException("Decorator : " + toString() + " generic delegate attribute must be same with decorated type : " + decType);
+                    }
+                }
+            }
+        }
     }
     
     private boolean bindingMatchesAnnotations(Annotation bindingType, Set<Annotation> annotations)
@@ -457,6 +481,4 @@
     {
         return this.wrappedBean.isAlternative();
     }
-
-
 }

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=909647&r1=909646&r2=909647&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 Fri Feb 12 23:00:52 2010
@@ -27,7 +27,8 @@
 import javax.enterprise.inject.spi.Decorator;
 
 import org.apache.webbeans.annotation.DefaultLiteral;
-import org.apache.webbeans.component.AbstractBean;
+import org.apache.webbeans.component.AbstractInjectionTargetBean;
+import org.apache.webbeans.component.InjectionTargetBean;
 import org.apache.webbeans.config.OWBLogConst;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.decorator.xml.WebBeansXMLDecorator;
@@ -43,7 +44,7 @@
 
     }
 
-    public static <T> void configureDecoratorClass(AbstractBean<T> delegate)
+    public static <T> void configureDecoratorClass(AbstractInjectionTargetBean<T> delegate)
     {
         logger.info(OWBLogConst.INFO_0011, new Object[]{logger.getTokenString(OWBLogConst.TEXT_ANNO_CLASS), delegate.getReturnType().getName()});
 
@@ -54,7 +55,7 @@
         BeanManagerImpl.getManager().addDecorator(decorator);
     }
 
-    public static <T> void configureXMLDecoratorClass(AbstractBean<T> delegate, XMLInjectionPointModel model)
+    public static <T> void configureXMLDecoratorClass(AbstractInjectionTargetBean<T> delegate, XMLInjectionPointModel model)
     {
         logger.info(OWBLogConst.INFO_0011, new Object[]{logger.getTokenString(OWBLogConst.TEXT_XML_CLASS), delegate.getReturnType().getName()});
 
@@ -65,7 +66,7 @@
         BeanManagerImpl.getManager().addDecorator(decorator);
     }
 
-    public static void configureDecarotors(AbstractBean<?> component)
+    public static void configureDecarotors(AbstractInjectionTargetBean<?> component)
     {
         Set<Annotation> qualifiers = component.getQualifiers();
         Annotation[] anns = new Annotation[qualifiers.size()];
@@ -77,14 +78,14 @@
         while (itList.hasNext())
         {
             WebBeansDecorator<?> decorator = (WebBeansDecorator<?>) itList.next();            
-            component.getDecorators().add(decorator);            
+            component.getDecoratorStack().add(decorator);            
         }
     }
     
-    public static List<Object> getDecoratorStack(AbstractBean<?> component, Object instance, Object delegate)
+    public static List<Object> getDecoratorStack(InjectionTargetBean<?> component, Object instance, Object delegate)
     {
         List<Object> decoratorStack = new ArrayList<Object>();
-        List<Decorator<?>> decoratorList = component.getDecorators();        
+        List<Decorator<?>> decoratorList = component.getDecoratorStack();        
         Iterator<Decorator<?>> itList = decoratorList.iterator();
         BeanManager manager = BeanManagerImpl.getManager();
         while (itList.hasNext())

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/xml/WebBeansXMLDecorator.java Fri Feb 12 23:00:52 2010
@@ -13,7 +13,7 @@
  */
 package org.apache.webbeans.decorator.xml;
 
-import org.apache.webbeans.component.AbstractBean;
+import org.apache.webbeans.component.AbstractInjectionTargetBean;
 import org.apache.webbeans.decorator.WebBeansDecorator;
 import org.apache.webbeans.inject.xml.XMLInjectionPointModel;
 
@@ -21,7 +21,7 @@
 {
     private XMLInjectionPointModel decoratesModel = null;
 
-    public WebBeansXMLDecorator(AbstractBean<T> delegateComponent, XMLInjectionPointModel model)
+    public WebBeansXMLDecorator(AbstractInjectionTargetBean<T> delegateComponent, XMLInjectionPointModel model)
     {
         super(delegateComponent);
         this.decoratesModel = model;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java Fri Feb 12 23:00:52 2010
@@ -62,7 +62,6 @@
         List<Element> childs = stereoTypeDecleration.elements();
         if (childs != null && childs.size() > 0)
         {
-            boolean deploymentTypeFound = false;
             boolean scopeTypeFound = false;
 
             for (Element child : childs)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventImpl.java Fri Feb 12 23:00:52 2010
@@ -37,6 +37,8 @@
  */
 public class EventImpl<T> implements Event<T>, Serializable
 {
+    private static final long serialVersionUID = -9035218380365451350L;
+
     /**Event binding types*/
     private Annotation[] injectedBindings;
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansPassivationException.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansPassivationException.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansPassivationException.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansPassivationException.java Fri Feb 12 23:00:52 2010
@@ -15,6 +15,8 @@
 
 public class WebBeansPassivationException extends WebBeansConfigurationException
 {
+    private static final long serialVersionUID = 778898501784477029L;
+
     public WebBeansPassivationException(String message)
     {
         super(message);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointImpl.java Fri Feb 12 23:00:52 2010
@@ -42,6 +42,8 @@
 
 class InjectionPointImpl implements InjectionPoint, Serializable
 {
+    private static final long serialVersionUID = 1047233127758068484L;
+
     private Set<Annotation> qualifierAnnotations = new HashSet<Annotation>();
     
     private Bean<?> ownerBean;

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=909647&r1=909646&r2=909647&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 Fri Feb 12 23:00:52 2010
@@ -32,6 +32,8 @@
 import javax.interceptor.Interceptors;
 
 import org.apache.webbeans.component.AbstractBean;
+import org.apache.webbeans.component.AbstractInjectionTargetBean;
+import org.apache.webbeans.component.InjectionTargetBean;
 import org.apache.webbeans.config.BeansDeployer;
 import org.apache.webbeans.config.DefinitionUtil;
 import org.apache.webbeans.container.BeanManagerImpl;
@@ -59,7 +61,7 @@
  * <code>configureDecorators(scanner)</code>. Those methods further call
  * <code>defineInterceptor(interceptor class)</code> and <code>defineDecorator(decorator class)</code>
  * methods. Those methods finally call {@link WebBeansUtil#defineInterceptors(Class)} and
- * {@link WebBeansUtil#defineDecorators(Class)} methods for actual configuration.
+ * {@link WebBeansUtil#defineDecorator(Class)} methods for actual configuration.
  * <p>
  * Let's look at the "WebBeansUtil's" methods; 
  * </p>
@@ -154,59 +156,65 @@
         
         try
         {
-            //toString is supported but no other object method names!!!
-            if ((!ClassUtil.isObjectMethod(method.getName()) || method.getName().equals("toString")) && InterceptorUtil.isWebBeansBusinessMethod(method))
+            if(bean instanceof InjectionTargetBean)
             {
+                InjectionTargetBean<?> injectionTarget = (InjectionTargetBean<?>)this.bean;
                 
-                DelegateHandler delegateHandler = null;
-                List<Object> decorators = null;
-                
-                if(bean.getDecorators().size() > 0)
+                //toString is supported but no other object method names!!!
+                if ((!ClassUtil.isObjectMethod(method.getName()) || method.getName().equals("toString")) && InterceptorUtil.isWebBeansBusinessMethod(method))
                 {
-                	ProxyFactory delegateFactory = JavassistProxyFactory.createProxyFactory(bean);
-                	delegateHandler = new DelegateHandler();
-                	delegateFactory.setHandler(delegateHandler);
-                	Object delegate = delegateFactory.createClass().newInstance();
-                		
-                    //Gets component decorator stack
-                    decorators = WebBeansDecoratorConfig.getDecoratorStack(bean, instance, delegate);
                     
-                    delegateHandler.setDecorators(decorators);
+                    DelegateHandler delegateHandler = null;
+                    List<Object> decorators = null;
+                    
+                    if(injectionTarget.getDecoratorStack().size() > 0)
+                    {
+                        ProxyFactory delegateFactory = JavassistProxyFactory.createProxyFactory(bean);
+                        delegateHandler = new DelegateHandler();
+                        delegateFactory.setHandler(delegateHandler);
+                        Object delegate = delegateFactory.createClass().newInstance();
+                            
+                        //Gets component decorator stack
+                        decorators = WebBeansDecoratorConfig.getDecoratorStack(injectionTarget, instance, delegate);
+                        
+                        delegateHandler.setDecorators(decorators);
+                    }
+               
+                    // Run around invoke chain
+                    List<InterceptorData> stack = injectionTarget.getInterceptorStack();
+                    
+                    List<InterceptorData> temp = new ArrayList<InterceptorData>(stack);
+                    
+                    //Filter both EJB and WebBeans interceptors
+                    filterCommonInterceptorStackList(temp, method);
+                    
+                    //Call Around Invokes
+                    if (WebBeansUtil.isContainsInterceptorMethod(temp, InterceptorType.AROUND_INVOKE))
+                    {
+                        result = callAroundInvokes(method, arguments, WebBeansUtil.getInterceptorMethods(temp, InterceptorType.AROUND_INVOKE));
+                        interceptorRun = true;
+                    }
+                    
+                    //If there are Decorators, allow the delegate handler to manage the stack
+                    if(decorators != null)
+                    {
+                        return delegateHandler.invoke(instance, method, proceed, arguments);
+                    }
+                   
                 }
-           
-                // Run around invoke chain
-                List<InterceptorData> stack = bean.getInterceptorStack();
-                
-                List<InterceptorData> temp = new ArrayList<InterceptorData>(stack);
-                
-                //Filter both EJB and WebBeans interceptors
-                filterCommonInterceptorStackList(temp, method);
-                
-                //Call Around Invokes
-                if (WebBeansUtil.isContainsInterceptorMethod(temp, InterceptorType.AROUND_INVOKE))
+
+                if(interceptorRun)
                 {
-                    result = callAroundInvokes(method, arguments, WebBeansUtil.getInterceptorMethods(temp, InterceptorType.AROUND_INVOKE));
-                    interceptorRun = true;
+                    return result;
                 }
                 
-                //If there are Decorators, allow the delegate handler to manage the stack
-                if(decorators != null)
+                if (!method.isAccessible())
                 {
-                	return delegateHandler.invoke(instance, method, proceed, arguments);
+                    method.setAccessible(true);
                 }
-               
-            }
-
-            if(interceptorRun)
-            {
-                return result;
+                
             }
             
-            if (!method.isAccessible())
-            {
-                method.setAccessible(true);
-            }
-
             return method.invoke(instance, arguments);
             
         }catch(InvocationTargetException e)
@@ -357,7 +365,7 @@
     {
         if( s.readByte() == 1)
         {
-            this.bean = (AbstractBean<?>)BeanManagerImpl.getManager().getPassivationCapableBean(s.readUTF());   
+            this.bean = (AbstractInjectionTargetBean<?>)BeanManagerImpl.getManager().getPassivationCapableBean(s.readUTF());   
         }
         else
         {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java Fri Feb 12 23:00:52 2010
@@ -17,12 +17,18 @@
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Target;
 import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.Disposes;
 import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.InterceptionType;
 import javax.inject.Inject;
 import javax.interceptor.AroundInvoke;
@@ -98,6 +104,46 @@
             throw new WebBeansException("Undefined interceotion type");
         }
     }
+    
+    @SuppressWarnings("unchecked")
+    public static <T> boolean isBusinessMethodInterceptor(AnnotatedType<T> annotatedType)
+    {
+        Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
+        for(AnnotatedMethod<? super T> methodA : methods)
+        {
+            AnnotatedMethod<T> method = (AnnotatedMethod<T>)methodA;
+            if(method.isAnnotationPresent(AroundInvoke.class))
+            {
+                    if (!methodA.getParameters().isEmpty())
+                    {
+                        List<AnnotatedParameter<T>> parameters = method.getParameters();
+                        List<Class<?>> clazzParameters = new ArrayList<Class<?>>();
+                        for(AnnotatedParameter<T> parameter : parameters)
+                        {
+                            clazzParameters.add(ClassUtil.getClazz(parameter.getBaseType()));
+                        }
+                        
+                        Class<?>[] params = clazzParameters.toArray(new Class<?>[0]);
+                        if (params.length == 1 && params[0].equals(InvocationContext.class))
+                        {
+                            if (ClassUtil.getReturnType(method.getJavaMember()).equals(Object.class))
+                            {
+                                if (!ClassUtil.isMethodHasCheckedException(method.getJavaMember()))
+                                {
+                                    if (!ClassUtil.isStatic(method.getJavaMember().getModifiers()) && !ClassUtil.isFinal(method.getJavaMember().getModifiers()))
+                                    {
+                                        return true;
+                                    }
+                                }
+                            }
+                        }
+                    }                
+            }           
+        }
+        
+        return false;
+    }
+    
 
     public static boolean isBusinessMethodInterceptor(Class<?> clazz)
     {
@@ -165,6 +211,69 @@
 
         return false;
     }
+    
+    @SuppressWarnings("unchecked")
+    public static <T> boolean isLifecycleMethodInterceptor(AnnotatedType<T> annotatedType)
+    {
+        Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
+        for(AnnotatedMethod<? super T> methodA : methods)
+        {
+            AnnotatedMethod<T> method = (AnnotatedMethod<T>)methodA;
+            if(method.isAnnotationPresent(PostConstruct.class) 
+                    || method.isAnnotationPresent(PreDestroy.class))
+            {
+                    if (!methodA.getParameters().isEmpty())
+                    {
+                        List<AnnotatedParameter<T>> parameters = method.getParameters();
+                        List<Class<?>> clazzParameters = new ArrayList<Class<?>>();
+                        for(AnnotatedParameter<T> parameter : parameters)
+                        {
+                            clazzParameters.add(ClassUtil.getClazz(parameter.getBaseType()));
+                        }
+                        
+                        Class<?>[] params = clazzParameters.toArray(new Class<?>[0]);
+                        if (params.length == 1 && params[0].equals(InvocationContext.class))
+                        {
+                            if (ClassUtil.getReturnType(method.getJavaMember()).equals(Void.TYPE))
+                            {
+                                if (!ClassUtil.isMethodHasCheckedException(method.getJavaMember()))
+                                {
+                                    if (!ClassUtil.isStatic(method.getJavaMember().getModifiers()))
+                                    {
+                                        return true;
+                                    }
+                                }
+                            }
+                        }
+                    }                
+            }           
+        }
+        
+        return false;
+    }
+    
+    
+    public static <T> void checkAnnotatedTypeInterceptorConditions(AnnotatedType<T> annotatedType)
+    {
+        Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
+        for(AnnotatedMethod<? super T> methodA : methods)
+        {
+            if(methodA.isAnnotationPresent(Produces.class))
+            {
+                throw new WebBeansConfigurationException("Interceptor class : " + annotatedType.getJavaClass().getName() + " can not have producer methods but it has one with name : " + methodA.getJavaMember().getName());
+            }
+            
+        }
+        
+        Annotation[] anns = annotatedType.getAnnotations().toArray(new Annotation[0]);
+        if (!AnnotationUtil.hasInterceptorBindingMetaAnnotation(anns))
+        {
+            throw new WebBeansConfigurationException("Interceptor class : " + annotatedType.getJavaClass().getName() + " must have at least one @InterceptorBinding annotation");
+        }
+
+        checkLifecycleConditions(annotatedType, anns, "Lifecycle interceptor : " + annotatedType.getJavaClass().getName() + " interceptor binding type must be defined as @Target{TYPE}");
+    }
+    
 
     public static void checkInterceptorConditions(Class<?> clazz)
     {
@@ -208,6 +317,27 @@
         }
 
     }
+    
+    public static <T> void checkLifecycleConditions(AnnotatedType<T> annotatedType, Annotation[] annots, String errorMessage)
+    {
+        if (isLifecycleMethodInterceptor(annotatedType) && !isBusinessMethodInterceptor(annotatedType))
+        {
+            Annotation[] anns = AnnotationUtil.getInterceptorBindingMetaAnnotations(annots);
+
+            for (Annotation annotation : anns)
+            {
+                Target target = annotation.annotationType().getAnnotation(Target.class);
+                ElementType[] elementTypes = target.value();
+
+                if (!(elementTypes.length == 1 && elementTypes[0].equals(ElementType.TYPE)))
+                {
+                    throw new WebBeansConfigurationException(errorMessage);
+                }
+            }
+        }
+
+    }
+    
 
     public static void checkSimpleWebBeansInterceptorConditions(Class<?> clazz)
     {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/NormalScopedBeanInterceptorHandler.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/NormalScopedBeanInterceptorHandler.java?rev=909647&r1=909646&r2=909647&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/NormalScopedBeanInterceptorHandler.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/NormalScopedBeanInterceptorHandler.java Fri Feb 12 23:00:52 2010
@@ -36,6 +36,7 @@
     // if we make sure that it is cleaned up properly!
     private static ThreadLocal<CreationalContext<Object>> creationalContxt = new ThreadLocal<CreationalContext<Object>>();
 
+    @SuppressWarnings("unchecked")
     public NormalScopedBeanInterceptorHandler(AbstractBean<?> bean, CreationalContext<?> cc)
     {
         super(bean);



Mime
View raw message