sylvain 2003/10/31 03:12:56
Modified: src/java/org/apache/cocoon Constants.java
src/java/org/apache/cocoon/components/treeprocessor
AbstractProcessingNodeBuilder.java
Log:
Sitemap components now can know their usage location in the sitemap
Revision Changes Path
1.9 +7 -3 cocoon-2.1/src/java/org/apache/cocoon/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/Constants.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Constants.java 27 Sep 2003 13:01:15 -0000 1.8
+++ Constants.java 31 Oct 2003 11:12:56 -0000 1.9
@@ -307,9 +307,13 @@
* FIXME(GP): Isn't this Action specific only?
*/
public static final boolean DESCRIPTOR_RELOADABLE_DEFAULT = true;
+
+ /**
+ * The special parameter passed to each sitemap component (matchers,
generators, etc) that
+ * contains the location of the sitemap statement where this component
is used.
+ */
+ public static final String SITEMAP_PARAMETERS_LOCATION =
"org.apache.cocoon.sitemap/Location";
}
-
-
1.2 +8 -3
cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/AbstractProcessingNodeBuilder.java
Index: AbstractProcessingNodeBuilder.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor/AbstractProcessingNodeBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AbstractProcessingNodeBuilder.java 9 Mar 2003 00:09:15 -0000
1.1
+++ AbstractProcessingNodeBuilder.java 31 Oct 2003 11:12:56 -0000
1.2
@@ -56,9 +56,11 @@
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.cocoon.Constants;
import
org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory;
import org.apache.cocoon.sitemap.PatternException;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -107,10 +109,13 @@
Configuration[] children = config.getChildren("parameter");
if (children.length == 0) {
- return null;
+ // Parameters are only the component's location
+ return
Collections.singletonMap(Constants.SITEMAP_PARAMETERS_LOCATION,
config.getLocation());
}
- Map params = new HashMap();
+ Map params = new HashMap(children.length+1);
+ // Add the location information as a parameter
+ params.put(Constants.SITEMAP_PARAMETERS_LOCATION,
config.getLocation());
for (int i = 0; i < children.length; i++) {
Configuration child = children[i];
if (true) { // FIXME : check namespace