openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r824190 - in /incubator/openwebbeans/trunk: samples/guess/src/main/java/org/apache/webbeans/sample/observer/ src/site/ src/site/apt/ webbeans-api/ webbeans-api/src/main/java/javax/enterprise/event/ webbeans-api/src/main/java/javax/enterpris...
Date Sun, 11 Oct 2009 22:45:09 GMT
Author: struberg
Date: Sun Oct 11 22:45:08 2009
New Revision: 824190

URL: http://svn.apache.org/viewvc?rev=824190&view=rev
Log:
OWB-140 remove obsolete @Observer and additionally remove TransactionalObserverType and ChildActivityManager

These steps have been necessary to be in sync with the latest spec.

Added:
    incubator/openwebbeans/trunk/src/site/apt/jsr330.apt   (with props)
Removed:
    incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/event/Observer.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ChildActivityManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/TransactionalObserverType.java
Modified:
    incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/observer/LoggedInObserver.java
    incubator/openwebbeans/trunk/src/site/apt/jsr299.apt
    incubator/openwebbeans/trunk/src/site/site.xml
    incubator/openwebbeans/trunk/webbeans-api/pom.xml
    incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/AfterBeanDiscovery.java
    incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/BeanManager.java
    incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java
    incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/ProcessObserverMethod.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java

Modified: incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/observer/LoggedInObserver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/observer/LoggedInObserver.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/observer/LoggedInObserver.java
(original)
+++ incubator/openwebbeans/trunk/samples/guess/src/main/java/org/apache/webbeans/sample/observer/LoggedInObserver.java
Sun Oct 11 22:45:08 2009
@@ -17,13 +17,17 @@
 package org.apache.webbeans.sample.observer;
 
 
+import javax.enterprise.event.Observes;
+
 import org.apache.webbeans.sample.event.LoggedInEvent;
 import org.apache.webbeans.sample.model.User;
 
