You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by ge...@apache.org on 2009/01/29 23:43:39 UTC

svn commit: r739058 - in /incubator/openwebbeans/trunk/webbeans-impl/src: main/java/org/apache/webbeans/annotation/ main/java/org/apache/webbeans/component/ main/java/org/apache/webbeans/config/ main/java/org/apache/webbeans/container/ main/java/org/ap...

Author: gerdogdu
Date: Thu Jan 29 22:43:38 2009
New Revision: 739058

URL: http://svn.apache.org/viewvc?rev=739058&view=rev
Log:
OWB-63 M1-Release Content is finished.

Added:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DeployedManagerLiteral.java   (with props)
Modified:
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/el/WebBeansELResolver.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/exception/WebBeansDeploymentException.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
    incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
    incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/META-INF/beans.xml

Added: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DeployedManagerLiteral.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DeployedManagerLiteral.java?rev=739058&view=auto
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DeployedManagerLiteral.java (added)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DeployedManagerLiteral.java Thu Jan 29 22:43:38 2009
@@ -0,0 +1,25 @@
+/*
+ *  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.annotation;
+
+import javax.inject.AnnotationLiteral;
+import javax.inject.manager.Deployed;
+
+public class DeployedManagerLiteral extends AnnotationLiteral<Deployed> implements Deployed
+{
+
+}

Propchange: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/annotation/DeployedManagerLiteral.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java?rev=739058&r1=739057&r2=739058&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractComponent.java Thu Jan 29 22:43:38 2009
@@ -29,6 +29,7 @@
 import javax.inject.manager.InjectionPoint;
 
 import org.apache.webbeans.container.ManagerImpl;
+import org.apache.webbeans.context.ContextFactory;
 import org.apache.webbeans.context.DependentContext;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
 import org.apache.webbeans.deployment.DeploymentTypeManager;
@@ -116,16 +117,10 @@
      */
     public T create(CreationalContext<T> creationalContext)
     {
-        DependentContext context = (DependentContext) getManager().getContext(Dependent.class);
-        boolean isActiveSet = false;
+        ContextFactory.getDependentContext().setActive(true);
         T instance = null;
         try
         {
-            if (!context.isActive())
-            {
-                context.setActive(true);
-                isActiveSet = true;
-            }
 
             instance = createInstance(creationalContext);
 
@@ -140,10 +135,7 @@
         }
         finally
         {
-            if (isActiveSet)
-            {
-                context.setActive(false);
-            }
+            ContextFactory.getDependentContext().setActive(false);
         }
 
         return instance;
@@ -163,16 +155,9 @@
      */
     public void destroy(T instance)
     {
-        DependentContext context = (DependentContext) getManager().getContext(Dependent.class);
-        boolean isActiveSet = false;
-
         try
         {
-            if (!context.isActive())
-            {
-                context.setActive(true);
-                isActiveSet = true;
-            }
+            ContextFactory.getDependentContext().setActive(true);
 
             destroyInstance(instance);
             destroyDependents();
@@ -180,10 +165,7 @@
         }
         finally
         {
-            if (isActiveSet)
-            {
-                context.setActive(false);
-            }
+            ContextFactory.getDependentContext().setActive(false);
         }
 
     }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=739058&r1=739057&r2=739058&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java Thu Jan 29 22:43:38 2009
@@ -595,7 +595,10 @@
     public static <T> void addFieldInjectionPointMetaData(AbstractComponent<T> owner, Field field)
     {
         InjectionPoint injectionPoint = InjectionPointFactory.getFieldInjectionPointData(owner, field);
-        owner.addInjectionPoint(injectionPoint);
+        if(injectionPoint != null)
+        {
+            owner.addInjectionPoint(injectionPoint);   
+        }
     }
     
     public static <T> void addMethodInjectionPointMetaData(AbstractComponent<T> owner, Method method)

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java?rev=739058&r1=739057&r2=739058&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContainerDeployer.java Thu Jan 29 22:43:38 2009
@@ -24,13 +24,16 @@
 import javax.inject.InconsistentSpecializationException;
 import javax.inject.Specializes;
 import javax.inject.manager.Bean;
+import javax.inject.manager.InjectionPoint;
 import javax.inject.manager.Manager;
 import javax.interceptor.Interceptor;
 
 import org.apache.webbeans.WebBeansConstants;
+import org.apache.webbeans.annotation.DeployedManagerLiteral;
 import org.apache.webbeans.annotation.InitializedManagerLiteral;
 import org.apache.webbeans.component.ComponentImpl;
 import org.apache.webbeans.component.WebBeansType;
+import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.container.ManagerImpl;
 import org.apache.webbeans.decorator.DecoratorUtil;
 import org.apache.webbeans.deployment.StereoTypeManager;
@@ -93,7 +96,16 @@
                 configureDecorators(scanner);
                 deployFromClassPath(scanner);
                 checkSpecializations(scanner);
-
+                
+                //Fire @Initialized Event
+                fireInitializeEvent();
+                
+                //Validate injection Points
+                validateInjectionPoints();
+                
+                //Fire @Deployed Event
+                fireDeployedEvent();
+                
                 deployed = true;
             }
 
