cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r535033 - in /cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper: ./ src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/
Date Fri, 04 May 2007 00:03:44 GMT
Author: reinhard
Date: Thu May  3 17:03:43 2007
New Revision: 535033

URL: http://svn.apache.org/viewvc?view=rev&rev=535033
Log:
make the usage of the spring app context reload configureable

Modified:
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/pom.xml
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/CocoonReloadingListener.java
    cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/ReloadingSpringFilter.java

Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/pom.xml?view=diff&rev=535033&r1=535032&r2=535033
==============================================================================
--- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/pom.xml (original)
+++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/pom.xml Thu May  3 17:03:43 2007
@@ -116,7 +116,7 @@
     <!-- Repository for the commons-jci -->
     <repository>
       <id>apache-m2-snapshot</id>
-      <name>Apache Maven 1 Repository</name>
+      <name>Apache Maven 2 Repository</name>
       <url>http://people.apache.org/repo/m2-snapshot-repository</url>
       <releases>
         <enabled>true</enabled>

Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/CocoonReloadingListener.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/CocoonReloadingListener.java?view=diff&rev=535033&r1=535032&r2=535033
==============================================================================
--- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/CocoonReloadingListener.java
(original)
+++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/CocoonReloadingListener.java
Thu May  3 17:03:43 2007
@@ -53,13 +53,13 @@
 
         if(changedFileParentPath.endsWith("META-INF/cocoon/spring") ||              // global
Spring beans configurations
                 changedFileParentPath.endsWith("config/avalon") ||                  // global
Avalon components
-//                changedFilePath.endsWith(".xmap") ||                                //
any file that ends with xmap (sitemaps)
-//                changedFilePath.endsWith(".xmap.xml") ||                            //
any sitemap that ends with xmap.xml (sitemaps)
-                changedFilePath.endsWith(".class") ||                         // Java class
file change
+                changedFilePath.endsWith(".xmap") ||                                // any
file that ends with xmap (sitemaps)
+                changedFilePath.endsWith(".xmap.xml") ||                            // any
sitemap that ends with xmap.xml (sitemaps)
+                changedFilePath.endsWith(".class") ||                               // Java
class file change
                 changedFileParentPath.endsWith("config/spring")                     // local
Spring bean configurations
            ) {                
             log.debug("Configuration or .class file change detected [" + operation + "]:
" + changedFile);
-//            System.out.println("Configuration or .class file change detected [" + operation
+ "]: " + changedFile);
+            System.out.println("RCL [" + operation + "]: " + changedFile);
             reload = true;
         } else {
             log.debug("Other file change detected, no reload [" + operation + "]: " + changedFile);
 // any other file change

Modified: cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/ReloadingSpringFilter.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/ReloadingSpringFilter.java?view=diff&rev=535033&r1=535032&r2=535033
==============================================================================
--- cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/ReloadingSpringFilter.java
(original)
+++ cocoon/trunk/tools/cocoon-rcl/cocoon-rcl-webapp-wrapper/src/main/java/org/apache/cocoon/tools/rcl/wrapper/servlet/ReloadingSpringFilter.java
Thu May  3 17:03:43 2007
@@ -18,6 +18,7 @@
 
 import java.io.IOException;
 import java.lang.reflect.Method;
+import java.util.Properties;
 
 import javax.servlet.Filter;
 import javax.servlet.FilterChain;
@@ -39,16 +40,17 @@
 public class ReloadingSpringFilter implements Filter {
     
     private final Log log = LogFactory.getLog(ReloadingSpringFilter.class);    
+    
+    private static final String WEB_INF_RCLWRAPPER_PROPERTIES = "/WEB-INF/cocoon/rclwrapper.properties";
        
 
     private FilterConfig config;
 
     public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain)
throws IOException,
             ServletException {
         
-        if(CocoonReloadingListener.isReload()) {
+        if(isReloadingEnabled() && CocoonReloadingListener.isReload()) {
             synchronized (this) {        
                 log.info("Performing a reload of the Spring application context.");
-                System.out.println("Performing a reload of the Spring application context.");
               
                 // load the spring context loader from the reloading classloader
                 ClassLoader cl = ReloadingClassloaderManager.getClassLoader(config.getServletContext());
                 Object reloader = null;
@@ -74,6 +76,13 @@
 
     public void init(FilterConfig filterConfig) throws ServletException {
         this.config = filterConfig;
+    }
+    
+    private boolean isReloadingEnabled() throws IOException {
+        Properties rclProps = new Properties();
+        rclProps.load(this.config.getServletContext().getResourceAsStream(WEB_INF_RCLWRAPPER_PROPERTIES));
+        String reloadingEnabled = rclProps.getProperty("reloading.spring.enabled", "true");
+        return reloadingEnabled.trim().toLowerCase().equals("true");
     }
  
 }



Mime
View raw message