-public class LoggedInObserver implements javax.enterprise.event.Observer<LoggedInEvent>
+
+
+public class LoggedInObserver
 {
 
-	public void notify(LoggedInEvent event)
+	public void afterLogin(@Observes LoggedInEvent event)
 	{
 		User user = event.getUser();
 		System.out.println("User with user name : " + user.getUserName());

Modified: incubator/openwebbeans/trunk/src/site/apt/jsr299.apt
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/src/site/apt/jsr299.apt?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/src/site/apt/jsr299.apt (original)
+++ incubator/openwebbeans/trunk/src/site/apt/jsr299.apt Sun Oct 11 22:45:08 2009
@@ -9,7 +9,7 @@
 ~~ 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.
-JSR-299 WebBeans
+JSR-299 Contexts and Dependency Injection for the Java EE platform
 
   The purpose of the WebBeans specification is to unify the JSF managed bean component model

   with the EJB component model, resulting in a significantly simplified programming model


Added: incubator/openwebbeans/trunk/src/site/apt/jsr330.apt
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/src/site/apt/jsr330.apt?rev=824190&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/src/site/apt/jsr330.apt (added)
+++ incubator/openwebbeans/trunk/src/site/apt/jsr330.apt Sun Oct 11 22:45:08 2009
@@ -0,0 +1,21 @@
+~~ 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.
+JSR-330 Dependency Injection for Java
+
+  The purpose of the JSR-330 'atinject' specification is to provide basic dependency
+  injection annotations for Java.
+
+* Official Resources
+    
+  *  {{{http://www.jcp.org/en/jsr/detail?id=330}Java Specification Request 330}}
+  
+  * TODO googlecode page

Propchange: incubator/openwebbeans/trunk/src/site/apt/jsr330.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/openwebbeans/trunk/src/site/apt/jsr330.apt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: incubator/openwebbeans/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/src/site/site.xml?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/src/site/site.xml (original)
+++ incubator/openwebbeans/trunk/src/site/site.xml Sun Oct 11 22:45:08 2009
@@ -43,6 +43,7 @@
 
         <menu name="OpenWebBeans">
             <item name="JSR-299" href="jsr299.html" />
+            <item name="JSR-330" href="jsr330.html" />
             <item name="Contributing" href="contributing.html" />
             <item name="IRC" href="irc.html" />
             <item name="FAQ" href="faq.html" />

Modified: incubator/openwebbeans/trunk/webbeans-api/pom.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-api/pom.xml?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-api/pom.xml (original)
+++ incubator/openwebbeans/trunk/webbeans-api/pom.xml Sun Oct 11 22:45:08 2009
@@ -42,7 +42,6 @@
         <dependency>
             <groupId>org.apache.openwebbeans</groupId>
             <artifactId>atinject-api</artifactId>
-            <scope>compile</scope>
         </dependency>
     </dependencies>
 </project>

Modified: incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/AfterBeanDiscovery.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/AfterBeanDiscovery.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/AfterBeanDiscovery.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/AfterBeanDiscovery.java
Sun Oct 11 22:45:08 2009
@@ -48,7 +48,7 @@
      * 
      * @param observerMethod observer method
      */
-    public void addObserverMethod(ObserverMethod<?, ?> observerMethod);
+    public void addObserverMethod(ObserverMethod<?> observerMethod);
     
     /**
      * Adds given context to the container.

Modified: incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/BeanManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/BeanManager.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/BeanManager.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/BeanManager.java
Sun Oct 11 22:45:08 2009
@@ -28,7 +28,6 @@
 import javax.enterprise.context.spi.Context;
 import javax.enterprise.context.spi.Contextual;
 import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observer;
 import javax.enterprise.inject.AmbiguousResolutionException;
 import javax.enterprise.inject.InjectionException;
 import javax.enterprise.inject.UnsatisfiedResolutionException;
@@ -150,20 +149,7 @@
      * @throws IllegalArgumentException same qualifier is given
      */
     public void fireEvent(Object event, Annotation... qualifiers);
-    
-    /**
-     * Returns a set of observers that observe for given event type and qualifiers
-     * 
-     * @param <T> observer type info
-     * @param event observer event type
-     * @param qualifiers event qualifiers
-     * @return set of observers that observe for given event type and qualifiers
-     * @throws IllegalArgumentException event object contains a {@link TypeVariable}
-     * @throws IllegalArgumentException given qualifier annotation is not a qualifier
-     * @throws IllegalArgumentException same qualifier is given
-     */
-    public <T> Set<Observer<T>> resolveObservers(T event, Annotation...
qualifiers);
-    
+        
     /**
      * Returns set of observer methods.
      * 
@@ -172,7 +158,7 @@
      * @param qualifiers event qualifiers
      * @return set of observer methods
      */
-    public <T> Set<ObserverMethod<?,T>> resolveObserverMethods(T event,
Annotation... qualifiers);
+    public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(T
event, Annotation... qualifiers);
     
     /**
      * Returns a list of decorator.

Modified: incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/ObserverMethod.java
Sun Oct 11 22:45:08 2009
@@ -25,9 +25,9 @@
 import javax.enterprise.event.Reception;
 import javax.enterprise.event.TransactionPhase;
 
-public interface ObserverMethod<X,T>
+public interface ObserverMethod<T>
 {
-    public Bean<X> getBean();
+    public Class<?> getBeanClass();
     
     public Type getObservedType();
     

Modified: incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/ProcessObserverMethod.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/ProcessObserverMethod.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/ProcessObserverMethod.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-api/src/main/java/javax/enterprise/inject/spi/ProcessObserverMethod.java
Sun Oct 11 22:45:08 2009
@@ -41,7 +41,7 @@
      * 
      * @return observer method instance
      */
-    public ObserverMethod<X,T> getObserverMethod();
+    public ObserverMethod<X> getObserverMethod();
 
     /**
      * Add throwable.

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Sun Oct 11 22:45:08 2009
@@ -37,7 +37,6 @@
 import javax.enterprise.context.spi.Contextual;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.event.Event;
-import javax.enterprise.event.Observer;
 import javax.enterprise.inject.AmbiguousResolutionException;
 import javax.enterprise.inject.Default;
 import javax.enterprise.inject.TypeLiteral;
@@ -381,15 +380,6 @@
         return this.injectionResolver.implResolveByType(apiType.getType(), bindingTypes);
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public <T> Set<Observer<T>> resolveObservers(T event, Annotation...
bindings)
-    {
-        return this.notificationManager.resolveObservers(event, bindings);
-    }
-
     
     public Set<Bean<?>> getComponents()
     {
@@ -526,15 +516,6 @@
     }
 
     /**
-     * Create a new ChildActivityManager.
-     */
-    
-    public BeanManager createActivity()
-    {
-        return new ChildActivityManager(this);
-    }
-
-    /**
      * Set the activity for the given scope type.
      * 
      * @param scopeType scope type for the context
@@ -937,14 +918,11 @@
         return null;
     }
 
-    /**
-     * {@inheritDoc}
-     */
     @Override
-    public <T> Set<ObserverMethod<?, T>> resolveObserverMethods(T event,
Annotation... bindings)
-    {
+    public <T> Set<ObserverMethod<? super T>> resolveObserverMethods( T
event, Annotation... qualifiers ) {
         // TODO Auto-generated method stub
         return null;
     }
 
+
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/BeanObserverImpl.java
Sun Oct 11 22:45:08 2009
@@ -19,11 +19,15 @@
 import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 import javax.enterprise.context.Dependent;
 import javax.enterprise.context.spi.Context;
-import javax.enterprise.event.Observer;
 import javax.enterprise.event.Observes;
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ObserverMethod;
 
 import org.apache.webbeans.annotation.DefaultLiteral;
 import org.apache.webbeans.component.AbstractBean;
@@ -58,7 +62,7 @@
  *
  * @param <T> event type
  */
-public class BeanObserverImpl<T> implements Observer<T>
+public class BeanObserverImpl<T> implements ObserverMethod<T>
 {
     /**Logger instance*/
     private static final WebBeansLogger logger = WebBeansLogger.getLogger(BeanObserverImpl.class);
@@ -72,9 +76,6 @@
     /**Using existing bean instance or not*/
     private final boolean ifExist;
 
-    /**Observer transaction type*/
-    private final TransactionalObserverType type;
-
     /**
      * Creates a new bean observer instance.
      * 
@@ -83,12 +84,11 @@
      * @param ifExist if exist parameter
      * @param type transaction type
      */
-    public BeanObserverImpl(InjectionTargetBean<?> bean, Method observerMethod, boolean
ifExist, TransactionalObserverType type)
+    public BeanObserverImpl(InjectionTargetBean<?> bean, Method observerMethod, boolean
ifExist)
     {
         this.bean = bean;
         this.observerMethod = observerMethod;
         this.ifExist = ifExist;
-        this.type = type;
     }
 
     /**
@@ -147,14 +147,7 @@
         }
         catch (Exception e)
         {
-            if (!getType().equals(TransactionalObserverType.NONE))
-            {
-                logger.error("Error is occured while notifying observer in class : " + observerMethod.getDeclaringClass().getName()
+ " in method : " + observerMethod.getName(), e);
-            }
-            else
-            {
-                throw new WebBeansException(e.getCause());
-            }
+                throw new WebBeansException(e);
         }
         finally
         {
@@ -232,23 +225,33 @@
     }
 
     /**
-     * Returrns observer owner bean.
+     * Returns observer owner bean.
      * 
      * @return the bean
      */
-    public InjectionTargetBean<?> getBean()
+    public Class<?> getBeanClass()
     {
-        return bean;
+        return bean.getClass();
     }
 
-    /**
-     * Returns observer's transactional type.
-     * 
-     * @return transactional type
-     */
-    public TransactionalObserverType getType()
-    {
-        return type;
+    public Set<Annotation> getObservedQualifiers() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Type getObservedType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public Reception getReception() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public TransactionPhase getTransactionPhase() {
+        // TODO Auto-generated method stub
+        return null;
     }
 
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/EventUtil.java
Sun Oct 11 22:45:08 2009
@@ -53,31 +53,15 @@
         AnnotationUtil.checkQualifierConditions(annotations);
     }
 
-    public static TransactionalObserverType getObserverMethodTransactionType(Method observerMethod)
+    public static TransactionPhase getObserverMethodTransactionType(Method observerMethod)
     {
         Observes observes = AnnotationUtil.getMethodFirstParameterAnnotation(observerMethod,
Observes.class);
-        
-        if (observes.during().equals(TransactionPhase.AFTER_COMPLETION))
-        {
-            return TransactionalObserverType.AFTER_TRANSACTION_COMPLETION;
-        }
-        else if (observes.during().equals(TransactionPhase.AFTER_SUCCESS))
-        {
-            return TransactionalObserverType.AFTER_TRANSACTION_SUCCESS;
-        }
-        else if (observes.during().equals(TransactionPhase.AFTER_FAILURE))
-        {
-            return TransactionalObserverType.AFTER_TRANSACTION_FAILURE;
-        }
-        else if (observes.during().equals(TransactionPhase.BEFORE_COMPLETION))
-        {
-            return TransactionalObserverType.BEFORE_TRANSACTION_COMPLETION;
-        }
-        else
+        if (observes != null)
         {
-            return TransactionalObserverType.NONE;
+            return observes.during();
         }
-
+        
+        return null;
     }
 
     public static void checkObserverMethodConditions(Method candidateObserverMethod, Class<?>
clazz)

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/NotificationManager.java
Sun Oct 11 22:45:08 2009
@@ -23,12 +23,13 @@
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 
-import javax.enterprise.event.Observer;
 import javax.enterprise.event.ObserverException;
 import javax.enterprise.event.Observes;
 import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
 import javax.enterprise.inject.Default;
 import javax.enterprise.inject.TypeLiteral;
+import javax.enterprise.inject.spi.ObserverMethod;
 import javax.transaction.Status;
 import javax.transaction.Synchronization;
 import javax.transaction.Transaction;
@@ -66,7 +67,7 @@
         return manager.getNotificationManager();
     }
 
-    public <T> void addObserver(Observer<T> observer, Type eventType, Annotation...
annotations)
+    public <T> void addObserver(ObserverMethod<T> observer, Type eventType, Annotation...
annotations)
     {
         EventUtil.checkEventBindings(annotations);
 
@@ -80,14 +81,14 @@
         set.add(new ObserverWrapper<T>(observer, annotations));
     }
 
-    public <T> void addObserver(Observer<T> observer, TypeLiteral<T> typeLiteral,
Annotation... annotations)
+    public <T> void addObserver(ObserverMethod<T> observer, TypeLiteral<T>
typeLiteral, Annotation... annotations)
     {
         EventUtil.checkEventType(typeLiteral.getRawType());
 
         addObserver(observer, typeLiteral.getRawType(), annotations);
     }
 
-    public <T> void removeObserver(Observer<T> observer, Class<T> eventType,
Annotation... annotations)
+    public <T> void removeObserver(ObserverMethod<T> observer, Class<T>
eventType, Annotation... annotations)
     {
         EventUtil.checkEventType(eventType);
         EventUtil.checkEventBindings(annotations);
@@ -97,7 +98,7 @@
             Set<ObserverWrapper<?>> set = observers.get(eventType);
             for (ObserverWrapper<?> s : set)
             {
-                Observer<T> ob = (Observer<T>) s.getObserver();
+                ObserverMethod<T> ob = (ObserverMethod<T>) s.getObserver();
 
                 Set<Annotation> evenBindings = s.getQualifiers();
                 Annotation[] anns = new Annotation[evenBindings.size()];
@@ -111,12 +112,12 @@
         }
     }
 
-    public <T> void removeObserver(Observer<T> observer, TypeLiteral<T>
typeLiteral, Annotation... annotations)
+    public <T> void removeObserver(ObserverMethod<T> observer, TypeLiteral<T>
typeLiteral, Annotation... annotations)
     {
         removeObserver(observer, typeLiteral.getRawType(), annotations);
     }
 
-    public <T> Set<Observer<T>> resolveObservers(T event, Annotation...
eventQualifiers)
+    public <T> Set<ObserverMethod<T>> resolveObservers(T event, Annotation...
eventQualifiers)
     {
         EventUtil.checkEventBindings(eventQualifiers);
 
@@ -187,9 +188,9 @@
         return matching;
     }
 
-    private <T> Set<Observer<T>> unwrap(Set<ObserverWrapper<T>>
wrappers)
+    private <T> Set<ObserverMethod<T>> unwrap(Set<ObserverWrapper<T>>
wrappers)
     {
-        Set<Observer<T>> observers = new HashSet<Observer<T>>();
+        Set<ObserverMethod<T>> observers = new HashSet<ObserverMethod<T>>();
 
         for (ObserverWrapper<T> wrapper : wrappers)
         {
@@ -203,36 +204,34 @@
     {
         Transaction transaction = transactionService.getTransaction();
 
-        Set<Observer<Object>> observers = resolveObservers(event, qualifiers);
+        Set<ObserverMethod<Object>> observers = resolveObservers(event, qualifiers);
 
-        for (Observer<Object> observer: observers)
+        for (ObserverMethod<Object> observer: observers)
         {
             try
             {
-                if (transaction != null && isTransactional(observer))
+                TransactionPhase phase = observer.getTransactionPhase();
+                if (transaction != null && phase != null)
                 {
-                    BeanObserverImpl<Object> beanObserver = (BeanObserverImpl<Object>)
observer;
-
-                    TransactionalObserverType type = beanObserver.getType();
-
-                    if (type.equals(TransactionalObserverType.AFTER_TRANSACTION_COMPLETION))
+                    if (phase.equals(TransactionPhase.AFTER_COMPLETION))
                     {
                         transaction.registerSynchronization(new AfterCompletion(observer,
event));
                     }
-                    else if (type.equals(TransactionalObserverType.AFTER_TRANSACTION_SUCCESS))
+                    else if (phase.equals(TransactionPhase.AFTER_SUCCESS))
                     {
                         transaction.registerSynchronization(new AfterCompletionSuccess(observer,
event));
                     }
-                    else if (type.equals(TransactionalObserverType.AFTER_TRANSACTION_FAILURE))
+                    else if (phase.equals(TransactionPhase.AFTER_FAILURE))
                     {
                         transaction.registerSynchronization(new AfterCompletionFailure(observer,
event));
                     }
-                    else if (type.equals(TransactionalObserverType.BEFORE_TRANSACTION_COMPLETION))
+                    else if (phase.equals(TransactionPhase.BEFORE_COMPLETION))
                     {
                         transaction.registerSynchronization(new BeforeCompletion(observer,
event));
                     }
-                    else {
-                        throw new IllegalStateException("TransactionalObserverType not supported:
" + type);
+                    else 
+                    {
+                        throw new IllegalStateException("TransactionPhase not supported:
" + phase);
                     }
                 }
                 else
@@ -264,23 +263,6 @@
         }
     }
 
-    private boolean isTransactional(Observer<?> observer)
-    {
-        if (!(observer instanceof BeanObserverImpl))
-        {
-            return false;
-        }
-
-        BeanObserverImpl<?> beanObserver = (BeanObserverImpl<?>) observer;
-
-        if (beanObserver.getType().equals(TransactionalObserverType.NONE))
-        {
-            return false;
-        }
-
-        return true;
-    }
-
     public <T> void addObservableComponentMethods(InjectionTargetBean<?> component)
     {
         Asserts.assertNotNull(component, "component parameter can not be null");
@@ -299,9 +281,9 @@
                 ifExist = true;
             }
 
-            TransactionalObserverType type = EventUtil.getObserverMethodTransactionType(observableMethod);
+            //X TODO TransactionPhase phase = EventUtil.getObserverMethodTransactionType(observableMethod);
 
-            BeanObserverImpl<T> observer = new BeanObserverImpl(component, observableMethod,
ifExist, type);
+            BeanObserverImpl<T> observer = new BeanObserverImpl(component, observableMethod,
ifExist);
 
             Class<T> clazz = (Class<T>) AnnotationUtil.getMethodFirstParameterTypeClazzWithAnnotation(observableMethod,
Observes.class);
 
@@ -339,9 +321,9 @@
         private final Set<Annotation> qualifiers;
 
         /**Wrapped observer instance*/
-        private final Observer<T> observer;
+        private final ObserverMethod<T> observer;
 
-        public ObserverWrapper(Observer<T> observer, Annotation... qualifiers)
+        public ObserverWrapper(ObserverMethod<T> observer, Annotation... qualifiers)
         {
             this.qualifiers = toQualiferSet(qualifiers);
             this.qualifiers.remove(Default.class);
@@ -353,7 +335,7 @@
             return this.qualifiers;
         }
 
-        public Observer<T> getObserver()
+        public ObserverMethod<T> getObserver()
         {
             return observer;
         }
@@ -361,10 +343,10 @@
 
     private static class AbstractSynchronization<T> implements Synchronization {
 
-        private final Observer<T> observer;
+        private final ObserverMethod<T> observer;
         private final T event;
 
-        public AbstractSynchronization(Observer<T> observer, T event)
+        public AbstractSynchronization(ObserverMethod<T> observer, T event)
         {
             this.observer = observer;
             this.event = event;
@@ -391,7 +373,7 @@
     }
 
     private static class BeforeCompletion extends AbstractSynchronization {
-        private BeforeCompletion(Observer observer, Object event)
+        private BeforeCompletion(ObserverMethod observer, Object event)
         {
             super(observer, event);
         }
@@ -404,7 +386,7 @@
     }
 
     private static class AfterCompletion extends AbstractSynchronization {
-        private AfterCompletion(Observer observer, Object event)
+        private AfterCompletion(ObserverMethod observer, Object event)
         {
             super(observer, event);
         }
@@ -417,7 +399,7 @@
     }
 
     private static class AfterCompletionSuccess extends AbstractSynchronization {
-        private AfterCompletionSuccess(Observer observer, Object event)
+        private AfterCompletionSuccess(ObserverMethod observer, Object event)
         {
             super(observer, event);
         }
@@ -433,7 +415,7 @@
     }
 
     private static class AfterCompletionFailure extends AbstractSynchronization {
-        private AfterCompletionFailure(Observer observer, Object event)
+        private AfterCompletionFailure(ObserverMethod observer, Object event)
         {
             super(observer, event);
         }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/event/xml/BeanObserverXMLImpl.java
Sun Oct 11 22:45:08 2009
@@ -23,16 +23,15 @@
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.event.BeanObserverImpl;
-import org.apache.webbeans.event.TransactionalObserverType;
 import org.apache.webbeans.inject.xml.XMLInjectionPointModel;
 
 public class BeanObserverXMLImpl<T> extends BeanObserverImpl<T>
 {
     private List<XMLInjectionPointModel> observersParameters = new ArrayList<XMLInjectionPointModel>();
 
-    public BeanObserverXMLImpl(InjectionTargetBean<?> bean, Method observerMethod,
boolean ifExist, TransactionalObserverType type)
+    public BeanObserverXMLImpl(InjectionTargetBean<?> bean, Method observerMethod,
boolean ifExist)
     {
-        super(bean, observerMethod, ifExist, type);
+        super(bean, observerMethod, ifExist);
     }
 
     /*

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java
Sun Oct 11 22:45:08 2009
@@ -31,9 +31,9 @@
     private final AnnotatedMethod<X> annotatedMethod;
     
     /**ObserverMethod instance*/
-    private final ObserverMethod<X, T> observerMethod;
+    private final ObserverMethod<X> observerMethod;
 
-    public ProcessObserverMethodImpl(AnnotatedMethod<X> annotatedMethod,ObserverMethod<X,
T> observerMethod)
+    public ProcessObserverMethodImpl(AnnotatedMethod<X> annotatedMethod,ObserverMethod<X>
observerMethod)
     {
         this.annotatedMethod = annotatedMethod;
         this.observerMethod = observerMethod;
@@ -62,7 +62,7 @@
      * {@inheritDoc}
      */
     @Override
-    public ObserverMethod<X, T> getObserverMethod()
+    public ObserverMethod<X> getObserverMethod()
     {
         return this.observerMethod;
     }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
Sun Oct 11 22:45:08 2009
@@ -61,7 +61,7 @@
      * {@inheritDoc}
      */
     @Override
-    public void addObserverMethod(ObserverMethod<?, ?> observerMethod)
+    public void addObserverMethod(ObserverMethod<?> observerMethod)
     {
         // TODO Auto-generated method stub
         

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/xml/XMLDefinitionUtil.java
Sun Oct 11 22:45:08 2009
@@ -44,7 +44,6 @@
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.decorator.WebBeansDecoratorConfig;
 import org.apache.webbeans.event.NotificationManager;
-import org.apache.webbeans.event.TransactionalObserverType;
 import org.apache.webbeans.event.xml.BeanObserverXMLImpl;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.exception.definition.NonexistentFieldException;
@@ -711,7 +710,7 @@
         /* Other parameter elements other than @Observes */
         List<Element> otherParameterElements = new ArrayList<Element>();
 
-        BeanObserverXMLImpl<K> beanObserver = new BeanObserverXMLImpl<K>(component,
observesMethod, false, TransactionalObserverType.NONE);
+        BeanObserverXMLImpl<K> beanObserver = new BeanObserverXMLImpl<K>(component,
observesMethod, false);
 
         Class<K> eventType = null;
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/LoggedInObserver.java
Sun Oct 11 22:45:08 2009
@@ -13,9 +13,16 @@
  */
 package org.apache.webbeans.test.event;
 
-import javax.enterprise.event.Observer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
 
-public class LoggedInObserver implements Observer<LoggedInEvent>
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
+
+
+public class LoggedInObserver implements ObserverMethod<LoggedInEvent>
 {
     private String result = null;
 
@@ -41,4 +48,34 @@
         this.result = result;
     }
 
+    @Override
+    public Class<?> getBeanClass() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Set<Annotation> getObservedQualifiers() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Type getObservedType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Reception getReception() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public TransactionPhase getTransactionPhase() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentInterfaceObserver.java
Sun Oct 11 22:45:08 2009
@@ -13,9 +13,16 @@
  */
 package org.apache.webbeans.test.event;
 
-import javax.enterprise.event.Observer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
 
-public class TypeArgumentInterfaceObserver implements Observer<ITypeArgumentEventInterface>
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
+
+
+public class TypeArgumentInterfaceObserver implements ObserverMethod<ITypeArgumentEventInterface>
 {
     private String result;
 
@@ -29,4 +36,34 @@
         return this.result;
     }
 
+    @Override
+    public Class<?> getBeanClass() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Set<Annotation> getObservedQualifiers() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Type getObservedType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Reception getReception() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public TransactionPhase getTransactionPhase() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/TypeArgumentObserver.java
Sun Oct 11 22:45:08 2009
@@ -13,9 +13,16 @@
  */
 package org.apache.webbeans.test.event;
 
-import javax.enterprise.event.Observer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
 
-public class TypeArgumentObserver implements Observer<TypeArgumentBaseEvent>
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
+
+
+public class TypeArgumentObserver implements ObserverMethod<TypeArgumentBaseEvent>
 {
     private String result = null;
 
@@ -29,4 +36,34 @@
     {
         return result;
     }
+
+    @Override
+    public Class<?> getBeanClass() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Set<Annotation> getObservedQualifiers() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Type getObservedType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Reception getReception() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public TransactionPhase getTransactionPhase() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/event/broke/BrokenObserver.java
Sun Oct 11 22:45:08 2009
@@ -13,10 +13,17 @@
  */
 package org.apache.webbeans.test.event.broke;
 
-import javax.enterprise.event.Observer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.spi.ObserverMethod;
+
 
 @SuppressWarnings("unchecked")
-public class BrokenObserver implements Observer<BrokenEvent>
+public class BrokenObserver implements ObserverMethod<BrokenEvent>
 {
 
     public void notify(BrokenEvent event)
@@ -24,4 +31,34 @@
 
     }
 
+    @Override
+    public Class<?> getBeanClass() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Set<Annotation> getObservedQualifiers() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Type getObservedType() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public Reception getReception() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public TransactionPhase getTransactionPhase() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java?rev=824190&r1=824189&r2=824190&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
(original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/test/mock/MockManager.java
Sun Oct 11 22:45:08 2009
@@ -24,7 +24,6 @@
 import javax.enterprise.context.spi.Context;
 import javax.enterprise.context.spi.Contextual;
 import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observer;
 import javax.enterprise.inject.TypeLiteral;
 import javax.enterprise.inject.spi.AnnotatedType;
 import javax.enterprise.inject.spi.Bean;
@@ -166,22 +165,12 @@
         return manager.resolveInterceptors(type, interceptorBindings);
     }
 
-    public <T> Set<Observer<T>> resolveObservers(T event, Annotation...
bindings)
-    {
-        return manager.resolveObservers(event, bindings);
-    }
-
     public BeanManager parse(InputStream xmlStream)
     {
         manager.parse(xmlStream);
         return manager;
     }
 
-    public BeanManager createActivity()
-    {
-        return manager.createActivity();
-    }
-
     public BeanManager setCurrent(Class<? extends Annotation> scopeType)
     {
         return manager.setCurrent(scopeType);
@@ -327,7 +316,7 @@
 
 
     @Override
-    public <T> Set<ObserverMethod<?, T>> resolveObserverMethods(T event,
Annotation... bindings)
+    public <T> Set<ObserverMethod<? super T>> resolveObserverMethods(T
event, Annotation... bindings)
     {
         return this.manager.resolveObserverMethods(event, bindings);
     }



Mime
View raw message