openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r952420 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: component/ inject/
Date Mon, 07 Jun 2010 20:35:48 GMT
Author: struberg
Date: Mon Jun  7 20:35:47 2010
New Revision: 952420

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

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java?rev=952420&r1=952419&r2=952420&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/EventBean.java
Mon Jun  7 20:35:47 2010
@@ -41,10 +41,6 @@ public class EventBean<T> extends Abstra
 
     /**
      * Creates a new instance of event bean.
-     * 
-     * @param returnType Event class
-     * @param eventType event type
-     * @param definedType webbeans type
      */
     @SuppressWarnings("serial")
     public EventBean()
@@ -84,7 +80,8 @@ public class EventBean<T> extends Abstra
             }
             catch (Exception e)
             {
-                throw new WebBeansException("Exception in creating Event implicit component
for event type : " + eventType);
+                throw new WebBeansException("Exception in creating Event implicit component
for event type : "
+                                            + eventType);
             }           
             finally
             {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java?rev=952420&r1=952419&r2=952420&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InjectionPointBean.java
Mon Jun  7 20:35:47 2010
@@ -46,7 +46,8 @@ public class InjectionPointBean extends 
         {
             return local.get();
             
-        }finally
+        }
+        finally
         {
             local.set(null);
             local.remove();

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java?rev=952420&r1=952419&r2=952420&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/InstanceBean.java
Mon Jun  7 20:35:47 2010
@@ -46,7 +46,8 @@ public class InstanceBean<T> extends Abs
         try
         {
             ParameterizedType injectedType = (ParameterizedType)local.get().getType();
-            Instance<T> instance = InstanceFactory.getInstance(injectedType.getActualTypeArguments()[0],
local.get().getQualifiers().toArray(new Annotation[0])); 
+            Instance<T> instance = InstanceFactory.getInstance(injectedType.getActualTypeArguments()[0],
+                                                               local.get().getQualifiers().toArray(new
Annotation[0]));
             
             return instance;
         }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java?rev=952420&r1=952419&r2=952420&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ManagedBean.java
Mon Jun  7 20:35:47 2010
@@ -22,14 +22,13 @@ import java.io.Serializable;
 import java.lang.reflect.Constructor;
 
 import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.Decorator;
 
 import org.apache.webbeans.inject.InjectableConstructor;
 import org.apache.webbeans.intercept.InterceptorData;
 
 /**
- * Managed bean implementation of the {@link Bean}.
+ * Managed bean implementation of the {@link javax.enterprise.inject.spi.Bean}.
  * 
  * @version $Rev$ $Date$
  */

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewBean.java?rev=952420&r1=952419&r2=952420&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/NewBean.java
Mon Jun  7 20:35:47 2010
@@ -19,10 +19,9 @@
 package org.apache.webbeans.component;
 
 import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.New;
 
 /**
- * Component definition with {@link New} binding annotation.
+ * Component definition with {@link javax.enterprise.inject.New} binding annotation.
  * 
  * <p>
  * It is defined as concrete java class component.
@@ -63,7 +62,8 @@ public class NewBean<T> extends ManagedB
      * always true for New qualifier
      */
     @Override
-    public boolean isDependent() {
+    public boolean isDependent()
+    {
         return true;
     }
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java?rev=952420&r1=952419&r2=952420&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/OwbBean.java
Mon Jun  7 20:35:47 2010
@@ -26,8 +26,6 @@ import java.util.Set;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.*;
 
-import org.apache.webbeans.exception.WebBeansConfigurationException;
-
 /**
  * OWB specific extension of the {@link Bean} interface.
  * It is used internally. Do not use it. Instead use {@link AbstractOwbBean}
@@ -204,7 +202,7 @@ public interface OwbBean<T> extends Bean
     
     /**
      * If bean is passivation capable, it validate all of its dependencies.
-     * @throws WebBeansConfigurationException if not satisfy passivation dependencies
+     * @throws org.apache.webbeans.exception.WebBeansConfigurationException if not satisfy
passivation dependencies
      */
     public void validatePassivationDependencies();
 }
\ No newline at end of file

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java?rev=952420&r1=952419&r2=952420&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerFieldBean.java
Mon Jun  7 20:35:47 2010
@@ -97,7 +97,8 @@ public class ProducerFieldBean<T> extend
                 
                 instance = (T) producerField.get(parentInstance);
             }
-        }catch(Exception e)
+        }
+        catch(Exception e)
         {
             throw new WebBeansException(e);
         }
@@ -161,7 +162,10 @@ public class ProducerFieldBean<T> extend
      */
     protected void checkNullInstance(Object instance)
     {
-        String errorMessage = "WebBeans producer field : " + producerField.getName() + "
return type in the component implementation class : " + this.ownerComponent.getReturnType().getName()
+ " scope must be @Dependent to create null instance";
+        String errorMessage = "WebBeans producer field : " + producerField.getName() +
+                              " return type in the component implementation class : " +
+                              this.ownerComponent.getReturnType().getName() +
+                              " scope must be @Dependent to create null instance";
         WebBeansUtil.checkNullInstance(instance, this.getScope(), errorMessage);
     }
 