@@ -102,11 +114,43 @@
         {
             throw new WebBeansDeploymentException(e);
         }
-        finally
+    }
+    
+    private void fireInitializeEvent()
+    {
+        Manager manager = ManagerImpl.getManager();
+        manager.fireEvent(manager, new Annotation[] { new InitializedManagerLiteral() });
+    }
+    
+    
+    private void fireDeployedEvent()
+    {
+        Manager manager = ManagerImpl.getManager();
+        manager.fireEvent(manager, new Annotation[] { new DeployedManagerLiteral() });        
+        
+    }
+    
+    private void validateInjectionPoints()
+    {
+        logger.info("Validation injection points is started");
+        
+        ManagerImpl manager = ManagerImpl.getManager();
+        InjectionResolver resolver = InjectionResolver.getInstance();
+        Set<Bean<?>> beans = manager.getBeans();
+        
+        if(beans != null && beans.size() > 0)
         {
-            Manager manager = ManagerImpl.getManager();
-            manager.fireEvent(manager, new Annotation[] { new InitializedManagerLiteral() });
+            for(Bean<?> bean : beans)
+            {
+                Set<InjectionPoint> injectionPoints = bean.getInjectionPoints();
+                for(InjectionPoint injectionPoint : injectionPoints)
+                {
+                    resolver.checkInjectionPoints(injectionPoint);
+                }
+            }
         }
+        
+        logger.info("Injection points are validated succesfully");
     }
 
     private void deployFromClassPath(WebBeansScanner scanner) throws ClassNotFoundException

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=739058&r1=739057&r2=739058&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java Thu Jan 29 22:43:38 2009
@@ -14,6 +14,7 @@
 package org.apache.webbeans.container;
 
 import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.Arrays;
 import java.util.HashSet;
@@ -22,11 +23,13 @@
 import java.util.Set;
 
 import javax.inject.manager.Bean;
+import javax.inject.manager.InjectionPoint;
 
 import org.apache.webbeans.annotation.CurrentLiteral;
 import org.apache.webbeans.component.ProducerComponentImpl;
 import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.deployment.DeploymentTypeManager;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;
@@ -45,6 +48,39 @@
         return instance;
     }
 
