[jboss-cvs] jboss-seam/src/main/org/jboss/seam/interceptors ...

Gavin King gavin.king at jboss.com
Wed Jul 26 19:33:39 EDT 2006


  User: gavin   
  Date: 06/07/26 19:33:39

  Modified:    src/main/org/jboss/seam/interceptors   
                        SeamInvocationContext.java Interceptor.java
                        EventType.java
  Log:
  more lifecycle events
  
  Revision  Changes    Path
  1.8       +3 -1      jboss-seam/src/main/org/jboss/seam/interceptors/SeamInvocationContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SeamInvocationContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/SeamInvocationContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- SeamInvocationContext.java	26 Jul 2006 23:22:37 -0000	1.7
  +++ SeamInvocationContext.java	26 Jul 2006 23:33:39 -0000	1.8
  @@ -1,4 +1,4 @@
  -//$Id: SeamInvocationContext.java,v 1.7 2006/07/26 23:22:37 gavin Exp $
  +//$Id: SeamInvocationContext.java,v 1.8 2006/07/26 23:33:39 gavin Exp $
   package org.jboss.seam.interceptors;
   
   import java.lang.reflect.Method;
  @@ -61,6 +61,8 @@
               case AROUND_INVOKE: return interceptor.aroundInvoke(this);
               case POST_CONSTRUCT: return interceptor.postConstruct(this);
               case PRE_DESTORY: return interceptor.preDestroy(this);
  +            case PRE_PASSIVATE: return interceptor.prePassivate(this);
  +            case POST_ACTIVATE: return interceptor.postActivate(this);
               default: throw new IllegalArgumentException("no InvocationType");
            }
         }
  
  
  
  1.12      +27 -3     jboss-seam/src/main/org/jboss/seam/interceptors/Interceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Interceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/Interceptor.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- Interceptor.java	26 Jul 2006 23:22:37 -0000	1.11
  +++ Interceptor.java	26 Jul 2006 23:33:39 -0000	1.12
  @@ -1,4 +1,4 @@
  -//$Id: Interceptor.java,v 1.11 2006/07/26 23:22:37 gavin Exp $
  +//$Id: Interceptor.java,v 1.12 2006/07/26 23:33:39 gavin Exp $
   package org.jboss.seam.interceptors;
   
   import java.lang.annotation.Annotation;
  @@ -6,6 +6,8 @@
   
   import javax.annotation.PostConstruct;
   import javax.annotation.PreDestroy;
  +import javax.ejb.PostActivate;
  +import javax.ejb.PrePassivate;
   import javax.interceptor.AroundInvoke;
   import javax.interceptor.Interceptors;
   import javax.interceptor.InvocationContext;
  @@ -25,6 +27,8 @@
      private Method aroundInvokeMethod;
      private Method postConstructMethod;
      private Method preDestroyMethod;
  +   private Method postActivateMethod;
  +   private Method prePassivateMethod;
      private InterceptorType type;
      
      public Object getUserInterceptor()
  @@ -89,6 +93,14 @@
            {
               preDestroyMethod = method;
            }
  +         if ( method.isAnnotationPresent(PrePassivate.class) )
  +         {
  +            prePassivateMethod = method;
  +         }
  +         if ( method.isAnnotationPresent(PostActivate.class) )
  +         {
  +            postActivateMethod = method;
  +         }
   
            Class[] params = method.getParameterTypes();
            //if there is a method that takes the annotation, call it, to pass initialization info
  @@ -118,13 +130,25 @@
      {
         return postConstructMethod==null ?
               invocation.proceed() :
  -            Reflections.invoke( aroundInvokeMethod, userInterceptor, invocation );
  +            Reflections.invoke( postConstructMethod, userInterceptor, invocation );
      }
      public Object preDestroy(InvocationContext invocation) throws Exception
      {
         return preDestroyMethod==null ?
               invocation.proceed() :
  -            Reflections.invoke( aroundInvokeMethod, userInterceptor, invocation );
  +            Reflections.invoke( preDestroyMethod, userInterceptor, invocation );
  +   }
  +   public Object prePassivate(InvocationContext invocation) throws Exception
  +   {
  +      return prePassivateMethod==null ?
  +            invocation.proceed() :
  +            Reflections.invoke( prePassivateMethod, userInterceptor, invocation );
  +   }
  +   public Object postActivate(InvocationContext invocation) throws Exception
  +   {
  +      return postActivateMethod==null ?
  +            invocation.proceed() :
  +            Reflections.invoke( postActivateMethod, userInterceptor, invocation );
      }
      
   }
  
  
  
  1.2       +3 -1      jboss-seam/src/main/org/jboss/seam/interceptors/EventType.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: EventType.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/EventType.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- EventType.java	26 Jul 2006 23:23:20 -0000	1.1
  +++ EventType.java	26 Jul 2006 23:33:39 -0000	1.2
  @@ -4,5 +4,7 @@
   {
      AROUND_INVOKE,
      PRE_DESTORY,
  -   POST_CONSTRUCT
  +   POST_CONSTRUCT,
  +   PRE_PASSIVATE,
  +   POST_ACTIVATE
   }
  
  
  



More information about the jboss-cvs-commits mailing list