You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2007/05/04 02:04:31 UTC

svn commit: r535034 - /cocoon/trunk/tools/cocoon-maven-plugin/src/main/java/org/apache/cocoon/maven/rcl/ReloadingWebappMojo.java

Author: reinhard
Date: Thu May  3 17:04:31 2007
New Revision: 535034

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

Modified:
    cocoon/trunk/tools/cocoon-maven-plugin/src/main/java/org/apache/cocoon/maven/rcl/ReloadingWebappMojo.java

Modified: cocoon/trunk/tools/cocoon-maven-plugin/src/main/java/org/apache/cocoon/maven/rcl/ReloadingWebappMojo.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/tools/cocoon-maven-plugin/src/main/java/org/apache/cocoon/maven/rcl/ReloadingWebappMojo.java?view=diff&rev=535034&r1=535033&r2=535034
==============================================================================
--- cocoon/trunk/tools/cocoon-maven-plugin/src/main/java/org/apache/cocoon/maven/rcl/ReloadingWebappMojo.java (original)
+++ cocoon/trunk/tools/cocoon-maven-plugin/src/main/java/org/apache/cocoon/maven/rcl/ReloadingWebappMojo.java Thu May  3 17:04:31 2007
@@ -36,6 +36,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 
 import org.antlr.stringtemplate.StringTemplate;
@@ -89,6 +90,8 @@
     private static final String WEB_INF_RCL_URLCL_CONF = "WEB-INF/cocoon/rclwrapper.urlcl.conf";
     
     private static final String WEB_INF_RCLWRAPPER_RCL_CONF = "WEB-INF/cocoon/rclwrapper.rcl.conf";
+    
+    private static final String WEB_INF_RCLWRAPPER_PROPERTIES = "/WEB-INF/cocoon/rclwrapper.properties";     
 
 
     /**
@@ -118,6 +121,13 @@
      * @parameter expression="${cocoon.rcl.log4j.useConsoleAppender}"
      */
     private boolean useConsoleAppender = false;
+    
+    /**
+     * Enable reloading or just use this goal to produce a web application environment.
+     * 
+     * @parameter
+     */
+    private boolean reloadingSpringEnabled = true;
 
     /**
      * Logging: Use a custom log4j xml configuration file=
@@ -218,6 +228,9 @@
         // based on the RCL configuration file, create a Cocoon properties file
         createCocoonProperties(webAppBaseDir, props);
         
+        // create RCL properties
+        createProperties(webAppBaseDir);
+        
         // apply xpatch files
         applyXpatchFiles(webAppBaseDir, props);
 
@@ -320,6 +333,17 @@
                     + artifact.getVersion() + ":" + artifact.getType());
         }
     }
+    
+    protected void createProperties(File webAppBaseDir) throws MojoExecutionException {
+        File rclProps = createPath(new File(webAppBaseDir, WEB_INF_RCLWRAPPER_PROPERTIES));       
+        try {
+            Properties props = new Properties();
+            props.setProperty("reloading.spring.enabled", Boolean.toString(this.reloadingSpringEnabled));
+            props.save(new FileOutputStream(rclProps), "Reloading Classloader Properties");
+        } catch (IOException e) {
+            throw new MojoExecutionException("Can't write to  " + rclProps.getAbsolutePath(), e);
+        } 
+    }    
 
     protected void writeLog4jXml(File webAppBaseDir) throws MojoExecutionException {
         Map log4jTemplateMap = new HashMap();