+    public void checkInjectionPoints(InjectionPoint injectionPoint)
+    {
+        Type type = injectionPoint.getType();
+        Class<?> clazz = null;
+        Type[] args = new Type[0];
+        
+        if (type instanceof ParameterizedType)
+        {
+            ParameterizedType pt = (ParameterizedType) type;
+
+            if (!ClassUtil.checkParametrizedType(pt))
+            {
+                throw new WebBeansConfigurationException("Injection point : " + injectionPoint + " can not defined type variable or wildcard");
+            }
+            
+            args = pt.getActualTypeArguments();
+
+            clazz = (Class<?>) pt.getRawType();
+        }
+        else
+        {
+            clazz = (Class<?>) type;
+        }
+        
+        Annotation[] bindingTypes = new Annotation[injectionPoint.getBindings().size()];
+        bindingTypes = injectionPoint.getBindings().toArray(bindingTypes);
+        
+        Set<Bean<Object>> beanSet = implResolveByType(clazz, args ,bindingTypes);
+        
+        ResolutionUtil.checkResolvedBeans(beanSet, clazz);
+        
+    }
+    
     public Set<Bean<?>> implResolveByName(String name)
     {
         Asserts.assertNotNull(name, "name parameter can not be null");

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java?rev=739058&r1=739057&r2=739058&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/ManagerImpl.java Thu Jan 29 22:43:38 2009
@@ -287,18 +287,11 @@
     public <T> T getInstance(Bean<T> bean)
     {
         Context context = null;
-        DependentContext dependentContext = null;
         T instance = null;
-        boolean isSetOnThis = false;
 
         try
         {
-            dependentContext = (DependentContext) getContext(Dependent.class);
-            if (!dependentContext.isActive())
-            {
-                dependentContext.setActive(true);
-                isSetOnThis = true;
-            }
+            ContextFactory.getDependentContext().setActive(true);
 
             /* @ScopeType is normal */
             if (WebBeansUtil.isScopeTypeNormal(bean.getScopeType()))
@@ -324,10 +317,7 @@
         }
         finally
         {
-            if (isSetOnThis)
-            {
-                dependentContext.setActive(false);
-            }
+            ContextFactory.getDependentContext().setActive(false);
         }
 
         return instance;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java?rev=739058&r1=739057&r2=739058&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/context/ContextFactory.java Thu Jan 29 22:43:38 2009
@@ -14,6 +14,8 @@
 package org.apache.webbeans.context;
 
 import java.lang.annotation.Annotation;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.context.ApplicationScoped;
 import javax.context.ContextNotActiveException;
@@ -48,7 +50,7 @@
 
     private static ThreadLocal<DependentContext> dependentContext = null;
 
-    private static ApplicationContext currentApplicationContext = null;
+    private static Map<ServletContext, ApplicationContext> currentApplicationContexts = new ConcurrentHashMap<ServletContext, ApplicationContext>();
 
     private static SessionContextManager sessionCtxManager = SessionContextManager.getInstance();
 
@@ -82,6 +84,8 @@
         {
             HttpSession session = request.getSession();
             initSessionContext(session);
+            
+            initApplicationContext(request.getSession().getServletContext());
         }
     }
 
@@ -101,7 +105,7 @@
                 context.destroy();
             }
 
-            requestContext.remove();// unset thread local
+            requestContext.remove();
         }
     }
 
@@ -143,7 +147,7 @@
                 context.destroy();
             }
 
-            sessionContext.remove();// unset thread local
+            sessionContext.remove();
 
         }
 
