jefft 2003/03/12 21:52:09
Modified: src/java/org/apache/cocoon/components/modules/input
XMLFileModule.java
Log:
Change input param from 'cachable' to 'cacheable'. Throw a meaningful
exception if 'cachable' is encountered.
Revision Changes Path
1.3 +20 -10
cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java
Index: XMLFileModule.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLFileModule.java 12 Mar 2003 15:04:38 -0000 1.2
+++ XMLFileModule.java 13 Mar 2003 05:52:09 -0000 1.3
@@ -78,10 +78,10 @@
*
* <p>Caching and reloading can be turned on / off (default: on)
* through <code><reloadable>false</reloadable></code> and
- * <code><cachable>false</cachable></code>. The file
+ * <code><cacheable>false</cacheable></code>. The file
* (source) to use is specified through <code><file
* src="protocol:path/to/file.xml" reloadable="true"
- * cachable="true"/></code> optionally overriding defaults for
+ * cacheable="true"/></code> optionally overriding defaults for
* caching and or reloading.</p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jeff Turner</a>
@@ -111,7 +111,7 @@
protected class DocumentHelper {
private boolean reloadable = true;
- private boolean cachable = true;
+ private boolean cacheable = true;
/** source location */
private String uri = null;
/** cached DOM */
@@ -127,7 +127,7 @@
*/
public DocumentHelper(boolean reload, boolean cache, String src) {
this.reloadable = reload;
- this.cachable = cache;
+ this.cacheable = cache;
this.uri = src;
// deferr loading document
}
@@ -174,7 +174,7 @@
}
dom = this.document;
}
- if (!this.cachable) {
+ if (!this.cacheable) {
if (logger.isDebugEnabled())
logger.debug("not caching document cached... uri "+this.uri);
this.srcVal = null;
@@ -206,7 +206,11 @@
super.configure(config);
this.reloadAll =
config.getChild("reloadable").getValueAsBoolean(this.reloadAll);
- this.cacheAll =
config.getChild("cachable").getValueAsBoolean(this.cacheAll);
+ if (config.getChild("cachable", false) != null) {
+ throw new ConfigurationException(
+ "Bzzt! Wrong spelling at
"+config.getChild("cachable").getLocation()+": please use 'cacheable', not
'cachable'");
+ }
+ this.cacheAll =
config.getChild("cacheable").getValueAsBoolean(this.cacheAll);
Configuration[] files = config.getChildren("file");
if (this.documents == null)
@@ -214,7 +218,7 @@
for (int i = 0; i < files.length; i++) {
boolean reload = files[i].getAttributeAsBoolean("reloadable",
this.reloadAll);
- boolean cache = files[i].getAttributeAsBoolean("cachable",
this.cacheAll);
+ boolean cache = files[i].getAttributeAsBoolean("cacheable",
this.cacheAll);
this.src = files[i].getAttribute("src");
// by assigning the source uri to this.src the last one will be the
default
// OTOH caching / reload parameters can be specified in one central
place
@@ -242,8 +246,14 @@
if (!this.documents.containsKey(src)) {
if (modeConf != null) {
- reload =
modeConf.getChild("file").getAttributeAsBoolean("reloadable",reload);
- cache =
modeConf.getChild("file").getAttributeAsBoolean("cachable",cache);
+ final Configuration fileConf = modeConf.getChild("file");
+ reload = fileConf.getAttributeAsBoolean("reloadable",reload);
+ cache = fileConf.getAttributeAsBoolean("cacheable",cache);
+ if (fileConf.getAttribute("cachable", null) != null) {
+ throw new ConfigurationException(
+ "Bzzt! Wrong spelling at "+fileConf.getLocation()+":
please use 'cacheable', not 'cachable'");
+ }
+
}
this.documents.put(src, new DocumentHelper(reload, cache, src));
}