You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Nicolas Lichtmaier <ni...@technisys.com.ar> on 2000/12/13 02:24:07 UTC

Setting config options from the zone (patch)

This patch load options from the servlet parameters, and make them
override the global ones from cocoon.properties.

The property in the JServ zone file looks like:

servlet.org.apache.cocoon.Cocoon.initArgs=processor.xsp.localclasspath=/home/nic
k/src/java:/home/nick/src/xml-cocoon/build/classes:/usr/local/share/java/fop_0_1
3_0.jar:/usr/local/share/java/xerces_1_2.jar:/usr/local/share/java/xalan_1_2_D02
.jar:/usr/local/share/java/xml.jar:/usr/local/share/java/turbine-pool.jar

(localclasspath is a property used in a patch I'll send shortly)

I making Cocoon work with JServ and zones (several developers in Apache+JServ
using the same JVM!), and this lets me have a global configuration and still
pass different options for different developers.

Index: Cocoon.java
===================================================================
RCS file: /home/cvspublic/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.18
diff -u -r1.18 Cocoon.java
--- Cocoon.java	2000/12/12 16:08:02	1.18
+++ Cocoon.java	2000/12/13 01:14:36
@@ -139,7 +139,14 @@
             } else {
                confs = new Configurations(confsName);
             }
-            
+
+	    // Override configuration settings with the "zone" values
+	    Enumeration e = config.getInitParameterNames();
+	    while(e.hasMoreElements()) {
+	    	String name = (String)e.nextElement();
+	    	confs.put(name, config.getInitParameter(name));
+	    }
+
             // Save servlet configurations
             showStatus = ((String) confs.get(SHOW_STATUS, "false")).toLowerCase().equals("true");
             statusURL = (String) confs.get(STATUS_URL, STATUS_URL_DEFAULT);