+1,

webbeans-core must not depend on any Java EE libraries. We use plugins for 
these 
kind of technology dependencies.


--Gurkan


________________________________
From: Mark Struberg <[email protected]>
To: [email protected]
Sent: Mon, July 26, 2010 5:15:49 PM
Subject: Re: svn commit: r979071 - in /openwebbeans/trunk: webbeans-ejb/ 
webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/ 
webbeans-impl/ webbeans-impl/src/main/java/org/apache/webbeans/intercept/ 
webbeans-impl/src/main/java/org/apache/webbeans...

txs Gurkan!

The patch was a good start, but it seems we need to revert for now anyway since 
this introduced a hardcoded EJB dependency in webbeans-impl. See OWB-422 for 
more info.

LieGrue,
strub

PS: this part looks easy on the first glance, but there was a good reason why 
it 

was left aside for such a long time :)



----- Original Message ----
> From: Gurkan Erdogdu <[email protected]>
> To: [email protected]
> Sent: Mon, July 26, 2010 4:10:30 PM
> Subject: Re: svn commit: r979071 - in /openwebbeans/trunk: webbeans-ejb/ 
>webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/ 
>webbeans-impl/ webbeans-impl/src/main/java/org/apache/webbeans/intercept/ 
>webbeans-impl/src/main/java/org/apache/webbeans...
> 
> Hello,
> 
> This commit breaks following TCK tests,
> 
> 1-  DecoratorAndInterceptorTest # testInterceptorCalledBeforeDecorator
> 2-  InterceptorCalledBeforeDecoratorTest #  
>testInterceptorCalledBeforeDecorator
> 
> --Gurkan
> 
> 
> 
> 
> ________________________________
> From:  "[email protected]" <[email protected]>
> To: [email protected]
> Sent:  Sun, July 25, 2010 8:10:37 PM
> Subject: svn commit: r979071 - in  /openwebbeans/trunk: webbeans-ejb/ 
> webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/ 
> webbeans-impl/ webbeans-impl/src/main/java/org/apache/webbeans/intercept/ 
> webbeans-impl/src/main/java/org/apache/webbeans...
> 
> Author:  covener
> Date: Sun Jul 25 17:10:36 2010
> New Revision: 979071
> 
> URL: http://svn.apache.org/viewvc?rev=979071&view=rev
> Log:
> OWB-384  OWB-422
> 
> Enable 299-defined interceptors for EJB lifecycle callbacks  @AroundTimeout, 
> @PrePassivate, and @PostActivate.
> 
> 
> Submitted By:  Paul Reder
> Reviewed By: covener
> 
> 
> Modified:
>      openwebbeans/trunk/webbeans-ejb/pom.xml
>    
>openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
>
>a
> 
>      openwebbeans/trunk/webbeans-impl/pom.xml
>    
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java
>
>a
> 
>      
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
>
>a
> 
>      
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorType.java
>
>a
> 
>      
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
>
>a
> 
>      
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
>
>a
> 
>      
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
>
>a
> 
>      
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
>
>a
> 
> 
> Modified:  openwebbeans/trunk/webbeans-ejb/pom.xml
> URL: 
>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/pom.xml?rev=979071&r1=979070&r2=979071&view=diff
>
>f
> 
> ==============================================================================
> ---  openwebbeans/trunk/webbeans-ejb/pom.xml (original)
> +++  openwebbeans/trunk/webbeans-ejb/pom.xml Sun Jul 25 17:10:36 2010
> @@ -33,6  +33,12 @@
>         <groupId>org.apache.openwebbeans</groupId>
>         <artifactId>openwebbeans-impl</artifactId>
>      </dependency>
> +
> +       <dependency>
> +             <groupId>org.apache.geronimo.specs</groupId>
> +             <artifactId>geronimo-ejb_3.0_spec</artifactId>
> +            <optional>true</optional>
> +        </dependency>
>        
>          <dependency>
>              <groupId>org.apache.geronimo.specs</groupId>
> 
> Modified: 
>openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
>
>a
> 
> URL: 
>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java?rev=979071&r1=979070&r2=979071&view=diff
>
>f
> 
> ==============================================================================
> --- 
>openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
>
>a
>  > (original)
> +++ 
>openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
>
>a
>   Sun Jul 25 17:10:36 2010
> @@ -35,12 +35,15 @@ import  javassist.util.proxy.ProxyObject;
> 
> import  javax.annotation.PostConstruct;
> import  javax.annotation.PreDestroy;
> +import javax.ejb.PostActivate;
> +import  javax.ejb.PrePassivate;
> import  javax.enterprise.context.ApplicationScoped;
> import  javax.enterprise.context.RequestScoped;
> import  javax.enterprise.context.spi.Context;
> import  javax.enterprise.context.spi.CreationalContext;
> import  javax.enterprise.inject.spi.Bean;
> import  javax.interceptor.AroundInvoke;
> +import  javax.interceptor.AroundTimeout;
> import  javax.interceptor.InvocationContext;
> 
> import  org.apache.webbeans.component.InjectionTargetBean;
> @@ -213,7 +216,48 @@  public class OpenWebBeansEjbInterceptor 
>        
>          return rv.RETURN_VALUE;
>       }
> -    
> +
> +    /**
> +     * Around  Timeout.
> +     * @param context invocation ctx
> +      */
> +    @AroundTimeout
> +    public Object  callAroundTimeouts(InvocationContext context) throws 
> Exception
> +     {
> +        Object retVal = null;
> +         InjectionTargetBean<?> injectionTarget =  (InjectionTargetBean<?>) 
> threadLocal.get();
> +
> +         logger.debug("OpenWebBeansEjbInterceptor: @AroundTimeout called.  
>Trying 
>
> to run Interceptors.");
> +
> +         if(injectionTarget != null)
> +        {
> +             if 
>(WebBeansUtil.isContainsInterceptorMethod(injectionTarget.getInterceptorStack(),
> 
>
> 
> InterceptorType.AROUND_TIMEOUT))
> +             {                
> +                 InvocationContextImpl impl =  new 
> InvocationContextImpl(null, 
>
>
> context.getTarget(), null, null, 
> 
> +                        
> InterceptorUtil.getInterceptorMethods(injectionTarget.getInterceptorStack(), 
> InterceptorType.AROUND_TIMEOUT), InterceptorType.AROUND_TIMEOUT);
> +                  
>impl.setCreationalContext(threadLocalCreationalContext.get());
> +                 try
> +                 {
> +                     //run OWB interceptors
> +                     impl.proceed();
> +                    
> +                     //run EJB  interceptors
> +                     retVal = context.proceed();
> +                 }
> +                 catch (Exception e)
> +                 {
> +                     logger.error(OWBLogConst.ERROR_0008, e, 
> "@AroundTimeout.");    
> 
> +                     throw new RuntimeException(e);
> +                 }
> +            }                        
> +        }
> +        else 
> +        { 
> +             runPrePostForNonContextual(context, 
> InterceptorType.AROUND_TIMEOUT);    // TODO: Is this required for  activate? 
> It 
>
>
> was in POST_CONSTUCT code.
> +         }
> +        return retVal;
> +     }
> +
>      /**
>       * Post construct.
>        * @param context invocation ctx
> @@ -265,7 +309,88 @@ public  class OpenWebBeansEjbInterceptor 
>               }
>          }
>      }
> -    
> +
> +    /**
> +     * Post activate.
> +      */
> +    @PostActivate
> +    public void  afterActivate(InvocationContext context)
> +    {
> +         InjectionTargetBean<?> injectionTarget =  (InjectionTargetBean<?>) 
> threadLocal.get();
> +
> +         logger.debug("OpenWebBeansEjbInterceptor: @PostActivate called.  
>Trying 
>
> to run Interceptors.");
> +
> +         if(injectionTarget != null)
> +        {
> +             if 
>(WebBeansUtil.isContainsInterceptorMethod(injectionTarget.getInterceptorStack(),
> 
>
> 
> InterceptorType.POST_ACTIVATE))
> +             {                
> +                 InvocationContextImpl impl =  new 
> InvocationContextImpl(null, 
>
>
> context.getTarget(), null, null, 
> 
> +                                                                        
> InterceptorUtil.getInterceptorMethods(
> +                                                                             
>  


> injectionTarget.getInterceptorStack(),
> +                                                                             
>  


> InterceptorType.POST_ACTIVATE),
> +                                                                        
> InterceptorType.POST_ACTIVATE);
> +                  
>impl.setCreationalContext(threadLocalCreationalContext.get());
> +                 try
> +                 {
> +                     //run OWB interceptors
> +                     impl.proceed();
> +
> +                     //run EJB  interceptors
> +                     context.proceed();
> +                 }
> +                catch  (Exception e)
> +                 {
> +                     logger.error(OWBLogConst.ERROR_0008, e, 
>"@PostActivate.");  
>
>  
> 
> +                     throw new RuntimeException(e);
> +                 }
> +            }                        
> +        }
> +         else
> +        {
> +             runPrePostForNonContextual(context, 
> InterceptorType.POST_ACTIVATE);    // TODO: Is this required for  activate? 
> It 


> was in POST_CONSTUCT code.
> +         }
> +    }
> +
> +    /**
> +     * Pre  Passivate.
> +     */
> +    @PrePassivate
> +     public void beforePassivate(InvocationContext context)
> +     {
> +        InjectionTargetBean<?> injectionTarget =  (InjectionTargetBean<?>) 
> threadLocal.get();
> +
> +         logger.debug("OpenWebBeansEjbInterceptor: @PrePassivate called.  
>Trying 
>
> to run Interceptors.");
> +
> +         if(injectionTarget != null)
> +        {
> +             if 
>(WebBeansUtil.isContainsInterceptorMethod(injectionTarget.getInterceptorStack(),
> 
>
> 
> InterceptorType.PRE_PASSIVATE))
> +             {                
> +                 InvocationContextImpl impl =  new 
> InvocationContextImpl(null, 
>
>
> context.getTarget(), null, null, 
> 
> +                                                                        
> InterceptorUtil.getInterceptorMethods(
> +                                                                             
>  


> injectionTarget.getInterceptorStack(),
> +                                                                             
>  


> InterceptorType.PRE_PASSIVATE),
> +                                                                        
> InterceptorType.PRE_PASSIVATE);
> +                  
>impl.setCreationalContext(threadLocalCreationalContext.get());
> +                 try
> +                 {
> +                     //Call OWB interceptord
> +                     impl.proceed();
> +
> +                     //Call EJB  interceptors
> +                     context.proceed();
> +                 }
> +                catch  (Exception e)
> +                 {
> +                     logger.error(OWBLogConst.ERROR_0008, e, 
>"@PrePassivate.");
> +                     throw new  RuntimeException(e);
> +                 }
> +            }                        
> +         }
> +        else
> +         {
> +             runPrePostForNonContextual(context, 
> InterceptorType.PRE_PASSIVATE);     // TODO: Is this required for passivate? 
> It 
>
>
> was in the PRE_DESTROY  code.
> +        }
> +    }    
>      /**
>       * Pre destroy.
>        * @param context invocation context
> @@ -501,7 +626,10 @@ public class  OpenWebBeansEjbInterceptor 
> 
>               List<Object> decorators = null;
>               DelegateHandler delegateHandler = null;
> -             logger.debug("Decorator stack for target {0}", 
> injectionTarget.getDecoratorStack());
> +             if (logger.wblWillLogDebug())
> +             {
> +                 logger.debug("Decorator stack for target {0}", 
> injectionTarget.getDecoratorStack());
> +             }
> 
>              if  (injectionTarget.getDecoratorStack().size() > 0)
>               {
> 
> Modified:  openwebbeans/trunk/webbeans-impl/pom.xml
> URL: 
>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/pom.xml?rev=979071&r1=979070&r2=979071&view=diff
>
>f
> 
> ==============================================================================
> ---  openwebbeans/trunk/webbeans-impl/pom.xml (original)
> +++  openwebbeans/trunk/webbeans-impl/pom.xml Sun Jul 25 17:10:36 2010
> @@ -78,6  +78,12 @@
>               <artifactId>geronimo-atinject_1.0_spec</artifactId>
>               <optional>true</optional>
>           </dependency>
> +        
> +        <dependency>
> +              <groupId>org.apache.geronimo.specs</groupId>
> +              <artifactId>geronimo-ejb_3.0_spec</artifactId>
> +             <optional>true</optional>
> +         </dependency>
> 
>           <dependency>
>               <groupId>org.apache.openwebbeans</groupId>
> 
> Modified: 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java
>
>a
> 
> URL: 
>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java?rev=979071&r1=979070&r2=979071&view=diff
>
>f
> 
> ==============================================================================
> --- 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java
>
>a
>  > (original)
> +++ 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java
>
>a
>   Sun Jul 25 17:10:36 2010
> @@ -55,6 +55,13 @@ public interface  InterceptorData
>      public Method  getPostConstruct();
> 
>      /**
> +     * Gets {...@link  javax.ejb.PostActivate} annotated method if exist
> +     * return  null otherwise. 
> +     * @return post-activate method
> +      */
> +    public Method getPostActivate();
> +    
> +    /**
>       * Gets the {...@link  javax.annotation.PreDestroy} annotated method
>       * if  exist, returns null otherwise. 
>       * @return pre-destroy  method
> @@ -62,6 +69,13 @@ public interface InterceptorData
>       public Method getPreDestroy();
> 
>      /**
> +     *  Gets {...@link javax.ejb.PrePassivate} annotated method if exist
> +      * return null otherwise. 
> +     * @return pre-passivate  method
> +     */
> +    public Method  getPrePassivate();
> +    
> +    /**
>        * Gets {...@link javax.interceptor.AroundInvoke} annotated method
>        * if exist, returns null otherwise. 
>       *  @return around invoke method
> @@ -69,6 +83,13 @@ public interface  InterceptorData
>      public Method getAroundInvoke();
>      
>      /**
> +     * Gets {...@link  javax.interceptor.AroundTimeout} annotated method
> +     * if exist,  returns null otherwise. 
> +     * @return around timeout  method
> +     */
> +    public Method  getAroundTimeout();
> +    
> +    /**
>        * Gets interceptor method that this
>       * interceptor  data contains. It is one of
>       * the post construct,  pre-destroy or around-invoke.
> 
> Modified: 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
>
>a
> 
> URL: 
>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java?rev=979071&r1=979070&r2=979071&view=diff
>
>f
> 
> ==============================================================================
> --- 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
>
>a
>  > (original)
> +++ 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
>
>a
>   Sun Jul 25 17:10:36 2010
> @@ -48,13 +48,22 @@ public class  InterceptorDataImpl impleme
>    
>      /** Around  invokes method */
>      private Method aroundInvoke =  null;
> +    
> +    /** Around timeout method  */
> +    private Method aroundTimeout = null;
> 
>       /** Post construct methods */
>      private Method postConstruct =  null;
> 
> +    /** Post activate method */
> +     private Method postActivate = null;
> +    
>      /**  Predestroy Method */
>      private Method preDestroy =  null;
> 
> +    /** Prepassivate Method */
> +    private  Method prePassivate = null;
> +    
>      private  Interceptor<?> webBeansInterceptor;
> 
>      /** Defined in  the interceptor or bean */
> @@ -134,6 +143,17 @@ public class  InterceptorDataImpl impleme
>      /*
>       *  (non-Javadoc)
>       * @see
> +     *  
>org.apache.webbeans.intercept.InterceptorData#addAroundTimeout(java.lang
> +      * .reflect.Method)
> +     */
> +    public void  setAroundTimeout(Method m)
> +    {
> +         this.aroundTimeout = m;
> +    }
> +    
> +     /*
> +     * (non-Javadoc)
> +     * @see
>        *  
>org.apache.webbeans.intercept.InterceptorData#addPostConstruct(java.lang
>        * .reflect.Method)
>       */
> @@ -145,6  +165,17 @@ public class InterceptorDataImpl impleme
>       /*
>       * (non-Javadoc)
>       *  @see
> +     *  
>org.apache.webbeans.intercept.InterceptorData#addPostActivate(java.lang
> +      * .reflect.Method)
> +     */
> +    protected  void setPostActivate(Method m)
> +    {
> +         this.postActivate = m;
> +    }
> +    
> +     /*
> +     * (non-Javadoc)
> +     * @see
>        *  
org.apache.webbeans.intercept.InterceptorData#addPreDestroy(java.lang
>        * .reflect.Method)
>       */
> @@ -155,6 +186,17  @@ public class InterceptorDataImpl impleme
> 
>      /*
>        * (non-Javadoc)
> +     * @see
> +     *  
>org.apache.webbeans.intercept.InterceptorData#addPrePassivate(java.lang
> +      * .reflect.Method)
> +     */
> +    protected  void setPrePassivate(Method m)
> +    {
> +         this.prePassivate = m;
> +    }
> +    
> +     /*
> +     * (non-Javadoc)
>       * @see  org.apache.webbeans.intercept.InterceptorData#getPostConstruct()
>        */
>      public Method getPostConstruct()
> @@ -164,6  +206,15 @@ public class InterceptorDataImpl impleme
> 
>       /*
>       * (non-Javadoc)
> +     * @see  org.apache.webbeans.intercept.InterceptorData#getPostActivate()
> +      */
> +    public Method getPostActivate()
> +     {
> +        return this.postActivate;
> +     }
> +    
> +    /*
> +     *  (non-Javadoc)
>       * @see  org.apache.webbeans.intercept.InterceptorData#getPreDestroy()
>        */
>      public Method getPreDestroy()
> @@ -173,6 +224,15  @@ public class InterceptorDataImpl impleme
> 
>      /*
>        * (non-Javadoc)
> +     * @see  org.apache.webbeans.intercept.InterceptorData#getPrePassivate()
> +      */
> +    public Method getPrePassivate()
> +     {
> +        return this.prePassivate;
> +     }
> +    
> +    /*
> +     *  (non-Javadoc)
>       * @see  org.apache.webbeans.intercept.InterceptorData#getAroundInvoke()
>        */
>      public Method getAroundInvoke()
> @@ -182,6 +242,15  @@ public class InterceptorDataImpl impleme
> 
>      /*
>        * (non-Javadoc)
> +     * @see  org.apache.webbeans.intercept.InterceptorData#getAroundTimeout()
> +      */
> +    public Method getAroundTimeout()
> +     {
> +        return this.aroundTimeout;
> +     }
> +    
> +    /*
> +     *  (non-Javadoc)
>       * @see
>       * 
> org.apache.webbeans.intercept.InterceptorData#isDefinedInInterceptorClass
>        * ()
> @@ -273,14 +342,26 @@ public class InterceptorDataImpl  impleme
>          {
>               return aroundInvoke;
>          }
> +         else if (aroundTimeout != null)
> +         {
> +            return aroundTimeout;
> +         }
>          else if (postConstruct !=  null)
>          {
>               return postConstruct;
>          }
> +         else if (postActivate != null)
> +         {
> +            return  postActivate;
> +        }
>           else if (preDestroy != null)
>          {
>               return preDestroy;
>           }
> +        else if (prePassivate != null)
> +         {
> +            return  prePassivate;
> +        }
> 
>           return null;
>      }
> @@ -288,7 +369,7 @@ public class  InterceptorDataImpl impleme
>      @Override
>      public  boolean isLifecycleInterceptor()
>      {
> -         if(this.preDestroy != null || this.postConstruct != null)
> +         if(this.preDestroy != null || this.postConstruct != null || 
> this.prePassivate != null || this.postActivate != null)
>           {
>              return  true;
>          }
> @@ -369,8 +450,11 @@ public class  InterceptorDataImpl impleme
>          StringBuilder sb =  new StringBuilder();
>          sb.append("Class: 
> [").append(webBeansInterceptor.getBeanClass()).append("]");
>           sb.append(" aroundInvoke  [").append(aroundInvoke).append("]");
> +         sb.append(" aroundTimeout [").append(aroundTimeout).append("]");
>           sb.append(" postConstruct  [").append(postConstruct).append("]");
> +         sb.append(" postActivate [").append(postActivate).append("]");
>           sb.append(" preDestroy  [").append(preDestroy).append("]");
> +        sb.append("  prePassivate [").append(prePassivate).append("]");
> 
>           return sb.toString();
>      }
> 
> Modified: 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorType.java
>
>a
> 
> URL: 
>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorType.java?rev=979071&r1=979070&r2=979071&view=diff
>
>f
> 
> ==============================================================================
> --- 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorType.java
>
>a
>  > (original)
> +++ 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorType.java
>
>a
>   Sun Jul 25 17:10:36 2010
> @@ -31,7 +31,7 @@ import  org.apache.webbeans.exception.Web
>   */
> public enum  InterceptorType
> {
> -    AROUND_INVOKE, POST_CONSTRUCT,  PRE_DESTROY, PRE_PASSIVATE, 
POST_ACTIVATE;
> +    AROUND_INVOKE,  AROUND_TIMEOUT, POST_CONSTRUCT, PRE_DESTROY, 
>PRE_PASSIVATE, 
>
> POST_ACTIVATE;
> 
>      public static InterceptorType  getType(InterceptionType type)
>      {
> @@ -39,6 +39,10 @@ public  enum InterceptorType
>          {
>               return AROUND_INVOKE;
>           }
> +        else if  (type.equals(InterceptionType.AROUND_TIMEOUT))
> +         {
> +            return  AROUND_TIMEOUT;
> +        }
>           else if (type.equals(InterceptionType.POST_CONSTRUCT))
>           {
>              return  POST_CONSTRUCT;
> 
> Modified: 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
>
>a
> 
> URL: 
>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=979071&r1=979070&r2=979071&view=diff
>
>f
> 
> ==============================================================================
> --- 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
>
>a
>  > (original)
> +++ 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
>
>a
>   Sun Jul 25 17:10:36 2010
> @@ -30,6 +30,8 @@ import  java.util.Set;
> 
> import javax.annotation.PostConstruct;
> import  javax.annotation.PreDestroy;
> +import javax.ejb.PrePassivate;
> +import  javax.ejb.PostActivate;
> import javax.enterprise.inject.Produces;
> import  javax.enterprise.inject.spi.AnnotatedMethod;
> import  javax.enterprise.inject.spi.AnnotatedParameter;
> @@ -45,6 +47,7 @@ import  org.apache.webbeans.component.Inj
> import  org.apache.webbeans.context.creational.CreationalContextImpl;
> import  org.apache.webbeans.exception.WebBeansConfigurationException;
> import  org.apache.webbeans.exception.WebBeansException;
> +import  org.apache.webbeans.logger.WebBeansLogger;
> import  org.apache.webbeans.util.AnnotationUtil;
> import  org.apache.webbeans.util.Asserts;
> import  org.apache.webbeans.util.ClassUtil;
> @@ -52,6 +55,9 @@ import  org.apache.webbeans.util.Security
> 
> public final class  InterceptorUtil
> {
> +    /**Logger instance*/
> +     private static final WebBeansLogger logger = 
> WebBeansLogger.getLogger(InterceptorUtil.class);
> +
>       private InterceptorUtil()
>      {
> 
> @@ -83,7 +89,10 @@ public  final class InterceptorUtil
>              if  (annCls.equals(Inject.class)        ||
>                   annCls.equals(PreDestroy.class)     ||
>                   annCls.equals(PostConstruct.class) ||
> -                 annCls.equals(AroundInvoke.class)    )
> +                  annCls.equals(AroundInvoke.class)  ||
> +                 annCls.equals(PrePassivate.class)  ||   //  JSR-299 7.2
> +                 annCls.equals(PostActivate.class)  ||   // JSR-299 7.2
> +                  annCls.equals(AroundTimeout.class))     // JSR-299 7.2
>               {
>                   return false;
>               }
> @@ -98,10 +107,10 @@ public final class InterceptorUtil
>           {
>              return  AroundInvoke.class;
>          }
> -//         else if (type.equals(InterceptionType.POST_ACTIVATE))
> -//         {
> -//            return  O;
> -//        }
> +        else if  (type.equals(InterceptionType.POST_ACTIVATE))
> +         {
> +            return  PostActivate.class;
> +        }
>           else if (type.equals(InterceptionType.POST_CONSTRUCT))
>           {
>              return  PostConstruct.class;
> @@ -110,10 +119,10 @@ public final class  InterceptorUtil
>          {
>               return PreDestroy.class;
>           }
> -//        else if  (type.equals(InterceptionType.PRE_PASSIVATE))
> -//         {
> -//            return  PrePassivate.class;
> -//        }
> +         else if (type.equals(InterceptionType.PRE_PASSIVATE))
> +         {
> +            return  PrePassivate.class;
> +        }
>           else if (type.equals(InterceptionType.AROUND_TIMEOUT))
>           {
>              return  AroundTimeout.class;
> @@ -203,8 +212,8 @@ public final class  InterceptorUtil
>          for (Method method :  methods)
>          {
>               if (AnnotationUtil.hasMethodAnnotation(method, 
>PostConstruct.class) 
>
> || AnnotationUtil.hasMethodAnnotation(method, PreDestroy.class)
> -//                      AnnotationUtil.isMethodHasAnnotation(method, 
> PostActivate.class) || 
> 
> -//                     AnnotationUtil.isMethodHasAnnotation(method, 
> PrePassivate.class)
> +                     ||  AnnotationUtil.hasMethodAnnotation(method, 
> PostActivate.class)
> +                     ||  AnnotationUtil.hasMethodAnnotation(method, 
> PrePassivate.class)
>                       )
>               {
>                   if (ClassUtil.isMethodHasParameter(method))
> @@ -220,10  +229,29 @@ public final class InterceptorUtil
>                                    {
>                                       return  true;
>                                   }
> +                                  else
> +                                 {
> +                                      logger.debug("Static LifeCycle 
> callback 


> method  found.");
> +                                 }
> +                              }
> +                             else
> +                             {
> +                                  logger.debug("LifeCycle callback method 
> with 
>
>
> checked  exception.");
>                               }
>                           }
> +                         else
> +                          {
> +                             logger.debug("LifeCycle callback method with 
> non-void return type.");
> +                         }
>                       }
> -
> +                     else
> +                     {
> +                          logger.debug("LifeCycle callback method with wrong 
> number or type of  parameter(s).");
> +                     }
> +                 }
> +                else
> +                 {
> +                     logger.debug("LifeCycle  callback method without any 
>context 
>
> parameter.");
>                   }
>               }
>          }
> @@ -239,7 +267,9 @@ public final  class InterceptorUtil
>          {
>               AnnotatedMethod<T> method =  (AnnotatedMethod<T>)methodA;
>               if(method.isAnnotationPresent(PostConstruct.class) 
> -                     ||  method.isAnnotationPresent(PreDestroy.class))
> +                     ||  method.isAnnotationPresent(PreDestroy.class)
> +                     ||  method.isAnnotationPresent(PostActivate.class)
> +                     ||  method.isAnnotationPresent(PrePassivate.class))
>               {
>                       if (!methodA.getParameters().isEmpty())
>                       {
> @@ -433,8 +463,11 @@  public final class InterceptorUtil
>      public static  List<InterceptorData> 
> getInterceptorMethods(List<InterceptorData> stack, InterceptorType  type)
>      {
>           List<InterceptorData> ai = new  ArrayList<InterceptorData>();
> +         List<InterceptorData> at = new  ArrayList<InterceptorData>();
> +         List<InterceptorData> pa = new  ArrayList<InterceptorData>();
>           List<InterceptorData> pc = new  ArrayList<InterceptorData>();
>           List<InterceptorData> pd = new  ArrayList<InterceptorData>();
> +         List<InterceptorData> pp = new  ArrayList<InterceptorData>();
>    
>           Iterator<InterceptorData> it = stack.iterator();
>           while (it.hasNext())
> @@ -451,6 +484,24 @@ public final class  InterceptorUtil
>                   }
>    
>              }
> +             else if  (type.equals(InterceptorType.AROUND_TIMEOUT))
> +             {
> +                m =  data.getAroundTimeout();
> +                 if (m != null)
> +                 {
> +                     at.add(data);
> +                 }
> +    
> +            }
> +             else if  (type.equals(InterceptorType.POST_ACTIVATE))
> +             {
> +                m =  data.getPostActivate();
> +                 if (m != null)
> +                 {
> +                     pa.add(data);
> +                 }
> +    
> +            }
>               else if  (type.equals(InterceptorType.POST_CONSTRUCT))
>               {
>                  m =  data.getPostConstruct();
> @@ -469,22 +520,42 @@ public final class  InterceptorUtil
>                   }
>    
>              }
> +             else if  (type.equals(InterceptorType.PRE_PASSIVATE))
> +             {
> +                m =  data.getPrePassivate();
> +                 if (m != null)
> +                 {
> +                     pp.add(data);
> +                 }
>    
> +            }
>           }
>    
>          if  (type.equals(InterceptorType.AROUND_INVOKE))
>           {
>              return ai;
>           }
> +        else if  (type.equals(InterceptorType.AROUND_TIMEOUT))
> +         {
> +            return at;
> +         }
> +        else if  (type.equals(InterceptorType.POST_ACTIVATE))
> +         {
> +            return pa;
> +         }
>          else if  (type.equals(InterceptorType.POST_CONSTRUCT))
>           {
>              return pc;
> -    
>          }
>          else if  (type.equals(InterceptorType.PRE_DESTROY))
>           {
>              return pd;
>           }
> +        else if  (type.equals(InterceptorType.PRE_PASSIVATE))
> +         {
> +            return pp;
> +    
> +        }
>    
>           return Collections.EMPTY_LIST;
>      }
> 
> Modified: 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
>
>a
> 
> URL: 
>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java?rev=979071&r1=979070&r2=979071&view=diff
>
>f
> 
> ==============================================================================
> --- 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
>
>a
>  > (original)
> +++ 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
>
>a
>   Sun Jul 25 17:10:36 2010
> @@ -33,6 +33,7 @@ import  org.apache.webbeans.component.Ent
> import  org.apache.webbeans.component.OwbBean;
> import  org.apache.webbeans.container.BeanManagerImpl;
> import  org.apache.webbeans.context.creational.CreationalContextImpl;
> +import  org.apache.webbeans.logger.WebBeansLogger;
> import  org.apache.webbeans.util.ClassUtil;
> import  org.apache.webbeans.util.SecurityUtil;
> 
> @@ -67,6 +68,9 @@ public class  InvocationContextImpl imple
>    
>      private  OwbBean<?> owbBean;
>      private InvocationContext  ejbInvocationContext;
> +
> +    //Logger instance
> +     private static final WebBeansLogger logger = 
> WebBeansLogger.getLogger(InvocationContextImpl.class);
>    
>      /**
>       * Initializes the context.
> @@  -168,8 +172,15 @@ public class InvocationContextImpl imple
>           {
>              if  (type.equals(InterceptorType.AROUND_INVOKE))
>               {
> +                 logger.debug("InvocationContextImpl: Proceeding to 
> AroundInvokes.");
>                   return proceedAroundInvokes(this.interceptorDatas);
>               }
> +            else if  (type.equals(InterceptorType.AROUND_TIMEOUT))
> +             {
> +                 logger.debug("InvocationContextImpl: Proceeding to 
> AroundTimeouts.");
> +                 return proceedAroundTimeouts(this.interceptorDatas);
> +             }
> +             logger.debug("InvocationContextImpl: Proceeding to 
> CommonAnnotations.");
>              return  proceedCommonAnnots(this.interceptorDatas, this.type);
> 
>           }
> @@ -261,7 +272,75 @@ public class InvocationContextImpl  imple
> 
>          return result;
>       }
> -    
> +
> +    /**
> +     *  AroundTimeout operations on stack.
> +     * @param datas interceptor  stack
> +     * @return final result
> +     * @throws  Exception for exceptions
> +     */
> +    private Object  proceedAroundTimeouts(List<InterceptorData> datas) 
> throws 


> Exception
> +    {
> +        Object result  = null;
> +
> +        if (currentMethod <=  datas.size())
> +        {
> +             InterceptorData intc = datas.get(currentMethod -  1);
> +
> +            Method method =  intc.getAroundTimeout();
> +            boolean  accessible = method.isAccessible();
> +            
> +            if  (!accessible)
> +            {
> +                  SecurityUtil.doPrivilegedSetAccessible(method, true);
> +             }
> +            
> +             Object t = 
>intc.createNewInstance(this.target,(CreationalContextImpl<?>)this.creationalContext);
>
>;
> 
> +            
> +             if (t == null)
> +            {
> +                 t = target;
> +             }
> +
> +             currentMethod++;
> +            
> +             result = method.invoke(t, new Object[] { this  });
> +            
> +             if(!accessible)
> +             {
> +                 SecurityUtil.doPrivilegedSetAccessible(method, false);
> +             }
> +
> +        }
> +         else
> +        {
> +             if(!(this.owbBean instanceof  EnterpriseBeanMarker))
> +             {
> +                boolean accessible  = this.method.isAccessible();
> +                 if(!accessible)
> +                 {                
> +                     SecurityUtil.doPrivilegedSetAccessible(method, true);
> +                 }
> +                
> +                 result = this.method.invoke(target, parameters);
> +                
> +                 if(!accessible)
> +                 {
> +                     SecurityUtil.doPrivilegedSetAccessible(method,  false);
> +                }                
> +             }
> +            else 
> +            { 
> +                 if (this.ejbInvocationContext !=  null)
> +                {
> +                     result =  ejbInvocationContext.proceed();
> +                 }
> +            }
> +         }
> +
> +        return  result;
> +    }
> +
>      /**
>       *  Post construct and predestroy 
>       * callback  operations.
> @@ -283,6 +362,14 @@ public class InvocationContextImpl  imple
>              {
>                   method = intc.getPostConstruct();
>               }
> +             else if (type.equals(InterceptorType.POST_ACTIVATE))
> +             {
> +                 method = intc.getPostActivate();
> +             }
> +            else if  (type.equals(InterceptorType.PRE_PASSIVATE))
> +             {
> +                 method = intc.getPrePassivate();
> +             }
>              else if  (type.equals(InterceptorType.PRE_DESTROY))
>               {
>                  method =  intc.getPreDestroy();
> 
> Modified: 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
>
>a
> 
> URL: 
>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=979071&r1=979070&r2=979071&view=diff
>
>f
> 
> ==============================================================================
> --- 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
>
>a
>  > (original)
> +++ 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
>
>a
>   Sun Jul 25 17:10:36 2010
> @@ -276,10 +276,6 @@ public class  WebBeansInterceptor<T> exte
>               method = 
>WebBeansUtil.checkAroundInvokeAnnotationCriterias(getClazz(),AroundTimeout.class);
>
>;
> 
>           }
>        
> -         else if(type.equals(InterceptionType.POST_ACTIVATE) || 
> type.equals(InterceptionType.PRE_PASSIVATE))
> -         {
> -            return null;
> -         }
>          else
>           {
>              Class<? extends  Annotation> interceptorTypeAnnotationClazz = 
> InterceptorUtil.getInterceptorAnnotationClazz(type);                
> 
> 
> Modified: 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
>
>a
> 
> URL: 
>http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=979071&r1=979070&r2=979071&view=diff
>
>f
> 
> ==============================================================================
> --- 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
>
>a
>  > (original)
> +++ 
>openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
>
>a
>   Sun Jul 25 17:10:36 2010
> @@ -45,6 +45,8 @@ import  java.util.concurrent.ConcurrentHa
> import  javax.annotation.PostConstruct;
> import javax.annotation.PreDestroy;
> import  javax.decorator.Decorator;
> +import javax.ejb.PostActivate;
> +import  javax.ejb.PrePassivate;
> import  javax.enterprise.context.ApplicationScoped;
> import  javax.enterprise.context.Conversation;
> import  javax.enterprise.context.ConversationScoped;
> @@ -1205,27 +1207,10 @@ public  final class WebBeansUtil
>          {
>               method = 
> WebBeansUtil.checkAroundInvokeAnnotationCriterias(interceptorClass, 
> interceptorType);
>          }
> -         else if (interceptorType.equals(PostConstruct.class))
> +         else if (interceptorType.equals(PostConstruct.class) || 
> interceptorType.equals(PostActivate.class)
> +                  || interceptorType.equals(PreDestroy.class) || 
> interceptorType.equals(PrePassivate.class))
>           {
> -            if  (definedInInterceptorClass)
> -             {
> -                method = 
> WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass, 
> PostConstruct.class, true);
> -             }
> -            else
> -             {
> -                 method = 
> WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass, 
> PostConstruct.class, false);
> -             }
> -        }
> -        else if  (interceptorType.equals(PreDestroy.class))
> -         {
> -            if  (definedInInterceptorClass)
> -             {
> -                method = 
> WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass,  
>PreDestroy.class, 
>
> true);
> -             }
> -            else
> -             {
> -                 method = 
> WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass,  
>PreDestroy.class, 
>
> false);
> -             }
> +            method = 
> WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass,  
> interceptorType, 
>
>
> definedInInterceptorClass);
>           }
> 
>          if (method != null)
> @@ -1264,27  +1249,10 @@ public final class WebBeansUtil
>           {
>              method = 
> WebBeansUtil.checkAroundInvokeAnnotationCriterias(annotatedType,  annotation);
>          }
> -         else if (annotation.equals(PostConstruct.class))
> +         else if (annotation.equals(PostConstruct.class) || 
> annotation.equals(PostActivate.class)
> +                  || annotation.equals(PreDestroy.class) || 
> annotation.equals(PrePassivate.class))
>           {
> -            if  (definedInInterceptorClass)
> -             {
> -                method = 
> WebBeansUtil.checkCommonAnnotationCriterias(annotatedType,  
>PostConstruct.class, 
>
> true);
> -             }
> -            else
> -             {
> -                 method = 
> WebBeansUtil.checkCommonAnnotationCriterias(annotatedType,  
>PostConstruct.class, 
>
> false);
> -             }
> -        }
> -        else if  (annotation.equals(PreDestroy.class))
> -         {
> -            if  (definedInInterceptorClass)
> -             {
> -                method = 
> WebBeansUtil.checkCommonAnnotationCriterias(annotatedType, PreDestroy.class, 
> true);
> -            }
> -             else
> -             {
> -                method = 
> WebBeansUtil.checkCommonAnnotationCriterias(annotatedType, PreDestroy.class, 
> false);
> -            }
> +             method =  
>WebBeansUtil.checkCommonAnnotationCriterias(annotatedType, 
>
> annotation,  definedInInterceptorClass);
>          }
> 
>           if (method != null)
> @@ -1368,15 +1336,26 @@ public  final class WebBeansUtil
>               {
>                  m =  data.getAroundInvoke();
>               }
> +            else if  (type.equals(InterceptorType.AROUND_TIMEOUT))
> +             {
> +                m =  data.getAroundTimeout();
> +             }
>              else if  (type.equals(InterceptorType.POST_CONSTRUCT))
>               {
>                  m =  data.getPostConstruct();
> -
> +             }
> +            else if  (type.equals(InterceptorType.POST_ACTIVATE))
> +             {
> +                m =  data.getPostActivate();
>               }
>              else if  (type.equals(InterceptorType.PRE_DESTROY))
>               {
>                  m =  data.getPreDestroy();
>              }
> +             else if  (type.equals(InterceptorType.PRE_PASSIVATE))
> +             {
> +                m =  data.getPrePassivate();
> +             }
> 
>              if (m != null)
>               {
> 
> 

Reply via email to