openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1504173 - in /openwebbeans/trunk: webbeans-cdi11/ webbeans-impl/src/main/java/org/apache/webbeans/component/creation/ webbeans-impl/src/main/java/org/apache/webbeans/intercept/ webbeans-impl/src/main/java/org/apache/webbeans/intercept/anno...
Date Wed, 17 Jul 2013 15:26:44 GMT
Author: rmannibucau
Date: Wed Jul 17 15:26:44 2013
New Revision: 1504173

URL: http://svn.apache.org/r1504173
Log:
OWB-884 basic @Priority support

Added:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/AroundConstruct.java
      - copied, changed from r1504132, openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/AroundConstruct.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/Priority.java
Removed:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/AroundConstruct.java
Modified:
    openwebbeans/trunk/webbeans-cdi11/pom.xml
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
    openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/constructor/AroundConstructTest.java

Modified: openwebbeans/trunk/webbeans-cdi11/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-cdi11/pom.xml?rev=1504173&r1=1504172&r2=1504173&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-cdi11/pom.xml (original)
+++ openwebbeans/trunk/webbeans-cdi11/pom.xml Wed Jul 17 15:26:44 2013
@@ -197,9 +197,13 @@
                             <value>import javax.enterprise.inject.Decorated</value>
                         </replacement>
                         <replacement>
-                            <token>import org.apache.webbeans.intercept.AroundConstruct</token>
+                            <token>import org.apache.webbeans.intercept.annotation.AroundConstruct</token>
                             <value>import javax.interceptor.AroundConstruct</value>
                         </replacement>
+                        <replacement>
+                            <token>import org.apache.webbeans.intercept.annotation.Priority</token>
+                            <value>import javax.annotation.Priority</value>
+                        </replacement>
                     </replacements>
                 </configuration>
             </plugin>

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java?rev=1504173&r1=1504172&r2=1504173&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/component/creation/InterceptorBeanBuilder.java
Wed Jul 17 15:26:44 2013
@@ -43,7 +43,7 @@ import org.apache.webbeans.component.Bea
 import org.apache.webbeans.component.InterceptorBean;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
-import org.apache.webbeans.intercept.AroundConstruct;
+import org.apache.webbeans.intercept.annotation.AroundConstruct;
 import org.apache.webbeans.plugins.OpenWebBeansEjbLCAPlugin;
 import org.apache.webbeans.util.Asserts;
 import org.apache.webbeans.util.ClassUtil;

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java?rev=1504173&r1=1504172&r2=1504173&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorComparator.java
Wed Jul 17 15:26:44 2013
@@ -44,8 +44,8 @@ public class InterceptorComparator<T> im
         }
         else
         {
-            Class<?> o1Clazz = o1.getBeanClass();
-            Class<?> o2Clazz = o2.getBeanClass();
+            final Class<?> o1Clazz = o1.getBeanClass();
+            final Class<?> o2Clazz = o2.getBeanClass();
 
             return interceptorsManager.compareCdiInterceptors(o1Clazz, o2Clazz);
 

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java?rev=1504173&r1=1504172&r2=1504173&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorsManager.java
Wed Jul 17 15:26:44 2013
@@ -41,6 +41,7 @@ import org.apache.webbeans.component.cre
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.container.BeanManagerImpl;
 import org.apache.webbeans.exception.WebBeansConfigurationException;
+import org.apache.webbeans.intercept.annotation.Priority;
 import org.apache.webbeans.util.AnnotationUtil;
 import org.apache.webbeans.util.Asserts;
 
@@ -156,6 +157,20 @@ public class InterceptorsManager
             throw new IllegalArgumentException(target.getName() + " is not an enabled interceptor!");
         }
 
+        final Priority p1 = src.getAnnotation(Priority.class);
+        final Priority p2 = target.getAnnotation(Priority.class);
+        if (p1 != null && p2 != null)
+        {
+            return p1.value() - p2.value();
+        }
+        if (p1 == null && p2 != null)
+        {
+            return -1;
+        }
+        if (p1 != null)
+        {
+            return 1;
+        }
 
         if (srcIndex == targetIndex)
         {

Copied: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/AroundConstruct.java
(from r1504132, openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/AroundConstruct.java)
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/AroundConstruct.java?p2=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/AroundConstruct.java&p1=openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/AroundConstruct.java&r1=1504132&r2=1504173&rev=1504173&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/AroundConstruct.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/AroundConstruct.java
Wed Jul 17 15:26:44 2013
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.webbeans.intercept;
+package org.apache.webbeans.intercept.annotation;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;

Added: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/Priority.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/Priority.java?rev=1504173&view=auto
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/Priority.java
(added)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/annotation/Priority.java
Wed Jul 17 15:26:44 2013
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.webbeans.intercept.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Priority
+{
+    int value();
+}

Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/constructor/AroundConstructTest.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/constructor/AroundConstructTest.java?rev=1504173&r1=1504172&r2=1504173&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/constructor/AroundConstructTest.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/interceptors/constructor/AroundConstructTest.java
Wed Jul 17 15:26:44 2013
@@ -18,7 +18,7 @@
  */
 package org.apache.webbeans.newtests.interceptors.constructor;
 
-import org.apache.webbeans.intercept.AroundConstruct;
+import org.apache.webbeans.intercept.annotation.AroundConstruct;
 import org.apache.webbeans.newtests.AbstractUnitTest;
 import org.junit.Ignore;
 import org.junit.Test;



Mime
View raw message