cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/sitemap Request.java Response.java Partition.java Processor.java Sitemap.java
Date Fri, 11 Feb 2000 13:14:52 GMT
pier        00/02/11 05:14:52

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2-alpha0 Cocoon.java
               src/org/apache/cocoon/filters Tag: xml-cocoon2-alpha0
                        Filter.java
               src/org/apache/cocoon/producers Tag: xml-cocoon2-alpha0
                        FileProducer.java Producer.java
               src/org/apache/cocoon/serializers Tag: xml-cocoon2-alpha0
                        Serializer.java SerializerFactory.java
               src/org/apache/cocoon/servlet Tag: xml-cocoon2-alpha0
                        CocoonServlet.java
               src/org/apache/cocoon/sitemap Tag: xml-cocoon2-alpha0
                        Partition.java Processor.java Sitemap.java
  Added:       src/org/apache/cocoon/servlet Tag: xml-cocoon2-alpha0
                        CocoonServletRequest.java
                        CocoonServletResponse.java
               src/org/apache/cocoon/sitemap Tag: xml-cocoon2-alpha0
                        Request.java Response.java
  Removed:     src/org/apache/cocoon Tag: xml-cocoon2-alpha0 Job.java
               src/org/apache/cocoon/servlet Tag: xml-cocoon2-alpha0
                        ServletJob.java
  Log:
  Moved all sources from the Job model to a Request-Response model, as discussed with Stefano
