openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1084537 - in /openwebbeans/trunk: webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/ webbeans-impl/src/main/java/org/apache/webbeans/component/ webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ webbeans-impl/...
Date Wed, 23 Mar 2011 11:10:32 GMT
Author: struberg
Date: Wed Mar 23 11:10:30 2011
New Revision: 1084537

URL: http://svn.apache.org/viewvc?rev=1084537&view=rev
Log:
OWB-545 drop a few more SecurityUtil calls

Modified:
    openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbDefinitionUtility.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansAnnotatedTypeUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java

Modified: openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbDefinitionUtility.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbDefinitionUtility.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbDefinitionUtility.java (original)
+++ openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/util/EjbDefinitionUtility.java Wed Mar 23 11:10:30 2011
@@ -78,7 +78,7 @@ public final class EjbDefinitionUtility
                 clazz = bean.getWebBeansContext().getJavassistProxyFactory().defineEjbBeanProxyClass(bean, iface, factory);
             }
             
-            proxyInstance = (T) ClassUtil.newInstance(clazz);
+            proxyInstance = (T) ClassUtil.newInstance(bean.getWebBeansContext(), clazz);
             
             EjbBeanProxyHandler handler = new EjbBeanProxyHandler(bean, creationalContext);
             ((ProxyObject)proxyInstance).setHandler(handler);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/AbstractInjectionTargetBean.java Wed Mar 23 11:10:30 2011
@@ -51,7 +51,6 @@ import org.apache.webbeans.intercept.Inv
 import org.apache.webbeans.intercept.webbeans.WebBeansInterceptor;
 import org.apache.webbeans.proxy.JavassistProxyFactory;
 import org.apache.webbeans.spi.ResourceInjectionService;
-import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 
 /**
@@ -329,12 +328,33 @@ public abstract class AbstractInjectionT
                     Object reference = getManager().getReference(injectionPointBean, InjectionPoint.class,
                                              getManager().createCreationalContext(injectionPointBean));
                     
-                    ClassUtil.setField(instance, field, reference);
+                    setField(instance, field, reference);
                 }
             }
         }                
     }
-    
+
+    private void setField(T instance, Field field, Object value)
+    {
+        if(!field.isAccessible())
+        {
+            getWebBeansContext().getSecurityService().doPrivilegedSetAccessible(field, true);
+        }
+
+        try
+        {
+            field.set(instance, value);
+        }
+        catch (IllegalArgumentException e)
+        {
+            throw new WebBeansException(e);
+        }
+        catch (IllegalAccessException e)
+        {
+            throw new WebBeansException(e);
+        }
+    }
+
     public void injectSuperFields(T instance, CreationalContext<T> creationalContext)
     {
         Set<Field> fields = getInjectedFromSuperFields();

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractBeanCreator.java Wed Mar 23 11:10:30 2011
@@ -52,6 +52,8 @@ public class AbstractBeanCreator<T> impl
      * to define bean instance instead of using class artifacts.
      */
     private AnnotatedType<T> annotatedType;
