openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r940119 [2/2] - in /openwebbeans/trunk: webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/ webbeans-impl/src/main/java/org/apache/webbeans/component/third/ webbeans-impl/src/main/java/org/apache/webbeans/config/ webbeans-impl/s...
Date Sat, 01 May 2010 22:20:54 GMT
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=940119&r1=940118&r2=940119&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 Sat May  1 22:20:53 2010
@@ -72,6 +72,7 @@ import javax.enterprise.inject.spi.Befor
 import javax.enterprise.inject.spi.BeforeShutdown;
 import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
 import javax.enterprise.inject.spi.Interceptor;
 import javax.enterprise.inject.spi.ObserverMethod;
 import javax.enterprise.inject.spi.PassivationCapable;
@@ -149,7 +150,6 @@ import org.apache.webbeans.portable.Anno
 import org.apache.webbeans.portable.creation.InjectionTargetProducer;
 import org.apache.webbeans.portable.creation.ProducerBeansProducer;
 import org.apache.webbeans.portable.events.ProcessBeanImpl;
-import org.apache.webbeans.portable.events.ProcessInjectionTargetImpl;
 import org.apache.webbeans.portable.events.ProcessProducerImpl;
 import org.apache.webbeans.portable.events.discovery.ErrorStack;
 import org.apache.webbeans.portable.events.generics.GProcessAnnotatedType;
@@ -161,6 +161,7 @@ import org.apache.webbeans.portable.even
 import org.apache.webbeans.portable.events.generics.GProcessProducerField;
 import org.apache.webbeans.portable.events.generics.GProcessProducerMethod;
 import org.apache.webbeans.portable.events.generics.GProcessSessionBean;
+import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
 import org.apache.webbeans.spi.plugins.OpenWebBeansPlugin;
 
 /**
@@ -365,6 +366,36 @@ public final class WebBeansUtil
             }
         }
     }
+    
+    /**
+     * Returns true if given class supports injections,
+     * false otherwise.
+     * <p>
+     * Each plugin is asked with given class that supports
+     * injections or not. 
+     * </p>
+     * @param clazz scanned class
+     * @return  true if given class supports injections
+     */
+    public static boolean supportsJavaEeComponentInjections(Class<?> clazz)
+    {
+        // and finally call all checks which are defined in plugins like JSF, JPA, etc
+        List<OpenWebBeansPlugin> plugins = PluginLoader.getInstance().getPlugins();
+        for (OpenWebBeansPlugin plugin : plugins)
+        {
+            //Ejb plugin handles its own events
+            //Also EJb beans supports injections
+            if(!(plugin instanceof OpenWebBeansEjbPlugin))
+            {
+                if(plugin.supportsJavaEeComponentInjections(clazz))
+                {
+                    return true;
+                }                
+            }
+        }
+        
+        return false;
+    }
 
     /**
      * Defines applicable constructor.
@@ -2122,15 +2153,15 @@ public final class WebBeansUtil
         return true;
     }
     
-    public static <T> void defineInterceptor(ManagedBeanCreatorImpl<T> managedBeanCreator, AnnotatedType<T> annotatedType)
+    public static <T> void defineInterceptor(ManagedBeanCreatorImpl<T> managedBeanCreator, ProcessInjectionTarget<T> injectionTargetEvent)
     {
-        Class<?> clazz = annotatedType.getJavaClass();
+        Class<?> clazz = injectionTargetEvent.getAnnotatedType().getJavaClass();
         if (InterceptorsManager.getInstance().isInterceptorEnabled(clazz))
         {
             ManagedBean<T> component = null;
 
             InterceptorUtil.checkInterceptorConditions(clazz);
-            component = defineManagedBean(managedBeanCreator, annotatedType);
+            component = defineManagedBean(managedBeanCreator, injectionTargetEvent);
 
             if (component != null)
             {
@@ -2147,15 +2178,15 @@ public final class WebBeansUtil
      * @param <T> type info
      * @param clazz decorator class
      */
