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/producers FileProducer.java
Date Sat, 12 Feb 2000 00:33:01 GMT
pier        00/02/11 16:33:01

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2-alpha0 Cocoon.java
               src/org/apache/cocoon/dom Tag: xml-cocoon2-alpha0
                        TreeGenerator.java
               src/org/apache/cocoon/producers Tag: xml-cocoon2-alpha0
                        FileProducer.java
  Added:       src/org/apache/cocoon/parsers Tag: xml-cocoon2-alpha0
                        Parser.java XercesParser.java
  Removed:     src/org/apache/cocoon/parsers Tag: xml-cocoon2-alpha0
                        ParserFactory.java XercesFactory.java
  Log:
  Renamed ParserFactory to Parser, and all its related classes.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.11.2.3  +22 -22    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.2
  retrieving revision 1.11.2.3
  diff -u -r1.11.2.2 -r1.11.2.3
  --- Cocoon.java	2000/02/11 13:14:41	1.11.2.2
  +++ Cocoon.java	2000/02/12 00:32:58	1.11.2.3
  @@ -15,7 +15,7 @@
   import org.apache.cocoon.framework.Configurations;
   import org.apache.cocoon.framework.ConfigurationException;
   import org.apache.cocoon.framework.Modificable;
  -import org.apache.cocoon.parsers.ParserFactory;
  +import org.apache.cocoon.parsers.Parser;
   import org.apache.cocoon.dom.DocumentFactory;
   import org.apache.cocoon.dom.TreeGenerator;
   import org.apache.cocoon.producers.Producer;
  @@ -50,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.2 $ $Date: 2000/02/11 13:14:41 $
  + * @version CVS $Revision: 1.11.2.3 $ $Date: 2000/02/12 00:32:58 $
    * @since Cocoon 2.0
    */
   public class Cocoon implements Configurable, Modificable {
  @@ -60,8 +60,8 @@
       private Configurations configurations=null;
       /** The current DocumentFactory */
       private DocumentFactory documentFactory=null;
  -    /** The current ParserFactory */
  -    private ParserFactory parserFactory=null;
  +    /** The current Parser */
  +    private Parser parser=null;
       /** The ProducerFactory table */
       private Hashtable producers=null;
       /** The FilterFactory table */
  @@ -99,12 +99,12 @@
        *       XML configuration file <i>(default=no default)</i>.
        *   <li><b>rootPath</b> <i>(string)</i> The root path
for Cocoon operation
        *       <i>(default=directory or configurationFile)</i>.
  -     *   <li><b>defaultParserFactory</b> <i>(string)</i>
The full class name
  -     *       of the default ParserFactory.
  -     *      <i>(default=org.apache.cocoon.parsers.XercesFactory)</i>.
  +     *   <li><b>defaultParser</b> <i>(string)</i> The full
class name
  +     *       of the default Parser.
  +     *      <i>(default=org.apache.cocoon.parsers.XercesParser)</i>.
        *   <li><b>defaultDocumentFactory</b> <i>(string)</i>
The full class name
        *       of the default DocumentFactory.
  -     *      <i>(default=org.apache.cocoon.parsers.XercesFactory)</i>.
  +     *      <i>(default=org.apache.cocoon.parsers.XercesParser)</i>.
        * </ul>
        * Those and all other specified parameters are merged with those specified
        * at root level in the configuration file and passed to all factories.
  @@ -131,9 +131,9 @@
               conf.setParameter("rootPath",this.configurationFile.getParent());
   
           //////////////////////////////////////////////////////////////////////
  -        // Check if the defaultParserFactory parameter was specified
  +        // Check if the defaultParser parameter was specified
           String d=conf.getParameter("defaultDocumentFactory",
  -                                   "org.apache.cocoon.parsers.XercesFactory");
  +                                   "org.apache.cocoon.parsers.XercesParser");
           try {
               this.documentFactory=(DocumentFactory)this.getClassInstance(d);
           } catch (ClassCastException e) {
  @@ -142,21 +142,21 @@
           }
   
           //////////////////////////////////////////////////////////////////////
  -        // Check if the defaultParserFactory property was specified
  -        String p=conf.getParameter("defaultParserFactory",
  -                                   "org.apache.cocoon.parsers.XercesFactory");
  +        // Check if the defaultParser property was specified
  +        String p=conf.getParameter("defaultParser",
  +                                   "org.apache.cocoon.parsers.XercesParser");
           try {
  -            this.parserFactory=(ParserFactory)this.getClassInstance(p);
  +            this.parser=(Parser)this.getClassInstance(p);
           } catch (ClassCastException e) {
               throw this.newException("Class '"+p+"' doesn't implement "+
  -                                    "'org.apache.cocoon.parser.ParserFactory'");
  +                                    "'org.apache.cocoon.parser.Parser'");
           }
   
           //////////////////////////////////////////////////////////////////////
           // Load configuration file
           TreeGenerator tg=new TreeGenerator(this.documentFactory);
           try {
  -            this.parserFactory.getXMLProducer(new InputSource(c)).produce(tg);
  +            this.parser.getXMLProducer(new InputSource(c)).produce(tg);
           } catch (IOException e) {
               throw this.newException("IOException catched parsing '"+c+"'", e);
           } catch (SAXException e) {
  @@ -201,10 +201,10 @@
       }
   
       /**
  -     * Get the configured ParserFactory.
  +     * Get the configured Parser.
        */
  -    public ParserFactory getParserFactory() {
  -        return(this.parserFactory);
  +    public Parser getParser() {
  +        return(this.parser);
       }
   
       /**
  @@ -332,11 +332,11 @@
   
               ///////////////////////////////////////////////////////////////////
               // Check if we were specified to instantiate a parser factory
  -            } else if (type.equals("parserFactory")) try {
  -                this.parserFactory=(ParserFactory)instance;
  +            } else if (type.equals("parser")) try {
  +                this.parser=(Parser)instance;
               } catch (ClassCastException ex) {
                   throw this.newException("Factory '"+f+"' does not implement "+
  -                                  "'org.apache.cocoon.parsers.ParserFactory'");
  +                                  "'org.apache.cocoon.parsers.Parser'");
   
               ///////////////////////////////////////////////////////////////////
               // Check if we were specified to instantiate a document factory
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +3 -1      xml-cocoon/src/org/apache/cocoon/dom/Attic/TreeGenerator.java
  
  Index: TreeGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/dom/Attic/TreeGenerator.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- TreeGenerator.java	2000/02/10 13:13:16	1.1.2.3
  +++ TreeGenerator.java	2000/02/12 00:32:58	1.1.2.4
  @@ -24,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.3 $ $Date: 2000/02/10 13:13:16 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/02/12 00:32:58 $
    */
   public class TreeGenerator implements XMLConsumer {
       /** The document was not started */
  @@ -172,6 +172,8 @@
           this.name=null;
           // Do a state change and reset the DTD flag
           state=S_AVAIL;
  +        // Notify the listener
  +        if (this.listener!=null) this.listener.notify(this.document);
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +24 -0     xml-cocoon/src/org/apache/cocoon/parsers/Attic/Parser.java
  
  
  
  
  1.1.2.1   +203 -0    xml-cocoon/src/org/apache/cocoon/parsers/Attic/XercesParser.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +10 -14    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.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- FileProducer.java	2000/02/11 13:14:43	1.1.2.4
  +++ FileProducer.java	2000/02/12 00:33:00	1.1.2.5
  @@ -18,7 +18,7 @@
   import org.apache.cocoon.framework.AbstractComponent;
   import org.apache.cocoon.framework.Configurations;
   import org.apache.cocoon.framework.ConfigurationException;
  -import org.apache.cocoon.parsers.ParserFactory;
  +import org.apache.cocoon.parsers.Parser;
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
   
  @@ -29,12 +29,12 @@
    *         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.4 $ $Date: 2000/02/11 13:14:43 $
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/02/12 00:33:00 $
    * @since Cocoon 2.0
    */
   public class FileProducer extends AbstractComponent implements Producer {
  -    /** The current parserFactory instance */
  -    private ParserFactory parserFactory=null;
  +    /** The current Parser instance */
  +    private Parser parser=null;
   
       /**
        * Return an <code>XMLSource</code> instance producing XML data from a
  @@ -44,7 +44,11 @@
        * @param res The cocoon <code>Response</code>.
        */
       public XMLSource getXMLSource(Request req, Response res) {
  -        return(Source.create(this.parserFactory,req.getPathTranslated()));
  +        Source s=new Source();
  +        String source=req.getPathTranslated();
  +        s.producer=parser.getXMLProducer(new InputSource(source));
  +        s.file=new File(source);
  +        return(s);
       }
   
       /**
  @@ -57,7 +61,7 @@
           if (cocoon==null)
               throw new ConfigurationException("Cannot access current 'Cocoon'"+
                                                "instance",this.getClass());
  -        this.parserFactory=cocoon.getParserFactory();
  +        this.parser=cocoon.getParser();
       }
       
       /** The XMLSource implementation for this producer */
  @@ -66,14 +70,6 @@
           private XMLProducer producer=null;
           /** The source file */
           private File file=null;
  -
  -        /** Create this Source object */
  -        private static Source create(ParserFactory parser, String source) {
  -            Source s=new Source();
  -            s.producer=parser.getXMLProducer(new InputSource(source));
  -            s.file=new File(source);
  -            return(s);
  -        }
   
           /**
            * Produce XML data.
  
  
  

Mime
View raw message