[seam-commits] Seam SVN: r9717 - in trunk/src: ioc/org/jboss/seam/ioc/spring and 10 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Dec 4 03:09:31 EST 2008


Author: dan.j.allen
Date: 2008-12-04 03:09:30 -0500 (Thu, 04 Dec 2008)
New Revision: 9717

Added:
   trunk/src/main/org/jboss/seam/web/HotDeployFilter.java
Removed:
   trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java
Modified:
   trunk/src/ioc/org/jboss/seam/ioc/spring/SeamScopePostProcessor.java
   trunk/src/ioc/org/jboss/seam/ioc/spring/SeamTargetSource.java
   trunk/src/ioc/org/jboss/seam/ioc/spring/SpringComponent.java
   trunk/src/main/org/jboss/seam/Seam.java
   trunk/src/main/org/jboss/seam/contexts/Lifecycle.java
   trunk/src/main/org/jboss/seam/core-2.1.xsd
   trunk/src/main/org/jboss/seam/core/Init.java
   trunk/src/main/org/jboss/seam/exception/Exceptions.java
   trunk/src/main/org/jboss/seam/init/Initialization.java
   trunk/src/main/org/jboss/seam/navigation/Pages.java
   trunk/src/main/org/jboss/seam/servlet/SeamFilter.java
   trunk/src/main/org/jboss/seam/servlet/SeamResourceServlet.java
   trunk/src/main/org/jboss/seam/web-2.1.xsd
   trunk/src/test/unit/org/jboss/seam/test/unit/AbstractPageTest.java
   trunk/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java
   trunk/src/test/unit/org/jboss/seam/test/unit/bpm/TaskListTest.java
Log:
JBSEAM-3729
JBSEAM-3708
JBSEAM-3728
also change the mockApplication and unmockApplication methods to setupApplication and cleanupApplication

Deleted: trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java
===================================================================
--- trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -1,59 +0,0 @@
-package org.jboss.seam.debug.hot;
-
-import static org.jboss.seam.ScopeType.APPLICATION;
-import static org.jboss.seam.annotations.Install.BUILT_IN;
-
-import java.io.IOException;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
-import org.jboss.seam.Seam;
-import org.jboss.seam.annotations.Install;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.intercept.BypassInterceptors;
-import org.jboss.seam.annotations.web.Filter;
-import org.jboss.seam.core.Init;
-import org.jboss.seam.init.Initialization;
-import org.jboss.seam.log.LogProvider;
-import org.jboss.seam.log.Logging;
-import org.jboss.seam.web.AbstractFilter;
-
- at Name("org.jboss.seam.debug.hotDeployFilter")
- at Install(debug=true, precedence=BUILT_IN)
- at BypassInterceptors
- at Scope(APPLICATION)
- at Filter
-public class HotDeployFilter extends AbstractFilter
-{
-
-   private static LogProvider log = Logging.getLogProvider(HotDeployFilter.class);
-   
-   public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
-            throws IOException, ServletException
-   {
-      if (request instanceof HttpServletRequest)
-      {
-         Init init = (Init) getServletContext().getAttribute(Seam.getComponentName(Init.class));
-         if (init != null)
-         {
-            try
-            {
-               new Initialization(getServletContext()).redeploy((HttpServletRequest) request, init);
-            }
-            catch (InterruptedException e)
-            {
-               log.warn("Unable to redeploy, please try again");
-            }
-         }
-      }
-      chain.doFilter(request, response);
-   }
-
-
-
-}

Modified: trunk/src/ioc/org/jboss/seam/ioc/spring/SeamScopePostProcessor.java
===================================================================
--- trunk/src/ioc/org/jboss/seam/ioc/spring/SeamScopePostProcessor.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/ioc/org/jboss/seam/ioc/spring/SeamScopePostProcessor.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -71,7 +71,7 @@
         boolean unmockApplication = false;
         if (!Contexts.isApplicationContextActive())
         {
-            Lifecycle.mockApplication();
+            Lifecycle.setupApplication();
             unmockApplication = true;
         }
         try
