vgritsenko 2003/01/24 18:53:41
Modified: src/java/org/apache/cocoon/components/modules/input
AbstractInputModule.java AbstractJXPathModule.java
ChainMetaModule.java JXPathMetaModule.java
MapMetaModule.java SitemapVariableHolder.java
XMLFileModule.java XMLFormInput.java
src/java/org/apache/cocoon/components/modules/output
AbstractOutputModule.java
Log:
javadoc fixes. remove unnesessary type casts. configuration fixes.
Revision Changes Path
1.4 +7 -13
xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/AbstractInputModule.java
Index: AbstractInputModule.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/AbstractInputModule.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractInputModule.java 18 Oct 2002 14:29:21 -0000 1.3
+++ AbstractInputModule.java 25 Jan 2003 02:53:40 -0000 1.4
@@ -87,18 +87,12 @@
* For nested configurations override this function.
* */
public void configure(Configuration conf) throws ConfigurationException {
-
- if (conf != null) {
- String key = null;
- String val = null;
- Configuration[] parameters = conf.getChildren();
- this.settings = new HashMap(parameters.length);
- for ( int i = 0; i < parameters.length; i++) {
- key = parameters[i].getName();
- val = parameters[i].getValue();
- if ( key != null )
- this.settings.put(key, val);
- }
+ Configuration[] parameters = conf.getChildren();
+ this.settings = new HashMap(parameters.length);
+ for (int i = 0; i < parameters.length; i++) {
+ String key = parameters[i].getName();
+ String val = parameters[i].getValue();
+ this.settings.put (key, val);
}
}
1.9 +3 -3
xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/AbstractJXPathModule.java
Index: AbstractJXPathModule.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/AbstractJXPathModule.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- AbstractJXPathModule.java 9 Jan 2003 17:04:18 -0000 1.8
+++ AbstractJXPathModule.java 25 Jan 2003 02:53:40 -0000 1.9
@@ -110,7 +110,7 @@
* Configure component. Preprocess list of packages and functions
* to add to JXPath context later.
*
- * @param conf a <code>Configuration</code> value
+ * @param config a <code>Configuration</code> value
* @exception ConfigurationException if an error occurs
*/
public void configure(Configuration config) throws ConfigurationException {
@@ -247,7 +247,7 @@
for (int i = 0; i < properties.length; i++) {
names.add(properties[i].getName());
}
- return (java.util.Iterator) names.listIterator();
+ return names.listIterator();
} catch (Exception e) {
throw new ConfigurationException(
"Error retrieving attribute names for class: "
1.7 +5 -4
xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/ChainMetaModule.java
Index: ChainMetaModule.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/ChainMetaModule.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ChainMetaModule.java 17 Dec 2002 14:53:16 -0000 1.6
+++ ChainMetaModule.java 25 Jan 2003 02:53:40 -0000 1.7
@@ -61,6 +61,7 @@
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
+
/**
* This modules allows to "chain" several other modules. If a module
* returns "null" as attribute value, the next module in the chain is
@@ -113,7 +114,7 @@
public void configure(Configuration config) throws ConfigurationException {
Configuration[] confs = config.getChildren("input-module");
- if (confs.length>0) {
+ if (confs.length > 0) {
this.inputs = new ModuleHolder[confs.length];
int j = 0;
for (int i=0; i<confs.length; i++) {
@@ -208,7 +209,7 @@
value = getValues(attr, objectModel, this.inputs[i].input,
this.inputs[i].name, this.inputs[i].config);
if (emptyAsNull && value != null && value.length == 0) value =
null;
if (emptyAsNull && value != null && value.length == 1 &&
- value[0] instanceof String &&
((String)value[0]).equals("")) value = null;
+ value[0] instanceof String && value[0].equals("")) value =
null;
if (debug) getLogger().debug("read from "+this.inputs[i].name+"
attribute "+attr+" as "+value);
if (allValues && value != null)
values.addAll(Arrays.asList(value));
}
@@ -223,7 +224,7 @@
value = getValues(attr, objectModel, null, name,
inputConfigs[i]);
if (emptyAsNull && value != null && value.length == 0) value =
null;
if (emptyAsNull && value != null && value.length == 1 &&
- value[0] instanceof String &&
((String)value[0]).equals("")) value = null;
+ value[0] instanceof String && value[0].equals("")) value =
null;
if (debug) getLogger().debug("read from "+name+" attribute
"+attr+" as "+value);
if (allValues && value != null)
values.addAll(Arrays.asList(value));
}
1.7 +3 -3
xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/JXPathMetaModule.java
Index: JXPathMetaModule.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/JXPathMetaModule.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- JXPathMetaModule.java 9 Jan 2003 17:04:18 -0000 1.6
+++ JXPathMetaModule.java 25 Jan 2003 02:53:40 -0000 1.7
@@ -124,7 +124,7 @@
* Configure component. Preprocess list of packages and functions
* to add to JXPath context later.
*
- * @param conf a <code>Configuration</code> value
+ * @param config a <code>Configuration</code> value
* @exception ConfigurationException if an error occurs
*/
public void configure(Configuration config) throws ConfigurationException {
@@ -268,7 +268,7 @@
for (int i = 0; i < properties.length; i++) {
names.add(properties[i].getName());
}
- return (java.util.Iterator) names.listIterator();
+ return names.listIterator();
} catch (Exception e) {
throw new ConfigurationException(
"Error retrieving attribute names for class: "
1.9 +2 -7
xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/MapMetaModule.java
Index: MapMetaModule.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/MapMetaModule.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- MapMetaModule.java 19 Dec 2002 10:34:47 -0000 1.8
+++ MapMetaModule.java 25 Jan 2003 02:53:40 -0000 1.9
@@ -97,17 +97,13 @@
// obtain correct configuration objects
// default vs dynamic
- Configuration inputConfig = this.inputConf;
String inputName=null;
String objectName = this.objectName;
String parameter = this.parameter;
- if (modeConf!=null) {
+ if (modeConf != null) {
inputName =
modeConf.getChild("input-module").getAttribute("name",null);
objectName = modeConf.getAttribute("object",objectName);
parameter = modeConf.getAttribute("parameter",parameter);
- if (inputName != null) {
- inputConfig = modeConf.getChild("input-module");
- }
}
parameter = (parameter != null? parameter : name);
@@ -119,7 +115,6 @@
return value;
}
-
1.2 +3 -6
xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/SitemapVariableHolder.java
Index: SitemapVariableHolder.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/SitemapVariableHolder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SitemapVariableHolder.java 8 Oct 2002 09:48:01 -0000 1.1
+++ SitemapVariableHolder.java 25 Jan 2003 02:53:40 -0000 1.2
@@ -103,14 +103,11 @@
throws ConfigurationException {
this.manager = new Manager();
final Configuration[] parameters = conf.getChildren();
- final int len = parameters.length;
- this.values = new HashMap( len );
- for ( int i = 0; i < len; i++) {
+ this.values = new HashMap(parameters.length);
+ for (int i = 0; i < parameters.length; i++) {
final String key = parameters[i].getName();
final String value = parameters[i].getValue();
- if ( key != null && value != null) {
- this.values.put(key, value);
- }
+ this.values.put(key, value);
}
}
1.6 +14 -16
xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java
Index: XMLFileModule.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XMLFileModule.java 13 Jan 2003 13:12:30 -0000 1.5
+++ XMLFileModule.java 25 Jan 2003 02:53:40 -0000 1.6
@@ -197,9 +197,8 @@
}
-
/**
- * @param conf a <code>Configuration</code> value
+ * @param config a <code>Configuration</code> value
* @exception ConfigurationException if an error occurs
*/
public void configure(Configuration config) throws ConfigurationException {
@@ -209,20 +208,19 @@
this.cacheAll =
config.getChild("cachable").getValueAsBoolean(this.cacheAll);
Configuration[] files = config.getChildren("file");
- if (files != null) {
- if (this.documents == null)
- this.documents = Collections.synchronizedMap(new HashMap());
+ if (this.documents == null)
+ this.documents = Collections.synchronizedMap(new HashMap());
- for (int i=0; i<files.length; i++) {
- boolean reload =
files[i].getAttributeAsBoolean("reloadable",this.reloadAll);
- boolean cache =
files[i].getAttributeAsBoolean("cachable",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
- // if multiple file tags are used.
- this.documents.put(files[i], new DocumentHelper(reload, cache,
this.src));
- }
+ for (int i = 0; i < files.length; i++) {
+ boolean reload = files[i].getAttributeAsBoolean("reloadable",
this.reloadAll);
+ boolean cache = files[i].getAttributeAsBoolean("cachable",
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
+ // if multiple file tags are used.
+ this.documents.put(files[i], new DocumentHelper(reload, cache,
this.src));
}
+
if (this.src == null)
throw new ConfigurationException("No source given!");
}
1.2 +2 -2
xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/XMLFormInput.java
Index: XMLFormInput.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/modules/input/XMLFormInput.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XMLFormInput.java 9 Jan 2003 17:04:18 -0000 1.1
+++ XMLFormInput.java 25 Jan 2003 02:53:40 -0000 1.2
@@ -82,7 +82,7 @@
* Configure component. Preprocess list of packages and functions
* to add to JXPath context later.
*
- * @param conf a <code>Configuration</code> value
+ * @param config a <code>Configuration</code> value
* @exception ConfigurationException if an error occurs
*/
public void configure(Configuration config) throws ConfigurationException {
1.5 +7 -13
xml-cocoon2/src/java/org/apache/cocoon/components/modules/output/AbstractOutputModule.java
Index: AbstractOutputModule.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/modules/output/AbstractOutputModule.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractOutputModule.java 22 Jan 2003 12:42:22 -0000 1.4
+++ AbstractOutputModule.java 25 Jan 2003 02:53:41 -0000 1.5
@@ -90,18 +90,12 @@
* For nested configurations override this function.
* */
public void configure(Configuration conf) throws ConfigurationException {
-
- if (conf != null) {
- String key = null;
- String val = null;
- Configuration[] parameters = conf.getChildren();
- this.settings = new HashMap(parameters.length);
- for ( int i = 0; i < parameters.length; i++) {
- key = parameters[i].getName();
- val = parameters[i].getValue();
- if ( key != null )
- this.settings.put(key, val);
- }
+ Configuration[] parameters = conf.getChildren();
+ this.settings = new HashMap(parameters.length);
+ for (int i = 0; i < parameters.length; i++) {
+ String key = parameters[i].getName();
+ String val = parameters[i].getValue();
+ this.settings.put(key, val);
}
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]