openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r923512 - in /openwebbeans/trunk/webbeans-impl: ./ src/main/java/org/apache/webbeans/container/ src/main/java/org/apache/webbeans/intercept/ src/main/java/org/apache/webbeans/logger/ src/main/java/org/apache/webbeans/util/ src/main/resource...
Date Tue, 16 Mar 2010 00:04:26 GMT
Author: struberg
Date: Tue Mar 16 00:04:26 2010
New Revision: 923512

URL: http://svn.apache.org/viewvc?rev=923512&view=rev
Log:
OWB-313 implement beans caching + improve Interceptor code

Modified:
    openwebbeans/trunk/webbeans-impl/   (props changed)
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLogger.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
    openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties

Propchange: openwebbeans/trunk/webbeans-impl/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Mar 16 00:04:26 2010
@@ -1,7 +1,11 @@
-.settings
 target
+.metadata
 .classpath
 .project
+.settings
 *.iml
 *.ipr
 *.iws
+.git
+.gitignore
+

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java?rev=923512&r1=923511&r2=923512&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/BeanManagerImpl.java
Tue Mar 16 00:04:26 2010
@@ -652,6 +652,8 @@ public class BeanManagerImpl implements 
     @Override
     public Set<Bean<?>> getBeans(String name)
     {        
+        Asserts.assertNotNull(name, "name parameter can not be null");
+        
         return this.injectionResolver.implResolveByName(name);
     }
 
