| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Seam
Revision: 8918
Author: pete.muir@jboss.org
Date: 05 Sep 2008 06:43:40
Changes:Add pree EE5 synonyms for PostActivate and PrePassivate
Files:| ... | ...@@ -13,6 +13,8 @@ | |
| 13 | 13 | import org.jboss.seam.Component; |
| 14 | 14 | import org.jboss.seam.annotations.intercept.AroundInvoke; |
| 15 | 15 | import org.jboss.seam.annotations.intercept.InterceptorType; |
| 16 | import org.jboss.seam.annotations.intercept.PostActivate; | |
| 17 | import org.jboss.seam.annotations.intercept.PrePassivate; | |
| 16 | 18 | import org.jboss.seam.util.Reflections; |
| 17 | 19 | |
| 18 | 20 | /** |
| ... | ...@@ -137,11 +139,11 @@ | |
| 137 | 139 | { |
| 138 | 140 | preDestroyMethod = method; |
| 139 | 141 | } |
| 140 | if ( method.isAnnotationPresent(PRE_PASSIVATE) ) | |
| 142 | if ( method.isAnnotationPresent(PRE_PASSIVATE) || method.isAnnotationPresent(PrePassivate.class) ) | |
| 141 | 143 | { |
| 142 | 144 | prePassivateMethod = method; |
| 143 | 145 | } |
| 144 | if ( method.isAnnotationPresent(POST_ACTIVATE) ) | |
| 146 | if ( method.isAnnotationPresent(POST_ACTIVATE) || method.isAnnotationPresent(PostActivate.class) ) | |
| 145 | 147 | { |
| 146 | 148 | postActivateMethod = method; |
| 147 | 149 | } |
| ... | ...@@ -232,7 +234,14 @@ | |
| 232 | 234 | { |
| 233 | 235 | Reflections.invokeAndWrap(annotationInjectorMethod, statelessUserInterceptorInstance, annotation); |
| 234 | 236 | } |
| 235 | return ((Boolean) Reflections.invokeAndWrap(interceptorEnabledMethod, statelessUserInterceptorInstance)); | |
| 237 | if (isOptimized()) | |
| 238 | { | |
| 239 | return ( (OptimizedInterceptor) statelessUserInterceptorInstance ).isInterceptorEnabled(); | |
| 240 | } | |
| 241 | else | |
| 242 | { | |
| 243 | return ((Boolean) Reflections.invokeAndWrap(interceptorEnabledMethod, statelessUserInterceptorInstance)); | |
| 244 | } | |
| 236 | 245 | } |
| 237 | 246 | else |
| 238 | 247 | { |
| ... | ...@@ -0,0 +1,20 @@ | |
| 1 | //$Id: AroundInvoke.java 5522 2007-06-25 22:28:50Z gavin $ | |
| 2 | package org.jboss.seam.annotations.intercept; | |
| 3 | ||
| 4 | import static java.lang.annotation.ElementType.METHOD; | |
| 5 | import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 6 | ||
| 7 | import java.lang.annotation.Documented; | |
| 8 | import java.lang.annotation.Retention; | |
| 9 | import java.lang.annotation.Target; | |
| 10 | ||
| 11 | /** | |
| 12 | * Synonym for {@link javax.ejb.PostActivate}, for | |
| 13 | * use in a pre Java EE 5 environment. | |
| 14 | * | |
| 15 | * @author Pete Muir | |
| 16 | */ | |
| 17 | @Target(METHOD) | |
| 18 | @Retention(RUNTIME) | |
| 19 | @Documented | |
| 20 | public @interface PostActivate {} |
| ... | ...@@ -0,0 +1,20 @@ | |
| 1 | //$Id: AroundInvoke.java 5522 2007-06-25 22:28:50Z gavin $ | |
| 2 | package org.jboss.seam.annotations.intercept; | |
| 3 | ||
| 4 | import static java.lang.annotation.ElementType.METHOD; | |
| 5 | import static java.lang.annotation.RetentionPolicy.RUNTIME; | |
| 6 | ||
| 7 | import java.lang.annotation.Documented; | |
| 8 | import java.lang.annotation.Retention; | |
| 9 | import java.lang.annotation.Target; | |
| 10 | ||
| 11 | /** | |
| 12 | * Synonym for {@link javax.ejb.PrePassivate}, for | |
| 13 | * use in a pre Java EE 5 environment. | |
| 14 | * | |
| 15 | * @author Pete Muir | |
| 16 | */ | |
| 17 | @Target(METHOD) | |
| 18 | @Retention(RUNTIME) | |
| 19 | @Documented | |
| 20 | public @interface PrePassivate {} |
| ... | ...@@ -5,9 +5,20 @@ | |
| 5 | 5 | * interceptor, to make the stacktrace smaller. |
| 6 | 6 | * |
| 7 | 7 | * @author Gavin King |
| 8 | * @author Pete Muir | |
| 8 | 9 | * |
| 9 | 10 | */ |
| 10 | 11 | public interface OptimizedInterceptor |
| 11 | 12 | { |
| 13 | ||
| 12 | 14 | public Object aroundInvoke(InvocationContext ic) throws Exception; |
| 15 | ||
| 16 | /** | |
| 17 | * Returns true if this interceptor should be enabled. The component and the | |
| 18 | * annotation will be injected into the interceptor instance before this | |
| 19 | * method is called, and can be used to decide whether the interceptor should | |
| 20 | * be enabled | |
| 21 | */ | |
| 22 | public boolean isInterceptorEnabled(); | |
| 23 | ||
| 13 | 24 | } |