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/05/09 14:41:12 UTC
svn commit: r1336146 -
/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
Author: rmannibucau
Date: Wed May 9 12:41:12 2012
New Revision: 1336146
URL: http://svn.apache.org/viewvc?rev=1336146&view=rev
Log:
with testing the same thing in the loop to skip the loop processing?
Modified:
openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
Modified: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java?rev=1336146&r1=1336145&r2=1336146&view=diff
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java (original)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java Wed May 9 12:41:12 2012
@@ -226,53 +226,55 @@ public class OpenEJBLifecycle implements
//Discover classpath classes
deployManagedBeans(scannerService.getBeanClasses(), stuff.getBeanContexts());
- for (BeanContext beanContext : stuff.getBeanContexts()) {
- if (!beanContext.getComponentType().isCdiCompatible() || stuff.getWebContext() != null) continue;
-
- final Class implClass = beanContext.getManagedClass();
-
- //Define annotation type
- AnnotatedType<?> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(implClass);
-
- //Fires ProcessAnnotatedType
- ProcessAnnotatedTypeImpl<?> processAnnotatedEvent = webBeansContext.getWebBeansUtil().fireProcessAnnotatedTypeEvent(annotatedType);
-
- // TODO Can you really veto an EJB?
- //if veto() is called
- if (processAnnotatedEvent.isVeto()) {
- continue;
- }
+ if (stuff.getWebContext() == null) { // otherwise we are in an ear and we already fired ejbs
+ for (BeanContext beanContext : stuff.getBeanContexts()) {
+ if (!beanContext.getComponentType().isCdiCompatible()) continue;
+
+ final Class implClass = beanContext.getManagedClass();
+
+ //Define annotation type
+ AnnotatedType<?> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(implClass);
+
+ //Fires ProcessAnnotatedType
+ ProcessAnnotatedTypeImpl<?> processAnnotatedEvent = webBeansContext.getWebBeansUtil().fireProcessAnnotatedTypeEvent(annotatedType);
+
+ // TODO Can you really veto an EJB?
+ //if veto() is called
+ if (processAnnotatedEvent.isVeto()) {
+ continue;
+ }
- CdiEjbBean<Object> bean = new CdiEjbBean<Object>(beanContext, webBeansContext);
+ CdiEjbBean<Object> bean = new CdiEjbBean<Object>(beanContext, webBeansContext);
- beanContext.set(CdiEjbBean.class, bean);
- beanContext.set(CurrentCreationalContext.class, new CurrentCreationalContext());
- beanContext.addSystemInterceptor(new CdiInterceptor(bean, beanManager, cdiPlugin.getContexsServices()));
+ beanContext.set(CdiEjbBean.class, bean);
+ beanContext.set(CurrentCreationalContext.class, new CurrentCreationalContext());
+ beanContext.addSystemInterceptor(new CdiInterceptor(bean, beanManager, cdiPlugin.getContexsServices()));
- EjbUtility.fireEvents((Class<Object>) implClass, bean, (ProcessAnnotatedTypeImpl<Object>) processAnnotatedEvent);
+ EjbUtility.fireEvents((Class<Object>) implClass, bean, (ProcessAnnotatedTypeImpl<Object>) processAnnotatedEvent);
- webBeansContext.getWebBeansUtil().setInjectionTargetBeanEnableFlag(bean);
+ webBeansContext.getWebBeansUtil().setInjectionTargetBeanEnableFlag(bean);
- Class clazz = beanContext.getBeanClass();
- while (clazz.isAnnotationPresent(Specializes.class)) {
- clazz = clazz.getSuperclass();
+ Class clazz = beanContext.getBeanClass();
+ while (clazz.isAnnotationPresent(Specializes.class)) {
+ clazz = clazz.getSuperclass();
- if (clazz == null || Object.class.equals(clazz)) break;
+ if (clazz == null || Object.class.equals(clazz)) break;
- final CdiEjbBean<Object> superBean = new CdiEjbBean<Object>(beanContext, webBeansContext, clazz);
+ final CdiEjbBean<Object> superBean = new CdiEjbBean<Object>(beanContext, webBeansContext, clazz);
- EjbBeanCreatorImpl<?> ejbBeanCreator = new EjbBeanCreatorImpl(superBean);
+ EjbBeanCreatorImpl<?> ejbBeanCreator = new EjbBeanCreatorImpl(superBean);
- //Define meta-data
- ejbBeanCreator.defineSerializable();
- ejbBeanCreator.defineStereoTypes();
- ejbBeanCreator.defineScopeType("Session Bean implementation class : " + clazz.getName() + " stereotypes must declare same @ScopeType annotations", false);
- ejbBeanCreator.defineQualifier();
- ejbBeanCreator.defineName(WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
+ //Define meta-data
+ ejbBeanCreator.defineSerializable();
+ ejbBeanCreator.defineStereoTypes();
+ ejbBeanCreator.defineScopeType("Session Bean implementation class : " + clazz.getName() + " stereotypes must declare same @ScopeType annotations", false);
+ ejbBeanCreator.defineQualifier();
+ ejbBeanCreator.defineName(WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
- bean.specialize(superBean);
+ bean.specialize(superBean);
- EjbUtility.defineSpecializedData(clazz, bean);
+ EjbUtility.defineSpecializedData(clazz, bean);
+ }
}
}