@@ -170,7 +174,10 @@ public class ProducerFieldBean<T> extend
      */
     protected void checkScopeType()
     {
-        String errorMessage = "WebBeans producer method : " + producerField.getName() + "
return type in the component implementation class : " + this.ownerComponent.getReturnType().getName()
+ " with passivating scope @" + this.getScope().getName() + " must be Serializable";
+        String errorMessage = "WebBeans producer method : " + producerField.getName() +
+                              " return type in the component implementation class : " +
+                              this.ownerComponent.getReturnType().getName() + " with passivating
scope @" +
+                              this.getScope().getName() + " must be Serializable";
         WebBeansUtil.checkSerializableScopeType(this.getScope(), this.isSerializable(), errorMessage);
     }
     

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java?rev=952420&r1=952419&r2=952420&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ProducerMethodBean.java
Mon Jun  7 20:35:47 2010
@@ -106,7 +106,10 @@ public class ProducerMethodBean<T> exten
     {
         if (this.disposalMethod != null)
         {
-            throw new WebBeansConfigurationException("There are multiple disposal method
for producer method component with name : " + getName() + " with implementation class " +
getParent().getReturnType().getName() + " with disposal method name : " + disposalMethod.getName());
+            throw new WebBeansConfigurationException("There are multiple disposal method
for producer method " +
+                    "component with name : " + getName() + " with implementation class "
+
+                    getParent().getReturnType().getName() + " with disposal method name :
" +
+                    disposalMethod.getName());
         }
         this.disposalMethod = disposalMethod;
     }
@@ -171,9 +174,12 @@ public class ProducerMethodBean<T> exten
         Object parentInstance = null;
         CreationalContext<?> parentCreational = null;
         InjectableMethods<T> m = null;
