cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@locus.apache.org
Subject cvs commit: xml-cocoon/xdocs/drafts sitemap-working-draft.xmap
Date Wed, 19 Jul 2000 22:20:06 GMT
giacomo     00/07/19 15:20:05

  Modified:    .        Tag: xml-cocoon2 todo.xml
               src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: xml-cocoon2 sitemap.xsl
               src/org/apache/cocoon/environment/http Tag: xml-cocoon2
                        HttpEnvironment.java HttpRequest.java
               src/org/apache/cocoon/matching Tag: xml-cocoon2
                        BrowserMatcherFactory.java MatcherFactory.java
                        WildcardURIMatcherFactory.java
               src/org/apache/cocoon/selection Tag: xml-cocoon2
                        BrowserSelectorFactory.java SelectorFactory.java
               src/org/apache/cocoon/sitemap Tag: xml-cocoon2
                        XSLTMatcherFactoryLoader.java
                        XSLTSelectorFactoryLoader.java
               xdocs/drafts Tag: xml-cocoon2 sitemap-working-draft.xmap
  Added:       lib      Tag: xml-cocoon2 jakarta-regexp-1.1.jar
               src/org/apache/cocoon/matching Tag: xml-cocoon2
                        RegexpURIMatcherFactory.java
  Log:
  Saving day work
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.9   +5 -1      xml-cocoon/todo.xml
  
  Index: todo.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/todo.xml,v
  retrieving revision 1.6.2.8
  retrieving revision 1.6.2.9
  diff -u -r1.6.2.8 -r1.6.2.9
  --- todo.xml	2000/06/19 20:29:00	1.6.2.8
  +++ todo.xml	2000/07/19 22:19:46	1.6.2.9
  @@ -4,7 +4,7 @@
   
   <!--
     History of Cocoon changes
  -  $Id: todo.xml,v 1.6.2.8 2000/06/19 20:29:00 giacomo Exp $
  +  $Id: todo.xml,v 1.6.2.9 2000/07/19 22:19:46 giacomo Exp $
   -->
   
   
  @@ -22,6 +22,10 @@
    </devs>
   
    <actions priority="high">
  +  <action context="code">
  +   Write URLHandler for the protocols defined in the sitemap, e.g. class://. cvs://
  +  </action>
  +
     <action context="code" assigned-to="BL">
      Make Cocoon 2 Avalon-aware using the Component api from Avalon.
     </action>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +109 -0    xml-cocoon/lib/Attic/jakarta-regexp-1.1.jar
  
  	<<Binary file>>
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.10  +106 -34   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.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- sitemap.xsl	2000/07/18 22:55:38	1.1.2.9
  +++ sitemap.xsl	2000/07/19 22:19:49	1.1.2.10
  @@ -21,8 +21,9 @@
     
     <xsl:template match="map:sitemap"> 
       package <xsl:value-of select="translate(@file-path, '/', '.')"/>;
  -
  + 
       import java.io.OutputStream;
  +    import java.io.IOException;
   
       import java.util.Map; 
       import java.util.Stack; 
  @@ -35,21 +36,24 @@
   
       import org.apache.cocoon.Request;
       import org.apache.cocoon.Response;
  -    import org.apache.cocoon.selection.Selector;
  -    import org.apache.cocoon.transformation.Transformer;
       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.AbstractSitemapProcessor;
  -    import org.apache.cocoon.sitemap.SitemapProcessor;
  +    import org.apache.cocoon.sitemap.ProcessingException;
       import org.apache.cocoon.sitemap.ResourcePipeline;
  +    import org.apache.cocoon.sitemap.SitemapProcessor;
  +    import org.apache.cocoon.transformation.Transformer;
   
  +    import org.xml.sax.SAXException;
       import org.xml.sax.helpers.AttributesImpl;
   
   /**
    *
    * @author &lt;a href="mailto:Giacomo.Pati@pwr.ch"&gt;Giacomo Pati&lt;/a&gt;
  - * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/07/18 22:55:38 $
  + * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/07/19 22:19:49 $
    */
   public class <xsl:value-of select="@file-name"/> extends AbstractSitemapProcessor
{
       
