You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2012/12/04 22:07:51 UTC

svn commit: r1417182 [16/22] - in /openejb/trunk/openejb: container/openejb-core/ deps/ deps/webbeans-impl/ deps/webbeans-impl/src/ deps/webbeans-impl/src/main/ deps/webbeans-impl/src/main/java/ deps/webbeans-impl/src/main/java/org/ deps/webbeans-impl/...

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedFieldImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedFieldImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedFieldImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedFieldImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+import java.lang.reflect.Field;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * Implementation of {@link AnnotatedField} interface.
+ * 
+ * @version $Rev: 1182780 $ $Date: 2011-10-13 13:11:03 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <X>
+ */
+public class AnnotatedFieldImpl<X> extends AbstractAnnotatedMember<X> implements AnnotatedField<X>
+{
+
+    /**
+     * Creates a new instance
+     * 
+     * @param declaringType base type
+     * @param javaMember field
+     */
+    AnnotatedFieldImpl(WebBeansContext webBeansContext, Field javaMember, AnnotatedType<X> declaringType)
+    {
+        super(webBeansContext, javaMember.getGenericType(), javaMember,declaringType);
+        
+        setAnnotations(javaMember.getDeclaredAnnotations());
+    }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    public Field getJavaMember()
+    {
+        return Field.class.cast(javaMember);
+    }
+    
+    public String toString()
+    {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Annotated Field,");
+        builder.append(super.toString());
+        
+        return builder.toString();
+    }
+    
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedMethodImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedMethodImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedMethodImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedMethodImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+import java.lang.reflect.Method;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * Implementation of {@link AnnotatedMethod} interface.
+ * 
+ * @version $Rev: 1182780 $ $Date: 2011-10-13 13:11:03 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <X> class info
+ */
+class AnnotatedMethodImpl<X> extends AbstractAnnotatedCallable<X> implements AnnotatedMethod<X>
+{
+
+    /**
+     * Create a ew instance.
+     * 
+     * @param declaringType declaring type
+     * @param javaMember method
+     */
+    AnnotatedMethodImpl(WebBeansContext webBeansContext, Method javaMember,AnnotatedType<X> declaringType)
+    {        
+        super(webBeansContext, javaMember.getGenericReturnType(), javaMember,declaringType);
+        setAnnotations(javaMember.getDeclaredAnnotations());
+        setAnnotatedParameters(javaMember.getGenericParameterTypes(), javaMember.getParameterAnnotations());
+    }
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Method getJavaMember()
+    {
+        return Method.class.cast(javaMember);
+    }
+    
+    public String toString()
+    {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Annotated Method,");
+        builder.append(super.toString());
+        
+        return builder.toString();
+    }
+    
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedParameterImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedParameterImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedParameterImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedParameterImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+import java.lang.reflect.Type;
+
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+
+/**
+ * Implementation of {@link AnnotatedParameter} interface.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <X> declaring class info
+ */
+class AnnotatedParameterImpl<X> extends AbstractAnnotated implements AnnotatedParameter<X>
+{
+    /**Declaring callable*/
+    private final AnnotatedCallable<X> declaringCallable;
+    
+    /**Parameter position*/
+    private final int position;
+    
+    AnnotatedParameterImpl(WebBeansContext webBeansContext, Type baseType, AnnotatedCallable<X> declaringCallable, int position)
+    {
+        super(webBeansContext, baseType);
+        this.declaringCallable = declaringCallable;
+        this.position = position;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public AnnotatedCallable<X> getDeclaringCallable()
+    {
+        return declaringCallable;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getPosition()
+    {
+        return position;
+    }
+
+    public String toString()
+    {
+        StringBuilder builder = new StringBuilder();
+        builder.append("Annotated Parameter");
+        builder.append(",");
+        builder.append(super.toString()+ ",");
+        builder.append("Position : " + position);
+        
+        return builder.toString();
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/AnnotatedTypeImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+
+/**
+ * Implementation of the {@link AnnotatedType} interface.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <X> class type
+ */
+class AnnotatedTypeImpl<X> extends AbstractAnnotated implements AnnotatedType<X>
+{
+    /**Annotated class*/
+    private final Class<X> annotatedClass;
+    
+    /**Constructors*/
+    private Set<AnnotatedConstructor<X>> constructors = null;
+    
+    /**Fields*/
+    private Set<AnnotatedField<? super X>> fields = null;
+    
+    /**Methods*/
+    private Set<AnnotatedMethod<? super X>> methods = null;
+    
+    /**
+     * Creates a new instance.
+     * 
+     * @param annotatedClass class
+     */
+    AnnotatedTypeImpl(WebBeansContext webBeansContext, Class<X> annotatedClass)
+    {
+        super(webBeansContext, annotatedClass);
+        this.annotatedClass = annotatedClass;     
+        
+        setAnnotations(annotatedClass.getDeclaredAnnotations());
+    }
+
+    private synchronized void init()
+    {
+        if (constructors == null)
+        {
+            constructors = new HashSet<AnnotatedConstructor<X>>();
+            fields = new HashSet<AnnotatedField<? super X>>();
+            methods = new HashSet<AnnotatedMethod<? super X>>();
+
+            Field[] decFields = getWebBeansContext().getSecurityService().doPrivilegedGetDeclaredFields(annotatedClass);
+            Method[] decMethods = getWebBeansContext().getSecurityService().doPrivilegedGetDeclaredMethods(annotatedClass);
+            Constructor<?>[] decCtxs = getWebBeansContext().getSecurityService().doPrivilegedGetDeclaredConstructors(annotatedClass);
+            for(Field f : decFields)
+            {
+                if (!f.isSynthetic())
+                {
+                    AnnotatedField<X> af = new AnnotatedFieldImpl<X>(getWebBeansContext(), f, this);
+                    fields.add(af);
+                }
+            }
+
+            for(Method m : decMethods)
+            {
+                if (!m.isSynthetic() && !m.isBridge())
+                {
+                    AnnotatedMethod<X> am = new AnnotatedMethodImpl<X>(getWebBeansContext(), m,this);
+                    methods.add(am);
+                }
+            }
+
+            for(Constructor<?> ct : decCtxs)
+            {
+                if (!ct.isSynthetic())
+                {
+                    AnnotatedConstructor<X> ac = new AnnotatedConstructorImpl<X>(getWebBeansContext(), (Constructor<X>) ct,this);
+                    constructors.add(ac);
+                }
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Class<X> getJavaClass()
+    {
+        return annotatedClass;
+    }
+
+
+    /**
+     * Adds new annotated constructor.
+     * 
+     * @param constructor new constructor
+     */
+    void addAnnotatedConstructor(AnnotatedConstructor<X> constructor)
+    {
+        if (constructors == null)
+        {
+            init();
+        }
+        constructors.add(constructor);
+    }
+    
+    /**
+     * Adds new annotated field.
+     * 
+     * @param field new field
+     */
+    void addAnnotatedField(AnnotatedField<? super X> field)
+    {
+        if (constructors == null)
+        {
+            init();
+        }
+        fields.add(field);
+    }
+
+    /**
+     * Adds new annotated method.
+     * 
+     * @param method new method
+     */
+    void addAnnotatedMethod(AnnotatedMethod<? super X> method)
+    {
+        if (constructors == null)
+        {
+            init();
+        }
+        methods.add(method);
+    }    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Set<AnnotatedConstructor<X>> getConstructors()
+    {
+        if (constructors == null)
+        {
+            init();
+        }
+
+        return Collections.unmodifiableSet(constructors);
+    }
+
+    /**
+     * {@inheritDoc}
+     */    
+    public Set<AnnotatedField<? super X>> getFields()
+    {
+        if (constructors == null)
+        {
+            init();
+        }
+
+        return Collections.unmodifiableSet(fields);
+    }
+
+    /**
+     * {@inheritDoc}
+     */    
+    public Set<AnnotatedMethod<? super X>> getMethods()
+    {
+        if (constructors == null)
+        {
+            init();
+        }
+
+        return Collections.unmodifiableSet(methods);
+    }
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/AbstractProducer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/AbstractProducer.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/AbstractProducer.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/AbstractProducer.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.creation;
+
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.component.OwbBean;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+
+/**
+ * Abstract implementation of {@link Producer} contract.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <T> bean type info
+ */
+public abstract class AbstractProducer<T> implements Producer<T> 
+{
+    /**Bean instance*/
+    protected OwbBean<T> bean;
+
+    /**Passing creational context*/
+    protected CreationalContext<T> creationalContext = null;
+    
+    /**
+     * Create a new producer with given bean.
+     * 
+     * @param bean bean instance
+     */
+    protected AbstractProducer(OwbBean<T> bean)
+    {
+        this.bean = bean;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Set<InjectionPoint> getInjectionPoints()
+    {
+        return bean.getInjectionPoints();
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public T produce(CreationalContext<T> creationalContext)
+    {
+        T instance;
+        if(!(creationalContext instanceof CreationalContextImpl))
+        {
+            creationalContext = bean.getWebBeansContext().getCreationalContextFactory().wrappedCreationalContext(creationalContext, bean);
+        }
+        
+        //Save it
+        this.creationalContext = creationalContext;
+        
+        //Create an instance of the bean
+        instance = bean.createNewInstance(this.creationalContext);
+                
+        return instance; 
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose(T instance)
+    {
+        bean.destroyCreatedInstance(instance, creationalContext);
+    }
+
+    /**
+     * Returns actual bean instance.
+     * 
+     * @param <X> bean type info
+     * @param clazz bean type class
+     * @return actual bean
+     */
+    protected <X> X getBean(Class<X> clazz)
+    {
+        return clazz.cast(bean);
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducer.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducer.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/InjectionTargetProducer.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.creation;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.apache.webbeans.component.EnterpriseBeanMarker;
+import org.apache.webbeans.component.InjectionTargetBean;
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.inject.AbstractInjectable;
+import org.apache.webbeans.proxy.ProxyFactory;
+
+/**
+ * InjectionTargetProducer implementation.
+ * 
+ * @version $Rev: 1385030 $ $Date: 2012-09-15 10:41:29 +0200 (sam., 15 sept. 2012) $
+ *
+ * @param <T> bean type info
+ */
+@SuppressWarnings("unchecked")
+public class InjectionTargetProducer<T> extends AbstractProducer<T> implements InjectionTarget<T>
+{
+    /**
+     * Creates a new injection target producer.
+     * @param bean injection target bean
+     */
+    public InjectionTargetProducer(InjectionTargetBean<T> bean)
+    {
+        super(bean);
+    }
+        
+    /**
+     * {@inheritDoc}
+     */
+    public void inject(T instance, CreationalContext<T> ctx)
+    {
+        if(!(ctx instanceof CreationalContextImpl))
+        {
+            ctx = bean.getWebBeansContext().getCreationalContextFactory().wrappedCreationalContext(ctx, bean);
+        }
+        
+        Object oldInstanceUnderInjection = AbstractInjectable.instanceUnderInjection.get();
+        boolean isInjectionToAnotherBean = false;
+        try
+        {
+            Contextual<?> contextual = null;
+            if(ctx instanceof CreationalContextImpl)
+            {
+                contextual = ((CreationalContextImpl)ctx).getBean();
+                isInjectionToAnotherBean = contextual == getBean(InjectionTargetBean.class) ? false : true;
+            }
+            
+            if(!isInjectionToAnotherBean)
+            {
+                AbstractInjectable.instanceUnderInjection.set(instance);   
+            }
+                        
+            InjectionTargetBean<T> bean = getBean(InjectionTargetBean.class);
+            
+            if(!(bean instanceof EnterpriseBeanMarker))
+            {
+                //GE: Currently we have a proxy for DependentScoped beans
+                //that has an interceptor or decroator. This means that
+                //injection will be occured on Proxy instances that are 
+                //not correct. Injection must be on actual dependent
+                //instance,so not necessary to inject on proxy
+                final ProxyFactory proxyFactory = this.bean.getWebBeansContext().getProxyFactory();
+                if(bean.getScope() == Dependent.class && proxyFactory.isProxyInstance(instance))
+                {
+                    return;
+                }
+                
+                bean.injectResources(instance, ctx);
+                bean.injectSuperFields(instance, ctx);
+                bean.injectSuperMethods(instance, ctx);
+                bean.injectFields(instance, ctx);
+                bean.injectMethods(instance, ctx);            
+            }                    
+        }
+        finally
+        {
+            if(oldInstanceUnderInjection != null)
+            {
+                AbstractInjectable.instanceUnderInjection.set(oldInstanceUnderInjection);   
+            }
+            else
+            {
+                AbstractInjectable.instanceUnderInjection.set(null);
+                AbstractInjectable.instanceUnderInjection.remove();
+            }
+        }
+        
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void postConstruct(T instance)
+    {
+        InjectionTargetBean<T> bean = getBean(InjectionTargetBean.class);    
+        if(!(bean instanceof EnterpriseBeanMarker))
+        {
+            bean.postConstruct(instance, creationalContext);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void preDestroy(T instance)
+    {
+        InjectionTargetBean<T> bean = getBean(InjectionTargetBean.class);
+        bean.destroyCreatedInstance(instance, creationalContext);
+    }
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/ProducerBeansProducer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/ProducerBeansProducer.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/ProducerBeansProducer.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/creation/ProducerBeansProducer.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.creation;
+
+import org.apache.webbeans.component.AbstractProducerBean;
+
+/**
+ * Implementation for producer beans.
+ * 
+ * @version $Rev: 952250 $ $Date: 2010-06-07 16:39:41 +0200 (lun., 07 juin 2010) $
+ *
+ * @param <T> producer return type info
+ */
+public class ProducerBeansProducer<T> extends AbstractProducer<T>
+{
+    /**
+     * Creats a new producer bean producer.
+     * 
+     * @param bean producer bean
+     */
+    public ProducerBeansProducer(AbstractProducerBean<T> bean)
+    {
+        super(bean);
+    }    
+}
\ No newline at end of file

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ExtensionLoader.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ExtensionLoader.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ExtensionLoader.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ExtensionLoader.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Extension;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.util.Asserts;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Loads META-INF/services/javax.enterprise.inject.spi.Extension
+ * services.
+ * 
+ * @version $Rev: 1363032 $ $Date: 2012-07-18 20:04:35 +0200 (mer., 18 juil. 2012) $
+ *
+ */
+public class ExtensionLoader
+{
+    /**Map of extensions*/
+    private final  Map<Bean<?>, Object> extensions = new ConcurrentHashMap<Bean<?>, Object>();
+    private final Set<Class<? extends Extension>> extensionClasses = new HashSet<Class<? extends Extension>>();
+    private final BeanManagerImpl manager;
+
+    private final WebBeansContext webBeansContext;
+
+    /**
+     * Creates a new loader instance.
+     * @param webBeansContext
+     */
+    public ExtensionLoader(WebBeansContext webBeansContext)
+    {
+
+        this.webBeansContext = webBeansContext;
+        manager = this.webBeansContext.getBeanManagerImpl();
+    }
+
+    /**
+     * Load extension services.
+     */
+    public void loadExtensionServices()
+    {
+        loadExtensionServices(WebBeansUtil.getCurrentClassLoader());
+    }
+
+    /**
+     * Load extension services.
+     * @param classLoader
+     */
+    public void loadExtensionServices(ClassLoader classLoader)
+    {
+        List<Extension> loader = webBeansContext.getLoaderService().load(Extension.class, classLoader);
+        for (Extension extension : loader)
+        {
+            if (!extensionClasses.contains(extension.getClass()))
+            {
+                extensionClasses.add(extension.getClass());
+                try
+                {
+                    addExtension(extension);
+                }
+                catch (Exception e)
+                {
+                    throw new WebBeansException("Error occurred while reading Extension service list", e);
+                }
+            }
+        }        
+    }
+    
+    /**
+     * Returns service bean instance.
+     * 
+     * @param bean service bean
+     * @return service bean instance
+     */
+    @SuppressWarnings("unchecked")
+    public <T> T getBeanInstance(Bean<T> bean)
+    {
+        Asserts.assertNotNull(bean,"bean parameter cannot be null");
+        
+        if(extensions.containsKey(bean))
+        {
+            return (T) extensions.get(bean);
+        }
+        
+        return null;
+    }
+
+
+    /**
+     * Add a CDI Extension to our internal list.
+     * @param ext Extension to add
+     */
+    public void addExtension(Extension ext)
+    {
+        Bean<?> bean = webBeansContext.getWebBeansUtil().createExtensionComponent(ext.getClass());
+        extensions.put(bean, ext);
+
+        manager.addBean(bean);
+    }
+
+    /**
+     * Clear service list.
+     * TODO since this doesn't remove the beans from the BeanManager it's unlikely to allow you to call loadExtensionServices again
+     */
+    public void clear()
+    {
+        extensions.clear();
+        extensionClasses.clear();
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+/**
+ * Default implementation of the {@link ProcessAnnotatedType}.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <X> bean class info
+ */
+public class ProcessAnnotatedTypeImpl<X> implements ProcessAnnotatedType<X>
+{
+    /**Annotated Type*/
+    private AnnotatedType<X> annotatedType = null;
+    
+    /**veto or not*/
+    private boolean veto = false;
+    
+    /**
+     * This field gets set to <code>true</code> when a custom AnnotatedType
+     * got set in an Extension. In this case we must now take this modified
+     * AnnotatedType for our further processing!
+     */
+    private boolean modifiedAnnotatedType = false;
+
+    /**
+     * Creates a new instance with the given annotated type.
+     * 
+     * @param annotatedType annotated type
+     */
+    public ProcessAnnotatedTypeImpl(AnnotatedType<X> annotatedType)
+    {
+        this.annotatedType = annotatedType;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public AnnotatedType<X> getAnnotatedType()
+    {
+        return annotatedType;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setAnnotatedType(AnnotatedType<X> type)
+    {
+        annotatedType = type;
+        modifiedAnnotatedType = true;
+    }
+    
+    /**
+     * Returns sets or not.
+     * 
+     * @return set or not
+     */
+    public boolean isModifiedAnnotatedType()
+    {
+        return modifiedAnnotatedType;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void veto()
+    {
+        veto = true;
+    }
+    
+    /**
+     * Returns veto status.
+     * 
+     * @return veto status
+     */
+    public boolean isVeto()
+    {
+        return veto;
+    }
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessBeanImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ProcessBean;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Implementation of the {@link ProcessBean}.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <X> bean class info
+ */
+public  class ProcessBeanImpl<X> implements ProcessBean<X>
+{
+    /**Annotated instance. Can be AnnotatedType, AnnotatedMethod or AnnotatedField*/
+    private final Annotated annotated;
+    
+    /**ManagedBean, SessionBean, ProducerMethodBean, ProducerFieldBean*/
+    private final Bean<X> bean;
+    
+    protected ProcessBeanImpl(Bean<X> bean, Annotated annotated)
+    {
+        this.bean = bean;
+        this.annotated = annotated;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void addDefinitionError(Throwable t)
+    {
+        WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Annotated getAnnotated()
+    {
+        return annotated;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Bean<X> getBean()
+    {
+        return bean;
+    }
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionTargetImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionTargetImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionTargetImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessInjectionTargetImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Implementation of the {@link ProcessInjectionTarget}.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <X> bean class info
+ */
+public class ProcessInjectionTargetImpl<X> implements ProcessInjectionTarget<X>
+{
+    /**Annotated type instance that is used by container to read meta-data*/
+    private final AnnotatedType<X> annotatedType;
+    
+    /**Injection target that is used by container to inject dependencies*/
+    private InjectionTarget<X> injectionTarget = null;
+    
+    /**Injection target is set or not*/
+    private boolean set = false;
+    
+    /**
+     * Creates a new instance.
+     * 
+     * @param injectionTarget injection target
+     */
+    public ProcessInjectionTargetImpl(InjectionTarget<X> injectionTarget, AnnotatedType<X> annotatedType)
+    {
+        this.injectionTarget = injectionTarget;
+        this.annotatedType = annotatedType;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void addDefinitionError(Throwable t)
+    {
+        WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
+    }
+
+    public AnnotatedType<X> getAnnotatedType()
+    {
+        return annotatedType;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public InjectionTarget<X> getInjectionTarget()
+    {
+        return injectionTarget;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setInjectionTarget(InjectionTarget<X> injectionTarget)
+    {
+        this.injectionTarget = injectionTarget;
+        set = true;
+    }
+
+    /**
+     * Returns whether or not injection target is set or not.
+     * 
+     * @return whether or not injection target is set
+     */
+    public boolean isSet()
+    {
+        return set;
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessManagedBeanImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessManagedBeanImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessManagedBeanImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessManagedBeanImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+
+import org.apache.webbeans.component.ManagedBean;
+
+/**
+ * Implementation of {@link ProcessManagedBean}.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <X> bean class info
+ */
+public class ProcessManagedBeanImpl<X> extends ProcessBeanImpl<X> implements ProcessManagedBean<X>
+{
+    /**Annotated managed bean class*/
+    private final AnnotatedType<X> annotatedBeanClass;
+
+    public ProcessManagedBeanImpl(ManagedBean<X> bean, AnnotatedType<X> annotatedType)
+    {        
+        super(bean, annotatedType);
+        annotatedBeanClass = annotatedType;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public AnnotatedType<X> getAnnotatedBeanClass()
+    {
+        return annotatedBeanClass;
+    }
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessObserverMethodImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Implementation of  {@link ProcessObserverMethod}.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <X> declared bean class
+ * @param <T> event type
+ */
+public class ProcessObserverMethodImpl<T,X> implements ProcessObserverMethod<T, X>
+{
+    /**Observer annotated method*/
+    private final AnnotatedMethod<X> annotatedMethod;
+    
+    /**ObserverMethod instance*/
+    private final ObserverMethod<T> observerMethod;
+
+    public ProcessObserverMethodImpl(AnnotatedMethod<X> annotatedMethod,ObserverMethod<T> observerMethod)
+    {
+        this.annotatedMethod = annotatedMethod;
+        this.observerMethod = observerMethod;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void addDefinitionError(Throwable t)
+    {
+        WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public AnnotatedMethod<X> getAnnotatedMethod()
+    {
+        return annotatedMethod;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ObserverMethod<T> getObserverMethod()
+    {
+        return observerMethod;
+    }
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerFieldImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerFieldImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerFieldImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerFieldImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.ProcessProducerField;
+
+import org.apache.webbeans.component.ProducerFieldBean;
+
+/**
+ * Implementation of the {@link ProcessProducerField}.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <X> producer field return type
+ * @param <T> producer field bean class type
+ */
+public class ProcessProducerFieldImpl<X,T> extends ProcessBeanImpl<T> implements ProcessProducerField<X, T>
+{
+    /**Annotated field*/
+    private final AnnotatedField<X> annotatedField;
+
+    public ProcessProducerFieldImpl(ProducerFieldBean<T> bean, AnnotatedField<X> annotatedField)
+    {
+        super(bean, annotatedField);
+        this.annotatedField = annotatedField;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public AnnotatedField<X> getAnnotatedProducerField()
+    {
+        return annotatedField;
+    }
+    
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.ProcessProducer;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Implementation of {@link ProcessProducer}.
+ * 
+ * @version $Rev: 1363092 $ $Date: 2012-07-18 22:15:55 +0200 (mer., 18 juil. 2012) $
+ *
+ * @param <X> bean class
+ * @param <T> producer return type class
+ */
+public class ProcessProducerImpl<X,T> implements ProcessProducer<X, T>
+{
+    /**Annotated method or annotated field according to producer method or field*/
+    private final AnnotatedMember<X> annotateMember;
+    
+    /**Used by container to produce instance for producer method or field*/
+    private Producer<T> producer = null;
+    
+    public ProcessProducerImpl(Producer<T> producer,AnnotatedMember<X> annotateMember)
+    {
+        this.annotateMember = annotateMember;
+        this.producer = producer;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void addDefinitionError(Throwable t)
+    {
+        WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public AnnotatedMember<X> getAnnotatedMember()
+    {
+        return annotateMember;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Producer<T> getProducer()
+    {
+        return producer;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setProducer(Producer<T> producer)
+    {
+        this.producer = producer;
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerMethodImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerMethodImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerMethodImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessProducerMethodImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+
+import org.apache.webbeans.component.ProducerMethodBean;
+
+/**
+ * Implementation of {@link ProcessProducerMethod}.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <X> producer method return type
+ * @param <T> producer method bean class
+ */
+public class ProcessProducerMethodImpl<X,T> extends ProcessBeanImpl<T> implements ProcessProducerMethod<X, T>
+{
+    /**Disposed parameter*/
+    private final AnnotatedParameter<X> annotatedDisposedParameter;
+    
+    /**Producer method*/
+    private final AnnotatedMethod<X> annotatedProducerMethod;
+
+    public ProcessProducerMethodImpl(ProducerMethodBean<T> bean, AnnotatedMethod<X> method, AnnotatedParameter<X> disposeParameter)
+    {
+        super(bean, method);
+        annotatedProducerMethod = method;
+        annotatedDisposedParameter = disposeParameter;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public AnnotatedParameter<X> getAnnotatedDisposedParameter()
+    {
+        return annotatedDisposedParameter;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public AnnotatedMethod<X> getAnnotatedProducerMethod()
+    {
+        return annotatedProducerMethod;
+    }
+    
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSessionBeanImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSessionBeanImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSessionBeanImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSessionBeanImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.ProcessSessionBean;
+import javax.enterprise.inject.spi.SessionBeanType;
+
+/**
+ * Implementation of {@link ProcessSessionBean}.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <X> ejb class info
+ */
+public class ProcessSessionBeanImpl<X> extends ProcessBeanImpl<Object> implements ProcessSessionBean<X>
+{
+    /**Session bean annotated type*/
+    private final AnnotatedType<Object> annotatedBeanClass;
+    
+    /**Ejb name*/
+    private final String ejbName;
+    
+    /**Session bean type*/
+    private final SessionBeanType type;
+
+    public ProcessSessionBeanImpl(Bean<Object> bean, AnnotatedType<Object> annotatedType, String name, SessionBeanType type)
+    {
+        super(bean, annotatedType);
+        annotatedBeanClass = annotatedType;
+        ejbName = name;
+        this.type = type;
+    }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getEjbName()
+    {
+        return ejbName;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public SessionBeanType getSessionBeanType()
+    {
+        return type;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public AnnotatedType<Object> getAnnotatedBeanClass()
+    {
+        return annotatedBeanClass;
+    }
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events.discovery;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.Interceptor;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.inject.spi.ProcessBean;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+
+import org.apache.webbeans.component.ManagedBean;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.decorator.WebBeansDecorator;
+import org.apache.webbeans.intercept.custom.CustomInterceptor;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.portable.events.generics.GProcessBean;
+import org.apache.webbeans.portable.events.generics.GProcessObservableMethod;
+import org.apache.webbeans.util.AnnotationUtil;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Event that is fired by the container after it discovers beans.
+ * 
+ * @version $Rev: 1362228 $ $Date: 2012-07-16 21:56:23 +0200 (lun., 16 juil. 2012) $
+ *
+ */
+public class AfterBeanDiscoveryImpl implements AfterBeanDiscovery
+{
+    private BeanManagerImpl beanManager = null;
+    
+    private static final Logger logger = WebBeansLoggerFacade.getLogger(AfterBeanDiscoveryImpl.class);
+    private final WebBeansContext webBeansContext;
+
+    public AfterBeanDiscoveryImpl(WebBeansContext webBeansContext)
+    {
+        this.webBeansContext = webBeansContext;
+        beanManager = this.webBeansContext.getBeanManagerImpl();
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @SuppressWarnings("unchecked")
+    public void addBean(Bean<?> bean)
+    {
+        AnnotatedType<?> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(bean.getBeanClass());
+        
+        //Fire Event
+        ProcessBean<?> processBeanEvent = new GProcessBean(bean,annotatedType);
+        beanManager.fireEvent(processBeanEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+        
+        if(bean instanceof Interceptor)
+        {
+            //Required for custom interceptors
+            ManagedBean managedBean =
+                webBeansContext.getWebBeansUtil().defineManagedBeanWithoutFireEvents(
+                    (AnnotatedType<?>) annotatedType);
+            
+            CustomInterceptor<?> interceptor = new CustomInterceptor(managedBean, (Interceptor<?>)bean);
+            if(interceptor.getScope() != Dependent.class)
+            {
+                if(logger.isLoggable(Level.WARNING))
+                {
+                    logger.log(Level.WARNING, OWBLogConst.WARN_0005_1, interceptor.getBeanClass().getName());
+                }
+            }
+            
+            if(interceptor.getName() != null)
+            {
+                if(logger.isLoggable(Level.WARNING))
+                {
+                    logger.log(Level.WARNING, OWBLogConst.WARN_0005_2, interceptor.getBeanClass().getName());
+                }
+            }
+            
+            if(interceptor.isAlternative())
+            {
+                if(logger.isLoggable(Level.WARNING))
+                {
+                    logger.log(Level.WARNING, OWBLogConst.WARN_0005_3, interceptor.getBeanClass().getName());
+                }                
+            }
+
+            beanManager.addInterceptor(interceptor);
+            webBeansContext.getBeanManagerImpl().addCustomInterceptorClass(bean.getBeanClass());
+        }
+        
+        else if(bean instanceof Decorator)
+        {
+            //Required for custom decorators
+            ManagedBean managedBean =
+                webBeansContext.getWebBeansUtil().defineManagedBeanWithoutFireEvents(
+                    (AnnotatedType<?>) annotatedType);
+            if(managedBean.getScope() != Dependent.class)
+            {
+                if(logger.isLoggable(Level.WARNING))
+                {
+                    logger.log(Level.WARNING, OWBLogConst.WARN_0005_1, managedBean.getBeanClass().getName());
+                }
+            }
+            
+            if(managedBean.getName() != null)
+            {
+                if(logger.isLoggable(Level.WARNING))
+                {
+                    logger.log(Level.WARNING, OWBLogConst.WARN_0005_2, managedBean.getBeanClass().getName());
+                }
+            }
+            
+            if(managedBean.isAlternative())
+            {
+                if(logger.isLoggable(Level.WARNING))
+                {
+                    logger.log(Level.WARNING, OWBLogConst.WARN_0005_3, managedBean.getBeanClass().getName());
+                }                
+            }
+
+
+            beanManager.addDecorator(new WebBeansDecorator(managedBean, (Decorator) bean));
+            webBeansContext.getBeanManagerImpl().addCustomDecoratorClass(bean.getBeanClass());
+        }
+        else
+        {
+            beanManager.addBean(bean);
+        }                
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addContext(Context context)
+    {
+        beanManager.addContext(context);
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addDefinitionError(Throwable t)
+    {
+        beanManager.getErrorStack().pushError(t);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addObserverMethod(ObserverMethod<?> observerMethod)
+    {
+        ProcessObserverMethod<?, ?> event = new GProcessObservableMethod(null,observerMethod);
+        beanManager.fireEvent(event, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+        beanManager.getNotificationManager().addObserver(observerMethod, observerMethod.getObservedType());
+    }
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterDeploymentValidationImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterDeploymentValidationImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterDeploymentValidationImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterDeploymentValidationImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events.discovery;
+
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+
+import org.apache.webbeans.container.BeanManagerImpl;
+
+/**
+ * Event that is fired by the container after it validates
+ * deployment.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ */
+public class AfterDeploymentValidationImpl implements AfterDeploymentValidation
+{
+    private final BeanManagerImpl beanManagerImpl;
+
+    public AfterDeploymentValidationImpl(BeanManagerImpl beanManagerImpl)
+    {
+        this.beanManagerImpl = beanManagerImpl;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addDeploymentProblem(Throwable t)
+    {
+        beanManagerImpl.getErrorStack().pushError(t);
+    }
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeBeanDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeBeanDiscoveryImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeBeanDiscoveryImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeBeanDiscoveryImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events.discovery;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.container.BeanManagerImpl;
+import org.apache.webbeans.container.ExternalScope;
+import org.apache.webbeans.deployment.StereoTypeModel;
+
+/**
+ * Events that is fired before container starts to discover beans.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ */
+public class BeforeBeanDiscoveryImpl implements BeforeBeanDiscovery
+{
+    
+    private BeanManagerImpl beanManager = null;
+    private final WebBeansContext webBeansContext;
+
+    public BeforeBeanDiscoveryImpl(WebBeansContext webBeansContext)
+    {
+        this.webBeansContext = webBeansContext;
+        beanManager = this.webBeansContext.getBeanManagerImpl();
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void addAnnotatedType(AnnotatedType<?> type)
+    {
+        beanManager.addAdditionalAnnotatedType(type);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addQualifier(Class<? extends Annotation> qualifier)
+    {
+        beanManager.addAdditionalQualifier(qualifier);
+        
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addInterceptorBinding(Class<? extends Annotation> binding, Annotation... bindingDef)
+    {
+        webBeansContext.getBeanManagerImpl().addInterceptorBindingType(binding, bindingDef);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addScope(Class<? extends Annotation> scope, boolean normal, boolean passivating)
+    {
+        ExternalScope additionalScope = new ExternalScope(scope, normal, passivating); 
+        beanManager.addAdditionalScope(additionalScope);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addStereotype(Class<? extends Annotation> stereotype, Annotation... stereotypeDef)
+    {
+        webBeansContext.getAnnotationManager().checkStereoTypeClass(stereotype, stereotypeDef);
+        StereoTypeModel model = new StereoTypeModel(webBeansContext, stereotype, stereotypeDef);
+        webBeansContext.getStereoTypeManager().addStereoTypeModel(model);
+    }
+
+}
\ No newline at end of file

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeShutdownImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeShutdownImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeShutdownImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/BeforeShutdownImpl.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events.discovery;
+
+import javax.enterprise.inject.spi.BeforeShutdown;
+
+/**
+ * Event that is fired by the container before it shuts down.
+ * 
+ * @version $Rev: 952250 $ $Date: 2010-06-07 16:39:41 +0200 (lun., 07 juin 2010) $
+ *
+ */
+public class BeforeShutdownImpl implements BeforeShutdown
+{
+    /**
+     * Creates a new instance.
+     */
+    public BeforeShutdownImpl()
+    {
+        super();
+    }
+}
\ No newline at end of file

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events.discovery;
+
+import java.util.Iterator;
+import java.util.Stack;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+
+/**
+ * Error stack.
+ * @version $Rev$ $Date$
+ *
+ */
+public class ErrorStack
+{
+    private static final Logger logger = WebBeansLoggerFacade.getLogger(ErrorStack.class);
+    
+    private Stack<Throwable> errorStack = new Stack<Throwable>();
+    
+    public ErrorStack()
+    {
+        
+    }
+    
+    public void pushError(Throwable e)
+    {
+        errorStack.addElement(e);
+    }
+
+    public Throwable[] popErrors()
+    {
+        Throwable[] list = new Throwable[errorStack.size()];
+        list = errorStack.toArray(list);
+        
+        return list;
+    }
+    
+    public void logErrors()
+    {
+        if(!errorStack.isEmpty())
+        {
+            Iterator<Throwable> it = errorStack.iterator();
+            while(it.hasNext())
+            {
+                Throwable t = it.next();
+                logger.log(Level.SEVERE, t.getMessage(), t);
+            }
+        }
+    }
+    
+    public void clear()
+    {
+        errorStack.clear();
+    }
+    
+    public boolean hasErrors()
+    {
+        return !errorStack.isEmpty();
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.portable.events.ProcessAnnotatedTypeImpl;
+
+@SuppressWarnings("unchecked")
+public class GProcessAnnotatedType extends ProcessAnnotatedTypeImpl implements GenericBeanEvent
+{
+    public GProcessAnnotatedType(AnnotatedType annotatedType )
+    {
+        super(annotatedType);
+    }
+
+    public Class<?> getBeanClassFor(Class<?> eventClass)
+    {
+        return getAnnotatedType().getJavaClass();
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessBean.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessBean.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessBean.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.portable.events.ProcessBeanImpl;
+
+@SuppressWarnings("unchecked")
+public class GProcessBean extends ProcessBeanImpl implements GenericBeanEvent
+{
+    public GProcessBean(Bean<?> bean,AnnotatedType<?> annotated)
+    {
+        super(bean,annotated);
+    }
+
+    public Class<?> getBeanClassFor(Class<?> eventClass)
+    {
+        return getBean().getBeanClass();
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessInjectionTarget.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessInjectionTarget.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessInjectionTarget.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessInjectionTarget.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+import org.apache.webbeans.portable.events.ProcessInjectionTargetImpl;
+
+@SuppressWarnings("unchecked")
+public class GProcessInjectionTarget extends ProcessInjectionTargetImpl implements GenericBeanEvent
+{
+    public GProcessInjectionTarget(InjectionTarget<?> injectionTarget,AnnotatedType<?> annotatedType)
+    {
+        super(injectionTarget, annotatedType);
+    }
+
+    public Class<?> getBeanClassFor(Class<?> eventClass)
+    {
+        return getAnnotatedType().getJavaClass();
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessManagedBean.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.component.ManagedBean;
+import org.apache.webbeans.portable.events.ProcessManagedBeanImpl;
+
+@SuppressWarnings("unchecked")
+public class GProcessManagedBean extends ProcessManagedBeanImpl implements GenericBeanEvent
+{
+    public GProcessManagedBean(ManagedBean<?> bean,AnnotatedType<?> annotated)
+    {
+        super(bean,annotated);
+    }
+
+    public Class<?> getBeanClassFor(Class<?> eventClass)
+    {
+        return getBean().getBeanClass();
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessObservableMethod.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.ObserverMethod;
+
+import org.apache.webbeans.portable.events.ProcessObserverMethodImpl;
+import org.apache.webbeans.util.ClassUtil;
+
+@SuppressWarnings("unchecked")
+public class GProcessObservableMethod extends ProcessObserverMethodImpl implements GenericProducerObserverEvent
+{
+
+    public GProcessObservableMethod(AnnotatedMethod<?> annotatedMethod, ObserverMethod<?> observerMethod)
+    {
+        super(annotatedMethod, observerMethod);
+    }
+
+    public Class<?> getBeanClass()
+    {
+        return getObserverMethod().getBeanClass();
+    }
+
+    public Class<?> getProducerOrObserverType()
+    {
+        return ClassUtil.getClazz(getObserverMethod().getObservedType());
+    }
+
+    
+    
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessProducer.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.portable.events.generics;
+
+import javax.enterprise.inject.spi.AnnotatedMember;
+import javax.enterprise.inject.spi.Producer;
+
+import org.apache.webbeans.portable.events.ProcessProducerImpl;
+import org.apache.webbeans.util.ClassUtil;
+
+@SuppressWarnings("unchecked")
+public class GProcessProducer extends ProcessProducerImpl implements GenericProducerObserverEvent
+{
+    public GProcessProducer(Producer<?> producer, AnnotatedMember<?> annotateMember)
+    {
+        super(producer,annotateMember);
+    }
+
+    public Class<?> getBeanClass()
+    {
+        return getAnnotatedMember().getDeclaringType().getJavaClass();
+    }
+
+    public Class<?> getProducerOrObserverType()
+    {
+        return ClassUtil.getClazz(getAnnotatedMember().getBaseType());
+    }
+
+
+}