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

Gavin King gavin.king at jboss.com
Thu Aug 3 10:44:53 EDT 2006


  User: gavin   
  Date: 06/08/03 10:44:53

  Modified:    src/main/org/jboss/seam/ejb  SeamInterceptor.java
  Log:
  fix lifecycle callback methods
  
  Revision  Changes    Path
  1.42      +37 -10    jboss-seam/src/main/org/jboss/seam/ejb/SeamInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: SeamInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/ejb/SeamInterceptor.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -b -r1.41 -r1.42
  --- SeamInterceptor.java	2 Aug 2006 17:50:26 -0000	1.41
  +++ SeamInterceptor.java	3 Aug 2006 14:44:53 -0000	1.42
  @@ -30,7 +30,7 @@
    * for a session bean component
    * 
    * @author Gavin King
  - * @version $Revision: 1.41 $
  + * @version $Revision: 1.42 $
    */
   public class SeamInterceptor implements Serializable
   {
  @@ -62,7 +62,7 @@
      }
      
      @PostConstruct
  -   public void postConstruct(InvocationContext invocation) throws Exception
  +   public void postConstruct(InvocationContext invocation)
      {
         //if instantiated by the EJB container, we 
         //still need to init the component reference
  @@ -70,31 +70,58 @@
         if ( isSeamComponent(bean) )
         {
            component = getSeamComponent(bean);
  +         try
  +         {
            component.initialize(bean);
  +         }
  +         catch (RuntimeException e)
  +         {
  +            throw e;
  +         }
  +         catch (Exception e)
  +         {
  +            throw new RuntimeException("exception initializing EJB component", e);
  +         }
            isSeamComponent = true;
         }
         
  -      invoke(invocation, EventType.POST_CONSTRUCT);
  +      invokeAndHandle(invocation, EventType.POST_CONSTRUCT);
      }
      
      @PreDestroy
  -   public void preDestroy(InvocationContext invocation) throws Exception
  +   public void preDestroy(InvocationContext invocation)
      {
  -      invoke(invocation, EventType.PRE_DESTORY);
  +      invokeAndHandle(invocation, EventType.PRE_DESTORY);
      }
      
      @PrePassivate
  -   public void prePassivate(InvocationContext invocation) throws Exception
  +   public void prePassivate(InvocationContext invocation)
      {
  -      invoke(invocation, EventType.PRE_PASSIVATE);
  +      invokeAndHandle(invocation, EventType.PRE_PASSIVATE);
         if (isSeamComponent) componentName = component.getName();
      }
      
      @PostActivate
  -   public void postActivate(InvocationContext invocation) throws Exception
  +   public void postActivate(InvocationContext invocation)
      {
         if (isSeamComponent) component = Component.forName(componentName);
  -      invoke(invocation, EventType.POST_ACTIVATE);
  +      invokeAndHandle(invocation, EventType.POST_ACTIVATE);
  +   }
  +   
  +   private void invokeAndHandle(InvocationContext invocation, EventType invocationType)
  +   {
  +      try
  +      {
  +         invoke(invocation, invocationType);
  +      }
  +      catch (RuntimeException e)
  +      {
  +         throw e;
  +      }
  +      catch (Exception e)
  +      {
  +         throw new RuntimeException("exception in EJB lifecycle callback", e);
  +      }
      }
      
      @AroundInvoke
  
  
  



More information about the jboss-cvs-commits mailing list