@@ -125,7 +125,7 @@
         {
             if (unmockApplication)
             {
-                Lifecycle.unmockApplication();
+                Lifecycle.cleanupApplication();
             }
         }
     }

Modified: trunk/src/ioc/org/jboss/seam/ioc/spring/SeamTargetSource.java
===================================================================
--- trunk/src/ioc/org/jboss/seam/ioc/spring/SeamTargetSource.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/ioc/org/jboss/seam/ioc/spring/SeamTargetSource.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -162,7 +162,7 @@
          boolean unmockApplication = false;
          if (!Contexts.isApplicationContextActive())
          {
-            Lifecycle.mockApplication();
+            Lifecycle.setupApplication();
             unmockApplication = true;
          }
          try
@@ -179,7 +179,7 @@
          {
             if (unmockApplication)
             {
-               Lifecycle.unmockApplication();
+               Lifecycle.cleanupApplication();
             }
          }
       }

Modified: trunk/src/ioc/org/jboss/seam/ioc/spring/SpringComponent.java
===================================================================
--- trunk/src/ioc/org/jboss/seam/ioc/spring/SpringComponent.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/ioc/org/jboss/seam/ioc/spring/SpringComponent.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -65,7 +65,7 @@
         boolean unmockApplication = false;
         if (!Contexts.isApplicationContextActive())
         {
-            Lifecycle.mockApplication();
+            Lifecycle.setupApplication();
             unmockApplication = true;
         }
         try
@@ -93,7 +93,7 @@
         {
             if (unmockApplication)
             {
-                Lifecycle.unmockApplication();
+                Lifecycle.cleanupApplication();
             }
         }
     }
@@ -121,7 +121,7 @@
         boolean unmockApplication = false;
         if (!Contexts.isApplicationContextActive())
         {
-            Lifecycle.mockApplication();
+            Lifecycle.setupApplication();
             unmockApplication = true;
         }
         try
@@ -132,7 +132,7 @@
         {
             if (unmockApplication)
             {
-                Lifecycle.unmockApplication();
+                Lifecycle.cleanupApplication();
             }
         }
     }

Modified: trunk/src/main/org/jboss/seam/Seam.java
===================================================================
--- trunk/src/main/org/jboss/seam/Seam.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/main/org/jboss/seam/Seam.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -295,14 +295,14 @@
       }
       else
       {
-         Lifecycle.mockApplication();
+         Lifecycle.setupApplication();
          try
          {
             return Component.forName(name);
          }
          finally
          {
-            Lifecycle.unmockApplication();
+            Lifecycle.cleanupApplication();
          }
       }
    }

Modified: trunk/src/main/org/jboss/seam/contexts/Lifecycle.java
===================================================================
--- trunk/src/main/org/jboss/seam/contexts/Lifecycle.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/main/org/jboss/seam/contexts/Lifecycle.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -106,12 +106,28 @@
       }
    }
 
+   /**
+    * @deprecated Use {@link Lifecycle#setupApplication()}
+    */
    public static void mockApplication()
    {
+      setupApplication();
+   }
+   
+   /**
+    * @deprecated Use {@link Lifecycle#cleanupApplication()}
+    */
+   public static void unmockApplication()
+   {
+      cleanupApplication();
+   }
+   
+   public static void setupApplication()
+   {
       Contexts.applicationContext.set( new ApplicationContext(getApplication()) );
    }
 
-   public static void unmockApplication()
+   public static void cleanupApplication()
    {
       Contexts.applicationContext.set(null);
    }

Modified: trunk/src/main/org/jboss/seam/core/Init.java
===================================================================
--- trunk/src/main/org/jboss/seam/core/Init.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/main/org/jboss/seam/core/Init.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -33,10 +33,12 @@
 import org.jboss.seam.log.Logging;
 import org.jboss.seam.persistence.EntityManagerProxyInterceptor;
 import org.jboss.seam.persistence.HibernateSessionProxyInterceptor;
+import org.jboss.seam.persistence.ManagedEntityInterceptor;
 import org.jboss.seam.security.Identity;
 import org.jboss.seam.security.SecurityInterceptor;
 import org.jboss.seam.transaction.RollbackInterceptor;
 import org.jboss.seam.transaction.TransactionInterceptor;
