openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1647256 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/container/ main/java/org/apache/webbeans/inject/impl/ main/java/org/apache/webbeans/portable/events/ main/java/org/apac...
Date Mon, 22 Dec 2014 08:18:57 GMT
Author: rmannibucau
Date: Mon Dec 22 08:18:57 2014
New Revision: 1647256

URL: http://svn.apache.org/r1647256
Log:
making container event usable only in their observed view - to remove if the spec thinks it is optional but today it is not

Added:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/EventBase.java
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanAttributesImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionPointImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionTargetImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessManagedBeanImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerFieldImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerMethodImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSessionBeanImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSyntheticAnnotatedTypeImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterDeploymentValidationImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeBeanDiscoveryImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/events/injectiontarget/ProcessInjectionTargetTest.java

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=1647256&r1=1647255&r2=1647256&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 Mon Dec 22 08:18:57 2014
@@ -570,7 +570,9 @@ public class BeansDeployer
     private void fireBeforeBeanDiscoveryEvent()
     {
         BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
-        manager.fireLifecycleEvent(new BeforeBeanDiscoveryImpl(webBeansContext));
+        BeforeBeanDiscoveryImpl event = new BeforeBeanDiscoveryImpl(webBeansContext);
+        manager.fireLifecycleEvent(event);
+        event.setStarted();
     }
     
     /**
@@ -604,11 +606,13 @@ public class BeansDeployer
         Collections.reverse(interceptors);
         Collections.reverse(decorators);
         Collections.reverse(alternatives);
-        manager.fireLifecycleEvent(new AfterTypeDiscoveryImpl(webBeansContext, newAt,
-                interceptors, decorators, alternatives));
+        final AfterTypeDiscoveryImpl event = new AfterTypeDiscoveryImpl(webBeansContext, newAt,
+                interceptors, decorators, alternatives);
+        manager.fireLifecycleEvent(event);
         // reverse to keep "selection" order - decorator and interceptors considers it in their sorting.
         // NOTE: from here priorityClass.getSorted() MUST NOT be recomputed (ie no priorityClass.add(...))
         Collections.reverse(alternatives);
+        event.setStarted();
 
         // we do not need to set back the sortedAlternatives to the AlternativesManager as the API
         // and all layers in between use a mutable List. Not very elegant but spec conform.
@@ -623,14 +627,16 @@ public class BeansDeployer
      */
     private void fireAfterDeploymentValidationEvent()
     {
-        BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
+        final BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
         manager.setAfterDeploymentValidationFired(true);
-        manager.fireLifecycleEvent(new AfterDeploymentValidationImpl(manager));
+        final AfterDeploymentValidationImpl event = new AfterDeploymentValidationImpl(manager);
+        manager.fireLifecycleEvent(event);
 
         webBeansContext.getWebBeansUtil().inspectErrorStack(
             "There are errors that are added by AfterDeploymentValidation event observers. Look at logs for further details");
 
         packageVetoCache.clear(); // no more needed, free the memory
+        event.setStarted();
     }
     
     /**
@@ -874,7 +880,7 @@ public class BeansDeployer
                         {
                             annotatedTypes.add(processAnnotatedEvent.getAnnotatedType());
                         }
-                        processAnnotatedEvent.setAfter();
+                        processAnnotatedEvent.setStarted();
                     }
                     else
                     {
@@ -963,8 +969,6 @@ public class BeansDeployer
      */
     private void addAdditionalAnnotatedTypes(Collection<AnnotatedType<?>> toDeploy, List<AnnotatedType<?>> annotatedTypes)
     {
-        BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
-
         for (AnnotatedType<?> annotatedType : toDeploy)
         {
             // Fires ProcessAnnotatedType
@@ -980,7 +984,10 @@ public class BeansDeployer
                 }
                 annotatedTypes.add(changedAnnotatedType);
             }
-
+            if (processAnnotatedEvent != null)
+            {
+                processAnnotatedEvent.setStarted();
+            }
         }
     }
 
@@ -1210,7 +1217,7 @@ public class BeansDeployer
                 }
 
                 annotatedType = processAnnotatedEvent.getAnnotatedType();
