giacomo 00/07/20 14:57:28
Modified: src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
Processor.java
src/org/apache/cocoon/components/language/markup/sitemap/java
Tag: xml-cocoon2 sitemap.xsl
src/org/apache/cocoon/matching Tag: xml-cocoon2
AuthenticationMatcher.java
FileAuthenticationMatcher.java Matcher.java
RegexpURIMatcherFactory.java
WildcardURIMatcherFactory.java
src/org/apache/cocoon/sitemap Tag: xml-cocoon2
AbstractSitemapProcessor.java GenericProcessor.java
ResourceProcessor.java Sitemap.java
SitemapPartition.java XSLTMatcherFactoryLoader.java
XSLTSelectorFactoryLoader.java
xdocs/drafts Tag: xml-cocoon2 sitemap-working-draft.xmap
Added: lib Tag: xml-cocoon2 bsf.jar
src/org/apache/cocoon/sitemap Tag: xml-cocoon2
SitemapHandler.java SitemapManager.java
Log:
Another step further to the C2 draft spec.
Revision Changes Path
No revision
No revision
1.1.2.1 +179 -0 xml-cocoon/lib/Attic/bsf.jar
<<Binary file>>
No revision
No revision
1.4.2.11 +3 -1 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.10
retrieving revision 1.4.2.11
diff -u -r1.4.2.10 -r1.4.2.11
--- Cocoon.java 2000/07/11 23:46:34 1.4.2.10
+++ Cocoon.java 2000/07/20 21:56:53 1.4.2.11
@@ -26,6 +26,7 @@
import org.apache.avalon.ConfigurationException;
import org.apache.avalon.SAXConfigurationBuilder;
import org.apache.cocoon.components.parser.Parser;
+import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.serialization.Serializer;
import org.apache.cocoon.sitemap.Sitemap;
import org.xml.sax.EntityResolver;
@@ -36,7 +37,7 @@
*
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.4.2.10 $ $Date: 2000/07/11 23:46:34 $
+ * @version CVS $Revision: 1.4.2.11 $ $Date: 2000/07/20 21:56:53 $
*/
public class Cocoon
implements Component, Configurable, ComponentManager, Modifiable, Processor,
@@ -186,6 +187,7 @@
* Process the given <code>Request</code> producing the output to the
* specified <code>Response</code> and <code>OutputStream</code>.
*/
+ public boolean process(Environment environment, OutputStream out) {return true;}
public boolean process(Request req, Response res, OutputStream out)
throws SAXException, IOException, ProcessingException {
return(this.sitemap.process(req,res,out));
1.1.2.3 +7 -1 xml-cocoon/src/org/apache/cocoon/Attic/Processor.java
Index: Processor.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Processor.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- Processor.java 2000/02/27 01:33:05 1.1.2.2
+++ Processor.java 2000/07/20 21:56:54 1.1.2.3
@@ -9,13 +9,16 @@
import java.io.IOException;
import java.io.OutputStream;
+
import org.xml.sax.SAXException;
+import org.apache.cocoon.environment.Environment;
+
/**
*
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/02/27 01:33:05 $
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/20 21:56:54 $
*/
public interface Processor {
/**
@@ -23,5 +26,8 @@
* specified <code>Response</code> and <code>OutputStream</code>.
*/
public boolean process(Request req, Response res, OutputStream out)
+ throws SAXException, IOException, ProcessingException;
+
+ public boolean process(Environment environment, OutputStream out)
throws SAXException, IOException, ProcessingException;
}
No revision
No revision
1.1.2.11 +23 -29 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.10
retrieving revision 1.1.2.11
diff -u -r1.1.2.10 -r1.1.2.11
--- sitemap.xsl 2000/07/19 22:19:49 1.1.2.10
+++ sitemap.xsl 2000/07/20 21:56:58 1.1.2.11
@@ -25,17 +25,14 @@
import java.io.OutputStream;
import java.io.IOException;
- import java.util.Map;
- import java.util.Stack;
- import java.util.Vector;
+ import java.util.ArrayList;
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.Request;
- import org.apache.cocoon.Response;
+ import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.generation.Generator;
import org.apache.cocoon.matching.Matcher;
import org.apache.cocoon.reading.Reader;
@@ -53,18 +50,14 @@
/**
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/07/19 22:19:49 $
+ * @version CVS $Revision: 1.1.2.11 $ $Date: 2000/07/20 21:56:58 $
*/
public class <xsl:value-of select="@file-name"/> extends AbstractSitemapProcessor
{
- SAXConfigurationBuilder confBuilder = new SAXConfigurationBuilder ();
Parameters emptyParam = new Parameters();
private Generator generator_error_handler = null;
- /* FIXME: only for testing */
- private boolean read (Request req, Response res, OutputStream out, String s, String
a) {}
-
<!-- generate variables for all components -->
/** The generators */
<xsl:for-each select="/map:sitemap/map:components/map:generators/map:generator">
@@ -111,7 +104,7 @@
<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 Map <xsl:value-of select="$matcher-name"/> (String pattern, Request
request) {
+ 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>
@@ -127,7 +120,7 @@
<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, Request
request) {
+ 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>
@@ -140,7 +133,7 @@
<xsl:variable name="mounter-name">mounter_<xsl:value-of select='translate($mounter-name1,"'","")'/></xsl:variable>
<xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
<xsl:value-of select="java:getSource($matcher-factory-loader, string('class'),
'org.apache.cocoon.matching.RegexpURIMatcherFactory', string($mounter-name), string(@uri-expr),
$config)"/>
- private boolean <xsl:value-of select="$mounter-name"/> (String pattern, Request
request) {
+ private boolean <xsl:value-of select="$mounter-name"/> (String pattern, Environment
environment) {
<xsl:value-of select="java:getSource($matcher-factory-loader, string('method'),
'org.apache.cocoon.matching.RegexpURIMatcherFactory', string($mounter-name), string(@uri-expr),
$config)"/>
}
</xsl:for-each>
@@ -152,6 +145,7 @@
*/
public void setConfiguration(Configuration xconf)
throws ConfigurationException {
+ SAXConfigurationBuilder confBuilder = new SAXConfigurationBuilder ();
AttributesImpl attr = new AttributesImpl();
<!-- configure all components -->
@@ -207,7 +201,7 @@
/* SitemapManager sm = SitemapManager.getInstance(); */
/* sm.beginRegistration (this); */
<xsl:for-each select="/map:sitemap/map:pipelines//map:mount">
- /* sitemap_<xsl:value-of select="translate(./@uri-prefix, '- /{}', '___')"/>
= sm.registerSitemap (this, "<xsl:value-of select="@src"/>"); */
+ /* sitemap_<xsl:value-of select="translate(./@uri-prefix, '- /{}', '___')"/>
= sm.registerSitemap (this, substitute(listOfLists,"<xsl:value-of select="@src"/>"));
*/
sitemap_<xsl:value-of select="translate(./@uri-prefix, '- /{}', '___')"/>.setConfiguration
(null);
</xsl:for-each>
/* sm.endRegistration (this); */
@@ -215,9 +209,9 @@
<xsl:for-each select="/map:sitemap/map:resources/map:resource">
private boolean resource_<xsl:value-of select="translate(@name, '- ', '__')"/>
(ResourcePipeline pipeline,
- Stack mapStack, Request request, Response response, OutputStream out)
+ ArrayList listOfLists, Environment environment, OutputStream out)
throws SAXException, IOException, ProcessingException {
- Map map = null;
+ List list = null;
Parameters param = null;
<xsl:apply-templates select="./*"/>
}
@@ -227,11 +221,11 @@
* Process the given <code>Request</code> producing the output to the
* specified <code>Response</code> and <code>OutputStream</code>.
*/
- public boolean process(Request request, Response response, OutputStream out)
+ public boolean process(Environment environment, OutputStream out)
throws SAXException, IOException, ProcessingException {
ResourcePipeline pipeline = new ResourcePipeline ();
- Stack mapStack = new Stack();
- Map map = null;
+ ArrayList listOfLists = new ArrayList();
+ ArrayList list = null;
Parameters param = null;
<xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
try {
@@ -244,7 +238,7 @@
<xsl:otherwise>
pipeline.setGenerator (generator_error_handler, e.getMessage(), emptyParam);
<xsl:apply-templates select="./map:handle-error/*"/>
- return pipeline.process (request, response, out);
+ return pipeline.process (Environment environment, out);
</xsl:otherwise>
</xsl:choose>
}
@@ -286,8 +280,8 @@
</xsl:choose>
</xsl:for-each>
</xsl:variable>
- if ((map = <xsl:value-of select="$matcher-name"/> ("<xsl:value-of select="$pattern-value"/>",
request)) != null) {
- mapStack.push (map);
+ 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" -->
@@ -325,7 +319,7 @@
</xsl:choose>
</xsl:for-each>
</xsl:variable>
- if (<xsl:value-of select="$selector-name"/> ("<xsl:value-of select="$test-value"/>",
request)) {
+ if (<xsl:value-of select="$selector-name"/> ("<xsl:value-of select="$test-value"/>",
environment)) {
<xsl:apply-templates/>
}
</xsl:for-each>
@@ -359,7 +353,7 @@
<xsl:with-param name="method">setSerializer</xsl:with-param>
<xsl:with-param name="prefix">serializer</xsl:with-param>
</xsl:call-template>
- return pipeline.process (request, response, out);
+ return pipeline.process (environment, out);
</xsl:template> <!-- match="map:serialize" -->
<xsl:template match="map:read">
@@ -368,24 +362,24 @@
<xsl:with-param name="method">setReader</xsl:with-param>
<xsl:with-param name="prefix">reader</xsl:with-param>
</xsl:call-template>
- return reader_<xsl:value-of select="translate(./@name, '- ', '__')"/>.process
(request, response, out);
+ return reader_<xsl:value-of select="translate(./@name, '- ', '__')"/>.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>
- /* environment.addUriPrefix ("<xsl:value-of select="./@uri-prefix"/>"); */
- return sitemap_<xsl:value-of select="$pos"/>.process(request, response, out);
+ environment.addUriPrefix (substitute(listOfLists,"<xsl:value-of select="./@uri-prefix"/>"));
+ return sitemapManager.invoke (substitute(listOfLists,"<xsl:value-of select="@src"/>"),
"<xsl:value-of select="@check-reload"/>", environment, 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,
mapStack, request, response, out);
+ 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(request, response, out);
+ // this.process(environment, out);
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="error">
No revision
No revision
1.1.2.2 +13 -4 xml-cocoon/src/org/apache/cocoon/matching/Attic/AuthenticationMatcher.java
Index: AuthenticationMatcher.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/AuthenticationMatcher.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- AuthenticationMatcher.java 2000/07/11 23:46:40 1.1.2.1
+++ AuthenticationMatcher.java 2000/07/20 21:57:00 1.1.2.2
@@ -1,16 +1,25 @@
package org.apache.cocoon.matching;
-import org.apache.cocoon.Request;
+import java.util.List;
+import java.util.ArrayList;
+import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.http.HttpEnvironment;
+
public abstract class AuthenticationMatcher implements Matcher {
protected String username_parameter = "username";
protected String password_parameter = "password";
- public boolean match(Request request) {
- return match(request.getParameter(username_parameter),request.getParameter(password_parameter));
+ public List match(String pattern, Environment environment) {
+ if (match(((HttpEnvironment)environment).getRequest().getParameter(username_parameter),
+ ((HttpEnvironment)environment).getRequest().getParameter(password_parameter)))
{
+ return new ArrayList();
+ } else {
+ return null;
+ }
}
- abstract public boolean match(String username, String password);
+ abstract boolean match(String username, String password);
}
1.1.2.2 +6 -3 xml-cocoon/src/org/apache/cocoon/matching/Attic/FileAuthenticationMatcher.java
Index: FileAuthenticationMatcher.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/FileAuthenticationMatcher.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- FileAuthenticationMatcher.java 2000/07/11 23:46:41 1.1.2.1
+++ FileAuthenticationMatcher.java 2000/07/20 21:57:01 1.1.2.2
@@ -2,10 +2,13 @@
import java.util.Enumeration;
import java.util.Hashtable;
-import java.util.Map;
+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.cocoon.environment.Environment;
import org.apache.cocoon.Request;
import org.apache.cocoon.Response;
import org.apache.avalon.utils.Parameters;
@@ -28,8 +31,8 @@
}
}
- public Map match(String pattern, Request request) {
- return (Map) new Hashtable();
+ public List match(String pattern, Environment environment) {
+ return new ArrayList();
}
public boolean match(String user, String password) {
if (user == null || password == null) {
1.1.2.3 +4 -4 xml-cocoon/src/org/apache/cocoon/matching/Attic/Matcher.java
Index: Matcher.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/Matcher.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- Matcher.java 2000/07/17 21:06:11 1.1.2.2
+++ Matcher.java 2000/07/20 21:57:02 1.1.2.3
@@ -7,15 +7,15 @@
*****************************************************************************/
package org.apache.cocoon.matching;
-import java.util.Map;
+import java.util.List;
import org.apache.cocoon.sitemap.SitemapComponent;
-import org.apache.cocoon.Request;
+import org.apache.cocoon.environment.Environment;
/**
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/07/17 21:06:11 $
+ * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/20 21:57:02 $
*/
public interface Matcher extends SitemapComponent {
/**
@@ -32,6 +32,6 @@
* contained in the pattern.
* If the return value is null there was no match.
*/
- public Map match (String pattern, Request request);
+ public List match (String pattern, Environment environment);
}
1.1.2.2 +4 -4 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.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- RegexpURIMatcherFactory.java 2000/07/19 22:19:55 1.1.2.1
+++ RegexpURIMatcherFactory.java 2000/07/20 21:57:02 1.1.2.2
@@ -18,7 +18,7 @@
* for request URIs
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.1 $ $Date: 2000/07/19 22:19:55 $
+ * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/07/20 21:57:02 $
*/
public class RegexpURIMatcherFactory implements MatcherFactory {
@@ -57,18 +57,18 @@
StringBuffer sb = new StringBuffer ();
String name = prefix+"_re";
String instructions = name + "PatternInstructions";
- sb.append("java.util.Stack stack = new java.util.Stack ();")
+ sb.append("java.util.ArrayList list = new java.util.ArrayList ();")
.append("if (").append(name).append("Pattern.match(request.getURI())) {");
// Count number of parens
int i = 0;
int j = -1;
while ((j = pattern.indexOf('(', j+1)) != -1) {
if (j == 0 || pattern.charAt(j-1) != '\\') {
- sb.append("stack.push (").append(name).append("Pattern.getParen(")
+ sb.append("list.add (").append(name).append("Pattern.getParen(")
.append(++i).append("));");
}
}
- sb.append("return (java.util.Map) stack; } else { return null; }");
+ sb.append("return list; } else { return null; }");
return sb.toString();
}
}
1.1.2.4 +5 -8 xml-cocoon/src/org/apache/cocoon/matching/Attic/WildcardURIMatcherFactory.java
Index: WildcardURIMatcherFactory.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/WildcardURIMatcherFactory.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- WildcardURIMatcherFactory.java 2000/07/19 22:19:55 1.1.2.3
+++ WildcardURIMatcherFactory.java 2000/07/20 21:57:03 1.1.2.4
@@ -17,7 +17,7 @@
* for request URIs
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/19 22:19:55 $
+ * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/07/20 21:57:03 $
*/
public class WildcardURIMatcherFactory /*extends PatternTranslator*/ implements MatcherFactory
{
@@ -38,10 +38,10 @@
public String generateMethodLevel (String prefix, String pattern, DocumentFragment
conf)
throws PatternException {
StringBuffer result = new StringBuffer();
- return result.append ("Stack stack = new Stack();")
- .append ("if (org.apache.cocoon.matching.helpers.WildcardURIMatcher.match
(stack, request.getUri(), ")
+ return result.append ("java.util.ArrayList list = new ArrayList();")
+ .append ("if (org.apache.cocoon.matching.helpers.WildcardURIMatcher.match
(list, environment.getUri(), ")
.append(prefix).append("_expr))")
- .append ("return (Map) stack;")
+ .append ("return list;")
.append ("else return null;").toString();
}
@@ -63,10 +63,7 @@
.append (',');
}
return result.append (sourcePattern[j])
- .append ("};")
- .append ("if (org.apache.cocoon.matching.helpers.WildcardURIMatcher.match
(stack, request.getUri(), expr))")
- .append ("return (Map) stack;")
- .append ("else return null;").toString();
+ .append ("};").toString();
}
/**
No revision
No revision
1.1.2.5 +72 -10 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemapProcessor.java
Index: AbstractSitemapProcessor.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemapProcessor.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- AbstractSitemapProcessor.java 2000/07/17 21:06:14 1.1.2.4
+++ AbstractSitemapProcessor.java 2000/07/20 21:57:12 1.1.2.5
@@ -10,15 +10,17 @@
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
+import java.util.List;
import org.apache.avalon.ComponentManager;
+import org.apache.avalon.Component;
import org.apache.avalon.Composer;
import org.apache.avalon.Configurable;
import org.apache.avalon.Configuration;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.Processor;
-import org.apache.cocoon.Request;
-import org.apache.cocoon.Response;
+import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.sitemap.patterns.PatternException;
import org.xml.sax.SAXException;
@@ -26,13 +28,16 @@
* Base class for XSP-generated <code>SitemapProcessor</code> classes
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/07/17 21:06:14 $
+ * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/07/20 21:57:12 $
*/
public abstract class AbstractSitemapProcessor
implements SitemapProcessor {
/** The component manager instance */
protected ComponentManager manager=null;
+ /** The Sitemap instances */
+ protected SitemapManager sitemapManager = new SitemapManager ();
+
/** The creation date */
protected static long dateCreated = -1L;
@@ -50,7 +55,7 @@
/**
* Determines whether this generator's source files have changed
*
- * @return Whether any of the files this generator depends on has changed
+ * @return Whether any of the files this sitemap depends on has changed
* since it was created
*/
public final boolean modifiedSince(long date) {
@@ -76,17 +81,74 @@
* dynamically generated content has changed
* @return Whether content has changes for this request's data
*/
- public boolean hasContentChanged(Request request) {
+ public boolean hasContentChanged(Environment environment) {
return true;
}
/**
- * Loads a class specified in a sitemap component definition
- */
- protected Object load_component (String ClassURL, Configuration conf) {
- return ("");
+ * Loads a class specified in a sitemap component definition and
+ * initialize it
+ */
+ protected Component load_component (String classURL, Configuration conf)
+ throws ClassNotFoundException, InstantiationException, IllegalAccessException {
+ Class cl = this.getClass().getClassLoader().loadClass(classURL);
+ Object comp = cl.newInstance();
+ if (comp instanceof Composer) {
+ ((Composer)comp).setComponentManager (this.manager);
+ }
+ if (comp instanceof Configurable) {
+ ((Configurable)comp).setConfiguration (conf);
+ }
+ return ((SitemapComponent)comp);
}
+ /**
+ * Replaces occurences of xpath like expressions ina argument String
+ * with content from a List of Lists
+ */
+ protected String substitute (List list, String expr)
+ throws PatternException, NumberFormatException {
+ StringBuffer result = new StringBuffer();
+ String s = null;
+ int j = 0;
+ int k = 0;
+ int l = 0;
+ int m = 0;
+ int n = 0;
+ int ii = 0;
+ int i = -1;
+ try {
+ while (ii <= expr.length() && (i = expr.indexOf('{', ii)) != -1)
{
+ result.append(expr.substring(ii, i));
+ j = expr.indexOf('}', i);
+ if (j < i)
+ throw new PatternException ("invalid expression in \""+expr+"\"");
+ ii = j+1;
+ if (j == -1)
+ throw new PatternException ("invalid expression in URL "+expr);
+ k = list.size() - 1;
+ s = expr.substring (i+1,j);
+ for (l = -1; (l = s.indexOf("../",l+1)) != -1; k--);
+ m = s.lastIndexOf('/');
+ if (m == -1) {
+ n = Integer.parseInt(s) - 1;
+ } else {
+ n = Integer.parseInt(s.substring(m+1)) - 1;
+ }
+ result.append((String)((List)list.get(k)).get(n));
+ }
+ if (ii < expr.length()) {
+ result.append(expr.substring(ii));
+ }
+ return (result.toString());
+ } catch (Exception e) {
+ throw new PatternException
+ ("error occurred during evaluation of expression \""
+ +expr+"\" at position "+(i+1)+"\n"
+ + e.getMessage());
+ }
+ }
+
/**
* Resolve a link against a source into the target URI space.
*/
@@ -101,6 +163,6 @@
* This method is supplied by the generated SitemapProcessor .
*/
/*
- public abstract boolean process (Request request, Response resposne, OutputStream out);
+ public abstract boolean process (Environment environment, OutputStream out);
*/
}
1.1.2.13 +4 -2 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/GenericProcessor.java
Index: GenericProcessor.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/GenericProcessor.java,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -r1.1.2.12 -r1.1.2.13
--- GenericProcessor.java 2000/07/11 23:46:53 1.1.2.12
+++ GenericProcessor.java 2000/07/20 21:57:13 1.1.2.13
@@ -22,12 +22,13 @@
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.Request;
import org.apache.cocoon.Response;
-import org.apache.cocoon.transformation.Transformer;
+import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.generation.Generator;
import org.apache.cocoon.serialization.Serializer;
import org.apache.cocoon.sitemap.patterns.PatternException;
import org.apache.cocoon.sitemap.patterns.PatternMatcher;
import org.apache.cocoon.sitemap.patterns.PatternTranslator;
+import org.apache.cocoon.transformation.Transformer;
import org.apache.cocoon.xml.XMLConsumer;
import org.xml.sax.SAXException;
@@ -35,7 +36,7 @@
*
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.2.12 $ $Date: 2000/07/11 23:46:53 $
+ * @version CVS $Revision: 1.1.2.13 $ $Date: 2000/07/20 21:57:13 $
*/
public class GenericProcessor
implements Composer, Configurable, Processor, LinkResolver {
@@ -124,6 +125,7 @@
* Process the given <code>Request</code> producing the output to the
* specified <code>Response</code> and <code>OutputStream</code>.
*/
+ public boolean process(Environment environment, OutputStream out) {return true;}
public boolean process(Request req, Response res, OutputStream out)
throws SAXException, IOException, ProcessingException {
if (!this.matcher.match(req.getUri())) return(false);
1.1.2.4 +3 -1 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/ResourceProcessor.java
Index: ResourceProcessor.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/ResourceProcessor.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- ResourceProcessor.java 2000/07/11 03:10:04 1.1.2.3
+++ ResourceProcessor.java 2000/07/20 21:57:14 1.1.2.4
@@ -21,6 +21,7 @@
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.Request;
import org.apache.cocoon.Response;
+import org.apache.cocoon.environment.Environment;
import org.apache.cocoon.sitemap.patterns.PatternException;
import org.apache.cocoon.sitemap.patterns.PatternMatcher;
import org.apache.cocoon.sitemap.patterns.PatternTranslator;
@@ -30,7 +31,7 @@
*
* @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/11 03:10:04 $
+ * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/07/20 21:57:14 $
*/
public class ResourceProcessor implements Composer, Configurable, Processor {
@@ -76,6 +77,7 @@
* Process the given <code>Request</code> producing the output to the
* specified <code>Response</code> and <code>OutputStream</code>.
*/
+ public boolean process(Environment environment, OutputStream out) {return true;}
public boolean process(Request req, Response res, OutputStream out)
throws SAXException, IOException, ProcessingException {
if (!this.targetTranslator.match(req.getUri())) return(false);
1.1.4.7 +7 -1 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Sitemap.java
Index: Sitemap.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Sitemap.java,v
retrieving revision 1.1.4.6
retrieving revision 1.1.4.7
diff -u -r1.1.4.6 -r1.1.4.7
--- Sitemap.java 2000/07/11 03:10:04 1.1.4.6
+++ Sitemap.java 2000/07/20 21:57:14 1.1.4.7
@@ -21,13 +21,14 @@
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.Request;
import org.apache.cocoon.Response;
+import org.apache.cocoon.environment.Environment;
import org.xml.sax.SAXException;
/**
*
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.4.6 $ $Date: 2000/07/11 03:10:04 $
+ * @version CVS $Revision: 1.1.4.7 $ $Date: 2000/07/20 21:57:14 $
*/
public class Sitemap
implements Composer, Configurable, Processor, LinkResolver {
@@ -89,6 +90,7 @@
* Process the given <code>Request</code> producing the output to the
* specified <code>Response</code> and <code>OutputStream</code>.
*/
+ public boolean process(Environment environment, OutputStream out) {return true;}
public boolean process(Request req, Response res, OutputStream out)
throws SAXException, IOException, ProcessingException {
if(this.partition!=null)
@@ -110,5 +112,9 @@
if (p!=null) return(p.resolve(source,part));
return(null);
+ }
+
+ public boolean hasChanged () {
+ return false;
}
}
1.1.2.7 +3 -1 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapPartition.java
Index: SitemapPartition.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapPartition.java,v
retrieving revision 1.1.2.6
retrieving revision 1.1.2.7
diff -u -r1.1.2.6 -r1.1.2.7
--- SitemapPartition.java 2000/07/11 03:10:04 1.1.2.6
+++ SitemapPartition.java 2000/07/20 21:57:18 1.1.2.7
@@ -21,13 +21,14 @@
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.Request;
import org.apache.cocoon.Response;
+import org.apache.cocoon.environment.Environment;
import org.xml.sax.SAXException;
/**
*
* @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
* (Apache Software Foundation, Exoffice Technologies)
- * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/07/11 03:10:04 $
+ * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/07/20 21:57:18 $
*/
public class SitemapPartition
implements Composer, Configurable, Processor, LinkResolver {
@@ -94,6 +95,7 @@
* Process the given <code>Request</code> producing the output to the
* specified <code>Response</code> and <code>OutputStream</code>.
*/
+ public boolean process(Environment environment, OutputStream out) {return true;}
public boolean process(Request req, Response res, OutputStream out)
throws SAXException, IOException, ProcessingException {
Enumeration e=this.processors.elements();
1.1.2.5 +1 -6 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/XSLTMatcherFactoryLoader.java
Index: XSLTMatcherFactoryLoader.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/XSLTMatcherFactoryLoader.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- XSLTMatcherFactoryLoader.java 2000/07/19 22:20:00 1.1.2.4
+++ XSLTMatcherFactoryLoader.java 2000/07/20 21:57:19 1.1.2.5
@@ -19,7 +19,7 @@
* generated source code.
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/07/19 22:20:00 $
+ * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/07/20 21:57:19 $
*/
public class XSLTMatcherFactoryLoader {
@@ -29,17 +29,12 @@
public String getSource (String level, String matcherFactoryClassname, String pattern,
String prefix, DocumentFragment conf)
throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception
{
- MatcherFactory factory = null;
-/*
MatcherFactory factory = (MatcherFactory) obj.get(matcherFactoryClassname);
if (factory == null) {
-*/
Class cl = this.getClass().getClassLoader().loadClass(matcherFactoryClassname);
factory = (MatcherFactory) cl.newInstance();
-/*
obj.put (matcherFactoryClassname, factory);
}
-*/
if ("class".equals(level)) {
return factory.generateClassLevel (pattern, prefix, conf);
} else {
1.1.2.4 +1 -6 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/XSLTSelectorFactoryLoader.java
Index: XSLTSelectorFactoryLoader.java
===================================================================
RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/XSLTSelectorFactoryLoader.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- XSLTSelectorFactoryLoader.java 2000/07/19 22:20:00 1.1.2.3
+++ XSLTSelectorFactoryLoader.java 2000/07/20 21:57:19 1.1.2.4
@@ -19,7 +19,7 @@
* generated source code.
*
* @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/19 22:20:00 $
+ * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/07/20 21:57:19 $
*/
public class XSLTSelectorFactoryLoader {
@@ -29,17 +29,12 @@
public String getSource (String level, String selectorFactoryClassname, String test,
String prefix, DocumentFragment conf)
throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception
{
- SelectorFactory factory = null;
-/*
SelectorFactory factory = (SelectorFactory ) obj.get(selectorFactoryClassname);
if (factory == null) {
-*/
Class cl = this.getClass().getClassLoader().loadClass(selectorFactoryClassname);
factory = (SelectorFactory) cl.newInstance();
-/*
obj.put (selectorFactoryClassname, factory);
}
-*/
if ("class".equals(level)) {
return factory.generateClassLevel (test, prefix, conf);
} else {
No revision
No revision
1.1.2.1 +111 -0 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapHandler.java
1.1.2.1 +58 -0 xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapManager.java
No revision
No revision
1.1.2.12 +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.11
retrieving revision 1.1.2.12
diff -u -r1.1.2.11 -r1.1.2.12
--- sitemap-working-draft.xmap 2000/07/19 22:20:02 1.1.2.11
+++ sitemap-working-draft.xmap 2000/07/20 21:57:26 1.1.2.12
@@ -237,7 +237,7 @@
depending on the matcher own logic (this is up to the matcher implementation).
-->
<map:matchers default="uri-wildcard">
- <map:matcher name="uri-wildcard" src="org.apache.cocoon.matching.WildcardURIMatcherFactory">
+ <map:matcher name="uri-wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher">
...
</map:matcher>
|