Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 81092 invoked from network); 22 Jul 2004 14:09:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 22 Jul 2004 14:09:18 -0000 Received: (qmail 83127 invoked by uid 500); 22 Jul 2004 14:09:13 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 83041 invoked by uid 500); 22 Jul 2004 14:09:12 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 83027 invoked by uid 99); 22 Jul 2004 14:09:12 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [66.111.4.26] (HELO out2.smtp.messagingengine.com) (66.111.4.26) by apache.org (qpsmtpd/0.27.1) with ESMTP; Thu, 22 Jul 2004 07:09:10 -0700 X-Sasl-enc: 2woE2RBM7EI/j93M4BZqHQ 1090505347 Received: from [127.0.0.1] (unknown [213.48.13.39]) by www.fastmail.fm (Postfix) with ESMTP id 615C2C12428 for ; Thu, 22 Jul 2004 10:09:07 -0400 (EDT) Message-ID: <40FFC960.2020103@upaya.co.uk> Date: Thu, 22 Jul 2004 15:04:16 +0100 From: Upayavira User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: JCS logging References: <40FEFFBA.6050009@reverycodes.com> <40FF5B46.2010700@upaya.co.uk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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 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 {