You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@locus.apache.org on 2000/09/22 14:21:16 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon Cocoon.java Constants.java Main.java

stefano     00/09/22 05:21:14

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
                        Constants.java Main.java
  Log:
  several bug fixes and cleanups
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.27  +22 -18    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.26
  retrieving revision 1.4.2.27
  diff -u -r1.4.2.26 -r1.4.2.27
  --- Cocoon.java	2000/09/19 00:27:51	1.4.2.26
  +++ Cocoon.java	2000/09/22 12:21:03	1.4.2.27
  @@ -41,7 +41,7 @@
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.4.2.26 $ $Date: 2000/09/19 00:27:51 $
  + * @version CVS $Revision: 1.4.2.27 $ $Date: 2000/09/22 12:21:03 $
    */
   public class Cocoon
     implements Component, Configurable, ComponentManager, Modifiable, Processor, Constants {
  @@ -53,22 +53,25 @@
       private HashMap configurations = new HashMap();
       
       /** The configuration file */ 
  -    private File configurationFile = null; 
  +    private File configurationFile; 
       
       /** The sitemap file */ 
  -    private String sitemapFileName = null; 
  +    private String sitemapFileName; 
       
       /** The configuration tree */
  -    private Configuration configuration = null;
  +    private Configuration configuration;
       
       /** The sitemap manager */
  -    private SitemapManager sitemapManager = null;
  +    private SitemapManager sitemapManager;
       
       /** The root uri/path */
  -    private URL root = null;
  +    private URL root;
   
  -    /** The classpath (if available) */
  -    private String classpath = null;
  +    /** The classpath (null if not available) */
  +    private String classpath;
  +
  +    /** The working directory (null if not available) */
  +    private File workDir;
               
       /**
        * Create a new <code>Cocoon</code> instance.
  @@ -87,21 +90,14 @@
       /**
        * Create a new <code>Cocoon</code> object, parsing configuration from
        * the specified file.
  -     */
  -    public Cocoon(String configurationFile, String classpath)
  -    throws SAXException, IOException, ConfigurationException {
  -        this(new File(configurationFile).getCanonicalFile(), classpath);
  -    }
  -    
  -    /**
  -     * Create a new <code>Cocoon</code> object, parsing configuration from
  -     * the specified file.
        */
  -    public Cocoon(File configurationFile, String classpath)
  +    public Cocoon(File configurationFile, String classpath, File workDir)
       throws SAXException, IOException, ConfigurationException {
           this();
   
           this.classpath = classpath;
  +        
  +        this.workDir = workDir;
                   
           this.configurationFile = configurationFile;
           if (!configurationFile.isFile()) {
  @@ -133,6 +129,14 @@
        */
       public String getClasspath() {
           return this.classpath;
  +    }
  +
  +    /**
  +     * Get the local workpath
  +     * @return the workpath available to this instance or null if not available.
  +     */
  +    public File getWorkDir() {
  +        return this.workDir;
       }
   
       /**
  
  
  
  1.1.2.3   +5 -2      xml-cocoon/src/org/apache/cocoon/Attic/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/Constants.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- Constants.java	2000/09/03 17:45:45	1.1.2.2
  +++ Constants.java	2000/09/22 12:21:04	1.1.2.3
  @@ -10,7 +10,7 @@
   
   /**
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/09/03 17:45:45 $
  + * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/09/22 12:21:04 $
    */
   
   public interface Constants {
  @@ -27,7 +27,7 @@
       public static final String TEMPDIR_PROPERTY  = "org.apache.cocoon.properties.tempdir";
       public static final String DEFAULT_CONF_FILE = "cocoon.xconf";
       public static final String DEFAULT_DEST_DIR  = "./site";
  -    public static final String DEFAULT_TEMP_DIR  = "./work";
  +    public static final String DEFAULT_WORK_DIR  = "./work";
   
       public static final String PARSER_PROPERTY = "org.apache.cocoon.components.parser.Parser";
       public static final String DEFAULT_PARSER  = "org.apache.cocoon.components.parser.XercesParser";
  @@ -44,5 +44,8 @@
       public static final String LINK_CRAWLING_ROLE    = "static";
       public static final String LINK_TRANSLATING_VIEW = "translate-links";
       public static final String LINK_TRANSLATED_NAME  = "translated-links";    
  +
  +    public static final String CATALINA_SERVLET_CLASSPATH = "org.apache.catalina.jsp_classpath";
  +    public static final String TOMCAT_SERVLET_CLASSPATH = "org.apache.tomcat.jsp_classpath";
   
   }
  
  
  
  1.1.4.6   +19 -6     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.5
  retrieving revision 1.1.4.6
  diff -u -r1.1.4.5 -r1.1.4.6
  --- Main.java	2000/09/19 00:27:51	1.1.4.5
  +++ Main.java	2000/09/22 12:21:08	1.1.4.6
  @@ -32,7 +32,7 @@
    * Command line entry point.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.4.5 $ $Date: 2000/09/19 00:27:51 $
  + * @version CVS $Revision: 1.1.4.6 $ $Date: 2000/09/22 12:21:08 $
    */
   
   public class Main {
  @@ -41,6 +41,7 @@
   
           String destDir  = Cocoon.DEFAULT_DEST_DIR;
           String confFile = Cocoon.DEFAULT_CONF_FILE;
  +        String workDir  = Cocoon.DEFAULT_WORK_DIR;
           List targets = new ArrayList();
           
           for (int i = 0; i < args.length; i++) {
  @@ -61,6 +62,15 @@
                           "using the -d/--destdir argument");
                       return;
                   }
  +            } else if (arg.equals("-w") || arg.equals("--workdir")) {
  +                try {
  +                    workDir = args[i + 1];
  +                    i++;
  +                } catch (ArrayIndexOutOfBoundsException e) {
  +                    System.out.println("You must specify a destination dir when " +
  +                        "using the -w/--workdir argument");
  +                    return;
  +                }
               } else if (arg.equals("-c") || arg.equals("--conf")) {
                   try {
                       confFile = args[i + 1];
  @@ -99,10 +109,11 @@
           }
   
           try {
  -            File dest = getDestinationDir(destDir);
  +            File dest = getDir(destDir, "destination");
  +            File work = getDir(workDir, "working");
               File conf = getConfigurationFile(confFile);
               File root = conf.getParentFile();
  -            Main main = new Main(new Cocoon(conf, null), conf, dest);
  +            Main main = new Main(new Cocoon(conf, null, work), conf, dest);
               System.out.println("[main] Starting...");
               main.process(targets);
               System.out.println("[main] Done.");
  @@ -129,6 +140,7 @@
           msg.append("  -l/--logfile <file>    use given file for log" + lSep);
           msg.append("  -c/--conf    <file>    use given file as configurations" + lSep);
           msg.append("  -d/--destdir <dir>     use given dir as destination" + lSep + lSep);
  +        msg.append("  -w/--workdir <dir>     use given dir as working directory" + lSep + lSep);
           msg.append("Note: if the configuration file is not specified, it will default to" + lSep);
           msg.append("'" + Cocoon.DEFAULT_CONF_FILE + "' in the current working directory, then in the user directory" + lSep);
           msg.append("and finally in the '/usr/local/etc/' directory before giving up." + lSep);
  @@ -164,13 +176,13 @@
           throw new FileNotFoundException("The configuration file could not be found.");
       }
   
  -    private static File getDestinationDir(String dir) throws Exception {
  +    private static File getDir(String dir, String type) throws Exception {
   
           File d = new File(dir);
   
           if (!d.exists()) {
               if (!d.mkdirs()) {
  -                throw new IOException("Error creating destination directory '" + d + "'");
  +                throw new IOException("Error creating " + type + " directory '" + d + "'");
               }
           }
   
  @@ -185,6 +197,8 @@
           return d;
       }
   
  +    // -----------------------------------------------------------------------
  +    
       private Cocoon cocoon;
       private File destDir;
       private File root;
  @@ -326,6 +340,5 @@
               return "xxx";
           }
       }
  -    
   }