+import org.jboss.seam.util.Resources;
 import org.jboss.seam.webservice.WSSecurityInterceptor;
 
 /**
@@ -81,6 +83,7 @@
    private boolean debug;
    private boolean myFacesLifecycleBug;
    private boolean transactionManagementEnabled = true;
+   private boolean distributable = false;
    
    private List<String> interceptors = new ArrayList<String>(DEFAULT_INTERCEPTORS);
    
@@ -432,6 +435,16 @@
       this.debug = debug;
    }
    
+   /**
+    * The debug page is considered available if debug JAR is on the classpath
+    * and Seam is running in debug mode (to prevent it from being enabling in
+    * the event the JAR is inadvertently packaged).
+    */
+   public boolean isDebugPageAvailable()
+   {
+      return debug && Resources.getResource("META-INF/debug.xhtml", null) != null;   
+   }
+   
    public boolean isMyFacesLifecycleBug()
    {
       return myFacesLifecycleBug;
@@ -597,7 +610,17 @@
    {
       this.interceptors = interceptors;
    }
-   
+      
+   public boolean isDistributable()
+   {
+      return distributable;
+   }
+
+   public void setDistributable(boolean distributable)
+   {
+      this.distributable = distributable;
+   }
+
    /**
     * Sanity check to warn users if they have disabled core interceptors
     */
@@ -610,6 +633,11 @@
             log.warn("The built-in interceptor " + defaultInterceptor + " is missing. This application may not function as expected");
          }
       }
+      
+      if (distributable && !interceptors.contains(ManagedEntityInterceptor.class.getName()))
+      {
+         interceptors.add(ManagedEntityInterceptor.class.getName());
+      }
    }
    
 }

Modified: trunk/src/main/org/jboss/seam/core-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/core-2.1.xsd	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/main/org/jboss/seam/core-2.1.xsd	2008-12-04 08:09:30 UTC (rev 9717)
@@ -17,7 +17,7 @@
             <xs:choice minOccurs="0" maxOccurs="unbounded">
                 <xs:element name="interceptors" type="components:multiValuedProperty">
                     <xs:annotation>
-                        <xs:documentation>A list of interceptors that should be enabled for all components. You must specify all built-in interceptors as well as any extras interceptors.
+                        <xs:documentation>A list of interceptors that should be enabled for all components. You must specify all built-in interceptors as well as any additional interceptors. Execution order is determined by the around and within attributes on the @Interceptor annotation.
                         
 These interceptors are enabled by default:
    org.jboss.seam.core.SynchronizationInterceptor
@@ -34,7 +34,9 @@
    org.jboss.seam.transaction.RollbackInterceptor
    org.jboss.seam.transaction.TransactionInterceptor
    org.jboss.seam.webservice.WSSecurityInterceptor
-   org.jboss.seam.security.SecurityInterceptor</xs:documentation>
+   org.jboss.seam.security.SecurityInterceptor
+   
+The distributable flag appends the ManagedEntityInterceptor to this list (applies only to conversation-scoped components).</xs:documentation>
                     </xs:annotation>
                 </xs:element>
             </xs:choice>
@@ -45,6 +47,7 @@
     
     <xs:attributeGroup name="attlist.init">
         <xs:attribute name="debug" type="components:boolean" />
+        <xs:attribute name="distributable" type="components:boolean" />
         <xs:attribute name="jndi-pattern" type="components:string" />
         <xs:attribute name="security-enabled" type="components:boolean" />
         <xs:attribute name="transaction-management-enabled" type="components:boolean"/>

Modified: trunk/src/main/org/jboss/seam/exception/Exceptions.java
===================================================================
--- trunk/src/main/org/jboss/seam/exception/Exceptions.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/main/org/jboss/seam/exception/Exceptions.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -126,7 +126,7 @@
       addHandler(new AnnotationRedirectHandler());
       addHandler(new AnnotationErrorHandler());
       
-      if (Init.instance().isDebug()) 
+      if (Init.instance().isDebugPageAvailable()) 
       {
          addHandler(new DebugPageHandler());
       }