-                processAnnotatedEvent.setAfter();
+                processAnnotatedEvent.setStarted();
 
                 Set<Annotation> annTypeAnnotations = annotatedType.getAnnotations();
                 if (annTypeAnnotations != null)
@@ -1384,7 +1391,7 @@ public class BeansDeployer
         if(webBeansContext.getWebBeansUtil().supportsJavaEeComponentInjections(beanClass))
         {
             //Fires ProcessInjectionTarget
-            webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEventForJavaEeComponents(beanClass);
+            webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEventForJavaEeComponents(beanClass).setStarted();
             webBeansContext.getWebBeansUtil().inspectErrorStack(
                 "There are errors that are added by ProcessInjectionTarget event observers. Look at logs for further details");
 
@@ -1510,6 +1517,7 @@ public class BeansDeployer
                 //Fires ProcessManagedBean
                 ProcessBeanImpl<T> processBeanEvent = new GProcessManagedBean(managedBean, annotatedType);
                 beanManager.fireEvent(processBeanEvent, true);
+                processBeanEvent.setStarted();
                 webBeansContext.getWebBeansUtil().inspectErrorStack("There are errors that are added by ProcessManagedBean event observers for " +
                         "managed beans. Look at logs for further details");
 

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=1647256&r1=1647255&r2=1647256&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 Mon Dec 22 08:18:57 2014
@@ -86,6 +86,7 @@ import org.apache.webbeans.portable.Anno
 import org.apache.webbeans.portable.InjectionTargetImpl;
 import org.apache.webbeans.portable.LazyInterceptorDefinedInjectionTarget;
 import org.apache.webbeans.portable.events.discovery.ErrorStack;
+import org.apache.webbeans.portable.events.generics.GProcessInjectionTarget;
 import org.apache.webbeans.spi.adaptor.ELAdaptor;
 import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
 import org.apache.webbeans.util.AnnotationUtil;
@@ -1189,7 +1190,10 @@ public class BeanManagerImpl implements
         {
             throw new IllegalArgumentException(ie);
         }
-        return webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEvent(injectionTarget, type).getInjectionTarget();
+        GProcessInjectionTarget event = webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEvent(injectionTarget, type);
+        final InjectionTarget it = event.getInjectionTarget();
+        event.setStarted();
+        return it;
     }
 
     @Override

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionTargetFactoryImpl.java Mon Dec 22 08:18:57 2014
@@ -23,6 +23,7 @@ import javax.enterprise.inject.spi.Injec
 import org.apache.webbeans.component.ManagedBean;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.portable.InjectionTargetImpl;
+import org.apache.webbeans.portable.events.generics.GProcessInjectionTarget;
 import org.apache.webbeans.util.Asserts;
 
 import javax.annotation.PostConstruct;
@@ -64,7 +65,10 @@ public class InjectionTargetFactoryImpl<
         {
             ManagedBean.class.cast(bean).setOriginalInjectionTarget(injectionTarget);
         }
-        return webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEvent(injectionTarget, annotatedType).getInjectionTarget();
+        final GProcessInjectionTarget event = webBeansContext.getWebBeansUtil().fireProcessInjectionTargetEvent(injectionTarget, annotatedType);
+        final InjectionTarget it = event.getInjectionTarget();
+        event.setStarted();
+        return it;
     }
 
     public Set<InjectionPoint> createInjectionPoints(Bean<T> bean)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java Mon Dec 22 08:18:57 2014
@@ -22,6 +22,7 @@ import org.apache.webbeans.annotation.An
 import org.apache.webbeans.annotation.NamedLiteral;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.portable.events.generics.GProcessInjectionPoint;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 
@@ -133,7 +134,9 @@ public class InjectionPointFactory
 
         if (fireEvent)
         {
-            injectionPoint = webBeansContext.getWebBeansUtil().fireProcessInjectionPointEvent(injectionPoint).getInjectionPoint();
+            final GProcessInjectionPoint event = webBeansContext.getWebBeansUtil().fireProcessInjectionPointEvent(injectionPoint);
+            injectionPoint = event.getInjectionPoint();
+            event.setStarted();
         }
 
         return injectionPoint;