@@ -158,14 +162,25 @@
      */
     public static void initApplicationContext(ServletContext servletContext)
     {
-        if (currentApplicationContext == null)
+        if(currentApplicationContexts.containsKey(servletContext))
+        {
+            applicationContext.set(currentApplicationContexts.get(servletContext));
+        }
+        
+        else
         {
-            currentApplicationContext = new ApplicationContext();
+            ApplicationContext currentApplicationContext = new ApplicationContext();         
             currentApplicationContext.setActive(true);
+            
+            if(servletContext != null)
+            {
+                currentApplicationContexts.put(servletContext, currentApplicationContext);
+                
+            }
+            
+            applicationContext.set(currentApplicationContext);
+   
         }
-
-        applicationContext.set(currentApplicationContext);
-
     }
 
     /**
@@ -185,11 +200,15 @@
                 context.destroy();
             }
 
-            applicationContext.remove();// unset thread local
+            applicationContext.remove();
 
         }
-
-        currentApplicationContext = null;
+        
+        if(servletContext != null)
+        {
+            currentApplicationContexts.remove(servletContext);   
+        }
+        
         sessionCtxManager.destroyAllSessions();
         conversationManager.destroyAllConversations();
     }
@@ -198,10 +217,14 @@
     {
         if (context == null)
         {
-            conversationContext.set(new ConversationContext());
+            ConversationContext newContext = new ConversationContext();
+            newContext.setActive(true);
+            
+            conversationContext.set(newContext);
         }
         else
         {
+            context.setActive(true);
             conversationContext.set(context);
         }
     }
@@ -317,12 +340,9 @@
         return sessionContext.get();
     }
 
-    /*
-     * Get current application ctx.
-     */
-    private static ApplicationContext getApplicationContext()
+     private static ApplicationContext getApplicationContext()
     {
-        return currentApplicationContext;
+        return applicationContext.get();
     }
 
     /*
@@ -333,7 +353,7 @@
         return conversationContext.get();
     }
 
-    private static DependentContext getDependentContext()
+    public static DependentContext getDependentContext()
     {
         DependentContext dependentCtx = dependentContext.get();
 
@@ -345,5 +365,6 @@
 
         return dependentCtx;
     }
+     
 
 }
\ No newline at end of file

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/el/WebBeansELResolver.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/el/WebBeansELResolver.java?rev=739058&r1=739057&r2=739058&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/el/WebBeansELResolver.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/el/WebBeansELResolver.java Thu Jan 29 22:43:38 2009
@@ -26,7 +26,7 @@
 import javax.inject.manager.Manager;
 
 import org.apache.webbeans.container.ManagerImpl;
-import org.apache.webbeans.context.DependentContext;
+import org.apache.webbeans.context.ContextFactory;
 
 public class WebBeansELResolver extends ELResolver
 {    
@@ -55,9 +55,8 @@
         Manager manager = ManagerImpl.getManager();
 
         Object object = null;
-        DependentContext dependentContext = null;
         Bean<?> bean = null;
-        boolean isActiveSet = false;
+
         boolean isResolution = false;
         try
         {
@@ -65,13 +64,7 @@
             {
                 isResolution = true;
 
-                dependentContext = (DependentContext) ManagerImpl.getManager().getContext(Dependent.class);
-
-                if (!dependentContext.isActive())
-                {
-                    dependentContext.setActive(true);
-                    isActiveSet = true;
-                }
+                ContextFactory.getDependentContext().setActive(true);
 
                 String name = (String) property;
                 object = manager.getInstanceByName(name);
@@ -91,10 +84,7 @@
                     destroyBean(bean, object);
                 }
 
-                if (isActiveSet)
-                {
-                    dependentContext.setActive(false);
-                }
+                ContextFactory.getDependentContext().setActive(false);
             }
         }
 

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=739058&r1=739057&r2=739058&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 Thu Jan 29 22:43:38 2009
@@ -14,7 +14,6 @@
 package org.apache.webbeans.event;
 
 import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
@@ -31,8 +30,9 @@
 import org.apache.webbeans.component.ObservesMethodsOwner;
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.container.ManagerImpl;
-import org.apache.webbeans.context.DependentContext;
+import org.apache.webbeans.context.ContextFactory;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.util.AnnotationUtil;
 
 public class BeanObserverImpl<T> implements Observer<T>
@@ -56,31 +56,24 @@
         this.manager = ManagerImpl.getManager();
     }
 
+    @SuppressWarnings("unchecked")
     public void notify(T event)
     {
         AbstractComponent<?> baseComponent = (AbstractComponent<?>) bean;
         Object object = null;
-
-        boolean isActiveSet = false;
-        DependentContext dependentContext = (DependentContext) ManagerImpl.getManager().getContext(Dependent.class);
+        Context context = null;
+        boolean isDependentContext = false;
 
         try
         {
             if (baseComponent.getScopeType().equals(Dependent.class))
             {
-                dependentContext = (DependentContext) ManagerImpl.getManager().getContext(Dependent.class);
-
-                if (!dependentContext.isActive())
-                {
-                    isActiveSet = true;
-                    dependentContext.setActive(true);
-
-                }
-
-                object = ManagerImpl.getManager().getInstance(baseComponent);
+                isDependentContext = true;
+                ContextFactory.getDependentContext().setActive(true);                
             }
 
-            Context context = manager.getContext(baseComponent.getScopeType());
+            context = manager.getContext(baseComponent.getScopeType());
+            
             if (ifExist)
             {
                 object = context.get(baseComponent);
@@ -97,42 +90,18 @@
 
                 args = new Object[argsObjects.size()];
                 args = argsObjects.toArray(args);
-
-                try
-                {
-                    observerMethod.invoke(object, args);
-
-                }
-                catch (IllegalArgumentException e)
-                {
-                    throw e;
-
-                }
-                catch (IllegalAccessException e)
-                {
-                    throw new RuntimeException(e);
-
-                }
-                catch (InvocationTargetException e)
-                {
-                    throw new RuntimeException(e);
-                }
-                finally
-                {
-                    if (isActiveSet)
-                    {
-                        object = null;
-                    }
-                }
-
+                observerMethod.invoke(object, args);
             }
 
-        }
+        }catch(Exception e)
+        {
+            throw new WebBeansException(e);
+        }        
         finally
         {
-            if (isActiveSet)
+            if(isDependentContext)
             {
-                dependentContext.setActive(false);
+                ContextFactory.getDependentContext().setActive(false);   
             }
         }
 

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java?rev=739058&r1=739057&r2=739058&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/exception/WebBeansDeploymentException.java Thu Jan 29 22:43:38 2009
@@ -13,13 +13,15 @@
  */
 package org.apache.webbeans.exception;
 
