cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/generation AbstractServerPage.java
Date Sun, 10 Feb 2002 05:08:24 GMT
vgritsenko    02/02/09 21:08:24

  Modified:    src/java/org/apache/cocoon/components/language/markup/xsp
                        JSGenerator.java
               src/java/org/apache/cocoon/components/language/programming/javascript
                        JavascriptLanguage.java
               src/java/org/apache/cocoon/generation
                        AbstractServerPage.java
  Log:
  fix dispose in JSGenerator,
  override modified since,
  cleanup
  
  Revision  Changes    Path
  1.2       +34 -18    xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/JSGenerator.java
  
  Index: JSGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/markup/xsp/JSGenerator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JSGenerator.java	9 Feb 2002 04:16:38 -0000	1.1
  +++ JSGenerator.java	10 Feb 2002 05:08:24 -0000	1.2
  @@ -91,7 +91,7 @@
    * written in Javascript language
    *
    * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
  - * @version CVS $Id: JSGenerator.java,v 1.1 2002/02/09 04:16:38 vgritsenko Exp $
  + * @version CVS $Id: JSGenerator.java,v 1.2 2002/02/10 05:08:24 vgritsenko Exp $
    */
   public class JSGenerator extends XSPGenerator
           implements Configurable, Initializable {
  @@ -109,10 +109,27 @@
   
       public void configure(Configuration configuration) throws ConfigurationException {
           this.file = new File(configuration.getChild("file").getValue());
  -        AbstractServerPage.dateCreated = this.file.lastModified();
  +    }
  +
  +    /**
  +     * Determines whether this generator's source files have changed
  +     *
  +     * @return Whether any of the files this generator depends on has changed
  +     * since it was created
  +     */
  +    public boolean modifiedSince(long date) {
  +        if (this.file.lastModified() < date) {
  +            return true;
  +        }
   
           // FIXME
  -        AbstractServerPage.dependencies = new File[]{};
  +//        for (int i = 0; i < dependencies.length; i++) {
  +//            if (dateCreated < dependencies[i].lastModified()) {
  +//                return true;
  +//            }
  +//        }
  +
  +        return false;
       }
   
       public void initialize() throws Exception {
  @@ -124,10 +141,10 @@
               global.put("jsAttr", global, Context.toObject(new AttributesImpl(), global));
   
               context.setOptimizationLevel(-1);
  +
               if (getLogger().isDebugEnabled()) {
                   getLogger().debug("Compiling script " + file);
               }
  -            System.out.println("Compiling script " + file);
               script = context.compileReader(global, new FileReader(file), file.toString(),
1, null);
           } finally {
               Context.exit();
  @@ -138,17 +155,12 @@
               throws ProcessingException, SAXException, IOException {
           super.setup(resolver, objectModel, src, par);
   
  -        Context context = Context.enter();
  -        try {
  -            global.put("objectModel", global, Context.toObject(this.objectModel, global));
  -            global.put("request", global, Context.toObject(this.request, global));
  -            global.put("response", global, Context.toObject(this.response, global));
  -            global.put("context", global, Context.toObject(this.context, global));
  -            global.put("resolver", global, Context.toObject(this.resolver, global));
  -            global.put("parameters", global, Context.toObject(this.parameters, global));
  -        } finally {
  -            Context.exit();
  -        }
  +        global.put("objectModel", global, Context.toObject(this.objectModel, global));
  +        global.put("request", global, Context.toObject(this.request, global));
  +        global.put("response", global, Context.toObject(this.response, global));
  +        global.put("context", global, Context.toObject(this.context, global));
  +        global.put("resolver", global, Context.toObject(this.resolver, global));
  +        global.put("parameters", global, Context.toObject(this.parameters, global));
       }
   
       public void generate() throws IOException, ProcessingException {
  @@ -161,7 +173,6 @@
               if (getLogger().isDebugEnabled()) {
                   getLogger().debug("Executing script " + file);
               }
  -            System.out.println("Executing script " + file);
   
               script.exec(context, global);
           } catch (JavaScriptException e) {
  @@ -185,8 +196,13 @@
       }
   
       public void dispose() {
  -        script = null;
  -        global = null;
  +        global.delete("page");
  +        global.delete("logger");
  +        global.delete("jsAttr");
  +        this.global = null;
  +        this.script = null;
  +
  +        super.dispose();
       }
   
       // Helper methods accessible from script
  
  
  
  1.6       +1 -2      xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/javascript/JavascriptLanguage.java
  
  Index: JavascriptLanguage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/language/programming/javascript/JavascriptLanguage.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JavascriptLanguage.java	9 Feb 2002 03:32:05 -0000	1.5
  +++ JavascriptLanguage.java	10 Feb 2002 05:08:24 -0000	1.6
  @@ -77,7 +77,7 @@
    * The class specified will be used as a Java wrapper interpreting javascript program.
    *
    * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
  - * @version CVS $Id: JavascriptLanguage.java,v 1.5 2002/02/09 03:32:05 vgritsenko Exp $
  + * @version CVS $Id: JavascriptLanguage.java,v 1.6 2002/02/10 05:08:24 vgritsenko Exp $
    */
   public class JavascriptLanguage extends AbstractProgrammingLanguage implements ProgrammingLanguage
{
   
  @@ -141,7 +141,6 @@
   
       protected void doUnload(Object program, String filename, File baseDir)
               throws LanguageException {
  -        System.out.println("IJavascriptLanguage: Unloading " + filename);
           // Do nothing. Source is already deleted by the AbstractProgrammingLanguage.
       }
   
  
  
  
  1.5       +2 -2      xml-cocoon2/src/java/org/apache/cocoon/generation/AbstractServerPage.java
  
  Index: AbstractServerPage.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/generation/AbstractServerPage.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractServerPage.java	4 Feb 2002 13:15:04 -0000	1.4
  +++ AbstractServerPage.java	10 Feb 2002 05:08:24 -0000	1.5
  @@ -69,7 +69,7 @@
    * declares variables that must be explicitly initialized by code generators.
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Id: AbstractServerPage.java,v 1.4 2002/02/04 13:15:04 cziegeler Exp $
  + * @version CVS $Id: AbstractServerPage.java,v 1.5 2002/02/10 05:08:24 vgritsenko Exp $
    */
   public abstract class AbstractServerPage
     extends ServletGenerator implements CompiledComponent, Cacheable
  @@ -100,7 +100,7 @@
      * @return Whether any of the files this generator depends on has changed
      * since it was created
      */
  -  public final boolean modifiedSince(long date) {
  +  public boolean modifiedSince(long date) {
       if (dateCreated < date) {
         return true;
       }
  
  
  

----------------------------------------------------------------------
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