openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1796702 - in /openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/component/creation/ main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/event/ main/java/org/apache/webbeans/portable/events/ main/java/org/a...
Date Mon, 29 May 2017 21:27:10 GMT
Author: struberg
Date: Mon May 29 21:27:10 2017
New Revision: 1796702

URL: http://svn.apache.org/viewvc?rev=1796702&view=rev
Log:
OWB-1186 implement ProcessSyntheticObserverMethod and ProcessSyntheticBean

Added:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObserverMethod.java
      - copied, changed from r1796701, openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticBean.java
      - copied, changed from r1796675, openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticObserverMethod.java
      - copied, changed from r1796675, openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java
Removed:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ContainerEventObserverMethodImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.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/discovery/AfterBeanDiscoveryImpl.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/discovery/ExtensionAware.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/event/TypeArgumentInterfaceObserver.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java?rev=1796702&r1=1796701&r2=1796702&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ObserverMethodsBuilder.java
Mon May 29 21:27:10 2017
@@ -96,7 +96,10 @@ public class ObserverMethodsBuilder<T>
                 //Looking for ObserverMethod
                 ObserverMethod<?> definedObserver = webBeansContext.getBeanManagerImpl().getNotificationManager().
                         getObservableMethodForAnnotatedMethod(annotatedMethod, observesParameter,
bean);
-                definedObservers.add(definedObserver);
+                if (definedObserver != null)
+                {
+                    definedObservers.add(definedObserver);
+                }
             }
         }
 

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=1796702&r1=1796701&r2=1796702&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 May 29 21:27:10 2017
@@ -1764,6 +1764,7 @@ public class BeansDeployer
                 ProcessBeanImpl<T> processBeanEvent = new GProcessManagedBean(managedBean,
annotatedType);
                 beanManager.fireEvent(processBeanEvent, true);
                 processBeanEvent.setStarted();
+
                 webBeansContext.getWebBeansUtil().inspectDefinitionErrorStack("There are
errors that are added by ProcessManagedBean event observers for " +
                         "managed beans. Look at logs for further details");
 
@@ -1777,11 +1778,6 @@ public class BeansDeployer
                 webBeansContext.getWebBeansUtil().inspectDefinitionErrorStack("There are
errors that are added by ProcessProducerField event observers for " +
                         "producer field beans. Look at logs for further details");
 
-                //Fire ObservableMethods
-                webBeansContext.getWebBeansUtil().fireProcessObservableMethodBeanEvent(observerMethodsMap);
-                webBeansContext.getWebBeansUtil().inspectDefinitionErrorStack("There are
errors that are added by ProcessObserverMethod event observers for " +
-                        "observer methods. Look at logs for further details");
-
                 if(!webBeansContext.getWebBeansUtil().isAnnotatedTypeDecoratorOrInterceptor(annotatedType))
                 {
                     beanManager.addBean(bean);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ContainerEventObserverMethodImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ContainerEventObserverMethodImpl.java?rev=1796702&r1=1796701&r2=1796702&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ContainerEventObserverMethodImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/ContainerEventObserverMethodImpl.java
Mon May 29 21:27:10 2017
@@ -24,6 +24,7 @@ import org.apache.webbeans.portable.even
 
 import javax.enterprise.inject.spi.AnnotatedMethod;
 import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.ProcessAnnotatedType;
 import javax.enterprise.inject.spi.WithAnnotations;
 import java.lang.reflect.InvocationTargetException;
@@ -76,7 +77,7 @@ public class ContainerEventObserverMetho
             if (ExtensionAware.class.isInstance(args[0]))
             {
                 extensionAware = ExtensionAware.class.cast(args[0]);
-                extensionAware.setExtension(object);
+                extensionAware.setExtension((Extension) object);
             }
         }
         super.invoke(object, args);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java?rev=1796702&r1=1796701&r2=1796702&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
Mon May 29 21:27:10 2017
@@ -59,7 +59,7 @@ import javax.enterprise.inject.spi.Proce
 import javax.enterprise.inject.spi.ProcessProducerField;
 import javax.enterprise.inject.spi.ProcessProducerMethod;
 import javax.enterprise.inject.spi.ProcessSyntheticAnnotatedType;