+import javax.inject.DeploymentException;
+
 /**
  * Exception that is thrown by the web beans container at the deployment time.
  * 
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>
  * @since 1.0
  */
-public class WebBeansDeploymentException extends WebBeansException
+public class WebBeansDeploymentException extends DeploymentException
 {
 
     private static final long serialVersionUID = 1863095663133791175L;

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=739058&r1=739057&r2=739058&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java Thu Jan 29 22:43:38 2009
@@ -29,7 +29,7 @@
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.container.ManagerImpl;
 import org.apache.webbeans.container.ResolutionUtil;
-import org.apache.webbeans.context.DependentContext;
+import org.apache.webbeans.context.ContextFactory;
 import org.apache.webbeans.context.WebBeansContext;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
 import org.apache.webbeans.event.EventImpl;
@@ -64,17 +64,10 @@
      */
     public <T> Object inject(Class<T> type, Type[] args, Annotation... annotations)
     {
-        DependentContext context = (DependentContext) ManagerImpl.getManager().getContext(Dependent.class);
-        boolean isSetOnThis = false;
+        ContextFactory.getDependentContext().setActive(true);
 
         try
         {
-            if (!context.isActive())
-            {
-                context.setActive(true);
-                isSetOnThis = true;
-            }
-
             if (isResource(annotations))
             {
                 //X TODO do we need the args too?
@@ -112,10 +105,7 @@
         }
         finally
         {
-            if (isSetOnThis)
-            {
-                context.setActive(false);
-            }
+            ContextFactory.getDependentContext().setActive(false);
         }
 
     }

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java?rev=739058&r1=739057&r2=739058&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java Thu Jan 29 22:43:38 2009
@@ -22,7 +22,9 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.event.Fires;
 import javax.event.Observes;
+import javax.inject.Obtains;
 import javax.inject.manager.Bean;
 import javax.inject.manager.InjectionPoint;
 
@@ -40,8 +42,24 @@
 
         Annotation[] annots = null;
         annots = member.getAnnotations();
+        
+
+        boolean firesOrObtainsAnnotation = false;
+
+        if(AnnotationUtil.isAnnotationExist(annots, Fires.class) || AnnotationUtil.isAnnotationExist(annots, Obtains.class))
+        {
+            firesOrObtainsAnnotation = true;
+        }
+        
+        if(!firesOrObtainsAnnotation)
+        {
+            return getGenericInjectionPoint(owner, annots, member.getGenericType(), member);   
+        }        
+        else
+        {
+            return null;
+        }
 
-        return getGenericInjectionPoint(owner, annots, member.getGenericType(), member);
     }
 
     private static InjectionPoint getGenericInjectionPoint(Bean<?> owner, Annotation[] annots, Type type, Member member)
@@ -49,7 +67,6 @@
         InjectionPointImpl injectionPoint = null;
 
         Annotation[] bindingAnnots = AnnotationUtil.getBindingAnnotations(annots);
-
         injectionPoint = new InjectionPointImpl(owner, type, member);
 
         addAnnotation(injectionPoint, annots, false);

Modified: incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/META-INF/beans.xml
URL: http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/META-INF/beans.xml?rev=739058&r1=739057&r2=739058&view=diff
==============================================================================
--- incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/META-INF/beans.xml (original)
+++ incubator/openwebbeans/trunk/webbeans-impl/src/test/resources/META-INF/beans.xml Thu Jan 29 22:43:38 2009
@@ -17,9 +17,9 @@
 specific language governing permissions and limitations
 under the License.
 -->
-<WebBeans 	xmlns="urn:java:javax.webbeans"
+<WebBeans 	xmlns="urn:java:ee"
  			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-			xsi:schemaLocation="urn:java:javax.webbeans http://java.sun.com/jee/web-beans-1.0.xsd">
+			xsi:schemaLocation="urn:java:ee http://java.sun.com/jee/beans-1.0.xsd">
 <!-- 
     This file is only needed to trigger the WebBeansScanner.
     It does NOT contain a valid WebBeans configuration yet!