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/src/org/apache/cocoon Cocoon.java
Date Sun, 02 Jul 2000 20:59:14 GMT
giacomo     00/07/02 13:59:14

  Modified:    conf     Tag: xml-cocoon2 cocoon.xconf
               src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
  Log:
  First try on a generated SitemapProcessor
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.8   +9 -0      xml-cocoon/conf/Attic/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/conf/Attic/cocoon.xconf,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- cocoon.xconf	2000/06/06 23:11:12	1.1.2.7
  +++ cocoon.xconf	2000/07/02 20:59:11	1.1.2.8
  @@ -36,6 +36,15 @@
             </builtin-logicsheet>
           </target-language>
         </component-instance>
  +
  +      <component-instance name="sitemap" class="org.apache.cocoon.components.language.markup.xsp.SitemapMarkupLanguage">
  +        <parameter name="prefix" value="map"/>
  +        <parameter name="uri" value="http://xml.apache.org/cocoon/sitemap"/>
  +  
  +        <target-language name="java">
  +          <parameter name="core-logicsheet" value="resource://org/apache/cocoon/components/language/markup/sitemap/java/sitemap.xsl"/>
  +        </target-language>
  +      </component-instance>
       </component-type>
     </component>
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.7   +48 -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.6
  retrieving revision 1.4.2.7
  diff -u -r1.4.2.6 -r1.4.2.7
  --- Cocoon.java	2000/05/24 23:15:01	1.4.2.6
  +++ Cocoon.java	2000/07/02 20:59:13	1.4.2.7
  @@ -35,7 +35,7 @@
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
  - * @version CVS $Revision: 1.4.2.6 $ $Date: 2000/05/24 23:15:01 $
  + * @version CVS $Revision: 1.4.2.7 $ $Date: 2000/07/02 20:59:13 $
    */
   public class Cocoon
   implements Component, Configurable, ComponentManager, Modifiable, Processor,
  @@ -53,6 +53,8 @@
       private Sitemap sitemap=null;
       /** The root uri/path */
       private URL root=null;
  +        
  +    private org.apache.cocoon.sitemap.SitemapProcessor processor = null;
   
       /**
        * Create a new <code>Cocoon</code> instance.
  @@ -84,6 +86,12 @@
           p.parse(new InputSource(this.configurationFile.getPath()));
           this.setConfiguration(b.getConfiguration());
           this.root=this.configurationFile.getParentFile().toURL();
  +/*
  +        try {
  +            generateSitemap ("/opt/giacomo/java/CVS/xml-cocoon2/test/xdocs/drafts/sitemap.xmap");

  +        } catch (org.apache.cocoon.ProcessingException pe) {
  +            throw new IOException (pe.getMessage());
  +        } */
       }
   
       /**
  @@ -177,6 +185,7 @@
       public boolean process(Request req, Response res, OutputStream out)
       throws SAXException, IOException, ProcessingException {
           return(this.sitemap.process(req,res,out));
  +//        return(this.processor.process(req,res,out));
       }
   
       /**
  @@ -214,6 +223,44 @@
           } catch (ClassNotFoundException e) {
               throw new ConfigurationException("Cannot load class "+className,
                   conf);
  +        }
  +    }
  +
  +    /** Generate the Sitemap class */
  +    private void generateSitemap (String sitemapName) 
  +            throws java.net.MalformedURLException, IOException, 
  +                   org.apache.cocoon.ProcessingException {
  +
  +        InputSource inputSource = new InputSource (sitemapName);
  +        String systemId = inputSource.getSystemId();
  +        System.out.println ("C2 generateSitemap: "+systemId);
  +
  +        File file = new File(systemId);
  +
  +        if (!file.canRead()) {
  +            throw new IOException("Can't read file: " + systemId);
  +        }
  +
  +        String markupLanguage = "sitemap";
  +        String programmingLanguage = "java";
  +
  +        org.apache.cocoon.components.language.generator.ProgramGenerator programGenerator
= null;
  +
  +        System.out.println ("C2 generateSitemap: obtaining programGenerator");
  +        programGenerator = 
  +            (org.apache.cocoon.components.language.generator.ProgramGenerator) getComponent("program-generator");
  +        System.out.println ("C2 generateSitemap: programGenerator obtained");
  +
  +        System.out.println ("C2 generateSitemap: obtaining generator");
  +        try {
  +            processor = (org.apache.cocoon.sitemap.SitemapProcessor)
  +                programGenerator.load(file, markupLanguage, programmingLanguage);
  +            System.out.println ("C2 generateSitemap: generator obtained");
  +            processor.setComponentManager(this);
  +            System.out.println ("C2 generateSitemap: generator called");
  +        } catch (Exception e) {
  +            e.printStackTrace();
  +            throw new org.apache.cocoon.ProcessingException (e.getMessage());    
           }
       }
   }
  
  
  

Mime
View raw message