giacomo 00/07/25 11:48:51
Modified: . Tag: xml-cocoon2 build.xml
src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
src/org/apache/cocoon/components/language/markup/sitemap/java
Tag: xml-cocoon2 sitemap.xsl
src/org/apache/cocoon/environment Tag: xml-cocoon2
Environment.java
src/org/apache/cocoon/environment/http Tag: xml-cocoon2
HttpEnvironment.java
src/org/apache/cocoon/generation Tag: xml-cocoon2
FileGenerator.java
src/org/apache/cocoon/servlet Tag: xml-cocoon2
CocoonServlet.java
src/org/apache/cocoon/sitemap Tag: xml-cocoon2
ResourcePipeline.java SitemapHandler.java
SitemapManager.java
src/org/apache/cocoon/transformation Tag: xml-cocoon2
XalanTransformer.java
src/org/apache/cocoon/xml/util Tag: xml-cocoon2
DocumentHandlerWrapper.java
Log:
Some changes and fixes
Revision Changes Path
No revision
No revision
1.6.2.17 +19 -3 xml-cocoon/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-cocoon/build.xml,v
retrieving revision 1.6.2.16
retrieving revision 1.6.2.17
diff -u -r1.6.2.16 -r1.6.2.17
--- build.xml 2000/07/23 00:04:07 1.6.2.16
+++ build.xml 2000/07/25 18:48:21 1.6.2.17
@@ -60,6 +60,7 @@
- package [default] -> creates ./build/cocoon/cocoon.jar
- webapp -> creates ./build/webapp/cocoon.war
- docs -> generates the HTML documentation in ./build/cocoon/docs
+ - printer-docs -> generates printer friendly HTML documentation in
./build/printer-docs
- javadocs -> generates the API documentation in ./build/cocoon/javadocs
- dist-zip -> generates the Cocoon distribution in ./dist
- dist-tgz -> generates the Cocoon distribution in ./dist
@@ -88,7 +89,7 @@
<property name="build.compiler" value="classic"/>
<property name="debug" value="on"/>
<property name="optimize" value="on"/>
- <property name="deprecation" value="on"/>
+ <property name="deprecation" value="off"/>
<property name="src.dir" value="./src"/>
<property name="lib.dir" value="./lib"/>
@@ -100,7 +101,8 @@
<property name="samples.dir" value="./samples"/>
<property name="packages" value="org.apache.*"/>
- <property name="skin" value="./skins/xml.apache.org/"/>
+ <property name="browser.skin" value="${skins.dir}/xml.apache.org/"/>
+ <property name="printer.skin" value="${skins.dir}/printer/"/>
<property name="doc.generator" value="org.apache.stylebook.StyleBook"/>
<property name="doc.generator.package"
value="${lib.dir}/stylebook-1.0-b2.jar"/>
@@ -109,6 +111,7 @@
<property name="build.src" value="${build.dir}/src"/>
<property name="build.dest" value="${build.dir}/classes"/>
<property name="build.docs" value="${build.dir}/docs"/>
+ <property name="build.docs.printer" value="${build.dir}/printer-docs"/>
<property name="build.war" value="${build.dir}/webapp"/>
<property name="build.javadocs" value="${build.dir}/javadocs"/>
@@ -159,6 +162,7 @@
<echo message=" webapp --> generates the cocoon.war file"/>
<echo message=" compile --> compiles the source code"/>
<echo message=" docs --> generates the HTML documentation"/>
+ <echo message=" printer-docs --> generates printer-friendly HTML
documentation"/>
<echo message=" javadocs --> generates the API documentation"/>
<echo message=" dist-zip --> generates the Cocoon distribution as
.zip"/>
<echo message=" dist-tgz --> generates the Cocoon distribution as
.tar.gz"/>
@@ -248,7 +252,19 @@
<java fork="yes"
classpath="${java.class.path}:${doc.generator.package}"
classname="${doc.generator}"
- args="targetDirectory=${build.docs} ${docs.dir}/book.xml ${skin}"/>
+ args="targetDirectory=${build.docs} ${docs.dir}/book.xml
${browser.skin}"/>
+ </target>
+
+ <!-- ===================================================================
-->
+ <!-- Generate printer-friendly HTML docs
-->
+ <!-- ===================================================================
-->
+ <target name="printer-docs" depends="prepare-docs">
+ <mkdir dir="${build.docs.printer}"/>
+ <copyfile src="${docs.dir}/docs-book.xml" dest="${docs.dir}/book.xml"
filtering="on"/>
+ <java fork="yes"
+ classpath="${java.class.path}:${doc.generator.package}"
+ classname="${doc.generator}"
+ args="targetDirectory=${build.docs.printer} ${docs.dir}/book.xml
${printer.skin}"/>
</target>
<!-- ===================================================================
-->
No revision
No revision
1.4.2.14 +5 -6 xml-cocoon/src/org/apache/cocoon/Cocoon.java
Index: Cocoon.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
retrieving revision 1.4.2.13
retrieving revision 1.4.2.14
diff -u -r1.4.2.13 -r1.4.2.14
--- Cocoon.java 2000/07/23 00:04:09 1.4.2.13
+++ Cocoon.java 2000/07/25 18:48:24 1.4.2.14
@@ -40,11 +40,10 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.4.2.13 $ $Date: 2000/07/23 00:04:09 $
+ * @version CVS $Revision: 1.4.2.14 $ $Date: 2000/07/25 18:48:24 $
*/
public class Cocoon
-implements Component, Configurable, ComponentManager, Modifiable, Processor,
- EntityResolver {
+implements Component, Configurable, ComponentManager, Modifiable, Processor {
/** The table of role-class */
private Hashtable components=new Hashtable();
@@ -188,15 +187,15 @@
/**
* Resolve an entity.
*/
- public InputSource resolveEntity(String systemId)
+ private InputSource resolveEntityXXX(String systemId)
throws SAXException, IOException {
- return(this.resolveEntity(null,systemId));
+ return(this.resolveEntityXXX(null,systemId));
}
/**
* Resolve an entity.
*/
- public InputSource resolveEntity(String publicId, String systemId)
+ private InputSource resolveEntityXXX(String publicId, String systemId)
throws SAXException, IOException {
System.out.println
("Cocoon.resolveEntity(\""+publicId+"\",\""+systemId+"\")");
if (systemId==null) throw new SAXException("Invalid System ID");
No revision
No revision
1.1.2.14 +571 -567
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.13
retrieving revision 1.1.2.14
diff -u -r1.1.2.13 -r1.1.2.14
--- sitemap.xsl 2000/07/23 00:04:10 1.1.2.13
+++ sitemap.xsl 2000/07/25 18:48:25 1.1.2.14
@@ -1,582 +1,586 @@
-<?xml version="1.0"?>
-<!-- Sitemap Core logicsheet for the Java language -->
-
-<xsl:stylesheet version="1.0"
- xmlns:map="http://apache.org/cocoon/sitemap/1.0"
- xmlns:java="http://xml.apache.org/xslt/java"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
->
-
- <xsl:output method="text"/>
-
- <xsl:variable name="prefix">map</xsl:variable>
- <xsl:variable name="matcher-factory-loader"
select="java:org.apache.cocoon.sitemap.XSLTMatcherFactoryLoader.new()"/>
- <xsl:variable name="selector-factory-loader"
select="java:org.apache.cocoon.sitemap.XSLTSelectorFactoryLoader.new()"/>
-
- <xsl:template match="/">
- <code xml:space="preserve">
- <xsl:apply-templates/>
- </code>
- </xsl:template>
-
- <xsl:template match="map:sitemap">
- package <xsl:value-of select="translate(@file-path, '/', '.')"/>;
-
- import java.io.OutputStream;
- import java.io.IOException;
-
- import java.util.List;
- import java.util.ArrayList;
-
- import org.apache.avalon.Configurable;
- import org.apache.avalon.Configuration;
- import org.apache.avalon.ConfigurationException;
- import org.apache.avalon.SAXConfigurationBuilder;
- import org.apache.avalon.utils.Parameters;
-
- import org.apache.cocoon.ProcessingException;
- import org.apache.cocoon.environment.Environment;
- import org.apache.cocoon.generation.Generator;
- import org.apache.cocoon.matching.Matcher;
- import org.apache.cocoon.reading.Reader;
- import org.apache.cocoon.selection.Selector;
- import org.apache.cocoon.serialization.Serializer;
- import org.apache.cocoon.sitemap.AbstractSitemap;
- import org.apache.cocoon.sitemap.ResourcePipeline;
- import org.apache.cocoon.sitemap.Sitemap;
- import org.apache.cocoon.sitemap.SitemapManager;
- import org.apache.cocoon.transformation.Transformer;
-
- import org.xml.sax.SAXException;
- import org.xml.sax.helpers.AttributesImpl;
-<!--
+<?xml version="1.0"?>
+<!-- Sitemap Core logicsheet for the Java language -->
+
+<xsl:stylesheet version="1.0"
+ xmlns:map="http://apache.org/cocoon/sitemap/1.0"
+ xmlns:java="http://xml.apache.org/xslt/java"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+ <xsl:output method="text"/>
+
+ <xsl:variable name="prefix">map</xsl:variable>
+ <xsl:variable name="matcher-factory-loader"
select="java:org.apache.cocoon.sitemap.XSLTMatcherFactoryLoader.new()"/>
+ <xsl:variable name="selector-factory-loader"
select="java:org.apache.cocoon.sitemap.XSLTSelectorFactoryLoader.new()"/>
+
+ <xsl:template match="/">
+ <code xml:space="preserve">
+ <xsl:apply-templates/>
+ </code>
+ </xsl:template>
+
+ <xsl:template match="map:sitemap">
+ package <xsl:value-of select="translate(@file-path, '/', '.')"/>;
+
+ import java.io.OutputStream;
+ import java.io.IOException;
+
+ import java.util.List;
+ import java.util.ArrayList;
+
+ import org.apache.avalon.Configurable;
+ import org.apache.avalon.Configuration;
+ import org.apache.avalon.ConfigurationException;
+ import org.apache.avalon.SAXConfigurationBuilder;
+ import org.apache.avalon.utils.Parameters;
+
+ import org.apache.cocoon.ProcessingException;
+ import org.apache.cocoon.environment.Environment;
+ import org.apache.cocoon.generation.Generator;
+ import org.apache.cocoon.matching.Matcher;
+ import org.apache.cocoon.reading.Reader;
+ import org.apache.cocoon.selection.Selector;
+ import org.apache.cocoon.serialization.Serializer;
+ import org.apache.cocoon.sitemap.AbstractSitemap;
+ import org.apache.cocoon.sitemap.ResourcePipeline;
+ import org.apache.cocoon.sitemap.Sitemap;
+ import org.apache.cocoon.sitemap.SitemapManager;
+ import org.apache.cocoon.transformation.Transformer;
+
+ import org.xml.sax.SAXException;
+ import org.xml.sax.helpers.AttributesImpl;
+<!--
/**
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.13 $ $Date: 2000/07/23 00:04:10 $
*
-/
+ * @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
+ * @version CVS $Revision: 1.1.2.14 $ $Date: 2000/07/25 18:48:25 $
+ *
+/
-->
-public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
+public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
static {
dateCreated = <xsl:value-of select="@creation-date"/>L;
}
-
- private Parameters emptyParam = new Parameters();
-
- private Generator generator_error_handler = null;
-
- <!-- generate variables for all components -->
- /** The generators */
- <xsl:for-each
select="/map:sitemap/map:components/map:generators/map:generator">
- private Generator generator_<xsl:value-of select="translate(./@name,
'- ', '__')"/> = null;
- </xsl:for-each>
-
- /** The transformers */
- <xsl:for-each
select="/map:sitemap/map:components/map:transformers/map:transformer">
- private Transformer transformer_<xsl:value-of
select="translate(./@name, '- ', '__')"/> = null;
- </xsl:for-each>
-
- /** The readers */
- <xsl:for-each
select="/map:sitemap/map:components/map:readers/map:reader">
- private Reader reader_<xsl:value-of select="translate(./@name, '- ',
'__')"/> = null;
- </xsl:for-each>
-
- /** The serializers */
- <xsl:for-each
select="/map:sitemap/map:components/map:serializers/map:serializer">
- private Serializer serializer_<xsl:value-of select="translate(./@name,
'- ', '__')"/> = null;
- </xsl:for-each>
-
- /** The matchers */
- <xsl:for-each
select="/map:sitemap/map:components/map:matchers/map:[EMAIL PROTECTED]">
- private Matcher matcher_<xsl:value-of select="translate(./@name, '- ',
'__')"/> = null;
- </xsl:for-each>
-
- /** The selectors */
- <xsl:for-each
select="/map:sitemap/map:components/map:selectors/map:[EMAIL PROTECTED]">
- private Selector selector_<xsl:value-of select="translate(./@name, '-
', '__')"/> = null;
- </xsl:for-each>
-
- /** The generated matchers */
- <xsl:for-each
select="/map:sitemap/map:components/map:matchers/map:[EMAIL PROTECTED]">
- <xsl:variable name="factory" select="@factory"/>
- <xsl:variable name="type" select="@name"/>
- <xsl:variable name="default"><xsl:if test="$type =
../@default">true</xsl:if></xsl:variable>
- <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
- <xsl:for-each
select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:[EMAIL
PROTECTED] or (not(@type) and $default!='')]">
- <xsl:variable name="matcher-name1" select="translate(@pattern,'/-
*?@:{}()[].#^\\$|!','_')"/>
- <xsl:variable name="matcher-name">matcher_<xsl:value-of
select='translate($matcher-name1,"'","")'/></xsl:variable>
- <xsl:value-of select="java:getSource($matcher-factory-loader,
string('class'), string($factory), string($matcher-name), string(@pattern),
$config)"/>
- private List <xsl:value-of select="$matcher-name"/> (String pattern,
Environment environment) {
- <xsl:value-of select="java:getSource($matcher-factory-loader,
string('method'), string($factory), string($matcher-name), string(@pattern),
$config)"/>
- }
- </xsl:for-each>
- </xsl:for-each>
-
- /** The generated selectors */
- <xsl:for-each
select="/map:sitemap/map:components/map:selectors/map:[EMAIL PROTECTED]">
- <xsl:variable name="factory" select="@factory"/>
- <xsl:variable name="type" select="@name"/>
- <xsl:variable name="default"><xsl:if test="$type =
../@default">true</xsl:if></xsl:variable>
- <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
- <xsl:for-each
select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:when[../map:select/@type=$type
or (not(../map:select/@type) and $default!='')]">
- <xsl:variable name="selector-name1" select="translate(@test,'/-
*?@:{}()[].#^\\$|!','_')"/>
- <xsl:variable name="selector-name">selector_<xsl:value-of
select='translate($selector-name1,"'","")'/></xsl:variable>
- <xsl:value-of select="java:getSource($selector-factory-loader,
string('class'), string($factory), string($selector-name), string(@test),
$config)"/>
- private boolean <xsl:value-of select="$selector-name"/> (String
test, Environment environment) {
- <xsl:value-of select="java:getSource($selector-factory-loader,
string('method'), string($factory), string($selector-name), string(@test),
$config)"/>
- }
- </xsl:for-each>
- </xsl:for-each>
-
- /**
- * Pass a <code>Configuration</code> instance to this
- * <code>Configurable</code> class.
- */
- public void setConfiguration(Configuration conf)
- throws ConfigurationException /*, SAXException, ClassNotFoundException,
- InstantiationException, IllegalAccessException */ {
+
+ private Parameters emptyParam = new Parameters();
+
+ private Generator generator_error_handler = null;
+
+ <!-- generate variables for all components -->
+ /** The generators */
+ <xsl:for-each
select="/map:sitemap/map:components/map:generators/map:generator">
+ private Generator generator_<xsl:value-of select="translate(./@name,
'- ', '__')"/> = null;
+ </xsl:for-each>
+
+ /** The transformers */
+ <xsl:for-each
select="/map:sitemap/map:components/map:transformers/map:transformer">
+ private Transformer transformer_<xsl:value-of
select="translate(./@name, '- ', '__')"/> = null;
+ </xsl:for-each>
+
+ /** The readers */
+ <xsl:for-each
select="/map:sitemap/map:components/map:readers/map:reader">
+ private Reader reader_<xsl:value-of select="translate(./@name, '- ',
'__')"/> = null;
+ </xsl:for-each>
+
+ /** The serializers */
+ <xsl:for-each
select="/map:sitemap/map:components/map:serializers/map:serializer">
+ private Serializer serializer_<xsl:value-of select="translate(./@name,
'- ', '__')"/> = null;
+ </xsl:for-each>
+
+ /** The matchers */
+ <xsl:for-each
select="/map:sitemap/map:components/map:matchers/map:[EMAIL PROTECTED]">
+ private Matcher matcher_<xsl:value-of select="translate(./@name, '- ',
'__')"/> = null;
+ </xsl:for-each>
+
+ /** The selectors */
+ <xsl:for-each
select="/map:sitemap/map:components/map:selectors/map:[EMAIL PROTECTED]">
+ private Selector selector_<xsl:value-of select="translate(./@name, '-
', '__')"/> = null;
+ </xsl:for-each>
+
+ /** The generated matchers */
+ <xsl:for-each
select="/map:sitemap/map:components/map:matchers/map:[EMAIL PROTECTED]">
+ <xsl:variable name="factory" select="@factory"/>
+ <xsl:variable name="type" select="@name"/>
+ <xsl:variable name="default"><xsl:if test="$type =
../@default">true</xsl:if></xsl:variable>
+ <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
+ <xsl:for-each
select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:[EMAIL
PROTECTED] or (not(@type) and $default!='')]">
+ <xsl:variable name="matcher-name1" select="translate(@pattern,'/-
*?@:{}()[].#^\\$|!','_')"/>
+ <xsl:variable name="matcher-name">matcher_<xsl:value-of
select='translate($matcher-name1,"'","")'/></xsl:variable>
+ <xsl:value-of select="java:getSource($matcher-factory-loader,
string('class'), string($factory), string($matcher-name), string(@pattern),
$config)"/>
+ private List <xsl:value-of select="$matcher-name"/> (String pattern,
Environment environment) {
+ <xsl:value-of select="java:getSource($matcher-factory-loader,
string('method'), string($factory), string($matcher-name), string(@pattern),
$config)"/>
+ }
+ </xsl:for-each>
+ </xsl:for-each>
+
+ /** The generated selectors */
+ <xsl:for-each
select="/map:sitemap/map:components/map:selectors/map:[EMAIL PROTECTED]">
+ <xsl:variable name="factory" select="@factory"/>
+ <xsl:variable name="type" select="@name"/>
+ <xsl:variable name="default"><xsl:if test="$type =
../@default">true</xsl:if></xsl:variable>
+ <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
+ <xsl:for-each
select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:when[../map:select/@type=$type
or (not(../map:select/@type) and $default!='')]">
+ <xsl:variable name="selector-name1" select="translate(@test,'/-
*?@:{}()[].#^\\$|!','_')"/>
+ <xsl:variable name="selector-name">selector_<xsl:value-of
select='translate($selector-name1,"'","")'/></xsl:variable>
+ <xsl:value-of select="java:getSource($selector-factory-loader,
string('class'), string($factory), string($selector-name), string(@test),
$config)"/>
+ private boolean <xsl:value-of select="$selector-name"/> (String
test, Environment environment) {
+ <xsl:value-of select="java:getSource($selector-factory-loader,
string('method'), string($factory), string($selector-name), string(@test),
$config)"/>
+ }
+ </xsl:for-each>
+ </xsl:for-each>
+
+ /**
+ * Pass a <code>Configuration</code> instance to this
+ * <code>Configurable</code> class.
+ */
+ public void setConfiguration(Configuration conf)
+ throws ConfigurationException /*, SAXException, ClassNotFoundException,
+ InstantiationException, IllegalAccessException */ {
SAXConfigurationBuilder confBuilder = new SAXConfigurationBuilder ();
Configuration cconf = null;
- AttributesImpl attr = new AttributesImpl();
-
- this.sitemapManager = new SitemapManager();
- this.sitemapManager.setComponentManager(this.manager);
- this.sitemapManager.setConfiguration(conf);
+ AttributesImpl attr = new AttributesImpl();
+
+ this.sitemapManager = new SitemapManager();
+ this.sitemapManager.setComponentManager(this.manager);
+ this.sitemapManager.setConfiguration(conf);
try {
- <!-- configure all components -->
- /* Configure generators */
- <xsl:call-template name="config-components">
- <xsl:with-param name="name">generator</xsl:with-param>
- <xsl:with-param name="interface">Generator</xsl:with-param>
- <xsl:with-param name="components"
-
select="/map:sitemap/map:components/map:generators/map:generator"/>
- </xsl:call-template>
-
- /* Configure transformers */
- <xsl:call-template name="config-components">
- <xsl:with-param name="name">transformer</xsl:with-param>
- <xsl:with-param name="interface">Transformer</xsl:with-param>
- <xsl:with-param name="components"
-
select="/map:sitemap/map:components/map:transformers/map:transformer"/>
- </xsl:call-template>
-
- /* Configure readers */
- <xsl:call-template name="config-components">
- <xsl:with-param name="name">reader</xsl:with-param>
- <xsl:with-param name="interface">Reader</xsl:with-param>
- <xsl:with-param name="components"
- select="/map:sitemap/map:components/map:readers/map:reader"/>
- </xsl:call-template>
-
- /* Configure serializers */
- <xsl:call-template name="config-components">
- <xsl:with-param name="name">serializer</xsl:with-param>
- <xsl:with-param name="interface">Serializer</xsl:with-param>
- <xsl:with-param name="components"
-
select="/map:sitemap/map:components/map:serializers/map:serializer"/>
- </xsl:call-template>
-
- /* Configure matchers */
- <xsl:call-template name="config-components">
- <xsl:with-param name="name">matcher</xsl:with-param>
- <xsl:with-param name="interface">Matcher</xsl:with-param>
- <xsl:with-param name="components"
- select="/map:sitemap/map:components/map:matchers/map:[EMAIL
PROTECTED]"/>
- </xsl:call-template>
-
- /* Configure selectors */
- <xsl:call-template name="config-components">
- <xsl:with-param name="name">selector</xsl:with-param>
- <xsl:with-param name="interface">Selector</xsl:with-param>
- <xsl:with-param name="components"
- select="/map:sitemap/map:components/map:selectors/map:[EMAIL
PROTECTED]"/>
- </xsl:call-template>
+ <!-- configure all components -->
+ /* Configure generators */
+ <xsl:call-template name="config-components">
+ <xsl:with-param name="name">generator</xsl:with-param>
+ <xsl:with-param name="interface">Generator</xsl:with-param>
+ <xsl:with-param name="components"
+
select="/map:sitemap/map:components/map:generators/map:generator"/>
+ </xsl:call-template>
+
+ /* Configure transformers */
+ <xsl:call-template name="config-components">
+ <xsl:with-param name="name">transformer</xsl:with-param>
+ <xsl:with-param name="interface">Transformer</xsl:with-param>
+ <xsl:with-param name="components"
+
select="/map:sitemap/map:components/map:transformers/map:transformer"/>
+ </xsl:call-template>
+
+ /* Configure readers */
+ <xsl:call-template name="config-components">
+ <xsl:with-param name="name">reader</xsl:with-param>
+ <xsl:with-param name="interface">Reader</xsl:with-param>
+ <xsl:with-param name="components"
+ select="/map:sitemap/map:components/map:readers/map:reader"/>
+ </xsl:call-template>
+
+ /* Configure serializers */
+ <xsl:call-template name="config-components">
+ <xsl:with-param name="name">serializer</xsl:with-param>
+ <xsl:with-param name="interface">Serializer</xsl:with-param>
+ <xsl:with-param name="components"
+
select="/map:sitemap/map:components/map:serializers/map:serializer"/>
+ </xsl:call-template>
+
+ /* Configure matchers */
+ <xsl:call-template name="config-components">
+ <xsl:with-param name="name">matcher</xsl:with-param>
+ <xsl:with-param name="interface">Matcher</xsl:with-param>
+ <xsl:with-param name="components"
+ select="/map:sitemap/map:components/map:matchers/map:[EMAIL
PROTECTED]"/>
+ </xsl:call-template>
+
+ /* Configure selectors */
+ <xsl:call-template name="config-components">
+ <xsl:with-param name="name">selector</xsl:with-param>
+ <xsl:with-param name="interface">Selector</xsl:with-param>
+ <xsl:with-param name="components"
+ select="/map:sitemap/map:components/map:selectors/map:[EMAIL
PROTECTED]"/>
+ </xsl:call-template>
} catch (Exception e) {
throw new ConfigurationException (e.toString(), cconf);
- }
+ }
}
-
- <xsl:for-each select="/map:sitemap/map:resources/map:resource">
- private boolean resource_<xsl:value-of select="translate(@name, '- ',
'__')"/> (ResourcePipeline pipeline,
- List listOfLists, Environment environment, OutputStream out)
- throws SAXException, IOException, ProcessingException {
- List list = null;
- Parameters param = null;
- <xsl:apply-templates select="./*"/>
- }
- </xsl:for-each>
-
- /**
- * Process to producing the output to the specified
>code<OutputStream>/code<.
- */
- public boolean process(Environment environment, OutputStream out)
- throws SAXException, IOException, ProcessingException {
- ResourcePipeline pipeline = new ResourcePipeline ();
- List listOfLists = (List)(new ArrayList());
- List list = null;
- Parameters param = null;
- <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
- try {
- <xsl:apply-templates select="./*"/>
- } catch (Exception e) {
- <xsl:choose>
- <xsl:when test="not (./map:handle-errors)">
+
+ <xsl:for-each select="/map:sitemap/map:resources/map:resource">
+ private boolean resource_<xsl:value-of select="translate(@name, '- ',
'__')"/> (ResourcePipeline pipeline,
+ List listOfLists, Environment environment, OutputStream out)
+ throws SAXException, IOException, ProcessingException {
+ List list = null;
+ Parameters param = null;
+ <xsl:apply-templates select="./*"/>
+ }
+ </xsl:for-each>
+
+ /**
+ * Process to producing the output to the specified
>code<OutputStream>/code<.
+ */
+ public boolean process(Environment environment, OutputStream out)
+ throws SAXException, IOException, ProcessingException {
+ ResourcePipeline pipeline = new ResourcePipeline ();
+ List listOfLists = (List)(new ArrayList());
+ List list = null;
+ Parameters param = null;
+ <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
+ 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(), emptyParam);
- <xsl:apply-templates select="./map:handle-error/*"/>
- return pipeline.process (environment, out);
- </xsl:otherwise>
- </xsl:choose>
- }
- </xsl:for-each>
- return false;
- }
-}
-
- </xsl:template> <!-- match="map:sitemap" -->
-
- <xsl:template match="map:match">
- <xsl:variable name="matcher-type">
- <xsl:call-template name="get-parameter">
- <xsl:with-param name="parname">type</xsl:with-param>
- <xsl:with-param name="default"><xsl:value-of
select="/map:sitemap/map:components/map:matchers/@default"/></xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="pattern-value">
- <xsl:call-template name="get-parameter">
- <xsl:with-param name="parname">pattern</xsl:with-param>
- <xsl:with-param name="required">true</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="matcher-name1" select="translate(@pattern,'/-
*?@:{}()[].#^\\$|!','_')"/>
- <xsl:variable name="matcher-name2"
select='translate($matcher-name1,"'","")'/>
- <xsl:variable name="matcher-name">
- <xsl:for-each
select="/map:sitemap/map:components/map:matchers/map:[EMAIL PROTECTED]">
- <xsl:choose>
- <xsl:when test="(./@src)">
- matcher_<xsl:value-of select="translate($matcher-type, '- ',
'__')"/>.match
- </xsl:when>
- <xsl:when test="(./@factory)">
- matcher_<xsl:value-of select="$matcher-name2"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="error">
- <xsl:with-param name="message">cannot choose a matcher name
<xsl:value-of select="$matcher-type"/></xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
- if ((list = <xsl:value-of select="$matcher-name"/> ("<xsl:value-of
select="$pattern-value"/>", environment)) != null) {
- listOfLists.add (list);
- <xsl:apply-templates/>
- }
- </xsl:template> <!-- match="map:match" -->
-
- <xsl:template match="map:select">
- <xsl:variable name="selector-type">
- <xsl:call-template name="get-parameter">
- <xsl:with-param name="parname">type</xsl:with-param>
- <xsl:with-param name="default"><xsl:value-of
select="/map:sitemap/map:components/map:selectors/@default"/></xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:for-each select="./map:when">
- <xsl:variable name="test-value">
- <xsl:call-template name="get-parameter">
- <xsl:with-param name="parname">test</xsl:with-param>
- <xsl:with-param name="required">true</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="selector-name1" select="translate($test-value,'/-
*?@:{}()[].#^\\$|!','_')"/>
- <xsl:variable name="selector-name2"
select='translate($selector-name1,"'","")'/>
- <xsl:variable name="selector-name">
- <xsl:for-each
select="/map:sitemap/map:components/map:selectors/map:[EMAIL PROTECTED]">
- <xsl:choose>
- <xsl:when test="(./@src)">
- selector_<xsl:value-of select="translate($selector-type, '- ',
'__')"/>.select
- </xsl:when>
- <xsl:when test="(./@factory)">
- selector_<xsl:value-of select="$selector-name2"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="error">
- <xsl:with-param name="message">cannot choose a selector name
<xsl:value-of select="$selector-type"/></xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
- if (<xsl:value-of select="$selector-name"/> ("<xsl:value-of
select="$test-value"/>", environment)) {
- <xsl:apply-templates/>
- }
- </xsl:for-each>
-
- <xsl:for-each select="./map:otherwise">
- else {
- <xsl:apply-templates/>
- }
- </xsl:for-each>
- </xsl:template> <!-- match="/map:sitemap/map:select" -->
-
- <xsl:template match="map:generate">
- <xsl:call-template name="setup-component">
- <xsl:with-param name="default-component"
select="/map:sitemap/map:components/map:generators/@default"/>
- <xsl:with-param name="method">setGenerator</xsl:with-param>
- <xsl:with-param name="prefix">generator</xsl:with-param>
- </xsl:call-template>
- </xsl:template> <!-- match="map:generate" -->
-
- <xsl:template match="map:transform">
- <xsl:call-template name="setup-component">
- <xsl:with-param name="default-component"
select="/map:sitemap/map:components/map:transformers/@default"/>
- <xsl:with-param name="method">addTransformer</xsl:with-param>
- <xsl:with-param name="prefix">transformer</xsl:with-param>
- </xsl:call-template>
- </xsl:template> <!-- match="map:transormer" -->
-
- <xsl:template match="map:serialize">
- <xsl:call-template name="setup-component">
- <xsl:with-param name="default-component"
select="/map:sitemap/map:components/map:serializers/@default"/>
- <xsl:with-param name="method">setSerializer</xsl:with-param>
- <xsl:with-param name="prefix">serializer</xsl:with-param>
- </xsl:call-template>
- return pipeline.process (environment, out);
- </xsl:template> <!-- match="map:serialize" -->
-
- <xsl:template match="map:read">
- <xsl:call-template name="setup-component">
- <xsl:with-param name="default-component"
select="/map:sitemap/map:components/map:readers/@default"/>
- <xsl:with-param name="method">setReader</xsl:with-param>
- <xsl:with-param name="prefix">reader</xsl:with-param>
- </xsl:call-template>
- return pipeline.process (environment, out);
- </xsl:template> <!-- match="map:read" -->
-
- <xsl:template match="map:mount">
- <xsl:variable name="src" select="@src"/>
- <xsl:variable name="pos"><xsl:value-of select="translate(./@uri-prefix,
'- /{}', '___')"/></xsl:variable>
- <xsl:variable name="check-reload">
- <xsl:choose>
- <xsl:when test="@check-reload='yes'">true</xsl:when>
- <xsl:when test="@check-reload='true'">true</xsl:when>
- <xsl:when test="@check-reload='no'">false</xsl:when>
- <xsl:when test="@check-reload='false'">false</xsl:when>
- <xsl:when test="not(@check-reload)">true</xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="error">
- <xsl:with-param name="message">
- element <xsl:value-of select="name(.)"/> with
uri-prefix="<xsl:value-of select="@uri-prefix"/>" has a wrong value in
'check-reload' attribute . Use "yes" or "no" but not "<xsl:value-of
select="@check-reload"/>".
- </xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- return sitemapManager.invoke (environment,
substitute(listOfLists,"<xsl:value-of select="@uri-prefix"/>"),
makeAbsolute(substitute(listOfLists,"<xsl:value-of select="@src"/>")),
<xsl:value-of select="$check-reload"/>, out);
- </xsl:template> <!-- match="map:mount" -->
-
- <xsl:template match="map:redirect-to">
- <xsl:choose>
- <xsl:when test="@resource">
- return resource_<xsl:value-of select="translate(@resource, '- ',
'__')"/>(pipeline, listOfLists, environment, out);
- </xsl:when>
- <xsl:when test="@uri">
- // request.setUri ("<xsl:value-of select="@uri"/>");
- // this.process(environment, out);
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="error">
- <xsl:with-param name="message">Missing attribute uri= or resource=
to element redirect-to</xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template> <!-- match="map:redirect-to" -->
-
- <xsl:template match="map:param">
- param.setParameter ("<xsl:value-of select="@name"/>", "<xsl:value-of
select="@map:value"/>");
- </xsl:template> <!-- match="map:param" -->
-
- <!-- Sitemap Utility templates -->
-
- <xsl:template name="config-components">
- <xsl:param name="name"/>
- <xsl:param name="interface"/>
- <xsl:param name="components"/>
-
- <xsl:variable name="qname">
- <xsl:value-of select="concat($prefix, ':value')"/>
- </xsl:variable>
-
- <xsl:variable name="ns" select="namespace-uri(.)"/>
- <xsl:for-each select="$components">
- confBuilder.startDocument ();
- <xsl:call-template name="nested-config-components">
- <xsl:with-param name="name" select="$name"/>
- <xsl:with-param name="config-name"><xsl:value-of
select="concat(local-name(.),'/',@name)"/></xsl:with-param>
- <xsl:with-param name="interface" select="$interface"/>
- <xsl:with-param name="components" select="*"/>
- <xsl:with-param name="type" select="@name"/>
- <xsl:with-param name="ns" select="$ns"/>
- </xsl:call-template>
- confBuilder.endDocument ();
+ </xsl:when>
+ <xsl:otherwise>
+ pipeline.setGenerator (generator_error_handler,
e.getMessage(), emptyParam);
+ <xsl:apply-templates select="./map:handle-error/*"/>
+ return pipeline.process (environment, out);
+ </xsl:otherwise>
+ </xsl:choose>
+ }
+ </xsl:for-each>
+ return false;
+ }
+}
+
+ </xsl:template> <!-- match="map:sitemap" -->
+
+ <xsl:template match="map:match">
+ <xsl:variable name="matcher-type">
+ <xsl:call-template name="get-parameter">
+ <xsl:with-param name="parname">type</xsl:with-param>
+ <xsl:with-param name="default"><xsl:value-of
select="/map:sitemap/map:components/map:matchers/@default"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="pattern-value">
+ <xsl:call-template name="get-parameter">
+ <xsl:with-param name="parname">pattern</xsl:with-param>
+ <xsl:with-param name="required">true</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="matcher-name1" select="translate(@pattern,'/-
*?@:{}()[].#^\\$|!','_')"/>
+ <xsl:variable name="matcher-name2"
select='translate($matcher-name1,"'","")'/>
+ <xsl:variable name="matcher-name">
+ <xsl:for-each
select="/map:sitemap/map:components/map:matchers/map:[EMAIL PROTECTED]">
+ <xsl:choose>
+ <xsl:when test="(./@src)">
+ matcher_<xsl:value-of select="translate($matcher-type, '- ',
'__')"/>.match
+ </xsl:when>
+ <xsl:when test="(./@factory)">
+ matcher_<xsl:value-of select="$matcher-name2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="error">
+ <xsl:with-param name="message">cannot choose a matcher name
<xsl:value-of select="$matcher-type"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ if ((list = <xsl:value-of select="$matcher-name"/> ("<xsl:value-of
select="$pattern-value"/>", environment)) != null) {
+ listOfLists.add (list);
+ <xsl:apply-templates/>
+ }
+ </xsl:template> <!-- match="map:match" -->
+
+ <xsl:template match="map:select">
+ <xsl:variable name="selector-type">
+ <xsl:call-template name="get-parameter">
+ <xsl:with-param name="parname">type</xsl:with-param>
+ <xsl:with-param name="default"><xsl:value-of
select="/map:sitemap/map:components/map:selectors/@default"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:for-each select="./map:when">
+ <xsl:variable name="test-value">
+ <xsl:call-template name="get-parameter">
+ <xsl:with-param name="parname">test</xsl:with-param>
+ <xsl:with-param name="required">true</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="selector-name1" select="translate($test-value,'/-
*?@:{}()[].#^\\$|!','_')"/>
+ <xsl:variable name="selector-name2"
select='translate($selector-name1,"'","")'/>
+ <xsl:variable name="selector-name">
+ <xsl:for-each
select="/map:sitemap/map:components/map:selectors/map:[EMAIL PROTECTED]">
+ <xsl:choose>
+ <xsl:when test="(./@src)">
+ selector_<xsl:value-of select="translate($selector-type, '- ',
'__')"/>.select
+ </xsl:when>
+ <xsl:when test="(./@factory)">
+ selector_<xsl:value-of select="$selector-name2"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="error">
+ <xsl:with-param name="message">cannot choose a selector name
<xsl:value-of select="$selector-type"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </xsl:variable>
+ if (<xsl:value-of select="$selector-name"/> ("<xsl:value-of
select="$test-value"/>", environment)) {
+ <xsl:apply-templates/>
+ }
+ </xsl:for-each>
+
+ <xsl:for-each select="./map:otherwise">
+ else {
+ <xsl:apply-templates/>
+ }
+ </xsl:for-each>
+ </xsl:template> <!-- match="/map:sitemap/map:select" -->
+
+ <xsl:template match="map:generate">
+ <xsl:call-template name="setup-component">
+ <xsl:with-param name="default-component"
select="/map:sitemap/map:components/map:generators/@default"/>
+ <xsl:with-param name="method">setGenerator</xsl:with-param>
+ <xsl:with-param name="prefix">generator</xsl:with-param>
+ </xsl:call-template>
+ </xsl:template> <!-- match="map:generate" -->
+
+ <xsl:template match="map:transform">
+ <xsl:call-template name="setup-component">
+ <xsl:with-param name="default-component"
select="/map:sitemap/map:components/map:transformers/@default"/>
+ <xsl:with-param name="method">addTransformer</xsl:with-param>
+ <xsl:with-param name="prefix">transformer</xsl:with-param>
+ </xsl:call-template>
+ </xsl:template> <!-- match="map:transormer" -->
+
+ <xsl:template match="map:serialize">
+ <xsl:call-template name="setup-component">
+ <xsl:with-param name="default-component"
select="/map:sitemap/map:components/map:serializers/@default"/>
+ <xsl:with-param name="method">setSerializer</xsl:with-param>
+ <xsl:with-param name="prefix">serializer</xsl:with-param>
+ </xsl:call-template>
+ return pipeline.process (environment, out);
+ </xsl:template> <!-- match="map:serialize" -->
+
+ <xsl:template match="map:read">
+ <xsl:call-template name="setup-component">
+ <xsl:with-param name="default-component"
select="/map:sitemap/map:components/map:readers/@default"/>
+ <xsl:with-param name="method">setReader</xsl:with-param>
+ <xsl:with-param name="prefix">reader</xsl:with-param>
+ </xsl:call-template>
+ return pipeline.process (environment, out);
+ </xsl:template> <!-- match="map:read" -->
+
+ <xsl:template match="map:mount">
+ <xsl:variable name="src" select="@src"/>
+ <xsl:variable name="pos"><xsl:value-of select="translate(./@uri-prefix,
'- /{}', '___')"/></xsl:variable>
+ <xsl:variable name="check-reload">
+ <xsl:choose>
+ <xsl:when test="@check-reload='yes'">true</xsl:when>
+ <xsl:when test="@check-reload='true'">true</xsl:when>
+ <xsl:when test="@check-reload='no'">false</xsl:when>
+ <xsl:when test="@check-reload='false'">false</xsl:when>
+ <xsl:when test="not(@check-reload)">true</xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="error">
+ <xsl:with-param name="message">
+ element <xsl:value-of select="name(.)"/> with
uri-prefix="<xsl:value-of select="@uri-prefix"/>" has a wrong value in
'check-reload' attribute . Use "yes" or "no" but not "<xsl:value-of
select="@check-reload"/>".
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ return sitemapManager.invoke (environment,
substitute(listOfLists,"<xsl:value-of select="@uri-prefix"/>"),
substitute(listOfLists,"<xsl:value-of select="@src"/>"), <xsl:value-of
select="$check-reload"/>, out);
+ </xsl:template> <!-- match="map:mount" -->
+
+ <xsl:template match="map:redirect-to">
+ <xsl:choose>
+ <xsl:when test="@resource">
+ return resource_<xsl:value-of select="translate(@resource, '- ',
'__')"/>(pipeline, listOfLists, environment, out);
+ </xsl:when>
+ <xsl:when test="@uri">
+ // request.setUri ("<xsl:value-of select="@uri"/>");
+ // this.process(environment, out);
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:call-template name="error">
+ <xsl:with-param name="message">Missing attribute uri= or resource=
to element redirect-to</xsl:with-param>
+ </xsl:call-template>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template> <!-- match="map:redirect-to" -->
+
+ <xsl:template match="parameter">
+ param.setParameter ("<xsl:value-of select="@name"/>", "<xsl:value-of
select="@value"/>");
+ </xsl:template>
+
+ <xsl:template match="map:param">
+ param.setParameter ("<xsl:value-of select="@name"/>", "<xsl:value-of
select="@map:value"/>");
+ </xsl:template>
+
+ <!-- Sitemap Utility templates -->
+
+ <xsl:template name="config-components">
+ <xsl:param name="name"/>
+ <xsl:param name="interface"/>
+ <xsl:param name="components"/>
+
+ <xsl:variable name="qname">
+ <xsl:value-of select="concat($prefix, ':value')"/>
+ </xsl:variable>
+
+ <xsl:variable name="ns" select="namespace-uri(.)"/>
+ <xsl:for-each select="$components">
+ confBuilder.startDocument ();
+ <xsl:call-template name="nested-config-components">
+ <xsl:with-param name="name" select="$name"/>
+ <xsl:with-param name="config-name"><xsl:value-of
select="concat(local-name(.),'/',@name)"/></xsl:with-param>
+ <xsl:with-param name="interface" select="$interface"/>
+ <xsl:with-param name="components" select="*"/>
+ <xsl:with-param name="type" select="@name"/>
+ <xsl:with-param name="ns" select="$ns"/>
+ </xsl:call-template>
+ confBuilder.endDocument ();
cconf = confBuilder.getConfiguration();
- <xsl:value-of select="$name"/>_<xsl:value-of select="translate(@name,
'- ', '__')"/> =
- (<xsl:value-of select="$interface"/>)load_component ("<xsl:value-of
select="@src"/>",
- cconf);
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="nested-config-components">
- <xsl:param name="name"/>
- <xsl:param name="config-name"/>
- <xsl:param name="interface"/>
- <xsl:param name="components"/>
- <xsl:param name="type"/>
- <xsl:param name="ns"/>
- <xsl:param name="subname"/>
-
- <xsl:variable name="qname">
- <xsl:value-of select="concat($prefix, ':value')"/>
- </xsl:variable>
-
- <!-- process content -->
- <xsl:for-each select="$components">
- <xsl:if test="$ns!=namespace-uri(.)">
- confBuilder.startPrefixMapping("","<xsl:value-of
select="namespace-uri(.)"/>");
- </xsl:if>
- attr.clear();
- <xsl:for-each select="attribute::*[name(.)!=$qname]">
- attr.addAttribute ("", "<xsl:value-of select="local-name(.)"/>",
"<xsl:value-of select="name(.)"/>", "CDATA", "<xsl:value-of select="."/>");
- </xsl:for-each>
- confBuilder.startElement("<xsl:value-of select="namespace-uri(.)"/>",
"<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>",
attr);
- <xsl:for-each select="attribute::*[name(.)=$qname]">
- confBuilder.characters("<xsl:value-of select="."/>".toCharArray(),
0, <xsl:value-of select="string-length(.)"/>);
- </xsl:for-each>
- <xsl:if test="normalize-space(text())">
- confBuilder.characters("<xsl:value-of
select="text()"/>".toCharArray(), 0, <xsl:value-of
select="string-length(text())"/>);
- </xsl:if>
- <xsl:variable name="newsubname">
- <xsl:choose>
- <xsl:when test="not($subname)"><xsl:value-of
select="position()"/></xsl:when>
- <xsl:otherwise><xsl:value-of
select="concat($subname,position())"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:call-template name="nested-config-components">
- <xsl:with-param name="name"><xsl:value-of
select="$name"/></xsl:with-param>
- <xsl:with-param name="config-name"><xsl:value-of
select="local-name(.)"/></xsl:with-param>
- <xsl:with-param name="interface"><xsl:value-of
select="$interface"/></xsl:with-param>
- <xsl:with-param name="components" select="./*"/>
- <xsl:with-param name="type"><xsl:value-of
select="$type"/></xsl:with-param>
- <xsl:with-param name="ns"><xsl:value-of
select="namespace-uri(.)"/></xsl:with-param>
- <xsl:with-param name="subname"><xsl:value-of
select="$newsubname"/></xsl:with-param>
- </xsl:call-template>
- confBuilder.endElement("<xsl:value-of select="namespace-uri(.)"/>",
"<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>");
- <xsl:if test="$ns!=namespace-uri(.)">
- confBuilder.endPrefixMapping("");
- </xsl:if>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="setup-component">
- <xsl:param name="default-component"/>
- <xsl:param name="method"/>
- <xsl:param name="prefix"/>
- <xsl:variable name="component-type">
- <xsl:call-template name="get-parameter">
- <xsl:with-param name="parname">type</xsl:with-param>
- <xsl:with-param name="default"><xsl:value-of
select="$default-component"/></xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="component-source">
- <xsl:call-template name="get-parameter">
- <xsl:with-param name="parname">src</xsl:with-param>
- <xsl:with-param name="default">null</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="descendant::map:param">
- param = new Parameters ();
- </xsl:if>
- <xsl:variable name="component-param">
- <xsl:choose>
- <xsl:when test="descendant::map:param">
- param
- </xsl:when>
- <xsl:otherwise>
- emptyParam
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:apply-templates select="./map:param"/>
- <xsl:choose>
- <xsl:when test="$component-source='null'">
- pipeline.<xsl:value-of select="$method"/> (<xsl:value-of
select="$prefix"/>_<xsl:value-of select="$component-type"/>,
- null, <xsl:value-of select="$component-param"/>);
- </xsl:when>
- <xsl:otherwise>
- pipeline.<xsl:value-of select="$method"/> (<xsl:value-of
select="$prefix"/>_<xsl:value-of select="$component-type"/>,
- makeAbsolute(substitute(listOfLists,"<xsl:value-of
select="$component-source"/>")), <xsl:value-of select="$component-param"/>);
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <!-- Utility templates -->
-
- <xsl:template name="get-parameter">
- <xsl:param name="parname"/>
- <xsl:param name="default"/>
- <xsl:param name="required">false</xsl:param>
-
- <xsl:variable name="qname">
- <xsl:value-of select="concat($prefix, ':param')"/>
- </xsl:variable>
-
- <xsl:choose>
- <xsl:when test="@*[name(.) = $parname]"><xsl:value-of
select="@*[name(.) = $parname]"/> </xsl:when>
- <xsl:when test="(*[name(.) = $qname])[EMAIL PROTECTED] = $parname]">
- <xsl:call-template name="get-nested-content">
- <xsl:with-param name="content"
- select="(*[name(.) = $qname])[EMAIL PROTECTED] =
$parname]"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="string-length($default) = 0">
- <xsl:choose>
- <xsl:when test="$required = 'true'">
- <xsl:call-template name="error">
- <xsl:with-param name="message">[Logicsheet processor]
-Parameter '<xsl:value-of select="$parname"/>' missing in dynamic tag
<<xsl:value-of select="name(.)"/>>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>""</xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise><xsl:copy-of select="$default"/></xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="get-nested-content">
- <xsl:param name="content"/>
- <xsl:choose>
- <xsl:when test="$content/*">
- <xsl:apply-templates select="$content/*"/>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="$content"/></xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template name="error">
- <xsl:param name="message"/>
- <xsl:message terminate="yes"><xsl:value-of
select="$message"/></xsl:message>
- </xsl:template>
-
- <!-- Ignored elements -->
- <xsl:template match="map:logicsheet|map:dependency|map:handle-errors"/>
-
-</xsl:stylesheet>
+ <xsl:value-of select="$name"/>_<xsl:value-of select="translate(@name,
'- ', '__')"/> =
+ (<xsl:value-of select="$interface"/>)load_component ("<xsl:value-of
select="@src"/>",
+ cconf);
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="nested-config-components">
+ <xsl:param name="name"/>
+ <xsl:param name="config-name"/>
+ <xsl:param name="interface"/>
+ <xsl:param name="components"/>
+ <xsl:param name="type"/>
+ <xsl:param name="ns"/>
+ <xsl:param name="subname"/>
+
+ <xsl:variable name="qname">
+ <xsl:value-of select="concat($prefix, ':value')"/>
+ </xsl:variable>
+
+ <!-- process content -->
+ <xsl:for-each select="$components">
+ <xsl:if test="$ns!=namespace-uri(.)">
+ confBuilder.startPrefixMapping("","<xsl:value-of
select="namespace-uri(.)"/>");
+ </xsl:if>
+ attr.clear();
+ <xsl:for-each select="attribute::*[name(.)!=$qname]">
+ attr.addAttribute ("", "<xsl:value-of select="local-name(.)"/>",
"<xsl:value-of select="name(.)"/>", "CDATA", "<xsl:value-of select="."/>");
+ </xsl:for-each>
+ confBuilder.startElement("<xsl:value-of select="namespace-uri(.)"/>",
"<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>",
attr);
+ <xsl:for-each select="attribute::*[name(.)=$qname]">
+ confBuilder.characters("<xsl:value-of select="."/>".toCharArray(),
0, <xsl:value-of select="string-length(.)"/>);
+ </xsl:for-each>
+ <xsl:if test="normalize-space(text())">
+ confBuilder.characters("<xsl:value-of
select="text()"/>".toCharArray(), 0, <xsl:value-of
select="string-length(text())"/>);
+ </xsl:if>
+ <xsl:variable name="newsubname">
+ <xsl:choose>
+ <xsl:when test="not($subname)"><xsl:value-of
select="position()"/></xsl:when>
+ <xsl:otherwise><xsl:value-of
select="concat($subname,position())"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:call-template name="nested-config-components">
+ <xsl:with-param name="name"><xsl:value-of
select="$name"/></xsl:with-param>
+ <xsl:with-param name="config-name"><xsl:value-of
select="local-name(.)"/></xsl:with-param>
+ <xsl:with-param name="interface"><xsl:value-of
select="$interface"/></xsl:with-param>
+ <xsl:with-param name="components" select="./*"/>
+ <xsl:with-param name="type"><xsl:value-of
select="$type"/></xsl:with-param>
+ <xsl:with-param name="ns"><xsl:value-of
select="namespace-uri(.)"/></xsl:with-param>
+ <xsl:with-param name="subname"><xsl:value-of
select="$newsubname"/></xsl:with-param>
+ </xsl:call-template>
+ confBuilder.endElement("<xsl:value-of select="namespace-uri(.)"/>",
"<xsl:value-of select="local-name(.)"/>", "<xsl:value-of select="name(.)"/>");
+ <xsl:if test="$ns!=namespace-uri(.)">
+ confBuilder.endPrefixMapping("");
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:template>
+
+ <xsl:template name="setup-component">
+ <xsl:param name="default-component"/>
+ <xsl:param name="method"/>
+ <xsl:param name="prefix"/>
+ <xsl:variable name="component-type">
+ <xsl:call-template name="get-parameter">
+ <xsl:with-param name="parname">type</xsl:with-param>
+ <xsl:with-param name="default"><xsl:value-of
select="$default-component"/></xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="component-source">
+ <xsl:call-template name="get-parameter">
+ <xsl:with-param name="parname">src</xsl:with-param>
+ <xsl:with-param name="default">null</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="count(parameter)>0">
+ param = new Parameters ();
+ </xsl:if>
+ <xsl:variable name="component-param">
+ <xsl:choose>
+ <xsl:when test="count(parameter)>0">
+ param
+ </xsl:when>
+ <xsl:otherwise>
+ emptyParam
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:apply-templates select="parameter"/>
+ <xsl:choose>
+ <xsl:when test="$component-source='null'">
+ pipeline.<xsl:value-of select="$method"/> (<xsl:value-of
select="$prefix"/>_<xsl:value-of select="$component-type"/>,
+ null, <xsl:value-of select="$component-param"/>);
+ </xsl:when>
+ <xsl:otherwise>
+ pipeline.<xsl:value-of select="$method"/> (<xsl:value-of
select="$prefix"/>_<xsl:value-of select="$component-type"/>,
+ substitute(listOfLists,"<xsl:value-of
select="$component-source"/>"), <xsl:value-of select="$component-param"/>);
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!-- Utility templates -->
+
+ <xsl:template name="get-parameter">
+ <xsl:param name="parname"/>
+ <xsl:param name="default"/>
+ <xsl:param name="required">false</xsl:param>
+
+ <xsl:variable name="qname">
+ <xsl:value-of select="concat($prefix, ':param')"/>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="@*[name(.) = $parname]"><xsl:value-of
select="@*[name(.) = $parname]"/> </xsl:when>
+ <xsl:when test="(*[name(.) = $qname])[EMAIL PROTECTED] = $parname]">
+ <xsl:call-template name="get-nested-content">
+ <xsl:with-param name="content"
+ select="(*[name(.) = $qname])[EMAIL PROTECTED] =
$parname]"/>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:choose>
+ <xsl:when test="string-length($default) = 0">
+ <xsl:choose>
+ <xsl:when test="$required = 'true'">
+ <xsl:call-template name="error">
+ <xsl:with-param name="message">[Logicsheet processor]
+Parameter '<xsl:value-of select="$parname"/>' missing in dynamic tag
<<xsl:value-of select="name(.)"/>>
+ </xsl:with-param>
+ </xsl:call-template>
+ </xsl:when>
+ <xsl:otherwise>""</xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+ <xsl:otherwise><xsl:copy-of select="$default"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="get-nested-content">
+ <xsl:param name="content"/>
+ <xsl:choose>
+ <xsl:when test="$content/*">
+ <xsl:apply-templates select="$content/*"/>
+ </xsl:when>
+ <xsl:otherwise><xsl:value-of select="$content"/></xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="error">
+ <xsl:param name="message"/>
+ <xsl:message terminate="yes"><xsl:value-of
select="$message"/></xsl:message>
+ </xsl:template>
+
+ <!-- Ignored elements -->
+ <xsl:template match="map:logicsheet|map:dependency|map:handle-errors"/>
+
+</xsl:stylesheet>
No revision
No revision
1.1.2.3 +14 -4
xml-cocoon/src/org/apache/cocoon/environment/Attic/Environment.java
Index: Environment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/Attic/Environment.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- Environment.java 2000/07/22 20:41:44 1.1.2.2
+++ Environment.java 2000/07/25 18:48:27 1.1.2.3
@@ -7,8 +7,18 @@
*****************************************************************************/
package org.apache.cocoon.environment;
-public interface Environment {
- public void addUriPrefix (String prefix);
- public String getView ();
- public String getUri ();
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.SAXException;
+import org.xml.sax.InputSource;
+
+public interface Environment extends EntityResolver {
+ public void changeContext (String uriprefix, String context)
+ throws MalformedURLException;
+ public String getView ();
+ public String getUri ();
+ public InputSource resolveEntity (String systemId)
+ throws SAXException, IOException;
}
No revision
No revision
1.1.2.4 +73 -22
xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpEnvironment.java
Index: HttpEnvironment.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpEnvironment.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- HttpEnvironment.java 2000/07/22 20:41:44 1.1.2.3
+++ HttpEnvironment.java 2000/07/25 18:48:29 1.1.2.4
@@ -7,11 +7,20 @@
*****************************************************************************/
package org.apache.cocoon.environment.http;
-import org.apache.cocoon.environment.Environment;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cocoon.environment.Environment;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
public class HttpEnvironment implements Environment {
/** The current uri in progress */
@@ -25,30 +34,48 @@
/** The HttpServletRequest */
private HttpRequest req = null;
-
- /** The HttpServletResponse */
- private HttpResponse res = null;
+
+ /** The HttpServletResponse */
+ private HttpResponse res = null;
+
+ /** The ServletContext */
+ private ServletContext servletContext = null;
+
+ /** The Context path */
+ private URL context = null;
+
/**
* Constructs a HttpEnvironment object from a HttpServletRequest
* and HttpServletResponse objects
*/
- public HttpEnvironment (String uri, HttpServletRequest req,
HttpServletResponse res) {
+ public HttpEnvironment (String uri, HttpServletRequest req,
+ HttpServletResponse res,
+ ServletContext servletContext)
+ throws MalformedURLException {
this.uri = uri;
this.view = req.getHeader("cocoon-view");
this.req = new HttpRequest (req, this);
this.res = new HttpResponse (res);
+ this.servletContext = servletContext;
+ this.context = new URL("file://"+servletContext.getRealPath("/"));
}
/**
* Adds an prefix to the overall stripped off prefix from the request uri
*/
- public void addUriPrefix (String prefix) {
- if (uri.startsWith (prefix)) {
- this.prefix.append (prefix);
- uri = uri.substring(prefix.length());
- } else {
- //FIXME: should we throw an error here ?
- }
+ public void changeContext(String prefix, String context)
+ throws MalformedURLException {
+ if (uri.startsWith (prefix)) {
+ this.prefix.append (prefix);
+ uri = uri.substring(prefix.length());
+ File f = new File(context);
+ if (f.isFile())
+ this.context=f.getParentFile().toURL();
+ else
+ this.context = f.toURL();
+ } else {
+ //FIXME: should we throw an error here ?
+ }
}
/**
@@ -70,12 +97,36 @@
*/
public HttpServletRequest getRequest () {
return this.req;
- }
-
- /**
- * Returns a wrapped HttpResponse object of the real HttpResponse in
progress
- */
- public HttpServletResponse getResponse () {
- return this.res;
}
+
+ /**
+ * Returns a wrapped HttpResponse object of the real HttpResponse in
progress
+ */
+ public HttpServletResponse getResponse () {
+ return this.res;
+ }
+
+ /**
+ * Resolve an entity.
+ */
+ public InputSource resolveEntity(String systemId)
+ throws SAXException, IOException {
+ return(this.resolveEntity(null,systemId));
+ }
+
+ /**
+ * Resolve an entity.
+ */
+ public InputSource resolveEntity(String publicId, String systemId)
+ throws SAXException, IOException {
+ if (systemId==null) throw new SAXException("Invalid System ID");
+
+ if (systemId.length()==0)
+ return new InputSource(this.context.toExternalForm());
+ if (systemId.indexOf(":/")>0)
+ return new InputSource(systemId);
+ if (systemId.charAt(0)=='/')
+ return new InputSource(this.context.getProtocol()+":"+systemId);
+ return(new InputSource(new
URL(this.context,systemId).toExternalForm()));
+ }
}
No revision
No revision
1.1.2.3 +3 -3
xml-cocoon/src/org/apache/cocoon/generation/Attic/FileGenerator.java
Index: FileGenerator.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/generation/Attic/FileGenerator.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- FileGenerator.java 2000/07/22 20:41:47 1.1.2.2
+++ FileGenerator.java 2000/07/25 18:48:31 1.1.2.3
@@ -17,7 +17,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/07/22 20:41:47 $
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/25 18:48:31 $
*/
public class FileGenerator extends ComposerGenerator {
@@ -27,9 +27,9 @@
public void generate()
throws IOException, SAXException {
Parser parser=(Parser)this.manager.getComponent("parser");
- Cocoon cocoon=(Cocoon)this.manager.getComponent("cocoon");
+ //Cocoon cocoon=(Cocoon)this.manager.getComponent("cocoon");
parser.setContentHandler(this.contentHandler);
parser.setLexicalHandler(this.lexicalHandler);
- parser.parse(cocoon.resolveEntity(this.source));
+ parser.parse(super.environment.resolveEntity(this.source));
}
}
No revision
No revision
1.1.4.14 +2 -2
xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java
Index: CocoonServlet.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServlet.java,v
retrieving revision 1.1.4.13
retrieving revision 1.1.4.14
diff -u -r1.1.4.13 -r1.1.4.14
--- CocoonServlet.java 2000/07/22 20:41:54 1.1.4.13
+++ CocoonServlet.java 2000/07/25 18:48:36 1.1.4.14
@@ -35,7 +35,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.4.13 $ $Date: 2000/07/22 20:41:54 $
+ * @version CVS $Revision: 1.1.4.14 $ $Date: 2000/07/25 18:48:36 $
*/
public class CocoonServlet extends HttpServlet {
private Cocoon cocoon=null;
@@ -138,7 +138,7 @@
if (!uri.equals("")) {
try {
if (uri.charAt(0)=='/') uri=uri.substring(1);
- HttpEnvironment env = new HttpEnvironment (uri, req, res);
+ HttpEnvironment env = new HttpEnvironment (uri, req, res,
context);
if (!this.cocoon.process(env,out)) {
res.setStatus(res.SC_NOT_FOUND);
res.setContentType("text/html");
No revision
No revision
1.1.2.7 +2 -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.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- ResourcePipeline.java 2000/07/22 20:41:57 1.1.2.6
+++ ResourcePipeline.java 2000/07/25 18:48:44 1.1.2.7
@@ -26,7 +26,7 @@
/**
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/07/22 20:41:57 $
+ * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/07/25 18:48:44 $
*/
public class ResourcePipeline {
private Generator generator = null;
@@ -99,7 +99,7 @@
producer = transformer;
}
- serializer.setup (environment, serializerSource, generatorParam);
+ serializer.setup (environment, serializerSource,
serializerParam);
serializer.setOutputStream (out);
producer.setConsumer (serializer);
generator.generate();
1.1.2.4 +27 -30
xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapHandler.java
Index: SitemapHandler.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapHandler.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- SitemapHandler.java 2000/07/23 00:04:12 1.1.2.3
+++ SitemapHandler.java 2000/07/25 18:48:45 1.1.2.4
@@ -28,7 +28,7 @@
* Handles the manageing and stating of one <code>Sitemap</code>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/23 00:04:12 $
+ * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/07/25 18:48:45 $
*/
public class SitemapHandler implements Runnable, Configurable, Composer {
@@ -39,8 +39,7 @@
private ComponentManager manager = null;
/** the source of this sitemap */
- private File source = null;
- private long changeDate = -1L;
+ private File sourceFile = null;
/** the last error */
private Exception exception = null;
@@ -63,30 +62,28 @@
this.conf = conf;
}
- protected SitemapHandler (String source) throws FileNotFoundException {
+ protected SitemapHandler (String source) throws FileNotFoundException {
System.out.println("SitemapHandler: Instantiating sitemap
\""+source+"\"");
- File f = null;
- String s = null;
- if (source.charAt(source.length()-1) == '/') {
- s = source+"sitemap.xmap";
- f = new File (s);
- } else {
- f = new File (source);
- if (!f.isFile()) {
- s = source+File.separatorChar+"sitemap.xmap";
- f = new File (s);
- }
- if (!f.canRead()) {
- throw new FileNotFoundException ("file "+s+" not found or
cannot be opened for reading");
- }
- }
- this.source = f;
- changeDate = f.lastModified();
- System.out.println("SitemapHandler: Instantiatet sitemap
\""+f.getPath()+"\"");
- }
-
- protected void throwError ()
- throws ProcessingException, SAXException, IOException,
InterruptedException {
+ System.out.println("SitemapHandler: last char of source is
\""+source.charAt(source.length()-1)+"\"");
+ String s = null;
+ if (source.charAt(source.length()-1) == '/') {
+ s = source+"sitemap.xmap";
+ this.sourceFile = new File (s);
+ } else {
+ sourceFile = new File (source);
+ if (!sourceFile.isFile()) {
+ s = source+File.separatorChar+"sitemap.xmap";
+ sourceFile = new File (s);
+ }
+ if (!sourceFile.canRead()) {
+ throw new FileNotFoundException ("file "+s+" not found or
cannot be opened for reading");
+ }
+ }
+ System.out.println("SitemapHandler: Instantiatet sitemap
\""+sourceFile.getPath()+"\"");
+ }
+
+ protected void throwError ()
+ throws ProcessingException, SAXException, IOException,
InterruptedException {
System.out.println("SitemapHandler.throwError()");
Exception e = exception;
exception = null;
@@ -113,8 +110,8 @@
protected boolean hasChanged () {
System.out.print("SitemapHandler.hasChanged() = ");
if (sitemap != null) {
-
System.out.println((sitemap.modifiedSince(this.changeDate)?"true":"false"));
- return sitemap.modifiedSince(this.changeDate);
+
System.out.println((sitemap.modifiedSince(this.sourceFile.lastModified())?"true":"false"));
+ return sitemap.modifiedSince(this.sourceFile.lastModified());
}
System.out.println("true");
return true;
@@ -144,7 +141,7 @@
regeneration.start();
regeneration.join();
throwError();
- }
else {
+ } else {
System.out.println("SitemapHandler.regenerate(): regenerating
already in progress");
}
}
@@ -165,7 +162,7 @@
org.apache.cocoon.ProcessingException {
*/
- InputSource inputSource = new InputSource (source.getPath());
+ InputSource inputSource = new InputSource (sourceFile.getPath());
String systemId = inputSource.getSystemId();
System.out.println ("C2 generateSitemap: "+systemId);
1.1.2.3 +10 -7
xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapManager.java
Index: SitemapManager.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapManager.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- SitemapManager.java 2000/07/22 20:41:57 1.1.2.2
+++ SitemapManager.java 2000/07/25 18:48:45 1.1.2.3
@@ -10,6 +10,7 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
+import java.net.MalformedURLException;
import java.util.Hashtable;
import org.apache.avalon.ComponentManager;
@@ -29,7 +30,7 @@
* checking regeneration of the sub <code>Sitemap</code>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/07/22 20:41:57 $
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/25 18:48:45 $
*/
public class SitemapManager implements Configurable, Composer {
@@ -58,7 +59,9 @@
throws SAXException, ProcessingException, IOException,
InterruptedException,
FileNotFoundException {
SitemapHandler sitemapHandler = (SitemapHandler) sitemaps.get
(source);
+ System.out.println
("SitemapManager.invoke(\""+uri_prefix+"\",\""+source+"\")");
if (sitemapHandler != null) {
+ System.out.println ("SitemapManager.invoke: SitemapHandler
found");
sitemapHandler.throwError();
if (sitemapHandler.available()) {
if (check_reload
@@ -66,23 +69,23 @@
&& !sitemapHandler.isRegenerating()) {
sitemapHandler.regenerateAsynchroniously();
}
- environment.addUriPrefix (uri_prefix);
+ environment.changeContext (uri_prefix, source);
return sitemapHandler.process (environment, out);
} else {
sitemapHandler.regenerate();
}
- environment.addUriPrefix (uri_prefix);
+ System.out.println ("SitemapManager.invoke: setting uri prefix");
+ environment.changeContext (uri_prefix, source);
return sitemapHandler.process (environment, out);
} else {
- String basePath = source.substring(0,source.lastIndexOf('/')+1);
- System.out.println ("BasePath is \""+basePath+"\"");
+ System.out.println ("SitemapManager.invoke: instantiating
SitemapHandler");
sitemapHandler = new SitemapHandler(source);
if (sitemapHandler instanceof Composer)
sitemapHandler.setComponentManager (this.manager);
if (sitemapHandler instanceof Configurable)
sitemapHandler.setConfiguration (this.conf);
- sitemapHandler.setBasePath (basePath);
sitemaps.put(source, sitemapHandler);
sitemapHandler.regenerate();
- environment.addUriPrefix (uri_prefix);
+ System.out.println ("SitemapManager.invoke: setting uri prefix");
+ environment.changeContext (uri_prefix, source);
return sitemapHandler.process (environment, out);
}
}
No revision
No revision
1.1.2.3 +3 -3
xml-cocoon/src/org/apache/cocoon/transformation/Attic/XalanTransformer.java
Index: XalanTransformer.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XalanTransformer.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- XalanTransformer.java 2000/07/22 20:42:01 1.1.2.2
+++ XalanTransformer.java 2000/07/25 18:48:47 1.1.2.3
@@ -39,7 +39,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/07/22 20:42:01 $
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/25 18:48:47 $
*/
public class XalanTransformer extends DocumentHandlerWrapper
implements Transformer, Composer {
@@ -63,11 +63,11 @@
if (xsluri==null) throw new ProcessingException("No stylesheet");
// Load the stylesheet (we should cache it in the STORE!)
- Cocoon cocoon=(Cocoon)this.manager.getComponent("cocoon");
+ //Cocoon cocoon=(Cocoon)this.manager.getComponent("cocoon");
StylesheetRoot stylesheet=null;
if (true) {
XSLTProcessor
loaderprocessor=XSLTProcessorFactory.getProcessor();
- InputSource xslsrc=cocoon.resolveEntity(xsluri);
+ InputSource xslsrc=environment.resolveEntity(xsluri);
XSLTInputSource style=new XSLTInputSource(xslsrc);
stylesheet=loaderprocessor.processStylesheet(style);
}
No revision
No revision
1.1.2.6 +2 -2
xml-cocoon/src/org/apache/cocoon/xml/util/Attic/DocumentHandlerWrapper.java
Index: DocumentHandlerWrapper.java
===================================================================
RCS file:
/home/cvs/xml-cocoon/src/org/apache/cocoon/xml/util/Attic/DocumentHandlerWrapper.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- DocumentHandlerWrapper.java 2000/07/23 00:04:13 1.1.2.5
+++ DocumentHandlerWrapper.java 2000/07/25 18:48:50 1.1.2.6
@@ -27,7 +27,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/07/23 00:04:13 $
+ * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/07/25 18:48:50 $
*/
public class DocumentHandlerWrapper extends AbstractXMLConsumer {
@@ -62,7 +62,7 @@
*/
public void setDocumentHandler(DocumentHandler document)
throws IllegalStateException {
- //FIXME: why this line? -> if (this.documentHandler!=null) throw new
IllegalStateException();
+ if (this.documentHandler!=null) throw new IllegalStateException();
this.documentHandler=document;
}