cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/language/programming CompiledProgrammingLanguage.java
Date Fri, 08 Feb 2002 19:07:05 GMT
dims        02/02/08 11:07:05

  Modified:    .        build.xml
               src/java/org/apache/cocoon/components/language/generator
                        ProgramGeneratorImpl.java
               src/java/org/apache/cocoon/components/language/programming
                        CompiledProgrammingLanguage.java
  Log:
  Finally, "build.precompile=true" works....
  
  Revision  Changes    Path
  1.160     +1 -0      xml-cocoon2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/build.xml,v
  retrieving revision 1.159
  retrieving revision 1.160
  diff -u -r1.159 -r1.160
  --- build.xml	7 Feb 2002 23:28:34 -0000	1.159
  +++ build.xml	8 Feb 2002 19:07:04 -0000	1.160
  @@ -1026,6 +1026,7 @@
           <fileset dir="lib/optional">
             <include name="**/*.jar"/>
           </fileset>
  +        <pathelement location="${build.war}/WEB-INF/classes"/>
           <pathelement location="${build.dir}/${name}.jar"/>
           <pathelement location="${tools.jar}"/>
         </classpath>
  
  
  
  1.8       +2 -2      xml-cocoon2/src/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ProgramGeneratorImpl.java	7 Feb 2002 04:07:27 -0000	1.7
  +++ ProgramGeneratorImpl.java	8 Feb 2002 19:07:05 -0000	1.8
  @@ -93,7 +93,7 @@
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
    * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
  - * @version CVS $Id: ProgramGeneratorImpl.java,v 1.7 2002/02/07 04:07:27 vgritsenko Exp
$
  + * @version CVS $Id: ProgramGeneratorImpl.java,v 1.8 2002/02/08 19:07:05 dims Exp $
    */
   public class ProgramGeneratorImpl extends AbstractLoggable
       implements ProgramGenerator, Contextualizable, Composable, Parameterizable,
  @@ -269,7 +269,7 @@
                * FIXME: It's the program (not the instance) that must
                * be queried for changes!!!
                */
  -            if (programInstance != null && this.autoReload) {
  +            if (programInstance != null && !this.preload && this.autoReload)
{
                   // Autoreloading: Unload program if its source is modified
                   long lastModified = source.getLastModified();
                   if (lastModified == 0 || programInstance.modifiedSince(lastModified)) {
  
  
  
  1.6       +12 -1     xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/CompiledProgrammingLanguage.java
  
  Index: CompiledProgrammingLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/CompiledProgrammingLanguage.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- CompiledProgrammingLanguage.java	7 Feb 2002 04:07:27 -0000	1.5
  +++ CompiledProgrammingLanguage.java	8 Feb 2002 19:07:05 -0000	1.6
  @@ -73,7 +73,7 @@
    * A compiled programming language. This class extends <code>AbstractProgrammingLanguage</code>
adding support for compilation
    * and object program files
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Id: CompiledProgrammingLanguage.java,v 1.5 2002/02/07 04:07:27 vgritsenko
Exp $
  + * @version CVS $Id: CompiledProgrammingLanguage.java,v 1.6 2002/02/08 19:07:05 dims Exp
$
    */
   public abstract class CompiledProgrammingLanguage extends AbstractProgrammingLanguage implements
Contextualizable {
   
  @@ -177,6 +177,17 @@
        * @exception LanguageException If an error occurs during compilation
        */
       public Program load(String filename, File baseDirectory, String encoding) throws LanguageException
{
  +
  +        // Used for preload/precompile option.
  +        // Don't need to test for existence of the Source code.
  +        try {
  +            Class program = this.loadProgram(filename, baseDirectory);
  +            Object testInstance = program.newInstance();
  +            return new JavaProgram(program);
  +        } catch (Throwable t) {
  +            //Ignore errors if any.
  +        }
  +
           // Does object file exist? Load and return instance
           File objectFile = new File(baseDirectory, new StringBuffer(filename).append(".").append(this.getObjectExtension()).toString());
           if (objectFile.exists() && objectFile.isFile() && objectFile.canRead())
{
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message