cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/servlet CocoonServlet.java
Date Thu, 07 Dec 2000 17:11:10 GMT
bloritsch    00/12/07 09:11:08

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java Main.java
               src/org/apache/cocoon/components/classloader Tag:
                        xml-cocoon2 ClassLoaderManager.java
                        ClassLoaderManagerImpl.java
                        RepositoryClassLoader.java
               src/org/apache/cocoon/components/language/generator Tag:
                        xml-cocoon2 ProgramGeneratorImpl.java
               src/org/apache/cocoon/components/language/programming Tag:
                        xml-cocoon2 AbstractProgrammingLanguage.java
                        CompiledProgrammingLanguage.java
                        ProgrammingLanguage.java
               src/org/apache/cocoon/components/language/programming/java
                        Tag: xml-cocoon2 AbstractJavaCompiler.java
                        JavaLanguage.java
               src/org/apache/cocoon/components/language/programming/javascript
                        Tag: xml-cocoon2 JavascriptLanguage.java
               src/org/apache/cocoon/servlet Tag: xml-cocoon2
                        CocoonServlet.java
  Log:
  Servlet engine compatibility fixes.  Things that are supposed to be
  URLs are passed that way, and things that are supposed to be
  Files are passed that way.  And the Webapp Root is now independant
  of the Cocoon.xconf file!
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.38  +19 -15    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.37
  retrieving revision 1.4.2.38
  diff -u -r1.4.2.37 -r1.4.2.38
  --- Cocoon.java	2000/11/30 21:40:28	1.4.2.37
  +++ Cocoon.java	2000/12/07 17:10:29	1.4.2.38
  @@ -46,7 +46,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.37 $ $Date: 2000/11/30 21:40:28 $
  + * @version CVS $Revision: 1.4.2.38 $ $Date: 2000/12/07 17:10:29 $
    */
   public class Cocoon
     implements Component, Configurable, ComponentManager, Modifiable, Processor, Constants
{
  @@ -60,7 +60,7 @@
       private HashMap configurations = new HashMap();
   
       /** The configuration file */
  -    private File configurationFile;
  +    private URL configurationFile;
   
       /** The sitemap file */
       private String sitemapFileName;
  @@ -78,7 +78,7 @@
       private String classpath;
   
       /** The working directory (null if not available) */
  -    private String workDir;
  +    private File workDir;
   
       /** The component manager. */
       private DefaultComponentManager componentManager = new DefaultComponentManager();
  @@ -109,7 +109,7 @@
        * Create a new <code>Cocoon</code> object, parsing configuration from
        * the specified file.
        */
  -    public Cocoon(File configurationFile, String classpath, String workDir)
  +    public Cocoon(final URL configurationFile, final String classpath, File workDir, final
String root)
       throws SAXException, IOException, ConfigurationException,
       ComponentNotFoundException, ComponentNotAccessibleException {
           this();
  @@ -118,25 +118,20 @@
           log.debug("Classpath = " + classpath);
   
           this.workDir = workDir;
  -        log.debug("Work directory = " + workDir);
  +        log.debug("Work directory = " + workDir.getCanonicalPath());
   
           this.configurationFile = configurationFile;
  -        if (!configurationFile.isFile()) {
  -            log.error("Could not open configuration file, Cocoon object not created");
  -            throw new FileNotFoundException(configurationFile.toString());
  -        }
   
           Parser p = (Parser) this.lookup(Roles.PARSER);
           SAXConfigurationHandler b = new SAXConfigurationHandler();
  -        String path = this.configurationFile.getPath();
  -        InputSource is = new InputSource(new FileReader(path));
  +        InputSource is = new InputSource(this.configurationFile.openStream());
   
           p.setContentHandler(b);
  -        is.setSystemId(path);
  +        is.setSystemId(this.configurationFile.toExternalForm());
           p.parse(is);
   
           this.configure(b.getConfiguration());
  -        this.root = this.configurationFile.getParentFile().toURL();
  +        this.root = new File(root).toURL();
       }
   
       /**
  @@ -160,7 +155,7 @@
        * Get the local workpath
        * @return the workpath available to this instance or null if not available.
        */
  -    public String getWorkDir() {
  +    public File getWorkDir() {
           return this.workDir;
       }
   
  @@ -227,7 +222,16 @@
        * Queries the class to estimate its ergodic period termination.
        */
       public boolean modifiedSince(long date) {
  -        return(date < this.configurationFile.lastModified());
  +        boolean answer;
  +
  +        try {
  +            answer = date < this.configurationFile.openConnection().getLastModified();
  +        } catch (IOException ioe) {
  +            log.warn("Problem checking the date on the Configuration File.", ioe);
  +            answer = false;
  +        }
  +
  +        return answer;
       }
   
       /**
  
  
  
  1.1.4.16  +2 -2      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.15
  retrieving revision 1.1.4.16
  diff -u -r1.1.4.15 -r1.1.4.16
  --- Main.java	2000/11/30 21:40:34	1.1.4.15
  +++ Main.java	2000/12/07 17:10:30	1.1.4.16
  @@ -48,7 +48,7 @@
    * Command line entry point.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.4.15 $ $Date: 2000/11/30 21:40:34 $
  + * @version CVS $Revision: 1.1.4.16 $ $Date: 2000/12/07 17:10:30 $
    */
   
   public class Main {
  @@ -191,7 +191,7 @@
               File work = getDir(workDir, "working");
               File context = getDir(contextDir, "context");
               File conf = getConfigurationFile(context);
  -            Main main = new Main(new Cocoon(conf, null, work.toString()), context, dest);
  +            Main main = new Main(new Cocoon(conf.toURL(), null, work, context.getCanonicalPath()),
context, dest);
               main.warmup();
               main.process(targets);
               log.info("Done");
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +3 -2      xml-cocoon/src/org/apache/cocoon/components/classloader/Attic/ClassLoaderManager.java
  
  Index: ClassLoaderManager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/classloader/Attic/ClassLoaderManager.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- ClassLoaderManager.java	2000/07/29 18:30:26	1.1.2.4
  +++ ClassLoaderManager.java	2000/12/07 17:10:34	1.1.2.5
  @@ -10,6 +10,7 @@
   import org.apache.avalon.Component;
   
   import java.io.IOException;
  +import java.io.File;
   
   /**
    * A class loader manager acting as a proxy for a <b>single</b>
  @@ -18,7 +19,7 @@
    * that it can be safely reinstantiated for dynamic class reloading
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/07/29 18:30:26 $
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/12/07 17:10:34 $
    */
   public interface ClassLoaderManager extends Component {
     /**
  @@ -27,7 +28,7 @@
      * @param directoryName The repository name
      * @exception IOException If the directory is invalid
      */
  -  public void addDirectory(String directoryName) throws IOException;
  +  public void addDirectory(File directoryName) throws IOException;
   
     /**
      * Load a class through the proxied class loader
  
  
  
  1.1.2.5   +3 -2      xml-cocoon/src/org/apache/cocoon/components/classloader/Attic/ClassLoaderManagerImpl.java
  
  Index: ClassLoaderManagerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/classloader/Attic/ClassLoaderManagerImpl.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- ClassLoaderManagerImpl.java	2000/11/26 21:48:02	1.1.2.4
  +++ ClassLoaderManagerImpl.java	2000/12/07 17:10:35	1.1.2.5
  @@ -8,6 +8,7 @@
   package org.apache.cocoon.components.classloader;
   
   import java.io.IOException;
  +import java.io.File;
   
   import org.apache.avalon.ThreadSafe;
   
  @@ -15,7 +16,7 @@
    * A singleton-like implementation of <code>ClassLoaderManager</code>
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/11/26 21:48:02 $
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/12/07 17:10:35 $
    */
   public class ClassLoaderManagerImpl implements ClassLoaderManager, ThreadSafe {
     /**
  @@ -39,7 +40,7 @@
      * @param directoryName The repository name
      * @exception IOException If the directory is invalid
      */
  -  public void addDirectory(String directoryName) throws IOException {
  +  public void addDirectory(File directoryName) throws IOException {
       instance.addDirectory(directoryName);
     }
   
  
  
  
  1.1.2.6   +8 -8      xml-cocoon/src/org/apache/cocoon/components/classloader/Attic/RepositoryClassLoader.java
  
  Index: RepositoryClassLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/classloader/Attic/RepositoryClassLoader.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- RepositoryClassLoader.java	2000/09/14 11:07:11	1.1.2.5
  +++ RepositoryClassLoader.java	2000/12/07 17:10:36	1.1.2.6
  @@ -21,7 +21,7 @@
    * A class loader with a growable list of path search directories
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/09/14 11:07:11 $
  + * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/12/07 17:10:36 $
    */
   class RepositoryClassLoader extends ClassLoader {
     /**
  @@ -54,8 +54,8 @@
      * @exception IOException Non-existent, non-readable or non-directory
      * repository
      */
  -  public void addDirectory(String directoryName) throws IOException {
  -    File repository = new File(directoryName);
  +  public void addDirectory(File repository) throws IOException {
  +    String directoryName = repository.getCanonicalPath();
   
       // Ensure the same directory isn't specified twice
       int count = this.repositories.size();
  @@ -142,14 +142,14 @@
         if (file.exists() && file.isFile() && file.canRead()) {
           byte[] buffer = null;
           FileInputStream in = null;
  -    
  +
           int n = 0;
           int pos = 0;
           buffer = new byte [(int) file.length ()];
  -  
  +
           try {
             in = new FileInputStream(file);
  -  
  +
             while (
               pos < buffer.length &&
               (n = in.read (buffer, pos, buffer.length - pos)) != -1
  @@ -157,8 +157,8 @@
               pos += n;
             }
   
  -	  return buffer;
  -	} catch (IOException e) {
  +      return buffer;
  +    } catch (IOException e) {
           } finally {
             if (in != null) {
               try { in.close(); }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.17  +5 -5      xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java,v
  retrieving revision 1.1.2.16
  retrieving revision 1.1.2.17
  diff -u -r1.1.2.16 -r1.1.2.17
  --- ProgramGeneratorImpl.java	2000/11/26 21:48:03	1.1.2.16
  +++ ProgramGeneratorImpl.java	2000/12/07 17:10:42	1.1.2.17
  @@ -53,7 +53,7 @@
    * The default implementation of <code>ProgramGenerator</code>
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.16 $ $Date: 2000/11/26 21:48:03 $
  + * @version CVS $Revision: 1.1.2.17 $ $Date: 2000/12/07 17:10:42 $
    */
   public class ProgramGeneratorImpl
     implements ProgramGenerator, Composer, Configurable, ThreadSafe
  @@ -76,10 +76,10 @@
     protected ComponentSelector languageSelector;
   
     /** The working directory */
  -  protected String workDir;
  +  protected File workDir;
   
     /**
  -   * Set the global component manager. This method also sets the
  +   * Set the global component manager. This metod also sets the
      * <code>ComponentSelector</code> used as language factory for both
      * markup and programming languages.
      *
  @@ -91,9 +91,9 @@
         try {
             log.debug("Lookup " + Roles.MARKUP_LANGUAGE);
             this.markupSelector = (ComponentSelector) this.manager.lookup(Roles.MARKUP_LANGUAGE);
  -	  log.debug("Lookup " + Roles.PROGRAMMING_LANGUAGE);
  +      log.debug("Lookup " + Roles.PROGRAMMING_LANGUAGE);
             this.languageSelector = (ComponentSelector) this.manager.lookup(Roles.PROGRAMMING_LANGUAGE);
  -	  log.debug("Lookup " + Roles.COCOON);
  +      log.debug("Lookup " + Roles.COCOON);
             this.workDir = ((Cocoon) this.manager.lookup(Roles.COCOON)).getWorkDir();
         } catch (Exception e) {
             log.error("Could not lookup Component", e);
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.9   +4 -5      xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/AbstractProgrammingLanguage.java
  
  Index: AbstractProgrammingLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/AbstractProgrammingLanguage.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- AbstractProgrammingLanguage.java	2000/11/15 19:29:37	1.1.2.8
  +++ AbstractProgrammingLanguage.java	2000/12/07 17:10:46	1.1.2.9
  @@ -27,7 +27,7 @@
    * unloading.
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/11/15 19:29:37 $
  + * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/12/07 17:10:46 $
    */
   public abstract class AbstractProgrammingLanguage
     implements ProgrammingLanguage, Configurable
  @@ -98,18 +98,17 @@
      * @exception LanguageException If an error occurs during unloading
      */
     protected abstract void doUnload(
  -    Object program, String filename, String baseDirectory
  +    Object program, String filename, File baseDirectory
     )
       throws LanguageException;
   
     public final void unload(
  -    Object program, String filename, String baseDirectory
  +    Object program, String filename, File baseDirectory
     )
       throws LanguageException
     {
       File file = new File (
  -      baseDirectory + File.separator +
  -      filename + "." + this.getSourceExtension()
  +      baseDirectory, filename + "." + this.getSourceExtension()
       );
   
       file.delete();
  
  
  
  1.1.2.10  +10 -14    xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/CompiledProgrammingLanguage.java
  
  Index: CompiledProgrammingLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/CompiledProgrammingLanguage.java,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- CompiledProgrammingLanguage.java	2000/11/10 22:38:54	1.1.2.9
  +++ CompiledProgrammingLanguage.java	2000/12/07 17:10:47	1.1.2.10
  @@ -26,7 +26,7 @@
    * and object program files
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/11/10 22:38:54 $
  + * @version CVS $Revision: 1.1.2.10 $ $Date: 2000/12/07 17:10:47 $
    */
   public abstract class CompiledProgrammingLanguage
     extends AbstractProgrammingLanguage
  @@ -58,7 +58,7 @@
       if (compilerClass == null) {
         throw new LanguageException(
           "Missing 'compiler' parameter for compiled language '" +
  -	this.getLanguageName() + "'"
  +    this.getLanguageName() + "'"
         );
       }
       this.compilerClass = ClassUtils.loadClass(compilerClass);
  @@ -106,13 +106,12 @@
      * @exception EXCEPTION_NAME If an error occurs
      */
     protected final void doUnload(
  -    Object program, String filename, String baseDirectory
  +    Object program, String filename, File baseDirectory
     )
       throws LanguageException
     {
       File file = new File (
  -      baseDirectory + File.separator +
  -      filename + "." + this.getObjectExtension()
  +      baseDirectory, filename + "." + this.getObjectExtension()
       );
   
       file.delete();
  @@ -128,7 +127,7 @@
      * @return The loaded object program
      * @exception LanguageException If an error occurs during loading
      */
  -  protected abstract Object loadProgram(String filename, String baseDirectory)
  +  protected abstract Object loadProgram(String filename, File baseDirectory)
       throws LanguageException;
   
     /**
  @@ -141,7 +140,7 @@
      * @exception LanguageException If an error occurs during compilation
      */
     protected abstract void compile(
  -    String filename, String baseDirectory, String encoding
  +    String filename, File baseDirectory, String encoding
     ) throws LanguageException;
   
     /**
  @@ -155,14 +154,12 @@
      * @return The loaded object program
      * @exception LanguageException If an error occurs during compilation
      */
  -  public Object load(String filename, String baseDirectory, String encoding)
  +  public Object load(String filename, File baseDirectory, String encoding)
       throws LanguageException
     {
  -
       // Does object file exist? Load and return instance
       File objectFile = new File(
  -      baseDirectory + File.separator +
  -      filename + "." + this.getObjectExtension()
  +      baseDirectory, filename + "." + this.getObjectExtension()
       );
   
       if (objectFile.exists() && objectFile.isFile() && objectFile.canRead())
{
  @@ -171,8 +168,7 @@
   
       // Does source file exist?
       File sourceFile = new File(
  -      baseDirectory + File.separator +
  -      filename + "." + this.getSourceExtension()
  +      baseDirectory, filename + "." + this.getSourceExtension()
       );
   
       if (sourceFile.exists() && sourceFile.isFile() && sourceFile.canRead())
{
  @@ -187,7 +183,7 @@
   
       throw new LanguageException(
         "Can't load program: " +
  -      baseDirectory + File.separator + filename
  +      baseDirectory.toString() + File.separator + filename
       );
     }
   }
  
  
  
  1.1.2.6   +5 -3      xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/ProgrammingLanguage.java
  
  Index: ProgrammingLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/Attic/ProgrammingLanguage.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- ProgrammingLanguage.java	2000/10/19 14:43:36	1.1.2.5
  +++ ProgrammingLanguage.java	2000/12/07 17:10:49	1.1.2.6
  @@ -7,6 +7,8 @@
    *****************************************************************************/
   package org.apache.cocoon.components.language.programming;
   
  +import java.io.File;
  +
   import org.apache.avalon.Component;
   
   import org.apache.cocoon.components.language.LanguageException;
  @@ -15,7 +17,7 @@
    * This interface states the functionality of a programming language processor
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/10/19 14:43:36 $
  + * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/12/07 17:10:49 $
    */
   public interface ProgrammingLanguage extends Component {
     /**
  @@ -35,7 +37,7 @@
      * @return The loaded program
      * @exception LanguageException If an error occurs during loading
      */
  -  public Object load(String filename, String baseDirectory, String encoding)
  +  public Object load(String filename, File baseDirectory, String encoding)
       throws LanguageException;
   
     /**
  @@ -55,7 +57,7 @@
      * @param baseDirectory The directory containing the program file
      * @exception LanguageException If an error occurs
      */
  -  public void unload (Object program, String filename, String baseDirectory)
  +  public void unload (Object program, String filename, File baseDirectory)
       throws LanguageException;
   
     /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.8   +19 -19    xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/AbstractJavaCompiler.java
  
  Index: AbstractJavaCompiler.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/AbstractJavaCompiler.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- AbstractJavaCompiler.java	2000/11/29 12:17:29	1.1.2.7
  +++ AbstractJavaCompiler.java	2000/12/07 17:10:56	1.1.2.8
  @@ -5,7 +5,7 @@
    * version 1.1, a copy of which has been included  with this distribution in *
    * the LICENSE file.                                                         *
    *****************************************************************************/
  - 
  +
   package org.apache.cocoon.components.language.programming.java;
   
   import java.io.*;
  @@ -17,7 +17,7 @@
   /**
    * This class implements the functionality common to all Java compilers.
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version $Revision: 1.1.2.7 $ $Date: 2000/11/29 12:17:29 $
  + * @version $Revision: 1.1.2.8 $ $Date: 2000/12/07 17:10:56 $
    * @since 2.0
    */
   public abstract class AbstractJavaCompiler implements LanguageCompiler, Recyclable {
  @@ -25,28 +25,28 @@
      * The source program filename
      */
     protected String    file;
  -  
  +
     /**
      * The name of the directory containing the source program file
      */
     protected String    srcDir;
  -  
  +
     /**
      * The name of the directory to contain the resulting object program file
      */
     protected String    destDir;
  -  
  +
     /**
      * The classpath to be used for compilation
      */
     protected String    classpath;
  -  
  +
     /**
      * The encoding of the source program or <code>null</code> to use the
      * platform's default encoding
      */
     protected String    encoding = null;
  -  
  +
     /**
      * The input stream to output compilation errors
      */
  @@ -59,7 +59,7 @@
      */
     public void setFile(String file) {
       this.file = file;
  -  } 
  +  }
   
     /**
      * Set the name of the directory containing the source program file
  @@ -68,7 +68,7 @@
      */
     public void setSource(String srcDir) {
       this.srcDir = srcDir;
  -  } 
  +  }
   
     /**
      * Set the name of the directory to contain the resulting object program file
  @@ -77,8 +77,8 @@
      * program file
      */
     public void setDestination(String destDir) {
  -    this.destDir = destDir;
  -  } 
  +      this.destDir = destDir;
  +  }
   
     /**
      * Set the classpath to be used for this compilation
  @@ -87,7 +87,7 @@
      */
     public void setClasspath(String classpath) {
       this.classpath = classpath;
  -  } 
  +  }
   
     /**
      * Set the encoding of the input source file or <code>null</code> to use
the
  @@ -98,7 +98,7 @@
      */
     public void setEncoding(String encoding) {
       this.encoding = encoding;
  -  } 
  +  }
   
     /**
      * Return the list of errors generated by this compilation
  @@ -108,7 +108,7 @@
      */
     public List getErrors() throws IOException {
       return parseStream(new BufferedReader(new InputStreamReader(errors)));
  -  } 
  +  }
   
     /**
      * Parse the compiler error stream to produce a list of
  @@ -118,7 +118,7 @@
      * @return The list of compiler error messages
      * @exception IOException If an error occurs during message collection
      */
  -  protected abstract List parseStream(BufferedReader errors) 
  +  protected abstract List parseStream(BufferedReader errors)
         throws IOException;
   
     /**
  @@ -135,7 +135,7 @@
       // classpath
       arguments.add("-classpath");
       arguments.add(classpath);
  -    
  +
       // sourcepath
       arguments.add("-sourcepath");
       arguments.add(srcDir);
  @@ -147,10 +147,10 @@
       if (encoding != null) {
         arguments.add("-encoding");
         arguments.add(encoding);
  -    } 
  +    }
   
       return arguments;
  -  } 
  +  }
   
     /**
      * Copy arguments to a string array
  @@ -164,7 +164,7 @@
   
       for (i = 0; i < arguments.size(); i++) {
         args[i] = (String) arguments.get(i);
  -    } 
  +    }
   
       args[i] = file;
   
  
  
  
  1.1.2.14  +7 -7      xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/JavaLanguage.java
  
  Index: JavaLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/java/Attic/JavaLanguage.java,v
  retrieving revision 1.1.2.13
  retrieving revision 1.1.2.14
  diff -u -r1.1.2.13 -r1.1.2.14
  --- JavaLanguage.java	2000/11/29 12:17:31	1.1.2.13
  +++ JavaLanguage.java	2000/12/07 17:10:58	1.1.2.14
  @@ -31,7 +31,7 @@
    * The Java programming language processor
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.13 $ $Date: 2000/11/29 12:17:31 $
  + * @version CVS $Revision: 1.1.2.14 $ $Date: 2000/12/07 17:10:58 $
    */
   public class JavaLanguage extends CompiledProgrammingLanguage implements ThreadSafe {
   
  @@ -110,7 +110,7 @@
      * @return The loaded object program
      * @exception LanguageException If an error occurs during loading
      */
  -  protected Object loadProgram(String name, String baseDirectory)
  +  protected Object loadProgram(String name, File baseDirectory)
       throws LanguageException
     {
       try {
  @@ -132,7 +132,7 @@
      * @exception LanguageException If an error occurs during compilation
      */
     protected void compile(
  -    String name, String baseDirectory, String encoding
  +    String name, File baseDirectory, String encoding
     ) throws LanguageException {
   
       try {
  @@ -142,7 +142,7 @@
         int pos = name.lastIndexOf(File.separatorChar);
         String filename = name.substring(pos + 1);
         String pathname =
  -        baseDirectory + File.separator +
  +        baseDirectory.getCanonicalPath() + File.separator +
           name.substring(0, pos).replace(File.separatorChar, '/');
   
         compiler.setFile(
  @@ -152,12 +152,12 @@
   
         compiler.setSource(pathname);
   
  -      compiler.setDestination(baseDirectory);
  +      compiler.setDestination(baseDirectory.getCanonicalPath());
   
         String systemClasspath = System.getProperty("java.class.path");
         String systemExtDirs = System.getProperty("java.ext.dirs");
         compiler.setClasspath(
  -        baseDirectory +
  +        baseDirectory.getCanonicalPath() +
           ((classpath != null) ? File.pathSeparator + classpath : "") +
           ((systemClasspath != null) ? File.pathSeparator + systemClasspath : "") +
           ((systemExtDirs != null) ? File.pathSeparator + expandDirs(systemExtDirs) : "")
  @@ -241,7 +241,7 @@
             buffer.append("\\n");
             break;
           case '"':
  -	    case '\\':
  +        case '\\':
             buffer.append('\\');
             // Fall through
           default:
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +6 -6      xml-cocoon/src/org/apache/cocoon/components/language/programming/javascript/Attic/JavascriptLanguage.java
  
  Index: JavascriptLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/programming/javascript/Attic/JavascriptLanguage.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- JavascriptLanguage.java	2000/07/29 18:30:32	1.1.2.3
  +++ JavascriptLanguage.java	2000/12/07 17:11:02	1.1.2.4
  @@ -20,7 +20,7 @@
    * The compiled Javascript (Rhino) programming language processor
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/07/29 18:30:32 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/12/07 17:11:02 $
    */
   public class JavascriptLanguage extends JavaLanguage
   {
  @@ -52,19 +52,19 @@
      * @exception LanguageException If an error occurs during compilation
      */
     protected void compile(
  -    String name, String baseDirectory, String encoding
  +    String name, File baseDirectory, String encoding
     ) throws LanguageException {
       try {
         Main compiler = (Main) this.compilerClass.newInstance();
  -  
  +
         int pos = name.lastIndexOf(File.separatorChar);
         String filename = name.substring(pos + 1);
         String pathname =
  -        baseDirectory + File.separator +
  +        baseDirectory.getCanonicalPath() + File.separator +
           name.substring(0, pos).replace(File.separatorChar, '/');
         String packageName =
           name.substring(0, pos).replace(File.separatorChar, '.');
  -  
  +
         String[] args = {
           "-extends",
           "org.apache.cocoon.components.language.markup.xsp.javascript.JSGenerator",
  @@ -73,7 +73,7 @@
           "-package", packageName,
           pathname + File.separator + filename + "." + this.getSourceExtension()
         };
  -  
  +
         compiler.main(args);
       } catch (Exception e) {
         throw new LanguageException(e.getMessage());
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.4.37  +11 -20    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.4.36
  retrieving revision 1.1.4.37
  diff -u -r1.1.4.36 -r1.1.4.37
  --- CocoonServlet.java	2000/12/06 23:52:41	1.1.4.36
  +++ CocoonServlet.java	2000/12/07 17:11:06	1.1.4.37
  @@ -52,7 +52,7 @@
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
    * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.1.4.36 $ $Date: 2000/12/06 23:52:41 $
  + * @version CVS $Revision: 1.1.4.37 $ $Date: 2000/12/07 17:11:06 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -65,11 +65,12 @@
   
       private long creationTime = 0;
       private Cocoon cocoon;
  -    private File configFile;
  +    private URL configFile;
       private Exception exception;
       private ServletContext context;
       private String classpath;
  -    private String workDir;
  +    private File workDir;
  +    private String root;
   
       /**
        * Initialize this <code>CocoonServlet</code> instance.  You will
  @@ -96,10 +97,12 @@
   
           this.forceLoad(conf.getInitParameter("force-load"));
   
  -        this.setWorkDir((File) this.context.getAttribute("javax.servlet.context.tempdir"));
  +        this.workDir = (File) this.context.getAttribute("javax.servlet.context.tempdir");
   
           this.setConfigFile(conf.getInitParameter("configurations"), this.context);
   
  +        this.root = this.context.getRealPath("/");
  +
           this.createCocoon();
       }
   
  @@ -211,7 +214,7 @@
           log.info("Using configuration file: " + configFileName);
   
           try {
  -            this.configFile = new File(context.getResource(configFileName).getFile());
  +            this.configFile = context.getResource(configFileName);
           } catch (Exception mue) {
               log.error("Servlet initialization argument 'configurations' not found at "
+ configFileName, mue);
               throw new ServletException("Servlet initialization argument 'configurations'
not found at " + configFileName);
  @@ -219,18 +222,6 @@
       }
   
       /**
  -     *  Set up the Work Directory (where things get compiled).
  -     *
  -     * @param workDir the File handle for the work directory
  -     *
  -     * @throws ServletException
  -     */
  -    private void setWorkDir(final File workDir)
  -    throws ServletException {
  -        this.workDir = workDir.toString();
  -    }
  -
  -    /**
        * Handle the "force-load" parameter.  This overcomes limits in
        * many classpath issues.  One of the more notorious ones is a
        * bug in WebSphere that does not load the URL handler for the
  @@ -351,7 +342,7 @@
   
           ServletOutputStream out = res.getOutputStream();
   
  -        long end = System.currentTimeMillis();
  +        long end = new Date().getTime();
           String timeString = processTime(end - start);
           log.debug("'" + uri + "' " + timeString);
   
  @@ -374,8 +365,8 @@
        */
       private void createCocoon() {
           try {
  -            log.info("Reloading from: " + this.configFile);
  -            Cocoon c = new Cocoon(this.configFile, this.classpath, this.workDir);
  +            log.info("Reloading from: " + this.configFile.toExternalForm());
  +            Cocoon c = new Cocoon(this.configFile, this.classpath, this.workDir, this.root);
               this.creationTime = new Date().getTime();
               this.cocoon = c;
           } catch (Exception e) {
  
  
  

Mime
View raw message