You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by bl...@locus.apache.org on 2000/10/23 23:17:48 UTC
cvs commit: xml-cocoon/src/org/apache/cocoon/matching RegexpURIMatcherFactory.java
bloritsch 00/10/23 14:17:47
Modified: src/org/apache/cocoon/components/language/markup/sitemap/java
Tag: xml-cocoon2 sitemap.xsl
src/org/apache/cocoon/matching Tag: xml-cocoon2
RegexpURIMatcherFactory.java
Log:
Changed SitemapConfiguration to be built directly.
Side affects--SVG serialization not configured properly.
Almost correct, though.
Revision Changes Path
No revision
No revision
1.1.2.52 +20 -43 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.51
retrieving revision 1.1.2.52
diff -u -r1.1.2.51 -r1.1.2.52
--- sitemap.xsl 2000/10/23 19:44:45 1.1.2.51
+++ sitemap.xsl 2000/10/23 21:17:46 1.1.2.52
@@ -52,8 +52,12 @@
import org.apache.avalon.Configurable;
import org.apache.avalon.Configuration;
import org.apache.avalon.ConfigurationException;
+ import org.apache.avalon.DefaultConfiguration;
import org.apache.avalon.Parameters;
+ import org.apache.regexp.RE;
+ import org.apache.regexp.REProgram;
+
import org.apache.cocoon.Cocoon;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.environment.Environment;
@@ -63,17 +67,13 @@
import org.apache.cocoon.sitemap.Sitemap;
import org.apache.cocoon.sitemap.ErrorNotifier;
import org.apache.cocoon.sitemap.Manager;
- import org.apache.cocoon.xml.SAXConfigurationBuilder;
import org.apache.cocoon.matching.helpers.WildcardURIMatcher;
- import org.xml.sax.SAXException;
- import org.xml.sax.helpers.AttributesImpl;
-
/**
* This is the automatically generated class from the sitemap definitions
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.51 $ $Date: 2000/10/23 19:44:45 $
+ * @version CVS $Revision: 1.1.2.52 $ $Date: 2000/10/23 21:17:46 $
*/
public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
static {
@@ -187,19 +187,16 @@
* <code>Configurable</code> class.
*/
public void configure(Configuration conf) throws ConfigurationException {
- SAXConfigurationBuilder confBuilder = new SAXConfigurationBuilder ();
- Configuration cconf = null;
- AttributesImpl attr = new AttributesImpl();
+ DefaultConfiguration cconf;
+ DefaultConfiguration current;
+ DefaultConfiguration nested;
this.sitemapManager = new Manager(super.sitemapComponentManager);
this.sitemapManager.compose(this.manager);
this.sitemapManager.configure(conf);
try {
<!-- configure all components -->
- /* Configure special ErrorNotifier and LinkTransformer */
- confBuilder.startDocument ();
- confBuilder.endDocument ();
- Configuration cconf2 = confBuilder.getConfiguration();
+ Configuration cconf2 = new DefaultConfiguration("");
load_component ("!generator:error-notifier!", "org.apache.cocoon.sitemap.ErrorNotifier", cconf2, null);
load_component ("!transformer:link-translator!", "org.apache.cocoon.sitemap.LinkTranslator", cconf2, null);
@@ -716,20 +713,13 @@
<xsl:variable name="is-factory-component"
select="(@factory and ($name = 'matcher' or $name = 'selector')) or (@src and ($name = 'matcher' or $name = 'selector') and java:isFactory($factory-loader, string(@src)))"/>
<xsl:if test="$is-factory-component=false()">
- confBuilder.startDocument ();
- <xsl:if test="$ns">
- confBuilder.startPrefixMapping("","<xsl:value-of select="namespace-uri(.)"/>");
- </xsl:if>
+ cconf = new DefaultConfiguration("");
- <!-- Create root configuration -->
- attr.clear();
+ current = new DefaultConfiguration("<xsl:value-of select="translate(@name, '- ', '__')"/>");
<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="."/>");
+ current.addAttribute ("<xsl:value-of select="name(.)"/>",
+ "<xsl:value-of select="."/>");
</xsl:for-each>
- confBuilder.startElement ("", "<xsl:value-of select="translate(@name, '- ', '__')"/>",
- "<xsl:value-of select="translate(@name, '- ', '__')"/>", attr);
<!-- get nested configuration definitions -->
<xsl:call-template name="nested-config-components">
@@ -740,14 +730,8 @@
<xsl:with-param name="ns" select="$ns"/>
</xsl:call-template>
- <!-- end of the configurations root element -->
- confBuilder.endElement ("", "<xsl:value-of select="translate(@name, '- ', '__')"/>",
- "<xsl:value-of select="translate(@name, '- ', '__')"/>");
- <xsl:if test="$ns">
- confBuilder.endPrefixMapping("");
- </xsl:if>
- confBuilder.endDocument ();
- cconf = confBuilder.getConfiguration();
+ cconf.addChild(current);
+
<xsl:choose>
<xsl:when test="@mime-type">
load_component ("<xsl:value-of select="$name"/>:<xsl:value-of select="@name"/>", "<xsl:value-of select="@src"/>", cconf, "<xsl:value-of select="@mime-type"/>");
@@ -775,19 +759,15 @@
<!-- 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();
+ nested = new DefaultConfiguration("<xsl:value-of select="name(.)"/>");
<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="."/>");
+ nested.addAttribute ("<xsl:value-of select="name(.)"/>", "<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(.)"/>);
+ nested.appendValueData("<xsl:value-of select="."/>");
</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())"/>);
+ nested.appendValueData("<xsl:value-of select="text()"/>");
</xsl:if>
<xsl:variable name="newsubname">
<xsl:choose>
@@ -803,10 +783,7 @@
<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>
+ current.addChild(nested);
</xsl:for-each>
</xsl:template>
No revision
No revision
1.1.2.11 +5 -5 xml-cocoon/src/org/apache/cocoon/matching/Attic/RegexpURIMatcherFactory.java
Index: RegexpURIMatcherFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/RegexpURIMatcherFactory.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- RegexpURIMatcherFactory.java 2000/10/19 14:44:00 1.1.2.10
+++ RegexpURIMatcherFactory.java 2000/10/23 21:17:47 1.1.2.11
@@ -20,7 +20,7 @@
* for request URIs
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/10/19 14:44:00 $
+ * @version CVS $Revision: 1.1.2.11 $ $Date: 2000/10/23 21:17:47 $
*/
public class RegexpURIMatcherFactory implements MatcherFactory {
@@ -51,9 +51,9 @@
sb.append("0x").append(hex).append(", ");
}
sb.append("\n };")
- .append("\n static org.apache.regexp.RE ")
+ .append("\n static RE ")
.append(name)
- .append("Pattern = new org.apache.regexp.RE(new org.apache.regexp.REProgram(")
+ .append("Pattern = new RE(new REProgram(")
.append(instructions)
.append("));");
return sb.toString();
@@ -69,8 +69,8 @@
String name = prefix;
String instructions = name + "PatternInstructions";
String pat = correctPattern (pattern);
- sb.append("java.util.ArrayList list = new java.util.ArrayList ();")
- .append("if(").append(name).append("Pattern.match(((javax.servlet.http.HttpServletRequest)objectModel.get(org.apache.cocoon.Cocoon.REQUEST_OBJECT)).getRequestURI())) {");
+ sb.append("ArrayList list = new ArrayList ();")
+ .append("if(").append(name).append("Pattern.match(((HttpServletRequest)objectModel.get(Cocoon.REQUEST_OBJECT)).getRequestURI())) {");
// Count number of parens
int i = 0;
int j = -1;