cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon Main.java
Date Thu, 31 Aug 2000 15:59:24 GMT
stefano     00/08/31 08:59:24

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Main.java
  Log:
  closer to command line operation but not there yet
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.2   +22 -15    xml-cocoon/src/org/apache/cocoon/Attic/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Main.java,v
  retrieving revision 1.1.4.1
  retrieving revision 1.1.4.2
  diff -u -r1.1.4.1 -r1.1.4.2
  --- Main.java	2000/08/23 22:44:26	1.1.4.1
  +++ Main.java	2000/08/31 15:59:23	1.1.4.2
  @@ -28,7 +28,7 @@
    * Command line entry point.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.4.1 $ $Date: 2000/08/23 22:44:26 $
  + * @version CVS $Revision: 1.1.4.2 $ $Date: 2000/08/31 15:59:23 $
    */
   
   public class Main {
  @@ -95,8 +95,13 @@
           }
   
           try {
  -            Main main = new Main(new Cocoon(getConfigurationFile(confFile)), getDestinationDir(destDir));
  +            File dest = getDestinationDir(destDir);
  +            File conf = getConfigurationFile(confFile);
  +            File root = conf.getParentFile();
  +            Main main = new Main(new Cocoon(conf), conf, dest);
  +            System.out.println("[main] Starting...");
               main.processLinks(targets.iterator());
  +            System.out.println("[main] Done.");
           } catch (Exception e) {
               System.out.println("[fatal error] Exception caught (" + e.getClass().getName()
+ "): " + e.getMessage() + "\n");
               printUsage();
  @@ -178,37 +183,39 @@
   
       private Cocoon cocoon;
       private File destDir;
  +    private File root;
   
       /**
        * Creates the Main class
        */
  -    public Main(Cocoon cocoon, File destDir) {
  +    public Main(Cocoon cocoon, File root, File destDir) {
           this.cocoon = cocoon;
  +        this.root = root;
           this.destDir = destDir;
       }
   
       /**
  +     * Process the link list and recursively process them all.
  +     */
  +    public void processLinks(Iterator links) throws Exception {
  +        while (links.hasNext()) {
  +            String link = (String) links.next();
  +            this.processLinks(this.processLink(link));
  +        }
  +    }
  +
  +    /**
        * Process the given link and return the list of sublinks.
        */
       public Iterator processLink(String link) throws Exception {
  -System.out.println("[main] processing link: " + link);        
  +        System.out.println("[main] processing link: " + link);        
           // First process the given link and save it on disk
  -        FileSavingEnvironment fileEnv = new FileSavingEnvironment(link, destDir);
  +        FileSavingEnvironment fileEnv = new FileSavingEnvironment(link, root, destDir);
           cocoon.process(fileEnv);
           // Then process it again (with another view) to obtain the hyperlinks
           LinkSamplingEnvironment linkEnv = new LinkSamplingEnvironment(link);
           cocoon.process(linkEnv);
           return linkEnv.getLinks();
  -    }
  -
  -    /**
  -     * Process the link list and recursively process them all.
  -     */
  -    public void processLinks(Iterator links) throws Exception {
  -        while (links.hasNext()) {
  -            String link = (String) links.next();
  -            this.processLinks(this.processLink(link));
  -        }
       }
   }
   
  
  
  

Mime
View raw message