Modified: trunk/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- trunk/src/main/org/jboss/seam/init/Initialization.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/main/org/jboss/seam/init/Initialization.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -822,9 +822,9 @@
                   Pages pages = (Pages) ServletLifecycle.getServletContext().getAttribute(Seam.getComponentName(Pages.class));
                   if (pages != null) {
                      // application context is needed for creating expressions
-                     Lifecycle.mockApplication();
+                     Lifecycle.setupApplication();
                      pages.initialize(warRootDeploymentStrategy.getDotPageDotXmlFileNames());
-                     Lifecycle.unmockApplication();
+                     Lifecycle.cleanupApplication();
                   }
                   ServletLifecycle.getServletContext().removeAttribute(Seam.getComponentName(Exceptions.class));
                   init.setWarTimestamp(warRootDeploymentStrategy.getTimestamp());
@@ -864,8 +864,7 @@
    
    private boolean isHotDeployEnabled(Init init)
    {
-      return Resources.getResource("META-INF/debug.xhtml", null) != null;
-      //return init.isDebug();
+      return init.isDebug();
    }
    
    private boolean isGroovyPresent()

Modified: trunk/src/main/org/jboss/seam/navigation/Pages.java
===================================================================
--- trunk/src/main/org/jboss/seam/navigation/Pages.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/main/org/jboss/seam/navigation/Pages.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -1696,12 +1696,12 @@
    
    private static boolean isDebugPage(String viewId)
    {
-      return Init.instance().isDebug() && viewId.startsWith("/debug.");
+      return Init.instance().isDebugPageAvailable() && viewId.startsWith("/debug.");
    }
    
    public static boolean isDebugPage()
    {
-      return Init.instance().isDebug() &&
+      return Init.instance().isDebugPageAvailable() &&
             getCurrentViewId() != null &&
             getCurrentViewId().startsWith("/debug.");
    }

Modified: trunk/src/main/org/jboss/seam/servlet/SeamFilter.java
===================================================================
--- trunk/src/main/org/jboss/seam/servlet/SeamFilter.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/main/org/jboss/seam/servlet/SeamFilter.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -87,7 +87,7 @@
 
    public void init(FilterConfig filterConfig) throws ServletException 
    {
-      Lifecycle.mockApplication();
+      Lifecycle.setupApplication();
       try
       {
          filters = getSortedFilters();
@@ -99,7 +99,7 @@
       }
       finally
       {
-         Lifecycle.unmockApplication();
+         Lifecycle.cleanupApplication();
       }
    }
 