-import javax.enterprise.util.TypeLiteral;
+import javax.enterprise.inject.spi.ProcessSyntheticBean;
 
 import org.apache.webbeans.component.AbstractOwbBean;
 import org.apache.webbeans.config.OWBLogConst;
@@ -69,6 +69,7 @@ import org.apache.webbeans.exception.Web
 import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.logger.WebBeansLoggerFacade;
 import org.apache.webbeans.portable.events.ProcessSessionBeanImpl;
+import org.apache.webbeans.portable.events.generics.GProcessObserverMethod;
 import org.apache.webbeans.portable.events.generics.GenericBeanEvent;
 import org.apache.webbeans.portable.events.generics.GenericProducerObserverEvent;
 import org.apache.webbeans.portable.events.generics.TwoParametersGenericBeanEvent;
@@ -108,6 +109,7 @@ public final class NotificationManager
             ProcessAnnotatedType.class,
             ProcessBean.class,
             ProcessBeanAttributes.class,
+            ProcessSyntheticBean.class,
             ProcessInjectionPoint.class,
             ProcessInjectionTarget.class,
             ProcessManagedBean.class,
@@ -173,25 +175,20 @@ public final class NotificationManager
         return observerMethods;
     }
 
-    public <T> void addObserver(ObserverMethod<T> observer, Type eventType)
+    public <T> void addObserver(ObserverMethod<T> observer)
     {
         webBeansContext.getAnnotationManager().checkQualifierConditions(observer.getObservedQualifiers());
 
-        Set<ObserverMethod<?>> set = observers.get(eventType);
+        Set<ObserverMethod<?>> set = observers.get(observer.getObservedType());
         if (set == null)
         {
             set = new HashSet<ObserverMethod<?>>();
-            observers.put(eventType, set);
+            observers.put(observer.getObservedType(), set);
         }
 
         set.add(observer);
     }
 
