You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by db...@apache.org on 2011/01/13 21:57:14 UTC

svn commit: r1058749 [2/3] - in /openwebbeans/trunk: webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/ webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/ webbeans-el10/src/main/java/org/apache/webbeans/el10/ webbeans-impl/sr...

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java?rev=1058749&r1=1058748&r2=1058749&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java Thu Jan 13 20:57:13 2011
@@ -32,7 +32,6 @@ import org.apache.webbeans.spi.BDABeansX
 import org.apache.webbeans.spi.ScannerService;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.SecurityUtil;
-import org.apache.webbeans.util.WebBeansUtil;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
@@ -115,7 +114,7 @@ public final class WebBeansInterceptorCo
         }
 
 
-        WebBeansContext.getInstance().getBeanManagerImpl().addInterceptor(interceptor);
+        delegate.getWebBeansContext().getBeanManagerImpl().addInterceptor(interceptor);
 
     }
     
@@ -162,7 +161,7 @@ public final class WebBeansInterceptorCo
         {
             typeAnns = clazz.getDeclaredAnnotations();
         }
-        AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+        AnnotationManager annotationManager = component.getWebBeansContext().getAnnotationManager();
         if (annotationManager.hasInterceptorBindingMetaAnnotation(typeAnns))
         {
             anns = annotationManager.getInterceptorBindingMetaAnnotations(typeAnns);
@@ -298,13 +297,14 @@ public final class WebBeansInterceptorCo
 
     public static void addComponentInterceptors(Set<Interceptor<?>> set, List<InterceptorData> stack)
     {
+        WebBeansContext webBeansContext = WebBeansContext.getInstance();
         Iterator<Interceptor<?>> it = set.iterator();
         while (it.hasNext())
         {
             WebBeansInterceptor<?> interceptor = (WebBeansInterceptor<?>) it.next();
             AnnotatedType<?> annotatedType = interceptor.getAnnotatedType();
 
-            OpenWebBeansEjbLCAPlugin ejbPlugin = WebBeansContext.getInstance().getPluginLoader().getEjbLCAPlugin();
+            OpenWebBeansEjbLCAPlugin ejbPlugin = webBeansContext.getPluginLoader().getEjbLCAPlugin();
             Class <? extends Annotation> prePassivateClass = null;
             Class <? extends Annotation> postActivateClass = null;
             Class <? extends Annotation> aroundTimeoutClass = null;
@@ -318,29 +318,60 @@ public final class WebBeansInterceptorCo
             if(annotatedType != null)
             {
                 // interceptor binding
-                WebBeansUtil.configureInterceptorMethods(interceptor, annotatedType, AroundInvoke.class, true, false, stack, null);
-                WebBeansUtil.configureInterceptorMethods(interceptor, annotatedType, PostConstruct.class, true, false, stack, null);
-                WebBeansUtil.configureInterceptorMethods(interceptor, annotatedType, PreDestroy.class, true, false, stack, null);   
-                
+                webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor, annotatedType,
+                                                                                             AroundInvoke.class, true,
+                                                                                             false, stack, null);
+                webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor, annotatedType,
+                                                                                             PostConstruct.class, true,
+                                                                                             false, stack, null);
+                webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor, annotatedType,
+                                                                                             PreDestroy.class, true,
+                                                                                             false, stack, null);
+
                 if (null != ejbPlugin)
                 {
-                    WebBeansUtil.configureInterceptorMethods(interceptor, annotatedType, prePassivateClass, true, false, stack, null);                
-                    WebBeansUtil.configureInterceptorMethods(interceptor, annotatedType, postActivateClass, true, false, stack, null);       
-                    
+                    webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                 annotatedType,
+                                                                                                 prePassivateClass,
+                                                                                                 true, false, stack,
+                                                                                                 null);
+                    webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                 annotatedType,
+                                                                                                 postActivateClass,
+                                                                                                 true, false, stack,
+                                                                                                 null);
+
                 }                
             }
             else
             {
                 // interceptor binding
-                WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), AroundInvoke.class, true, false, stack, null, true);
-                WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), PostConstruct.class, true, false, stack, null, true);
-                WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), PreDestroy.class, true, false, stack, null, true);
-                
+                webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                             interceptor.getClazz(),
+                                                                                             AroundInvoke.class, true,
+                                                                                             false, stack, null, true);
+                webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                             interceptor.getClazz(),
+                                                                                             PostConstruct.class, true,
+                                                                                             false, stack, null, true);
+                webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                             interceptor.getClazz(),
+                                                                                             PreDestroy.class, true,
+                                                                                             false, stack, null, true);
+
                 if (null != ejbPlugin) 
                 {
-                    WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), prePassivateClass, true, false, stack, null, true);                
-                    WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), postActivateClass, true, false, stack, null, true);       
-                    
+                    webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                 interceptor.getClazz(),
+                                                                                                 prePassivateClass,
+                                                                                                 true, false, stack,
+                                                                                                 null, true);
+                    webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                 interceptor.getClazz(),
+                                                                                                 postActivateClass,
+                                                                                                 true, false, stack,
+                                                                                                 null, true);
+
                 }                
 
             }
@@ -358,7 +389,8 @@ public final class WebBeansInterceptorCo
     private static void addMethodInterceptors(Class<?> clazz, List<InterceptorData> stack, Set<Interceptor<?>> componentInterceptors,
                                               Set<Annotation> resolvedComponentInterceptorBindings)
     {
-        AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+        WebBeansContext webBeansContext = WebBeansContext.getInstance();
+        AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
 
         // All methods, not just those declared
         Method[] methods = clazz.getMethods();
@@ -415,15 +447,35 @@ public final class WebBeansInterceptorCo
                 {
                     WebBeansInterceptor<?> interceptor = (WebBeansInterceptor<?>) it.next();
 
-                    WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), AroundInvoke.class, true, true, stack, method, true);
-                    WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), PostConstruct.class, true, true, stack, method, true);
-                    WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), PreDestroy.class, true, true, stack, method, true);
+                    webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                 interceptor.getClazz(),
+                                                                                                 AroundInvoke.class,
+                                                                                                 true, true, stack,
+                                                                                                 method, true);
+                    webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                 interceptor.getClazz(),
+                                                                                                 PostConstruct.class,
+                                                                                                 true, true, stack,
+                                                                                                 method, true);
+                    webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                 interceptor.getClazz(),
+                                                                                                 PreDestroy.class, true,
+                                                                                                 true, stack, method,
+                                                                                                 true);
 
-                    OpenWebBeansEjbLCAPlugin ejbPlugin = WebBeansContext.getInstance().getPluginLoader().getEjbLCAPlugin();
+                    OpenWebBeansEjbLCAPlugin ejbPlugin = webBeansContext.getPluginLoader().getEjbLCAPlugin();
                     if (null != ejbPlugin)
                     {
-                        WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), ejbPlugin.getPrePassivateClass(), true, true, stack, method, true);
-                        WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), ejbPlugin.getPostActivateClass(), true, true, stack, method, true);
+                        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                     interceptor.getClazz(),
+                                                                                                     ejbPlugin.getPrePassivateClass(),
+                                                                                                     true, true, stack,
+                                                                                                     method, true);
+                        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                     interceptor.getClazz(),
+                                                                                                     ejbPlugin.getPostActivateClass(),
+                                                                                                     true, true, stack,
+                                                                                                     method, true);
                     }
             
                     
@@ -437,7 +489,8 @@ public final class WebBeansInterceptorCo
     private static <T> void addMethodInterceptors(AnnotatedType<T> annotatedType, List<InterceptorData> stack, Set<Interceptor<?>> componentInterceptors)
     {
 
-        AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+        WebBeansContext webBeansContext = WebBeansContext.getInstance();
+        AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
         Set<AnnotatedMethod<? super T>> methods = annotatedType.getMethods();
         for(AnnotatedMethod<? super T> methodA : methods)
         {
@@ -507,15 +560,39 @@ public final class WebBeansInterceptorCo
                     
                     if(interAnnoType == null)
                     {
-                        WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), AroundInvoke.class, true, true, stack, method, true);
-                        WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), PostConstruct.class, true, true, stack, method, true);
-                        WebBeansUtil.configureInterceptorMethods(interceptor, interceptor.getClazz(), PreDestroy.class, true, true, stack, method, true);                        
+                        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                     interceptor.getClazz(),
+                                                                                                     AroundInvoke.class,
+                                                                                                     true, true, stack,
+                                                                                                     method, true);
+                        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                     interceptor.getClazz(),
+                                                                                                     PostConstruct.class,
+                                                                                                     true, true, stack,
+                                                                                                     method, true);
+                        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                     interceptor.getClazz(),
+                                                                                                     PreDestroy.class,
+                                                                                                     true, true, stack,
+                                                                                                     method, true);
                     }
                     else
                     {
-                        WebBeansUtil.configureInterceptorMethods(interceptor, interAnnoType, AroundInvoke.class, true, true, stack, method);
-                        WebBeansUtil.configureInterceptorMethods(interceptor, interAnnoType, PostConstruct.class, true, true, stack, method);
-                        WebBeansUtil.configureInterceptorMethods(interceptor, interAnnoType, PreDestroy.class, true, true, stack, method);                        
+                        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                     interAnnoType,
+                                                                                                     AroundInvoke.class,
+                                                                                                     true, true, stack,
+                                                                                                     method);
+                        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                     interAnnoType,
+                                                                                                     PostConstruct.class,
+                                                                                                     true, true, stack,
+                                                                                                     method);
+                        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(interceptor,
+                                                                                                     interAnnoType,
+                                                                                                     PreDestroy.class,
+                                                                                                     true, true, stack,
+                                                                                                     method);
                     }
                 }
             }            

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java?rev=1058749&r1=1058748&r2=1058749&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/ejb/EJBInterceptorConfig.java Thu Jan 13 20:57:13 2011
@@ -28,13 +28,13 @@ import javax.interceptor.AroundInvoke;
 import javax.interceptor.AroundTimeout;
 import javax.interceptor.Interceptors;
 
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.intercept.InterceptorData;
 import org.apache.webbeans.intercept.InterceptorUtil;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.SecurityUtil;
