You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gi...@locus.apache.org on 2000/08/03 00:48:30 UTC
cvs commit: xml-cocoon/xdocs/drafts sitemap-working-draft.xmap
giacomo 00/08/02 15:48:30
Modified: conf Tag: xml-cocoon2 sitemap.xmap
samples/stylesheets Tag: xml-cocoon2
simple-directory2html.xsl
src/org/apache/cocoon/components/language/markup/sitemap/java
Tag: xml-cocoon2 sitemap.xsl
src/org/apache/cocoon/generation Tag: xml-cocoon2
DirectoryGenerator.java
src/org/apache/cocoon/sitemap Tag: xml-cocoon2
ResourcePipeline.java
xdocs/drafts Tag: xml-cocoon2 sitemap-working-draft.xmap
Added: samples/stylesheets Tag: xml-cocoon2 simple-error2html.xsl
src/org/apache/cocoon/sitemap Tag: xml-cocoon2
ErrorGenerator.java
Log:
Implemented ErrorGenerator contributed by Nicola Ken Barozzi
Revision Changes Path
No revision
No revision
1.1.2.5 +5 -0 xml-cocoon/conf/Attic/sitemap.xmap
Index: sitemap.xmap
===================================================================
RCS file: /home/cvs/xml-cocoon/conf/Attic/sitemap.xmap,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- sitemap.xmap 2000/07/28 16:19:49 1.1.2.4
+++ sitemap.xmap 2000/08/02 22:48:25 1.1.2.5
@@ -124,6 +124,11 @@
<parameter name="contentType" value="text/html"/>
</map:serialize>
</map:match>
+
+ <map:handle-errors>
+ <map:transform src="stylesheets/simple-error2html.xsl"/>
+ <map:serialize/>
+ </map:handle-errors>
</map:pipeline>
</map:pipelines>
No revision
No revision
1.1.2.3 +1 -1 xml-cocoon/samples/stylesheets/Attic/simple-directory2html.xsl
Index: simple-directory2html.xsl
===================================================================
RCS file: /home/cvs/xml-cocoon/samples/stylesheets/Attic/simple-directory2html.xsl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- simple-directory2html.xsl 2000/05/24 22:38:03 1.1.2.2
+++ simple-directory2html.xsl 2000/08/02 22:48:26 1.1.2.3
@@ -1,6 +1,6 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:dir="http://xml.apache.org/cocoon/2.0/DirectoryGenerator">
+ xmlns:dir="http://apache.org/cocoon/2.0/DirectoryGenerator">
<xsl:template match="/">
<html>
No revision
No revision
1.1.2.1 +48 -0 xml-cocoon/samples/stylesheets/Attic/simple-error2html.xsl
No revision
No revision
1.1.2.18 +36 -13 xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl
Index: sitemap.xsl
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -u -r1.1.2.17 -r1.1.2.18
--- sitemap.xsl 2000/07/30 19:08:57 1.1.2.17
+++ sitemap.xsl 2000/08/02 22:48:28 1.1.2.18
@@ -2,7 +2,7 @@
<!-- Sitemap Core logicsheet for the Java language -->
<!--
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.17 $ $Date: 2000/07/30 19:08:57 $
+ * @version CVS $Revision: 1.1.2.18 $ $Date: 2000/08/02 22:48:28 $
-->
<xsl:stylesheet
@@ -48,6 +48,7 @@
import org.apache.cocoon.sitemap.ResourcePipeline;
import org.apache.cocoon.sitemap.Sitemap;
import org.apache.cocoon.sitemap.SitemapManager;
+ import org.apache.cocoon.sitemap.ErrorGenerator;
import org.apache.cocoon.transformation.Transformer;
import org.xml.sax.SAXException;
@@ -60,7 +61,7 @@
private Parameters emptyParam = new Parameters();
- private Generator generator_error_handler = null;
+ private Generator generator_error_handler = new ErrorGenerator();
<!-- generate variables for all components -->
/** The generators */
@@ -228,26 +229,48 @@
List list = null;
Parameters param = null;
<xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
+ <xsl:variable name="pipeline-position" select="position()"/>
try {
<xsl:apply-templates select="./*"/>
} catch (Exception e) {
<xsl:choose>
- <xsl:when test="not (./map:handle-errors)">
- System.out.println (e.toString());
- e.printStackTrace(System.out);
- </xsl:when>
- <xsl:otherwise>
-
- pipeline.setGenerator (generator_error_handler, e.getMessage(), null, emptyParam);
- <xsl:apply-templates select="./map:handle-error/*"/>
- return pipeline.process (environment, out);
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:when test="(./map:handle-errors)">
+ try {
+ return error_process_<xsl:value-of select="$pipeline-position"/> (environment, out, e);
+ } catch (Exception ex) {
+ System.out.println (ex.toString());
+ ex.printStackTrace(System.out);
+ }
+ </xsl:when>
+ <xsl:otherwise>
+ System.out.println (e.toString());
+ e.printStackTrace(System.out);
+ </xsl:otherwise>
+ </xsl:choose>
}
</xsl:for-each>
return false;
}
+
+ <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
+ <xsl:variable name="pipeline-position" select="position()"/>
+ <xsl:if test="(./map:handle-errors)">
+ private boolean error_process_<xsl:value-of select="$pipeline-position"/> (Environment environment, OutputStream out, Exception e)
+ throws Exception {
+ ResourcePipeline pipeline = new ResourcePipeline ();
+ pipeline.setComponentManager (this.manager);
+ List listOfLists = (List)(new ArrayList());
+ List list = null;
+ Parameters param = null;
+ pipeline.setGenerator (generator_error_handler, e.getMessage(), null, emptyParam);
+ ErrorGenerator eg = (ErrorGenerator) pipeline.getGenerator();
+ eg.setException (e);
+ <xsl:apply-templates select="./map:handle-errors/*"/>
+ }
+ </xsl:if>
+ </xsl:for-each>
}
+
</xsl:template> <!-- match="map:sitemap" -->
No revision
No revision
1.1.2.4 +2 -2 xml-cocoon/src/org/apache/cocoon/generation/Attic/DirectoryGenerator.java
Index: DirectoryGenerator.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/DirectoryGenerator.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- DirectoryGenerator.java 2000/07/27 21:49:00 1.1.2.3
+++ DirectoryGenerator.java 2000/08/02 22:48:28 1.1.2.4
@@ -52,12 +52,12 @@
*
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/27 21:49:00 $ */
+ * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/08/02 22:48:28 $ */
public class DirectoryGenerator extends ComposerGenerator {
/** The URI of the namespace of this generator. */
protected static final String URI =
- "http://xml.apache.org/cocoon/2.0/DirectoryGenerator";
+ "http://apache.org/cocoon/2.0/DirectoryGenerator";
/* Node and attribute names */
protected static final String DIR_NODE_NAME = "directory";
No revision
No revision
1.1.2.11 +6 -2 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/ResourcePipeline.java
Index: ResourcePipeline.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/ResourcePipeline.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- ResourcePipeline.java 2000/07/31 17:05:56 1.1.2.10
+++ ResourcePipeline.java 2000/08/02 22:48:29 1.1.2.11
@@ -28,9 +28,8 @@
import org.xml.sax.SAXException;
/**
- *
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/07/31 17:05:56 $
+ * @version CVS $Revision: 1.1.2.11 $ $Date: 2000/08/02 22:48:29 $
*/
public class ResourcePipeline implements Composer {
private Generator generator = null;
@@ -57,6 +56,7 @@
public void setComponentManager (ComponentManager manager) {
this.manager = manager;
}
+
public void setGenerator (Generator generator, String source,
Configuration conf, Parameters param)
throws InstantiationException, IllegalAccessException {
@@ -67,6 +67,10 @@
((Configurable)this.generator).setConfiguration (conf);
this.generatorSource = source;
this.generatorParam = param;
+ }
+
+ public Generator getGenerator () {
+ return this.generator;
}
public void setReader (Reader reader, String source,
No revision
No revision
1.1.2.1 +241 -0 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/ErrorGenerator.java
No revision
No revision
1.1.2.13 +1 -1 xml-cocoon/xdocs/drafts/Attic/sitemap-working-draft.xmap
Index: sitemap-working-draft.xmap
===================================================================
RCS file: /home/cvs/xml-cocoon/xdocs/drafts/Attic/sitemap-working-draft.xmap,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -r1.1.2.12 -r1.1.2.13
--- sitemap-working-draft.xmap 2000/07/20 21:57:26 1.1.2.12
+++ sitemap-working-draft.xmap 2000/08/02 22:48:29 1.1.2.13
@@ -367,7 +367,7 @@
</map:match>
<map:handle-errors>
- <map:serialize type="xml"/>
+ <map:serialize type="html"/>
</map:handle-errors>
</map:pipeline>