Added: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/EventBase.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/EventBase.java?rev=1647256&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/EventBase.java (added)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/EventBase.java Mon Dec 22 08:18:57 2014
@@ -0,0 +1,37 @@
+/*
+ * 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.portable.events;
+
+public abstract class EventBase
+{
+    private boolean started;
+
+    public void setStarted()
+    {
+        started = true;
+    }
+
+    protected void checkState()
+    {
+        if (started)
+        {
+            throw new IllegalStateException("only call container event methods in their correct lifecycle");
+        }
+    }
+}

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java Mon Dec 22 08:18:57 2014
@@ -26,7 +26,7 @@ import javax.enterprise.inject.spi.Proce
  * 
  * @param <X> bean class info
  */
-public class ProcessAnnotatedTypeImpl<X> implements ProcessAnnotatedType<X>
+public class ProcessAnnotatedTypeImpl<X> extends EventBase implements ProcessAnnotatedType<X>
 {
     /**Annotated Type*/
     private AnnotatedType<X> annotatedType = null;
@@ -57,6 +57,7 @@ public class ProcessAnnotatedTypeImpl<X>
     @Override
     public AnnotatedType<X> getAnnotatedType()
     {
+        checkState();
         return annotatedType;
     }
 
@@ -66,6 +67,7 @@ public class ProcessAnnotatedTypeImpl<X>
     @Override
     public void setAnnotatedType(AnnotatedType<X> type)
     {
+        checkState();
         annotatedType = type;
         modifiedAnnotatedType = true;
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanAttributesImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanAttributesImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanAttributesImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanAttributesImpl.java Mon Dec 22 08:18:57 2014
@@ -22,7 +22,7 @@ import javax.enterprise.inject.spi.Annot
 import javax.enterprise.inject.spi.BeanAttributes;
 import javax.enterprise.inject.spi.ProcessBeanAttributes;
 
-public class ProcessBeanAttributesImpl<T> implements ProcessBeanAttributes<T>
+public class ProcessBeanAttributesImpl<T> extends EventBase implements ProcessBeanAttributes<T>
 {
     private Annotated annotated;
     private BeanAttributes<T> attributes;
@@ -38,30 +38,35 @@ public class ProcessBeanAttributesImpl<T
     @Override
     public Annotated getAnnotated()
     {
+        checkState();
         return annotated;
     }
 
     @Override
     public BeanAttributes<T> getBeanAttributes()
     {
+        checkState();
         return attributes;
     }
 
     @Override
     public void setBeanAttributes(final BeanAttributes<T> tBeanAttributes)
     {
+        checkState();
         attributes = tBeanAttributes;
     }
 
     @Override
     public void veto()
     {
+        checkState();
         veto = true;
     }
 
     @Override
     public void addDefinitionError(final Throwable throwable)
     {
+        checkState();
         definitionError = throwable;
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanImpl.java Mon Dec 22 08:18:57 2014
@@ -31,14 +31,14 @@ import org.apache.webbeans.config.WebBea
  *
  * @param <X> bean class info
  */
-public  class ProcessBeanImpl<X> implements ProcessBean<X>
+public  class ProcessBeanImpl<X> extends EventBase implements ProcessBean<X>
 {
     /**Annotated instance. Can be AnnotatedType, AnnotatedMethod or AnnotatedField*/
     private final Annotated annotated;
     
     /**ManagedBean, SessionBean, ProducerMethodBean, ProducerFieldBean*/
     private final Bean<X> bean;
-    
+
     protected ProcessBeanImpl(Bean<X> bean, Annotated annotated)
     {
         this.bean = bean;
@@ -51,6 +51,7 @@ public  class ProcessBeanImpl<X> impleme
     @Override
     public void addDefinitionError(Throwable t)
     {
+        checkState();
         WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
     }
 
@@ -60,6 +61,7 @@ public  class ProcessBeanImpl<X> impleme
     @Override
     public Annotated getAnnotated()
     {
+        checkState();
         return annotated;
     }
 
@@ -69,6 +71,7 @@ public  class ProcessBeanImpl<X> impleme
     @Override
     public Bean<X> getBean()
     {
+        checkState();
         return bean;
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionPointImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionPointImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionPointImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionPointImpl.java Mon Dec 22 08:18:57 2014
@@ -30,7 +30,7 @@ import javax.enterprise.inject.spi.Proce
  * @param <T> bean class
  * @param <X> declared type
  */
-public class ProcessInjectionPointImpl<T, X> implements ProcessInjectionPoint<T, X>
+public class ProcessInjectionPointImpl<T, X> extends EventBase implements ProcessInjectionPoint<T, X>
 {
 
     private InjectionPoint injectionPoint;
@@ -48,6 +48,7 @@ public class ProcessInjectionPointImpl<T
     @Override
     public InjectionPoint getInjectionPoint()
     {
+        checkState();
         return injectionPoint;
     }
 
@@ -57,6 +58,7 @@ public class ProcessInjectionPointImpl<T
     @Override
     public void setInjectionPoint(InjectionPoint injectionPoint)
     {
+        checkState();
         this.injectionPoint = injectionPoint;
     }
 
@@ -66,6 +68,7 @@ public class ProcessInjectionPointImpl<T
     @Override
     public void addDefinitionError(Throwable t)
     {
+        checkState();
         WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionTargetImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionTargetImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionTargetImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionTargetImpl.java Mon Dec 22 08:18:57 2014
@@ -31,7 +31,7 @@ import org.apache.webbeans.config.WebBea
  *
  * @param <X> bean class info
  */
-public class ProcessInjectionTargetImpl<X> implements ProcessInjectionTarget<X>
+public class ProcessInjectionTargetImpl<X> extends EventBase implements ProcessInjectionTarget<X>
 {
     /**Annotated type instance that is used by container to read meta-data*/
     private final AnnotatedType<X> annotatedType;
@@ -56,29 +56,37 @@ public class ProcessInjectionTargetImpl<
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addDefinitionError(Throwable t)
     {
+        checkState();
         WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
     }
 
+    @Override
     public AnnotatedType<X> getAnnotatedType()
     {
+        checkState();
         return annotatedType;
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public InjectionTarget<X> getInjectionTarget()
     {
+        checkState();
         return injectionTarget;
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public void setInjectionTarget(InjectionTarget<X> injectionTarget)
     {
+        checkState();
         this.injectionTarget = injectionTarget;
         set = true;
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessManagedBeanImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessManagedBeanImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessManagedBeanImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessManagedBeanImpl.java Mon Dec 22 08:18:57 2014
@@ -47,6 +47,7 @@ public class ProcessManagedBeanImpl<X> e
     @Override
     public AnnotatedType<X> getAnnotatedBeanClass()
     {
+        checkState();
         return annotatedBeanClass;
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java Mon Dec 22 08:18:57 2014
@@ -32,7 +32,7 @@ import org.apache.webbeans.config.WebBea
  * @param <X> declared bean class
  * @param <T> event type
  */
-public class ProcessObserverMethodImpl<T,X> implements ProcessObserverMethod<T, X>
+public class ProcessObserverMethodImpl<T,X> extends EventBase implements ProcessObserverMethod<T, X>
 {
     /**Observer annotated method*/
     private final AnnotatedMethod<X> annotatedMethod;
@@ -52,6 +52,7 @@ public class ProcessObserverMethodImpl<T
     @Override
     public void addDefinitionError(Throwable t)
     {
+        checkState();
         WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
     }
 
@@ -61,6 +62,7 @@ public class ProcessObserverMethodImpl<T
     @Override
     public AnnotatedMethod<X> getAnnotatedMethod()
     {
+        checkState();
         return annotatedMethod;
     }
 
@@ -70,6 +72,7 @@ public class ProcessObserverMethodImpl<T
     @Override
     public ObserverMethod<T> getObserverMethod()
     {
+        checkState();
         return observerMethod;
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerFieldImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerFieldImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerFieldImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerFieldImpl.java Mon Dec 22 08:18:57 2014
@@ -50,6 +50,7 @@ public class ProcessProducerFieldImpl<X,
     @Override
     public AnnotatedField<X> getAnnotatedProducerField()
     {
+        checkState();
         return annotatedField;
     }
 
@@ -58,6 +59,7 @@ public class ProcessProducerFieldImpl<X,
      */
     public AnnotatedParameter<X> getAnnotatedDisposedParameter()
     {
+        checkState();
         return annotatedParameter;
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java Mon Dec 22 08:18:57 2014
@@ -32,7 +32,7 @@ import org.apache.webbeans.config.WebBea
  * @param <X> bean class
  * @param <T> producer return type class
  */
-public class ProcessProducerImpl<X,T> implements ProcessProducer<X, T>
+public class ProcessProducerImpl<X,T> extends EventBase implements ProcessProducer<X, T>
 {
     /**Annotated method or annotated field according to producer method or field*/
     private final AnnotatedMember<X> annotateMember;
@@ -52,6 +52,7 @@ public class ProcessProducerImpl<X,T> im
     @Override
     public void addDefinitionError(Throwable t)
     {
+        checkState();
         WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
     }
 
@@ -61,6 +62,7 @@ public class ProcessProducerImpl<X,T> im
     @Override
     public AnnotatedMember<X> getAnnotatedMember()
     {
+        checkState();
         return annotateMember;
     }
 
@@ -70,6 +72,7 @@ public class ProcessProducerImpl<X,T> im
     @Override
     public Producer<T> getProducer()
     {
+        checkState();
         return producer;
     }
 
@@ -79,6 +82,7 @@ public class ProcessProducerImpl<X,T> im
     @Override
     public void setProducer(Producer<T> producer)
     {
+        checkState();
         this.producer = producer;
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerMethodImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerMethodImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerMethodImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerMethodImpl.java Mon Dec 22 08:18:57 2014
@@ -53,6 +53,7 @@ public class ProcessProducerMethodImpl<X
     @Override
     public AnnotatedParameter<X> getAnnotatedDisposedParameter()
     {
+        checkState();
         return annotatedDisposedParameter;
     }
 
@@ -62,6 +63,7 @@ public class ProcessProducerMethodImpl<X
     @Override
     public AnnotatedMethod<X> getAnnotatedProducerMethod()
     {
+        checkState();
         return annotatedProducerMethod;
     }
     

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSessionBeanImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSessionBeanImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSessionBeanImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSessionBeanImpl.java Mon Dec 22 08:18:57 2014
@@ -56,6 +56,7 @@ public class ProcessSessionBeanImpl<X> e
     @Override
     public String getEjbName()
     {
+        checkState();
         return ejbName;
     }
     
@@ -65,6 +66,7 @@ public class ProcessSessionBeanImpl<X> e
     @Override
     public SessionBeanType getSessionBeanType()
     {
+        checkState();
         return type;
     }
 
@@ -74,6 +76,7 @@ public class ProcessSessionBeanImpl<X> e
     @Override
     public AnnotatedType<Object> getAnnotatedBeanClass()
     {
+        checkState();
         return annotatedBeanClass;
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSyntheticAnnotatedTypeImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSyntheticAnnotatedTypeImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSyntheticAnnotatedTypeImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSyntheticAnnotatedTypeImpl.java Mon Dec 22 08:18:57 2014
@@ -27,7 +27,7 @@ import javax.enterprise.inject.spi.Proce
  *
  * @param <X> bean class info
  */
-public class ProcessSyntheticAnnotatedTypeImpl<X> implements ProcessSyntheticAnnotatedType<X>
+public class ProcessSyntheticAnnotatedTypeImpl<X> extends EventBase implements ProcessSyntheticAnnotatedType<X>
 {
 
     private Extension source;
@@ -55,6 +55,7 @@ public class ProcessSyntheticAnnotatedTy
     @Override
     public Extension getSource()
     {
+        checkState();
         return source;
     }
 
@@ -64,6 +65,7 @@ public class ProcessSyntheticAnnotatedTy
     @Override
     public AnnotatedType<X> getAnnotatedType()
     {
+        checkState();
         return annotatedType;
     }
 
@@ -73,6 +75,7 @@ public class ProcessSyntheticAnnotatedTy
     @Override
     public void setAnnotatedType(AnnotatedType<X> type)
     {
+        checkState();
         annotatedType = type;
         modifiedAnnotatedType = true;
     }
@@ -93,6 +96,7 @@ public class ProcessSyntheticAnnotatedTy
     @Override
     public void veto()
     {
+        checkState();
         veto = true;
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterDeploymentValidationImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterDeploymentValidationImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterDeploymentValidationImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterDeploymentValidationImpl.java Mon Dec 22 08:18:57 2014
@@ -32,18 +32,28 @@ import org.apache.webbeans.container.Bea
 public class AfterDeploymentValidationImpl implements AfterDeploymentValidation
 {
     private final BeanManagerImpl beanManagerImpl;
+    private boolean started;
 
     public AfterDeploymentValidationImpl(BeanManagerImpl beanManagerImpl)
     {
         this.beanManagerImpl = beanManagerImpl;
     }
 
+    public void setStarted()
+    {
+        started = true;
+    }
+
     /**
      * {@inheritDoc}
      */
     @Override
     public void addDeploymentProblem(Throwable t)
     {
+        if (started)
+        {
+            throw new IllegalStateException("Only call container eevnt methods in their lifecycle");
+        }
         beanManagerImpl.getErrorStack().pushError(t);
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java Mon Dec 22 08:18:57 2014
@@ -23,12 +23,13 @@ import javax.enterprise.inject.spi.Annot
 import java.util.List;
 
 import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.portable.events.EventBase;
 
 /**
  * OWB fires this event after all AnnotatedTypes from scanned classes
  * got picked up.
  */
-public class AfterTypeDiscoveryImpl implements AfterTypeDiscovery, ExtensionAware
+public class AfterTypeDiscoveryImpl extends EventBase implements AfterTypeDiscovery, ExtensionAware
 {
     private final WebBeansContext webBeansContext;
     private final List<Class<?>> sortedAlternatives;
@@ -53,24 +54,28 @@ public class AfterTypeDiscoveryImpl impl
     @Override
     public List<Class<?>> getAlternatives()
     {
+        checkState();
         return sortedAlternatives;
     }
 
     @Override
     public List<Class<?>> getInterceptors()
     {
+        checkState();
         return sortedInterceptors;
     }
 
     @Override
     public List<Class<?>> getDecorators()
     {
+        checkState();
         return sortedDecorators;
     }
 
     @Override
     public void addAnnotatedType(AnnotatedType<?> type, String id)
     {
+        checkState();
         webBeansContext.getBeanManagerImpl().addAdditionalAnnotatedType(extension, type, id);
         newAt.add(type);
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeBeanDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeBeanDiscoveryImpl.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeBeanDiscoveryImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeBeanDiscoveryImpl.java Mon Dec 22 08:18:57 2014
@@ -40,19 +40,28 @@ public class BeforeBeanDiscoveryImpl imp
     private BeanManagerImpl beanManager = null;
     private final WebBeansContext webBeansContext;
     private Object extension;
+    private boolean started;
 
     public BeforeBeanDiscoveryImpl(WebBeansContext webBeansContext)
     {
         this.webBeansContext = webBeansContext;
         beanManager = this.webBeansContext.getBeanManagerImpl();
     }
-    
+
+    public void setStarted()
+    {
+        started = true;
+    }
     /**
      * {@inheritDoc}
      */
     @Override
     public void addAnnotatedType(AnnotatedType<?> type)
     {
+        if (started)
+        {
+            throw new IllegalStateException("Only call container eevnt methods in their lifecycle");
+        }
         beanManager.addAdditionalAnnotatedType(extension, type);
     }
 
@@ -62,6 +71,10 @@ public class BeforeBeanDiscoveryImpl imp
     @Override
     public void addQualifier(Class<? extends Annotation> qualifier)
     {
+        if (started)
+        {
+            throw new IllegalStateException("Only call container eevnt methods in their lifecycle");
+        }
         beanManager.addAdditionalQualifier(qualifier);
         
     }
@@ -72,6 +85,10 @@ public class BeforeBeanDiscoveryImpl imp
     @Override
     public void addInterceptorBinding(Class<? extends Annotation> binding, Annotation... bindingDef)
     {
+        if (started)
+        {
+            throw new IllegalStateException("Only call container eevnt methods in their lifecycle");
+        }
         webBeansContext.getInterceptorsManager().addInterceptorBindingType(binding, bindingDef);
     }
 
@@ -81,6 +98,10 @@ public class BeforeBeanDiscoveryImpl imp
     @Override
     public void addScope(Class<? extends Annotation> scope, boolean normal, boolean passivating)
     {
+        if (started)
+        {
+            throw new IllegalStateException("Only call container eevnt methods in their lifecycle");
+        }
         ExternalScope additionalScope = new ExternalScope(scope, normal, passivating); 
         beanManager.addAdditionalScope(additionalScope);
     }
@@ -91,6 +112,10 @@ public class BeforeBeanDiscoveryImpl imp
     @Override
     public void addStereotype(Class<? extends Annotation> stereotype, Annotation... stereotypeDef)
     {
+        if (started)
+        {
+            throw new IllegalStateException("Only call container eevnt methods in their lifecycle");
+        }
         webBeansContext.getAnnotationManager().checkStereoTypeClass(stereotype, stereotypeDef);
         StereoTypeModel model = new StereoTypeModel(webBeansContext, stereotype, stereotypeDef);
         webBeansContext.getStereoTypeManager().addStereoTypeModel(model);
@@ -99,16 +124,26 @@ public class BeforeBeanDiscoveryImpl imp
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addAnnotatedType(AnnotatedType<?> annotatedType, String id)
     {
+        if (started)
+        {
+            throw new IllegalStateException("Only call container eevnt methods in their lifecycle");
+        }
         beanManager.addAdditionalAnnotatedType(extension, annotatedType, id);
     }
 
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addInterceptorBinding(AnnotatedType<? extends Annotation> annotatedType)
     {
+        if (started)
+        {
+            throw new IllegalStateException("Only call container eevnt methods in their lifecycle");
+        }
         // TODO extract inherited types
         webBeansContext.getInterceptorsManager().addInterceptorBindingType(annotatedType);
     }
@@ -116,8 +151,13 @@ public class BeforeBeanDiscoveryImpl imp
     /**
      * {@inheritDoc}
      */
+    @Override
     public void addQualifier(AnnotatedType<? extends Annotation> annotatedType)
     {
+        if (started)
+        {
+            throw new IllegalStateException("Only call container eevnt methods in their lifecycle");
+        }
         beanManager.addAdditionalQualifier(annotatedType.getJavaClass());
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java Mon Dec 22 08:18:57 2014
@@ -25,45 +25,26 @@ import org.apache.webbeans.portable.even
 @SuppressWarnings("unchecked")
 public class GProcessAnnotatedType extends ProcessAnnotatedTypeImpl implements GenericBeanEvent
 {
-    private boolean after = false;
-
     public GProcessAnnotatedType(AnnotatedType annotatedType )
     {
         super(annotatedType);
     }
 
-    public void setAfter()
-    {
-        this.after = true;
-    }
-
     @Override
     public AnnotatedType getAnnotatedType()
     {
-        if (after)
-        {
-            throw new IllegalStateException("Can't call ProcessAnnotatedType.getAnnotatedType() after the event");
-        }
         return super.getAnnotatedType();
     }
 
     @Override
     public void setAnnotatedType(AnnotatedType type)
     {
-        if (after)
-        {
-            throw new IllegalStateException("Can't call ProcessAnnotatedType.setAnnotatedType(at) after the event");
-        }
         super.setAnnotatedType(type);
     }
 
     @Override
     public void veto()
     {
-        if (after)
-        {
-            throw new IllegalStateException("Can't call ProcessAnnotatedType.veto() after the event");
-        }
         super.veto();
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java Mon Dec 22 08:18:57 2014
@@ -35,12 +35,14 @@ public class GProcessProducer extends Pr
     @Override
     public Class<?> getBeanClass()
     {
+        checkState();
         return getAnnotatedMember().getDeclaringType().getJavaClass();
     }
 
     @Override
     public Class<?> getProducerOrObserverType()
     {
+        checkState();
         return ClassUtil.getClazz(getAnnotatedMember().getBaseType());
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Mon Dec 22 08:18:57 2014
@@ -1056,7 +1056,9 @@ public final class WebBeansUtil
         //Fires ProcessProducer
         webBeansContext.getBeanManagerImpl().fireEvent(processProducerEvent, true, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
         webBeansContext.getWebBeansUtil().inspectErrorStack("There are errors that are added by ProcessProducer event observers. Look at logs for further details");
-        return processProducerEvent.getProducer();
+        Producer prod = processProducerEvent.getProducer();
+        processProducerEvent.setStarted();
+        return prod;
     }
 
     public void fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>, AnnotatedMethod<?>> annotatedMethods, AnnotatedType<?> annotatedType)
@@ -1087,6 +1089,7 @@ public final class WebBeansUtil
 
             //Fires ProcessProducer
             webBeansContext.getBeanManagerImpl().fireEvent(processProducerMethodEvent, true, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+            processProducerMethodEvent.setStarted();
         }
     }
 
@@ -1101,6 +1104,7 @@ public final class WebBeansUtil
 
             //Fires ProcessProducer
             webBeansContext.getBeanManagerImpl().fireEvent(event, true, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+            event.setStarted();
         }
     }
 
@@ -1116,6 +1120,7 @@ public final class WebBeansUtil
 
             //Fire ProcessProducer
             webBeansContext.getBeanManagerImpl().fireEvent(processProducerFieldEvent, true, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+            processProducerFieldEvent.setStarted();
         }
     }
 
@@ -1808,6 +1813,7 @@ public final class WebBeansUtil
         {
             beanAttributes = ba;
         }
+        event.setStarted();
         if (event.isVeto())
         {
             return null;

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/events/injectiontarget/ProcessInjectionTargetTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/events/injectiontarget/ProcessInjectionTargetTest.java?rev=1647256&r1=1647255&r2=1647256&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/events/injectiontarget/ProcessInjectionTargetTest.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/events/injectiontarget/ProcessInjectionTargetTest.java Mon Dec 22 08:18:57 2014
@@ -36,14 +36,13 @@ import org.junit.Test;
 public class ProcessInjectionTargetTest extends AbstractUnitTest
 {
     @Test
-    public void testInjectionTargetIsValid() throws Exception
-    {
+    public void testInjectionTargetIsValid() throws Exception {
         InjectionTargetExtension injectionTargetExtension = new InjectionTargetExtension();
         addExtension(injectionTargetExtension);
         startContainer(SomeBean.class, SomeOtherBean.class);
 
-        Assert.assertNotNull(injectionTargetExtension.getProcessInjectionTarget());
-        InjectionTarget injectionTarget = injectionTargetExtension.getProcessInjectionTarget().getInjectionTarget();
+        Assert.assertNotNull(injectionTargetExtension.getInjectionTarget());
+        InjectionTarget injectionTarget = injectionTargetExtension.getInjectionTarget();
         Assert.assertNotNull(injectionTarget);
         Assert.assertNotNull(injectionTarget.getInjectionPoints());
         Assert.assertEquals(1, injectionTarget.getInjectionPoints().size());
@@ -51,17 +50,16 @@ public class ProcessInjectionTargetTest
 
     public static class InjectionTargetExtension implements Extension
     {
-        private ProcessInjectionTarget processInjectionTarget;
+        private InjectionTarget injectionTarget;
 
 
         public void observePit(@Observes ProcessInjectionTarget<SomeBean> pit)
         {
-            this.processInjectionTarget = pit;
+            this.injectionTarget = pit.getInjectionTarget();
         }
 
-        public ProcessInjectionTarget getProcessInjectionTarget()
-        {
-            return processInjectionTarget;
+        public InjectionTarget getInjectionTarget() {
+            return injectionTarget;
         }
     }
 



Mime
View raw message