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

Gavin King gavin.king at jboss.com
Fri Sep 29 18:48:50 EDT 2006


  User: gavin   
  Date: 06/09/29 18:48:50

  Modified:    src/main/org/jboss/seam/contexts           
                        BusinessProcessContext.java
                        ClientConversationContext.java Contexts.java
                        FacesApplicationContext.java Lifecycle.java
                        MapContext.java PageContext.java
                        ServerConversationContext.java
                        WebApplicationContext.java WebRequestContext.java
                        WebSessionContext.java
  Log:
  JBSEAM-28 context events
  
  Revision  Changes    Path
  1.28      +6 -2      jboss-seam/src/main/org/jboss/seam/contexts/BusinessProcessContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: BusinessProcessContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/BusinessProcessContext.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -b -r1.27 -r1.28
  --- BusinessProcessContext.java	17 Jun 2006 21:12:30 -0000	1.27
  +++ BusinessProcessContext.java	29 Sep 2006 22:48:50 -0000	1.28
  @@ -15,6 +15,7 @@
   import org.apache.commons.logging.LogFactory;
   import org.jboss.seam.ScopeType;
   import org.jboss.seam.Seam;
  +import org.jboss.seam.core.Events;
   import org.jboss.seam.core.Init;
   import org.jboss.seam.core.ProcessInstance;
   import org.jboss.seam.core.TaskInstance;
  @@ -26,7 +27,7 @@
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
    * @author <a href="mailto:steve at hibernate.org">Steve Ebersole</a>
    * @author Gavin King
  - * @version $Revision: 1.27 $
  + * @version $Revision: 1.28 $
    */
   public class BusinessProcessContext implements Context {
   
  @@ -62,6 +63,7 @@
      }
   
      public void set(String name, Object value) {
  +      Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name);
         if (value==null)
         {
            //yes, we need this
  @@ -72,6 +74,7 @@
            removals.remove(name);
            additions.put(name, value);
         }
  +      Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name);
      }
   
      public boolean isSet(String name) {
  @@ -79,8 +82,10 @@
      }
      
      public void remove(String name) {
  +      Events.instance().raiseEvent("org.jboss.seam.preRemoveVariable." + name);
         additions.remove(name);
         removals.add(name);
  +      Events.instance().raiseEvent("org.jboss.seam.postRemoveVariable." + name);
      }
   
      public String[] getNames() {
  @@ -119,7 +124,6 @@
         removals.addAll( getNamesFromContext() );
      }
      
  -
      public void flush()
      {
         if ( !additions.isEmpty() || !removals.isEmpty() )
  
  
  
  1.5       +6 -1      jboss-seam/src/main/org/jboss/seam/contexts/ClientConversationContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ClientConversationContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/ClientConversationContext.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- ClientConversationContext.java	30 Dec 2005 23:44:00 -0000	1.4
  +++ ClientConversationContext.java	29 Sep 2006 22:48:50 -0000	1.5
  @@ -13,6 +13,7 @@
   
   import org.jboss.seam.ScopeType;
   import org.jboss.seam.Seam;
  +import org.jboss.seam.core.Events;
   import org.jboss.seam.core.Manager;
   
   /**
  @@ -21,7 +22,7 @@
    * 
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class ClientConversationContext implements Context {
   
  @@ -45,7 +46,9 @@
   
   	public void set(String name, Object value) 
      {
  +      Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name);
   		map.put(name, value);
  +      Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name);
   	}
   
   	public boolean isSet(String name) 
  @@ -55,7 +58,9 @@
      
   	public void remove(String name) 
      {
  +      Events.instance().raiseEvent("org.jboss.seam.preRemoveVariable." + name);
         map.remove(name);
  +      Events.instance().raiseEvent("org.jboss.seam.postRemoveVariable." + name);
   	}
   
      public String[] getNames() {
  
  
  
  1.41      +5 -1      jboss-seam/src/main/org/jboss/seam/contexts/Contexts.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Contexts.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/Contexts.java,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -b -r1.40 -r1.41
  --- Contexts.java	13 Sep 2006 17:25:28 -0000	1.40
  +++ Contexts.java	29 Sep 2006 22:48:50 -0000	1.41
  @@ -9,13 +9,14 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.jboss.seam.Component;
  +import org.jboss.seam.core.Events;
   
   /**
    * Provides access to the current contexts associated with the thread.
    * 
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.40 $
  + * @version $Revision: 1.41 $
    */
   public class Contexts {
   
  @@ -173,6 +174,7 @@
      
      public static void destroy(Context context)
      {
  +      Events.instance().raiseEvent("org.jboss.seam.preDestroyContext." + context.getType().toString());
         Lifecycle.startDestroying();
         try
         {
  @@ -181,6 +183,7 @@
               log.debug("destroying: " + name);
               if ( component!=null )
               {
  +               Events.instance().raiseEvent("org.jboss.seam.preDestroy." + name);
                  try
                  {
                     component.callDestroyMethod( context.get(name) );
  @@ -196,6 +199,7 @@
         {
            Lifecycle.stopDestroying();
         }
  +      Events.instance().raiseEvent("org.jboss.seam.postDestroyContext." + context.getType().toString());
      }
      
   }
  \ No newline at end of file
  
  
  
  1.5       +8 -3      jboss-seam/src/main/org/jboss/seam/contexts/FacesApplicationContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: FacesApplicationContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/FacesApplicationContext.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- FacesApplicationContext.java	17 Jun 2006 21:12:30 -0000	1.4
  +++ FacesApplicationContext.java	29 Sep 2006 22:48:50 -0000	1.5
  @@ -13,11 +13,12 @@
   
   import org.jboss.seam.ScopeType;
   import org.jboss.seam.Seam;
  +import org.jboss.seam.core.Events;
   
   /**
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class FacesApplicationContext implements Context {
   
  @@ -47,7 +48,9 @@
   	}
   
   	public void set(String name, Object value) {
  +      Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name);
          externalContext.getApplicationMap().put( getKey(name), value );
  +      Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name);
   	}
   
   	public boolean isSet(String name) {
  @@ -55,7 +58,9 @@
   	}
   
   	public void remove(String name) {
  +      Events.instance().raiseEvent("org.jboss.seam.preRemoveVariable." + name);
          externalContext.getApplicationMap().remove( getKey(name) );
  +      Events.instance().raiseEvent("org.jboss.seam.postRemoveVariable." + name);
   	}
   
       public String[] getNames() {
  
  
  
  1.52      +4 -1      jboss-seam/src/main/org/jboss/seam/contexts/Lifecycle.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Lifecycle.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/Lifecycle.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -b -r1.51 -r1.52
  --- Lifecycle.java	28 Sep 2006 23:04:08 -0000	1.51
  +++ Lifecycle.java	29 Sep 2006 22:48:50 -0000	1.52
  @@ -20,6 +20,7 @@
   import org.jboss.seam.Component;
   import org.jboss.seam.ScopeType;
   import org.jboss.seam.Seam;
  +import org.jboss.seam.core.Events;
   import org.jboss.seam.core.Init;
   import org.jboss.seam.core.Manager;
   import org.jboss.seam.security.authenticator.Authenticator;
  @@ -27,7 +28,7 @@
   /**
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.51 $
  + * @version $Revision: 1.52 $
    */
   public class Lifecycle
   {
  @@ -115,6 +116,8 @@
   
      public static void endInitialization()
      {
  +      startup( Component.forName( Seam.getComponentName(Events.class) ) );
  +      
   	   //instantiate all application-scoped @Startup components
         Context context = Contexts.getApplicationContext();
         for ( String name: context.getNames() )
  
  
  
  1.2       +6 -1      jboss-seam/src/main/org/jboss/seam/contexts/MapContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: MapContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/MapContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- MapContext.java	17 Jun 2006 20:09:41 -0000	1.1
  +++ MapContext.java	29 Sep 2006 22:48:50 -0000	1.2
  @@ -1,4 +1,4 @@
  -//$Id: MapContext.java,v 1.1 2006/06/17 20:09:41 gavin Exp $
  +//$Id: MapContext.java,v 1.2 2006/09/29 22:48:50 gavin Exp $
   package org.jboss.seam.contexts;
   
   import java.util.HashMap;
  @@ -6,6 +6,7 @@
   
   import org.jboss.seam.ScopeType;
   import org.jboss.seam.Seam;
  +import org.jboss.seam.core.Events;
   
   public class MapContext implements Context
   {
  @@ -45,12 +46,16 @@
   
      public void remove(String name)
      {
  +      Events.instance().raiseEvent("org.jboss.seam.preRemoveVariable." + name);
         map.remove(name);
  +      Events.instance().raiseEvent("org.jboss.seam.postRemoveVariable." + name);
      }
   
      public void set(String name, Object value)
      {
  +      Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name);
         map.put(name, value);
  +      Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name);
      }
   
      public void flush() {}
  
  
  
  1.4       +6 -1      jboss-seam/src/main/org/jboss/seam/contexts/PageContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: PageContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/PageContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- PageContext.java	4 Jul 2006 14:09:43 -0000	1.3
  +++ PageContext.java	29 Sep 2006 22:48:50 -0000	1.4
  @@ -14,6 +14,7 @@
   
   import org.jboss.seam.ScopeType;
   import org.jboss.seam.Seam;
  +import org.jboss.seam.core.Events;
   
   /**
    * The page context allows you to store state during a request that
  @@ -28,7 +29,7 @@
    * returns values from the page that was the source of the request.
    * 
    * @author Gavin King
  - * @version $Revision: 1.3 $
  + * @version $Revision: 1.4 $
    */
   public class PageContext implements Context {
   
  @@ -71,12 +72,16 @@
   
   	public void set(String name, Object value) 
      {
  +      Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name);
         getCurrentWritableMap().put(name, value);
  +      Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name);
   	}
   
   	public void remove(String name) 
      {
  +      Events.instance().raiseEvent("org.jboss.seam.preRemoveVariable." + name);
         getCurrentWritableMap().remove(name);
  +      Events.instance().raiseEvent("org.jboss.seam.postRemoveVariable." + name);
   	}
   
      public String[] getNames() {
  
  
  
  1.8       +6 -1      jboss-seam/src/main/org/jboss/seam/contexts/ServerConversationContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ServerConversationContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/ServerConversationContext.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- ServerConversationContext.java	28 Sep 2006 23:04:45 -0000	1.7
  +++ ServerConversationContext.java	29 Sep 2006 22:48:50 -0000	1.8
  @@ -15,6 +15,7 @@
   
   import org.jboss.seam.ScopeType;
   import org.jboss.seam.Seam;
  +import org.jboss.seam.core.Events;
   import org.jboss.seam.core.Manager;
   
   /**
  @@ -23,7 +24,7 @@
    * 
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    */
   public class ServerConversationContext implements Context {
   
  @@ -101,6 +102,7 @@
   
      public void set(String name, Object value) 
      {
  +      Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name);
         if (value==null)
         {
            //yes, we need this
  @@ -111,6 +113,7 @@
            removals.remove(name);
            additions.put(name, value);
         }
  +      Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name);
   	}
   
   	public boolean isSet(String name) 
  @@ -120,8 +123,10 @@
      
   	public void remove(String name) 
      {
  +      Events.instance().raiseEvent("org.jboss.seam.preRemoveVariable." + name);
         additions.remove(name);
         removals.add(name);
  +      Events.instance().raiseEvent("org.jboss.seam.postRemoveVariable." + name);
   	}
   
      public String[] getNames() 
  
  
  
  1.17      +9 -4      jboss-seam/src/main/org/jboss/seam/contexts/WebApplicationContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: WebApplicationContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/WebApplicationContext.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -r1.16 -r1.17
  --- WebApplicationContext.java	17 Jun 2006 14:34:22 -0000	1.16
  +++ WebApplicationContext.java	29 Sep 2006 22:48:50 -0000	1.17
  @@ -13,11 +13,12 @@
   
   import org.jboss.seam.ScopeType;
   import org.jboss.seam.Seam;
  +import org.jboss.seam.core.Events;
   
   /**
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.16 $
  + * @version $Revision: 1.17 $
    */
   public class WebApplicationContext implements Context 
   {
  @@ -48,7 +49,9 @@
   	}
   
   	public void set(String name, Object value) {
  +      if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name);
          servletContext.setAttribute( getKey(name), value );
  +      if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name);
   	}
   
   	public boolean isSet(String name) {
  @@ -56,7 +59,9 @@
   	}
   
   	public void remove(String name) {
  +      if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.preRemoveVariable." + name);
          servletContext.removeAttribute( getKey(name) );
  +      if ( Events.exists() ) Events.instance().raiseEvent("org.jboss.seam.postRemoveVariable." + name);
   	}
   
       public String[] getNames() {
  
  
  
  1.17      +6 -1      jboss-seam/src/main/org/jboss/seam/contexts/WebRequestContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: WebRequestContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/WebRequestContext.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -r1.16 -r1.17
  --- WebRequestContext.java	17 Jun 2006 20:08:48 -0000	1.16
  +++ WebRequestContext.java	29 Sep 2006 22:48:50 -0000	1.17
  @@ -11,11 +11,12 @@
   
   import org.jboss.seam.ScopeType;
   import org.jboss.seam.Seam;
  +import org.jboss.seam.core.Events;
   
   /**
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.16 $
  + * @version $Revision: 1.17 $
    */
   public class WebRequestContext implements Context {
   
  @@ -45,7 +46,9 @@
   	}
   
   	public void set(String name, Object value) {
  +      Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name);
   		request.setAttribute( getKey(name), value);
  +      Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name);
   	}
   
   	public boolean isSet(String name) {
  @@ -53,7 +56,9 @@
   	}
   
   	public void remove(String name) {
  +      Events.instance().raiseEvent("org.jboss.seam.preRemoveVariable." + name);
   		request.removeAttribute( getKey(name) );
  +      Events.instance().raiseEvent("org.jboss.seam.postRemoveVariable." + name);
   	}
   
   	public String[] getNames() {
  
  
  
  1.21      +6 -1      jboss-seam/src/main/org/jboss/seam/contexts/WebSessionContext.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: WebSessionContext.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/contexts/WebSessionContext.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -b -r1.20 -r1.21
  --- WebSessionContext.java	17 Jun 2006 14:34:22 -0000	1.20
  +++ WebSessionContext.java	29 Sep 2006 22:48:50 -0000	1.21
  @@ -11,11 +11,12 @@
   
   import org.jboss.seam.ScopeType;
   import org.jboss.seam.Seam;
  +import org.jboss.seam.core.Events;
   
   /**
    * @author Gavin King
    * @author <a href="mailto:theute at jboss.org">Thomas Heute</a>
  - * @version $Revision: 1.20 $
  + * @version $Revision: 1.21 $
    */
   public class WebSessionContext implements Context 
   {
  @@ -49,7 +50,9 @@
   
   	public void set(String name, Object value) 
      {
  +      Events.instance().raiseEvent("org.jboss.seam.preSetVariable." + name);
   		session.setAttribute( getKey(name), value );
  +      Events.instance().raiseEvent("org.jboss.seam.postSetVariable." + name);
   	}
   
   	public boolean isSet(String name) 
  @@ -59,7 +62,9 @@
   
   	public void remove(String name) 
      {
  +      Events.instance().raiseEvent("org.jboss.seam.preRemoveVariable." + name);
   		session.removeAttribute( getKey(name) );
  +      Events.instance().raiseEvent("org.jboss.seam.postRemoveVariable." + name);
   	}
   
   	public String[] getNames() 
  
  
  



More information about the jboss-cvs-commits mailing list