Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 47866 invoked from network); 31 Oct 2003 13:12:08 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 31 Oct 2003 13:12:08 -0000 Received: (qmail 57544 invoked by uid 500); 31 Oct 2003 13:12:05 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 57495 invoked by uid 500); 31 Oct 2003 13:12:04 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 57477 invoked by uid 500); 31 Oct 2003 13:12:04 -0000 Delivered-To: apmail-cocoon-2.2-cvs@apache.org Received: (qmail 57473 invoked from network); 31 Oct 2003 13:12:04 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 31 Oct 2003 13:12:04 -0000 Received: (qmail 47798 invoked by uid 1758); 31 Oct 2003 13:12:06 -0000 Date: 31 Oct 2003 13:12:06 -0000 Message-ID: <20031031131206.47797.qmail@minotaur.apache.org> From: unico@apache.org To: cocoon-2.2-cvs@apache.org Subject: cvs commit: cocoon-2.2/src/webapp/WEB-INF cocoon.xconf X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N unico 2003/10/31 05:12:06 Modified: src/webapp/samples/modules menu.xml index.xhtml sitemap.xmap src/webapp/WEB-INF cocoon.xconf Added: src/java/org/apache/cocoon/components/modules/input PropertiesFileModule.java Log: new properties file input module Revision Changes Path 1.9 +1 -0 cocoon-2.2/src/webapp/samples/modules/menu.xml Index: menu.xml =================================================================== RCS file: /home/cvs/cocoon-2.2/src/webapp/samples/modules/menu.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- menu.xml 18 May 2003 16:31:35 -0000 1.8 +++ menu.xml 31 Oct 2003 13:12:05 -0000 1.9 @@ -24,6 +24,7 @@ + 1.5 +5 -1 cocoon-2.2/src/webapp/samples/modules/index.xhtml Index: index.xhtml =================================================================== RCS file: /home/cvs/cocoon-2.2/src/webapp/samples/modules/index.xhtml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- index.xhtml 17 May 2003 08:11:27 -0000 1.4 +++ index.xhtml 31 Oct 2003 13:12:05 -0000 1.5 @@ -57,9 +57,13 @@ randomnumber Random number - + realpath Real filesystem paths of context paths + + + properties + Properties file values 1.7 +20 -2 cocoon-2.2/src/webapp/samples/modules/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/cocoon-2.2/src/webapp/samples/modules/sitemap.xmap,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- sitemap.xmap 17 May 2003 08:11:27 -0000 1.6 +++ sitemap.xmap 31 Oct 2003 13:12:05 -0000 1.7 @@ -261,7 +261,6 @@ - @@ -275,6 +274,25 @@ + + + + + + + + + + + + + + + + 1.1 cocoon-2.2/src/java/org/apache/cocoon/components/modules/input/PropertiesFileModule.java Index: PropertiesFileModule.java =================================================================== /* ============================================================================ The Apache Software License, Version 1.1 ============================================================================ Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. Redistribution and use in source and binary forms, with or without modifica- tion, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The end-user documentation included with the redistribution, if any, must include the following acknowledgment: "This product includes software developed by the Apache Software Foundation (http://www.apache.org/)." Alternately, this acknowledgment may appear in the software itself, if and wherever such third-party acknowledgments normally appear. 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact apache@apache.org. 5. Products derived from this software may not be called "Apache", nor may "Apache" appear in their name, without prior written permission of the Apache Software Foundation. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the Apache Software Foundation and was originally created by Stefano Mazzocchi . For more information on the Apache Software Foundation, please see . */ package org.apache.cocoon.components.modules.input; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; import java.util.Map; import java.util.Properties; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.logger.AbstractLogEnabled; import org.apache.avalon.framework.service.ServiceException; import org.apache.avalon.framework.service.ServiceManager; import org.apache.avalon.framework.service.Serviceable; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceResolver; /** * Input module for accessing properties in a properties file. * *

* The properties file can only be configured statically and * is resolved via the SourceResolver system. *

* * @author Unico Hommes */ public class PropertiesFileModule extends AbstractLogEnabled implements InputModule, Serviceable, Configurable, ThreadSafe { private SourceResolver m_resolver; private Properties m_properties; public void service(ServiceManager manager) throws ServiceException { m_resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE); } /** * Configure the location of the properties file: *

* <file src="resource://my.properties" /> *

*/ public void configure(Configuration configuration) throws ConfigurationException { String file = configuration.getChild("file").getAttribute("src"); load(file); } private void load(String file) throws ConfigurationException { Source source = null; InputStream stream = null; try { source = m_resolver.resolveURI(file); stream = source.getInputStream(); m_properties = new Properties(); m_properties.load(stream); } catch (IOException e) { throw new ConfigurationException("Cannot load properties file " + file); } finally { if (source != null) { m_resolver.release(source); } if (stream != null) { try { stream.close(); } catch (IOException e) { } } } } public Object getAttribute(String name,Configuration modeConf,Map objectModel) throws ConfigurationException { return m_properties.getProperty(name); } public Iterator getAttributeNames(Configuration modeConf, Map objectModel) throws ConfigurationException { return m_properties.keySet().iterator(); } public Object[] getAttributeValues(String name,Configuration modeConf,Map objectModel) throws ConfigurationException { return new Object[] { getAttribute(name,modeConf,objectModel) }; } } 1.32 +3 -0 cocoon-2.2/src/webapp/WEB-INF/cocoon.xconf Index: cocoon.xconf =================================================================== RCS file: /home/cvs/cocoon-2.2/src/webapp/WEB-INF/cocoon.xconf,v retrieving revision 1.31 retrieving revision 1.32 diff -u -r1.31 -r1.32 --- cocoon.xconf 9 Oct 2003 20:12:35 -0000 1.31 +++ cocoon.xconf 31 Oct 2003 13:12:05 -0000 1.32 @@ -174,6 +174,9 @@ + + +