You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2003/10/31 12:12:56 UTC
cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor AbstractProcessingNodeBuilder.java
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
Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor
AbstractProcessingNodeBuilder.java
Posted by Sylvain Wallez <sy...@apache.org>.
Stefano Mazzocchi wrote:
>
> On Friday, Oct 31, 2003, at 12:31 Europe/Rome, Sylvain Wallez wrote:
>
>> Reinhard Poetz wrote:
>>
>>> From: sylvain@apache.org [mailto:sylvain@apache.org]
>>>
>>>> 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
>>>>
>>>
>>> What does this mean? Can you give me an example?
>>>
>>
>> Wow, you're fast!
>>
>> Here's an example:
>>
>> public void setup(blah, blah, Parameters params) {
>> getLogger().debug("I am used at location " +
>> params.getParameter(Constants.SITEMAP_PARAMETER_LOCATION);
>> }
>>
>> --> I am used a location /path/to/sitemap.xmap:234:12
>
>
> Does this mean that we can have the sitemap-oriented stacktraces now
> <hint/> <hint/>? ;-)
Not yet, and this addition is not related to this: it "only" allows
sitemap components to issue more descriptive logs and exceptions.
To implement sitemap-oriented stacktraces, I'd like to add treeprocessor
listeners that would be notified of start/end of sitemap statements and
of start/end of sitemap processing (yes, it looks like SAX).
Sitemap-level stacktraces can then be implemented by collecting the
startStatement events and building the corresponding stack trace if
endProcessing notifies that an error was raised.
Sylvain
--
Sylvain Wallez Anyware Technologies
http://www.apache.org/~sylvain http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance - http://www.orixo.com
Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor AbstractProcessingNodeBuilder.java
Posted by Stefano Mazzocchi <st...@apache.org>.
On Friday, Oct 31, 2003, at 12:31 Europe/Rome, Sylvain Wallez wrote:
> Reinhard Poetz wrote:
>
>> From: sylvain@apache.org [mailto:sylvain@apache.org]
>>
>>> 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
>>>
>>
>> What does this mean? Can you give me an example?
>>
>
> Wow, you're fast!
>
> Here's an example:
>
> public void setup(blah, blah, Parameters params) {
> getLogger().debug("I am used at location " +
> params.getParameter(Constants.SITEMAP_PARAMETER_LOCATION);
> }
>
> --> I am used a location /path/to/sitemap.xmap:234:12
Does this mean that we can have the sitemap-oriented stacktraces now
<hint/> <hint/>? ;-)
--
Stefano.
Re: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor
AbstractProcessingNodeBuilder.java
Posted by Sylvain Wallez <sy...@apache.org>.
Reinhard Poetz wrote:
>From: sylvain@apache.org [mailto:sylvain@apache.org]
>
>
>
>>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
>>
>>
>
>What does this mean? Can you give me an example?
>
>
Wow, you're fast!
Here's an example:
public void setup(blah, blah, Parameters params) {
getLogger().debug("I am used at location " +
params.getParameter(Constants.SITEMAP_PARAMETER_LOCATION);
}
--> I am used a location /path/to/sitemap.xmap:234:12
Sylvain
--
Sylvain Wallez Anyware Technologies
http://www.apache.org/~sylvain http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance - http://www.orixo.com
RE: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/treeprocessor AbstractProcessingNodeBuilder.java
Posted by Reinhard Poetz <re...@apache.org>.
From: sylvain@apache.org [mailto:sylvain@apache.org]
> 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
What does this mean? Can you give me an example?
--
Reinhard