-    public static <T> void defineDecorator(ManagedBeanCreatorImpl<T> creator, AnnotatedType<T> annotatedType)
+    public static <T> void defineDecorator(ManagedBeanCreatorImpl<T> creator, ProcessInjectionTarget<T> processInjectionTargetEvent)
     {
-        Class<T> clazz = annotatedType.getJavaClass();
+        Class<T> clazz = processInjectionTargetEvent.getAnnotatedType().getJavaClass();
         if (DecoratorsManager.getInstance().isDecoratorEnabled(clazz))
         {
             ManagedBean<T> delegate = null;
 
             DecoratorUtil.checkDecoratorConditions(clazz);
-            delegate = defineManagedBean(creator, annotatedType);
+            delegate = defineManagedBean(creator, processInjectionTargetEvent);
 
             if (delegate != null)
             {
@@ -2355,6 +2386,26 @@ public final class WebBeansUtil
         
     }
     
+    /**
+     * Returns <code>ProcessInjectionTarget</code> event.
+     * @param <T> bean type
+     * @param bean bean instance
+     * @return event
+     */
+    public static <T> GProcessInjectionTarget fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass)
+    {
+        AnnotatedType<T> annotatedType = AnnotatedElementFactory.newAnnotatedType(componentClass);
+        InjectionTarget<T> injectionTarget = BeanManagerImpl.getManager().createInjectionTarget(annotatedType);
+        GProcessInjectionTarget processInjectionTargetEvent = new GProcessInjectionTarget(injectionTarget,annotatedType);
+        
+        //Fires ProcessInjectionTarget
+        BeanManagerImpl.getManager().fireEvent(processInjectionTargetEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+        
+        return processInjectionTargetEvent;
+        
+    }
+    
+    
     public static GProcessProducer fireProcessProducerEventForMethod(ProducerMethodBean<?> producerMethod,AnnotatedMethod<?> method)
     {         
         GProcessProducer producerEvent = new GProcessProducer(new ProducerBeansProducer(producerMethod),method);
@@ -2375,7 +2426,7 @@ public final class WebBeansUtil
         return producerEvent;
     }
     
-    public static void fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>,AnnotatedMethod<?>> annotatedMethods)
+    public static void fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>,AnnotatedMethod<?>> annotatedMethods, AnnotatedType<?> annotatedType)
     {
         for(ProducerMethodBean<?> bean : annotatedMethods.keySet())
         {
@@ -2386,7 +2437,7 @@ public final class WebBeansUtil
             GProcessProducerMethod processProducerMethodEvent = null;
             if(disposal != null)
             {
-                disposalAnnotated = AnnotatedElementFactory.newAnnotatedMethod(disposal, bean.getParent().getReturnType());
+                disposalAnnotated = AnnotatedElementFactory.newAnnotatedMethod(disposal, annotatedType);
                 processProducerMethodEvent = new GProcessProducerMethod(bean,annotatedMethod,disposalAnnotated.getParameters().get(0));                
             }
             else
@@ -2718,13 +2769,15 @@ public final class WebBeansUtil
     }
     
  
-    public static <T> ManagedBean<T> defineManagedBean(ManagedBeanCreatorImpl<T> managedBeanCreator,AnnotatedType<T> annotatedType)
+    public static <T> ManagedBean<T> defineManagedBean(ManagedBeanCreatorImpl<T> managedBeanCreator,ProcessInjectionTarget<T> processInjectionTargetEvent)
     {
         BeanManagerImpl manager = BeanManagerImpl.getManager();        
-        ManagedBean<T> managedBean = managedBeanCreator.getBean();
-        
-        Class<T> clazz = annotatedType.getJavaClass();
         
+        //Annotated type
+        AnnotatedType<T> annotatedType = processInjectionTargetEvent.getAnnotatedType();
+        ManagedBean<T> managedBean = managedBeanCreator.getBean();
+        Class<T> clazz = annotatedType.getJavaClass();        
+                                
         managedBeanCreator.defineSerializable();
 
         //Define meta-data
@@ -2751,8 +2804,8 @@ public final class WebBeansUtil
         }
                                 
         //Fires ProcessInjectionTarget
-        ProcessInjectionTargetImpl<T> processInjectionTargetEvent = WebBeansUtil.fireProcessInjectionTargetEvent(managedBean);    
-        WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessInjectionTarget event observers. Look at logs for further details");
+        //ProcessInjectionTargetImpl<T> processInjectionTargetEvent = WebBeansUtil.fireProcessInjectionTargetEvent(managedBean);    
+        //WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessInjectionTarget event observers. Look at logs for further details");
         
         //Put final InjectionTarget instance
         manager.putInjectionTargetWrapper(managedBean, new InjectionTargetWrapper(processInjectionTargetEvent.getInjectionTarget()));
@@ -2760,7 +2813,7 @@ public final class WebBeansUtil
         Map<ProducerMethodBean<?>,AnnotatedMethod<?>> annotatedMethods = new HashMap<ProducerMethodBean<?>, AnnotatedMethod<?>>(); 
         for(ProducerMethodBean<?> producerMethod : producerMethods)
         {
-            AnnotatedMethod<?> method = AnnotatedElementFactory.newAnnotatedMethod(producerMethod.getCreatorMethod(), producerMethod.getParent().getReturnType());
+            AnnotatedMethod<?> method = AnnotatedElementFactory.newAnnotatedMethod(producerMethod.getCreatorMethod(), annotatedType);
             ProcessProducerImpl<?, ?> producerEvent = WebBeansUtil.fireProcessProducerEventForMethod(producerMethod,method);                
             WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducer event observers for ProducerMethods. Look at logs for further details");
 
@@ -2773,7 +2826,7 @@ public final class WebBeansUtil
         Map<ProducerFieldBean<?>,AnnotatedField<?>> annotatedFields = new HashMap<ProducerFieldBean<?>, AnnotatedField<?>>();
         for(ProducerFieldBean<?> producerField : producerFields)
         {
-            AnnotatedField<?> field = AnnotatedElementFactory.newAnnotatedField(producerField.getCreatorField(), producerField.getParent().getReturnType());
+            AnnotatedField<?> field = AnnotatedElementFactory.newAnnotatedField(producerField.getCreatorField(), annotatedType);
             ProcessProducerImpl<?, ?> producerEvent = WebBeansUtil.fireProcessProducerEventForField(producerField, field);
             WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducer event observers for ProducerFields. Look at logs for further details");
             
@@ -2787,7 +2840,7 @@ public final class WebBeansUtil
         for(ObserverMethod<?> observerMethod : observerMethods)
         {
             ObserverMethodImpl<?> impl = (ObserverMethodImpl<?>)observerMethod;
-            AnnotatedMethod<?> method = AnnotatedElementFactory.newAnnotatedMethod(impl.getObserverMethod(), impl.getBeanClass());
+            AnnotatedMethod<?> method = AnnotatedElementFactory.newAnnotatedMethod(impl.getObserverMethod(), annotatedType);
             
             observerMethodsMap.put(observerMethod, method);
         }
@@ -2800,7 +2853,7 @@ public final class WebBeansUtil
         WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessManagedBean event observers for managed beans. Look at logs for further details");
         
         //Fires ProcessProducerMethod
-        WebBeansUtil.fireProcessProducerMethodBeanEvent(annotatedMethods);            
+        WebBeansUtil.fireProcessProducerMethodBeanEvent(annotatedMethods, annotatedType);            
         WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducerMethod event observers for producer method beans. Look at logs for further details");            
         
         //Fires ProcessProducerField
@@ -2830,6 +2883,43 @@ public final class WebBeansUtil
         
         return managedBean;
     }
+    
+    public static <T> ManagedBean<T>  defineManagedBeanWithoutFireEvents(AnnotatedType<T> type)
+    {
+        Class<T> clazz = type.getJavaClass();
+        
+        ManagedBean<T> managedBean = new ManagedBean<T>(clazz,WebBeansType.MANAGED);    
+        managedBean.setAnnotatedType(type);
+        ManagedBeanCreatorImpl<T> managedBeanCreator = new ManagedBeanCreatorImpl<T>(managedBean);            
+        managedBeanCreator.setAnnotatedType(type);
+        
+        managedBeanCreator.defineSerializable();
+
+        //Define meta-data
+        managedBeanCreator.defineStereoTypes();
+
+        //Scope type
+        managedBeanCreator.defineScopeType(logger.getTokenString(OWBLogConst.TEXT_MB_IMPL) + clazz.getName() + logger.getTokenString(OWBLogConst.TEXT_SAME_SCOPE));                                        
+        //Check for Enabled via Alternative
+        WebBeansUtil.setInjectionTargetBeanEnableFlag(managedBean);        
+        managedBeanCreator.defineApiType();
+        managedBeanCreator.checkCreateConditions();
+        managedBeanCreator.defineQualifier();
+        managedBeanCreator.defineName(WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
+        managedBeanCreator.defineConstructor();            
+        managedBeanCreator.defineProducerMethods();       
+        managedBeanCreator.defineProducerFields();           
+        managedBeanCreator.defineInjectedFields();
+        managedBeanCreator.defineInjectedMethods();
+        managedBeanCreator.defineObserverMethods();
+        DefinitionUtil.defineDecoratorStack(managedBean);
+        DefinitionUtil.defineBeanInterceptorStack(managedBean);
+                                        
+        managedBeanCreator.defineDisposalMethods();//Define disposal method after adding producers
+        
+        return managedBean;
+    }
+    
 
     /**
      * Determines if the injection is to be performed into a static field.

Modified: openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JSFUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JSFUtil.java?rev=940119&r1=940118&r2=940119&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JSFUtil.java (original)
+++ openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/JSFUtil.java Sat May  1 22:20:53 2010
@@ -85,7 +85,13 @@ public final class JSFUtil
 
     public static Application getApplication()
     {
-        return getCurrentFacesContext().getApplication();
+        FacesContext context = getCurrentFacesContext();
+        if(context != null)
+        {
+            return context.getApplication();
+        }
+        
+        return null;
     }
     
     public static void addInfoMessage(String message)

Added: openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplication.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplication.java?rev=940119&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplication.java (added)
+++ openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplication.java Sat May  1 22:20:53 2010
@@ -0,0 +1,549 @@
+/*
+ * 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.jsf;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.el.ELContextListener;
+import javax.el.ELException;
+import javax.el.ELResolver;
+import javax.el.ExpressionFactory;
+import javax.el.ValueExpression;
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.application.NavigationHandler;
+import javax.faces.application.ProjectStage;
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
+import javax.faces.application.StateManager;
+import javax.faces.application.ViewHandler;
+import javax.faces.component.UIComponent;
+import javax.faces.component.behavior.Behavior;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.PropertyResolver;
+import javax.faces.el.ReferenceSyntaxException;
+import javax.faces.el.ValueBinding;
+import javax.faces.el.VariableResolver;
+import javax.faces.event.ActionListener;
+import javax.faces.event.SystemEvent;
+import javax.faces.event.SystemEventListener;
+import javax.faces.validator.Validator;
+
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.el.OwbElContextListener;
+
+public class OwbApplication extends Application
+{
+    private Application wrappedApplication;
+    
+    private volatile ExpressionFactory expressionFactory;
+    
+    public OwbApplication(Application wrappedApplication)
+    {
+        this.wrappedApplication = wrappedApplication;
+        this.wrappedApplication.addELContextListener(new OwbElContextListener());
+    }
+
+    @Override
+    public void addComponent(String arg0, String arg1)
+    {
+        this.wrappedApplication.addComponent(arg0, arg1);
+    }
+    
+
+    @Override
+    public void addConverter(Class<?> arg0, String arg1)
+    {
+        this.wrappedApplication.addConverter(arg0, arg1);        
+    }
+
+    @Override
+    public void addConverter(String arg0, String arg1)
+    {
+        this.wrappedApplication.addConverter(arg0, arg1);
+    }
+
+    @Override
+    public void addValidator(String arg0, String arg1)
+    {
+        this.wrappedApplication.addValidator(arg0, arg1);        
+    }
+
+    @Override
+    public UIComponent createComponent(String arg0) throws FacesException
+    {        
+        return this.wrappedApplication.createComponent(arg0);
+    }
+
+    @Override
+    public UIComponent createComponent(ValueBinding arg0, FacesContext arg1, String arg2) throws FacesException
+    {        
+        return this.wrappedApplication.createComponent(arg0, arg1, arg2);
+    }
+
+    @Override
+    public Converter createConverter(Class<?> arg0)
+    {        
+        return this.wrappedApplication.createConverter(arg0);
+    }
+
+    @Override
+    public Converter createConverter(String arg0)
+    {        
+        return this.wrappedApplication.createConverter(arg0);
+    }
+
+    @Override
+    public MethodBinding createMethodBinding(String arg0, Class<?>[] arg1) throws ReferenceSyntaxException
+    {        
+        return this.wrappedApplication.createMethodBinding(arg0, arg1);
+    }
+
+    @Override
+    public Validator createValidator(String arg0) throws FacesException
+    {
+        
+        return this.wrappedApplication.createValidator(arg0);
+    }
+
+    @Override
+    public ValueBinding createValueBinding(String arg0) throws ReferenceSyntaxException
+    {        
+        return this.wrappedApplication.createValueBinding(arg0);
+    }
+
+    @Override
+    public ActionListener getActionListener()
+    {        
+        return this.wrappedApplication.getActionListener();
+    }
+
+    @Override
+    public Iterator<String> getComponentTypes()
+    {        
+        return this.wrappedApplication.getComponentTypes();
+    }
+
+    @Override
+    public Iterator<String> getConverterIds()
+    {        
+        return this.wrappedApplication.getConverterIds();
+    }
+
+    @Override
+    public Iterator<Class<?>> getConverterTypes()
+    {        
+        return this.wrappedApplication.getConverterTypes();
+    }
+
+    @Override
+    public Locale getDefaultLocale()
+    {        
+        return this.wrappedApplication.getDefaultLocale();
+    }
+
+    @Override
+    public String getDefaultRenderKitId()
+    {        
+        return this.wrappedApplication.getDefaultRenderKitId();
+    }
+
+    @Override
+    public String getMessageBundle()
+    {        
+        return this.wrappedApplication.getMessageBundle();
+    }
+
+    @Override
+    public NavigationHandler getNavigationHandler()
+    {        
+        return this.wrappedApplication.getNavigationHandler();
+    }
+
+    @Override
+    public PropertyResolver getPropertyResolver()
+    {        
+        return this.wrappedApplication.getPropertyResolver();
+    }
+
+    @Override
+    public StateManager getStateManager()
+    {        
+        return this.wrappedApplication.getStateManager();
+    }
+
+    @Override
+    public Iterator<Locale> getSupportedLocales()
+    {        
+        return this.wrappedApplication.getSupportedLocales();
+    }
+
+    @Override
+    public Iterator<String> getValidatorIds()
+    {        
+        return this.wrappedApplication.getValidatorIds();
+    }
+
+    @Override
+    public VariableResolver getVariableResolver()
+    {        
+        return this.wrappedApplication.getVariableResolver();
+    }
+
+    @Override
+    public ViewHandler getViewHandler()
+    {        
+        return this.wrappedApplication.getViewHandler();
+    }
+
+    @Override
+    public void setActionListener(ActionListener arg0)
+    {        
+        this.wrappedApplication.setActionListener(arg0);
+    }
+
+    @Override
+    public void setDefaultLocale(Locale arg0)
+    {
+        this.wrappedApplication.setDefaultLocale(arg0);        
+    }
+
+    @Override
+    public void setDefaultRenderKitId(String arg0)
+    {
+        this.wrappedApplication.setDefaultRenderKitId(arg0);        
+    }
+
+    @Override
+    public void setMessageBundle(String arg0)
+    {
+        this.wrappedApplication.setMessageBundle(arg0);        
+    }
+
+    @Override
+    public void setNavigationHandler(NavigationHandler arg0)
+    {
+        this.wrappedApplication.setNavigationHandler(arg0);        
+    }
+
+    @Override
+    public void setPropertyResolver(PropertyResolver arg0)
+    {        
+        this.wrappedApplication.setPropertyResolver(arg0);
+    }
+
+    @Override
+    public void setStateManager(StateManager arg0)
+    {        
+        this.wrappedApplication.setStateManager(arg0);
+    }
+
+    @Override
+    public void setSupportedLocales(Collection<Locale> arg0)
+    {
+        this.wrappedApplication.setSupportedLocales(arg0);
+        
+    }
+
+    @Override
+    public void setVariableResolver(VariableResolver arg0)
+    {        
+        this.wrappedApplication.setVariableResolver(arg0);
+    }
+
+    @Override
+    public void setViewHandler(ViewHandler arg0)
+    {        
+        this.wrappedApplication.setViewHandler(arg0);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#getExpressionFactory()
+     */
+    @Override
+    public ExpressionFactory getExpressionFactory()
+    {
+        if(this.expressionFactory == null)
+        {
+            expressionFactory = wrappedApplication.getExpressionFactory();
+            expressionFactory = BeanManagerImpl.getManager().wrapExpressionFactory(expressionFactory);            
+        }
+        
+        return expressionFactory;
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#addBehavior(java.lang.String, java.lang.String)
+     */
+    @Override
+    public void addBehavior(String behaviorId, String behaviorClass)
+    {
+        wrappedApplication.addBehavior(behaviorId, behaviorClass);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#addDefaultValidatorId(java.lang.String)
+     */
+    @Override
+    public void addDefaultValidatorId(String validatorId)
+    {
+       
+        wrappedApplication.addDefaultValidatorId(validatorId);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#addELContextListener(javax.el.ELContextListener)
+     */
+    @Override
+    public void addELContextListener(ELContextListener listener)
+    {
+       
+        wrappedApplication.addELContextListener(listener);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#addELResolver(javax.el.ELResolver)
+     */
+    @Override
+    public void addELResolver(ELResolver resolver)
+    {
+       
+        wrappedApplication.addELResolver(resolver);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#createBehavior(java.lang.String)
+     */
+    @Override
+    public Behavior createBehavior(String behaviorId) throws FacesException
+    {
+       
+        return wrappedApplication.createBehavior(behaviorId);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#createComponent(javax.faces.context.FacesContext, javax.faces.application.Resource)
+     */
+    @Override
+    public UIComponent createComponent(FacesContext context, Resource componentResource)
+    {
+       
+        return wrappedApplication.createComponent(context, componentResource);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#createComponent(javax.faces.context.FacesContext, java.lang.String, java.lang.String)
+     */
+    @Override
+    public UIComponent createComponent(FacesContext context, String componentType, String rendererType)
+    {
+       
+        return wrappedApplication.createComponent(context, componentType, rendererType);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#createComponent(javax.el.ValueExpression, javax.faces.context.FacesContext, java.lang.String, java.lang.String)
+     */
+    @Override
+    public UIComponent createComponent(ValueExpression componentExpression, FacesContext context, String componentType, String rendererType)
+    {
+       
+        return wrappedApplication.createComponent(componentExpression, context, componentType, rendererType);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#createComponent(javax.el.ValueExpression, javax.faces.context.FacesContext, java.lang.String)
+     */
+    @Override
+    public UIComponent createComponent(ValueExpression componentExpression, FacesContext context, String componentType) throws FacesException
+    {
+       
+        return wrappedApplication.createComponent(componentExpression, context, componentType);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#evaluateExpressionGet(javax.faces.context.FacesContext, java.lang.String, java.lang.Class)
+     */
+    @Override
+    public <T> T evaluateExpressionGet(FacesContext context, String expression, Class<? extends T> expectedType) throws ELException
+    {
+       
+        return wrappedApplication.evaluateExpressionGet(context, expression, expectedType);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#getBehaviorIds()
+     */
+    @Override
+    public Iterator<String> getBehaviorIds()
+    {
+       
+        return wrappedApplication.getBehaviorIds();
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#getDefaultValidatorInfo()
+     */
+    @Override
+    public Map<String, String> getDefaultValidatorInfo()
+    {
+       
+        return wrappedApplication.getDefaultValidatorInfo();
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#getELContextListeners()
+     */
+    @Override
+    public ELContextListener[] getELContextListeners()
+    {
+       
+        return wrappedApplication.getELContextListeners();
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#getELResolver()
+     */
+    @Override
+    public ELResolver getELResolver()
+    {
+       
+        return wrappedApplication.getELResolver();
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#getProjectStage()
+     */
+    @Override
+    public ProjectStage getProjectStage()
+    {
+       
+        return wrappedApplication.getProjectStage();
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#getResourceBundle(javax.faces.context.FacesContext, java.lang.String)
+     */
+    @Override
+    public ResourceBundle getResourceBundle(FacesContext ctx, String name) throws FacesException, NullPointerException
+    {
+       
+        return wrappedApplication.getResourceBundle(ctx, name);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#getResourceHandler()
+     */
+    @Override
+    public ResourceHandler getResourceHandler()
+    {
+       
+        return wrappedApplication.getResourceHandler();
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#publishEvent(javax.faces.context.FacesContext, java.lang.Class, java.lang.Class, java.lang.Object)
+     */
+    @Override
+    public void publishEvent(FacesContext facesContext, Class<? extends SystemEvent> systemEventClass, Class<?> sourceBaseType, Object source)
+    {
+       
+        wrappedApplication.publishEvent(facesContext, systemEventClass, sourceBaseType, source);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#publishEvent(javax.faces.context.FacesContext, java.lang.Class, java.lang.Object)
+     */
+    @Override
+    public void publishEvent(FacesContext facesContext, Class<? extends SystemEvent> systemEventClass, Object source)
+    {
+       
+        wrappedApplication.publishEvent(facesContext, systemEventClass, source);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#removeELContextListener(javax.el.ELContextListener)
+     */
+    @Override
+    public void removeELContextListener(ELContextListener listener)
+    {
+       
+        wrappedApplication.removeELContextListener(listener);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#setResourceHandler(javax.faces.application.ResourceHandler)
+     */
+    @Override
+    public void setResourceHandler(ResourceHandler resourceHandler)
+    {
+       
+        wrappedApplication.setResourceHandler(resourceHandler);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#subscribeToEvent(java.lang.Class, java.lang.Class, javax.faces.event.SystemEventListener)
+     */
+    @Override
+    public void subscribeToEvent(Class<? extends SystemEvent> systemEventClass, Class<?> sourceClass, SystemEventListener listener)
+    {
+       
+        wrappedApplication.subscribeToEvent(systemEventClass, sourceClass, listener);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#subscribeToEvent(java.lang.Class, javax.faces.event.SystemEventListener)
+     */
+    @Override
+    public void subscribeToEvent(Class<? extends SystemEvent> systemEventClass, SystemEventListener listener)
+    {
+       
+        wrappedApplication.subscribeToEvent(systemEventClass, listener);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#unsubscribeFromEvent(java.lang.Class, java.lang.Class, javax.faces.event.SystemEventListener)
+     */
+    @Override
+    public void unsubscribeFromEvent(Class<? extends SystemEvent> systemEventClass, Class<?> sourceClass, SystemEventListener listener)
+    {
+       
+        wrappedApplication.unsubscribeFromEvent(systemEventClass, sourceClass, listener);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.Application#unsubscribeFromEvent(java.lang.Class, javax.faces.event.SystemEventListener)
+     */
+    @Override
+    public void unsubscribeFromEvent(Class<? extends SystemEvent> systemEventClass, SystemEventListener listener)
+    {
+       
+        wrappedApplication.unsubscribeFromEvent(systemEventClass, listener);
+    }
+    
+    
+    
+
+}

Propchange: openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplication.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplicationFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplicationFactory.java?rev=940119&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplicationFactory.java (added)
+++ openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplicationFactory.java Sat May  1 22:20:53 2010
@@ -0,0 +1,63 @@
+/*
+ * 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.jsf;
+
+import javax.faces.application.Application;
+import javax.faces.application.ApplicationFactory;
+
+public class OwbApplicationFactory extends ApplicationFactory
+{
+    private ApplicationFactory wrapped;
+    
+    private Application wrappedApplication;
+    
+    public OwbApplicationFactory(ApplicationFactory applicationFactory)
+    {
+        this.wrapped = applicationFactory;        
+    }
+
+    @Override
+    public Application getApplication()
+    {
+        if(wrappedApplication == null)
+        {
+            wrappedApplication = new OwbApplication(wrapped.getApplication());
+        }
+        
+        return wrappedApplication;
+    }
+
+    @Override
+    public void setApplication(Application arg0)
+    {
+        this.wrapped.setApplication(arg0);
+    }
+
+    /* (non-Javadoc)
+     * @see javax.faces.application.ApplicationFactory#getWrapped()
+     */
+    @Override
+    public ApplicationFactory getWrapped()
+    {
+        return wrapped.getWrapped();
+    }
+    
+    
+
+}

Propchange: openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/OwbApplicationFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/OpenWebBeansJsfPlugin.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/OpenWebBeansJsfPlugin.java?rev=940119&r1=940118&r2=940119&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/OpenWebBeansJsfPlugin.java (original)
+++ openwebbeans/trunk/webbeans-jsf/src/main/java/org/apache/webbeans/jsf/plugin/OpenWebBeansJsfPlugin.java Sat May  1 22:20:53 2010
@@ -19,7 +19,7 @@ import org.apache.webbeans.exception.Web
 import org.apache.webbeans.spi.plugins.AbstractOwbPlugin;
 import org.apache.webbeans.util.ClassUtil;
 
-public class OpenWebBeansJsfPlugin extends AbstractOwbPlugin 
+public class OpenWebBeansJsfPlugin extends AbstractOwbPlugin
 {
 
     /** {@inheritDoc} */
@@ -31,5 +31,4 @@ public class OpenWebBeansJsfPlugin exten
                                                      + " can not implement JSF UIComponent");
         }
     }
-
 }

Modified: openwebbeans/trunk/webbeans-jsf/src/main/resources/META-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-jsf/src/main/resources/META-INF/faces-config.xml?rev=940119&r1=940118&r2=940119&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-jsf/src/main/resources/META-INF/faces-config.xml (original)
+++ openwebbeans/trunk/webbeans-jsf/src/main/resources/META-INF/faces-config.xml Sat May  1 22:20:53 2010
@@ -20,6 +20,11 @@ under the License.
 <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xi="http://www.w3.org/2001/XInclude"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
+ 
+ <factory>
+      <application-factory>org.apache.webbeans.jsf.OwbApplicationFactory</application-factory>
+   </factory>
+ 
  <application>
   <view-handler>org.apache.webbeans.jsf.ConversationAwareViewHandler</view-handler>
   <el-resolver>org.apache.webbeans.el.WebBeansELResolver</el-resolver>

Modified: openwebbeans/trunk/webbeans-openejb/src/main/java/org/apache/webbeans/ejb/EjbPlugin.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-openejb/src/main/java/org/apache/webbeans/ejb/EjbPlugin.java?rev=940119&r1=940118&r2=940119&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-openejb/src/main/java/org/apache/webbeans/ejb/EjbPlugin.java (original)
+++ openwebbeans/trunk/webbeans-openejb/src/main/java/org/apache/webbeans/ejb/EjbPlugin.java Sat May  1 22:20:53 2010
@@ -22,6 +22,7 @@ import java.util.concurrent.ConcurrentHa
 
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
 import javax.enterprise.inject.spi.SessionBeanType;
 
 import org.apache.openejb.Container;
@@ -169,7 +170,7 @@ public class EjbPlugin extends AbstractO
     public void beforeApplicationDestroyed(AppInfo appInfo) {
     }
     
-    public <T> Bean<T> defineSessionBean(Class<T> clazz)
+    public <T> Bean<T> defineSessionBean(Class<T> clazz, ProcessAnnotatedType<T> processAnnotatedTypeEvent)
     {
         if(!isSessionBean(clazz))
         {
@@ -202,7 +203,7 @@ public class EjbPlugin extends AbstractO
         bean.setDeploymentInfo(info);
         bean.setEjbType(type);
         
-        EjbUtility.fireEvents(clazz, bean);
+        EjbUtility.fireEvents(clazz, bean, processAnnotatedTypeEvent);
         
         return bean;
     }

Modified: openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/EjbTestContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/EjbTestContext.java?rev=940119&r1=940118&r2=940119&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/EjbTestContext.java (original)
+++ openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/EjbTestContext.java Sat May  1 22:20:53 2010
@@ -20,6 +20,8 @@ import org.apache.openejb.OpenEJB;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.ejb.component.OpenEjbBean;
 import org.apache.webbeans.plugins.PluginLoader;
+import org.apache.webbeans.portable.AnnotatedElementFactory;
+import org.apache.webbeans.portable.events.generics.GProcessAnnotatedType;
 
 public abstract class EjbTestContext
 {    
@@ -59,9 +61,11 @@ public abstract class EjbTestContext
         }
     }
     
+    @SuppressWarnings("unchecked")
     protected <T> OpenEjbBean<T> defineEjbBean(Class<T> ejbClass)
     {
         EjbPlugin plugin = new EjbPlugin();
-       return (OpenEjbBean<T>)plugin.defineSessionBean(ejbClass);
+       return (OpenEjbBean<T>)plugin.defineSessionBean(ejbClass, 
+               new GProcessAnnotatedType(AnnotatedElementFactory.newAnnotatedType(ejbClass)));
     }
 }

Modified: openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/bean/SimpleBeanTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/bean/SimpleBeanTest.java?rev=940119&r1=940118&r2=940119&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/bean/SimpleBeanTest.java (original)
+++ openwebbeans/trunk/webbeans-openejb/src/test/java/org/apache/webbeans/ejb/bean/SimpleBeanTest.java Sat May  1 22:20:53 2010
@@ -18,6 +18,8 @@ import junit.framework.Assert;
 import org.apache.webbeans.ejb.EjbPlugin;
 import org.apache.webbeans.ejb.EjbTestContext;
 import org.apache.webbeans.ejb.component.OpenEjbBean;
+import org.apache.webbeans.portable.AnnotatedElementFactory;
+import org.apache.webbeans.portable.events.generics.GProcessAnnotatedType;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -42,6 +44,7 @@ public class SimpleBeanTest extends EjbT
     }
 
     @Test
+    @SuppressWarnings("unchecked")
     public void testLocalMethod()
     {
         EjbPlugin plugin = new EjbPlugin();
@@ -49,7 +52,9 @@ public class SimpleBeanTest extends EjbT
         
         Assert.assertTrue(value);
         
-        OpenEjbBean<SimpleBean> bean = (OpenEjbBean<SimpleBean>)plugin.defineSessionBean(SimpleBean.class);
+        GProcessAnnotatedType annotatedType = new GProcessAnnotatedType(AnnotatedElementFactory.newAnnotatedType(SimpleBean.class));
+        
+        OpenEjbBean<SimpleBean> bean = (OpenEjbBean<SimpleBean>)plugin.defineSessionBean(SimpleBean.class, annotatedType);
         Assert.assertNotNull(bean);
         
         

Modified: openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/AbstractOwbPlugin.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/AbstractOwbPlugin.java?rev=940119&r1=940118&r2=940119&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/AbstractOwbPlugin.java (original)
+++ openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/AbstractOwbPlugin.java Sat May  1 22:20:53 2010
@@ -38,6 +38,12 @@ public abstract class AbstractOwbPlugin 
     public void isManagedBean(Class<?> clazz) throws Exception
     {
     }
+    
+    /** @{inheritDoc} */
+    public boolean supportsJavaEeComponentInjections(Class<?> targetClass)
+    {        
+        return false;
+    }
 
     /** @{inheritDoc} */
     public void shutDown() throws Exception

Modified: openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java?rev=940119&r1=940118&r2=940119&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java (original)
+++ openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansEjbPlugin.java Sat May  1 22:20:53 2010
@@ -15,6 +15,7 @@ package org.apache.webbeans.spi.plugins;
 
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
 
 /**
  * Session bean related plugin contract.
@@ -35,8 +36,9 @@ public interface OpenWebBeansEjbPlugin e
      * Configures session bean and adds it into the container.
      * 
      * @param clazz session bean class
+     * @param processAnnotateTypeEvent process annotated type event
      */
-    public <T> Bean<T> defineSessionBean(Class<T> clazz);
+    public <T> Bean<T> defineSessionBean(Class<T> clazz, ProcessAnnotatedType<T> processAnnotateTypeEvent);
 
     /**
      * Returns true if given class is singleton session bean, false otherwise.

Modified: openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansPlugin.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansPlugin.java?rev=940119&r1=940118&r2=940119&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansPlugin.java (original)
+++ openwebbeans/trunk/webbeans-spi/src/main/java/org/apache/webbeans/spi/plugins/OpenWebBeansPlugin.java Sat May  1 22:20:53 2010
@@ -65,6 +65,15 @@ public interface OpenWebBeansPlugin
     public boolean supportService(Class<?> serviceClass);
     
     /**
+     * Returns true if given class supports injections,
+     * false otherwise.
+     * @param targetClass any target class
+     * @return true if given class supports injections
+     */
+    public boolean supportsJavaEeComponentInjections(Class<?> targetClass);
+    
+    
+    /**
      * Gets service instance.
      * @param <T> type
      * @param serviceClass service class

Modified: openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java?rev=940119&r1=940118&r2=940119&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java (original)
+++ openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java Sat May  1 22:20:53 2010
@@ -33,19 +33,27 @@ import org.apache.webbeans.spi.SecurityS
 import org.apache.webbeans.spi.plugins.AbstractOwbPlugin;
 import org.apache.webbeans.spi.plugins.OpenWebBeansWebPlugin;
 
+/**
+ * Tomcat plugin for OWB.
+ * 
+ * @version $Rev$ $Date$
+ *
+ */
 public class TomcatWebPlugin extends AbstractOwbPlugin implements OpenWebBeansWebPlugin
 {
+    //Security service implementation.
     private final TomcatSecurityService securityService = new TomcatSecurityService();
     
+    /**
+     * Default constructor.
+     */
     public TomcatWebPlugin()
     {
         
     }
     
-    
-
-    /* (non-Javadoc)
-     * @see org.apache.webbeans.plugins.AbstractOwbPlugin#getSupportedService(java.lang.Class)
+    /**
+     * {@inheritDoc}
      */
     @Override
     public <T> T getSupportedService(Class<T> serviceClass)
@@ -59,7 +67,9 @@ public class TomcatWebPlugin extends Abs
     }
 
 
-
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public void isManagedBean(Class<?> clazz) throws Exception
     {
@@ -77,9 +87,33 @@ public class TomcatWebPlugin extends Abs
             throw new Exception("Given class  : " + clazz.getName() + " is not managed bean");
         }
     }
-
-    /* (non-Javadoc)
-     * @see org.apache.webbeans.plugins.AbstractOwbPlugin#supportService(java.lang.Class)
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean supportsJavaEeComponentInjections(Class<?> clazz)
+    {
+        if(Servlet.class.isAssignableFrom(clazz) ||
+                Filter.class.isAssignableFrom(clazz) ||
+                ServletContextListener.class.isAssignableFrom(clazz) ||
+                ServletContextAttributeListener.class.isAssignableFrom(clazz) ||
+                HttpSessionActivationListener.class.isAssignableFrom(clazz) ||
+                HttpSessionAttributeListener.class.isAssignableFrom(clazz) ||
+                HttpSessionBindingListener.class.isAssignableFrom(clazz) ||
+                HttpSessionListener.class.isAssignableFrom(clazz) ||
+                ServletRequestListener.class.isAssignableFrom(clazz) ||
+                ServletRequestAttributeListener.class.isAssignableFrom(clazz) )
+        {
+            return true;
+        }
+        
+        return false;
+    }
+    
+    
+    /**
+     * {@inheritDoc}
      */
     @Override
     public boolean supportService(Class<?> serviceClass)

Propchange: openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/TomcatWebPlugin.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java?rev=940119&r1=940118&r2=940119&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java (original)
+++ openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/lifecycle/WebContainerLifecycle.java Sat May  1 22:20:53 2010
@@ -31,6 +31,7 @@ import javax.servlet.jsp.JspFactory;
 import org.apache.webbeans.config.OpenWebBeansConfiguration;
 import org.apache.webbeans.config.OWBLogConst;
 import org.apache.webbeans.conversation.ConversationManager;
+import org.apache.webbeans.el.OwbElContextListener;
 import org.apache.webbeans.el.WebBeansELResolver;
 import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.lifecycle.AbstractLifeCycle;
@@ -97,15 +98,21 @@ public final class WebContainerLifecycle
         service = Executors.newScheduledThreadPool(1);
         service.scheduleWithFixedDelay(new ConversationCleaner(), delay, delay, TimeUnit.MILLISECONDS);
         
+        WebBeansELResolver resolver = new WebBeansELResolver();
+        OwbElContextListener elContextListener = new OwbElContextListener();
         //Application is configured as JSP
         if(OpenWebBeansConfiguration.getInstance().isJspApplication())
         {
             logger.debug("Application is configured as JSP. Adding EL Resolver.");
             
             JspApplicationContext applicationCtx = JspFactory.getDefaultFactory().getJspApplicationContext((ServletContext)(startupObject));
-            applicationCtx.addELResolver(new WebBeansELResolver());  
-        }      
-        
+            applicationCtx.addELResolver(resolver);  
+            
+            logger.debug("Application is configured as JSP. Adding EL Listener.");
+            
+            //Adding listener
+            applicationCtx.addELContextListener(elContextListener);                        
+        }              
         
         // Add BeanManager to the 'javax.enterprise.inject.spi.BeanManager' servlet context attribute
         ServletContext servletContext = (ServletContext)(startupObject); 



Mime
View raw message