Dave Brondsema wrote:

Upayavira wrote:

The CLI way would be to add a property tag into the cli.xconf. Now, this
would be a pretty trivial fix to one Cocoon class. Is this what would be
needed?


Sounds like it to me. Can we try it?


Don't have time to do _any_ testing on this (shouldn't really have been doing this little bit). Here's a patch for o.a.c.bean.helpers.BeanConfigurator.

Try this. This should mean that you can put <system-property name="blah" value="diblah"/> into cli.xconf. If it works, either commit it if you can, or tell me and I will.

(watch out for the email wrapped line!)

Regards, Upayavira

Index: src/java/org/apache/cocoon/bean/helpers/BeanConfigurator.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/bean/helpers/BeanConfigurator.java,v
retrieving revision 1.8
diff -u -r1.8 BeanConfigurator.java
--- src/java/org/apache/cocoon/bean/helpers/BeanConfigurator.java 28 Mar 2004 20:51:24 -0000 1.8
+++ src/java/org/apache/cocoon/bean/helpers/BeanConfigurator.java 22 Jul 2004 14:00:01 -0000
@@ -90,6 +90,9 @@
private static final String ATTR_URI_SOURCEURI = "src";
private static final String ATTR_URI_DESTURI = "dest";


+ private static final String NODE_SYSPROP = "system-property";
+ private static final String ATTR_SYSPROP_NAME = "name";
+ private static final String ATTR_SYSPROP_VALUE = "value";
private static final String NODE_URIS = "uris";
private static final String ATTR_NAME = "name";
@@ -213,6 +216,9 @@
} else if (nodeName.equals(NODE_URIS)) {
parseURIsNode(cocoon, node, destDir, uriGroup);


+ } else if (nodeName.equals(NODE_SYSPROP)) {
+ parsePropertyNode(cocoon, node);
+
} else if (nodeName.equals(NODE_URI_FILE)) {
if (hasAttribute(root, ATTR_URI_FILE)) {
throw new IllegalArgumentException("Cannot have "+NODE_URI_FILE+" as both element and attribute");
@@ -241,6 +247,20 @@
if (nodes.getLength()!=0) {
throw new IllegalArgumentException("Unexpected children of <" + NODE_LOGGING + "> node");
}
+ }
+
+ private static void parsePropertyNode(CocoonBean cocoon, Node node) throws IllegalArgumentException {
+ NodeList nodes = node.getChildNodes();
+ if (nodes.getLength()!=0) {
+ throw new IllegalArgumentException("Unexpected children of <" + NODE_LOGGING + "> node");
+ }
+ if (!hasAttribute(node, ATTR_SYSPROP_NAME) || !hasAttribute(node, ATTR_SYSPROP_VALUE)) {
+ throw new IllegalArgumentException("A property node requires both name and value attributes");
+ }
+ String name = getAttributeValue(node, ATTR_SYSPROP_NAME);
+ String value = getAttributeValue(node, ATTR_SYSPROP_VALUE);
+ + System.setProperty(name, value);
}


private static void parseIncludeLinksNode(CocoonBean cocoon, Node node) throws IllegalArgumentException {





Reply via email to