+
+    private final DefinitionUtil definitionUtil;
     
     /**
      * Creates a bean instance.
@@ -62,7 +64,8 @@ public class AbstractBeanCreator<T> impl
     public AbstractBeanCreator(AbstractOwbBean<T> bean, Annotation[] beanAnnotations)
     {
         this.bean = bean;
-        this.beanAnnotations = beanAnnotations;           
+        this.beanAnnotations = beanAnnotations;
+        this.definitionUtil = bean.getWebBeansContext().getDefinitionUtil();
     }
 
     /**
@@ -99,11 +102,11 @@ public class AbstractBeanCreator<T> impl
     {
         if(isDefaultMetaDataProvider())
         {
-            DefinitionUtil.defineQualifiers(this.bean, this.beanAnnotations);
+            definitionUtil.defineQualifiers(this.bean, this.beanAnnotations);
         }
         else
         {
-            DefinitionUtil.defineQualifiers(this.bean, AnnotationUtil.getAnnotationsFromSet(this.annotatedType.getAnnotations()));
+            definitionUtil.defineQualifiers(this.bean, AnnotationUtil.getAnnotationsFromSet(this.annotatedType.getAnnotations()));
         }
         
     }
@@ -116,11 +119,11 @@ public class AbstractBeanCreator<T> impl
     {
         if(isDefaultMetaDataProvider())
         {
-            DefinitionUtil.defineName(this.bean, this.beanAnnotations, defaultName);
+            definitionUtil.defineName(this.bean, this.beanAnnotations, defaultName);
         }
         else
         {
-            DefinitionUtil.defineName(this.bean, AnnotationUtil.getAnnotationsFromSet(this.annotatedType.getAnnotations()), 
+            definitionUtil.defineName(this.bean, AnnotationUtil.getAnnotationsFromSet(this.annotatedType.getAnnotations()),
                     WebBeansUtil.getManagedBeanDefaultName(annotatedType.getJavaClass().getSimpleName()));
         }
         
@@ -134,11 +137,11 @@ public class AbstractBeanCreator<T> impl
     {
         if(isDefaultMetaDataProvider())
         {
-            DefinitionUtil.defineScopeType(this.bean, this.beanAnnotations, errorMessage, allowLazyInit);
+            definitionUtil.defineScopeType(this.bean, this.beanAnnotations, errorMessage, allowLazyInit);
         }
         else
         {
-            DefinitionUtil.defineScopeType(this.bean, AnnotationUtil.getAnnotationsFromSet(this.annotatedType.getAnnotations()), errorMessage, false);
+            definitionUtil.defineScopeType(this.bean, AnnotationUtil.getAnnotationsFromSet(this.annotatedType.getAnnotations()), errorMessage, false);
         }
     }
 
@@ -148,7 +151,7 @@ public class AbstractBeanCreator<T> impl
     @Override
     public void defineSerializable()
     {
-        DefinitionUtil.defineSerializable(this.bean);        
+        definitionUtil.defineSerializable(this.bean);
     }
 
     /**
@@ -159,11 +162,11 @@ public class AbstractBeanCreator<T> impl
     {
         if(isDefaultMetaDataProvider())
         {
-            DefinitionUtil.defineStereoTypes(this.bean, this.beanAnnotations);
+            definitionUtil.defineStereoTypes(this.bean, this.beanAnnotations);
         }
         else
         {
-            DefinitionUtil.defineStereoTypes(this.bean, AnnotationUtil.getAnnotationsFromSet(this.annotatedType.getAnnotations()));
+            definitionUtil.defineStereoTypes(this.bean, AnnotationUtil.getAnnotationsFromSet(this.annotatedType.getAnnotations()));
         }
         
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AbstractInjectedTargetBeanCreator.java Wed Mar 23 11:10:30 2011
@@ -25,7 +25,6 @@ import javax.enterprise.inject.spi.Obser
 import org.apache.webbeans.component.AbstractInjectionTargetBean;
 import org.apache.webbeans.component.ProducerFieldBean;
 import org.apache.webbeans.component.ProducerMethodBean;
-import org.apache.webbeans.config.DefinitionUtil;
 import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
 
 /**
@@ -54,13 +53,15 @@ public abstract class AbstractInjectedTa
     @Override
     public void defineDisposalMethods()
     {
+        AbstractInjectionTargetBean bean = getBean();
         if(isDefaultMetaDataProvider())
         {
-            DefinitionUtil.defineDisposalMethods(getBean());   
+
+            bean.getWebBeansContext().getDefinitionUtil().defineDisposalMethods(getBean());
         }
         else
         {
-            WebBeansAnnotatedTypeUtil.defineDisposalMethods(getBean(), getAnnotatedType());
+            bean.getWebBeansContext().getAnnotatedTypeUtil().defineDisposalMethods(getBean(), getAnnotatedType());
         }
         
     }
@@ -71,13 +72,14 @@ public abstract class AbstractInjectedTa
     @Override
     public void defineInjectedFields()
     {
+        AbstractInjectionTargetBean bean = getBean();
         if(isDefaultMetaDataProvider())
         {
-            DefinitionUtil.defineInjectedFields(getBean());   
+            bean.getWebBeansContext().getDefinitionUtil().defineInjectedFields(bean);
         }
         else
         {
-            WebBeansAnnotatedTypeUtil.defineInjectedFields(getBean(), getAnnotatedType());
+            WebBeansAnnotatedTypeUtil.defineInjectedFields(bean, getAnnotatedType());
         }
         
     }
@@ -88,13 +90,14 @@ public abstract class AbstractInjectedTa
     @Override
     public void defineInjectedMethods()
     {
+        AbstractInjectionTargetBean bean = getBean();
         if(isDefaultMetaDataProvider())
         {
-            DefinitionUtil.defineInjectedMethods(getBean());
+            bean.getWebBeansContext().getDefinitionUtil().defineInjectedMethods(bean);
         }
         else
         {
-            WebBeansAnnotatedTypeUtil.defineInjectedMethods(getBean(), getAnnotatedType());
+            bean.getWebBeansContext().getAnnotatedTypeUtil().defineInjectedMethods(bean, getAnnotatedType());
         }
         
     }
@@ -105,13 +108,14 @@ public abstract class AbstractInjectedTa
     @Override
     public Set<ObserverMethod<?>> defineObserverMethods()
     {   
+        AbstractInjectionTargetBean bean = getBean();
         if(isDefaultMetaDataProvider())
         {
-            return DefinitionUtil.defineObserverMethods(getBean(), getBean().getReturnType());
+            return bean.getWebBeansContext().getDefinitionUtil().defineObserverMethods(bean, bean.getReturnType());
         }
         else
         {
-            return WebBeansAnnotatedTypeUtil.defineObserverMethods(getBean(), getAnnotatedType());
+            return bean.getWebBeansContext().getAnnotatedTypeUtil().defineObserverMethods(bean, getAnnotatedType());
         }
     }
 
@@ -121,13 +125,14 @@ public abstract class AbstractInjectedTa
     @Override
     public Set<ProducerFieldBean<?>> defineProducerFields()
     {
+        AbstractInjectionTargetBean bean = getBean();
         if(isDefaultMetaDataProvider())
         {
-            return DefinitionUtil.defineProduerFields(getBean());
+            return bean.getWebBeansContext().getDefinitionUtil().defineProduerFields(bean);
         }
         else
         {
-            return WebBeansAnnotatedTypeUtil.defineProducerFields(getBean(), getAnnotatedType());
+            return bean.getWebBeansContext().getAnnotatedTypeUtil().defineProducerFields(bean, getAnnotatedType());
         }
     }
 
@@ -137,13 +142,14 @@ public abstract class AbstractInjectedTa
     @Override
     public Set<ProducerMethodBean<?>> defineProducerMethods()
     {
+        AbstractInjectionTargetBean bean = getBean();
         if(isDefaultMetaDataProvider())
         {
-            return DefinitionUtil.defineProducerMethods(getBean());
+            return bean.getWebBeansContext().getDefinitionUtil().defineProducerMethods(bean);
         }
         else
         {
-            return WebBeansAnnotatedTypeUtil.defineProducerMethods(getBean(), getAnnotatedType());
+            return bean.getWebBeansContext().getAnnotatedTypeUtil().defineProducerMethods(bean, getAnnotatedType());
         }
     }
     

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/AnnotatedTypeBeanCreatorImpl.java Wed Mar 23 11:10:30 2011
@@ -46,9 +46,10 @@ public class AnnotatedTypeBeanCreatorImp
         Constructor<T> constructor;
         try
         {
-            AnnotatedConstructor<T> annotated = WebBeansAnnotatedTypeUtil.getBeanConstructor(getAnnotatedType());
+            WebBeansAnnotatedTypeUtil annotatedTypeUtil = getBean().getWebBeansContext().getAnnotatedTypeUtil();
+            AnnotatedConstructor<T> annotated = annotatedTypeUtil.getBeanConstructor(getAnnotatedType());
             constructor = annotated.getJavaMember();
-            WebBeansAnnotatedTypeUtil.addConstructorInjectionPointMetaData(getBean(), annotated);
+            annotatedTypeUtil.addConstructorInjectionPointMetaData(getBean(), annotated);
             
             getBean().setConstructor(constructor);
             

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ManagedBeanCreatorImpl.java Wed Mar 23 11:10:30 2011
@@ -23,7 +23,6 @@ import java.lang.reflect.Constructor;
 import javax.enterprise.inject.spi.AnnotatedConstructor;
 
 import org.apache.webbeans.component.ManagedBean;
-import org.apache.webbeans.config.DefinitionUtil;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
 import org.apache.webbeans.util.WebBeansUtil;
@@ -82,13 +81,13 @@ public class ManagedBeanCreatorImpl<T> e
         if(isDefaultMetaDataProvider())
         {
             constructor = webBeansContext.getWebBeansUtil().defineConstructor(getBean().getReturnType());
-            DefinitionUtil.addConstructorInjectionPointMetaData(getBean(), constructor);
+            webBeansContext.getDefinitionUtil().addConstructorInjectionPointMetaData(getBean(), constructor);
         }
         else
         {
            AnnotatedConstructor<T> annotated = WebBeansAnnotatedTypeUtil.getBeanConstructor(getAnnotatedType());
            constructor = annotated.getJavaMember();
-           WebBeansAnnotatedTypeUtil.addConstructorInjectionPointMetaData(getBean(), annotated);
+           webBeansContext.getAnnotatedTypeUtil().addConstructorInjectionPointMetaData(getBean(), annotated);
         }
         
         getBean().setConstructor(constructor);

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java Wed Mar 23 11:10:30 2011
@@ -241,7 +241,7 @@ public class BeansDeployer
         Class<?> beanClass = ClassUtil.getClassFromName(className);
         if(beanClass != null)
         {
-            bean  = (Bean)ClassUtil.newInstance(beanClass);
+            bean  = (Bean)ClassUtil.newInstance(webBeansContext, beanClass);
         }
         
         if(bean != null)
@@ -363,7 +363,7 @@ public class BeansDeployer
                             !(bean instanceof javax.enterprise.inject.spi.Interceptor) &&
                             !(bean instanceof NewBean))
                     {
-                        DefinitionUtil.defineDecoratorStack((AbstractInjectionTargetBean<Object>)bean);   
+                        webBeansContext.getDefinitionUtil().defineDecoratorStack((AbstractInjectionTargetBean<Object>)bean);
                     }
                     
                     //If intercepted marker

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/DefinitionUtil.java Wed Mar 23 11:10:30 2011
@@ -76,7 +76,6 @@ import org.apache.webbeans.spi.api.Resou
 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;
 import static org.apache.webbeans.util.InjectionExceptionUtils.throwUnsatisfiedResolutionException;
 
@@ -217,7 +216,7 @@ public final class DefinitionUtil
      * @param component configuring web beans component
      * @param annotations annotations
      */
