cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rica...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/components/language/generator ProgramGenerator.java ProgramGeneratorImpl.java
Date Wed, 24 May 2000 21:00:37 GMT
ricardo     00/05/24 14:00:35

  Modified:    src/org/apache/cocoon/components/language/generator Tag:
                        xml-cocoon2 ProgramGenerator.java
                        ProgramGeneratorImpl.java
  Log:
  Generated programs are no longer required to implement Modifiable, though doing so is necessary
for auto-reloading. This is a provisional fix: the program (as opposed to the program instance)
should implement this interface
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.2   +2 -3      xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGenerator.java
  
  Index: ProgramGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGenerator.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ProgramGenerator.java	2000/05/24 20:17:02	1.1.2.1
  +++ ProgramGenerator.java	2000/05/24 21:00:30	1.1.2.2
  @@ -9,14 +9,13 @@
   
   import java.io.File;
   import org.apache.arch.Component;
  -import org.apache.arch.Modifiable;
   
   /**
    * This interface defines a loader for programs automatically built from XML
    * documents writeen in a <code>MarkupLanguage</code>
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2000/05/24 20:17:02 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/05/24 21:00:30 $
    */
   public interface ProgramGenerator extends Component {
     /**
  @@ -31,7 +30,7 @@
      * @return The loaded object
      * @exception Exception If an error occurs during generation or loading
      */
  -  public Modifiable load(
  +  public Object load(
       File file, String markupLanguage, String programmingLanguage
     ) throws Exception;
   }
  
  
  
  1.1.2.2   +13 -11    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.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- ProgramGeneratorImpl.java	2000/05/24 20:17:03	1.1.2.1
  +++ ProgramGeneratorImpl.java	2000/05/24 21:00:32	1.1.2.2
  @@ -50,7 +50,7 @@
    * The default implementation of <code>ProgramGenerator</code>
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.1 $ $Date: 2000/05/24 20:17:03 $
  + * @version CVS $Revision: 1.1.2.2 $ $Date: 2000/05/24 21:00:32 $
    */
   public class ProgramGeneratorImpl
     implements ProgramGenerator, Composer, Configurable
  @@ -112,7 +112,7 @@
      * @return The loaded program instance
      * @exception Exception If an error occurs during generation or loading
      */
  -  public Modifiable load(
  +  public Object load(
       File file, String markupLanguageName, String programmingLanguageName
     ) throws Exception {
       // Get markup and programming languages
  @@ -132,7 +132,7 @@
   
       // Ensure no 2 requests for the same file overlap
       Object program = null;
  -    Modifiable programInstance = null;
  +    Object programInstance = null;
   
       synchronized(filename.intern()) {
         // Attempt to load program object from cache
  @@ -146,20 +146,22 @@
             );
     
   	  // Instantiate program
  -          programInstance =
  -	    (Modifiable) programmingLanguage.instantiate(program);
  +          programInstance = programmingLanguage.instantiate(program);
   	}
   
  -        programInstance = (Modifiable) programmingLanguage.instantiate(program);
  -
           // Store loaded program in cache
           this.cache.store(filename, program);
         } catch (LanguageException e) {}
         
  +      /*
  +         FIXME: It's the program (not the instance) that must
  +	 be queried for changes!!!
  +      */
         if (
   	  this.autoReload &&
             programInstance != null &&
  -	  programInstance.modifiedSince(file.lastModified())
  +	  programInstance instanceof Modifiable &&
  +	  ((Modifiable) programInstance).modifiedSince(file.lastModified())
         )
         {
           // Unload program
  @@ -204,12 +206,12 @@
   	  normalizedName, this.repositoryName, encoding
   	);
   
  -	// Instantiate
  -        programInstance = (Modifiable) programmingLanguage.instantiate(program);
  -
           // Store generated program in cache
           this.cache.store(filename, program);
         }
  +
  +      // Instantiate
  +      programInstance = programmingLanguage.instantiate(program);
       }
   
       return programInstance;
  
  
  

Mime
View raw message