openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1600923 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans: config/ portable/events/ portable/events/discovery/ portable/events/generics/ util/
Date Fri, 06 Jun 2014 15:29:20 GMT
Author: struberg
Date: Fri Jun  6 15:29:19 2014
New Revision: 1600923

URL: http://svn.apache.org/r1600923
Log:
OWB-966 implement ProcessSyntheticAnnotatedType

works in TCK already. Need to write a unit test for it though...

Added:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSyntheticAnnotatedTypeImpl.java
      - copied, changed from r1600744, openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticAnnotatedType.java
      - copied, changed from r1600744, openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java
Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.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/config/BeansDeployer.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/config/BeansDeployer.java?rev=1600923&r1=1600922&r2=1600923&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
Fri Jun  6 15:29:19 2014
@@ -59,6 +59,7 @@ import org.apache.webbeans.portable.Anno
 import org.apache.webbeans.portable.events.ProcessAnnotatedTypeImpl;
 import org.apache.webbeans.portable.events.ProcessBeanImpl;
 import org.apache.webbeans.portable.events.ProcessInjectionTargetImpl;
+import org.apache.webbeans.portable.events.ProcessSyntheticAnnotatedTypeImpl;
 import org.apache.webbeans.portable.events.discovery.AfterBeanDiscoveryImpl;
 import org.apache.webbeans.portable.events.discovery.AfterDeploymentValidationImpl;
 import org.apache.webbeans.portable.events.discovery.AfterTypeDiscoveryImpl;
@@ -705,8 +706,8 @@ public class BeansDeployer
         for (AnnotatedType<?> annotatedType : additionalAnnotatedTypes)
         {
             // Fires ProcessAnnotatedType
-            ProcessAnnotatedTypeImpl<?> processAnnotatedEvent =
-                    webBeansContext.getWebBeansUtil().fireProcessAnnotatedTypeEvent(annotatedType);
+            ProcessSyntheticAnnotatedTypeImpl<?> processAnnotatedEvent =
+                    webBeansContext.getWebBeansUtil().fireProcessSyntheticAnnotatedTypeEvent(annotatedType);
 
             if (!processAnnotatedEvent.isVeto())
             {

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java?rev=1600923&r1=1600922&r2=1600923&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java
Fri Jun  6 15:29:19 2014
@@ -24,8 +24,6 @@ import javax.enterprise.inject.spi.Proce
 /**
  * Default implementation of the {@link ProcessAnnotatedType}.
  * 
- * @version $Rev$ $Date$
- *
  * @param <X> bean class info
  */
 public class ProcessAnnotatedTypeImpl<X> implements ProcessAnnotatedType<X>

Copied: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSyntheticAnnotatedTypeImpl.java
(from r1600744, openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java)
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSyntheticAnnotatedTypeImpl.java?p2=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSyntheticAnnotatedTypeImpl.java&p1=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java&r1=1600744&r2=1600923&rev=1600923&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessAnnotatedTypeImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/ProcessSyntheticAnnotatedTypeImpl.java
Fri Jun  6 15:29:19 2014
@@ -19,23 +19,25 @@
 package org.apache.webbeans.portable.events;
 
 import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessSyntheticAnnotatedType;
 
 /**
- * Default implementation of the {@link ProcessAnnotatedType}.
- * 
- * @version $Rev$ $Date$
+ * Default implementation of the {@link javax.enterprise.inject.spi.ProcessSyntheticAnnotatedType}.
  *
  * @param <X> bean class info
  */
-public class ProcessAnnotatedTypeImpl<X> implements ProcessAnnotatedType<X>
+public class ProcessSyntheticAnnotatedTypeImpl<X> implements ProcessSyntheticAnnotatedType<X>
 {
+
+    private Extension source;
+
     /**Annotated Type*/
     private AnnotatedType<X> annotatedType = null;
-    
+
     /**veto or not*/
     private boolean veto = false;
-    
+
     /**
      * This field gets set to <code>true</code> when a custom AnnotatedType
      * got set in an Extension. In this case we must now take this modified
@@ -43,16 +45,19 @@ public class ProcessAnnotatedTypeImpl<X>
      */
     private boolean modifiedAnnotatedType = false;
 
-    /**
-     * Creates a new instance with the given annotated type.
-     * 
-     * @param annotatedType annotated type
-     */
-    public ProcessAnnotatedTypeImpl(AnnotatedType<X> annotatedType)
+
+    public ProcessSyntheticAnnotatedTypeImpl(AnnotatedType<X> annotatedType, Extension
source)
     {
         this.annotatedType = annotatedType;
+        this.source = source;
     }
-    
+
+    @Override
+    public Extension getSource()
+    {
+        return source;
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -71,10 +76,10 @@ public class ProcessAnnotatedTypeImpl<X>
         annotatedType = type;
         modifiedAnnotatedType = true;
     }
-    
+
     /**
      * Returns sets or not.
-     * 
+     *
      * @return set or not
      */
     public boolean isModifiedAnnotatedType()
@@ -90,10 +95,10 @@ public class ProcessAnnotatedTypeImpl<X>
     {
         veto = true;
     }
-    
+
     /**
      * Returns veto status.
-     * 
+     *
      * @return veto status
      */
     public boolean isVeto()

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java?rev=1600923&r1=1600922&r2=1600923&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/AfterTypeDiscoveryImpl.java
Fri Jun  6 15:29:19 2014
@@ -60,6 +60,7 @@ public class AfterTypeDiscoveryImpl impl
     @Override
     public void addAnnotatedType(AnnotatedType<?> type, String id)
     {
+        //X TODO evaluate and file Extension
         webBeansContext.getBeanManagerImpl().addAdditionalAnnotatedType(type, id);
     }
 }

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java?rev=1600923&r1=1600922&r2=1600923&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/discovery/ErrorStack.java
Fri Jun  6 15:29:19 2014
@@ -54,7 +54,15 @@ public class ErrorStack
             while(it.hasNext())
             {
                 Throwable t = it.next();
-                logger.log(Level.SEVERE, t.getMessage(), t);
+                String message = t.getMessage();
+                if (message != null && message.length() > 0)
+                {
+                    logger.log(Level.SEVERE, t.getMessage(), t);
+                }
+                else
+                {
+                    logger.log(Level.SEVERE, "unknown error", t);
+                }
             }
         }
     }