@@ -667,6 +669,8 @@ public class BeanManagerImpl implements 
     @Override
     public Object getInjectableReference(InjectionPoint injectionPoint, CreationalContext<?>
ownerCreationalContext)
     {
+        Asserts.assertNotNull(injectionPoint, "injectionPoint parameter can not be null");
+
         //Injected instance
         Object instance = null;
         
@@ -757,6 +761,8 @@ public class BeanManagerImpl implements 
     @Override
     public Object getReference(Bean<?> bean, Type beanType, CreationalContext<?>
creationalContext)
     {
+        Asserts.assertNotNull(bean, "bean parameter can not be null");
+
         Context context = null;
         Object instance = null;
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java?rev=923512&r1=923511&r2=923512&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/container/InjectionResolver.java
Tue Mar 16 00:04:26 2010
@@ -19,7 +19,9 @@ import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.enterprise.event.Event;
 import javax.enterprise.inject.Instance;
@@ -33,6 +35,7 @@ import org.apache.webbeans.component.Abs
 import org.apache.webbeans.config.WebBeansFinder;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
 import org.apache.webbeans.exception.inject.NullableDependencyException;
+import org.apache.webbeans.logger.WebBeansLogger;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;
@@ -43,7 +46,7 @@ import org.apache.webbeans.util.WebBeans
  * 
  * <p>
  * It is a singleton class per ClassLoader per JVM. It is
- * responsible for resolbing the bean instances at the injection points for 
+ * responsible for resolving the bean instances at the injection points for 
  * its bean manager.
  * </p>
  * 
@@ -52,10 +55,23 @@ import org.apache.webbeans.util.WebBeans
  */
 public class InjectionResolver
 {
+    private static final WebBeansLogger logger = WebBeansLogger.getLogger(InjectionResolver.class);
+
     /**Bean Manager*/
     private BeanManagerImpl manager;
     
     /**
+     * This Map contains all resolved beans via it's type and qualifiers.
+     * If a bean have resolved as not existing, the entry will contain <code>null</code>
as value.
+     */
+    private Map<String, Set<Bean<?>>> resolvedBeansByType = new ConcurrentHashMap<String,
Set<Bean<?>>>();
+    
+    /**
+     * This Map contains all resolved beans via it's ExpressionLanguage name.
+     */
+    private Map<String, Set<Bean<?>>> resolvedBeansByName = new ConcurrentHashMap<String,
Set<Bean<?>>>();
+    
+    /**
      * Creates a new injection resolve for given bean manager.
      * 
      * @param manager bean manager
@@ -256,6 +272,12 @@ public class InjectionResolver
     {
         Asserts.assertNotNull(name, "name parameter can not be null");
 
+        String cacheKey = name;
+        if (resolvedBeansByName.containsKey(cacheKey))
+        {
+            return resolvedBeansByName.get(cacheKey); 
+        }
+
         Set<Bean<?>> resolvedComponents = new HashSet<Bean<?>>();
       
         Set<Bean<?>> deployedComponents = this.manager.getBeans();
         
@@ -286,7 +308,10 @@ public class InjectionResolver
                 return specializedComponents;
             }            
         }
-                
+        
+        resolvedBeansByType.put(cacheKey, resolvedComponents);
+        logger.debug("DEBUG_ADD_BYNYME_CACHE_BEANS", cacheKey);
+
         return resolvedComponents;
     }
      
@@ -342,15 +367,22 @@ public class InjectionResolver
      * @param <T> bean type info
      * @param injectionPointType injection point api type
      * @param injectionPointTypeArguments actual type arguments if parameterized type
-     * @param qualifier qualifier of the injection point
+     * @param qualifiers qualifiers of the injection point
      * @return set of resolved beans
      */
-    public Set<Bean<?>> implResolveByType(Type injectionPointType, Annotation...
qualifier)
+    public Set<Bean<?>> implResolveByType(Type injectionPointType, Annotation...
qualifiers)
     {
-        Asserts.assertNotNull(injectionPointType, "injectionPointType parameter can not be
null");
-        Asserts.assertNotNull(qualifier, "qualifier parameter can not be null");
+        //X TODO maybe we need to stringify the qualifiers manually im a loop...
+        String cacheKey = getBeanCacheKey(injectionPointType, qualifiers);
+
+        
+        if (resolvedBeansByType.containsKey(cacheKey))
+        {
+            return resolvedBeansByType.get(cacheKey); 
+        }
         
         Set<Bean<?>> results = new HashSet<Bean<?>>();
+        
         Set<Bean<?>> deployedComponents = this.manager.getBeans();
 
         boolean currentQualifier = false;
@@ -358,16 +390,16 @@ public class InjectionResolver
         
         if(isInstanceOrEventInjection(injectionPointType))
         {
-            qualifier = new Annotation[1];
-            qualifier[0] = new AnyLiteral();
+            qualifiers = new Annotation[1];
+            qualifiers[0] = new AnyLiteral();
         }
         
         else
         {
-            if (qualifier.length == 0)
+            if (qualifiers.length == 0)
             {
-                qualifier = new Annotation[1];
-                qualifier[0] = new DefaultLiteral();
+                qualifiers = new Annotation[1];
+                qualifiers[0] = new DefaultLiteral();
                 currentQualifier = true;
             }                        
         }
@@ -389,25 +421,22 @@ public class InjectionResolver
                 continue;
             }
 
-            else
+            Set<Type> componentApiTypes = component.getTypes();
+            Iterator<Type> itComponentApiTypes = componentApiTypes.iterator();
+            while (itComponentApiTypes.hasNext())
             {
-                Set<Type> componentApiTypes = component.getTypes();
-                Iterator<Type> itComponentApiTypes = componentApiTypes.iterator();
-                while (itComponentApiTypes.hasNext())
+                Type componentApiType = itComponentApiTypes.next();
+                
+                if(ClassUtil.isAssignable(componentApiType, injectionPointType))
                 {
-                    Type componentApiType = itComponentApiTypes.next();                 
  
-                    
-                    if(ClassUtil.isAssignable(componentApiType, injectionPointType))
-                    {
-                        results.add((Bean<?>) component);
-                        break;                                            
-                    }                    
+                    results.add((Bean<?>) component);
+                    break;
                 }
-            }            
+            }
         }
  
         //Look for qualifiers
-        results = findByQualifier(results, qualifier);
+        results = findByQualifier(results, qualifiers);
         
         //Look for alternative
         results = findByAlternatives(results);
@@ -417,13 +446,26 @@ public class InjectionResolver
         if(results.size() > 1)
         {
             //Look for specialization
-            results = findBySpecialization(results);            
+            results = findBySpecialization(results);
 
         }
         
+        resolvedBeansByType.put(cacheKey, results);
+        logger.debug("DEBUG_ADD_BYTYPE_CACHE_BEANS", cacheKey);
+        
         return results;
     }
     
+    private String getBeanCacheKey(Type injectionPointType, Annotation... qualifiers)
+    {
+        StringBuilder cacheKey = new StringBuilder(injectionPointType.toString());
+        for (Annotation a : qualifiers)
+        {
+            cacheKey.append('@').append(a.toString());
+        }
+        return cacheKey.toString();
+    }
+
     /**
      * Returns specialized beans if exists, otherwise return input result
      * 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java?rev=923512&r1=923511&r2=923512&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorHandler.java
Tue Mar 16 00:04:26 2010
@@ -162,7 +162,8 @@ public abstract class InterceptorHandler
                 InjectionTargetBean<?> injectionTarget = (InjectionTargetBean<?>)
this.bean;
 
                 // toString is supported but no other object method names!!!
-                if ((!ClassUtil.isObjectMethod(method.getName()) || method.getName().equals("toString"))
&& InterceptorUtil.isWebBeansBusinessMethod(method))
+                if ((!ClassUtil.isObjectMethod(method.getName()) || method.getName().equals("toString"))

+                    && InterceptorUtil.isWebBeansBusinessMethod(method))
                 {
 
                     DelegateHandler delegateHandler = null;
@@ -188,30 +189,35 @@ public abstract class InterceptorHandler
                     }
 
                     // Run around invoke chain
-                    List<InterceptorData> stack = injectionTarget.getInterceptorStack();
+                    List<InterceptorData> interceptorStack = injectionTarget.getInterceptorStack();
 
-                    List<InterceptorData> temp = new ArrayList<InterceptorData>(stack);
-
-                    // Filter both EJB and WebBeans interceptors
-                    filterCommonInterceptorStackList(temp, method, ownerCreationalContext);
-
-                    // If there are both interceptors and decorators, add hook
-                    // point to the end of the interceptor stack.
-                    if (decorators != null && temp.size() > 0)
+                    if (interceptorStack.size() > 0)
                     {
-                        WebBeansDecoratorInterceptor lastInterceptor = new WebBeansDecoratorInterceptor(delegateHandler,
instance);
-                        InterceptorDataImpl data = new InterceptorDataImpl(true);
-                        data.setInterceptorInstance(lastInterceptor);
-                        data.setAroundInvoke(lastInterceptor.getClass().getDeclaredMethods()[0]);
-                        temp.add(data);
-                    }
-
-                    // Call Around Invokes
-                    if (WebBeansUtil.isContainsInterceptorMethod(temp, InterceptorType.AROUND_INVOKE))
-                    {
-                        return callAroundInvokes(method, arguments, WebBeansUtil.getInterceptorMethods(temp,
InterceptorType.AROUND_INVOKE));
+                        List<InterceptorData> filteredInterceptorStack = new ArrayList<InterceptorData>(interceptorStack);
+    
+                        // Filter both EJB and WebBeans interceptors
+                        filterCommonInterceptorStackList(filteredInterceptorStack, method,
ownerCreationalContext);
+    
+                        injectInterceptorFields(filteredInterceptorStack, ownerCreationalContext);
+    
+                        // If there are both interceptors and decorators, add hook
+                        // point to the end of the interceptor stack.
+                        if (decorators != null && filteredInterceptorStack.size()
> 0)
+                        {
+                            WebBeansDecoratorInterceptor lastInterceptor = new WebBeansDecoratorInterceptor(delegateHandler,
instance);
+                            InterceptorDataImpl data = new InterceptorDataImpl(true);
+                            data.setInterceptorInstance(lastInterceptor);
+                            data.setAroundInvoke(lastInterceptor.getClass().getDeclaredMethods()[0]);
+                            filteredInterceptorStack.add(data);
+                        }
+    
+                        // Call Around Invokes
+                        if (WebBeansUtil.isContainsInterceptorMethod(filteredInterceptorStack,
InterceptorType.AROUND_INVOKE))
+                        {
+                            return callAroundInvokes(method, arguments, WebBeansUtil.getInterceptorMethods(filteredInterceptorStack,
InterceptorType.AROUND_INVOKE));
+                        }
                     }
-
+                    
                     // If there are Decorators, allow the delegate handler to
                     // manage the stack
                     if (decorators != null)
@@ -297,7 +303,7 @@ public abstract class InterceptorHandler
         return false;
     }
 
-    private void filterCommonInterceptorStackList(final List<InterceptorData> stack,
Method method, CreationalContextImpl<?> ownerCreationalContext)
+    private void filterCommonInterceptorStackList(List<InterceptorData> stack, Method
method, CreationalContextImpl<?> ownerCreationalContext)
     {
         Iterator<InterceptorData> it = stack.iterator();
         while (it.hasNext())
@@ -310,7 +316,6 @@ public abstract class InterceptorHandler
             }
         }
         
-        injectInterceptorFields(stack, ownerCreationalContext);
     }
     
     

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLogger.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLogger.java?rev=923512&r1=923511&r2=923512&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLogger.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/logger/WebBeansLogger.java
Tue Mar 16 00:04:26 2010
@@ -80,7 +80,7 @@ public final class WebBeansLogger
         logger.logp(log_level, this.caller.getName(), Thread.currentThread().getStackTrace()[4].getMethodName(),
messageKey);
     }
 
-    private void wblLog(Level log_level, String messageKey, Object args[])
+    private void wblLog(Level log_level, String messageKey, Object... args)
     {
         checkNullLogger();
         logger.logp(log_level, this.caller.getName(), Thread.currentThread().getStackTrace()[4].getMethodName(),
messageKey, args);
@@ -92,7 +92,7 @@ public final class WebBeansLogger
         logger.logp(log_level, this.caller.getName(), Thread.currentThread().getStackTrace()[4].getMethodName(),
messageKey, e);
     }
 
-    private void wblLog(Level log_level, String messageKey, Object args[], Throwable e)
+    private void wblLog(Level log_level, Throwable e, String messageKey, Object... args)
     {
         checkNullLogger();
         logger.logp(log_level, this.caller.getName(), Thread.currentThread().getStackTrace()[3].getMethodName(),
constructMessage(messageKey, args), e);
@@ -123,7 +123,7 @@ public final class WebBeansLogger
         this.wblLog(WebBeansLogger.WBL_ERROR, messageKey);
     }
 
-    public void error(String messageKey, Object args[])
+    public void error(String messageKey, Object... args)
     {
         this.wblLog(WebBeansLogger.WBL_ERROR, messageKey, args);
     }
@@ -133,7 +133,7 @@ public final class WebBeansLogger
         this.wblLog(WebBeansLogger.WBL_ERROR, messageKey, e);
     }
 
-    public void error(String messageKey, Object args[], Throwable e)
+    public void error(String messageKey, Throwable e, Object... args)
     {
         this.wblLog(WebBeansLogger.WBL_ERROR, messageKey, args, e);
     }
@@ -143,7 +143,7 @@ public final class WebBeansLogger
         this.wblLog(WebBeansLogger.WBL_WARN, messageKey);
     }
 
-    public void warn(String messageKey, Object args[])
+    public void warn(String messageKey, Object... args)
     {
         this.wblLog(WebBeansLogger.WBL_WARN, messageKey, args);
     }
@@ -158,7 +158,7 @@ public final class WebBeansLogger
     	this.wblLog(WebBeansLogger.WBL_INFO, messageKey);
     }
 
-    public void info(String messageKey, Object args[])
+    public void info(String messageKey, Object... args)
     {
         this.wblLog(WebBeansLogger.WBL_INFO, messageKey, args);
     }
@@ -173,9 +173,9 @@ public final class WebBeansLogger
         this.wblLog(WebBeansLogger.WBL_DEBUG, messageKey);
     }
 
-    public void debug(String messageKey, Object args[])
+    public void debug(String messageKey, Object... args)
     {
-        this.wblLog(WebBeansLogger.WBL_WARN, messageKey, args);
+        this.wblLog(WebBeansLogger.WBL_DEBUG, messageKey, args);
     }
 
     public void debug(String messageKey, Throwable e)
@@ -188,7 +188,7 @@ public final class WebBeansLogger
         this.wblLog(WebBeansLogger.WBL_TRACE, messageKey);
     }
 
-    public void trace(String messageKey, Object args[])
+    public void trace(String messageKey, Object... args)
     {
         this.wblLog(WebBeansLogger.WBL_TRACE, messageKey, args);
     }
@@ -198,7 +198,7 @@ public final class WebBeansLogger
         this.wblLog(WebBeansLogger.WBL_TRACE, messageKey, e);
     }
 
-    private String constructMessage(String messageKey, Object args[])
+    private String constructMessage(String messageKey, Object... args)
     {
     	MessageFormat msgFrmt;
     	String formattedString;

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=923512&r1=923511&r2=923512&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
Tue Mar 16 00:04:26 2010
@@ -220,10 +220,10 @@ public final class WebBeansUtil
      */
     public static void checkGenericType(Bean<?> bean)
     {
-    	Asserts.assertNotNull(bean);
-    	
-    	Class<?> clazz = bean.getBeanClass();
-    	
+        Asserts.assertNotNull(bean);
+
+        Class<?> clazz = bean.getBeanClass();
+
         if (ClassUtil.isDefinitionConstainsTypeVariables(clazz))
         {
             if(!bean.getScope().equals(Dependent.class))
@@ -232,8 +232,8 @@ public final class WebBeansUtil
             }
         }
     }