-        List<DependentCreationalContext<Object>> oldDependents = AbstractInjectable.dependentInstanceOfProducerMethods.get();
+        List<DependentCreationalContext<Object>> oldDependents =
+                AbstractInjectable.dependentInstanceOfProducerMethods.get();
+
         try
         {
+            //X TODO dependentInstanceOfProducerMethods MUST NOT be public! 
             AbstractInjectable.dependentInstanceOfProducerMethods.set(new ArrayList<DependentCreationalContext<Object>>());
             parentCreational = getManager().createCreationalContext(this.ownerComponent);
             
@@ -199,11 +205,13 @@ public class ProducerMethodBean<T> exten
             {
                 if(oldDependents == null && injectionTargetInstance != null)
                 {
-                    ((CreationalContextImpl)creationalContext).addDependent(injectionTargetInstance.get(),
this , instance);
+                    ((CreationalContextImpl)creationalContext).addDependent(injectionTargetInstance.get(),
+                                                                            this , instance);
                 }
                 else
                 {
-                    DependentCreationalContext<Object> dependentCreational = new DependentCreationalContext<Object>((Contextual<Object>)this);
+                    DependentCreationalContext<Object> dependentCreational =
+                            new DependentCreationalContext<Object>((Contextual<Object>)this);
                     dependentCreational.setInstance(instance);
                     dependentCreational.setDependentType(DependentType.BEAN);
 
@@ -212,12 +220,14 @@ public class ProducerMethodBean<T> exten
             }
             else
             {
-                List<DependentCreationalContext<Object>> dependents = AbstractInjectable.dependentInstanceOfProducerMethods.get();
+                List<DependentCreationalContext<Object>> dependents =
+                        AbstractInjectable.dependentInstanceOfProducerMethods.get();
                 if(dependents != null)
                 {
                     for(DependentCreationalContext<Object> dependent : dependents)
                     {
-                        ((CreationalContextImpl)creationalContext).addDependent(instance,
dependent.getContextual() , dependent.getInstance());
+                        ((CreationalContextImpl)creationalContext).addDependent(instance,
dependent.getContextual(),
+                                                                                dependent.getInstance());
                     }
                 }
             }
@@ -235,11 +245,13 @@ public class ProducerMethodBean<T> exten
                         {
                             if(oldDependents == null && injectionTargetInstance !=
null)
                             {
-                                ((CreationalContextImpl)creationalContext).addDependent(injectionTargetInstance.get(),
this , instance);
+                                ((CreationalContextImpl)creationalContext).addDependent(injectionTargetInstance.get(),
+                                                                                        this
, instance);
                             }
                             else
                             {
-                                DependentCreationalContext<Object> dependentCreational
= new DependentCreationalContext<Object>((Contextual<Object>)bean);
+                                DependentCreationalContext<Object> dependentCreational
=
+                                        new DependentCreationalContext<Object>((Contextual<Object>)bean);
                                 dependentCreational.setInstance(dependents.get(bean));
                                 dependentCreational.setDependentType(DependentType.BEAN);
                                 oldDependents.add(dependentCreational);                 
                                          
@@ -247,7 +259,8 @@ public class ProducerMethodBean<T> exten
                         }
                         else
                         {
-                            ((CreationalContextImpl)creationalContext).addDependent(instance,
bean , dependents.get(bean));   
+                            ((CreationalContextImpl)creationalContext).addDependent(instance,
bean ,
+                                                                                    dependents.get(bean));
  
                         }
                     }
                 }
@@ -356,7 +369,10 @@ public class ProducerMethodBean<T> exten
      */
     protected void checkNullInstance(Object instance)
     {
-        String errorMessage = "WebBeans producer method : " + creatorMethod.getName() + "
return type in the component implementation class : " + this.ownerComponent.getReturnType().getName()
+ " scope type must be @Dependent to create null instance";
+        String errorMessage = "WebBeans producer method : " + creatorMethod.getName() +
+                              " return type in the component implementation class : " +
+                              this.ownerComponent.getReturnType().getName() +
+                              " scope type must be @Dependent to create null instance";
         WebBeansUtil.checkNullInstance(instance, this.getScope(), errorMessage);
     }
 
@@ -365,7 +381,10 @@ public class ProducerMethodBean<T> exten
      */
     protected void checkScopeType()
     {
-        String errorMessage = "WebBeans producer method : " + creatorMethod.getName() + "
return type in the component implementation class : " + this.ownerComponent.getReturnType().getName()
+ " with passivating scope @" + this.getScope().getName() + " must be Serializable";
+        String errorMessage = "WebBeans producer method : " + creatorMethod.getName() +
+                              " return type in the component implementation class : " +
+                              this.ownerComponent.getReturnType().getName() + " with passivating
scope @" +
+                              this.getScope().getName() + " must be Serializable";
         WebBeansUtil.checkSerializableScopeType(this.getScope(), this.isSerializable(), errorMessage);
 
     }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java?rev=952420&r1=952419&r2=952420&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/ResourceBean.java
Mon Jun  7 20:35:47 2010
@@ -37,7 +37,8 @@ public class ResourceBean<X, T extends A
     
     private ResourceReference<X,T> resourceReference = null;
     
-    public ResourceBean(Class<X> returnType, InjectionTargetBean<?> ownerBean,
ResourceReference<X, T> resourceReference)
+    public ResourceBean(Class<X> returnType, InjectionTargetBean<?> ownerBean,
+                        ResourceReference<X, T> resourceReference)
     {
         super(ownerBean, returnType);
         this.resourceReference = resourceReference;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java?rev=952420&r1=952419&r2=952420&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/WebBeansType.java
Mon Jun  7 20:35:47 2010
@@ -18,7 +18,6 @@
  */
 package org.apache.webbeans.component;
 
-import javax.enterprise.inject.Produces;
 
 /**
  * There are different <i>Web Beans Component</i> with regard to the definition.
@@ -36,10 +35,10 @@ import javax.enterprise.inject.Produces;
  * <p>
  * Producer Method Components are defined within the class that is annotated
  * with {@link OwbBean} annotation. In these classes, there are methods that
- * are annotated with {@link Produces} annotation. These methods become the
- * producer method components of this web beans component. It maybe defined
- * using the web-beans.xml file using the &lt;producer&gt; element. It is
- * possible to mix these two definitons.
+ * are annotated with {@link javax.enterprise.inject.Produces} annotation.
+ * These methods become the producer method components of this web beans component.
+ * It maybe defined using the web-beans.xml file using the &lt;producer&gt; element.
+ * It is possible to mix these two definitons.
  * </p>
  * <p>
  * For further details about the components, see Web Beans Specification

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java?rev=952420&r1=952419&r2=952420&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/inject/AbstractInjectable.java
Mon Jun  7 20:35:47 2010
@@ -69,15 +69,16 @@ public abstract class AbstractInjectable
     protected Member injectionMember;
     
     public static ThreadLocal<Object> instanceUnderInjection = new ThreadLocal<Object>();
-    
+
+    //X TODO this MUST NOT be public! 
     public static ThreadLocal<List<DependentCreationalContext<Object>>>
dependentInstanceOfProducerMethods = 
         new ThreadLocal<List<DependentCreationalContext<Object>>>();
 
     /**
      * Creates a new injectable.
      * 
-     * @param bean owner bean
-     * @param creaitonalContext creational context instance
+     * @param injectionOwnerBean owner bean
+     * @param injectionOwnerCreationalContext creational context instance
      */
     protected AbstractInjectable(OwbBean<?> injectionOwnerBean, CreationalContext<?>
injectionOwnerCreationalContext)
     {



Mime
View raw message