-    public static <T> void defineQualifiers(AbstractOwbBean<T> component, Annotation[] annotations)
+    public <T> void defineQualifiers(AbstractOwbBean<T> component, Annotation[] annotations)
     {
         final AnnotationManager annotationManager = component.getWebBeansContext().getAnnotationManager();
 
@@ -227,7 +226,7 @@ public final class DefinitionUtil
 
             if (annotationManager.isQualifierAnnotation(type))
             {
-                Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(type);
+                Method[] methods = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethods(type);
 
                 for (Method method : methods)
                 {
@@ -627,7 +626,7 @@ public final class DefinitionUtil
      * @param component configuring web beans component
      * @param defaultName default name of the web bean
      */
-    public static <T> void defineName(AbstractOwbBean<T> component, Annotation[] anns, String defaultName)
+    public <T> void defineName(AbstractOwbBean<T> component, Annotation[] anns, String defaultName)
     {
         Named nameAnnot = null;
         boolean isDefault = false;
@@ -676,16 +675,16 @@ public final class DefinitionUtil
      * @param component producer field owner component
      * @return the set of producer field components
      */
-    public static Set<ProducerFieldBean<?>> defineProduerFields(InjectionTargetBean<?> component)
+    public Set<ProducerFieldBean<?>> defineProduerFields(InjectionTargetBean<?> component)
     {
         Set<ProducerFieldBean<?>> producerFields = new HashSet<ProducerFieldBean<?>>();
-        Field[] fields = SecurityUtil.doPrivilegedGetDeclaredFields(component.getReturnType());
+        Field[] fields = webBeansContext.getSecurityService().doPrivilegedGetDeclaredFields(component.getReturnType());
         createProducerField(component, producerFields, fields);
 
         return producerFields;
     }
 
-    private static void createProducerField(InjectionTargetBean<?> component, Set<ProducerFieldBean<?>> producerFields, Field[] fields)
+    private void createProducerField(InjectionTargetBean<?> component, Set<ProducerFieldBean<?>> producerFields, Field[] fields)
     {
         for (Field field : fields)
         {        
@@ -723,14 +722,14 @@ public final class DefinitionUtil
      * @return the set of producer components
      * @throws WebBeansConfigurationException if any exception occurs
      */
-    public static Set<ProducerMethodBean<?>> defineProducerMethods(AbstractInjectionTargetBean<?> component)
+    public Set<ProducerMethodBean<?>> defineProducerMethods(AbstractInjectionTargetBean<?> component)
     {
         Asserts.assertNotNull(component, "component parameter can not be null");
 
         Set<ProducerMethodBean<?>> producerComponents = new HashSet<ProducerMethodBean<?>>();
 
         Class<?> clazz = component.getReturnType();
-        Method[] declaredMethods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
+        Method[] declaredMethods = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethods(clazz);
 
         // This methods defined in the class
         for (Method declaredMethod : declaredMethods)
@@ -741,7 +740,7 @@ public final class DefinitionUtil
         return producerComponents;
     }
 
-    private static <T> void createProducerComponents(InjectionTargetBean<T> component, Set<ProducerMethodBean<?>> producerComponents,
+    private <T> void createProducerComponents(InjectionTargetBean<T> component, Set<ProducerMethodBean<?>> producerComponents,
                                                      Method declaredMethod, Class<?> clazz)
     {
         boolean isSpecializes = false;
@@ -773,7 +772,7 @@ public final class DefinitionUtil
 
     }
 
-    public static <T> ProducerMethodBean<T> createProducerComponent(Class<T> returnType, Method method, InjectionTargetBean<?> parent,
+    public <T> ProducerMethodBean<T> createProducerComponent(Class<T> returnType, Method method, InjectionTargetBean<?> parent,
                                                                     boolean isSpecializes)
     {
         ProducerMethodBean<T> component = new ProducerMethodBean<T>(parent, returnType);
@@ -797,18 +796,18 @@ public final class DefinitionUtil
         WebBeansContext webBeansContext = parent.getWebBeansContext();
         webBeansContext.getWebBeansUtil().setBeanEnableFlagForProducerBean(parent, component, methodAnns);
 
-        DefinitionUtil.defineProducerMethodApiTypes(component, method.getGenericReturnType(), methodAnns);
-        DefinitionUtil.defineScopeType(component, methodAnns, "WebBeans producer method : " + method.getName() + " in class " + parent.getReturnType().getName()
+        defineProducerMethodApiTypes(component, method.getGenericReturnType(), methodAnns);
+        defineScopeType(component, methodAnns, "WebBeans producer method : " + method.getName() + " in class " + parent.getReturnType().getName()
                                                               + " must declare default @Scope annotation", false);
         webBeansContext.getWebBeansUtil().checkUnproxiableApiType(component, component.getScope());
         WebBeansUtil.checkProducerGenericType(component,method);
-        DefinitionUtil.defineQualifiers(component, methodAnns);
-        DefinitionUtil.defineName(component, methodAnns, WebBeansUtil.getProducerDefaultName(method.getName()));
+        defineQualifiers(component, methodAnns);
+        defineName(component, methodAnns, WebBeansUtil.getProducerDefaultName(method.getName()));
 
         return component;
     }
 
-    private static <T> ProducerFieldBean<T> createProducerFieldComponent(Class<T> returnType, Field field, InjectionTargetBean<?> parent)
+    private <T> ProducerFieldBean<T> createProducerFieldComponent(Class<T> returnType, Field field, InjectionTargetBean<?> parent)
     {
         ProducerFieldBean<T> component = new ProducerFieldBean<T>(parent, returnType);
         
@@ -859,13 +858,13 @@ public final class DefinitionUtil
                                                              + " must declare default @Scope annotation", false);
         webBeansContext.getWebBeansUtil().checkUnproxiableApiType(component, component.getScope());
         WebBeansUtil.checkProducerGenericType(component,field);
-        DefinitionUtil.defineQualifiers(component, fieldAnns);
-        DefinitionUtil.defineName(component, fieldAnns, field.getName());
+        defineQualifiers(component, fieldAnns);
+        defineName(component, fieldAnns, field.getName());
 
         return component;
     }
 
-    public static <T> void defineDisposalMethods(AbstractOwbBean<T> component)
+    public <T> void defineDisposalMethods(AbstractOwbBean<T> component)
     {
         Class<?> clazz = component.getReturnType();
 
@@ -876,7 +875,7 @@ public final class DefinitionUtil
 
     }
 
-    private static <T> void createDisposalMethods(AbstractOwbBean<T> component, Method[] methods, Class<?> clazz)
+    private <T> void createDisposalMethods(AbstractOwbBean<T> component, Method[] methods, Class<?> clazz)
     {
         final AnnotationManager annotationManager = component.getWebBeansContext().getAnnotationManager();
 
@@ -939,7 +938,7 @@ public final class DefinitionUtil
         }
     }
 
-    public static <T> void defineInjectedFields(AbstractInjectionTargetBean<T> component)
+    public <T> void defineInjectedFields(AbstractInjectionTargetBean<T> component)
     {
         Class<T> clazz = component.getReturnType();
 
@@ -951,7 +950,7 @@ public final class DefinitionUtil
 
     }
 
-    public static <T> void defineInternalInjectedFieldsRecursively(AbstractInjectionTargetBean<T> component, Class<T> clazz)
+    public <T> void defineInternalInjectedFieldsRecursively(AbstractInjectionTargetBean<T> component, Class<T> clazz)
     {
         // From inheritance
         Class<?> superClazz = clazz.getSuperclass();
@@ -967,13 +966,13 @@ public final class DefinitionUtil
 
     }
 
-    public static <T> void defineInternalInjectedFields(AbstractInjectionTargetBean<T> component, Class<T> clazz, boolean fromSuperClazz)
+    public <T> void defineInternalInjectedFields(AbstractInjectionTargetBean<T> component, Class<T> clazz, boolean fromSuperClazz)
     {
 
         WebBeansContext webBeansContext = component.getWebBeansContext();
         final AnnotationManager annotationManager = webBeansContext.getAnnotationManager();
 
-        Field[] fields = SecurityUtil.doPrivilegedGetDeclaredFields(clazz);
+        Field[] fields = webBeansContext.getSecurityService().doPrivilegedGetDeclaredFields(clazz);
 
         if (fields.length != 0)
         {
@@ -1031,7 +1030,7 @@ public final class DefinitionUtil
         }
     }
 
-    public static <T> void defineInjectedMethods(AbstractInjectionTargetBean<T> bean)
+    public <T> void defineInjectedMethods(AbstractInjectionTargetBean<T> bean)
     {
         Asserts.assertNotNull(bean, "bean parameter can not be null");
 
@@ -1044,7 +1043,7 @@ public final class DefinitionUtil
         defineInternalInjectedMethodsRecursively(bean, clazz);
     }
 
-    public static <T> void defineInternalInjectedMethodsRecursively(AbstractInjectionTargetBean<T> component, Class<T> clazz)
+    public <T> void defineInternalInjectedMethodsRecursively(AbstractInjectionTargetBean<T> component, Class<T> clazz)
     {
         // From inheritance
         Class<?> superClazz = clazz.getSuperclass();
@@ -1059,10 +1058,10 @@ public final class DefinitionUtil
 
     }
 
-    private static <T> void defineInternalInjectedMethods(AbstractInjectionTargetBean<T> component, Class<T> clazz, boolean fromInherited)
+    private <T> void defineInternalInjectedMethods(AbstractInjectionTargetBean<T> component, Class<T> clazz, boolean fromInherited)
     {
 
-        Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
+        Method[] methods = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethods(clazz);
         
         for (Method method : methods)
         {
@@ -1092,7 +1091,7 @@ public final class DefinitionUtil
                 }
                 else
                 {                    
-                    Method[] beanMethods = SecurityUtil.doPrivilegedGetDeclaredMethods(component.getReturnType());
+                    Method[] beanMethods = webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethods(component.getReturnType());
                     boolean defined = false;
                     for (Method beanMethod : beanMethods)
                     {
@@ -1192,12 +1191,12 @@ public final class DefinitionUtil
      * Defines decorator stack of given bean.
      * @param bean injection target bean
      */
-    public static void defineDecoratorStack(AbstractInjectionTargetBean<?> bean)
+    public void defineDecoratorStack(AbstractInjectionTargetBean<?> bean)
     {
         WebBeansDecoratorConfig.configureDecarotors(bean);
     }
 
-    public static <T> Set<ObserverMethod<?>> defineObserverMethods(InjectionTargetBean<T> component, Class<T> clazz)
+    public <T> Set<ObserverMethod<?>> defineObserverMethods(InjectionTargetBean<T> component, Class<T> clazz)
     {
         Asserts.assertNotNull(component, "component parameter can not be null");
         Asserts.nullCheckForClass(clazz);
@@ -1213,7 +1212,7 @@ public final class DefinitionUtil
 
     }
 
-    private static <T> void createObserverMethods(InjectionTargetBean<T> component, Class<?> clazz, Method[] candidateMethods)
+    private <T> void createObserverMethods(InjectionTargetBean<T> component, Class<?> clazz, Method[] candidateMethods)
     {
 
         for (Method candidateMethod : candidateMethods)
@@ -1238,7 +1237,7 @@ public final class DefinitionUtil
 
     }
 
-    public static <T> void defineSerializable(AbstractOwbBean<T> component)
+    public <T> void defineSerializable(AbstractOwbBean<T> component)
     {
         Asserts.assertNotNull(component, "component parameter can not be null");
         if (ClassUtil.isClassAssignable(Serializable.class, component.getReturnType()))
@@ -1247,7 +1246,7 @@ public final class DefinitionUtil
         }
     }
 
-    public static <T> void addFieldInjectionPointMetaData(AbstractOwbBean<T> owner, Field field)
+    public <T> void addFieldInjectionPointMetaData(AbstractOwbBean<T> owner, Field field)
     {
         InjectionPoint injectionPoint = owner.getWebBeansContext().getInjectionPointFactory().getFieldInjectionPointData(owner, field);
         if (injectionPoint != null)
@@ -1257,7 +1256,7 @@ public final class DefinitionUtil
         }
     }
 
-    public static <T> void addMethodInjectionPointMetaData(AbstractOwbBean<T> owner, Method method)
+    public <T> void addMethodInjectionPointMetaData(AbstractOwbBean<T> owner, Method method)
     {
         List<InjectionPoint> injectionPoints = owner.getWebBeansContext().getInjectionPointFactory().getMethodInjectionPointData(owner, method);
         for (InjectionPoint injectionPoint : injectionPoints)
@@ -1267,7 +1266,7 @@ public final class DefinitionUtil
         }
     }
 
-    public static <T> void addConstructorInjectionPointMetaData(AbstractOwbBean<T> owner, Constructor<T> constructor)
+    public <T> void addConstructorInjectionPointMetaData(AbstractOwbBean<T> owner, Constructor<T> constructor)
     {
         List<InjectionPoint> injectionPoints = owner.getWebBeansContext().getInjectionPointFactory().getConstructorInjectionPointData(owner, constructor);
         for (InjectionPoint injectionPoint : injectionPoints)
@@ -1277,7 +1276,7 @@ public final class DefinitionUtil
         }
     }
     
-    public static void addImplicitComponentForInjectionPoint(InjectionPoint injectionPoint)
+    public void addImplicitComponentForInjectionPoint(InjectionPoint injectionPoint)
     {
         if(!WebBeansUtil.checkObtainsInjectionPointConditions(injectionPoint))
         {
@@ -1285,7 +1284,7 @@ public final class DefinitionUtil
         }        
     }
     
-    public static <X> Set<ProducerMethodBean<?>> defineProducerMethods(InjectionTargetBean<X> bean, AnnotatedType<X> annotatedType)
+    public <X> Set<ProducerMethodBean<?>> defineProducerMethods(InjectionTargetBean<X> bean, AnnotatedType<X> annotatedType)
     {
         Set<ProducerMethodBean<?>> producerComponents = new HashSet<ProducerMethodBean<?>>();
         Set<AnnotatedMethod<? super X>> annotatedMethods = annotatedType.getMethods();
@@ -1298,7 +1297,7 @@ public final class DefinitionUtil
         return producerComponents;
     }
     
-    private static <X> void createProducerBeansFromAnnotatedType(InjectionTargetBean<X> bean, Set<ProducerMethodBean<?>> producerComponents,
+    private <X> void createProducerBeansFromAnnotatedType(InjectionTargetBean<X> bean, Set<ProducerMethodBean<?>> producerComponents,
                                                                  AnnotatedMethod<X> annotatedMethod, Class<?> clazz, boolean isSpecializes)
     {
         Set<Annotation> annSet = annotatedMethod.getAnnotations();
@@ -1345,7 +1344,7 @@ public final class DefinitionUtil
 
     }
 
-    public static <X> ProducerMethodBean<X> createProducerBeanFromAnnotatedType(Class<X> returnType, AnnotatedMethod<X> method,
+    public <X> ProducerMethodBean<X> createProducerBeanFromAnnotatedType(Class<X> returnType, AnnotatedMethod<X> method,
                                                                                 InjectionTargetBean<?> parent, boolean isSpecializes)
     {
         ProducerMethodBean<X> bean = new ProducerMethodBean<X>(parent, returnType);
@@ -1371,8 +1370,8 @@ public final class DefinitionUtil
         DefinitionUtil.defineScopeType(bean, anns, "Bean producer method : " + method.getJavaMember().getName() + " in class "
                                                    + parent.getReturnType().getName() + " must declare default @Scope annotation", false);
         WebBeansUtil.checkProducerGenericType(bean,method.getJavaMember());        
-        DefinitionUtil.defineQualifiers(bean, anns);
-        DefinitionUtil.defineName(bean, anns, WebBeansUtil.getProducerDefaultName(method.getJavaMember().getName()));
+        defineQualifiers(bean, anns);
+        defineName(bean, anns, WebBeansUtil.getProducerDefaultName(method.getJavaMember().getName()));
 
         return bean;
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/ManagedBeanConfigurator.java Wed Mar 23 11:10:30 2011
@@ -111,6 +111,8 @@ public final class ManagedBeanConfigurat
     public <T> ManagedBean<T> define(Class<T> clazz, WebBeansType type) throws WebBeansConfigurationException
     {
         BeanManagerImpl manager = webBeansContext.getBeanManagerImpl();
+        DefinitionUtil definitionUtil = webBeansContext.getDefinitionUtil();
+
 
         int modifier = clazz.getModifiers();
 
@@ -135,29 +137,29 @@ public final class ManagedBeanConfigurat
 
         webBeansContext.getWebBeansUtil().setInjectionTargetBeanEnableFlag(component);
 
-        DefinitionUtil.defineSerializable(component);
-        DefinitionUtil.defineStereoTypes(component, clazz.getDeclaredAnnotations());
+        definitionUtil.defineSerializable(component);
+        definitionUtil.defineStereoTypes(component, clazz.getDeclaredAnnotations());
 
         Annotation[] clazzAnns = clazz.getDeclaredAnnotations();
 
-        DefinitionUtil.defineApiTypes(component, clazz);
-        DefinitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean Component implementation class : " + clazz.getName()
+        definitionUtil.defineApiTypes(component, clazz);
+        definitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean Component implementation class : " + clazz.getName()
                                                              + " stereotypes must declare same @Scope annotations", false);
         // we fully initialize the bean in this case.
         component.setFullInit(true);
 
         WebBeansUtil.checkGenericType(component);
-        DefinitionUtil.defineQualifiers(component, clazzAnns);
-        DefinitionUtil.defineName(component, clazzAnns, WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
+        definitionUtil.defineQualifiers(component, clazzAnns);
+        definitionUtil.defineName(component, clazzAnns, WebBeansUtil.getManagedBeanDefaultName(clazz.getSimpleName()));
 
         Constructor<T> constructor = webBeansContext.getWebBeansUtil().defineConstructor(clazz);
         component.setConstructor(constructor);
-        DefinitionUtil.addConstructorInjectionPointMetaData(component, constructor);
+        definitionUtil.addConstructorInjectionPointMetaData(component, constructor);
 
         //Dropped from the speicification
         //WebBeansUtil.checkSteroTypeRequirements(component, clazz.getDeclaredAnnotations(), "Simple WebBean Component implementation class : " + clazz.getName());
 
-        Set<ProducerMethodBean<?>> producerMethods = DefinitionUtil.defineProducerMethods(component);
+        Set<ProducerMethodBean<?>> producerMethods = definitionUtil.defineProducerMethods(component);
         for (ProducerMethodBean<?> producerMethod : producerMethods)
         {
             // add them one after the other to enable serialization handling et al
@@ -165,7 +167,7 @@ public final class ManagedBeanConfigurat
             manager.putInjectionTargetWrapper(producerMethod, new InjectionTargetWrapper(new ProducerBeansProducer(producerMethod)));
         }
 
-        Set<ProducerFieldBean<?>> producerFields = DefinitionUtil.defineProduerFields(component);
+        Set<ProducerFieldBean<?>> producerFields = definitionUtil.defineProduerFields(component);
         for (ProducerFieldBean<?> producerField : producerFields)
         {
             // add them one after the other to enable serialization handling et al
@@ -174,10 +176,10 @@ public final class ManagedBeanConfigurat
         }
 
 
-        DefinitionUtil.defineDisposalMethods(component);
-        DefinitionUtil.defineInjectedFields(component);
-        DefinitionUtil.defineInjectedMethods(component);
-        DefinitionUtil.defineObserverMethods(component, clazz);
+        definitionUtil.defineDisposalMethods(component);
+        definitionUtil.defineInjectedFields(component);
+        definitionUtil.defineInjectedMethods(component);
+        definitionUtil.defineObserverMethods(component, clazz);
 
         return component;
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/WebBeansContext.java Wed Mar 23 11:10:30 2011
@@ -53,6 +53,7 @@ import org.apache.webbeans.spi.ScannerSe
 import org.apache.webbeans.spi.SecurityService;
 import org.apache.webbeans.spi.plugins.OpenWebBeansPlugin;
 import org.apache.webbeans.util.ClassUtil;
+import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
 import org.apache.webbeans.util.WebBeansUtil;
 
 /**
@@ -87,6 +88,7 @@ public class WebBeansContext
     private InjectionPointFactory injectionPointFactory = new InjectionPointFactory(this);
     private InterceptorUtil interceptorUtil = new InterceptorUtil(this);
     private DefinitionUtil definitionUtil = new DefinitionUtil(this);
+    private WebBeansAnnotatedTypeUtil annotatedTypeUtil = new WebBeansAnnotatedTypeUtil(this);
     private ManagedBeanConfigurator managedBeanConfigurator = new ManagedBeanConfigurator(this);
     private SecurityService securityService = getService(SecurityService.class);
 
@@ -193,6 +195,11 @@ public class WebBeansContext
         return definitionUtil;
     }
 
+    public WebBeansAnnotatedTypeUtil getAnnotatedTypeUtil()
+    {
+        return annotatedTypeUtil;
+    }
+
     public InjectionPointFactory getInjectionPointFactory()
     {
         return injectionPointFactory;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/WebBeansDecorator.java Wed Mar 23 11:10:30 2011
@@ -189,7 +189,7 @@ public class WebBeansDecorator<T> extend
         }
         else
         {
-            Field[] fields = ClassUtil.getFieldsWithType(returnType, delegateType);
+            Field[] fields = ClassUtil.getFieldsWithType(wrappedBean.getWebBeansContext(), returnType, delegateType);
             if(fields.length == 0)
             {
                 throw new WebBeansConfigurationException("Delegate injection field is not found for decorator : " + toString());

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java Wed Mar 23 11:10:30 2011
@@ -43,6 +43,7 @@ import org.apache.webbeans.config.WebBea
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.container.InjectionResolver;
 import org.apache.webbeans.context.creational.CreationalContextImpl;
+import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.util.ClassUtil;
 import org.apache.webbeans.util.WebBeansAnnotatedTypeUtil;
 import org.apache.webbeans.util.WebBeansUtil;
@@ -146,7 +147,7 @@ public final class OWBInjector implement
                         
                         //Set field
                         Field field = (Field)injectionPoint.getMember();
-                        ClassUtil.setField(javaEeComponentInstance, field, object);
+                        setField(javaEeComponentInstance, field, object);
                     }                        
                 }
                 
@@ -162,7 +163,8 @@ public final class OWBInjector implement
         
         return null;
     }
-    
+
+
     /**
      * Release dependents.
      */
@@ -189,7 +191,28 @@ public final class OWBInjector implement
             }            
         }        
     }
-    
+
+    private void setField(Object instance, Field field, Object value)
+    {
+        if(!field.isAccessible())
+        {
+            webBeansContext.getSecurityService().doPrivilegedSetAccessible(field, true);
+        }
+
+        try
+        {
+            field.set(instance, value);
+        }
+        catch (IllegalArgumentException e)
+        {
+            throw new WebBeansException(e);
+        }
+        catch (IllegalAccessException e)
+        {
+            throw new WebBeansException(e);
+        }
+    }
+
     /**
      * Gets injected object reference.
      * @param injectionPoint injection point of javaee instance

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/AnnotationUtil.java Wed Mar 23 11:10:30 2011
@@ -27,11 +27,13 @@ import javax.enterprise.inject.spi.Annot
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.util.Nonbinding;
 import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -614,9 +616,9 @@ public final class AnnotationUtil
 
         try
         {
-            if (!accessible)
+            if (!accessible )
             {
-                SecurityUtil.doPrivilegedSetAccessible(method, true);
+                doPrivilegedSetAccessible(method, true);
             }
 
             return method.invoke(instance, EMPTY_OBJECT_ARRAY);
@@ -628,7 +630,33 @@ public final class AnnotationUtil
         finally
         {
             // reset accessible value
-            SecurityUtil.doPrivilegedSetAccessible(method, accessible);
+            doPrivilegedSetAccessible(method, accessible);
+        }
+    }
+
+    private static Object doPrivilegedSetAccessible(AccessibleObject obj, boolean flag)
+    {
+        AccessController.doPrivileged(new PrivilegedActionForAccessibleObject(obj, flag));
+        return null;
+    }
+
+    private static class PrivilegedActionForAccessibleObject implements PrivilegedAction<Object>
+    {
+
+        private AccessibleObject object;
+
+        private boolean flag;
+
+        protected PrivilegedActionForAccessibleObject(AccessibleObject object, boolean flag)
+        {
+            this.object = object;
+            this.flag = flag;
+        }
+
+        public Object run()
+        {
+            object.setAccessible(flag);
+            return null;
         }
     }
 
@@ -734,35 +762,6 @@ public final class AnnotationUtil
         return rMethod;
     }
 
-    /**
-     * Gets array of methods that has given annotation type.
-     * 
-     * @param clazz class for check
-     * @param annotation for check
-     * @return array of methods
-     */
-    public static Method[] getMethodsWithAnnotation(Class<?> clazz, Class<? extends Annotation> annotation)
-    {
-        Asserts.nullCheckForClass(clazz);
-        Asserts.assertNotNull(annotation, "Annotation argument can not be null");
-
-        Method[] methods = SecurityUtil.doPrivilegedGetDeclaredMethods(clazz);
-        List<Method> list = new ArrayList<Method>();
-        Method[] rMethod  ;
-
-        for (Method m : methods)
-        {
-            if (hasMethodAnnotation(m, annotation))
-            {
-                list.add(m);
-            }
-        }
-
-        rMethod = new Method[list.size()];
-        rMethod = list.toArray(rMethod);
-
-        return rMethod;
-    }
 
     /**
      * Check whether or not class contains the given annotation.
@@ -865,58 +864,6 @@ public final class AnnotationUtil
         return result;
     }
 
-    public static Field[] getClazzFieldsWithGivenAnnotation(Class<?> clazz, Class<? extends Annotation> annotation)
-    {
-        Field[] fields = SecurityUtil.doPrivilegedGetDeclaredFields(clazz);
-        List<Field> list = new ArrayList<Field>();
-
-        if (fields.length != 0)
-        {
-            for (Field field : fields)
-            {
-                if (field.isAnnotationPresent(annotation))
-                {
-                    list.add(field);
-                }
-            }
-        }
-
-        fields = new Field[list.size()];
-        fields = list.toArray(fields);
-
-        return fields;
-    }
-
-    @Deprecated
-    public static void checkQualifierConditions(Annotation... qualifierAnnots)
-    {
-        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifierAnnots);
-    }
-
-    /**
-     * This function obviously cannot check for duplicate annotations.
-     * So this must have been done before!
-     * @param qualifierAnnots
-     */
-    @Deprecated
-    public static void checkQualifierConditions(Set<Annotation> qualifierAnnots)
-    {
-        WebBeansContext.getInstance().getAnnotationManager().checkQualifierConditions(qualifierAnnots);
-    }
-
-    /**
-     * Returns true if the annotation is defined in xml or annotated with
-     * {@link javax.inject.Qualifier} false otherwise.
-     *
-     * @param clazz type of the annotation
-     * @return true if the annotation is defined in xml or annotated with
-     *         {@link javax.inject.Qualifier} false otherwise
-     */
-    @Deprecated
-    public static boolean isQualifierAnnotation(Class<? extends Annotation> clazz)
-    {
-        return WebBeansContext.getInstance().getAnnotationManager().isQualifierAnnotation(clazz);
-    }
 
     /**
      * Returns true if any binding exist

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/ClassUtil.java Wed Mar 23 11:10:30 2011
@@ -40,6 +40,7 @@ import javax.enterprise.inject.spi.Injec
 import javax.inject.Provider;
 
 import org.apache.webbeans.config.BeanTypeSetResolver;
+import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.logger.WebBeansLogger;
 
@@ -77,13 +78,13 @@ public final class ClassUtil
         throw new UnsupportedOperationException();
     }
 
-    public static Object newInstance(Class<?> clazz)
+    public static Object newInstance(WebBeansContext webBeansContext, Class<?> clazz)
     {
         try
         {
             if(System.getSecurityManager() != null)
             {
-                return SecurityUtil.doPrivilegedObjectCreate(clazz);
+                return webBeansContext.getSecurityService().doPrivilegedObjectCreate(clazz);
             }            
             
             return clazz.newInstance();
@@ -1249,13 +1250,13 @@ public final class ClassUtil
         return true;
     }
 
-    public static Field[] getFieldsWithType(Class<?> clazz, Type type)
+    public static Field[] getFieldsWithType(WebBeansContext webBeansContext, Class<?> clazz, Type type)
     {
         Asserts.nullCheckForClass(clazz);
         Asserts.assertNotNull(type, "type parameter can not be null");
 
         List<Field> fieldsWithType = new ArrayList<Field>();
-        Field[] fields = SecurityUtil.doPrivilegedGetDeclaredFields(clazz);
+        Field[] fields = webBeansContext.getSecurityService().doPrivilegedGetDeclaredFields(clazz);
         for (Field field : fields)
         {
             if(field.getType().equals(type))
@@ -1267,32 +1268,7 @@ public final class ClassUtil
         return fieldsWithType.toArray(new Field[fieldsWithType.size()]);
 
     }
-    
-    public static void setField(Object instance, Field field, Object value)
-    {
-        Asserts.assertNotNull(instance);
-        Asserts.assertNotNull(field);
-        
-        if(!field.isAccessible())
-        {
-            SecurityUtil.doPrivilegedSetAccessible(field, true);
-        }
-        
-        try
-        {
-            field.set(instance, value);
-        }
-        catch (IllegalArgumentException e)
-        {
-            throw new WebBeansException(e);
-        }
-        catch (IllegalAccessException e)
-        {
-            throw new WebBeansException(e);
-        }
-        
-    }
- 
+
     /**
      * Returns injection point raw type.
      * 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/SecurityUtil.java Wed Mar 23 11:10:30 2011
@@ -18,13 +18,9 @@
  */
 package org.apache.webbeans.util;
 
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
 
 import javassist.util.proxy.ProxyFactory;
 import org.apache.webbeans.exception.WebBeansException;
@@ -32,14 +28,9 @@ import org.apache.webbeans.exception.Web
 /** @deprecated  use SecurityService instead */
 public class SecurityUtil
 {
-    private static final int METHOD_CLASS_GETDECLAREDMETHOD = 0x03;
 
     private static final int METHOD_CLASS_GETDECLAREDMETHODS = 0x04;
 
-    private static final int METHOD_CLASS_GETDECLAREDFIELD = 0x05;
-
-    private static final int METHOD_CLASS_GETDECLAREDFIELDS = 0x06;
-    
     public static <T> Method[] doPrivilegedGetDeclaredMethods(Class<T> clazz)
     {
         Object obj = AccessController.doPrivileged(
@@ -47,25 +38,15 @@ public class SecurityUtil
         return (Method[])obj;
     }
 
-    public static <T> Field[] doPrivilegedGetDeclaredFields(Class<T> clazz)
-    {
-        Object obj = AccessController.doPrivileged(
-                new PrivilegedActionForClass(clazz, null, METHOD_CLASS_GETDECLAREDFIELDS));
-        return (Field[])obj;
-    }
-
     protected static class PrivilegedActionForClass implements PrivilegedAction<Object>
     {
         private Class<?> clazz;
 
-        private Object parameters;
-
         private int method;
 
         protected PrivilegedActionForClass(Class<?> clazz, Object parameters, int method)
         {
             this.clazz = clazz;
-            this.parameters = parameters;
             this.method = method;
         }
 
@@ -75,16 +56,8 @@ public class SecurityUtil
             {
                 switch (method)
                 {
-                    case METHOD_CLASS_GETDECLAREDMETHOD:
-                        String name = (String)((Object[])parameters)[0];
-                        Class<?>[] realParameters = (Class<?>[])((Object[])parameters)[1];
-                        return clazz.getDeclaredMethod(name, realParameters);
                     case METHOD_CLASS_GETDECLAREDMETHODS:
                         return clazz.getDeclaredMethods();
-                    case METHOD_CLASS_GETDECLAREDFIELD:
-                        return clazz.getDeclaredField((String)parameters);
-                    case METHOD_CLASS_GETDECLAREDFIELDS:
-                        return clazz.getDeclaredFields();
 
                     default:
                         return new WebBeansException("unknown security method: " + method);
@@ -98,72 +71,12 @@ public class SecurityUtil
 
     }
 
-    public static Object doPrivilegedSetAccessible(AccessibleObject obj, boolean flag)
-    {
-        AccessController.doPrivileged(new PrivilegedActionForAccessibleObject(obj, flag));
-        return null;
-    }
-
-    protected static class PrivilegedActionForAccessibleObject implements PrivilegedAction<Object>
-    {
-
-        private AccessibleObject object;
-
-        private boolean flag;
-
-        protected PrivilegedActionForAccessibleObject(AccessibleObject object, boolean flag)
-        {
-            this.object = object;
-            this.flag = flag;
-        }
-
-        public Object run()
-        {
-            object.setAccessible(flag);
-            return null;
-        }
-    }
-
-
     public static Class<?> doPrivilegedCreateClass(ProxyFactory factory)
     {
         Class<?> ret = (Class<?>)AccessController.doPrivileged(new PrivilegedActionForProxyFactory(factory));
         return ret;
     }
 
-    public static Object doPrivilegedObjectCreate(Class<?> clazz) throws PrivilegedActionException
-    {
-        return AccessController.doPrivileged(new PrivilegedActionForObjectCreation(clazz));
-    }
-
-
-    protected static class PrivilegedActionForObjectCreation implements PrivilegedExceptionAction<Object>
-    {
-        private Class<?> clazz;
-        
-        protected PrivilegedActionForObjectCreation(Class<?> clazz)
-        {
-            this.clazz = clazz;
-        }
-
-        @Override
-        public Object run() throws Exception
-        {
-            try
-            {
-                return clazz.newInstance();
-            }
-            catch (InstantiationException e)
-            {
-                throw e;
-            }
-            catch (IllegalAccessException e)
-            {
-                throw e;
-            }
-        }
-        
-    }
 
     protected static class PrivilegedActionForProxyFactory implements PrivilegedAction<Object>
     {

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=1084537&r1=1084536&r2=1084537&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 Wed Mar 23 11:10:30 2011
@@ -73,10 +73,12 @@ import static org.apache.webbeans.util.I
 public final class WebBeansAnnotatedTypeUtil
 {
     private static final WebBeansLogger logger = WebBeansLogger.getLogger(WebBeansAnnotatedTypeUtil.class);
-    
-    private WebBeansAnnotatedTypeUtil()
+
+    private final WebBeansContext webBeansContext;
+
+    public WebBeansAnnotatedTypeUtil(WebBeansContext webBeansContext)
     {
-        
+        this.webBeansContext = webBeansContext;
     }
     
     public static <T> AnnotatedConstructor<T> getBeanConstructor(AnnotatedType<T> type)
@@ -142,23 +144,23 @@ public final class WebBeansAnnotatedType
         return result;
     }
     
-    public static <T> void addConstructorInjectionPointMetaData(AbstractOwbBean<T> owner, AnnotatedConstructor<T> constructor)
+    public <T> void addConstructorInjectionPointMetaData(AbstractOwbBean<T> owner, AnnotatedConstructor<T> constructor)
     {
         InjectionPointFactory injectionPointFactory = owner.getWebBeansContext().getInjectionPointFactory();
         List<InjectionPoint> injectionPoints = injectionPointFactory.getConstructorInjectionPointData(owner, constructor);
         for (InjectionPoint injectionPoint : injectionPoints)
         {
-            DefinitionUtil.addImplicitComponentForInjectionPoint(injectionPoint);
+            webBeansContext.getDefinitionUtil().addImplicitComponentForInjectionPoint(injectionPoint);
             owner.addInjectionPoint(injectionPoint);
         }
     }
     
-    public static <T,X> void addMethodInjectionPointMetaData(OwbBean<T> owner, AnnotatedMethod<X> method)
+    public <T,X> void addMethodInjectionPointMetaData(OwbBean<T> owner, AnnotatedMethod<X> method)
     {
         List<InjectionPoint> injectionPoints = owner.getWebBeansContext().getInjectionPointFactory().getMethodInjectionPointData(owner, method);
         for (InjectionPoint injectionPoint : injectionPoints)
         {
-            DefinitionUtil.addImplicitComponentForInjectionPoint(injectionPoint);
+            webBeansContext.getDefinitionUtil().addImplicitComponentForInjectionPoint(injectionPoint);
             owner.addInjectionPoint(injectionPoint);
         }
     }
@@ -169,7 +171,7 @@ public final class WebBeansAnnotatedType
     }
     
     @SuppressWarnings("unchecked")
-    public static <X> Set<ObserverMethod<?>> defineObserverMethods(AbstractInjectionTargetBean<X> bean,AnnotatedType<X> annotatedType)
+    public <X> Set<ObserverMethod<?>> defineObserverMethods(AbstractInjectionTargetBean<X> bean,AnnotatedType<X> annotatedType)
     {
         WebBeansContext webBeansContext = bean.getWebBeansContext();
         Set<ObserverMethod<?>> definedObservers = new HashSet<ObserverMethod<?>>();
@@ -223,7 +225,7 @@ public final class WebBeansAnnotatedType
     }
     
     @SuppressWarnings("unchecked")
-    public static <X> void defineDisposalMethods(AbstractInjectionTargetBean<X> bean,AnnotatedType<X> annotatedType)
+    public <X> void defineDisposalMethods(AbstractInjectionTargetBean<X> bean,AnnotatedType<X> annotatedType)
     {
         final AnnotationManager annotationManager = bean.getWebBeansContext().getAnnotationManager();
         Set<AnnotatedMethod<? super X>> annotatedMethods = annotatedType.getMethods();    
@@ -298,7 +300,7 @@ public final class WebBeansAnnotatedType
     }
     
     @SuppressWarnings("unchecked")
-    public static <X> void defineInjectedMethods(AbstractInjectionTargetBean<X> bean,AnnotatedType<X> annotatedType)
+    public <X> void defineInjectedMethods(AbstractInjectionTargetBean<X> bean,AnnotatedType<X> annotatedType)
     {
         Set<AnnotatedMethod<? super X>> annotatedMethods = annotatedType.getMethods();
         
@@ -330,7 +332,7 @@ public final class WebBeansAnnotatedType
             }
         }
         
-        DefinitionUtil.defineInternalInjectedMethodsRecursively(bean, annotatedType.getJavaClass());
+        webBeansContext.getDefinitionUtil().defineInternalInjectedMethodsRecursively(bean, annotatedType.getJavaClass());
     }
     
     public static <X> void defineInjectedFields(AbstractInjectionTargetBean<X> bean,AnnotatedType<X> annotatedType)
@@ -381,14 +383,14 @@ public final class WebBeansAnnotatedType
             }                                    
         }
         
-        DefinitionUtil.defineInternalInjectedFieldsRecursively(bean, annotatedType.getJavaClass());
+        bean.getWebBeansContext().getDefinitionUtil().defineInternalInjectedFieldsRecursively(bean, annotatedType.getJavaClass());
     }
     
     
     @SuppressWarnings("unchecked")
-    public static <X> Set<ProducerFieldBean<?>> defineProducerFields(InjectionTargetBean<X> bean, AnnotatedType<X> annotatedType)
+    public <X> Set<ProducerFieldBean<?>> defineProducerFields(InjectionTargetBean<X> bean, AnnotatedType<X> annotatedType)
     {
-        WebBeansContext webBeansContext = bean.getWebBeansContext();
+        DefinitionUtil definitionUtil = webBeansContext.getDefinitionUtil();
         Set<ProducerFieldBean<?>> producerBeans = new HashSet<ProducerFieldBean<?>>();
         Set<AnnotatedField<? super X>> annotatedFields = annotatedType.getFields();        
         for(AnnotatedField<? super X> annotatedField: annotatedFields)
@@ -429,7 +431,7 @@ public final class WebBeansAnnotatedType
                         ResourceBean<X,Annotation> resourceBean = new ResourceBean((Class<X>)field.getType(),bean, resourceRef);
                         
                         resourceBean.getTypes().addAll(annotatedField.getTypeClosure());
-                        DefinitionUtil.defineQualifiers(resourceBean, anns);                    
+                        definitionUtil.defineQualifiers(resourceBean, anns);
                         resourceBean.setImplScopeType(new DependentScopeLiteral());
                         resourceBean.setProducerField(field);
                         
@@ -445,20 +447,20 @@ public final class WebBeansAnnotatedType
                     {
                         producerFieldBean.setNullable(false);
                     }                    
-                    
-                    DefinitionUtil.defineSerializable(producerFieldBean);
-                    DefinitionUtil.defineStereoTypes(producerFieldBean, anns);
+
+                    definitionUtil.defineSerializable(producerFieldBean);
+                    definitionUtil.defineStereoTypes(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", false);
+                    definitionUtil.defineScopeType(producerFieldBean, anns, "Annotated producer field: " + annotatedField +  "must declare default @Scope annotation", false);
                     webBeansContext.getWebBeansUtil().checkUnproxiableApiType(producerFieldBean,
                                                                                              producerFieldBean.getScope());
                     WebBeansUtil.checkProducerGenericType(producerFieldBean,annotatedField.getJavaMember());
-                    DefinitionUtil.defineQualifiers(producerFieldBean, anns);
-                    DefinitionUtil.defineName(producerFieldBean, anns, WebBeansUtil.getProducerDefaultName(annotatedField.getJavaMember().getName()));
+                    definitionUtil.defineQualifiers(producerFieldBean, anns);
+                    definitionUtil.defineName(producerFieldBean, anns, WebBeansUtil.getProducerDefaultName(annotatedField.getJavaMember().getName()));
                     
                     producerBeans.add(producerFieldBean);
                 }
@@ -470,10 +472,9 @@ public final class WebBeansAnnotatedType
     
     
     @SuppressWarnings("unchecked")
-    public static <X> Set<ProducerMethodBean<?>> defineProducerMethods(InjectionTargetBean<X> bean, AnnotatedType<X> annotatedType)
+    public <X> Set<ProducerMethodBean<?>> defineProducerMethods(InjectionTargetBean<X> bean, AnnotatedType<X> annotatedType)
     {
-        WebBeansContext webBeansContext = bean.getWebBeansContext();
-
+        DefinitionUtil definitionUtil = webBeansContext.getDefinitionUtil();
         Set<ProducerMethodBean<?>> producerBeans = new HashSet<ProducerMethodBean<?>>();
         Set<AnnotatedMethod<? super X>> annotatedMethods = annotatedType.getMethods();
         
@@ -506,8 +507,8 @@ public final class WebBeansAnnotatedType
                     producerMethodBean.setNullable(false);
                 }
                 
-                DefinitionUtil.defineSerializable(producerMethodBean);
-                DefinitionUtil.defineStereoTypes(producerMethodBean, AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
+                definitionUtil.defineSerializable(producerMethodBean);
+                definitionUtil.defineStereoTypes(producerMethodBean, AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
                 webBeansContext.getWebBeansUtil().setBeanEnableFlagForProducerBean(bean,
                                                                                                   producerMethodBean,
                                                                                                   AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
@@ -521,8 +522,8 @@ public final class WebBeansAnnotatedType
                 webBeansContext.getWebBeansUtil().checkUnproxiableApiType(producerMethodBean,
                                                                                          producerMethodBean.getScope());
                 WebBeansUtil.checkProducerGenericType(producerMethodBean,annotatedMethod.getJavaMember());
-                DefinitionUtil.defineQualifiers(producerMethodBean, AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
-                DefinitionUtil.defineName(producerMethodBean,
+                definitionUtil.defineQualifiers(producerMethodBean, AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()));
+                definitionUtil.defineName(producerMethodBean,
                                           AnnotationUtil.getAnnotationsFromSet(annotatedMethod.getAnnotations()),
                                                                                WebBeansUtil.getProducerDefaultName(annotatedMethod.getJavaMember().getName()));
                 

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=1084537&r1=1084536&r2=1084537&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 Wed Mar 23 11:10:30 2011
@@ -576,17 +576,19 @@ public final class WebBeansUtil
     {
         Asserts.nullCheckForClass(clazz);
 
-        NewBean<T> comp = null;
+        NewBean<T> comp;
+        DefinitionUtil definitionUtil = webBeansContext.getDefinitionUtil();
+
 
         if (webBeansContext.getManagedBeanConfigurator().isManagedBean(clazz))
         {
             comp = new NewBean<T>(clazz, WebBeansType.MANAGED, webBeansContext);
             comp.setImplScopeType(new DependentScopeLiteral());
             comp.setConstructor(defineConstructor(clazz));
-            DefinitionUtil.addConstructorInjectionPointMetaData(comp, comp.getConstructor());
+            definitionUtil.addConstructorInjectionPointMetaData(comp, comp.getConstructor());
 
-            DefinitionUtil.defineInjectedFields(comp);
-            DefinitionUtil.defineInjectedMethods(comp);
+            definitionUtil.defineInjectedFields(comp);
+            definitionUtil.defineInjectedMethods(comp);
         }
         else if (EJBWebBeansConfigurator.isSessionBean(clazz, webBeansContext))
         {
@@ -630,12 +632,13 @@ public final class WebBeansUtil
         comp = new ExtensionBean<T>(clazz, webBeansContext);
         comp.setEnabled(true);
 
-        DefinitionUtil.defineApiTypes(comp, clazz);
+        DefinitionUtil definitionUtil = webBeansContext.getDefinitionUtil();
+        definitionUtil.defineApiTypes(comp, clazz);
 
         comp.setImplScopeType(new ApplicationScopeLiteral());
         comp.addQualifier(new DefaultLiteral());
 
-        DefinitionUtil.defineObserverMethods(comp, clazz);
+        definitionUtil.defineObserverMethods(comp, clazz);
 
         return comp;
     }
@@ -2930,8 +2933,10 @@ public final class WebBeansUtil
         managedBeanCreator.defineInjectedFields();
         managedBeanCreator.defineInjectedMethods();
         managedBeanCreator.defineObserverMethods();
-        DefinitionUtil.defineDecoratorStack(managedBean);
-        webBeansContext.getDefinitionUtil().defineBeanInterceptorStack(managedBean);
+
+        DefinitionUtil definitionUtil = webBeansContext.getDefinitionUtil();
+        definitionUtil.defineDecoratorStack(managedBean);
+        definitionUtil.defineBeanInterceptorStack(managedBean);
 
         managedBeanCreator.defineDisposalMethods();//Define disposal method after adding producers
 

Modified: openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java?rev=1084537&r1=1084536&r2=1084537&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java (original)
+++ openwebbeans/trunk/webbeans-porting/src/main/java/org/apache/webbeans/test/tck/BeansImpl.java Wed Mar 23 11:10:30 2011
@@ -42,7 +42,8 @@ public class BeansImpl implements Beans
     @SuppressWarnings("unchecked")
     public <T> Bean<T> createProducerMethodBean(Method method, Bean<?> declaringBean)
     {
-        return DefinitionUtil.createProducerComponent((Class<T>)method.getReturnType(), method, (InjectionTargetBean<?>)declaringBean, false);
+        DefinitionUtil definitionUtil = ((InjectionTargetBean<?>)declaringBean).getWebBeansContext().getDefinitionUtil();
+        return definitionUtil.createProducerComponent((Class<T>)method.getReturnType(), method, (InjectionTargetBean<?>)declaringBean, false);
         
     }
 



Mime
View raw message