-    public <T> void addObserver(ObserverMethod<T> observer, TypeLiteral<T>
typeLiteral)
-    {
-        addObserver(observer, typeLiteral.getType());
-    }
-
 
     public <T> Set<ObserverMethod<? super T>> resolveObservers(T event,
EventMetadataImpl metadata, boolean isLifecycleEvent)
     {
@@ -734,14 +731,37 @@ public final class NotificationManager
     public <T> ObserverMethod<?> getObservableMethodForAnnotatedMethod(AnnotatedMethod<?>
annotatedMethod, AnnotatedParameter<?> annotatedParameter, AbstractOwbBean<T>
bean)
     {
         Asserts.assertNotNull(annotatedParameter, "annotatedParameter");
-        
-        //Observer creation from annotated method
-        ObserverMethodImpl<T> observer = isContainerEvent(annotatedParameter)?
-                new ContainerEventObserverMethodImpl(bean, annotatedMethod, annotatedParameter)
:
-                new ObserverMethodImpl(bean, annotatedMethod, annotatedParameter);
-        
-        //Adds this observer
-        addObserver(observer, annotatedParameter.getBaseType());
+
+        ObserverMethodImpl<T> observer = null;
+        // Observer creation from annotated method
+        if (isContainerEvent(annotatedParameter))
+        {
+            observer = new ContainerEventObserverMethodImpl(bean, annotatedMethod, annotatedParameter);
+            addObserver(observer);
+        }
+        else
+        {
+            observer = new ObserverMethodImpl(bean, annotatedMethod, annotatedParameter);
+
+            GProcessObserverMethod event = new GProcessObserverMethod(annotatedMethod, observer);
+
+            //Fires ProcessObserverMethod
+            webBeansContext.getBeanManagerImpl().fireEvent(event, true, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+
+            webBeansContext.getWebBeansUtil().inspectDefinitionErrorStack("There are errors
that are added by ProcessObserverMethod event observers for " +
+                "observer methods. Look at logs for further details");
+
+            if (!event.isVetoed())
+            {
+                //Adds this observer
+                addObserver(event.getObserverMethod());
+            }
+            else
+            {
+                observer = null;
+            }
+            event.setStarted();
+        }
 
         return observer;
     }

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=1796702&r1=1796701&r2=1796702&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 May 29 21:27:10 2017
@@ -39,7 +39,8 @@ public class ProcessObserverMethodImpl<T
     private final AnnotatedMethod<X> annotatedMethod;
     
     /**ObserverMethod instance*/
-    private final ObserverMethod<T> observerMethod;
+    private ObserverMethod<T> observerMethod;
+    private boolean vetoed = false;
 
     public ProcessObserverMethodImpl(AnnotatedMethod<X> annotatedMethod,ObserverMethod<T>
observerMethod)
     {
@@ -84,18 +85,22 @@ public class ProcessObserverMethodImpl<T
         return observerMethod;
     }
 
-    //X TODO OWB-1182 CDI 2.0
     @Override
     public void setObserverMethod(ObserverMethod<T> observerMethod)
     {
-        throw new UnsupportedOperationException("CDI 2.0 not yet imlemented");
+        checkState();
+        this.observerMethod = observerMethod;
     }
 
-    //X TODO OWB-1182 CDI 2.0
     @Override
     public void veto()
     {
-        throw new UnsupportedOperationException("CDI 2.0 not yet imlemented");
+        checkState();
+        vetoed = true;
     }
 
+    public boolean isVetoed()
+    {
+        return vetoed;
+    }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java?rev=1796702&r1=1796701&r2=1796702&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
Mon May 29 21:27:10 2017
@@ -24,11 +24,11 @@ import javax.enterprise.inject.spi.After
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.Interceptor;
 import javax.enterprise.inject.spi.ObserverMethod;
-import javax.enterprise.inject.spi.ProcessBean;
-import javax.enterprise.inject.spi.ProcessObserverMethod;
+import javax.enterprise.inject.spi.ProcessSyntheticBean;
 import javax.enterprise.inject.spi.configurator.BeanConfigurator;
 import javax.enterprise.inject.spi.configurator.ObserverMethodConfigurator;
 
@@ -39,8 +39,8 @@ import org.apache.webbeans.container.Bea
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.intercept.InterceptorsManager;
 import org.apache.webbeans.logger.WebBeansLoggerFacade;
-import org.apache.webbeans.portable.events.generics.GProcessBean;
-import org.apache.webbeans.portable.events.generics.GProcessObservableMethod;
+import org.apache.webbeans.portable.events.generics.GProcessSyntheticBean;
+import org.apache.webbeans.portable.events.generics.GProcessSyntheticObserverMethod;
 import org.apache.webbeans.util.AnnotationUtil;
 
 import java.util.logging.Level;
@@ -52,12 +52,14 @@ import java.util.logging.Logger;
  * @version $Rev$ $Date$
  *
  */
-public class AfterBeanDiscoveryImpl implements AfterBeanDiscovery
+public class AfterBeanDiscoveryImpl implements AfterBeanDiscovery, ExtensionAware
 {
     private BeanManagerImpl beanManager = null;
 
     private static final Logger logger = WebBeansLoggerFacade.getLogger(AfterBeanDiscoveryImpl.class);
     private final WebBeansContext webBeansContext;
+
+    private Extension extension;
     private boolean started;
 
     public AfterBeanDiscoveryImpl(WebBeansContext webBeansContext)
@@ -71,6 +73,12 @@ public class AfterBeanDiscoveryImpl impl
         started = true;
     }
 
+    @Override
+    public void setExtension(Extension extension)
+    {
+        this.extension = extension;
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -85,8 +93,8 @@ public class AfterBeanDiscoveryImpl impl
         AnnotatedType<?> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(bean.getBeanClass());
 
         //Fire Event
-        ProcessBean<?> processBeanEvent = new GProcessBean(bean,annotatedType);
-        beanManager.fireEvent(processBeanEvent, true, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+        ProcessSyntheticBean<?> processSyntheticBean = new GProcessSyntheticBean(bean,annotatedType,
extension);
+        beanManager.fireEvent(processSyntheticBean, true, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
 
         if(bean instanceof Interceptor)
         {
@@ -214,9 +222,13 @@ public class AfterBeanDiscoveryImpl impl
         {
             throw new IllegalStateException("Don't call AfterBeanDiscovery.addObserverMethod(...)
after the event is fired");
         }
-        ProcessObserverMethod<?, ?> event = new GProcessObservableMethod(null,observerMethod);
-        beanManager.fireEvent(event, true, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
-        beanManager.getNotificationManager().addObserver(observerMethod, observerMethod.getObservedType());
+        GProcessSyntheticObserverMethod event = new GProcessSyntheticObserverMethod(null,observerMethod,
extension);
+        if (!event.isVetoed())
+        {
+            beanManager.fireEvent(event, true, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+            ObserverMethod newObserverMethod = event.getObserverMethod();
+            beanManager.getNotificationManager().addObserver(newObserverMethod);
+        }
     }
 
     /**

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=1796702&r1=1796701&r2=1796702&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 May 29 21:27:10 2017
@@ -20,6 +20,7 @@ package org.apache.webbeans.portable.eve
 
 import javax.enterprise.inject.spi.AfterTypeDiscovery;
 import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.configurator.AnnotatedTypeConfigurator;
 import java.util.List;
 
@@ -37,7 +38,7 @@ public class AfterTypeDiscoveryImpl exte
     private final List<Class<?>> sortedInterceptors;
     private final List<Class<?>> sortedDecorators;
     private final List<AnnotatedType<?>> newAt;
-    private Object extension;
+    private Extension extension;
 
     public AfterTypeDiscoveryImpl(WebBeansContext webBeansContext,
                                   List<AnnotatedType<?>> newAt,
@@ -89,7 +90,7 @@ public class AfterTypeDiscoveryImpl exte
     }
 
     @Override
-    public void setExtension(final Object instance)
+    public void setExtension(Extension instance)
     {
         this.extension = instance;
     }

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=1796702&r1=1796701&r2=1796702&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 May 29 21:27:10 2017
@@ -22,6 +22,7 @@ import java.lang.annotation.Annotation;
 
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.configurator.AnnotatedTypeConfigurator;
 
 import org.apache.webbeans.config.WebBeansContext;
@@ -40,7 +41,7 @@ public class BeforeBeanDiscoveryImpl imp
     
     private BeanManagerImpl beanManager = null;
     private final WebBeansContext webBeansContext;
-    private Object extension;
+    private Extension extension;
     private boolean started;
 
     public BeforeBeanDiscoveryImpl(WebBeansContext webBeansContext)
@@ -183,7 +184,7 @@ public class BeforeBeanDiscoveryImpl imp
         beanManager.addAdditionalQualifier(annotatedType);
     }
 
-    public void setExtension(final Object extension)
+    public void setExtension(final Extension extension)
     {
         this.extension = extension;
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ExtensionAware.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ExtensionAware.java?rev=1796702&r1=1796701&r2=1796702&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ExtensionAware.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ExtensionAware.java
Mon May 29 21:27:10 2017
@@ -18,7 +18,9 @@
  */
 package org.apache.webbeans.portable.events.discovery;
 
+import javax.enterprise.inject.spi.Extension;
+
 public interface ExtensionAware
 {
-    void setExtension(Object instance);
+    void setExtension(Extension instance);
 }

Copied: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObserverMethod.java
(from r1796701, openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java)
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObserverMethod.java?p2=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObserverMethod.java&p1=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java&r1=1796701&r2=1796702&rev=1796702&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObserverMethod.java
Mon May 29 21:27:10 2017
@@ -25,10 +25,10 @@ import org.apache.webbeans.portable.even
 import org.apache.webbeans.util.ClassUtil;
 
 @SuppressWarnings("unchecked")
-public class GProcessObservableMethod extends ProcessObserverMethodImpl implements GenericProducerObserverEvent
+public class GProcessObserverMethod extends ProcessObserverMethodImpl implements GenericProducerObserverEvent
 {
 
-    public GProcessObservableMethod(AnnotatedMethod<?> annotatedMethod, ObserverMethod<?>
observerMethod)
+    public GProcessObserverMethod(AnnotatedMethod<?> annotatedMethod, ObserverMethod<?>
observerMethod)
     {
         super(annotatedMethod, observerMethod);
     }

Copied: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticBean.java
(from r1796675, openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java)
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticBean.java?p2=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticBean.java&p1=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java&r1=1796675&r2=1796702&rev=1796702&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticBean.java
Mon May 29 21:27:10 2017
@@ -19,21 +19,26 @@
 package org.apache.webbeans.portable.events.generics;
 
 import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessSyntheticBean;
 
-import org.apache.webbeans.component.ManagedBean;
-import org.apache.webbeans.portable.events.ProcessManagedBeanImpl;
 
 @SuppressWarnings("unchecked")
-public class GProcessManagedBean extends ProcessManagedBeanImpl implements GenericBeanEvent
+public class GProcessSyntheticBean extends GProcessBean implements ProcessSyntheticBean
 {
-    public GProcessManagedBean(ManagedBean<?> bean,AnnotatedType<?> annotated)
+    private final Extension source;
+
+    public GProcessSyntheticBean(Bean<?> bean, AnnotatedType<?> annotated, Extension
source)
     {
         super(bean,annotated);
+        this.source = source;
     }
 
+
     @Override
-    public Class<?> getBeanClassFor(Class<?> eventClass)
+    public Extension getSource()
     {
-        return getBean().getBeanClass();
+        return source;
     }
 }

Copied: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticObserverMethod.java
(from r1796675, openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java)
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticObserverMethod.java?p2=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticObserverMethod.java&p1=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java&r1=1796675&r2=1796702&rev=1796702&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticObserverMethod.java
Mon May 29 21:27:10 2017
@@ -19,32 +19,27 @@
 package org.apache.webbeans.portable.events.generics;
 
 import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.ProcessSyntheticObserverMethod;
 
-import org.apache.webbeans.portable.events.ProcessObserverMethodImpl;
-import org.apache.webbeans.util.ClassUtil;
 
 @SuppressWarnings("unchecked")
-public class GProcessObservableMethod extends ProcessObserverMethodImpl implements GenericProducerObserverEvent
+public class GProcessSyntheticObserverMethod extends GProcessObserverMethod implements ProcessSyntheticObserverMethod
 {
+    private final Extension source;
 
-    public GProcessObservableMethod(AnnotatedMethod<?> annotatedMethod, ObserverMethod<?>
observerMethod)
+    public GProcessSyntheticObserverMethod(AnnotatedMethod<?> annotatedMethod,
+                                           ObserverMethod<?> observerMethod,
+                                           Extension source)
     {
         super(annotatedMethod, observerMethod);
+        this.source = source;
     }
 
     @Override
-    public Class<?> getBeanClass()
+    public Extension getSource()
     {
-        return getObserverMethod().getBeanClass();
+        return source;
     }
-
-    @Override
-    public Class<?> getProducerOrObserverType()
-    {
-        return ClassUtil.getClazz(getObserverMethod().getObservedType());
-    }
-
-    
-    
 }

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=1796702&r1=1796701&r2=1796702&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 May 29 21:27:10 2017
@@ -73,7 +73,7 @@ import org.apache.webbeans.portable.even
 import org.apache.webbeans.portable.events.generics.GProcessInjectionPoint;
 import org.apache.webbeans.portable.events.generics.GProcessInjectionTarget;
 import org.apache.webbeans.portable.events.generics.GProcessManagedBean;
-import org.apache.webbeans.portable.events.generics.GProcessObservableMethod;
+import org.apache.webbeans.portable.events.generics.GProcessObserverMethod;
 import org.apache.webbeans.portable.events.generics.GProcessProducer;
 import org.apache.webbeans.portable.events.generics.GProcessProducerField;
 import org.apache.webbeans.portable.events.generics.GProcessProducerMethod;
@@ -109,7 +109,6 @@ import javax.enterprise.inject.spi.Befor
 import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.Interceptor;
-import javax.enterprise.inject.spi.ObserverMethod;
 import javax.enterprise.inject.spi.PassivationCapable;
 import javax.enterprise.inject.spi.ProcessAnnotatedType;
 import javax.enterprise.inject.spi.ProcessBean;
@@ -1095,20 +1094,6 @@ public final class WebBeansUtil
         }
     }
 
-    public void fireProcessObservableMethodBeanEvent(Map<ObserverMethod<?>,AnnotatedMethod<?>>
annotatedMethods)
-    {
-        for(Map.Entry<ObserverMethod<?>, AnnotatedMethod<?>> observableMethodEntry
: annotatedMethods.entrySet())
-        {
-            ObserverMethod<?> observableMethod = observableMethodEntry.getKey();
-            AnnotatedMethod<?> annotatedMethod = observableMethodEntry.getValue();
-
-            GProcessObservableMethod event = new GProcessObservableMethod(annotatedMethod,
observableMethod);
-
-            //Fires ProcessProducer
-            webBeansContext.getBeanManagerImpl().fireEvent(event, true, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
-            event.setStarted();
-        }
-    }
 
 
     public void fireProcessProducerFieldBeanEvent(Map<ProducerFieldBean<?>,AnnotatedField<?>>
annotatedFields)
@@ -1295,7 +1280,7 @@ public final class WebBeansUtil
             GProcessProducer.class,
             GProcessProducerField.class,
             GProcessProducerMethod.class,
-            GProcessObservableMethod.class}));
+            GProcessObserverMethod.class}));
     public static boolean isExtensionProducerOrObserverEventType(Type type)
     {
         return EXTENSION_PRODUCER_OR_OBSERVER_EVENT_TYPE.contains(type);

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java?rev=1796702&r1=1796701&r2=1796702&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java
Mon May 29 21:27:10 2017
@@ -63,7 +63,7 @@ public class TypeArgumentInterfaceObserv
 
     @Override
     public Type getObservedType() {
-        return null;
+        return ITypeArgumentEventInterface.class;
     }
 
     @Override

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java?rev=1796702&r1=1796701&r2=1796702&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java
Mon May 29 21:27:10 2017
@@ -64,7 +64,7 @@ public class TypeArgumentObserver implem
 
     @Override
     public Type getObservedType() {
-        return null;
+        return TypeArgumentBaseEvent.class;
     }
 
     @Override

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java?rev=1796702&r1=1796701&r2=1796702&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/EventTest.java
Mon May 29 21:27:10 2017
@@ -21,7 +21,6 @@ package org.apache.webbeans.test.unittes
 import java.lang.annotation.Annotation;
 
 import javax.enterprise.util.AnnotationLiteral;
-import javax.enterprise.util.TypeLiteral;
 
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.test.AbstractUnitTest;
@@ -49,7 +48,7 @@ public class EventTest extends AbstractU
         };
 
         LoggedInObserver observer = new LoggedInObserver(ArrayUtil.asSet(anns));
-        WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer,
LoggedInEvent.class);
+        WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer);
 
         getBeanManager().fireEvent(new LoggedInEvent(), anns);
 