-    
-    
+
+
     /**
      * Check producer method/field bean return type. 
      * @param bean producer bean instance
@@ -241,34 +241,34 @@ public final class WebBeansUtil
      */
     public static void checkProducerGenericType(Bean<?> bean,Member member)
     {
-    	Asserts.assertNotNull(bean,"Bean is null");
-    	
-    	Type type = null;
-    	
-    	if(bean instanceof ProducerMethodBean)
-    	{
-    		type = ((ProducerMethodBean<?>)bean).getCreatorMethod().getGenericReturnType();
-    	}
-    	else if(bean instanceof ProducerFieldBean)
-    	{
-    		type = ((ProducerFieldBean<?>)bean).getCreatorField().getGenericType();
-    	}
-    	else
-    	{
-    		throw new IllegalArgumentException("Bean must be Producer Field or Method Bean instance
: " + bean);
-    	}
-    	
-    	String message = "Producer Field/Method Bean with name : " + member.getName() + " in
bean class : " + member.getDeclaringClass().getName(); 
-    	
-    	if(checkGenericForProducers(type, message))
-    	{
+        Asserts.assertNotNull(bean,"Bean is null");
+
+        Type type = null;
+
+        if(bean instanceof ProducerMethodBean)
+        {
+            type = ((ProducerMethodBean<?>)bean).getCreatorMethod().getGenericReturnType();
+        }
+        else if(bean instanceof ProducerFieldBean)
+        {
+            type = ((ProducerFieldBean<?>)bean).getCreatorField().getGenericType();
+        }
+        else
+        {
+            throw new IllegalArgumentException("Bean must be Producer Field or Method Bean
instance : " + bean);
+        }
+
+        String message = "Producer Field/Method Bean with name : " + member.getName() + "
in bean class : " + member.getDeclaringClass().getName(); 
+
+        if(checkGenericForProducers(type, message))
+        {
             if(!bean.getScope().equals(Dependent.class))
             {
                 throw new WebBeansConfigurationException(message + " scope must bee @Dependent");
             }
-    	}
+        }
     }
-    
+
     /**
      * Check generic types for producer method and fields.
      * @param type generic return type
@@ -278,37 +278,37 @@ public final class WebBeansUtil
     //Helper method
     private static boolean checkGenericForProducers(Type type, String message)
     {
-    	boolean result = false;
-    	
-    	if(type instanceof TypeVariable)
-    	{
-    		throw new WebBeansConfigurationException(message + " return type can not be type variable");
-    	}
-    	
-    	if(ClassUtil.isParametrizedType(type))
-    	{
-    		Type[] actualTypes = ClassUtil.getActualTypeArguements(type);
-    		
-    		if(actualTypes.length == 0)
-    		{
-        		throw new WebBeansConfigurationException(message + " return type must define actual
type arguments or type variable");
-    		}
-    		
-    		for(Type actualType : actualTypes)
-    		{
-    			if(ClassUtil.isWildCardType(actualType))
-    			{
-    				throw new WebBeansConfigurationException(message + " return type can not define wildcard
actual type argument");
-    			}
-    			
-    			if(ClassUtil.isTypeVariable(actualType))
-    			{
-    				result = true; 
-    			}
-    		}    		
-    	}
-    	
-    	return result;
+        boolean result = false;
+
+        if(type instanceof TypeVariable)
+        {
+            throw new WebBeansConfigurationException(message + " return type can not be type
variable");
+        }
+
+        if(ClassUtil.isParametrizedType(type))
+        {
+            Type[] actualTypes = ClassUtil.getActualTypeArguements(type);
+
+            if(actualTypes.length == 0)
+            {
+                throw new WebBeansConfigurationException(message + " return type must define
actual type arguments or type variable");
+            }
+
+            for(Type actualType : actualTypes)
+            {
+                if(ClassUtil.isWildCardType(actualType))
+                {
+                    throw new WebBeansConfigurationException(message + " return type can
not define wildcard actual type argument");
+                }
+
+                if(ClassUtil.isTypeVariable(actualType))
+                {
+                    result = true; 
+                }
+            }    		
+        }
+
+        return result;
     }
     
     /**
@@ -1788,103 +1788,103 @@ public final class WebBeansUtil
         List<ProducerMethodBean> producerBeans = new ArrayList<ProducerMethodBean>();
         for(Bean b : beans) 
         {
-        	if (b instanceof ProducerMethodBean) 
-        	{
-        		producerBeans.add((ProducerMethodBean)b);
-        	}
+            if (b instanceof ProducerMethodBean) 
+            {
+                producerBeans.add((ProducerMethodBean)b);
+            }
         }
-        
+
         // create sorted bean helper.
         SortedListHelper<ProducerMethodBean> producerBeanListHelper = new
-        	SortedListHelper<ProducerMethodBean>(new ArrayList<ProducerMethodBean>(),

-        		new Comparator<ProducerMethodBean> () 
-        		{
-	        		public int compare(ProducerMethodBean e1, ProducerMethodBean e2) 
-	        		{
-	        			if (e1.getBeanClass().isAssignableFrom(e2.getBeanClass())) 
-	        			{
-	        				return -1;
-	        			} 
-	        			else if (e1.equals(e2)) 
-	        			{
-	        				return 0;
-	        			}
-	        			return 1;
-	        		}
-        	});
-        
+        SortedListHelper<ProducerMethodBean>(new ArrayList<ProducerMethodBean>(),

+                new Comparator<ProducerMethodBean> () 
+                {
+            public int compare(ProducerMethodBean e1, ProducerMethodBean e2) 
+            {
+                if (e1.getBeanClass().isAssignableFrom(e2.getBeanClass())) 
+                {
+                    return -1;
+                } 
+                else if (e1.equals(e2)) 
+                {
+                    return 0;
+                }
+                return 1;
+            }
+                });
+
         while(true) 
         {
-        	pbean = null;
-        	method = null;
-        	producerBeanListHelper.clear();
-        	
-        	//locate a specialized bean 
-        	for(ProducerMethodBean pb : producerBeans) 
-            {
-        		if (pb.isSpecializedBean()) 
-            	{	
-            		pbean = pb;
-            		method = pb.getCreatorMethod();
-            		producerBeanListHelper.add(pb);
-            		break;
-            	}
+            pbean = null;
+            method = null;
+            producerBeanListHelper.clear();
+
+            //locate a specialized bean 
+            for(ProducerMethodBean pb : producerBeans) 
+            {
+                if (pb.isSpecializedBean()) 
+                {	
+                    pbean = pb;
+                    method = pb.getCreatorMethod();
+                    producerBeanListHelper.add(pb);
+                    break;
+                }
             }
             if (pbean == null) break;
-            
+
             pLeft = pRight = pbean;
             boolean pLeftContinue = true;
             boolean pRightContinue = true;
-            
+
             // find all pbean's super beans and sub sub beans
             while(pLeftContinue || pRightContinue)
             {
-            	pLeftContinue = pRightContinue = false;
-	            for(ProducerMethodBean pb : producerBeans) 
-	            {
-	            	//left
-	            	if (pLeft!= null &&
-            			pLeft.getBeanClass().getSuperclass().equals(pb.getBeanClass()))
-	            	{
-	            		Method superMethod = ClassUtil.getClassMethodWithTypes(pb.getBeanClass(),
method.getName(), Arrays.asList(method.getParameterTypes()));
-	               		if (superMethod != null)
-	    				{
-	               			producerBeanListHelper.add(pb);
-	               			pLeft = (pb.isSpecializedBean()) ? pb : null; 
-	    				} 
-	               		else {
-	               			pLeft = null;
-	               		}
-	               		if (pLeft != null) pLeftContinue = true; 
-	            	}
-	            	//right
-	            	if (pRight != null && 
-	            		pb.getBeanClass().getSuperclass().equals(pRight.getBeanClass()))
-	            	{
-	            		if (!pb.isSpecializedBean()) 
-	            		{
-	            			pRight = null;
-	            		} else {
-		            		Method superMethod = ClassUtil.getClassMethodWithTypes(pb.getBeanClass(),
method.getName(), Arrays.asList(method.getParameterTypes()));
-		               		if (superMethod != null)
-		    				{
-		               			producerBeanListHelper.add(pb);
-		               			pRight = pb;
-		    				} else 
-		    				{
-		    					pRight = null;
-		    				}
-	            		}
-	               		if (pRight != null) pRightContinue = true; 
-	            	}
-	            } // for
+                pLeftContinue = pRightContinue = false;
+                for(ProducerMethodBean pb : producerBeans) 
+                {
+                    //left
+                    if (pLeft!= null &&
+                            pLeft.getBeanClass().getSuperclass().equals(pb.getBeanClass()))
+                    {
+                        Method superMethod = ClassUtil.getClassMethodWithTypes(pb.getBeanClass(),
method.getName(), Arrays.asList(method.getParameterTypes()));
+                        if (superMethod != null)
+                        {
+                            producerBeanListHelper.add(pb);
+                            pLeft = (pb.isSpecializedBean()) ? pb : null; 
+                        } 
+                        else {
+                            pLeft = null;
+                        }
+                        if (pLeft != null) pLeftContinue = true; 
+                    }
+                    //right
+                    if (pRight != null && 
+                            pb.getBeanClass().getSuperclass().equals(pRight.getBeanClass()))
+                    {
+                        if (!pb.isSpecializedBean()) 
+                        {
+                            pRight = null;
+                        } else {
+                            Method superMethod = ClassUtil.getClassMethodWithTypes(pb.getBeanClass(),
method.getName(), Arrays.asList(method.getParameterTypes()));
+                            if (superMethod != null)
+                            {
+                                producerBeanListHelper.add(pb);
+                                pRight = pb;
+                            } else 
+                            {
+                                pRight = null;
+                            }
+                        }
+                        if (pRight != null) pRightContinue = true; 
+                    }
+                } // for
             } // while
-            
+
             //remove the group from producer bean list
             for(ProducerMethodBean pb : producerBeanListHelper.getList())
-    		{
-            	producerBeans.remove(pb);
-    		}
+            {
+                producerBeans.remove(pb);
+            }
             //configure the directly extended producer beans
             configSpecializedProducerMethodBeans(producerBeanListHelper.getList());
         }

Modified: openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties?rev=923512&r1=923511&r2=923512&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/resources/openwebbeans/Messages.properties Tue
Mar 16 00:04:26 2010
@@ -104,4 +104,7 @@ EXCEPT_0012 = All elements in the beans.
 EXCEPT_0013 = Unable to read root element of the given input stream.
 EXCEPT_0014 = Multiple classes with name \: 
 
+DEBUG_ADD_BYTYPE_CACHE_BEANS = Adding resolved beans with key {0} to cache.
+DEBUG_ADD_BYNAME_CACHE_BEANS = Adding resolved EL beans with key {0} to cache.
+ 
 #========= END OF TRANSLATED MESSAGES =================================



Mime
View raw message