Modified: trunk/src/main/org/jboss/seam/servlet/SeamResourceServlet.java
===================================================================
--- trunk/src/main/org/jboss/seam/servlet/SeamResourceServlet.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/main/org/jboss/seam/servlet/SeamResourceServlet.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -44,7 +44,7 @@
    {
       try
       {
-         Lifecycle.mockApplication();
+         Lifecycle.setupApplication();
 
          for (String name : Init.instance().getResourceProviders())
          {         
@@ -58,7 +58,7 @@
       }
       finally
       {
-         Lifecycle.unmockApplication();
+         Lifecycle.cleanupApplication();
       }
    }
 

Copied: trunk/src/main/org/jboss/seam/web/HotDeployFilter.java (from rev 9679, trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java)
===================================================================
--- trunk/src/main/org/jboss/seam/web/HotDeployFilter.java	                        (rev 0)
+++ trunk/src/main/org/jboss/seam/web/HotDeployFilter.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -0,0 +1,58 @@
+package org.jboss.seam.web;
+
+import static org.jboss.seam.ScopeType.APPLICATION;
+import static org.jboss.seam.annotations.Install.BUILT_IN;
+
+import java.io.IOException;
+
+import javax.servlet.FilterChain;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+
+import org.jboss.seam.Seam;
+import org.jboss.seam.annotations.Install;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
+import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.annotations.web.Filter;
+import org.jboss.seam.core.Init;
+import org.jboss.seam.init.Initialization;
+import org.jboss.seam.log.LogProvider;
+import org.jboss.seam.log.Logging;
+
+ at Name("org.jboss.seam.web.hotDeployFilter")
+ at Install(debug=true, precedence=BUILT_IN)
+ at BypassInterceptors
+ at Scope(APPLICATION)
+ at Filter
+public class HotDeployFilter extends AbstractFilter
+{
+
+   private static LogProvider log = Logging.getLogProvider(HotDeployFilter.class);
+   
+   public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+            throws IOException, ServletException
+   {
+      if (request instanceof HttpServletRequest)
+      {
+         Init init = (Init) getServletContext().getAttribute(Seam.getComponentName(Init.class));
+         if (init != null)
+         {
+            try
+            {
+               new Initialization(getServletContext()).redeploy((HttpServletRequest) request, init);
+            }
+            catch (InterruptedException e)
+            {
+               log.warn("Unable to redeploy, please try again");
+            }
+         }
+      }
+      chain.doFilter(request, response);
+   }
+
+
+
+}


Property changes on: trunk/src/main/org/jboss/seam/web/HotDeployFilter.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Modified: trunk/src/main/org/jboss/seam/web-2.1.xsd
===================================================================
--- trunk/src/main/org/jboss/seam/web-2.1.xsd	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/main/org/jboss/seam/web-2.1.xsd	2008-12-04 08:09:30 UTC (rev 9717)
@@ -4,6 +4,16 @@
     xmlns:components="http://jboss.com/products/seam/components" attributeFormDefault="unqualified">
     <xs:import namespace="http://jboss.com/products/seam/components" schemaLocation="components-2.1.xsd"/>
 
+    <xs:element name="hot-deploy-filter">
+        <xs:annotation>
+            <xs:documentation>This filter triggers a scan for hot deployable components and descriptor files on each request. The URL pattern should be set to the same pattern as used by the Faces Servlet. Note that this filter is automatically disabled when Seam debug mode is disabled.</xs:documentation>
+        </xs:annotation>
+        <xs:complexType mixed="true">
+            <xs:attributeGroup ref="components:attlist.component"/>
+            <xs:attributeGroup ref="web:attlist.filter"/>
+        </xs:complexType>
+    </xs:element>
+
     <xs:element name="identity-filter">
         <xs:annotation>
             <xs:documentation>This filter provides integration between Servlet Security and the identity component.</xs:documentation>

Modified: trunk/src/test/unit/org/jboss/seam/test/unit/AbstractPageTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/AbstractPageTest.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/AbstractPageTest.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -51,14 +51,14 @@
       Pages.instance();
 
       // mark the application as started
-      Lifecycle.mockApplication();
+      Lifecycle.setupApplication();
    }
 
    @AfterMethod
    public void tearDown()
    {
       Lifecycle.endApplication();
-      Lifecycle.unmockApplication();
+      Lifecycle.cleanupApplication();
    }
    
    protected void installComponents(Context appContext)

Modified: trunk/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/PageParamTest.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -48,7 +48,7 @@
       Param param = new Param("param");
       param.setValueExpression(Expressions.instance().createValueExpression("#{variable}"));
       Lifecycle.beginApplication(new HashMap<String, Object>());
-      Lifecycle.mockApplication();
+      Lifecycle.setupApplication();
       assert param.getConverter() == null;
       Lifecycle.endApplication();
    }

Modified: trunk/src/test/unit/org/jboss/seam/test/unit/bpm/TaskListTest.java
===================================================================
--- trunk/src/test/unit/org/jboss/seam/test/unit/bpm/TaskListTest.java	2008-12-04 08:06:28 UTC (rev 9716)
+++ trunk/src/test/unit/org/jboss/seam/test/unit/bpm/TaskListTest.java	2008-12-04 08:09:30 UTC (rev 9717)
@@ -26,7 +26,7 @@
    {
       Lifecycle.beginApplication(new HashMap<String, Object>());
       new Initialization(new MockServletContext()).create().init();
-      Lifecycle.mockApplication();
+      Lifecycle.setupApplication();
       installComponent(Contexts.getApplicationContext(), Actor.class);
       installComponent(Contexts.getApplicationContext(), PooledTaskInstanceList.class);
       installComponent(Contexts.getApplicationContext(), MockRolledBackTransaction.class);




More information about the seam-commits mailing list