jefft 2003/03/19 00:19:12
Modified: src/java/org/apache/cocoon/components/modules/input
DefaultsMetaModule.java
src/documentation/xdocs/userdocs/concepts modules.xml
src/webapp/WEB-INF cocoon.xconf
src/webapp/samples/modules menu.xml sitemap.xmap
Added: src/java/org/apache/cocoon/components/modules/input
DefaultsModule.java
Log:
Deprecated DefaultsMetaModule in favour of DefaultsModule.
Revision Changes Path
1.2 +13 -50
cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/DefaultsMetaModule.java
Index: DefaultsMetaModule.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/DefaultsMetaModule.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultsMetaModule.java 9 Mar 2003 00:09:02 -0000 1.1
+++ DefaultsMetaModule.java 19 Mar 2003 08:19:12 -0000 1.2
@@ -57,75 +57,38 @@
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.thread.ThreadSafe;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
/**
- * Set a number of constants. To override the values with input from
- * another module, combine this one with the ChainMetaModule and an
- * arbitrary number of other modules. IOW this is no "meta" module
- * anymore!
- *
- * <values>
- * <skin>myskin</skin>
- * <base>baseurl</base>
- * </values>
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a>
+ * Old name for [EMAIL PROTECTED] DefaultsModule}.
+ * @deprecated Use DefaultsModule instead; this is not a 'meta' module and is
+ * thus misnamed.
* @version CVS $Id$
*/
-public class DefaultsMetaModule extends AbstractLogEnabled
+
+/* Deprecated 2003-03-19. Suggest we keep this class for compat with 2.0.x
+ * until at least v2.2 (JT) */
+
+public class DefaultsMetaModule extends DefaultsModule
implements InputModule, Configurable, ThreadSafe {
- private Map constants = null;
-
public void configure(Configuration config) throws ConfigurationException {
-
- this.constants = new HashMap();
- Configuration[] consts = config.getChild("values").getChildren();
- for (int i=0; i<consts.length; i++) {
- this.constants.put(consts[i].getName(), consts[i].getValue());
- }
+ super.configure( config );
}
-
public Object[] getAttributeValues( String name, Configuration modeConf, Map
objectModel )
throws ConfigurationException {
-
- String parameter=name;
- Configuration mConf = null;
- if (modeConf!=null) {
- mConf = modeConf.getChild("values");
- }
-
- Object[] values = new Object[1];
- values[0] = (mConf!=null? mConf.getChild(parameter).getValue((String)
this.constants.get(parameter))
- : this.constants.get(parameter));
- return values;
+ return super.getAttributeValues( name, modeConf, objectModel );
}
-
public Iterator getAttributeNames( Configuration modeConf, Map objectModel )
throws ConfigurationException {
-
- SortedSet matchset = new TreeSet(this.constants.keySet());
- if (modeConf!=null) {
- Configuration[] consts = modeConf.getChild("values").getChildren();
- for (int i=0; i<consts.length; i++)
- matchset.add(consts[i].getName());
- }
- return matchset.iterator();
+ return super.getAttributeNames( modeConf, objectModel );
}
-
public Object getAttribute( String name, Configuration modeConf, Map
objectModel )
throws ConfigurationException {
-
- Object[] values = this.getAttributeValues(name,modeConf,objectModel);
- return values[0];
+ return super.getAttribute( name, modeConf, objectModel );
}
-
}
1.1
cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/DefaultsModule.java
Index: DefaultsModule.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
[EMAIL PROTECTED]
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 <[EMAIL PROTECTED]>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.components.modules.input;
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.thread.ThreadSafe;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
/**
* Set a number of constants. To override the values with input from
* another module, combine this one with the ChainMetaModule and an
* arbitrary number of other modules. IOW this is no "meta" module
* anymore!
*
* <values>
* <skin>myskin</skin>
* <base>baseurl</base>
* </values>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a>
* @version CVS $Id: DefaultsModule.java,v 1.1 2003/03/19 08:19:12 jefft Exp $
*/
public class DefaultsModule extends AbstractLogEnabled
implements InputModule, Configurable, ThreadSafe {
private Map constants = null;
public void configure(Configuration config) throws ConfigurationException {
this.constants = new HashMap();
Configuration[] consts = config.getChild("values").getChildren();
for (int i=0; i<consts.length; i++) {
this.constants.put(consts[i].getName(), consts[i].getValue());
}
}
public Object[] getAttributeValues( String name, Configuration modeConf, Map
objectModel )
throws ConfigurationException {
String parameter=name;
Configuration mConf = null;
if (modeConf!=null) {
mConf = modeConf.getChild("values");
}
Object[] values = new Object[1];
values[0] = (mConf!=null? mConf.getChild(parameter).getValue((String)
this.constants.get(parameter))
: this.constants.get(parameter));
return values;
}
public Iterator getAttributeNames( Configuration modeConf, Map objectModel )
throws ConfigurationException {
SortedSet matchset = new TreeSet(this.constants.keySet());
if (modeConf!=null) {
Configuration[] consts = modeConf.getChild("values").getChildren();
for (int i=0; i<consts.length; i++)
matchset.add(consts[i].getName());
}
return matchset.iterator();
}
public Object getAttribute( String name, Configuration modeConf, Map objectModel
)
throws ConfigurationException {
Object[] values = this.getAttributeValues(name,modeConf,objectModel);
return values[0];
}
}
1.2 +1 -1 cocoon-2.1/src/documentation/xdocs/userdocs/concepts/modules.xml
Index: modules.xml
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/concepts/modules.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- modules.xml 9 Mar 2003 00:08:17 -0000 1.1
+++ modules.xml 19 Mar 2003 08:19:12 -0000 1.2
@@ -96,7 +96,7 @@
<component-instance name="date"
class="org.apache.cocoon.components.modules.input.DateInputModule"/>
<component-instance name="defaults"
- class="org.apache.cocoon.components.modules.input.DefaultsMetaModule">
+ class="org.apache.cocoon.components.modules.input.DefaultsModule">
<input-module name="request"/>
<values>
<skin>defaultSkin</skin>
1.11 +1 -1 cocoon-2.1/src/webapp/WEB-INF/cocoon.xconf
Index: cocoon.xconf
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/webapp/WEB-INF/cocoon.xconf,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- cocoon.xconf 18 Mar 2003 05:41:36 -0000 1.10
+++ cocoon.xconf 19 Mar 2003 08:19:12 -0000 1.11
@@ -166,7 +166,7 @@
<!-- The 'defaults', 'myxml' and 'slashdot' input modules are used
in the samples -->
- <component-instance logger="core.modules.input" name="defaults"
class="org.apache.cocoon.components.modules.input.DefaultsMetaModule">
+ <component-instance logger="core.modules.input" name="defaults"
class="org.apache.cocoon.components.modules.input.DefaultsModule">
<values>
<skin>defaultSkin</skin>
<base-url>http://localhost:8080/cocoon</base-url>
1.3 +1 -1 cocoon-2.1/src/webapp/samples/modules/menu.xml
Index: menu.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/modules/menu.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- menu.xml 14 Mar 2003 03:41:49 -0000 1.2
+++ menu.xml 19 Mar 2003 08:19:12 -0000 1.3
@@ -14,7 +14,7 @@
<menu label="Modules">
<menu-item label="RequestModule" href="request.xsp"/>
<menu-item label="DateInputModule" href="date.xsp"/>
- <menu-item label="DefaultsMetaModule" href="defaults.xsp"/>
+ <menu-item label="DefaultsModule" href="defaults.xsp"/>
<menu-item label="SessionModule" href="session.xsp"/>
<menu-item label="SessionAttributeModule" href="session-attr.xsp"/>
<menu-item label="SystemPropertiesModule" href="system-property.xsp"/>
1.2 +3 -3 cocoon-2.1/src/webapp/samples/modules/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/modules/sitemap.xmap,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sitemap.xmap 9 Mar 2003 00:11:15 -0000 1.1
+++ sitemap.xmap 19 Mar 2003 08:19:12 -0000 1.2
@@ -165,8 +165,8 @@
<map:parameter name="base-url" value="{defaults:base-url}"/>
</map:generate>
<map:transform src="properties2html.xsl">
- <map:parameter name="title" value="Defaults Input Module
(DefaultsMetaModule)"/>
- <map:parameter name="description" value="DefaultsMetaModule
+ <map:parameter name="title" value="Defaults Input Module
(DefaultsModule)"/>
+ <map:parameter name="description" value="DefaultsModule
contains 'default' values, hardcoded into cocoon.xconf.
It is simply a lookup table containing static values."/>
</map:transform>