-import org.apache.webbeans.util.WebBeansUtil;
 
 /**
  * Configures the EJB related interceptors.
@@ -86,6 +86,7 @@ public final class EJBInterceptorConfig
      */
     private static void configureInterceptorAnnots(Class<?> clazz, List<InterceptorData> stack, boolean isMethod, Method m)
     {
+        WebBeansContext webBeansContext = WebBeansContext.getInstance();
         // 1- Look interceptor class super class
         // 2- Look interceptor class
         Class<?> superClass = clazz.getSuperclass();
@@ -94,10 +95,14 @@ public final class EJBInterceptorConfig
             configureInterceptorAnnots(superClass, stack, false, null);
         }
 
-        WebBeansUtil.configureInterceptorMethods(null, clazz, AroundInvoke.class, true, isMethod, stack, m, false);
-        WebBeansUtil.configureInterceptorMethods(null, clazz, AroundTimeout.class, true, isMethod, stack, m, false);
-        WebBeansUtil.configureInterceptorMethods(null, clazz, PostConstruct.class, true, isMethod, stack, m, false);
-        WebBeansUtil.configureInterceptorMethods(null, clazz, PreDestroy.class, true, isMethod, stack, m, false);
+        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(null, clazz, AroundInvoke.class,
+                                                                                     true, isMethod, stack, m, false);
+        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(null, clazz, AroundTimeout.class,
+                                                                                     true, isMethod, stack, m, false);
+        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(null, clazz, PostConstruct.class,
+                                                                                     true, isMethod, stack, m, false);
+        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(null, clazz, PreDestroy.class,
+                                                                                     true, isMethod, stack, m, false);
 
     }
     
@@ -135,10 +140,15 @@ public final class EJBInterceptorConfig
         configureBeanSuperClassAnnots(listSuperClazz, stack);
 
         // 3- Bean itself
-        WebBeansUtil.configureInterceptorMethods(null, clazz, AroundInvoke.class, false, false, stack, null, false);
-        WebBeansUtil.configureInterceptorMethods(null, clazz, AroundTimeout.class, false, false, stack, null, false);
-        WebBeansUtil.configureInterceptorMethods(null, clazz, PostConstruct.class, false, false, stack, null, false);
-        WebBeansUtil.configureInterceptorMethods(null, clazz, PreDestroy.class, false, false, stack, null, false);
+        WebBeansContext webBeansContext = WebBeansContext.getInstance();
+        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(null, clazz, AroundInvoke.class,
+                                                                                     false, false, stack, null, false);
+        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(null, clazz, AroundTimeout.class,
+                                                                                     false, false, stack, null, false);
+        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(null, clazz, PostConstruct.class,
+                                                                                     false, false, stack, null, false);
+        webBeansContext.getWebBeansUtil()._configureInterceptorMethods(null, clazz, PreDestroy.class,
+                                                                                     false, false, stack, null, false);
 
     }
     