and Niclas.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.11.2.2  +5 -3      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.11.2.1
  retrieving revision 1.11.2.2
  diff -u -r1.11.2.1 -r1.11.2.2
  --- Cocoon.java	2000/02/07 15:35:34	1.11.2.1
  +++ Cocoon.java	2000/02/11 13:14:41	1.11.2.2
  @@ -24,6 +24,8 @@
   import org.apache.cocoon.filters.FilterFactory;
   import org.apache.cocoon.serializers.Serializer;
   import org.apache.cocoon.serializers.SerializerFactory;
  +import org.apache.cocoon.sitemap.Request;
  +import org.apache.cocoon.sitemap.Response;
   import org.apache.cocoon.sitemap.Sitemap;
   import org.apache.cocoon.sitemap.SitemapFactory;
   import org.w3c.dom.Document;
  @@ -48,7 +50,7 @@
    *         Exoffice Technologies, INC.</a>
    * @author Copyright 1999 &copy; <a href="http://www.apache.org">The Apache
    *         Software Foundation</a>. All rights reserved.
  - * @version CVS $Revision: 1.11.2.1 $ $Date: 2000/02/07 15:35:34 $
  + * @version CVS $Revision: 1.11.2.2 $ $Date: 2000/02/11 13:14:41 $
    * @since Cocoon 2.0
    */
   public class Cocoon implements Configurable, Modificable {
  @@ -241,9 +243,9 @@
           return(s);
       }
   
  -    public boolean handle(Job job, OutputStream out)
  +    public boolean handle(Request req, Response res, OutputStream out)
       throws IOException, SAXException {
  -        return(this.sitemap.handle(job,out));
  +        return(this.sitemap.handle(req,res,out));
       }
   
       /** Create a new instance for a specified class */
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +6 -5      xml-cocoon/src/org/apache/cocoon/filters/Attic/Filter.java
  
  Index: Filter.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/filters/Attic/Filter.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- Filter.java	2000/02/09 08:34:28	1.1.2.3
  +++ Filter.java	2000/02/11 13:14:42	1.1.2.4
  @@ -7,7 +7,8 @@
    *****************************************************************************/
   package org.apache.cocoon.filters;
   
  -import org.apache.cocoon.Job;
  +import org.apache.cocoon.sitemap.Request;
  +import org.apache.cocoon.sitemap.Response;
   import org.apache.cocoon.sax.XMLConsumer;
   import org.apache.cocoon.framework.Component;
   import org.apache.cocoon.framework.Configurable;
  @@ -21,7 +22,7 @@
    *         Exoffice Technologies, INC.</a>
    * @author Copyright 1999 &copy; <a href="http://www.apache.org">The Apache
    *         Software Foundation</a>. All rights reserved.
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/02/09 08:34:28 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/02/11 13:14:42 $
    * @since Cocoon 2.0
    */
   public interface Filter extends Component, Configurable, Modificable {
  @@ -30,10 +31,10 @@
        * modify them, and then forward them to the specified 
        * <code>XMLConsumer</code>.
        *
  -     * @param job The current <code>Job</code>.
  -     * @param src The sitemap-translate source URI.
  +     * @param req The cocoon <code>Request</code>.
  +     * @param res The cocoon <code>Response</code>.
        * @param cons The <code>XMLConsumer</code> listening to the modified
        *             SAX events.
        */
  -    public XMLConsumer getXMLConsumer(Job job, String src, XMLConsumer cons);
  +    public XMLConsumer getXMLConsumer(Request req, Response res, XMLConsumer cons);
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +7 -6      xml-cocoon/src/org/apache/cocoon/producers/Attic/FileProducer.java
  
  Index: FileProducer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/producers/Attic/FileProducer.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- FileProducer.java	2000/02/09 08:34:46	1.1.2.3
  +++ FileProducer.java	2000/02/11 13:14:43	1.1.2.4
  @@ -10,7 +10,8 @@
   import java.io.File;
   import java.io.IOException;
   import org.apache.cocoon.Cocoon;
  -import org.apache.cocoon.Job;
  +import org.apache.cocoon.sitemap.Request;
  +import org.apache.cocoon.sitemap.Response;
   import org.apache.cocoon.sax.XMLConsumer;
   import org.apache.cocoon.sax.XMLProducer;
   import org.apache.cocoon.sax.XMLSource;
  @@ -28,7 +29,7 @@
    *         Exoffice Technologies, INC.</a>
    * @author Copyright 1999 &copy; <a href="http://www.apache.org">The Apache
    *         Software Foundation</a>. All rights reserved.
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/02/09 08:34:46 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/02/11 13:14:43 $
    * @since Cocoon 2.0
    */
   public class FileProducer extends AbstractComponent implements Producer {
  @@ -39,11 +40,11 @@
        * Return an <code>XMLSource</code> instance producing XML data from a
        * file.
        *
  -     * @param job The current <code>Job</code>.
  -     * @param source The sitemap-translate source URI that will be parsed.
  +     * @param req The cocoon <code>Request</code>.
  +     * @param res The cocoon <code>Response</code>.
        */
  -    public XMLSource getXMLSource(Job job, String source) {
  -        return(Source.create(this.parserFactory,source));
  +    public XMLSource getXMLSource(Request req, Response res) {
  +        return(Source.create(this.parserFactory,req.getPathTranslated()));
       }
   
       /**
  
  
  
  1.1.4.4   +6 -5      xml-cocoon/src/org/apache/cocoon/producers/Attic/Producer.java
  
  Index: Producer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/producers/Attic/Producer.java,v
  retrieving revision 1.1.4.3
  retrieving revision 1.1.4.4
  diff -u -r1.1.4.3 -r1.1.4.4
  --- Producer.java	2000/02/09 08:34:46	1.1.4.3
  +++ Producer.java	2000/02/11 13:14:44	1.1.4.4
  @@ -7,7 +7,8 @@
    *****************************************************************************/
   package org.apache.cocoon.producers;
   
  -import org.apache.cocoon.Job;
  +import org.apache.cocoon.sitemap.Request;
  +import org.apache.cocoon.sitemap.Response;
   import org.apache.cocoon.sax.XMLSource;
   import org.apache.cocoon.framework.Component;
   import org.apache.cocoon.framework.Configurable;
  @@ -20,15 +21,15 @@
    *         Exoffice Technologies, INC.</a>
    * @author Copyright 1999 &copy; <a href="http://www.apache.org">The Apache
    *         Software Foundation</a>. All rights reserved.
  - * @version CVS $Revision: 1.1.4.3 $ $Date: 2000/02/09 08:34:46 $
  + * @version CVS $Revision: 1.1.4.4 $ $Date: 2000/02/11 13:14:44 $
    * @since Cocoon 2.0
    */
   public interface Producer extends Component, Configurable {
       /**
        * Get the <code>XMLSource</code> object that will produce SAX events.
        *
  -     * @param job The current <code>Job</code>.
  -     * @param source The sitemap-translate source URI.
  +     * @param req The cocoon <code>Request</code>.
  +     * @param res The cocoon <code>Response</code>.
        */
  -    public XMLSource getXMLSource(Job job, String source);
  +    public XMLSource getXMLSource(Request req, Response res);
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.3   +4 -3      xml-cocoon/src/org/apache/cocoon/serializers/Attic/Serializer.java
  
  Index: Serializer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serializers/Attic/Serializer.java,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- Serializer.java	2000/02/09 08:34:55	1.1.4.2
  +++ Serializer.java	2000/02/11 13:14:45	1.1.4.3
  @@ -9,7 +9,8 @@
   
   import java.io.IOException;
   import java.io.OutputStream;
  -import org.apache.cocoon.Job;
  +import org.apache.cocoon.sitemap.Request;
  +import org.apache.cocoon.sitemap.Response;
   import org.apache.cocoon.sax.XMLConsumer;
   import org.apache.cocoon.framework.Component;
   import org.apache.cocoon.framework.Configurable;
  @@ -21,9 +22,9 @@
    *         Exoffice Technologies, INC.</a>
    * @author Copyright 1999 &copy; <a href="http://www.apache.org">The Apache
    *         Software Foundation</a>. All rights reserved.
  - * @version CVS $Revision: 1.1.4.2 $ $Date: 2000/02/09 08:34:55 $
  + * @version CVS $Revision: 1.1.4.3 $ $Date: 2000/02/11 13:14:45 $
    */
   public interface Serializer extends Component, Configurable, Modificable {
  -    public XMLConsumer getXMLConsumer(Job job, String src, OutputStream out)
  +    public XMLConsumer getXMLConsumer(Request req, Response res, OutputStream out)
       throws IOException;
   }
  
  
  
  1.1.2.2   +4 -2      xml-cocoon/src/org/apache/cocoon/serializers/Attic/SerializerFactory.java
  
  Index: SerializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/serializers/Attic/SerializerFactory.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- SerializerFactory.java	2000/02/07 15:35:41	1.1.2.1
  +++ SerializerFactory.java	2000/02/11 13:14:46	1.1.2.2
  @@ -8,6 +8,7 @@
   package org.apache.cocoon.serializers;
   
   import org.apache.cocoon.framework.Configurable;
  +import org.apache.cocoon.framework.ConfigurationException;
   
   /**
    *
  @@ -15,8 +16,9 @@
    *         Exoffice Technologies, INC.</a>
    * @author Copyright 1999 &copy; <a href="http://www.apache.org">The Apache
    *         Software Foundation</a>. All rights reserved.
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2000/02/07 15:35:41 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/02/11 13:14:46 $
    */
   public interface SerializerFactory extends Configurable {
  -    public Serializer getSerializer();
  +    public Serializer getSerializer()
  +    throws ConfigurationException;
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +5 -3      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.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- CocoonServlet.java	2000/02/07 15:35:42	1.1.2.1
  +++ CocoonServlet.java	2000/02/11 13:14:47	1.1.2.2
  @@ -13,6 +13,7 @@
   import javax.servlet.*;
   import javax.servlet.http.*;
   import org.apache.cocoon.*;
  +import org.apache.cocoon.sitemap.*;
   import org.apache.cocoon.framework.*;
   import org.xml.sax.SAXException;
   
  @@ -22,7 +23,7 @@
    *         Exoffice Technologies, INC.</a>
    * @author Copyright 1999 &copy; <a href="http://www.apache.org">The Apache
    *         Software Foundation</a>. All rights reserved.
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2000/02/07 15:35:42 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/02/11 13:14:47 $
    * @since Cocoon 2.0
    */
   public class CocoonServlet extends HttpServlet {
  @@ -83,8 +84,9 @@
           ServletOutputStream os=res.getOutputStream();
           String uri=req.getPathInfo();
           if (uri!=null) try {
  -            Job job=new ServletJob(req,res);
  -            if (!this.cocoon.handle(job,os)) res.sendError(res.SC_NOT_FOUND);
  +            Request rq=new CocoonServletRequest(req);
  +            Response rs=new CocoonServletResponse(res);
  +            if (!this.cocoon.handle(rq,rs,os)) res.sendError(res.SC_NOT_FOUND);
           } catch (IOException e) {
               throw(e);    
           } catch (SAXException e) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +204 -0    xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServletRequest.java
  
  
  
  
  1.1.2.1   +205 -0    xml-cocoon/src/org/apache/cocoon/servlet/Attic/CocoonServletResponse.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +3 -4      xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Partition.java
  
  Index: Partition.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Partition.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- Partition.java	2000/02/07 15:35:42	1.1.2.1
  +++ Partition.java	2000/02/11 13:14:49	1.1.2.2
  @@ -9,7 +9,6 @@
   
   import java.io.IOException;
   import java.io.OutputStream;
  -import org.apache.cocoon.Job;
   import org.xml.sax.SAXException;
   
   /**
  @@ -18,7 +17,7 @@
    *         Exoffice Technologies, INC.</a>
    * @author Copyright 1999 &copy; <a href="http://www.apache.org">The Apache
    *         Software Foundation</a>. All rights reserved.
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2000/02/07 15:35:42 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/02/11 13:14:49 $
    */
   public class Partition {
       /** This Partition array of Processor. */
  @@ -39,10 +38,10 @@
           this.sitemap=smap;
       }
   
  -    public boolean handle(Job job, OutputStream out)
  +    public boolean handle(Request req, Response res, OutputStream out)
       throws IOException, SAXException {
           for(int x=0; x<processors.length; x++)
  -            if (processors[x].handle(job,out)) return(true);
  +            if (processors[x].handle(req,res,out)) return(true);
           return(false);
       }
   }
  
  
  
  1.1.2.3   +8 -9      xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Processor.java
  
  Index: Processor.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/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/09 08:35:07	1.1.2.2
  +++ Processor.java	2000/02/11 13:14:50	1.1.2.3
  @@ -10,7 +10,6 @@
   import java.io.IOException;
   import java.io.OutputStream;
   import java.io.PrintStream;
  -import org.apache.cocoon.Job;
   import org.apache.cocoon.sax.XMLConsumer;
   import org.apache.cocoon.sax.XMLSource;
   import org.apache.cocoon.framework.ConfigurationException;
  @@ -25,7 +24,7 @@
    *         Exoffice Technologies, INC.</a>
    * @author Copyright 1999 &copy; <a href="http://www.apache.org">The Apache
    *         Software Foundation</a>. All rights reserved.
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/02/09 08:35:07 $
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/02/11 13:14:50 $
    */
   public class Processor {
       /** The int representing '*' */
  @@ -80,18 +79,18 @@
       }
   
       /**
  -     * Handle a given Job.
  +     * Handle a given Request.
        */
  -    public boolean handle(Job job, OutputStream out)
  +    public boolean handle(Request req, Response res, OutputStream out)
       throws IOException, SAXException {
  -        String uri=job.getUri();
  +        String uri=req.getPathInfo();
           if(!this.matchTarget(uri)) return(false);
  -        String source=this.translateTarget(uri);
  -        XMLConsumer consumer=this.serializer.getXMLConsumer(job,source,out);
  +        req.setPathTranslated(this.translateTarget(uri));
  +        XMLConsumer consumer=this.serializer.getXMLConsumer(req,res,out);
           for (int x=0; x<this.filters.length; x++) {
  -            consumer=this.filters[x].getXMLConsumer(job,source,consumer);
  +            consumer=this.filters[x].getXMLConsumer(req,res,consumer);
           }
  -        this.producer.getXMLSource(job,source).produce(consumer);
  +        this.producer.getXMLSource(req,res).produce(consumer);
           return(true);
       }
   
  
  
  
  1.1.2.2   +10 -8     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.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- Sitemap.java	2000/02/07 15:35:43	1.1.2.1
  +++ Sitemap.java	2000/02/11 13:14:50	1.1.2.2
  @@ -11,7 +11,6 @@
   import java.io.OutputStream;
   import java.util.Enumeration;
   import java.util.Hashtable;
  -import org.apache.cocoon.Job;
   import org.xml.sax.SAXException;
   
   /**
  @@ -20,7 +19,7 @@
    *         Exoffice Technologies, INC.</a>
    * @author Copyright 1999 &copy; <a href="http://www.apache.org">The Apache
    *         Software Foundation</a>. All rights reserved.
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2000/02/07 15:35:43 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/02/11 13:14:50 $
    */
   public class Sitemap {
       /** This sitemap Partition table */
  @@ -33,14 +32,17 @@
           this.partitions=new Hashtable();
       }
       
  -    public boolean handle(Job job, OutputStream out)
  +    public boolean handle(Request req, Response res, OutputStream out)
       throws IOException, SAXException {
  -        // Try to handle the job to the default partition.
  -        if(this.defaultPartition.handle(job,out)) return(true);
  -        // Iterate thru all partitions handling the job
  +        // Try to handle the request to the default partition.
  +        if(this.defaultPartition.handle(req,res,out)) return(true);
  +        // Iterate thru all partitions handling the request
           Enumeration enum=this.partitions.elements();
  -        while(enum.hasMoreElements())
  -            if (((Partition)enum.nextElement()).handle(job,out)) return(true);
  +        while(enum.hasMoreElements()) {
  +            if (((Partition)enum.nextElement()).handle(req,res,out)) {
  +                return(true);
  +            }
  +        }
           return(false);
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +83 -0     xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Request.java
  
  
  
  
  1.1.2.1   +39 -0     xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Response.java
  
  
  
  

Mime
View raw message