openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r952931 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: decorator/ deployment/ inject/ inject/impl/ intercept/ util/
Date Wed, 09 Jun 2010 09:49:09 GMT
Author: struberg
Date: Wed Jun  9 09:49:08 2010
New Revision: 952931

URL: http://svn.apache.org/viewvc?rev=952931&view=rev
Log:
OWB-275 code cleanup

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/OWBInjector.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorRuntimeSupport.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.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/WebBeansConstants.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java?rev=952931&r1=952930&r2=952931&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/decorator/DecoratorsManager.java
Wed Jun  9 09:49:08 2010
@@ -68,11 +68,17 @@ public class DecoratorsManager
         }
 
         if (srcIndex == targetIndex)
+        {
             return 0;
+        }
         else if (srcIndex < targetIndex)
+        {
             return -1;
+        }
         else
+        {
             return 1;
+        }
     }
 
     public boolean isDecoratorEnabled(Class<?> decoratorClazz)

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java?rev=952931&r1=952930&r2=952931&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/deployment/XMLStereoTypeModel.java
Wed Jun  9 09:49:08 2010
@@ -237,7 +237,9 @@ public class XMLStereoTypeModel implemen
         }
 
         if (!(obj instanceof XMLStereoTypeModel))
+        {
             return false;
+        }
 
         XMLStereoTypeModel model = (XMLStereoTypeModel) obj;
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java?rev=952931&r1=952930&r2=952931&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/InjectableConstructor.java
Wed Jun  9 09:49:08 2010
@@ -27,12 +27,11 @@ import javax.enterprise.inject.spi.Annot
 import javax.enterprise.inject.spi.InjectionPoint;
 
 import org.apache.webbeans.component.AbstractOwbBean;
-import org.apache.webbeans.component.ManagedBean;
 import org.apache.webbeans.exception.WebBeansException;
 import org.apache.webbeans.util.SecurityUtil;
 
 /**
- * Injects the parameters of the {@link ManagedBean} constructor and returns
+ * Injects the parameters of the {@link org.apache.webbeans.component.ManagedBean} constructor
and returns
  * the created instance.
  * 
  * @author <a href="mailto:gurkanerdogdu@yahoo.com">Gurkan Erdogdu</a>

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=952931&r1=952930&r2=952931&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 Jun  9 09:49:08 2010
@@ -154,7 +154,8 @@ public final class OWBInjector implement
                             Field field = (Field)injectionPoint.getMember();
                             ClassUtil.setField(javaEeComponentInstance, field, object);
                         }                        
-                    }finally
+                    }
+                    finally
                     {
                         if(injectionPointBeanSet)
                         {
@@ -167,7 +168,8 @@ public final class OWBInjector implement
             }
             
             
-        }catch(Exception e)
+        }
+        catch(Exception e)
         {
             throw e;
         }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java?rev=952931&r1=952930&r2=952931&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/impl/InjectionPointFactory.java
Wed Jun  9 09:49:08 2010
@@ -219,7 +219,8 @@ public class InjectionPointFactory
             //@Observes is not injection point type for method parameters
             if(parameter.getAnnotation(Observes.class) == null)
             {
-                point = getGenericInjectionPoint(owner, parameter.getAnnotations().toArray(new
Annotation[parameter.getAnnotations().size()]), parameter.getBaseType(), member , parameter);
+                point = getGenericInjectionPoint(owner, parameter.getAnnotations().toArray(new
Annotation[parameter.getAnnotations().size()]),
+                                                 parameter.getBaseType(), member , parameter);
                 lists.add(point);                
             }  
         }
@@ -243,7 +244,8 @@ public class InjectionPointFactory
             //@Observes is not injection point type for method parameters
             if(parameter.getAnnotation(Observes.class) == null)
             {
-                point = getGenericInjectionPoint(owner, parameter.getAnnotations().toArray(new
Annotation[parameter.getAnnotations().size()]), parameter.getBaseType(), method.getJavaMember()
, parameter);
+                point = getGenericInjectionPoint(owner, parameter.getAnnotations().toArray(new
Annotation[parameter.getAnnotations().size()]),
+                                                 parameter.getBaseType(), method.getJavaMember()
, parameter);
                 lists.add(point);                
             }  
         }
@@ -294,7 +296,8 @@ public class InjectionPointFactory
         
         for(AnnotatedParameter<?> parameter : parameters)
         {
-            point = getGenericInjectionPoint(owner, parameter.getAnnotations().toArray(new
Annotation[parameter.getAnnotations().size()]), parameter.getBaseType(), constructor.getJavaMember()
, parameter);
+            point = getGenericInjectionPoint(owner, parameter.getAnnotations().toArray(new
Annotation[parameter.getAnnotations().size()]),
+                                             parameter.getBaseType(), constructor.getJavaMember()
, parameter);
             lists.add(point);
         }
         
@@ -318,7 +321,8 @@ public class InjectionPointFactory
         
         for(AnnotatedParameter<?> parameter : parameters)
         {
-            point = getGenericInjectionPoint(owner, parameter.getAnnotations().toArray(new
Annotation[parameter.getAnnotations().size()]), parameter.getBaseType(), member , parameter);
+            point = getGenericInjectionPoint(owner, parameter.getAnnotations().toArray(new
Annotation[parameter.getAnnotations().size()]),
+                                             parameter.getBaseType(), member , parameter);
             lists.add(point);
         }
         

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorRuntimeSupport.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorRuntimeSupport.java?rev=952931&r1=952930&r2=952931&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorRuntimeSupport.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorRuntimeSupport.java
Wed Jun  9 09:49:08 2010
@@ -36,7 +36,8 @@ import org.apache.webbeans.component.Owb
  * override intercepted functions to first delegate to all 
  * registered {@link InterceptorHandler}s.</p>
  */