  @@ -58,6 +62,9 @@
   
       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">
  @@ -69,6 +76,11 @@
         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;
  @@ -86,7 +98,7 @@
         
       /** The sub sitemaps */  
       <xsl:for-each select="/map:sitemap/map:pipelines//map:mount">  
  -      SitemapProcessor sitemap_<xsl:value-of select="position()"/> = null;
  +      SitemapProcessor sitemap_<xsl:value-of select="translate(./@uri-prefix, '- /{}',
'___')"/> = null;
       </xsl:for-each>
   
       /** The generated matchers */
  @@ -97,9 +109,10 @@
         <xsl:variable name="config"><xsl:copy-of select="."/></xsl:variable>
         <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline/descendant-or-self::map:match[@type=$type
or (not(@type) and $default!='')]">
           <xsl:variable name="matcher-name1" select="translate(@pattern,'/- *?@:{}()[].#^\\$|&#33;','_')"/>
  -        <xsl:variable name="matcher-name" select='translate($matcher-name1,"&#39;","")'/>
  -        private Map _matcher_<xsl:value-of select="$matcher-name"/> (Request request)
{
  -          <xsl:value-of select="java:getSource($matcher-factory-loader, string($factory),
string(@pattern), $config)"/>
  +        <xsl:variable name="matcher-name">matcher_<xsl:value-of select='translate($matcher-name1,"&#39;","")'/></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) {
  +          <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>
  @@ -112,20 +125,34 @@
         <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,'/- *?@:{}()[].#^\\$|&#33;','_')"/>
  -        <xsl:variable name="selector-name" select='translate($selector-name1,"&#39;","")'/>
  -        private boolean _selector_<xsl:value-of select="$selector-name"/> (Request
request) {
  -          <xsl:value-of select="java:getSource($selector-factory-loader, string($factory),
string(@test), $config)"/>
  +        <xsl:variable name="selector-name">selector_<xsl:value-of select='translate($selector-name1,"&#39;","")'/></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) {
  +          <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>
   
  +<!--
  +    /** The generated mounter */
  +    <xsl:for-each select="/map:sitemap/map:mounts/map:mount">
  +      <xsl:variable name="mounter-name1" select="translate(@uri-expr,'/- *?@:{}()[].#^\\$|&#33;','_')"/>
  +      <xsl:variable name="mounter-name">mounter_<xsl:value-of select='translate($mounter-name1,"&#39;","")'/></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) {
  +        <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>
  +-->
  +
       /**
        * Pass a &lt;code&gt;Configuration&lt;/code&gt; instance to this
        * &lt;code&gt;Configurable&lt;/code&gt; class.
        */
       public void setConfiguration(Configuration xconf) 
       throws ConfigurationException {
  -      AttributeImpl attr = new AttributeImpl();
  +      AttributesImpl attr = new AttributesImpl();
   
       <!-- configure all components -->
       /* Configure generators */
  @@ -143,6 +170,14 @@
         <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">
  @@ -169,18 +204,18 @@
       </xsl:call-template>
   
       /* Configure mounted sitemaps */
  -    SitemapManager sm = SitemapManager.getInstance();
  -    sm.beginRegistration (this);
  +    /* SitemapManager sm = SitemapManager.getInstance(); */
  +    /* sm.beginRegistration (this); */
       <xsl:for-each select="/map:sitemap/map:pipelines//map:mount">  
  -      sitemap_<xsl:value-of select="position()"/> = sm.registerSitemap (this, "<xsl:value-of
select="@src"/>");
  -      sitemap_<xsl:value-of select="position()"/>.setConfiguration (null);
  +      /* sitemap_<xsl:value-of select="translate(./@uri-prefix, '- /{}', '___')"/>
= sm.registerSitemap (this, "<xsl:value-of select="@src"/>"); */
  +      sitemap_<xsl:value-of select="translate(./@uri-prefix, '- /{}', '___')"/>.setConfiguration
(null);
       </xsl:for-each>
  -    sm.endRegistration (this);
  +    /* sm.endRegistration (this); */
       }
   
       <xsl:for-each select="/map:sitemap/map:resources/map:resource">
         private boolean resource_<xsl:value-of select="translate(@name, '- ', '__')"/>
(ResourcePipeline pipeline, 
  -          Stack mapStack, Request req, Response res, OutputStream out) 
  +          Stack mapStack, Request request, Response response, OutputStream out) 
         throws SAXException, IOException, ProcessingException { 
           Map map = null;
           Parameters param = null; 
  @@ -232,7 +267,26 @@
           <xsl:with-param name="required">true</xsl:with-param>
         </xsl:call-template>
       </xsl:variable>
  -    if ((map = matcher_<xsl:value-of select="translate($matcher-type, '- ', '__')"/>.match
("<xsl:value-of select="$pattern-value"/>", request)) != null) {
  +    <xsl:variable name="matcher-name1" select="translate(@pattern,'/- *?@:{}()[].#^\\$|&#33;','_')"/>
  +    <xsl:variable name="matcher-name2" select='translate($matcher-name1,"&#39;","")'/>
  +    <xsl:variable name="matcher-name">
  +      <xsl:for-each select="/map:sitemap/map:components/map:matchers/map:matcher[@name=$matcher-type]">
  +        <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 ((map = <xsl:value-of select="$matcher-name"/> ("<xsl:value-of select="$pattern-value"/>",
request)) != null) {
          mapStack.push (map);  
          <xsl:apply-templates/>
       }
  @@ -252,7 +306,26 @@
             <xsl:with-param name="required">true</xsl:with-param>
           </xsl:call-template>
         </xsl:variable>
  -      if (selector_<xsl:value-of select="translate($selector-type, '- ', '__')"/>.select
("<xsl:value-of select="$test-value"/>", request)) {
  +      <xsl:variable name="selector-name1" select="translate($test-value,'/- *?@:{}()[].#^\\$|&#33;','_')"/>
  +      <xsl:variable name="selector-name2" select='translate($selector-name1,"&#39;","")'/>
  +      <xsl:variable name="selector-name">
  +        <xsl:for-each select="/map:sitemap/map:components/map:selectors/map:selector[@name=$selector-type]">
  +          <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"/>",
request)) {
          <xsl:apply-templates/>
         }
       </xsl:for-each>
  @@ -289,23 +362,22 @@
       return pipeline.process (request, response, 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 reader_<xsl:value-of select="translate(./@name, '- ', '__')"/>.process
(request, response, out);
  +  </xsl:template> <!-- match="map:read" --> 
  +
     <xsl:template match="map:mount">
       <xsl:variable name="src" select="@src"/>
  -    <xsl:variable name="pos">
  -      <xsl:for-each select="/map:sitemap/map:pipelines//map:mount">
  -        <xsl:if test="@src=$src">
  -          <xsl:value-of select="position()"/>
  -        </xsl:if>
  -      </xsl:for-each>
  -    </xsl:variable>
  +    <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);
     </xsl:template> <!-- match="map:mount" -->
   
  -  <xsl:template match="map:read">
  -    return read (request, response, out, 
  -      "<xsl:value-of select="@src"/>"<xsl:if test="(@mime-type)">, "<xsl:value-of
select="@mime-type"/>"</xsl:if>);
  -  </xsl:template> <!-- match="map:read" -->
  -
     <xsl:template match="map:redirect-to">
       <xsl:choose>
         <xsl:when test="@resource">
  @@ -402,7 +474,7 @@
         </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:value-of select="namespace-uri(.)"/>");

  +        confBuilder.endPrefixMapping(""); 
         </xsl:if>
       </xsl:for-each> 
     </xsl:template> 
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +3 -3      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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- HttpEnvironment.java	2000/07/18 22:59:32	1.1.2.1
  +++ HttpEnvironment.java	2000/07/19 22:19:50	1.1.2.2
  @@ -34,10 +34,10 @@
        * and HttpServletResponse objects
        */
       public HttpEnvironment (HttpServletRequest req, HttpServletResponse res) {
  -        this.req = new HttpRequest (req);
  -        this.res = new HttpResponse (res);
  -        this.uri = this.req.getRequestURI(true);
  +        this.uri = req.getRequestURI();
           this.view = req.getHeader("cocoon-view");
  +        this.req = new HttpRequest (req, this);
  +        this.res = new HttpResponse (res);
       }
       /**
        * Adds an prefix to the overall stripped off prefix from the request uri
  
  
  
  1.1.2.2   +7 -8      xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpRequest.java
  
  Index: HttpRequest.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpRequest.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- HttpRequest.java	2000/07/18 22:59:33	1.1.2.1
  +++ HttpRequest.java	2000/07/19 22:19:51	1.1.2.2
  @@ -31,16 +31,16 @@
       /** The real HttpServletRequest object */
       private HttpServletRequest req = null;
   
  +    /** The HttpEnvironment object */
  +    private HttpEnvironment env = null;
  +
       /**
        * Creates a HttpServletRequest based on a real HttpServletRequest object
        */
  -    protected HttpRequest (HttpServletRequest req) {
  +    protected HttpRequest (HttpServletRequest req, HttpEnvironment env) {
           super ();
           this.req = req;
  -    }
  -
  -    protected String getRequestURI(boolean dummy) {
  -        return this.req.getRequestURI();
  +        this.env = env;
       }
   
       /* The HttpServletRequest interface methods */
  @@ -109,9 +109,8 @@
           return this.req.getRequestedSessionId();
       }
   
  -    public String getRequestURI() throws IllegalStateException {
  -        throw new IllegalStateException ("you must call the getUri() from the Environment");
  -        //return this.req.getRequestURI();
  +    public String getRequestURI() {
  +        return this.env.getUri();
       }
   
       public String getServletPath() {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +36 -4     xml-cocoon/src/org/apache/cocoon/matching/Attic/BrowserMatcherFactory.java
  
  Index: BrowserMatcherFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/BrowserMatcherFactory.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- BrowserMatcherFactory.java	2000/07/18 22:56:19	1.1.2.4
  +++ BrowserMatcherFactory.java	2000/07/19 22:19:53	1.1.2.5
  @@ -10,19 +10,51 @@
   import java.util.Stack;
   
   import org.w3c.dom.DocumentFragment;
  +import org.w3c.dom.Node;
  +import org.w3c.dom.NamedNodeMap;
  +import org.w3c.dom.traversal.TreeWalker;
  +import org.w3c.dom.traversal.NodeFilter;
  +
  +import org.apache.xerces.dom.TreeWalkerImpl;
    
   /** 
    * This class generates source code which matches a specific browser pattern
    * for request URIs
    * 
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a> 
  - * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/07/18 22:56:19 $ 
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/07/19 22:19:53 $ 
    */ 
   
   public class BrowserMatcherFactory implements MatcherFactory {
  -    public String generate (String test_expression, DocumentFragment conf) {
  +    public String generateMethodLevel (String prefix, String test_expression, DocumentFragment
conf) throws Exception {
           StringBuffer sb = new StringBuffer();
  -        sb.append("return null;");
  -        return (sb.toString());
  +        TreeWalker tw = new TreeWalkerImpl (conf, NodeFilter.SHOW_ALL, null, false);
  +        Node node = null;
  +        Node nodea = null;
  +        NamedNodeMap nm = null;
  +
  +        sb.append ("/*\n");
  +        while ((node = tw.nextNode()) != null) {
  +            sb.append("name=")
  +              .append(node.getNodeName())
  +              .append(" type=")
  +              .append(node.getNodeType())
  +              .append(" value="+node.getNodeValue()+"\n");
  +            nm = node.getAttributes();
  +            if (nm != null) {
  +                int i = nm.getLength();
  +                for (int j = 0; j < i; j++) {
  +                    nodea = nm.item(j);
  +                    sb.append("name="+nodea.getNodeName())
  +                      .append(" type="+nodea.getNodeType())
  +                      .append(" value="+nodea.getNodeValue()+"\n");
  +                }
  +            }
  +        }
  +        return sb.append("*/\nreturn null;").toString();
  +    }
  +
  +    public String generateClassLevel (String prefix, String pattern, DocumentFragment conf)
throws Exception {
  +        return "";
       }
   }
  
  
  
  1.1.2.3   +3 -2      xml-cocoon/src/org/apache/cocoon/matching/Attic/MatcherFactory.java
  
  Index: MatcherFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/matching/Attic/MatcherFactory.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- MatcherFactory.java	2000/07/17 21:06:11	1.1.2.2
  +++ MatcherFactory.java	2000/07/19 22:19:53	1.1.2.3
  @@ -18,9 +18,10 @@
    * sitemap code generation.
    * 
    * @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/19 22:19:53 $ 
    */ 
   
   public interface MatcherFactory {
  -    public String generate (String pattern, DocumentFragment conf) throws Exception;
  +    public String generateClassLevel (String prefix, String pattern, DocumentFragment conf)
throws Exception;
  +    public String generateMethodLevel (String prefix, String pattern, DocumentFragment
conf) throws Exception;
   }
  
  
  
  1.1.2.3   +27 -15    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.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- WildcardURIMatcherFactory.java	2000/07/17 21:06:12	1.1.2.2
  +++ WildcardURIMatcherFactory.java	2000/07/19 22:19:55	1.1.2.3
  @@ -17,7 +17,7 @@
    * for request URIs
    * 
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a> 
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/07/17 21:06:12 $ 
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/19 22:19:55 $ 
    */ 
   
   public class WildcardURIMatcherFactory /*extends PatternTranslator*/ implements MatcherFactory
{
  @@ -33,29 +33,40 @@
       protected int[] sourcePattern=null;
   
       /**
  -     * Generates the matcher method source code
  +     * Generates the matcher method level source code
        */
  -    public String generate (String pattern, DocumentFragment conf) 
  +    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(), ")
  +                     .append(prefix).append("_expr))")
  +                     .append ("return (Map) stack;")
  +                     .append ("else return null;").toString();
  +    }
  +
  +    /**
  +     * Generates the matcher class level source code
  +     */
  +    public String generateClassLevel (String prefix, String pattern, DocumentFragment conf)

  +    throws PatternException {
  +        StringBuffer result = new StringBuffer();
           this.setPattern (pattern);
      
  -        result.append ("Stack stack = new Stack();");
  -        result.append ("/* pattern=\""+pattern+"\" */");
  -        result.append ("int expr[] = {");
  +        result.append ("/* pattern=\""+pattern+"\" */")
  +              .append ("int expr[] = {");
   
           int j = sourcePattern.length-1;
           char c;
           for (int i = 0; i < j; i++) {
  -            result.append (sourcePattern[i]);
  -            result.append (',');
  +            result.append (sourcePattern[i])
  +                  .append (',');
           }
  -        result.append (sourcePattern[j]);
  -        result.append ("};");
  -        result.append ("if (org.apache.cocoon.matching.helpers.WildcardURIMatcher.match
(stack, request.getUri(), expr))");
  -        result.append ("return (Map) stack;");
  -        result.append ("else return null;");
  -        return result.toString();
  +        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();
       }
   
       /**
  @@ -142,7 +153,8 @@
               if (argv.length<1) return;
               System.out.println("Matching Expr.    \""+argv[0]+"\"");
               WildcardURIMatcherFactory wm = new WildcardURIMatcherFactory();
  -            System.out.println(wm.generate (argv[0], null));
  +            System.out.println(wm.generateClassLevel ("", argv[0], null));
  +            System.out.println(wm.generateMethodLevel ("", argv[0], null));
           } catch (Exception e) {
               System.out.println(e.getClass().getName());
               System.out.println(e.getMessage());
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +74 -0     xml-cocoon/src/org/apache/cocoon/matching/Attic/RegexpURIMatcherFactory.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.3   +7 -2      xml-cocoon/src/org/apache/cocoon/selection/Attic/BrowserSelectorFactory.java
  
  Index: BrowserSelectorFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/selection/Attic/BrowserSelectorFactory.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- BrowserSelectorFactory.java	2000/07/17 21:06:12	1.1.2.2
  +++ BrowserSelectorFactory.java	2000/07/19 22:19:57	1.1.2.3
  @@ -14,11 +14,16 @@
    * agains the requesting user-agent
    * 
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a> 
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/07/17 21:06:12 $ 
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/19 22:19:57 $ 
    */ 
   
   public class BrowserSelectorFactory implements SelectorFactory {
  -    public String generate (String test_expression, DocumentFragment conf) {
  +
  +    public String generateClassLevel (String test, String prefix, DocumentFragment conf)
throws Exception {
  +        return "";
  +    }
  +
  +    public String generateMethodLevel (String test, String prefix, DocumentFragment conf)
throws Exception {
           return "return true;";
       }
   }
  
  
  
  1.1.2.3   +3 -2      xml-cocoon/src/org/apache/cocoon/selection/Attic/SelectorFactory.java
  
  Index: SelectorFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/selection/Attic/SelectorFactory.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- SelectorFactory.java	2000/07/17 21:06:13	1.1.2.2
  +++ SelectorFactory.java	2000/07/19 22:19:58	1.1.2.3
  @@ -18,9 +18,10 @@
    * sitemap code generation.
    * 
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a> 
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/07/17 21:06:13 $ 
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/19 22:19:58 $ 
    */ 
   
   public interface SelectorFactory {
  -    public String generate (String test, DocumentFragment conf) throws Exception;
  +    public String generateClassLevel (String test, String prefix, DocumentFragment conf)
throws Exception;
  +    public String generateMethodLevel (String test, String prefix, DocumentFragment conf)
throws Exception;
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +23 -5     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.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- XSLTMatcherFactoryLoader.java	2000/07/17 21:06:14	1.1.2.3
  +++ XSLTMatcherFactoryLoader.java	2000/07/19 22:20:00	1.1.2.4
  @@ -7,6 +7,8 @@
    *****************************************************************************/ 
   package org.apache.cocoon.sitemap; 
   
  +import java.util.Hashtable;
  +
   import org.apache.cocoon.matching.MatcherFactory;
   
   import org.w3c.dom.DocumentFragment;
  @@ -17,15 +19,31 @@
    * generated source code.
    * 
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a> 
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/17 21:06:14 $ 
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/07/19 22:20:00 $ 
    */ 
   
   public class XSLTMatcherFactoryLoader {
  +
  +    Hashtable obj = new Hashtable ();
   
  -    public String getSource (String matcherFactoryClassname, String pattern, DocumentFragment
conf) 
  +    public String getSource (String level, String matcherFactoryClassname, String pattern,

  +        String prefix, DocumentFragment conf) 
       throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception
{
  -        Class cl = this.getClass().getClassLoader().loadClass(matcherFactoryClassname);
  -        MatcherFactory factory = (MatcherFactory) cl.newInstance();
  -        return factory.generate (pattern, conf);
  +        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 {
  +            return factory.generateMethodLevel (pattern, prefix, conf);
  +        } 
       }
   }
  
  
  
  1.1.2.3   +23 -5     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.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- XSLTSelectorFactoryLoader.java	2000/07/17 21:06:14	1.1.2.2
  +++ XSLTSelectorFactoryLoader.java	2000/07/19 22:20:00	1.1.2.3
  @@ -7,6 +7,8 @@
    *****************************************************************************/ 
   package org.apache.cocoon.sitemap; 
   
  +import java.util.Hashtable;
  +
   import org.apache.cocoon.selection.SelectorFactory;
   
   import org.w3c.dom.DocumentFragment;
  @@ -17,15 +19,31 @@
    * generated source code.
    * 
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a> 
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/07/17 21:06:14 $ 
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/19 22:20:00 $ 
    */ 
   
   public class XSLTSelectorFactoryLoader {
  +
  +    Hashtable obj = new Hashtable ();
   
  -    public String getSource (String selectorFactoryClassname, String test, DocumentFragment
conf) 
  +    public String getSource (String level, String selectorFactoryClassname, String test,

  +            String prefix, DocumentFragment conf) 
       throws ClassNotFoundException, InstantiationException, IllegalAccessException, Exception
{
  -        Class cl = this.getClass().getClassLoader().loadClass(selectorFactoryClassname);
  -        SelectorFactory factory = (SelectorFactory) cl.newInstance();
  -        return factory.generate (test, conf);
  +        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 {
  +            return factory.generateMethodLevel (test, prefix, conf);
  +        } 
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.11  +66 -49    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.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- sitemap-working-draft.xmap	2000/07/17 21:06:15	1.1.2.10
  +++ sitemap-working-draft.xmap	2000/07/19 22:20:02	1.1.2.11
  @@ -133,7 +133,7 @@
     <map:generators default="parser">
      <map:generator name="parser" src="class:///org.apache.cocoon.generation.FileGenerator"
label="content"/>
      <map:generator name="dir"    src="file:///home/mystuff/java/MyDirGenerator.class"
    label="content"/>
  -   <map:generator name="xsp"    src="class:///org.apache.cocoon.generation.XSPGenerator"
label="content">
  +   <map:generator name="serverpages"    src="class:///org.apache.cocoon.generation.XSPGenerator"
label="content">
       ...
      </map:generator>
     </map:generators>
  @@ -149,11 +149,19 @@
      <map:transformer name="schema" src="class:///org.apache.cocoon.transformation.SchemaLoader"/>
      <map:transformer name="rdf" src="class:///org.apache.cocoon.transformation.RDFizer"/>
     </map:transformers>
  -
  -   <!-- 
  -       Serializers serialize SAX events in binary or char streams for 
  -       final client consumption.
  -   -->
  + 
  +   <!--  
  +       Readers generate and serialize directly from a resource in binary or char streams
for  
  +       final client consumption. 
  +   --> 
  +  <map:readers default="binary"> 
  +   <map:reader name="binary" src="class:///org.apache.cocoon.reading.BinaryReader"/>

  +  </map:readers> 
  + 
  +   <!--  
  +       Serializers serialize SAX events in binary or char streams for  
  +       final client consumption. 
  +   --> 
     <map:serializers default="html">
      <map:serializer name="html" mime-type="text/html" src="class:///org.apache.cocoon.serialization.HTMLSerializer">
       <doctype-public map:value="-//W3C//DTD HTML 4.0 Transitional//EN"/>
  @@ -209,9 +217,13 @@
       ...
      </map:selector>
   
  -   <map:selector name="user" src="class:///org.apache.cocoon.selection.AuthenticationSelector">
  -    ...
  -   </map:selector>
  +   <map:selector name="user" src="class:///org.apache.cocoon.selection.AuthenticationSelector">
  +    ...
  +   </map:selector>
  +
  +   <map:selector name="ip-filter" src="class:///org.apache.cocoon.selection.IPFilterSelector">
  +    ...
  +   </map:selector>
   
      <map:selector name="browser" factory="org.apache.cocoon.selection.BrowserSelectorFactory">
       ...
  @@ -225,15 +237,15 @@
          depending on the matcher own logic (this is up to the matcher implementation).
      -->
     <map:matchers default="uri-wildcard">
  -   <map:matcher name="uri-wildcard" factory="org.apache.cocoon.matching.WildcardURIMatcherFactory">
  +   <map:matcher name="uri-wildcard" src="org.apache.cocoon.matching.WildcardURIMatcherFactory">
       ...
      </map:matcher>
   
  -   <map:matcher name="uri-regexp" src="class:///org.apache.cocoon.matching.RegexpURIMatcher">
  +   <map:matcher name="uri-regexp" factory="org.apache.cocoon.matching.RegexpURIMatcherFactory">
       ...
      </map:matcher>
   
  -   <map:matcher name="browser" factory="org.apache.cocoon.matching.BrowserMatcherFactory">
  +   <map:matcher name="browser" src="org.apache.cocoon.matching.BrowserMatcher">
       <foo value="bar">baz</foo>
       <lines>
        <left>red</left>
  @@ -320,42 +332,46 @@
     </map:resource>
       
    </map:resources>
  -
  -<!-- =========================== Pipelines ================================= -->

  -
  + 
  +<!-- =========================== Pipelines ================================= -->
 
  + 
    <map:pipelines>
  -  <map:pipeline>
  -  
  -   <!-- 
  -       Mount points allow sitemaps to be cascaded and site management 
  -       workload to be parallelized.
  -     -->
  -   <map:match pattern="cocoon/*">
  -    <map:mount src="cvs:pserver:anonymous@xml.apache.org://home/cvs/cocoon/xdocs/{1}"/>
  -   </map:match>
  -  
  -   <map:match pattern="bugs/*">
  -    <map:mount src="jar://apps/bugs.cocoon#{1}"/>
  -   </map:match>
  -  
  -   <map:match pattern="dist/*">
  -    <map:mount src="./dist/{1}"/>
  -   </map:match>
  -  
  -   <map:match pattern="faq/*">
  -    <map:mount src="jar://apps/faq-o-matic.cocoon#{1}"/>
  -   </map:match>
  -  
  -   <map:match type="uri-regexp" pattern="^/xerces-(j|c|p)/(.*)$">
  -    <map:mount src="cvs:pserver:anonymous@xml.apache.org://home/cvs/xerces-{1}/xdocs/{2}"/>
  -   </map:match>
  -   
  -   <map:handle-errors>
  -    <map:serialize type="xml"/>  
  -   </map:handle-errors>
  +  <map:pipeline> 
  +   
  +   <!--  
  +       Mount points allow sitemaps to be cascaded and site management  
  +       workload to be parallelized. 
  +     --> 
  +   <map:match pattern="cocoon/*"> 
  +    <map:mount uri-prefix="cocoon/{1}" check-reload="yes"
  +      src="cvs:pserver:anonymous@xml.apache.org://home/cvs/cocoon/xdocs/{1}"/> 
  +   </map:match> 
  +   
  +   <map:match pattern="bugs/*"> 
  +    <map:mount uri-prefix="bugs/{1}" check-reload="true"
  +      src="jar://apps/bugs.cocoon#{1}"/> 
  +   </map:match> 
  +   
  +   <map:match pattern="dist/*"> 
  +    <map:mount uri-prefix="dist/{1}" check-reload="false"  src="./dist/{1}"/> 
  +   </map:match> 
  +   
  +   <map:match pattern="faq/*"> 
  +    <map:mount uri-prefix="faq/{1}" check-reload="no" 
  +      src="jar://apps/faq-o-matic.cocoon#{1}"/> 
  +   </map:match> 
  +   
  +   <map:match type="uri-regexp" pattern="^/xerces-(j|c|p)/(.*)$"> 
  +    <map:mount uri-prefix="/xerces-{1}/{2}" 
  +      src="cvs:pserver:anonymous@xml.apache.org://home/cvs/xerces-{1}/xdocs/{2}"/> 
  +   </map:match> 
  +    
  +   <map:handle-errors> 
  +    <map:serialize type="xml"/>   
  +   </map:handle-errors> 
  +    
  +  </map:pipeline> 
      
  -  </map:pipeline>
  -  
     <map:pipeline>
    
      <!-- 
  @@ -444,8 +460,9 @@
          to the pattern tokens generated by the matchers.
        -->
      <map:match pattern="nested-matchers/*">
  -    <map:match type="browser" pattern="name('Mozilla ?\?*')">
  -     <map:mount src="file:///home/www/mozilla-{1}-{2}/{../1}"/>
  +    <map:match type="browser" pattern="name('Mozilla ?\\?*')">
  +     <map:mount uri-prefix="nested-matchers/{1}"
  +       src="file:///home/www/mozilla-{1}-{2}/{../1}"/>
       </map:match>
      </map:match>
     
  @@ -502,7 +519,7 @@
     
     </map:pipeline>
    </map:pipelines>
  -
  +    
   </map:sitemap>
   
   <!-- end of file -->
  
  
  

Mime
View raw message