@@ -150,16 +160,25 @@ public final class EJBInterceptorConfig
     private static void configureBeanSuperClassAnnots(List<Class<?>> list, List<InterceptorData> stack)
     {
         int i = list.size();
+        WebBeansContext webBeansContext = WebBeansContext.getInstance();
 
         for (int j = i - 1; j >= 0; j--)
         {
             Class<?> clazz = list.get(j);
             if (!clazz.equals(Object.class))
             {
-                WebBeansUtil.configureInterceptorMethods(null, clazz, AroundInvoke.class, false, false, stack, null, false);
-                WebBeansUtil.configureInterceptorMethods(null, clazz, AroundTimeout.class, false, false, stack, null, false);
-                WebBeansUtil.configureInterceptorMethods(null, clazz, PostConstruct.class, false, false, stack, null, false);
-                WebBeansUtil.configureInterceptorMethods(null, clazz, PreDestroy.class, false, false, stack, null, false);
+                webBeansContext.getWebBeansUtil()._configureInterceptorMethods(null, clazz,
+                                                                                             AroundInvoke.class, false,
+                                                                                             false, stack, null, false);
+                webBeansContext.getWebBeansUtil()._configureInterceptorMethods(null, clazz,
+                                                                                             AroundTimeout.class, false,
+                                                                                             false, stack, null, false);
+                webBeansContext.getWebBeansUtil()._configureInterceptorMethods(null, clazz,
+                                                                                             PostConstruct.class, false,
+                                                                                             false, stack, null, false);
+                webBeansContext.getWebBeansUtil()._configureInterceptorMethods(null, clazz,
+                                                                                             PreDestroy.class, false,
+                                                                                             false, stack, null, false);
             }
         }
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=1058749&r1=1058748&r2=1058749&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java Thu Jan 13 20:57:13 2011
@@ -277,8 +277,10 @@ public class WebBeansInterceptor<T> exte
         
         else
         {
-            Class<? extends Annotation> interceptorTypeAnnotationClazz = InterceptorUtil.getInterceptorAnnotationClazz(type);                
-            method = WebBeansUtil.checkCommonAnnotationCriterias(getClazz(), interceptorTypeAnnotationClazz, true);            
+            Class<? extends Annotation> interceptorTypeAnnotationClazz = InterceptorUtil.getInterceptorAnnotationClazz(type);
+            method = getWebBeansContext().getWebBeansUtil()._checkCommonAnnotationCriterias(getClazz(),
+                                                                                                     interceptorTypeAnnotationClazz,
+                                                                                                     true);
         }
         
         return method;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java?rev=1058749&r1=1058748&r2=1058749&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterBeanDiscoveryImpl.java Thu Jan 13 20:57:13 2011
@@ -39,7 +39,6 @@ import org.apache.webbeans.logger.WebBea
 import org.apache.webbeans.portable.events.generics.GProcessBean;
 import org.apache.webbeans.portable.events.generics.GProcessObservableMethod;
 import org.apache.webbeans.util.AnnotationUtil;
-import org.apache.webbeans.util.WebBeansUtil;
 
 /**
  * Event that is fired by the container after it discovers beans.
@@ -76,7 +75,9 @@ public class AfterBeanDiscoveryImpl impl
         if(bean instanceof Interceptor)
         {
             //Required for custom interceptors
-            ManagedBean managedBean = WebBeansUtil.defineManagedBeanWithoutFireEvents(annotatedType);
+            ManagedBean managedBean =
+                webBeansContext.getWebBeansUtil()._defineManagedBeanWithoutFireEvents(
+                    (AnnotatedType<?>) annotatedType);
             
             CustomInterceptor<?> interceptor = new CustomInterceptor(managedBean, (Interceptor<?>)bean);
             if(interceptor.getScope() != Dependent.class)
@@ -110,7 +111,9 @@ public class AfterBeanDiscoveryImpl impl
         else if(bean instanceof Decorator)
         {
             //Required for custom decorators
-            ManagedBean managedBean = WebBeansUtil.defineManagedBeanWithoutFireEvents(annotatedType);
+            ManagedBean managedBean =
+                webBeansContext.getWebBeansUtil()._defineManagedBeanWithoutFireEvents(
+                    (AnnotatedType<?>) annotatedType);
             if(managedBean.getScope() != Dependent.class)
             {
                 if(logger.wblWillLogWarn())

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java?rev=1058749&r1=1058748&r2=1058749&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java Thu Jan 13 20:57:13 2011
@@ -176,7 +176,7 @@ public final class WebBeansAnnotatedType
     @SuppressWarnings("unchecked")
     public static <X> Set<ObserverMethod<?>> defineObserverMethods(AbstractInjectionTargetBean<X> bean,AnnotatedType<X> annotatedType)
     {
-        WebBeansContext webBeansContext = WebBeansContext.getInstance();
+        WebBeansContext webBeansContext = bean.getWebBeansContext();
         Set<ObserverMethod<?>> definedObservers = new HashSet<ObserverMethod<?>>();
         Set<AnnotatedMethod<? super X>> annotatedMethods = annotatedType.getMethods();    
         for (AnnotatedMethod<? super X> annotatedMethod : annotatedMethods)
@@ -230,7 +230,7 @@ public final class WebBeansAnnotatedType
     @SuppressWarnings("unchecked")
     public static <X> void defineDisposalMethods(AbstractInjectionTargetBean<X> bean,AnnotatedType<X> annotatedType)
     {
-        final AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+        final AnnotationManager annotationManager = bean.getWebBeansContext().getAnnotationManager();
         Set<AnnotatedMethod<? super X>> annotatedMethods = annotatedType.getMethods();    
         ProducerMethodBean<?> previous = null;
         for (AnnotatedMethod<? super X> annotatedMethod : annotatedMethods)
@@ -338,7 +338,7 @@ public final class WebBeansAnnotatedType
     
     public static <X> void defineInjectedFields(AbstractInjectionTargetBean<X> bean,AnnotatedType<X> annotatedType)
     {
-        AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+        AnnotationManager annotationManager = bean.getWebBeansContext().getAnnotationManager();
 
         Set<AnnotatedField<? super X>> annotatedFields = annotatedType.getFields();   
         for(AnnotatedField<? super X> annotatedField: annotatedFields)
@@ -391,6 +391,7 @@ public final class WebBeansAnnotatedType
     @SuppressWarnings("unchecked")
     public static <X> Set<ProducerFieldBean<?>> defineProducerFields(InjectionTargetBean<X> bean, AnnotatedType<X> annotatedType)
     {
+        WebBeansContext webBeansContext = bean.getWebBeansContext();
         Set<ProducerFieldBean<?>> producerBeans = new HashSet<ProducerFieldBean<?>>();
         Set<AnnotatedField<? super X>> annotatedFields = annotatedType.getFields();        
         for(AnnotatedField<? super X> annotatedField: annotatedFields)
@@ -450,12 +451,15 @@ public final class WebBeansAnnotatedType
                     
                     DefinitionUtil.defineSerializable(producerFieldBean);
                     DefinitionUtil.defineStereoTypes(producerFieldBean, anns);
-                    WebBeansUtil.setBeanEnableFlagForProducerBean(bean, producerFieldBean, anns);
+                    webBeansContext.getWebBeansUtil()._setBeanEnableFlagForProducerBean(bean,
+                                                                                                      producerFieldBean,
+                                                                                                      anns);
                     Set<Type> types = annotatedField.getTypeClosure();
                     producerFieldBean.getTypes().addAll(types);
                     DefinitionUtil.defineScopeType(producerFieldBean, anns, "Annotated producer field: " + annotatedField +  "must declare default @Scope annotation");
-                    WebBeansUtil.checkUnproxiableApiType(producerFieldBean, producerFieldBean.getScope());
-                    WebBeansUtil.checkProducerGenericType(producerFieldBean,annotatedField.getJavaMember());        
+                    webBeansContext.getWebBeansUtil()._checkUnproxiableApiType(producerFieldBean,
+                                                                                             producerFieldBean.getScope());
+                    WebBeansUtil.checkProducerGenericType(producerFieldBean,annotatedField.getJavaMember());
                     DefinitionUtil.defineQualifiers(producerFieldBean, anns);
                     DefinitionUtil.defineName(producerFieldBean, anns, WebBeansUtil.getProducerDefaultName(annotatedField.getJavaMember().getName()));
                     
@@ -471,6 +475,8 @@ public final class WebBeansAnnotatedType
     @SuppressWarnings("unchecked")
     public static <X> Set<ProducerMethodBean<?>> defineProducerMethods(InjectionTargetBean<X> bean, AnnotatedType<X> annotatedType)
     {
+        WebBeansContext webBeansContext = bean.getWebBeansContext();
+
         Set<ProducerMethodBean<?>> producerBeans = new HashSet<ProducerMethodBean<?>>();
         Set<AnnotatedMethod<? super X>> annotatedMethods = annotatedType.getMethods();
         
@@ -505,15 +511,18 @@ public final class WebBeansAnnotatedType
                 
                 DefinitionUtil.defineSerializable(producerMethodBean);
                 DefinitionUtil.defineStereoTypes(producerMethodBean, AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
-                WebBeansUtil.setBeanEnableFlagForProducerBean(bean, producerMethodBean, AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
-                
+                webBeansContext.getWebBeansUtil()._setBeanEnableFlagForProducerBean(bean,
+                                                                                                  producerMethodBean,
+                                                                                                  AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
+
                 Set<Type> types = annotatedMethod.getTypeClosure();
                 producerMethodBean.getTypes().addAll(types);
                 DefinitionUtil.defineScopeType(producerMethodBean,
                                                AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()),
                                                                                     "Annotated producer method : " + annotatedMethod +  "must declare default @Scope annotation");
-                WebBeansUtil.checkUnproxiableApiType(producerMethodBean, producerMethodBean.getScope());
-                WebBeansUtil.checkProducerGenericType(producerMethodBean,annotatedMethod.getJavaMember());        
+                webBeansContext.getWebBeansUtil()._checkUnproxiableApiType(producerMethodBean,
+                                                                                         producerMethodBean.getScope());
+                WebBeansUtil.checkProducerGenericType(producerMethodBean,annotatedMethod.getJavaMember());
                 DefinitionUtil.defineQualifiers(producerMethodBean, AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
                 DefinitionUtil.defineName(producerMethodBean,
                                           AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()),
@@ -610,7 +619,7 @@ public final class WebBeansAnnotatedType
         
         }
 
-        AnnotationManager annotationManager = WebBeansContext.getInstance().getAnnotationManager();
+        AnnotationManager annotationManager = component.getWebBeansContext().getAnnotationManager();
 
         List<AnnotatedParameter<X>> annotatedParameters = annotatedMethod.getParameters();
         for (AnnotatedParameter<X> annotatedParameter : annotatedParameters)
@@ -840,7 +849,7 @@ public final class WebBeansAnnotatedType
         managedBeanCreator.defineScopeType(logger.getTokenString(OWBLogConst.TEXT_MB_IMPL) + clazz.getName()
                                            + logger.getTokenString(OWBLogConst.TEXT_SAME_SCOPE));                                        
         //Check for Enabled via Alternative
-        WebBeansUtil.setInjectionTargetBeanEnableFlag(managedBean);        
+        WebBeansContext.getInstance().getWebBeansUtil()._setInjectionTargetBeanEnableFlag(managedBean);
         managedBeanCreator.defineApiType();
         managedBeanCreator.checkCreateConditions();
         managedBeanCreator.defineQualifier();

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1058749&r1=1058748&r2=1058749&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java Thu Jan 13 20:57:13 2011
@@ -170,7 +170,7 @@ import static org.apache.webbeans.util.I
 /**
  * Contains some utility methods used in the all project.
  *
- * @version $Rev$ $Date$ 
+ * @version $Rev$ $Date$
  */
 @SuppressWarnings("unchecked")
 public final class WebBeansUtil
@@ -183,10 +183,11 @@ public final class WebBeansUtil
      */
     private static Boolean enforceCheckedException;
 
-    // No instantiate
-    private WebBeansUtil()
+    private final WebBeansContext webBeansContext;
+
+    public WebBeansUtil(WebBeansContext webBeansContext)
     {
-        throw new UnsupportedOperationException();
+        this.webBeansContext = webBeansContext;
     }
 
     /**
@@ -197,11 +198,11 @@ public final class WebBeansUtil
      *
      * @return <code>true</code> if the spec rule of having no checked exception should be enforced
      */
-    private static boolean isNoCheckedExceptionEnforced()
+    private boolean _isNoCheckedExceptionEnforced()
     {
         if (enforceCheckedException == null)
         {
-            enforceCheckedException = Boolean.parseBoolean(WebBeansContext.getInstance().getOpenWebBeansConfiguration().
+            enforceCheckedException = Boolean.parseBoolean(webBeansContext.getOpenWebBeansConfiguration().
                     getProperty(OpenWebBeansConfiguration.INTERCEPTOR_FORCE_NO_CHECKED_EXCEPTIONS, "true"));
         }
 
@@ -248,7 +249,7 @@ public final class WebBeansUtil
 
 
     /**
-     * Check producer method/field bean return type. 
+     * Check producer method/field bean return type.
      * @param bean producer bean instance
      * @param member related member instance
      */
@@ -287,7 +288,7 @@ public final class WebBeansUtil
      * Check generic types for producer method and fields.
      * @param type generic return type
      * @param message error message
-     * @return true if parametrized type argument is TypeVariable 
+     * @return true if parametrized type argument is TypeVariable
      */
     //Helper method
     private static boolean checkGenericForProducers(Type type, String message)
@@ -334,7 +335,7 @@ public final class WebBeansUtil
      * @param clazz class in hand
      * @return <code>true</code> if the given class is ok for simple web bean conditions.
      */
-    public static void isManagedBeanClass(Class<?> clazz)
+    public void _isManagedBeanClass(Class<?> clazz)
     {
         Asserts.nullCheckForClass(clazz, "Class is null");
 
@@ -378,7 +379,7 @@ public final class WebBeansUtil
         }
 
         // and finally call all checks which are defined in plugins like JSF, JPA, etc
-        List<OpenWebBeansPlugin> plugins = WebBeansContext.getInstance().getPluginLoader().getPlugins();
+        List<OpenWebBeansPlugin> plugins = webBeansContext.getPluginLoader().getPlugins();
         for (OpenWebBeansPlugin plugin : plugins)
         {
             try
@@ -397,15 +398,15 @@ public final class WebBeansUtil
      * false otherwise.
      * <p>
      * Each plugin is asked with given class that supports
-     * injections or not. 
+     * injections or not.
      * </p>
      * @param clazz scanned class
      * @return  true if given class supports injections
      */
-    public static boolean supportsJavaEeComponentInjections(Class<?> clazz)
+    public boolean _supportsJavaEeComponentInjections(Class<?> clazz)
     {
         // and finally call all checks which are defined in plugins like JSF, JPA, etc
-        List<OpenWebBeansPlugin> plugins = WebBeansContext.getInstance().getPluginLoader().getPlugins();
+        List<OpenWebBeansPlugin> plugins = webBeansContext.getPluginLoader().getPlugins();
         for (OpenWebBeansPlugin plugin : plugins)
         {
             //Ejb plugin handles its own events
@@ -496,7 +497,7 @@ public final class WebBeansUtil
     }
 
     /**
-     * Check that simple web beans class has compatible constructor. 
+     * Check that simple web beans class has compatible constructor.
      * @param clazz web beans simple class
      * @throws WebBeansConfigurationException if the web beans has incompatible
      *             constructor
@@ -547,7 +548,7 @@ public final class WebBeansUtil
     /**
      * CheckProducerMethodDisposal.
      * @param disposalMethod disposal method
-     * @param definedBeanClassName bean class name 
+     * @param definedBeanClassName bean class name
      */
     public static void checkProducerMethodDisposal(Method disposalMethod, String definedBeanClassName)
     {
@@ -860,8 +861,7 @@ public final class WebBeansUtil
      *            interceptors defiend outside of the bean class.
      * @return post construct or predestroy method
      */
-    public static Method checkCommonAnnotationCriterias(Class<?> clazz, Class<? extends Annotation> commonAnnotation,
-                                                        boolean invocationContext)
+    public Method _checkCommonAnnotationCriterias(Class<?> clazz, Class<? extends Annotation> commonAnnotation, boolean invocationContext)
     {
         Asserts.nullCheckForClass(clazz);
 
@@ -911,7 +911,7 @@ public final class WebBeansUtil
                             + " must return void type");
                 }
 
-                if (isNoCheckedExceptionEnforced() && ClassUtil.isMethodHasCheckedException(method))
+                if (_isNoCheckedExceptionEnforced() && ClassUtil.isMethodHasCheckedException(method))
                 {
                     throw new WebBeansConfigurationException("@" + commonAnnotation.getSimpleName()
                             + " annotated method : " + method.getName() + " in class : " + clazz.getName()
@@ -930,9 +930,7 @@ public final class WebBeansUtil
         return result;
     }
 
-    public static <T> Method checkCommonAnnotationCriterias(AnnotatedType<T> annotatedType,
-                                                            Class<? extends Annotation> commonAnnotation,
-                                                            boolean invocationContext)
+    public <T> Method _checkCommonAnnotationCriterias(AnnotatedType<T> annotatedType, Class<? extends Annotation> commonAnnotation, boolean invocationContext)
     {
         Class<?> clazz = annotatedType.getJavaClass();
 
@@ -997,7 +995,7 @@ public final class WebBeansUtil
                             + " must return void type");
                 }
 
-                if (isNoCheckedExceptionEnforced() && ClassUtil.isMethodHasCheckedException(method))
+                if (_isNoCheckedExceptionEnforced() && ClassUtil.isMethodHasCheckedException(method))
                 {
                     throw new WebBeansConfigurationException("@" + commonAnnotation.getSimpleName()
                             + " annotated method : " + method.getName() + " in class : " + clazz.getName()
@@ -1064,7 +1062,7 @@ public final class WebBeansUtil
                             + method.getName() + " in class : " + clazz.getName()
                             + " can not take any formal arguments other than InvocationContext");
                 }
-                
+
                 if (!ClassUtil.getReturnType(method).equals(Object.class))
                 {
                     throw new WebBeansConfigurationException("@" + annot.getSimpleName() + " annotated method : "
@@ -1088,8 +1086,7 @@ public final class WebBeansUtil
         return result;
     }
 
-    public static <T> Method checkAroundInvokeAnnotationCriterias(AnnotatedType<T> annotatedType,
-                                                                  Class<? extends Annotation> annot)
+    public static <T> Method checkAroundInvokeAnnotationCriterias(AnnotatedType<T> annotatedType, Class<? extends Annotation> annot)
     {
         Method result = null;
         boolean found = false;
@@ -1132,7 +1129,7 @@ public final class WebBeansUtil
                             + method.getJavaMember().getName() + " in class : " + annotatedType.getJavaClass().getName()
                             + " can not take any formal arguments other than InvocationContext");
                 }
-                
+
                 if (!ClassUtil.getReturnType(method.getJavaMember()).equals(Object.class))
                 {
                     throw new WebBeansConfigurationException("@" + annot.getSimpleName() + " annotated method : "
@@ -1176,14 +1173,14 @@ public final class WebBeansUtil
      * @param defineWithInterceptorBinding if interceptor is defined with WebBeans
      *            spec, not EJB spec
      */
-    public static void configureInterceptorMethods(Interceptor<?> webBeansInterceptor,
-                                                   Class<?> interceptorClass,
-                                                   Class<? extends Annotation> interceptorType,
-                                                   boolean definedInInterceptorClass,
-                                                   boolean definedInMethod,
-                                                   List<InterceptorData> stack,
-                                                   Method annotatedInterceptorClassMethod,
-                                                   boolean defineWithInterceptorBinding)
+    public void _configureInterceptorMethods(Interceptor<?> webBeansInterceptor,
+                                             Class<?> interceptorClass,
+                                             Class<? extends Annotation> interceptorType,
+                                             boolean definedInInterceptorClass,
+                                             boolean definedInMethod,
+                                             List<InterceptorData> stack,
+                                             Method annotatedInterceptorClassMethod,
+                                             boolean defineWithInterceptorBinding)
     {
         InterceptorData intData = null;
         Method method = null;
@@ -1191,8 +1188,8 @@ public final class WebBeansUtil
         Class<? extends Annotation> prePassivateClass  = null;
         Class<? extends Annotation> postActivateClass  = null;
 
-        ejbPlugin = WebBeansContext.getInstance().getPluginLoader().getEjbLCAPlugin();
-        if(ejbPlugin != null) 
+        ejbPlugin = webBeansContext.getPluginLoader().getEjbLCAPlugin();
+        if(ejbPlugin != null)
         {
             prePassivateClass  = ejbPlugin.getPrePassivateClass();
             postActivateClass  = ejbPlugin.getPostActivateClass();
@@ -1219,7 +1216,7 @@ public final class WebBeansUtil
         else if (interceptorType.equals(PostConstruct.class) || ((postActivateClass != null) && (interceptorType.equals(postActivateClass)))
                  || interceptorType.equals(PreDestroy.class) || ((prePassivateClass != null) && (interceptorType.equals(prePassivateClass))))
         {
-            method = WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass, interceptorType, definedInInterceptorClass);
+            method = _checkCommonAnnotationCriterias(interceptorClass, interceptorType, definedInInterceptorClass);
         }
 
         if (method != null)
@@ -1242,13 +1239,13 @@ public final class WebBeansUtil
     }
 
 
-    public static <T> void configureInterceptorMethods(Interceptor<?> webBeansInterceptor,
-                                                       AnnotatedType<T> annotatedType,
-                                                       Class<? extends Annotation> annotation,
-                                                       boolean definedInInterceptorClass,
-                                                       boolean definedInMethod,
-                                                       List<InterceptorData> stack,
-                                                       Method annotatedInterceptorClassMethod)
+    public <T> void _configureInterceptorMethods(Interceptor<?> webBeansInterceptor,
+                                                 AnnotatedType<T> annotatedType,
+                                                 Class<? extends Annotation> annotation,
+                                                 boolean definedInInterceptorClass,
+                                                 boolean definedInMethod,
+                                                 List<InterceptorData> stack,
+                                                 Method annotatedInterceptorClassMethod)
     {
         InterceptorData intData = null;
         Method method = null;
@@ -1256,7 +1253,7 @@ public final class WebBeansUtil
         Class<? extends Annotation> prePassivateClass  = null;
         Class<? extends Annotation> postActivateClass  = null;
 
-        ejbPlugin = WebBeansContext.getInstance().getPluginLoader().getEjbLCAPlugin();
+        ejbPlugin = webBeansContext.getPluginLoader().getEjbLCAPlugin();
         if(ejbPlugin != null)
         {
             prePassivateClass  = ejbPlugin.getPrePassivateClass();
@@ -1271,7 +1268,7 @@ public final class WebBeansUtil
         else if (annotation.equals(PostConstruct.class) || ((postActivateClass != null) && (annotation.equals(postActivateClass)))
                  || annotation.equals(PreDestroy.class) || ((prePassivateClass != null) && (annotation.equals(prePassivateClass))))
         {
-            method = WebBeansUtil.checkCommonAnnotationCriterias(annotatedType, annotation, definedInInterceptorClass);
+            method = _checkCommonAnnotationCriterias(annotatedType, annotation, definedInInterceptorClass);
         }
 
         if (method != null)
@@ -1299,8 +1296,7 @@ public final class WebBeansUtil
      * @return
      * @throws WebBeansConfigurationException
      */
-    public static <T> T newInstanceForced(Class<T> clazz)
-            throws WebBeansConfigurationException
+    public static <T> T newInstanceForced(Class<T> clazz) throws WebBeansConfigurationException
     {
         // FIXME: This new instance should have JCDI injection performed
         Constructor<T> ct = ClassUtil.isContaintNoArgConstructor(clazz);
@@ -1537,11 +1533,11 @@ public final class WebBeansUtil
         return true;
     }
 
-    public static void configureSpecializations(List<Class<?>> beanClasses)
+    public void _configureSpecializations(List<Class<?>> beanClasses)
     {
         for(Class<?> clazz : beanClasses)
         {
-            configureSpecializations(clazz, beanClasses);
+            _configureSpecializations(clazz, beanClasses);
         }
     }
 
@@ -1558,14 +1554,14 @@ public final class WebBeansUtil
      * @throws InconsistentSpecializationException related with priority
      * @throws WebBeansConfigurationException any other exception
      */
-    protected static void configureSpecializations(Class<?> specializedClass, List<Class<?>> beanClasses)
+    protected void _configureSpecializations(Class<?> specializedClass, List<Class<?>> beanClasses)
     {
         Asserts.nullCheckForClass(specializedClass);
 
         Bean<?> superBean = null;
         Bean<?> specialized = null;
-        Set<Bean<?>> resolvers = isConfiguredWebBeans(specializedClass, true);
-        AlternativesManager altManager = WebBeansContext.getInstance().getAlternativesManager();
+        Set<Bean<?>> resolvers = _isConfiguredWebBeans(specializedClass, true);
+        AlternativesManager altManager = webBeansContext.getAlternativesManager();
 
         if (resolvers != null)
         {
@@ -1591,7 +1587,7 @@ public final class WebBeansUtil
                     {
                         continue;
                     }
-                    
+
                     if (((AbstractOwbBean<?>)sp).getReturnType().
                             isAssignableFrom(((AbstractOwbBean<?>)specialized).getReturnType()))
                     {
@@ -1602,7 +1598,7 @@ public final class WebBeansUtil
 
             Class<?> superClass = specializedClass.getSuperclass();
 
-            resolvers = isConfiguredWebBeans(superClass,false);
+            resolvers = _isConfiguredWebBeans(superClass,false);
 
             for(Bean<?> candidates : resolvers)
             {
@@ -1624,7 +1620,7 @@ public final class WebBeansUtil
                 // So the name and bean meta data could be populated to this beanclass.
                 if (beanClasses.contains(superClass) && ((AbstractOwbBean<?>)superBean).isEnabled())
                 {
-                    configureSpecializations(superClass, beanClasses);
+                    _configureSpecializations(superClass, beanClasses);
                 }
 
                 if (!AnnotationUtil.hasClassAnnotation(specializedClass, Alternative.class))
@@ -1684,14 +1680,14 @@ public final class WebBeansUtil
      *
      * @param sortedProducerBeans
      */
-    protected static void configSpecializedProducerMethodBeans(List<ProducerMethodBean> sortedProducerBeans)
+    protected void _configSpecializedProducerMethodBeans(List<ProducerMethodBean> sortedProducerBeans)
     {
         if (sortedProducerBeans.isEmpty())
         {
             return;
         }
 
-        AlternativesManager altManager = WebBeansContext.getInstance().getAlternativesManager();
+        AlternativesManager altManager = webBeansContext.getAlternativesManager();
         Method superMethod = sortedProducerBeans.get(0).getCreatorMethod();
 
         for(int i=1; i<sortedProducerBeans.size(); i++)
@@ -1706,7 +1702,7 @@ public final class WebBeansUtil
                 bean.addQualifier(an);
             }
             // inherit name is super class has name
-            boolean isSuperHasName = configuredProducerSpecializedName(bean, bean.getCreatorMethod(), superMethod);
+            boolean isSuperHasName = _configuredProducerSpecializedName(bean, bean.getCreatorMethod(), superMethod);
 
             // disable super bean if needed
             if (bean.getCreatorMethod().getAnnotation(Alternative.class) == null)
@@ -1732,7 +1728,7 @@ public final class WebBeansUtil
     /**
      * Configure direct/indirect specialized producer method beans.
      */
-    public static void configureProducerMethodSpecializations()
+    public void _configureProducerMethodSpecializations()
     {
         Method method;
         ProducerMethodBean pbean;
@@ -1742,7 +1738,7 @@ public final class WebBeansUtil
         logger.debug("configure Specialized producer beans has started.");
 
         // collect all producer method beans
-        Set<Bean<?>> beans = WebBeansContext.getInstance().getBeanManagerImpl().getBeans();
+        Set<Bean<?>> beans = webBeansContext.getBeanManagerImpl().getBeans();
         List<ProducerMethodBean> producerBeans = new ArrayList<ProducerMethodBean>();
         for(Bean b : beans)
         {
@@ -1777,7 +1773,7 @@ public final class WebBeansUtil
             method = null;
             producerBeanListHelper.clear();
 
-            //locate a specialized bean 
+            //locate a specialized bean
             for(ProducerMethodBean pb : producerBeans)
             {
                 if (pb.isSpecializedBean())
@@ -1864,18 +1860,18 @@ public final class WebBeansUtil
                 producerBeans.remove(pb);
             }
             //configure the directly extended producer beans
-            configSpecializedProducerMethodBeans(producerBeanListHelper.getList());
+            _configSpecializedProducerMethodBeans(producerBeanListHelper.getList());
         }
     }
 
 
-    public static Set<Bean<?>> isConfiguredWebBeans(Class<?> clazz,boolean annotate)
+    public Set<Bean<?>> _isConfiguredWebBeans(Class<?> clazz,boolean annotate)
     {
         Asserts.nullCheckForClass(clazz);
 
         Set<Bean<?>> beans = new HashSet<Bean<?>>();
 
-        Set<Bean<?>> components = WebBeansContext.getInstance().getBeanManagerImpl().getComponents();
+        Set<Bean<?>> components = webBeansContext.getBeanManagerImpl().getComponents();
         Iterator<Bean<?>> it = components.iterator();
 
         while (it.hasNext())
@@ -1915,16 +1911,16 @@ public final class WebBeansUtil
      * Checks the unproxiable condition.
      * @param bean managed bean
      * @param scopeType scope type
-     * @throws WebBeansConfigurationException if 
+     * @throws WebBeansConfigurationException if
      *  bean is not proxied by the container
      */
-    public static void checkUnproxiableApiType(Bean<?> bean, Class<? extends Annotation> scopeType)
+    public void _checkUnproxiableApiType(Bean<?> bean, Class<? extends Annotation> scopeType)
     {
         Asserts.assertNotNull("bean", "bean parameter can not be null");
         Asserts.assertNotNull(scopeType, "scopeType parameter can not be null");
 
         //Unproxiable test for NormalScoped beans
-        if (WebBeansUtil.isScopeTypeNormal(scopeType))
+        if (_isScopeTypeNormal(scopeType))
         {
             Set<Type> types = bean.getTypes();
 
@@ -2031,11 +2027,9 @@ public final class WebBeansUtil
      * @param method specialized producer method
      * @param superMethod overriden super producer method
      */
-    public static boolean configuredProducerSpecializedName(AbstractOwbBean<?> component,
-                                                            Method method,
-                                                            Method superMethod)
+    public boolean _configuredProducerSpecializedName(AbstractOwbBean<?> component, Method method, Method superMethod)
     {
-         return WebBeansContext.getInstance().getAnnotationManager().configuredProducerSpecializedName(component, method, superMethod);
+        return webBeansContext.getAnnotationManager().configuredProducerSpecializedName(component, method, superMethod);
     }
 
     public static void checkInjectedMethodParameterConditions(Method method, Class<?> clazz)
@@ -2124,21 +2118,20 @@ public final class WebBeansUtil
         return true;
     }
 
-    public static <T> void defineInterceptor(ManagedBeanCreatorImpl<T> managedBeanCreator,
-                                             ProcessInjectionTarget<T> injectionTargetEvent)
+    public <T> void _defineInterceptor(ManagedBeanCreatorImpl<T> managedBeanCreator, ProcessInjectionTarget<T> injectionTargetEvent)
     {
         Class<?> clazz = injectionTargetEvent.getAnnotatedType().getJavaClass();
-        if (WebBeansContext.getInstance().getInterceptorsManager().isInterceptorEnabled(clazz))
+        if (webBeansContext.getInterceptorsManager().isInterceptorEnabled(clazz))
         {
             ManagedBean<T> component = null;
 
             InterceptorUtil.checkInterceptorConditions(clazz);
-            component = defineManagedBean(managedBeanCreator, injectionTargetEvent);
+            component = _defineManagedBean(managedBeanCreator, injectionTargetEvent);
 
             if (component != null)
             {
                 WebBeansInterceptorConfig.configureInterceptorClass((ManagedBean<Object>) component,
-                                                                    WebBeansContext.getInstance().getAnnotationManager().getInterceptorBindingMetaAnnotations(
+                                                                    webBeansContext.getAnnotationManager().getInterceptorBindingMetaAnnotations(
                                                                         clazz.getDeclaredAnnotations()));
             }
         }
@@ -2150,13 +2143,12 @@ public final class WebBeansUtil
      * Define decorator bean.
      * @param <T> type info
      * @param creator bean creator
-     * @param processInjectionTargetEvent 
+     * @param processInjectionTargetEvent
      */
-    public static <T> void defineDecorator(ManagedBeanCreatorImpl<T> creator,
-                                           ProcessInjectionTarget<T> processInjectionTargetEvent)
+    public <T> void _defineDecorator(ManagedBeanCreatorImpl<T> creator, ProcessInjectionTarget<T> processInjectionTargetEvent)
     {
         Class<T> clazz = processInjectionTargetEvent.getAnnotatedType().getJavaClass();
-        if (WebBeansContext.getInstance().getDecoratorsManager().isDecoratorEnabled(clazz))
+        if (webBeansContext.getDecoratorsManager().isDecoratorEnabled(clazz))
         {
             ManagedBean<T> delegate = null;
 
@@ -2164,11 +2156,11 @@ public final class WebBeansUtil
 
             if(Modifier.isAbstract(clazz.getModifiers()))
             {
-                delegate = defineAbstractDecorator(creator, processInjectionTargetEvent);
+                delegate = _defineAbstractDecorator(creator, processInjectionTargetEvent);
             }
             else
             {
-                delegate = defineManagedBean(creator, processInjectionTargetEvent);
+                delegate = _defineManagedBean(creator, processInjectionTargetEvent);
             }
 
             if (delegate != null)
@@ -2189,7 +2181,7 @@ public final class WebBeansUtil
      * @return <code>true</code> if the given scopeType represents a
      *         {@link javax.enterprise.context.NormalScope}d bean
      */
-    public static boolean isScopeTypeNormal(Class<? extends Annotation> scopeType)
+    public boolean _isScopeTypeNormal(Class<? extends Annotation> scopeType)
     {
         Asserts.assertNotNull(scopeType, "scopeType argument can not be null");
 
@@ -2213,14 +2205,14 @@ public final class WebBeansUtil
             return false;
         }
 
-        List<ExternalScope> additionalScopes = WebBeansContext.getInstance().getBeanManagerImpl().getAdditionalScopes();
+        List<ExternalScope> additionalScopes = webBeansContext.getBeanManagerImpl().getAdditionalScopes();
         for (ExternalScope additionalScope : additionalScopes)
         {
             if (additionalScope.getScope().equals(scopeType))
             {
                 isNormal = additionalScope.isNormal() ? Boolean.TRUE : Boolean.FALSE;
                 isScopeTypeNormalCache.put(scopeType, isNormal);
-                return isNormal.booleanValue(); 
+                return isNormal.booleanValue();
             }
         }
 
@@ -2232,7 +2224,7 @@ public final class WebBeansUtil
      * we cache results of calls to {@link #isScopeTypeNormalCache} because
      * this doesn't change at runtime.
      * We don't need to take special care about classloader
-     * hierarchies, because each cl has other classes. 
+     * hierarchies, because each cl has other classes.
      */
     private static Map<Class<? extends Annotation>, Boolean> isScopeTypeNormalCache =
             new ConcurrentHashMap<Class<? extends Annotation>, Boolean>();
@@ -2250,10 +2242,9 @@ public final class WebBeansUtil
 
     }
 
-    public static void checkSerializableScopeType(Class<? extends Annotation> scopeType, boolean isSerializable,
-                                                  String errorMessage)
+    public void _checkSerializableScopeType(Class<? extends Annotation> scopeType, boolean isSerializable, String errorMessage)
     {
-        if (WebBeansContext.getInstance().getBeanManagerImpl().isPassivatingScope(scopeType))
+        if (webBeansContext.getBeanManagerImpl().isPassivatingScope(scopeType))
         {
             if (!isSerializable)
             {
@@ -2305,43 +2296,43 @@ public final class WebBeansUtil
 //    public static void addInjectedImplicitEventComponent(InjectionPoint injectionPoint)
 //    {
 //        Type type = injectionPoint.getType();
-//        
+//
 //        if(!(type instanceof ParameterizedType))
 //        {
 //            return;
 //        }
-//        
+//
 //        Type[] args = new Type[0];
-//        
+//
 //        Class<?> clazz = null;
 //        if (type instanceof ParameterizedType)
 //        {
 //            ParameterizedType pt = (ParameterizedType) type;
 //            args = pt.getActualTypeArguments();
 //        }
-//        
+//
 //        clazz = (Class<?>)args[0];
-//        
+//
 //        Annotation[] qualifiers = new Annotation[injectionPoint.getQualifiers().size()];
 //        qualifiers = injectionPoint.getQualifiers().toArray(qualifiers);
-//        
+//
 //        Bean<?> bean = createObservableImplicitComponent(EventImpl.class, clazz, qualifiers);
-//        BeanManagerImpl.getManager().addBean(bean);                  
+//        BeanManagerImpl.getManager().addBean(bean);
 //    }
 
 
 //    public static <T> void addInjectedImplicitInstanceComponent(InjectionPoint injectionPoint)
 //    {
 //        ParameterizedType genericType = (ParameterizedType)injectionPoint.getType();
-//        
+//
 //        Class<Instance<T>> clazz = (Class<Instance<T>>)genericType.getRawType();
-//        
+//
 //        Annotation[] qualifiers = new Annotation[injectionPoint.getQualifiers().size()];
 //        qualifiers = injectionPoint.getQualifiers().toArray(qualifiers);
-//        
+//
 //        Bean<Instance<T>> bean = createInstanceComponent(genericType,clazz, genericType.getActualTypeArguments()[0], qualifiers);
 //        BeanManagerImpl.getManager().addBean(bean);
-//        
+//
 //    }
 
     public static Bean<?> getMostSpecializedBean(BeanManager manager, Bean<?> component)
@@ -2366,17 +2357,17 @@ public final class WebBeansUtil
     }
 
     /**
-     * Returns <code>ProcessAnnotatedType</code> event. 
+     * Returns <code>ProcessAnnotatedType</code> event.
      * @param <T> bean type
      * @param annotatedType bean class
      * @return event
      */
-    public static <T> GProcessAnnotatedType fireProcessAnnotatedTypeEvent(AnnotatedType<T> annotatedType)
+    public <T> GProcessAnnotatedType _fireProcessAnnotatedTypeEvent(AnnotatedType<T> annotatedType)
     {
         GProcessAnnotatedType processAnnotatedEvent = new GProcessAnnotatedType(annotatedType);
 
         //Fires ProcessAnnotatedType
-        WebBeansContext.getInstance().getBeanManagerImpl().fireEvent(processAnnotatedEvent,AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+        webBeansContext.getBeanManagerImpl().fireEvent(processAnnotatedEvent,AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
 
         return processAnnotatedEvent;
     }
@@ -2387,15 +2378,15 @@ public final class WebBeansUtil
      * @param bean bean instance
      * @return event
      */
-    public static <T> GProcessInjectionTarget fireProcessInjectionTargetEvent(AbstractInjectionTargetBean<T> bean)
+    public <T> GProcessInjectionTarget _fireProcessInjectionTargetEvent(AbstractInjectionTargetBean<T> bean)
     {
-        AnnotatedType<T> annotatedType = WebBeansContext.getInstance().getAnnotatedElementFactory().newAnnotatedType(bean.getReturnType());
+        AnnotatedType<T> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(bean.getReturnType());
         InjectionTargetProducer<T> injectionTarget = new InjectionTargetProducer<T>(bean);
         GProcessInjectionTarget processInjectionTargetEvent = new GProcessInjectionTarget(injectionTarget,
                                                                                           annotatedType);
 
         //Fires ProcessInjectionTarget
-        WebBeansContext.getInstance().getBeanManagerImpl().fireEvent(processInjectionTargetEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+        webBeansContext.getBeanManagerImpl().fireEvent(processInjectionTargetEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
 
         return processInjectionTargetEvent;
 
@@ -2406,47 +2397,43 @@ public final class WebBeansUtil
      * @param <T> bean type
      * @return event
      */
-    public static <T> GProcessInjectionTarget fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass)
+    public <T> GProcessInjectionTarget _fireProcessInjectionTargetEventForJavaEeComponents(Class<T> componentClass)
     {
-        AnnotatedType<T> annotatedType = WebBeansContext.getInstance().getAnnotatedElementFactory().newAnnotatedType(componentClass);
-        InjectionTarget<T> injectionTarget = WebBeansContext.getInstance().getBeanManagerImpl().createInjectionTarget(annotatedType);
+        AnnotatedType<T> annotatedType = webBeansContext.getAnnotatedElementFactory().newAnnotatedType(componentClass);
+        InjectionTarget<T> injectionTarget = webBeansContext.getBeanManagerImpl().createInjectionTarget(annotatedType);
         GProcessInjectionTarget processInjectionTargetEvent = new GProcessInjectionTarget(injectionTarget,annotatedType);
 
         //Fires ProcessInjectionTarget
-        WebBeansContext.getInstance().getBeanManagerImpl().fireEvent(processInjectionTargetEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+        webBeansContext.getBeanManagerImpl().fireEvent(processInjectionTargetEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
 
         return processInjectionTargetEvent;
 
     }
 
 
-    public static GProcessProducer fireProcessProducerEventForMethod(ProducerMethodBean<?> producerMethod,
-                                                                     AnnotatedMethod<?> method)
+    public GProcessProducer _fireProcessProducerEventForMethod(ProducerMethodBean<?> producerMethod, AnnotatedMethod<?> method)
     {
         GProcessProducer producerEvent = new GProcessProducer(new ProducerBeansProducer(producerMethod),method);
 
         //Fires ProcessProducer for methods
-        WebBeansContext.getInstance().getBeanManagerImpl().fireEvent(producerEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+        webBeansContext.getBeanManagerImpl().fireEvent(producerEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
 
         return producerEvent;
     }
 
-    public static GProcessProducer fireProcessProducerEventForField(ProducerFieldBean<?> producerField,
-                                                                    AnnotatedField<?> field)
+    public GProcessProducer _fireProcessProducerEventForField(ProducerFieldBean<?> producerField, AnnotatedField<?> field)
     {
         GProcessProducer producerEvent = new GProcessProducer(new ProducerBeansProducer(producerField),field);
 
         //Fires ProcessProducer for fields
-        WebBeansContext.getInstance().getBeanManagerImpl().fireEvent(producerEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+        webBeansContext.getBeanManagerImpl().fireEvent(producerEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
 
         return producerEvent;
     }
 
-    public static void fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>,
-                                                          AnnotatedMethod<?>> annotatedMethods,
-                                                          AnnotatedType<?> annotatedType)
+    public void _fireProcessProducerMethodBeanEvent(Map<ProducerMethodBean<?>, AnnotatedMethod<?>> annotatedMethods, AnnotatedType<?> annotatedType)
     {
-        WebBeansContext webBeansContext = WebBeansContext.getInstance();
+        WebBeansContext webBeansContext = this.webBeansContext;
         AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
 
         for(ProducerMethodBean<?> bean : annotatedMethods.keySet())
@@ -2474,7 +2461,7 @@ public final class WebBeansUtil
         }
     }
 
-    public static void fireProcessObservableMethodBeanEvent(Map<ObserverMethod<?>,AnnotatedMethod<?>> annotatedMethods)
+    public void _fireProcessObservableMethodBeanEvent(Map<ObserverMethod<?>,AnnotatedMethod<?>> annotatedMethods)
     {
         for(ObserverMethod<?> observableMethod : annotatedMethods.keySet())
         {
@@ -2483,12 +2470,12 @@ public final class WebBeansUtil
             GProcessObservableMethod event = new GProcessObservableMethod(annotatedMethod, observableMethod);
 
             //Fires ProcessProducer
-            WebBeansContext.getInstance().getBeanManagerImpl().fireEvent(event, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+            webBeansContext.getBeanManagerImpl().fireEvent(event, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
         }
     }
 
 
-    public static void fireProcessProducerFieldBeanEvent(Map<ProducerFieldBean<?>,AnnotatedField<?>> annotatedFields)
+    public void _fireProcessProducerFieldBeanEvent(Map<ProducerFieldBean<?>,AnnotatedField<?>> annotatedFields)
     {
         for(ProducerFieldBean<?> bean : annotatedFields.keySet())
         {
@@ -2497,7 +2484,7 @@ public final class WebBeansUtil
             GProcessProducerField processProducerFieldEvent = new GProcessProducerField(bean,field);
 
             //Fire ProcessProducer
-            WebBeansContext.getInstance().getBeanManagerImpl().fireEvent(processProducerFieldEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+            webBeansContext.getBeanManagerImpl().fireEvent(processProducerFieldEvent, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
         }
     }
 
@@ -2553,13 +2540,13 @@ public final class WebBeansUtil
      * Sets bean enabled flag.
      * @param bean bean instance
      */
-    public static void setInjectionTargetBeanEnableFlag(InjectionTargetBean<?> bean)
+    public void _setInjectionTargetBeanEnableFlag(InjectionTargetBean<?> bean)
     {
         Asserts.assertNotNull(bean, "bean can not be null");
 
         if(hasInjectionTargetBeanAnnotatedWithAlternative(bean))
         {
-            if(!WebBeansContext.getInstance().getAlternativesManager().isBeanHasAlternative(bean))
+            if(!webBeansContext.getAlternativesManager().isBeanHasAlternative(bean))
             {
                 bean.setEnabled(false);
             }
@@ -2596,9 +2583,7 @@ public final class WebBeansUtil
 
     }
 
-    public static void setBeanEnableFlagForProducerBean(InjectionTargetBean<?> parent,
-                                                        AbstractProducerBean<?> producer,
-                                                        Annotation[] annotations)
+    public void _setBeanEnableFlagForProducerBean(InjectionTargetBean<?> parent, AbstractProducerBean<?> producer, Annotation[] annotations)
     {
         Asserts.assertNotNull(parent, "parent can not be null");
         Asserts.assertNotNull(producer, "producer can not be null");
@@ -2626,7 +2611,7 @@ public final class WebBeansUtil
         if(alternative)
         {
             if(hasInjectionTargetBeanAnnotatedWithAlternative(parent) &&
-                    WebBeansContext.getInstance().getAlternativesManager().isBeanHasAlternative(parent))
+                    webBeansContext.getAlternativesManager().isBeanHasAlternative(parent))
             {
                 producer.setEnabled(true);
             }
@@ -2739,9 +2724,9 @@ public final class WebBeansUtil
         return ((OwbBean) bean).isDependent();
     }
 
-    public static void inspectErrorStack(String logMessage)
+    public void _inspectErrorStack(String logMessage)
     {
-        BeanManagerImpl manager = WebBeansContext.getInstance().getBeanManagerImpl();
+        BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
         //Looks for errors
         ErrorStack stack = manager.getErrorStack();
         try
@@ -2795,14 +2780,13 @@ public final class WebBeansUtil
         return null;
     }
 
-    public static <T> ManagedBean<T> defineAbstractDecorator(ManagedBeanCreatorImpl<T> managedBeanCreator,
-                                                             ProcessInjectionTarget<T> processInjectionTargetEvent)
+    public <T> ManagedBean<T> _defineAbstractDecorator(ManagedBeanCreatorImpl<T> managedBeanCreator, ProcessInjectionTarget<T> processInjectionTargetEvent)
     {
 
-        ManagedBean<T> bean = defineManagedBean(managedBeanCreator, processInjectionTargetEvent);
+        ManagedBean<T> bean = _defineManagedBean(managedBeanCreator, processInjectionTargetEvent);
 
         //X TODO move proxy instance creation into JavassistProxyFactory!
-        Class clazz = WebBeansContext.getInstance().getJavassistProxyFactory().createAbstractDecoratorProxyClass(bean);
+        Class clazz = webBeansContext.getJavassistProxyFactory().createAbstractDecoratorProxyClass(bean);
 
         bean.setConstructor(WebBeansUtil.defineConstructor(clazz));
         bean.setIsAbstractDecorator(true);
@@ -2810,10 +2794,9 @@ public final class WebBeansUtil
     }
 
 
-    public static <T> ManagedBean<T> defineManagedBean(ManagedBeanCreatorImpl<T> managedBeanCreator,
-                                                       ProcessInjectionTarget<T> processInjectionTargetEvent)
+    public <T> ManagedBean<T> _defineManagedBean(ManagedBeanCreatorImpl<T> managedBeanCreator, ProcessInjectionTarget<T> processInjectionTargetEvent)
     {
-        BeanManagerImpl manager = WebBeansContext.getInstance().getBeanManagerImpl();
+        BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
 
         //Annotated type
         AnnotatedType<T> annotatedType = processInjectionTargetEvent.getAnnotatedType();
@@ -2828,7 +2811,7 @@ public final class WebBeansUtil
         managedBeanCreator.defineScopeType(logger.getTokenString(OWBLogConst.TEXT_MB_IMPL) + clazz.getName() +
                 logger.getTokenString(OWBLogConst.TEXT_SAME_SCOPE));
         //Check for Enabled via Alternative
-        WebBeansUtil.setInjectionTargetBeanEnableFlag(managedBean);
+        _setInjectionTargetBeanEnableFlag(managedBean);
 
         managedBeanCreator.defineApiType();
         managedBeanCreator.checkCreateConditions();
@@ -2855,11 +2838,11 @@ public final class WebBeansUtil
 
         for(ProducerMethodBean<?> producerMethod : producerMethods)
         {
-            AnnotatedMethod<?> method = WebBeansContext.getInstance().getAnnotatedElementFactory().newAnnotatedMethod(producerMethod.getCreatorMethod(),
+            AnnotatedMethod<?> method = webBeansContext.getAnnotatedElementFactory().newAnnotatedMethod(producerMethod.getCreatorMethod(),
                                                                                    annotatedType);
-            ProcessProducerImpl<?, ?> producerEvent = WebBeansUtil.fireProcessProducerEventForMethod(producerMethod,
+            ProcessProducerImpl<?, ?> producerEvent = _fireProcessProducerEventForMethod(producerMethod,
                                                                                                     method);
-            WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducer event observers for "
+            _inspectErrorStack("There are errors that are added by ProcessProducer event observers for "
                                            + "ProducerMethods. Look at logs for further details");
 
             annotatedMethods.put(producerMethod, method);
@@ -2873,11 +2856,11 @@ public final class WebBeansUtil
 
         for(ProducerFieldBean<?> producerField : producerFields)
         {
-            AnnotatedField<?> field = WebBeansContext.getInstance().getAnnotatedElementFactory().newAnnotatedField(producerField.getCreatorField(),
+            AnnotatedField<?> field = webBeansContext.getAnnotatedElementFactory().newAnnotatedField(producerField.getCreatorField(),
                                                                                 annotatedType);
-            ProcessProducerImpl<?, ?> producerEvent = WebBeansUtil.fireProcessProducerEventForField(producerField,
+            ProcessProducerImpl<?, ?> producerEvent = _fireProcessProducerEventForField(producerField,
                                                                                                     field);
-            WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducer event observers for"
+            _inspectErrorStack("There are errors that are added by ProcessProducer event observers for"
                                            + " ProducerFields. Look at logs for further details");
 
             annotatedFields.put(producerField, field);
@@ -2892,33 +2875,33 @@ public final class WebBeansUtil
         for(ObserverMethod<?> observerMethod : observerMethods)
         {
             ObserverMethodImpl<?> impl = (ObserverMethodImpl<?>)observerMethod;
-            AnnotatedMethod<?> method = WebBeansContext.getInstance().getAnnotatedElementFactory().newAnnotatedMethod(impl.getObserverMethod(),
+            AnnotatedMethod<?> method = webBeansContext.getAnnotatedElementFactory().newAnnotatedMethod(impl.getObserverMethod(),
                                                                                    annotatedType);
 
             observerMethodsMap.put(observerMethod, method);
         }
 
-        BeanManagerImpl beanManager = WebBeansContext.getInstance().getBeanManagerImpl();
+        BeanManagerImpl beanManager = webBeansContext.getBeanManagerImpl();
 
         //Fires ProcessManagedBean
         ProcessBeanImpl<T> processBeanEvent = new GProcessManagedBean(managedBean,annotatedType);
         beanManager.fireEvent(processBeanEvent, new Annotation[0]);
-        WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessManagedBean event observers for " +
+        _inspectErrorStack("There are errors that are added by ProcessManagedBean event observers for " +
                 "managed beans. Look at logs for further details");
 
         //Fires ProcessProducerMethod
-        WebBeansUtil.fireProcessProducerMethodBeanEvent(annotatedMethods, annotatedType);
-        WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducerMethod event observers for " +
+        _fireProcessProducerMethodBeanEvent(annotatedMethods, annotatedType);
+        _inspectErrorStack("There are errors that are added by ProcessProducerMethod event observers for " +
                 "producer method beans. Look at logs for further details");
 
         //Fires ProcessProducerField
-        WebBeansUtil.fireProcessProducerFieldBeanEvent(annotatedFields);
-        WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessProducerField event observers for " +
+        _fireProcessProducerFieldBeanEvent(annotatedFields);
+        _inspectErrorStack("There are errors that are added by ProcessProducerField event observers for " +
                 "producer field beans. Look at logs for further details");
 
         //Fire ObservableMethods
-        WebBeansUtil.fireProcessObservableMethodBeanEvent(observerMethodsMap);
-        WebBeansUtil.inspectErrorStack("There are errors that are added by ProcessObserverMethod event observers for " +
+        _fireProcessObservableMethodBeanEvent(observerMethodsMap);
+        _inspectErrorStack("There are errors that are added by ProcessObserverMethod event observers for " +
                 "observer methods. Look at logs for further details");
 
         if(!WebBeansAnnotatedTypeUtil.isAnnotatedTypeDecoratorOrInterceptor(annotatedType))
@@ -2941,7 +2924,7 @@ public final class WebBeansUtil
         return managedBean;
     }
 
-    public static <T> ManagedBean<T>  defineManagedBeanWithoutFireEvents(AnnotatedType<T> type)
+    public <T> ManagedBean<T>  _defineManagedBeanWithoutFireEvents(AnnotatedType<T> type)
     {
         Class<T> clazz = type.getJavaClass();
 
@@ -2959,7 +2942,7 @@ public final class WebBeansUtil
         managedBeanCreator.defineScopeType(logger.getTokenString(OWBLogConst.TEXT_MB_IMPL) + clazz.getName() +
                 logger.getTokenString(OWBLogConst.TEXT_SAME_SCOPE));
         //Check for Enabled via Alternative
-        WebBeansUtil.setInjectionTargetBeanEnableFlag(managedBean);
+        _setInjectionTargetBeanEnableFlag(managedBean);
         managedBeanCreator.defineApiType();
         managedBeanCreator.checkCreateConditions();
         managedBeanCreator.defineQualifier();
@@ -2999,7 +2982,7 @@ public final class WebBeansUtil
         return false;
     }
 
-    public static boolean isPassivationCapableDependency(InjectionPoint injectionPoint)
+    public boolean _isPassivationCapableDependency(InjectionPoint injectionPoint)
     {
         Bean<?> bean = InjectionResolver.getInstance().getInjectionPointBean(injectionPoint);
         if((bean instanceof EnterpriseBeanMarker) ||
@@ -3013,7 +2996,7 @@ public final class WebBeansUtil
             return true;
         }
 
-        else if(WebBeansContext.getInstance().getBeanManagerImpl().isNormalScope(bean.getScope()))
+        else if(webBeansContext.getBeanManagerImpl().isNormalScope(bean.getScope()))
         {
             return true;
         }
@@ -3036,7 +3019,7 @@ public final class WebBeansUtil
 
         throw new RuntimeException(e);
     }
-    
+
     public static void initProxyFactoryClassLoaderProvider()
     {
         ProxyFactory.classLoaderProvider = new ProxyFactory.ClassLoaderProvider()
@@ -3048,5 +3031,5 @@ public final class WebBeansUtil
             }
 
         };
-    } 
+    }
 }