-public class InterceptorRuntimeSupport {
+public class InterceptorRuntimeSupport
+{
 
     /**
      * <p>Create a interceptor/decorator subclass for the given bean.</p>

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=952931&r1=952930&r2=952931&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
Wed Jun  9 09:49:08 2010
@@ -404,7 +404,8 @@ public final class InterceptorUtil
                 if (hasClassInterceptors)
                 {
                     throw new WebBeansConfigurationException("Simple web bean class : " +
clazz.getName()
-                                                             + " can not define non-static,
non-private final methods. Because it is annotated with at least one @InterceptorBinding");
+                                                             + " can not define non-static,
non-private final methods. "
+                                                             + "Because it is annotated with
at least one @InterceptorBinding");
                 }
                 else
                 {

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=952931&r1=952930&r2=952931&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 Jun  9 09:49:08 2010
@@ -49,7 +49,6 @@ import javax.enterprise.inject.spi.Annot
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.InjectionPoint;
 import javax.enterprise.inject.spi.ObserverMethod;
-import javax.enterprise.inject.spi.ProcessInjectionTarget;
 import javax.inject.Inject;
 import javax.inject.Named;
 import javax.interceptor.Interceptor;
@@ -65,7 +64,6 @@ import org.apache.webbeans.component.Pro
 import org.apache.webbeans.component.ResourceBean;
 import org.apache.webbeans.component.WebBeansType;
 import org.apache.webbeans.component.creation.AnnotatedTypeBeanCreatorImpl;
-import org.apache.webbeans.component.creation.ManagedBeanCreatorImpl;
 import org.apache.webbeans.config.DefinitionUtil;
 import org.apache.webbeans.config.OWBLogConst;
 import org.apache.webbeans.config.OpenWebBeansConfiguration;
@@ -259,9 +257,11 @@ public final class WebBeansAnnotatedType
                 Annotation[] annot = AnnotationUtil.getAnnotatedMethodFirstParameterQualifierWithGivenAnnotation(annotatedMethod,
Disposes.class);
 
                 Set<Bean<?>> set = InjectionResolver.getInstance().implResolveByType(type,
annot);
-                if (set.isEmpty()) {
+                if (set.isEmpty())
+                {
                     throw new UnsatisfiedResolutionException("Producer method component of
the disposal method : " + declaredMethod.getName() + 
-                                  " in class : " + declaredMethod.getDeclaringClass().getName()
+ ". Cannot find bean " + type + " with qualifier " + Arrays.toString(annot));
+                                  " in class : " + declaredMethod.getDeclaringClass().getName()
+ ". Cannot find bean " + type + " with qualifier "
+                                  + Arrays.toString(annot));
                 }
                 
                 Bean<?> foundBean = set.iterator().next();
@@ -426,7 +426,8 @@ public final class WebBeansAnnotatedType
                     //WebBeansUtil.checkForValidResources(annotatedField.getDeclaringType().getJavaClass(),
field.getType(), field.getName(), anns);
                     if(!ClassUtil.isStatic(field.getModifiers()))
                     {
-                        ResourceReference<X,Annotation> resourceRef = new ResourceReference<X,
Annotation>(bean.getBeanClass(), field.getName(), (Class<X>)field.getType(), resourceAnnotation);
+                        ResourceReference<X,Annotation> resourceRef = new ResourceReference<X,
Annotation>(bean.getBeanClass(), field.getName(),
+                                                                                        
                  (Class<X>)field.getType(), resourceAnnotation);
                         
                         //Can not define EL name
                         if(annotatedField.isAnnotationPresent(Named.class))
@@ -649,8 +650,6 @@ public final class WebBeansAnnotatedType
                     throw new WebBeansConfigurationException("Error in definining disposal
method of annotated method : " + annotatedMethod
                             + ". Multiple disposes annotation.");
                 }
-                else
-
                 found = true;
             }
         }
@@ -793,7 +792,8 @@ public final class WebBeansAnnotatedType
         managedBeanCreator.defineStereoTypes();
 
         //Scope type
-        managedBeanCreator.defineScopeType(logger.getTokenString(OWBLogConst.TEXT_MB_IMPL)
+ clazz.getName() + logger.getTokenString(OWBLogConst.TEXT_SAME_SCOPE));                 
                      
+        managedBeanCreator.defineScopeType(logger.getTokenString(OWBLogConst.TEXT_MB_IMPL)
+ clazz.getName()
+                                           + logger.getTokenString(OWBLogConst.TEXT_SAME_SCOPE));
                                       
         //Check for Enabled via Alternative
         WebBeansUtil.setInjectionTargetBeanEnableFlag(managedBean);        
         managedBeanCreator.defineApiType();

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansConstants.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansConstants.java?rev=952931&r1=952930&r2=952931&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansConstants.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansConstants.java
Wed Jun  9 09:49:08 2010
@@ -18,7 +18,6 @@
  */
 package org.apache.webbeans.util;
 
-import javax.enterprise.inject.spi.BeanManager;
 
 /**
  * Web beans related constants.
@@ -120,7 +119,7 @@ public final class WebBeansConstants
 
     public static final String WEB_BEANS_XML_ARRAY_ELEMENT = "Array";
 
-    /**JNDI name of the {@link BeanManager} instance*/
+    /**JNDI name of the {@link javax.enterprise.inject.spi.BeanManager} instance*/
     public static final String WEB_BEANS_MANAGER_JNDI_NAME = "java:comp/BeanManager";
 
 }

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=952931&r1=952930&r2=952931&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 Jun  9 09:49:08 2010
@@ -1143,10 +1143,12 @@ public final class WebBeansUtil
                 Class<?>[] params = clazzParameters.toArray(new Class<?>[0]);
 
                 if (params.length != 1 || !params[0].equals(InvocationContext.class))
+                {
                     throw new WebBeansConfigurationException("@" + annot.getSimpleName()
+ " annotated method : "
                             + method.getJavaMember().getName() + " in class : " + annotatedType.getJavaClass().getName()
                             + " can not take any formal arguments other than InvocationContext");
-
+                }
+                
                 if (!ClassUtil.getReturnType(method.getJavaMember()).equals(Object.class))
                 {
                     throw new WebBeansConfigurationException("@" + annot.getSimpleName()
+ " annotated method : "
@@ -1406,7 +1408,6 @@ public final class WebBeansUtil
     /**
      * Returns true if array contains the StereoType meta annotation
      *
-     * @param anns annotation array
      * @return true if array contains the StereoType meta annotation
      */
     public static boolean isComponentHasStereoType(OwbBean<?> component)
@@ -1647,10 +1648,10 @@ public final class WebBeansUtil
 
         Bean<?> superBean = null;
         Bean<?> specialized = null;
-        Set<Bean<?>> resolvers = null;
+        Set<Bean<?>> resolvers = isConfiguredWebBeans(specializedClass, true);
         AlternativesManager altManager = AlternativesManager.getInstance();
 
-        if ((resolvers = isConfiguredWebBeans(specializedClass, true)) != null)
+        if (resolvers != null)
         {
             if(resolvers.isEmpty())
             {
@@ -1769,7 +1770,11 @@ public final class WebBeansUtil
      */
     protected static void configSpecializedProducerMethodBeans(List<ProducerMethodBean>
sortedProducerBeans)
     {
-        if (sortedProducerBeans.isEmpty()) return;
+        if (sortedProducerBeans.isEmpty())
+        {
+            return;
+        }
+        
         AlternativesManager altManager = AlternativesManager.getInstance();
         Method superMethod = sortedProducerBeans.get(0).getCreatorMethod();
 
@@ -1814,7 +1819,9 @@ public final class WebBeansUtil
     public static void configureProducerMethodSpecializations()
     {
         Method method;
-        ProducerMethodBean pbean, pLeft, pRight;
+        ProducerMethodBean pbean;
+        ProducerMethodBean pLeft;
+        ProducerMethodBean pRight;
 
         logger.debug("configure Specialized producer beans has started.");
 
@@ -1865,7 +1872,10 @@ public final class WebBeansUtil
                     break;
                 }
             }
-            if (pbean == null) break;
+            if (pbean == null)
+            {
+                break;
+            }
 
             pLeft = pRight = pbean;
             boolean pLeftContinue = true;
@@ -1879,7 +1889,7 @@ public final class WebBeansUtil
                 {
                     //left
                     if (pLeft!= null &&
-                            pLeft.getBeanClass().getSuperclass().equals(pb.getBeanClass()))
+                        pLeft.getBeanClass().getSuperclass().equals(pb.getBeanClass()))
                     {
                         Method superMethod = ClassUtil.getClassMethodWithTypes(pb.getBeanClass(),
method.getName(),
                                 Arrays.asList(method.getParameterTypes()));
@@ -1894,7 +1904,10 @@ public final class WebBeansUtil
                         {
                             pLeft = null;
                         }
-                        if (pLeft != null) pLeftContinue = true;
+                        if (pLeft != null)
+                        {
+                            pLeftContinue = true;
+                        }
                     }
                     //right
                     if (pRight != null &&
@@ -2505,7 +2518,7 @@ public final class WebBeansUtil
     /**
      * Returns <code>ProcessAnnotatedType</code> event. 
      * @param <T> bean type
-     * @param clazz bean class
+     * @param annotatedType bean class
      * @return event
      */
     public static <T> GProcessAnnotatedType fireProcessAnnotatedTypeEvent(AnnotatedType<T>
annotatedType)
@@ -2541,7 +2554,6 @@ public final class WebBeansUtil
     /**
      * Returns <code>ProcessInjectionTarget</code> event.
      * @param <T> bean type
-     * @param bean bean instance
      * @return event
      */
     public static <T> GProcessInjectionTarget fireProcessInjectionTargetEventForJavaEeComponents(Class<T>
componentClass)



Mime
View raw message