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

Gavin King gavin.king at jboss.com
Thu Dec 14 05:27:00 EST 2006


  User: gavin   
  Date: 06/12/14 05:26:59

  Modified:    src/main/org/jboss/seam   Component.java ScopeType.java
  Log:
  introduce METHOD context, and solve   JBSEAM-564
  
  Revision  Changes    Path
  1.219     +6 -1      jboss-seam/src/main/org/jboss/seam/Component.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Component.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/Component.java,v
  retrieving revision 1.218
  retrieving revision 1.219
  diff -u -b -r1.218 -r1.219
  --- Component.java	13 Dec 2006 04:54:19 -0000	1.218
  +++ Component.java	14 Dec 2006 10:26:59 -0000	1.219
  @@ -100,6 +100,7 @@
   import org.jboss.seam.interceptors.EventInterceptor;
   import org.jboss.seam.interceptors.ExceptionInterceptor;
   import org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor;
  +import org.jboss.seam.interceptors.MethodContextInterceptor;
   import org.jboss.seam.interceptors.OutcomeInterceptor;
   import org.jboss.seam.interceptors.RemoveInterceptor;
   import org.jboss.seam.interceptors.RollbackInterceptor;
  @@ -121,7 +122,7 @@
    *
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
    * @author Gavin King
  - * @version $Revision: 1.218 $
  + * @version $Revision: 1.219 $
    */
   @Scope(ScopeType.APPLICATION)
   @SuppressWarnings("deprecation")
  @@ -738,6 +739,10 @@
         {
            addInterceptor( new Interceptor( new RemoveInterceptor(), this ) );
         }
  +      if ( getType()!=ENTITY_BEAN )
  +      {
  +         addInterceptor( new Interceptor( new MethodContextInterceptor(), this ) );
  +      }
         if ( beanClassHasAnnotation(RaiseEvent.class) )
         {
            addInterceptor( new Interceptor( new EventInterceptor(), this ) );
  
  
  
  1.11      +17 -1     jboss-seam/src/main/org/jboss/seam/ScopeType.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ScopeType.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/ScopeType.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- ScopeType.java	12 Oct 2006 00:09:45 -0000	1.10
  +++ ScopeType.java	14 Dec 2006 10:26:59 -0000	1.11
  @@ -13,7 +13,7 @@
    * The available scopes (contexts).
    * 
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.10 $
  + * @version $Revision: 1.11 $
    */
   public enum ScopeType 
   {
  @@ -22,6 +22,14 @@
       */
      STATELESS,
      /**
  +    * The method context. Each call to a session bean or 
  +    * JavaBean component puts a new method context onto
  +    * the stack of method contexts associated with the
  +    * current thread. The context is destroyed (and the
  +    * stack popped) when the method returns.
  +    */
  +   METHOD,
  +   /**
       * The event (request) context. Spans a server request,
       * from restore view to render response.
       */
  @@ -68,6 +76,8 @@
         {
            case STATELESS:
               return true;
  +         case METHOD:
  +            return Contexts.isMethodContextActive();
            case EVENT:
               return Contexts.isEventContextActive();
            case PAGE:
  @@ -93,6 +103,12 @@
         {
            case STATELESS: 
               throw new UnsupportedOperationException("Stateless psuedo-scope does not have a Context object");
  +         case METHOD: 
  +            if ( !Contexts.isMethodContextActive() )
  +            {
  +               throw new IllegalStateException("No method context active");
  +            }
  +            return Contexts.getMethodContext();
            case EVENT: 
               if ( !Contexts.isEventContextActive() )
               {
  
  
  



More information about the jboss-cvs-commits mailing list