Copied: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticAnnotatedType.java
(from r1600744, openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java)
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticAnnotatedType.java?p2=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticAnnotatedType.java&p1=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java&r1=1600744&r2=1600923&rev=1600923&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessAnnotatedType.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/portable/events/generics/GProcessSyntheticAnnotatedType.java
Fri Jun  6 15:29:19 2014
@@ -19,15 +19,15 @@
 package org.apache.webbeans.portable.events.generics;
 
 import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.Extension;
+import org.apache.webbeans.portable.events.ProcessSyntheticAnnotatedTypeImpl;
 
-import org.apache.webbeans.portable.events.ProcessAnnotatedTypeImpl;
 
-@SuppressWarnings("unchecked")
-public class GProcessAnnotatedType extends ProcessAnnotatedTypeImpl implements GenericBeanEvent
+public class GProcessSyntheticAnnotatedType extends ProcessSyntheticAnnotatedTypeImpl implements
GenericBeanEvent
 {
-    public GProcessAnnotatedType(AnnotatedType annotatedType )
+    public GProcessSyntheticAnnotatedType(Extension source, AnnotatedType annotatedType)
     {
-        super(annotatedType);
+        super(annotatedType, source);
     }
 
     @Override
@@ -35,4 +35,5 @@ public class GProcessAnnotatedType exten
     {
         return getAnnotatedType().getJavaClass();
     }
+
 }

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=1600923&r1=1600922&r2=1600923&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
Fri Jun  6 15:29:19 2014
@@ -71,6 +71,7 @@ import org.apache.webbeans.portable.even
 import org.apache.webbeans.portable.events.generics.GProcessProducerField;
 import org.apache.webbeans.portable.events.generics.GProcessProducerMethod;
 import org.apache.webbeans.portable.events.generics.GProcessSessionBean;
+import org.apache.webbeans.portable.events.generics.GProcessSyntheticAnnotatedType;
 import org.apache.webbeans.spi.plugins.OpenWebBeansEjbPlugin;
 import org.apache.webbeans.spi.plugins.OpenWebBeansPlugin;
 
@@ -940,6 +941,28 @@ public final class WebBeansUtil
     }
 
     /**
+     * Returns <code>ProcessAnnotatedType</code> event.
+     * @param <T> bean type
+     * @param annotatedType bean class
+     * @return event
+     */
+    public <T> GProcessSyntheticAnnotatedType fireProcessSyntheticAnnotatedTypeEvent(AnnotatedType<T>
annotatedType)
+    {
+        Extension source = null; //X TODO
+        GProcessSyntheticAnnotatedType gProcessSyntheticAnnotatedType = new GProcessSyntheticAnnotatedType(source,
annotatedType);
+
+        //Fires ProcessSyntheticAnnotatedType
+        webBeansContext.getBeanManagerImpl().fireEvent(gProcessSyntheticAnnotatedType, AnnotationUtil.EMPTY_ANNOTATION_ARRAY);
+
+        if (gProcessSyntheticAnnotatedType.isModifiedAnnotatedType())
+        {
+            webBeansContext.getAnnotatedElementFactory().setAnnotatedType(gProcessSyntheticAnnotatedType.getAnnotatedType());
+        }
+
+        return gProcessSyntheticAnnotatedType;
+    }
+
+    /**
      * Returns <code>ProcessInjectionTarget</code> event.
      * @param <T> bean type
      * @return event
@@ -1169,6 +1192,7 @@ public final class WebBeansUtil
                type.equals(AfterDeploymentValidation.class) ||
                type.equals(BeforeShutdown.class) ||
                type.equals(GProcessAnnotatedType.class) ||
+               type.equals(GProcessSyntheticAnnotatedType.class) ||
                type.equals(GProcessInjectionTarget.class) ||
                type.equals(GProcessProducer.class) ||
                type.equals(GProcessProducerField.class) ||
@@ -1182,6 +1206,7 @@ public final class WebBeansUtil
     public static boolean isExtensionBeanEventType(Type type)
     {
         return type.equals(GProcessAnnotatedType.class) ||
+               type.equals(GProcessSyntheticAnnotatedType.class) ||
                type.equals(GProcessInjectionTarget.class) ||
                type.equals(GProcessManagedBean.class) ||
                type.equals(GProcessSessionBean.class) ||
@@ -1191,6 +1216,7 @@ public final class WebBeansUtil
     public static boolean isDefaultExtensionBeanEventType(Class<?> clazz)
     {
         return clazz.equals(ProcessAnnotatedType.class) ||
+               clazz.equals(ProcessSyntheticAnnotatedType.class) ||
                clazz.equals(ProcessInjectionTarget.class) ||
                clazz.equals(ProcessManagedBean.class) ||
                clazz.equals(ProcessBean.class) ||



Mime
View raw message