@@ -66,11 +65,8 @@ public class EventTest extends AbstractU
         };
 
         TypeArgumentObserver observer = new TypeArgumentObserver(ArrayUtil.asSet(anns));
-        TypeLiteral<TypeArgumentBaseEvent> tl = new TypeLiteral<TypeArgumentBaseEvent>()
-        {
-        };
 
-        WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer,
tl);
+        WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer);
 
         getBeanManager().fireEvent(new TypeArgumentEvent(), anns);
 
@@ -87,7 +83,7 @@ public class EventTest extends AbstractU
         };
 
         TypeArgumentInterfaceObserver observer = new TypeArgumentInterfaceObserver(ArrayUtil.asSet(anns));
-        WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer,
ITypeArgumentEventInterface.class);
+        WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer);
 
         getBeanManager().fireEvent(new TypeArgumentEvent(), anns);
         Assert.assertEquals("ok", observer.getResult());

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java?rev=1796702&r1=1796701&r2=1796702&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/unittests/event/exception/EventExceptionTest.java
Mon May 29 21:27:10 2017
@@ -95,7 +95,7 @@ public class EventExceptionTest extends
             };
 
             LoggedInObserver observer = new LoggedInObserver(ArrayUtil.asSet(anns));
-            WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer,
LoggedInEvent.class);
+            WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer);
 
             getBeanManager().fireEvent(new LoggedInEvent(), anns);
 
@@ -121,7 +121,7 @@ public class EventExceptionTest extends
             };
             
             LoggedInObserver observer = new LoggedInObserver(ArrayUtil.asSet(anns));
-            WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer,
LoggedInEvent.class);
+            WebBeansContext.getInstance().getBeanManagerImpl().getNotificationManager().addObserver(observer);
             Assert.fail("IllegalArgumentException expected");
         }
         catch (IllegalArgumentException e)



Mime
View raw message