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 [3/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/s...

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetBean.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,187 @@
+/*
+ * 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.component;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Decorator;
+
+import org.apache.webbeans.config.inheritance.IBeanInheritedMetaData;
+import org.apache.webbeans.intercept.InterceptorData;
+
+/**
+ * Defines contract for injection target beans.
+ * 
+ * @version $Rev: 952250 $ $Date: 2010-06-07 16:39:41 +0200 (lun., 07 juin 2010) $
+ *
+ * @param <T> bean type
+ */
+public interface InjectionTargetBean<T> extends OwbBean<T>
+{
+    /**
+     * Returns set of observable methods.
+     * 
+     * @return set of observable methods
+     */
+    public Set<Method> getObservableMethods();
+
+    /**
+     * Adds new observer method.
+     * 
+     * @param observerMethod observer method
+     */
+    public void addObservableMethod(Method observerMethod);
+    
+    /**
+     * Inject JavaEE resources.
+     * 
+     * @param instance bean instance
+     * @param creationalContext creational context
+     */
+    public void injectResources(T instance, CreationalContext<T> creationalContext);
+    
+    /**
+     * Inject fields of the bean instance.
+     * 
+     * @param instance bean instance
+     * @param creationalContext creational context
+     */
+    public void injectFields(T instance, CreationalContext<T> creationalContext);
+    
+    /**
+     * Inject initializer methods of the bean instance.
+     * 
+     * @param instance bean instance
+     * @param creationalContext creational context
+     */
+    public void injectMethods(T instance, CreationalContext<T> creationalContext);
+    
+    /**
+     * Inject fields of the bean instance.
+     * 
+     * @param instance bean instance
+     * @param creationalContext creational context
+     */
+    public void injectSuperFields(T instance, CreationalContext<T> creationalContext);
+    
+    /**
+     * Inject initializer methods of the bean instance.
+     * 
+     * @param instance bean instance
+     * @param creationalContext creational context
+     */
+    public void injectSuperMethods(T instance, CreationalContext<T> creationalContext);
+        
+    /**
+     * Gets all injected fields of bean.
+     * @return all injected fields
+     */
+    public Set<Field> getInjectedFields();
+
+    /**
+     * Adds new injected field.
+     * @param field new injected field
+     */
+    public void addInjectedField(Field field);
+    
+    /**
+     * Gets injected fields from super class.
+     * @return injected fields from super class 
+     */
+    public Set<Field> getInjectedFromSuperFields();
+
+    /**
+     * Adds new super injected field.
+     * @param field add to super
+     */
+    public void addInjectedFieldToSuper(Field field);    
+    
+    /**
+     * Gets injected methods.
+     * @return injected(initializer) methods
+     */
+    public Set<Method> getInjectedMethods();
+
+    /**
+     * Adds new injected method.
+     * @param method new injected method
+     */
+    public void addInjectedMethod(Method method);
+
+    /**
+     * Gets injected methods from super class.
+     * @return injected method from super class
+     */
+    public Set<Method> getInjectedFromSuperMethods();
+
+    /**
+     * Add injected method to super list.
+     * @param method injected method
+     */
+    public void addInjectedMethodToSuper(Method method);
+    
+    /**
+     * Gets inherited meta data.
+     * @return inherited meta data
+     */
+    public IBeanInheritedMetaData getInheritedMetaData();
+    
+    /**
+     * Gets interceptor stack of bean instance.
+     * @return interceptor stack
+     */
+    public List<InterceptorData> getInterceptorStack();    
+    
+    /**
+     * Gets decorator stack of bean instance.
+     * @return decorator stack
+     */
+    public List<Decorator<?>> getDecoratorStack();
+
+    /**
+     * Calls post constrcut method.
+     * 
+     * @param instance bean instance
+     */
+    public void postConstruct(T instance, CreationalContext<T> creationalContext);
+    
+    /**
+     * Calls predestroy method.
+     * 
+     * @param instance bean instance
+     */
+    public void preDestroy(T instance, CreationalContext<T> creationalContext);    
+    
+    /**
+     * Sets annotated type.
+     * @param annotatedType annotated type
+     */
+    public void setAnnotatedType(AnnotatedType<T> annotatedType);    
+    
+    /**
+     * Gets annotated type.
+     * @return annotated type
+     */
+    public AnnotatedType<T> getAnnotatedType();        
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetWrapper.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetWrapper.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetWrapper.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionTargetWrapper.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,138 @@
+/*
+ * 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.component;
+
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.Producer;
+
+/**
+ * Reponsible for producing, injection etc.
+ * of beans. Delegate operations to the wrapped
+ * instance.
+ * <p>
+ * Container uses final InjectionTarget or Producer instance
+ * to use while doing operations on beans.
+ * </p> 
+ * @version $Rev$ $Date$
+ *
+ * @param <T>
+ */
+public class InjectionTargetWrapper<T> implements InjectionTarget<T>
+{
+    /**Wrapped injection target*/
+    //This defaults to InjectionTargetProducer
+    private InjectionTarget<T> wrapped = null;
+    
+    /**Wrapped producer*/
+    //This default to ProducerBeansProducer
+    private Producer<T> wrappedProducer = null;
+    
+    /**
+     * New instance.
+     * @param wrapped wrapped injection target
+     */
+    public InjectionTargetWrapper(InjectionTarget<T> wrapped)
+    {
+        this.wrapped = wrapped;
+    }
+
+    
+    /**
+     * New instance.
+     * @param wrappedProducer wrapped producer.
+     */
+    public InjectionTargetWrapper(Producer<T> wrappedProducer)
+    {
+        this.wrappedProducer = wrappedProducer;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void inject(T instance, CreationalContext<T> ctx)
+    {
+        if(wrapped != null)
+        {
+            wrapped.inject(instance, ctx);   
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void postConstruct(T instance)
+    {
+        if(wrapped != null)
+        {
+            wrapped.postConstruct(instance);   
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */    
+    public void preDestroy(T instance)
+    {
+        if(wrapped != null)
+        {
+            wrapped.preDestroy(instance);   
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */    
+    public void dispose(T instance)
+    {
+        if(wrappedProducer != null)
+        {
+            wrappedProducer.dispose(instance);   
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */    
+    public Set<InjectionPoint> getInjectionPoints()
+    {
+        if(wrappedProducer != null)
+        {
+            return wrappedProducer.getInjectionPoints();
+        }
+        
+        return wrapped.getInjectionPoints();
+    }
+
+    /**
+     * {@inheritDoc}
+     */    
+    public T produce(CreationalContext<T> creationalContext)
+    {
+        if(wrappedProducer != null)
+        {
+            return wrappedProducer.produce(creationalContext);
+        }
+        
+        return wrapped.produce(creationalContext);
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,97 @@
+/*
+ * 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.component;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.util.TypeLiteral;
+
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.inject.AbstractInjectable;
+import org.apache.webbeans.inject.instance.InstanceFactory;
+
+public class InstanceBean<T> extends AbstractOwbBean<Instance<T>>
+{
+    // TODO refactor. public static variables are uterly ugly
+    public static ThreadLocal<InjectionPoint> local = new ThreadLocal<InjectionPoint>();
+    
+    @SuppressWarnings("serial")
+    public InstanceBean(WebBeansContext webBeansContext)
+    {
+        super(WebBeansType.INSTANCE, new TypeLiteral<Instance<T>>(){}.getRawType(), webBeansContext);
+    }
+    
+         
+    @Override
+    protected Instance<T> createInstance(CreationalContext<Instance<T>> creationalContext)
+    {
+        try
+        {
+            InjectionPoint injectionPoint = local.get();
+            Set<Annotation> qualifiers;
+            Type type;
+            Class injectionPointClass = null;
+
+            if (injectionPoint != null)
+            {
+                ParameterizedType injectedType = (ParameterizedType)injectionPoint.getType();
+                qualifiers = injectionPoint.getQualifiers();
+                type = injectedType.getActualTypeArguments()[0];
+                if (injectionPoint.getBean() != null)
+                {
+                    injectionPointClass = injectionPoint.getBean().getBeanClass();
+                }
+            }
+            else
+            {
+                qualifiers = getQualifiers();
+                type = getReturnType();
+            }
+
+            Object ownerInstance = AbstractInjectable.instanceUnderInjection.get();
+
+            Instance<T> instance = InstanceFactory.getInstance(type, injectionPointClass, getWebBeansContext(),
+                                                               creationalContext, ownerInstance,
+                                                               qualifiers.toArray(new Annotation[qualifiers.size()]));
+            
+            return instance;
+        }
+        finally
+        {
+            local.set(null);
+            local.remove();
+        }
+    }
+
+    /* (non-Javadoc)
+    * @see org.apache.webbeans.component.AbstractOwbBean#isPassivationCapable()
+    */
+    @Override
+    public boolean isPassivationCapable()
+    {
+        return true;
+    }
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptedMarker.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptedMarker.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptedMarker.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/InterceptedMarker.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,30 @@
+/*
+ * 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.component;
+
+/**
+ * Marker interface for beans that
+ * can be intercepted.
+ * @version $Rev: 952250 $ $Date: 2010-06-07 16:39:41 +0200 (lun., 07 juin 2010) $
+ *
+ */
+public interface InterceptedMarker
+{
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/JmsBeanMarker.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,24 @@
+/*
+ * 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.component;
+
+public interface JmsBeanMarker
+{
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,203 @@
+/*
+ * 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.component;
+
+import java.io.Serializable;
+import java.lang.reflect.Constructor;
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.spi.Decorator;
+
+import org.apache.webbeans.component.creation.ManagedBeanCreatorImpl;
+import org.apache.webbeans.config.WebBeansContext;
+import org.apache.webbeans.decorator.AbstractDecoratorMethodHandler;
+import org.apache.webbeans.inject.InjectableConstructor;
+import org.apache.webbeans.intercept.InterceptorData;
+
+/**
+ * Managed bean implementation of the {@link javax.enterprise.inject.spi.Bean}.
+ * 
+ * @version $Rev: 1385030 $ $Date: 2012-09-15 10:41:29 +0200 (sam., 15 sept. 2012) $
+ */
+public class ManagedBean<T> extends AbstractInjectionTargetBean<T> implements InterceptedMarker
+{
+    /** Constructor of the web bean component */
+    private Constructor<T> constructor;
+    
+    protected boolean isAbstractDecorator;
+
+    /**
+     * Whether the bean is fully initialized or not yet.
+     * Only beans scanned from the classpath can be lazily initialized,
+     * and only if they do _NOT_ contain any javax.inject or javax.enterprise
+     * annotation! In other words: we can skip eager initialisation for
+     * beans which only could picked up as auto-&#0064;Dependent beans which
+     * do not register/ any other beans (e.g. via &#0064;Produces)
+     */
+    private volatile boolean fullInit = true;
+
+
+    public ManagedBean(Class<T> returnType, WebBeansContext webBeansContext)
+    {
+        this(returnType, WebBeansType.MANAGED, webBeansContext);
+    }
+
+    /**
+     * Creates a new instance.
+     * 
+     * @param returnType bean class
+     * @param type webbeans type
+     * @param webBeansContext
+     */
+    public ManagedBean(Class<T> returnType, WebBeansType type, WebBeansContext webBeansContext)
+    {
+        super(type, returnType, webBeansContext);
+        
+        //Setting inherited meta data instance
+        setInheritedMetaData();
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected T createComponentInstance(CreationalContext<T> creationalContext)
+    {
+        if (!fullInit)
+        {
+            lazyInit();
+        }
+
+
+        Constructor<T> con = getConstructor();
+        InjectableConstructor<T> ic = new InjectableConstructor<T>(con, this,creationalContext);
+
+        T instance = ic.doInjection();
+        
+        //If this is an abstract Decorator, we need to set the handler on the Proxy instance
+        if(isAbstractDecorator)
+        {
+            webBeansContext.getProxyFactory().setHandler(instance, new AbstractDecoratorMethodHandler());
+        }
+        
+        return instance;
+    }
+
+    private synchronized void lazyInit()
+    {
+        if (!fullInit)
+        {
+            fullInit = true;
+            ManagedBeanCreatorImpl<T> managedBeanCreator = new ManagedBeanCreatorImpl<T>(this);
+            managedBeanCreator.setAnnotatedType(getAnnotatedType());
+
+            getWebBeansContext().getWebBeansUtil().lazyInitializeManagedBean(getBeanClass(), this, managedBeanCreator);
+        }
+    }
+
+    public boolean isFullInit()
+    {
+        return fullInit;
+    }
+
+    public void setFullInit(boolean fullInit)
+    {
+        this.fullInit = fullInit;
+    }
+
+    @Override
+    public void addQualifier(Annotation qualifier)
+    {
+        if (!(qualifier instanceof Default || qualifier instanceof Any))
+        {
+            // if a bean defines other qualifiers than Default or Any, we need to fully initialize it
+            fullInit = true;
+        }
+        super.addQualifier(qualifier);
+    }
+
+    /**
+     * Get constructor.
+     * 
+     * @return constructor
+     */
+    public Constructor<T> getConstructor()
+    {
+        return constructor;
+    }
+
+    /**
+     * Set constructor.
+     * 
+     * @param constructor constructor instance
+     */
+    public void setConstructor(Constructor<T> constructor)
+    {
+        this.constructor = constructor;
+    }
+    
+    public boolean isPassivationCapable()
+    {
+        if (isPassivationCapable != null)
+        {
+            return isPassivationCapable.booleanValue();
+        }
+        if(Serializable.class.isAssignableFrom(returnType))
+        {
+            for(Decorator<?> dec : decorators)
+            {
+                if(dec.getBeanClass() != null && !Serializable.class.isAssignableFrom(dec.getBeanClass()))
+                {
+                    isPassivationCapable = Boolean.FALSE;
+                    return false;
+                }
+            }
+
+            for(InterceptorData interceptorData : interceptorStack)
+            {
+                if(interceptorData.isDefinedInInterceptorClass())
+                {
+                    Class<?> interceptor = interceptorData.getInterceptorClass();
+                    if(!Serializable.class.isAssignableFrom(interceptor))
+                    {
+                        isPassivationCapable = Boolean.FALSE;
+                        return false;
+                    }
+                }
+            }
+
+            isPassivationCapable = Boolean.TRUE;
+            return true;
+        }
+
+        isPassivationCapable = Boolean.FALSE;
+        return false;
+    }
+
+    /** cache previously calculated result */
+    private Boolean isPassivationCapable = null;
+    
+    public void setIsAbstractDecorator(boolean flag)
+    {
+        isAbstractDecorator = flag;
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/NewBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/NewBean.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/NewBean.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/NewBean.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.component;
+
+/**
+ * Marker interface for @New based beans
+ */
+public interface NewBean<T> 
+{
+
+}
\ No newline at end of file

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/NewManagedBean.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.component;
+
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * Component definition with {@link javax.enterprise.inject.New} binding annotation.
+ * 
+ * <p>
+ * It is defined as concrete java class component.
+ * </p>
+ * 
+ */
+public class NewManagedBean<T> extends ManagedBean<T> implements NewBean<T>
+{
+    private WebBeansType definedType;
+
+    public NewManagedBean(Class<T> returnType, WebBeansType definedType, WebBeansContext webBeansContext)
+    {
+        super(returnType, webBeansContext);
+        this.definedType = definedType;        
+    }
+
+    @Override
+    protected T createInstance(CreationalContext<T> creationalContext)
+    {
+        return super.createInstance(creationalContext);
+    }
+
+    @Override
+    protected void destroyInstance(T instance, CreationalContext<T> creationalContext)
+    {
+        super.destroyInstance(instance, creationalContext);
+    }
+
+    /**
+     * @return the definedType
+     */
+    public WebBeansType getDefinedType()
+    {
+        return definedType;
+    }
+
+    /**
+     * always true for New qualifier
+     */
+    @Override
+    public boolean isDependent()
+    {
+        return true;
+    }
+
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,197 @@
+/*
+ * 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.component;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.*;
+import org.apache.webbeans.config.WebBeansContext;
+
+/**
+ * OWB specific extension of the {@link Bean} interface.
+ * It is used internally. Do not use it. Instead use {@link AbstractOwbBean}
+ * for extension.
+ * 
+ * @version $Rev: 1363092 $ $Date: 2012-07-18 22:15:55 +0200 (mer., 18 juil. 2012) $
+ * <T> bean class
+ */
+public interface OwbBean<T> extends Bean<T>
+{
+    /**
+     * Sets bean scope type annotation.
+     * 
+     * @param scopeType bean scope type annotation
+     */
+    public void setImplScopeType(Annotation scopeType);    
+
+    /**
+     * Returns bean type.
+     * 
+     * @return webbeans type
+     * @see WebBeansType
+     */
+    public WebBeansType getWebBeansType();
+    
+    /**
+     * Create an instance.
+     * @param creationalContext creaitonal context
+     * @return instance
+     */
+    public T createNewInstance(CreationalContext<T> creationalContext);
+
+    /**
+     * Destroys instance.
+     * @param instance instance
+     * @param creationalContext creational
+     */
+    public void destroyCreatedInstance(T instance, CreationalContext<T> creationalContext);
+    
+    /**
+     * Adds qualifier.
+     * 
+     * @param qualifier bean qualifier
+     */
+    public void addQualifier(Annotation qualifier);
+    
+    /**
+     * Returns true if bean is capable of
+     * serializable, false otherwise.
+     * 
+     * @return true if bean is serializable
+     */
+    public boolean isSerializable();    
+
+    /**
+     * Adds new stereotype annotation.
+     * 
+     * @param stereoType stereotype annotation
+     */
+    public void addStereoType(Annotation stereoType);
+
+    /**
+     * Adds new api type.
+     * 
+     * @param apiType api type
+     */
+    public void addApiType(Class<?> apiType);
+    
+    /**
+     * Adds new injection point.
+     * 
+     * @param injectionPoint injection point
+     */
+    public void addInjectionPoint(InjectionPoint injectionPoint);
+
+    /**
+     * Gets stereotypes annotations.
+     */
+    public Set<Annotation> getOwbStereotypes();
+
+    /**
+     * Sets name of the bean.
+     * 
+     * @param name bean name
+     */
+    public void setName(String name);
+    
+    /**
+     * Gets injection points for given member.
+     * <p>
+     * For example, if member is field, it gets all
+     * injected field's injection points of bean.
+     * </p>
+     * @param member java member
+     * @return injection points for given member
+     */
+    public List<InjectionPoint> getInjectionPoint(Member member);
+
+    /**
+     * Returns bean class type
+     * @return bean class type
+     */
+    public Class<T> getReturnType();
+
+    /**
+     * Sets serializable flag.
+     * @param serializable flag
+     */
+    public void setSerializable(boolean serializable);
+
+    /**
+     * Set nullable flag.
+     * @param nullable flag
+     */
+    public void setNullable(boolean nullable);
+    
+    /**
+     * Set specialized flag.
+     * @param specialized flag
+     */
+    public void setSpecializedBean(boolean specialized);
+    
+    /**
+     * Returns true if bean is a specialized bean, false otherwise.
+     * @return true if bean is a specialized bean
+     */
+    public boolean isSpecializedBean();
+    
+    /**
+     * Set enableed flag.
+     * @param enabled flag
+     */
+    public void setEnabled(boolean enabled);    
+    
+    /**
+     * Bean is enabled or not.
+     * @return true if enabled
+     */    
+    public boolean isEnabled();
+    
+    /**
+     * Gets id of the bean.
+     * @return id of the bean
+     */
+    public String getId();
+    
+    /**
+     * True if passivation capable false otherwise.
+     * @return true if this bean is passivation capable
+     */
+    public boolean isPassivationCapable();
+    
+    /**
+     * This determines if this bean is really a dependent bean,
+     * and as such always creats a freshl instance for each
+     * InjectionPoint. A BeanManagerBean is e.g. not a dependent bean.
+     * @return <code>true</code> if this is a dependent bean
+     */
+    public boolean isDependent();
+    
+    /**
+     * If bean is passivation capable, it validate all of its dependencies.
+     * @throws org.apache.webbeans.exception.WebBeansConfigurationException if not satisfy passivation dependencies
+     */
+    public void validatePassivationDependencies();
+
+    public WebBeansContext getWebBeansContext();
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,179 @@
+/*
+ * 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.component;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Defines the producer field component implementation.
+ * 
+ * @param <T> Type of the field decleration
+ */
+public class ProducerFieldBean<T> extends AbstractProducerBean<T> implements IBeanHasParent<T>
+{
+    /** Producer field that defines the component */
+    private Field producerField = null;
+
+    /**
+     * Defines the new producer field component.
+     * 
+     * @param returnType type of the field decleration
+     */
+    public ProducerFieldBean(InjectionTargetBean<?> ownerComponent, Class<T> returnType)
+    {
+        super(WebBeansType.PRODUCERFIELD, returnType, ownerComponent);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected T createInstance(CreationalContext<T> creationalContext)
+    {
+        T instance = null;
+        
+        instance = createDefaultInstance(creationalContext);
+        checkNullInstance(instance);
+        checkScopeType();
+
+        return instance;
+
+    }
+
+    /**
+     * Default producer method creation.
+     * 
+     * @param creationalContext creational context
+     * @return producer method instance
+     */
+    @SuppressWarnings("unchecked")
+    protected T createDefaultInstance(CreationalContext<T> creationalContext)
+    {
+        T instance = null;
+        Object parentInstance = null;
+        CreationalContext<?> parentCreational = null;
+        try
+        {
+            parentCreational = getManager().createCreationalContext(ownerComponent);
+            
+            if (!producerField.isAccessible())
+            {
+                getWebBeansContext().getSecurityService().doPrivilegedSetAccessible(producerField, true);
+            }
+
+            if (Modifier.isStatic(producerField.getModifiers()))
+            {
+                instance = (T) producerField.get(null);
+            }
+            else
+            { 
+                parentInstance = getParentInstanceFromContext(parentCreational);
+                
+                instance = (T) producerField.get(parentInstance);
+            }
+        }
+        catch(Exception e)
+        {
+            throw new WebBeansException(e);
+        }
+        finally
+        {
+            if (ownerComponent.getScope().equals(Dependent.class))
+            {
+                destroyBean(ownerComponent, parentInstance, parentCreational);
+            }
+        }
+
+        return instance;
+
+    }
+
+    /**
+     * Gets creator field.
+     * 
+     * @return creator field
+     */
+    public Field getCreatorField()
+    {
+        return producerField;
+    }
+
+    /**
+     * Set producer field.
+     * 
+     * @param field producer field
+     */
+    public void setProducerField(Field field)
+    {
+        producerField = field;
+    }
+
+    /**
+     * Check null instance.
+     * 
+     * @param instance bean instance
+     */
+    protected void checkNullInstance(Object instance)
+    {
+        String errorMessage = "WebBeans producer field : %s" +
+                              " return type in the component implementation class : %s" +
+                              " scope must be @Dependent to create null instance";
+        WebBeansUtil.checkNullInstance(instance, getScope(), errorMessage, producerField.getName(),
+                ownerComponent.getReturnType().getName());
+    }
+
+    /**
+     * Check scope type passivation controls.
+     */
+    protected void checkScopeType()
+    {
+        String errorMessage = "WebBeans producer method : %s" + 
+                              " return type in the component implementation class : %s" +
+                              " with passivating scope @%s" +
+                              " must be Serializable";
+        getWebBeansContext().getWebBeansUtil().checkSerializableScopeType(getScope(),
+                isSerializable(), errorMessage, producerField.getName(), 
+                ownerComponent.getReturnType().getName(), getScope().getName());
+    }
+    
+    @Override
+    public boolean isPassivationCapable()
+    {
+        return isPassivationCapable(producerField.getType(), producerField.getModifiers());
+    }
+    
+    @Override
+    public String getId()
+    {
+        if (passivatingId == null)
+        {
+            String id = super.getId();
+            
+            passivatingId = id + "#" + producerField.toGenericString();
+        }
+        return passivatingId;
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,365 @@
+/*
+ * 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.component;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.context.creational.DependentCreationalContext;
+import org.apache.webbeans.context.creational.DependentCreationalContext.DependentType;
+import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.inject.AbstractInjectable;
+import org.apache.webbeans.inject.InjectableMethods;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Concrete implementation of the {@link AbstractOwbBean}.
+ * <p>
+ * It is defined as producer method component.
+ * </p>
+ * 
+ * @version $Rev: 1363131 $ $Date: 2012-07-18 23:39:39 +0200 (mer., 18 juil. 2012) $
+ */
+public class ProducerMethodBean<T> extends AbstractProducerBean<T>
+{
+    /** Creator method of the parent component */
+    protected Method creatorMethod;
+
+    /** Disposal method */
+    protected Method disposalMethod;
+
+    /**
+     * Creates a new instance.
+     * 
+     * @param parent parent bean
+     * @param returnType producer method return type
+     */
+    public ProducerMethodBean(InjectionTargetBean<?> parent, Class<T> returnType)
+    {
+        super(WebBeansType.PRODUCERMETHOD, returnType, parent);
+    }
+
+    /**
+     * Gets the creator method.
+     * 
+     * @return producer method
+     */
+    public Method getCreatorMethod()
+    {
+        return creatorMethod;
+    }
+
+    /**
+     * Sets the method.
+     * 
+     * @param creatorMethod producer method
+     */
+    public void setCreatorMethod(Method creatorMethod)
+    {
+        this.creatorMethod = creatorMethod;
+    }
+
+    /**
+     * Sets the disposal method.
+     * 
+     * @param disposalMethod disposal method of this producer method component
+     */
+    public void setDisposalMethod(Method disposalMethod)
+    {
+        if (this.disposalMethod != null)
+        {
+            throw new WebBeansConfigurationException("There are multiple disposal method for producer method " +
+                    "component with name : " + getName() + " with implementation class " +
+                    getParent().getReturnType().getName() + " with disposal method name : " +
+                    disposalMethod.getName());
+        }
+        this.disposalMethod = disposalMethod;
+    }
+
+    public String getId()
+    {
+        if (passivatingId == null)
+        {
+            String id = super.getId();
+            
+            passivatingId = id + "#" + creatorMethod.toGenericString();
+        }
+        return passivatingId;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected T createInstance(CreationalContext<T> creationalContext)
+    {
+        T instance = null;
+        instance = createDefaultInstance(creationalContext);
+        // Check null instance
+        checkNullInstance(instance);
+
+        // Check scope type
+        checkScopeType();
+        return instance;
+    }
+
+    /**
+     * Default producer method creation.
+     * 
+     * @param creationalContext creational context
+     * @return producer method instance
+     */
+    @SuppressWarnings("unchecked")
+    protected T createDefaultInstance(CreationalContext<T> creationalContext)
+    {
+        T instance = null;
+        Object parentInstance = null;
+        CreationalContext<?> parentCreational = null;
+        InjectableMethods<T> m = null;
+        List<DependentCreationalContext<Object>> oldDependents =
+                AbstractInjectable.dependentInstanceOfProducerMethods.get();
+
+        try
+        {
+            //X TODO dependentInstanceOfProducerMethods MUST NOT be public! 
+            AbstractInjectable.dependentInstanceOfProducerMethods.set(new ArrayList<DependentCreationalContext<Object>>());
+            parentCreational = getManager().createCreationalContext(ownerComponent);
+            
+            if (!Modifier.isStatic(creatorMethod.getModifiers()))
+            {
+                parentInstance = getParentInstance(parentCreational);
+            }
+
+            m = new InjectableMethods<T>(creatorMethod, parentInstance, this, creationalContext);
+            //Injection of parameters
+            instance = m.doInjection();
+            
+            boolean isInjectionToAnotherBean = false;
+            Contextual<?> contextual = null; 
+            if(creationalContext instanceof CreationalContextImpl)
+            {
+                contextual =  ((CreationalContextImpl)creationalContext).getBean();
+                isInjectionToAnotherBean = contextual == this ? false : true;
+            }
+            
+            ThreadLocal<Object> injectionTargetInstance = AbstractInjectable.instanceUnderInjection;
+            if(isInjectionToAnotherBean)
+            {
+                if(oldDependents != null)
+                {
+                    DependentCreationalContext<Object> dependentCreational =
+                            new DependentCreationalContext<Object>((Contextual<Object>)this);
+                    dependentCreational.setInstance(instance);
+                    dependentCreational.setDependentType(DependentType.BEAN);
+
+                    oldDependents.add(dependentCreational);
+                }
+            }
+            else
+            {
+                List<DependentCreationalContext<Object>> dependents =
+                        AbstractInjectable.dependentInstanceOfProducerMethods.get();
+                if(dependents != null)
+                {
+                    for(int i = 0, size = dependents.size(); i < size; i++)
+                    {
+                        DependentCreationalContext<Object> dependent = dependents.get(i);
+                        ((CreationalContextImpl)creationalContext).
+                                addDependent(instance, dependent.getContextual(), dependent.getInstance());
+                    }
+                }
+            }
+            
+            //Adding dependents of producers
+            Map<Bean<?>, Object> dependents = m.getDependentBeanParameters();
+            if(dependents != null)
+            {
+                Set<Bean<?>> beans = dependents.keySet();
+                for(Bean<?> bean : beans)
+                {
+                    if(creationalContext instanceof CreationalContextImpl)
+                    {
+                        if(isInjectionToAnotherBean)
+                        {
+                            if(oldDependents == null)
+                            {
+                                if (injectionTargetInstance != null && injectionTargetInstance.get() != null)
+                                {
+                                    ((CreationalContextImpl)creationalContext)
+                                            .addDependent(injectionTargetInstance.get(), this , instance);
+                                }
+                            }
+                            else
+                            {
+                                DependentCreationalContext<Object> dependentCreational =
+                                        new DependentCreationalContext<Object>((Contextual<Object>)bean);
+                                dependentCreational.setInstance(dependents.get(bean));
+                                dependentCreational.setDependentType(DependentType.BEAN);
+                                oldDependents.add(dependentCreational);                                                            
+                            }
+                        }
+                        else
+                        {
+                            ((CreationalContextImpl)creationalContext).addDependent(instance, bean ,
+                                                                                    dependents.get(bean));   
+                        }
+                    }
+                }
+            }
+        }
+        finally
+        {
+            if (getParent().getScope().equals(Dependent.class))
+            {
+                // this handles dependent scoped producer methods and fields
+                destroyBean(getParent(), parentInstance, parentCreational);
+            }
+            
+            if(oldDependents != null)
+            {
+                AbstractInjectable.dependentInstanceOfProducerMethods.set(oldDependents);   
+            }
+            else
+            {
+                AbstractInjectable.dependentInstanceOfProducerMethods.set(null);
+                AbstractInjectable.dependentInstanceOfProducerMethods.remove();
+            }
+        }
+
+        return instance;
+
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void destroyInstance(T instance, CreationalContext<T> creationalContext)
+    {
+        dispose(instance,creationalContext);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void dispose(T instance, CreationalContext<T> creationalContext)
+    {
+        disposeDefault(instance, creationalContext);
+    }
+
+    /**
+     * Default dispose method used.
+     * 
+     * @param instance bean instance
+     */
+    @SuppressWarnings("unchecked")
+    protected void disposeDefault(T instance, CreationalContext<T> creationalContext)
+    {
+        if (disposalMethod != null)
+        {
+            Object parentInstance = null;
+            CreationalContext<?> parentCreational = null;
+            InjectableMethods<T> m = null;
+            try
+            {
+                parentCreational = getManager().createCreationalContext(ownerComponent);
+                
+                if (!Modifier.isStatic(disposalMethod.getModifiers()))
+                {
+                    parentInstance = getParentInstance(parentCreational);
+                }
+
+                m = new InjectableMethods<T>(disposalMethod, parentInstance, ownerComponent, creationalContext);
+                m.setDisposable(true);
+                m.setProducerMethodInstance(instance);
+
+                m.doInjection();
+
+            }
+            finally
+            {
+                if (getParent().getScope().equals(Dependent.class))
+                {
+                    destroyBean(getParent(), parentInstance, parentCreational);
+                }
+
+                //Destroy dependent parameters
+                Map<Bean<?>, Object> dependents = m.getDependentBeanParameters();
+                if(dependents != null)
+                {
+                    Set<Bean<?>> beans = dependents.keySet();
+                    for(Bean<?> bean : beans)
+                    {
+                        Bean<Object> beanTt = (Bean<Object>)bean;
+                        if(creationalContext instanceof CreationalContextImpl)
+                        {
+                            beanTt.destroy(dependents.get(beanTt), (CreationalContext<Object>)creationalContext);
+                        }
+                    }
+                }
+                
+            }
+        }
+    }
+    
+    /**
+     * Check null control.
+     * 
+     * @param instance bean instance
+     */
+    protected void checkNullInstance(Object instance)
+    {
+        String errorMessage = "WebBeans producer method : %s" +
+                              " return type in the component implementation class : %s" +
+                              " scope type must be @Dependent to create null instance";
+        WebBeansUtil.checkNullInstance(instance, getScope(), errorMessage, creatorMethod.getName(),
+                ownerComponent.getReturnType().getName());
+    }
+
+    /**
+     * Check passivation check.
+     */
+    protected void checkScopeType()
+    {
+        String errorMessage = "WebBeans producer method : %s" +
+                              " return type in the component implementation class : %s" +
+                              " with passivating scope @%s" +
+                              " must be Serializable";
+        getWebBeansContext().getWebBeansUtil().checkSerializableScopeType(getScope(),
+                isSerializable(), errorMessage, creatorMethod.getName(), ownerComponent.getReturnType().getName(),
+                getScope().getName());
+
+    }
+
+    @Override
+    public boolean isPassivationCapable()
+    {
+        return isPassivationCapable(creatorMethod.getReturnType(), creatorMethod.getModifiers());
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,85 @@
+/*
+ * 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.component;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Modifier;
+
+import javax.enterprise.context.spi.CreationalContext;
+import org.apache.webbeans.exception.WebBeansException;
+import org.apache.webbeans.proxy.ResourceProxyHandler;
+import org.apache.webbeans.spi.ResourceInjectionService;
+import org.apache.webbeans.spi.api.ResourceReference;
+
+public class ResourceBean<X, T extends Annotation> extends ProducerFieldBean<X>
+{
+    private ResourceReference<X,T> resourceReference = null;
+    
+    public ResourceBean(Class<X> returnType, InjectionTargetBean<?> ownerBean,
+                        ResourceReference<X, T> resourceReference)
+    {
+        super(ownerBean, returnType);
+        this.resourceReference = resourceReference;
+    }
+
+     
+    
+    @Override
+    @SuppressWarnings("unchecked")
+    protected X createInstance(CreationalContext<X> creationalContext)
+    {
+        try
+        {
+            ResourceInjectionService resourceService = getWebBeansContext().getService(ResourceInjectionService.class);
+            X instance = resourceService.getResourceReference(resourceReference);
+
+            if (instance == null || Modifier.isFinal(instance.getClass().getModifiers()))
+            {
+                return instance;
+            }
+
+            X proxyInstance = (X) getWebBeansContext().getProxyFactory().getResourceBeanProxyClass(this).newInstance();
+            webBeansContext.getProxyFactory().setHandler(proxyInstance, new ResourceProxyHandler(this,instance));
+            return proxyInstance;
+        }
+        catch (Exception e)
+        {
+            throw new WebBeansException(e);
+        }
+
+    }
+
+    /**
+     * Called after deserialization to get a new instance for some type of resource bean instance that are
+     * not serializable.
+     * 
+     * @return a new instance of this resource bean.
+     */
+    public X getActualInstance() 
+    {
+        ResourceInjectionService resourceService = getWebBeansContext().getService(ResourceInjectionService.class);
+        X instance = resourceService.getResourceReference(resourceReference);
+        return instance;
+    }
+    
+    public boolean isPassivationCapable()
+    {
+        return true;
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.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.component;
+
+
+/**
+ * There are different <i>Web Beans Component</i> with regard to the definition.
+ * These are the;
+ * <ul>
+ * <li>Bean Implementation Class Components</li>
+ * <li>Producer Method Components</li>
+ * </ul>
+ * <p>
+ * Bean Implementation Class Components are defined with annotating the ordinary
+ * classes with {@link OwbBean} annotation. It maybe defined within the
+ * web-beans.xml file using &lt;class&gt; element. It is possible to mix these
+ * two definitions.
+ * </p>
+ * <p>
+ * Producer Method Components are defined within the class that is annotated
+ * with {@link OwbBean} annotation. In these classes, there are methods that
+ * are annotated with {@link javax.enterprise.inject.Produces} annotation.
+ * These methods become the producer method components of this web beans component.
+ * It maybe defined using the web-beans.xml file using the &lt;producer&gt; element.
+ * It is possible to mix these two definitons.
+ * </p>
+ * <p>
+ * For further details about the components, see Web Beans Specification
+ * Chapter-2.
+ * </p>
+ * 
+ * @version $Rev: 952420 $ $Date: 2010-06-07 22:35:47 +0200 (lun., 07 juin 2010) $
+ */
+public enum WebBeansType
+{
+    MANAGED, 
+    PRODUCERMETHOD, 
+    PRODUCERFIELD,
+    RESOURCEBEAN,
+    NEW, 
+    ENTERPRISE, 
+    JMS, 
+    DEPENDENT, 
+    INTERCEPTOR, 
+    DECORATOR, 
+    OBSERVABLE, 
+    MANAGER, 
+    CONVERSATION,
+    INSTANCE,
+    INJECTIONPOINT,
+    THIRDPARTY,
+    EXTENSION,
+    USERTRANSACTION,
+    PRINCIPAL,
+    VALIDATIONFACT,
+    VALIDATION
+}
\ No newline at end of file

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,221 @@
+/*
+ * 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.component.creation;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.AnnotatedType;
+
+import org.apache.webbeans.component.AbstractOwbBean;
+import org.apache.webbeans.config.DefinitionUtil;
+import org.apache.webbeans.util.AnnotationUtil;
+import org.apache.webbeans.util.WebBeansUtil;
+
+/**
+ * Abstract implementation.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <T> bean class info
+ */
+public class AbstractBeanCreator<T> implements BeanCreator<T>
+{
+    /**Bean instance*/
+    private final AbstractOwbBean<T> bean;    
+    
+    /**Default metadata provider*/
+    private MetaDataProvider metadataProvider = MetaDataProvider.DEFAULT;
+    
+    /**Bean annotations*/
+    private final Annotation[] beanAnnotations;
+    
+    /**
+     * If annotated type is set by ProcessAnnotatedType event, used this annotated type
+     * to define bean instance instead of using class artifacts.
+     */
+    private AnnotatedType<T> annotatedType;
+
+    private final DefinitionUtil definitionUtil;
+    
+    /**
+     * Creates a bean instance.
+     * 
+     * @param bean bean instance
+     * @param beanAnnotations annotations
+     */
+    public AbstractBeanCreator(AbstractOwbBean<T> bean, Annotation[] beanAnnotations)
+    {
+        this.bean = bean;
+        this.beanAnnotations = beanAnnotations;
+        definitionUtil = bean.getWebBeansContext().getDefinitionUtil();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void checkCreateConditions()
+    {
+        //Sub-class can override this
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void defineApiType()
+    {
+        if(isDefaultMetaDataProvider())
+        {
+            DefinitionUtil.defineApiTypes(bean, bean.getReturnType());
+        }
+        else
+        {
+            Set<Type> types = annotatedType.getTypeClosure();
+            bean.getTypes().addAll(types);
+        }
+        Set<String> ignored = bean.getWebBeansContext().getOpenWebBeansConfiguration().getIgnoredInterfaces();
+        for (Iterator<Type> i = bean.getTypes().iterator(); i.hasNext();)
+        {
+            Type t = i.next();
+            if (t instanceof Class && ignored.contains(((Class<?>)t).getName()))
+            {
+                i.remove();
+            }
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void defineQualifier()
+    {
+        if(isDefaultMetaDataProvider())
+        {
+            definitionUtil.defineQualifiers(bean, beanAnnotations);
+        }
+        else
+        {
+            definitionUtil.defineQualifiers(bean, AnnotationUtil.getAnnotationsFromSet(annotatedType.getAnnotations()));
+        }
+        
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void defineName(String defaultName)
+    {
+        if(isDefaultMetaDataProvider())
+        {
+            definitionUtil.defineName(bean, beanAnnotations, defaultName);
+        }
+        else
+        {
+            definitionUtil.defineName(bean, AnnotationUtil.getAnnotationsFromSet(annotatedType.getAnnotations()),
+                    WebBeansUtil.getManagedBeanDefaultName(annotatedType.getJavaClass().getSimpleName()));
+        }
+        
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void defineScopeType(String errorMessage, boolean allowLazyInit)
+    {
+        if(isDefaultMetaDataProvider())
+        {
+            definitionUtil.defineScopeType(bean, beanAnnotations, errorMessage, allowLazyInit);
+        }
+        else
+        {
+            definitionUtil.defineScopeType(bean, AnnotationUtil.getAnnotationsFromSet(annotatedType.getAnnotations()), errorMessage, false);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void defineSerializable()
+    {
+        definitionUtil.defineSerializable(bean);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void defineStereoTypes()
+    {
+        if(isDefaultMetaDataProvider())
+        {
+            definitionUtil.defineStereoTypes(bean, beanAnnotations);
+        }
+        else
+        {
+            definitionUtil.defineStereoTypes(bean, AnnotationUtil.getAnnotationsFromSet(annotatedType.getAnnotations()));
+        }
+        
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public MetaDataProvider getMetaDataProvider()
+    {
+        return metadataProvider;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void setMetaDataProvider(MetaDataProvider metadataProvider)
+    {
+        this.metadataProvider = metadataProvider;
+    }
+    
+    /**
+     * Returns true if metadata provider is default,
+     * false otherwise
+     * 
+     * @return true if metadata provider is default
+     */
+    protected boolean isDefaultMetaDataProvider()
+    {
+        return metadataProvider.equals(MetaDataProvider.DEFAULT);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public AbstractOwbBean<T> getBean()
+    {
+        return bean;
+    }
+
+   protected AnnotatedType<T> getAnnotatedType()
+    {
+        return annotatedType;
+    }
+    
+    public void setAnnotatedType(AnnotatedType<T> annotatedType)
+    {
+        this.annotatedType = annotatedType;
+    }
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,157 @@
+/*
+ * 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.component.creation;
+
+import java.util.Set;
+
+import javax.enterprise.inject.spi.ObserverMethod;
+
+import org.apache.webbeans.component.AbstractInjectionTargetBean;
+import org.apache.webbeans.component.ProducerFieldBean;
+import org.apache.webbeans.component.ProducerMethodBean;
+import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
+
+/**
+ * Abstract implementation of {@link InjectedTargetBeanCreator}.
+ * 
+ * @version $Rev: 1182847 $ $Date: 2011-10-13 15:31:37 +0200 (jeu., 13 oct. 2011) $
+ *
+ * @param <T> bean class type
+ */
+public abstract class AbstractInjectedTargetBeanCreator<T> extends AbstractBeanCreator<T> implements InjectedTargetBeanCreator<T>
+{    
+    /**
+     * Creates a new instance.
+     * 
+     * @param bean bean instance
+     */
+    public AbstractInjectedTargetBeanCreator(AbstractInjectionTargetBean<T> bean)
+    {
+        super(bean, bean.getReturnType().getDeclaredAnnotations());
+    }
+    
+ 
+    /**
+     * {@inheritDoc}
+     */
+    public void defineDisposalMethods()
+    {
+        AbstractInjectionTargetBean bean = getBean();
+        if(isDefaultMetaDataProvider())
+        {
+
+            bean.getWebBeansContext().getDefinitionUtil().defineDisposalMethods(getBean());
+        }
+        else
+        {
+            bean.getWebBeansContext().getAnnotatedTypeUtil().defineDisposalMethods(getBean(), getAnnotatedType());
+        }
+        
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void defineInjectedFields()
+    {
+        AbstractInjectionTargetBean bean = getBean();
+        if(isDefaultMetaDataProvider())
+        {
+            bean.getWebBeansContext().getDefinitionUtil().defineInjectedFields(bean);
+        }
+        else
+        {
+            WebBeansAnnotatedTypeUtil.defineInjectedFields(bean, getAnnotatedType());
+        }
+        
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void defineInjectedMethods()
+    {
+        AbstractInjectionTargetBean bean = getBean();
+        if(isDefaultMetaDataProvider())
+        {
+            bean.getWebBeansContext().getDefinitionUtil().defineInjectedMethods(bean);
+        }
+        else
+        {
+            bean.getWebBeansContext().getAnnotatedTypeUtil().defineInjectedMethods(bean, getAnnotatedType());
+        }
+        
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Set<ObserverMethod<?>> defineObserverMethods()
+    {   
+        AbstractInjectionTargetBean bean = getBean();
+        if(isDefaultMetaDataProvider())
+        {
+            return bean.getWebBeansContext().getDefinitionUtil().defineObserverMethods(bean, bean.getReturnType());
+        }
+        else
+        {
+            return bean.getWebBeansContext().getAnnotatedTypeUtil().defineObserverMethods(bean, getAnnotatedType());
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Set<ProducerFieldBean<?>> defineProducerFields()
+    {
+        AbstractInjectionTargetBean bean = getBean();
+        if(isDefaultMetaDataProvider())
+        {
+            return bean.getWebBeansContext().getDefinitionUtil().defineProducerFields(bean);
+        }
+        else
+        {
+            return bean.getWebBeansContext().getAnnotatedTypeUtil().defineProducerFields(bean, getAnnotatedType());
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Set<ProducerMethodBean<?>> defineProducerMethods()
+    {
+        AbstractInjectionTargetBean bean = getBean();
+        if(isDefaultMetaDataProvider())
+        {
+            return bean.getWebBeansContext().getDefinitionUtil().defineProducerMethods(bean);
+        }
+        else
+        {
+            return bean.getWebBeansContext().getAnnotatedTypeUtil().defineProducerMethods(bean, getAnnotatedType());
+        }
+    }
+    
+    /**
+     * Return type-safe bean instance.
+     */
+    public AbstractInjectionTargetBean<T> getBean()
+    {
+        return (AbstractInjectionTargetBean<T>)super.getBean();
+    }
+}
\ No newline at end of file

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.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.component.creation;
+
+import java.lang.reflect.Constructor;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+
+import org.apache.webbeans.component.ManagedBean;
+import org.apache.webbeans.config.OWBLogConst;
+import org.apache.webbeans.logger.WebBeansLoggerFacade;
+import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
+
+public class AnnotatedTypeBeanCreatorImpl<T> extends ManagedBeanCreatorImpl<T>
+{
+    private final static Logger logger = WebBeansLoggerFacade.getLogger(AnnotatedTypeBeanCreatorImpl.class);
+
+    public AnnotatedTypeBeanCreatorImpl(ManagedBean<T> managedBean)
+    {
+        super(managedBean);
+        setMetaDataProvider(MetaDataProvider.THIRDPARTY);
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void defineConstructor()
+    {
+        Constructor<T> constructor;
+        try
+        {
+            WebBeansAnnotatedTypeUtil annotatedTypeUtil = getBean().getWebBeansContext().getAnnotatedTypeUtil();
+            AnnotatedConstructor<T> annotated = annotatedTypeUtil.getBeanConstructor(getAnnotatedType());
+            constructor = annotated.getJavaMember();
+            annotatedTypeUtil.addConstructorInjectionPointMetaData(getBean(), annotated);
+            
+            getBean().setConstructor(constructor);
+            
+        }
+        catch(Exception e)
+        {
+            // if no constructor could be found, we just leave the empty set.
+            logger.log(Level.INFO, OWBLogConst.WARN_0012, getAnnotatedType().getJavaClass());
+        }
+    }
+    
+}

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanCreator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanCreator.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanCreator.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/BeanCreator.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,109 @@
+/*
+ * 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.component.creation;
+
+
+import org.apache.webbeans.component.AbstractOwbBean;
+
+/**
+ * Contract for {@link javax.enterprise.inject.spi.Bean} creation.
+ * 
+ * <p>
+ * Common operations on ManagedBean, ProducerField and ProducerMethods.
+ * </p>
+ * 
+ * @version $Rev: 1076897 $ $Date: 2011-03-04 01:02:13 +0100 (ven., 04 mars 2011) $
+ *
+ */
+public interface BeanCreator<T>
+{
+    /**
+     * MetaDataProvider. 
+     */
+    public enum MetaDataProvider
+    {
+        //Default meta-data is used
+        DEFAULT,
+        //Third party overriden meta-data will be used. 
+        //It is overriden with event ProcessAnnotatedType
+        THIRDPARTY
+    }
+    
+    /**
+     * Check conditions on creating bean instance.
+     */
+    public void checkCreateConditions();
+    
+    /**
+     * Define serializable.
+     */
+    public void defineSerializable();
+    
+    /**
+     * Define stereptypes.
+     */
+    public void defineStereoTypes();
+    
+    /**
+     * Define api type.
+     */
+    public void defineApiType();
+    
+    /**
+     * Returns metadata provider.
+     * 
+     * @return metadata provider
+     */
+    public MetaDataProvider getMetaDataProvider();
+    
+    /**
+     * Sets meta-data provider.
+     * 
+     * @param metadataProvider metadata provider
+     */
+    public void setMetaDataProvider(MetaDataProvider metadataProvider);
+        
+    /**
+     * Define scope type of the bean.
+     * 
+     * <p>
+     * Check passivation related controls.
+     * </p>
+     */
+    public void defineScopeType(String errorMessage, boolean allowLazyInit);
+    
+    /**
+     * Defines qualifier.
+     */
+    public void defineQualifier();
+    
+    /**
+     * Defines bean name.
+     * 
+     * @param defaultName default bean name
+     */
+    public void defineName(String defaultName);   
+    
+    /**
+     * Gets bean.
+     * 
+     * @return bean instance
+     */
+    public AbstractOwbBean<T> getBean();    
+}
\ No newline at end of file

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InjectedTargetBeanCreator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InjectedTargetBeanCreator.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InjectedTargetBeanCreator.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InjectedTargetBeanCreator.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,74 @@
+/*
+ * 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.component.creation;
+
+import java.util.Set;
+
+import javax.enterprise.inject.spi.ObserverMethod;
+
+import org.apache.webbeans.component.ProducerFieldBean;
+import org.apache.webbeans.component.ProducerMethodBean;
+
+/**
+ * Contract for {@link org.apache.webbeans.component.InjectionTargetBean} creation.
+ * 
+ * <p>
+ * Common operations for ManagedBean.
+ * </p>
+ * 
+ * @version $Rev: 952591 $ $Date: 2010-06-08 11:45:27 +0200 (mar., 08 juin 2010) $
+ *
+ * @param <T> bean class info
+ */
+public interface InjectedTargetBeanCreator<T>
+{
+    /**
+     * Defines bean's producer methods.
+     * 
+     * @return set of producer methods
+     */
+    public Set<ProducerMethodBean<?>> defineProducerMethods();
+
+    /**
+     * Defines bean's producer fields.
+     * 
+     * @return set of producer fields
+     */
+    public Set<ProducerFieldBean<?>> defineProducerFields();
+    
+    /**
+     * Defines disposal methods.
+     */
+    public void defineDisposalMethods();
+    
+    /**
+     * Define injected fields.
+     */
+    public void defineInjectedFields();
+    
+    /**
+     * Define injected methods, a.k.a <code>@Initializer</code>
+     */
+    public void defineInjectedMethods();
+    
+    /**
+     * Define observer methods, a.k.a method parameter with <code>@Observes</code>
+     */
+    public Set<ObserverMethod<?>> defineObserverMethods();        
+}
\ No newline at end of file

Added: openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreator.java?rev=1417182&view=auto
==============================================================================
--- openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreator.java (added)
+++ openejb/trunk/openejb/deps/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreator.java Tue Dec  4 21:07:25 2012
@@ -0,0 +1,35 @@
+/*
+ * 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.component.creation;
+
+/**
+ * Contract for {@link org.apache.webbeans.component.ManagedBean}.
+ * 
+ * @version $Rev: 952591 $ $Date: 2010-06-08 11:45:27 +0200 (mar., 08 juin 2010) $
+ *
+ * @param <T> bean class
+ */
+public interface ManagedBeanCreator<T> extends InjectedTargetBeanCreator<T>
+{
+    /**
+     * Define managed bean constructor.
+     */
+    public void defineConstructor();
+        
+}