cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: rev 55418 - in cocoon/trunk/src/blocks: python/java/org/apache/cocoon/components/language/programming/python xsp/java/org/apache/cocoon/components/language/generator xsp/java/org/apache/cocoon/components/language/programming xsp/java/org/apache/cocoon/components/language/programming/java xsp/java/org/apache/cocoon/components/language/programming/javascript xsp/java/org/apache/cocoon/generation
Date Sun, 24 Oct 2004 10:20:31 GMT
Author: cziegeler
Date: Sun Oct 24 03:20:29 2004
New Revision: 55418

Modified:
   cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonLanguage.java
   cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonProgram.java
   cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
   cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/CompiledProgrammingLanguage.java
   cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/JavaProgram.java
   cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptLanguage.java
   cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptProgram.java
   cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/generation/ServerPagesGenerator.java
Log:
Get XSP working again

Modified: cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonLanguage.java
==============================================================================
--- cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonLanguage.java
(original)
+++ cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonLanguage.java
Sun Oct 24 03:20:29 2004
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.components.language.programming.python;
 
+import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.cocoon.components.language.programming.AbstractProgrammingLanguage;
 import org.apache.cocoon.components.language.programming.ProgrammingLanguage;
 import org.apache.cocoon.components.language.programming.Program;
@@ -40,7 +41,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: PythonLanguage.java,v 1.3 2004/03/05 13:02:20 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class PythonLanguage extends AbstractProgrammingLanguage implements ProgrammingLanguage
{
 
@@ -100,7 +101,9 @@
             }
         }
 
-        return new PythonProgram(sourceFile, clazz, dependecies);
+        final Program p = new PythonProgram(sourceFile, clazz, dependecies);
+        ContainerUtil.enableLogging(p, this.getLogger());
+        return p;
     }
 
     private String getMeta(String line, String meta) {

Modified: cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonProgram.java
==============================================================================
--- cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonProgram.java
(original)
+++ cocoon/trunk/src/blocks/python/java/org/apache/cocoon/components/language/programming/python/PythonProgram.java
Sun Oct 24 03:20:29 2004
@@ -18,6 +18,7 @@
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceManager;
 
 import org.apache.cocoon.components.language.programming.Program;
@@ -34,7 +35,7 @@
  * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
  * @version CVS $Id$
  */
-public class PythonProgram implements Program {
+public class PythonProgram extends AbstractLogEnabled implements Program {
 
     protected File file;
     protected Class clazz;
@@ -65,7 +66,7 @@
             throws Exception {
 
         return AbstractComponentHandler.getComponentHandler(
-                clazz, config, manager, context, null, null, null);
+                clazz, config, manager, context, getLogger(), null, null);
     }
 
     public CompiledComponent newInstance() throws Exception {

Modified: cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
==============================================================================
--- cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
(original)
+++ cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/generator/ProgramGeneratorImpl.java
Sun Oct 24 03:20:29 2004
@@ -133,13 +133,11 @@
      * @param manager The global component manager
      */
     public void service(ServiceManager manager) throws ServiceException {
-        if (this.manager == null && manager != null) {
-            this.manager = manager;
-            this.cache = (GeneratorSelector) this.manager.lookup(GeneratorSelector.ROLE +
"Selector");
-            this.markupSelector = (ServiceSelector)this.manager.lookup(MarkupLanguage.ROLE
+ "Selector");
-            this.languageSelector = (ServiceSelector)this.manager.lookup(ProgrammingLanguage.ROLE
+ "Selector");
-            this.classManager = (ClassLoaderManager)this.manager.lookup(ClassLoaderManager.ROLE);
-        }
+        this.manager = manager;
+        this.cache = (GeneratorSelector) this.manager.lookup(GeneratorSelector.ROLE + "Selector");
+        this.markupSelector = (ServiceSelector)this.manager.lookup(MarkupLanguage.ROLE +
"Selector");
+        this.languageSelector = (ServiceSelector)this.manager.lookup(ProgrammingLanguage.ROLE
+ "Selector");
+        this.classManager = (ClassLoaderManager)this.manager.lookup(ClassLoaderManager.ROLE);
     }
 
     /**
@@ -492,22 +490,23 @@
         this.cache.removeGenerator(normalizedName);
     }
 
-    /**
-     *  dispose
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
      */
     public void dispose() {
-        this.manager.release(this.cache);
-        this.cache = null;
-        this.manager.release(this.markupSelector);
-        this.markupSelector = null;
-        this.manager.release(this.languageSelector);
-        this.languageSelector = null;
-        this.manager.release(this.classManager);
-        this.classManager = null;
-
-        this.manager = null;
+        if ( this.manager != null ) {
+            this.manager.release(this.cache);
+            this.cache = null;
+            this.manager.release(this.markupSelector);
+            this.markupSelector = null;
+            this.manager.release(this.languageSelector);
+            this.languageSelector = null;
+            this.manager.release(this.classManager);
+            this.classManager = null;
 
+            this.manager = null;
+        }
         this.workDir = null;
         this.contextDir = null;
     }
-}
+}
\ No newline at end of file

Modified: cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/CompiledProgrammingLanguage.java
==============================================================================
--- cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/CompiledProgrammingLanguage.java
(original)
+++ cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/CompiledProgrammingLanguage.java
Sun Oct 24 03:20:29 2004
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.components.language.programming;
 
+import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.context.Contextualizable;
@@ -33,7 +34,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.1 2004/03/10 12:58:07 stephan Exp
$
+ * @version CVS $Id$
  */
 public abstract class CompiledProgrammingLanguage extends AbstractProgrammingLanguage implements
Contextualizable {
 
@@ -141,7 +142,10 @@
             Class program = this.loadProgram(filename, baseDirectory);
             // Create and discard test instance.
             program.newInstance();
-            return new JavaProgram(program);
+
+            final Program p = new JavaProgram(program);
+            ContainerUtil.enableLogging(p, this.getLogger());
+            return p;
         } catch (Throwable t) {
             throw new LanguageException("Unable to preload program " + filename, t);
         }
@@ -197,6 +201,8 @@
             throw new LanguageException("Can't load program : " + baseDirectory.toString()
+ File.separator + filename);
         }
 
-        return new JavaProgram(program);
+        final Program p = new JavaProgram(program);
+        ContainerUtil.enableLogging(p, this.getLogger());
+        return p;
     }
 }

Modified: cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/JavaProgram.java
==============================================================================
--- cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/JavaProgram.java
(original)
+++ cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/java/JavaProgram.java
Sun Oct 24 03:20:29 2004
@@ -17,6 +17,7 @@
 
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceManager;
 
 import org.apache.cocoon.components.language.generator.CompiledComponent;
@@ -30,7 +31,7 @@
  * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
  * @version CVS $Id$
  */
-public class JavaProgram implements Program {
+public class JavaProgram extends AbstractLogEnabled implements Program {
 
     protected Class program;
 
@@ -49,7 +50,7 @@
         return AbstractComponentHandler.getComponentHandler(
                 program,
                 new DefaultConfiguration("", "GeneratorSelector"),
-                manager, context, null, null, null);
+                manager, context, getLogger(), null, null);
     }
 
     public CompiledComponent newInstance() throws Exception {

Modified: cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptLanguage.java
==============================================================================
--- cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptLanguage.java
(original)
+++ cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptLanguage.java
Sun Oct 24 03:20:29 2004
@@ -15,6 +15,7 @@
  */
 package org.apache.cocoon.components.language.programming.javascript;
 
+import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.cocoon.components.language.LanguageException;
 import org.apache.cocoon.components.language.markup.xsp.XSLTExtension;
 import org.apache.cocoon.components.language.programming.AbstractProgrammingLanguage;
@@ -38,7 +39,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.1 2004/03/10 12:58:08 stephan Exp $
+ * @version CVS $Id$
  */
 public class JavascriptLanguage extends AbstractProgrammingLanguage implements ProgrammingLanguage
{
 
@@ -95,7 +96,9 @@
             }
         }
 
-        return new JavascriptProgram(sourceFile, clazz, dependecies);
+        final Program p = new JavascriptProgram(sourceFile, clazz, dependecies);
+        ContainerUtil.enableLogging(p, this.getLogger());
+        return p;
     }
 
     private String getMeta(String line, String meta) {

Modified: cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptProgram.java
==============================================================================
--- cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptProgram.java
(original)
+++ cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/components/language/programming/javascript/JavascriptProgram.java
Sun Oct 24 03:20:29 2004
@@ -18,6 +18,7 @@
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceManager;
 
 import org.apache.cocoon.components.language.generator.CompiledComponent;
@@ -34,7 +35,7 @@
  * @author <a href="mailto:vgritsenko@apache.org">Vadim Gritsenko</a>
  * @version CVS $Id$
  */
-public class JavascriptProgram implements Program {
+public class JavascriptProgram extends AbstractLogEnabled implements Program {
 
     protected File file;
     protected Class clazz;
@@ -67,7 +68,7 @@
     throws Exception {
 
         return AbstractComponentHandler.getComponentHandler(
-                clazz, config, manager, context, null, null, null);
+                clazz, config, manager, context, getLogger(), null, null);
     }
 
     public CompiledComponent newInstance() throws Exception {

Modified: cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/generation/ServerPagesGenerator.java
==============================================================================
--- cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/generation/ServerPagesGenerator.java
(original)
+++ cocoon/trunk/src/blocks/xsp/java/org/apache/cocoon/generation/ServerPagesGenerator.java
Sun Oct 24 03:20:29 2004
@@ -59,12 +59,13 @@
  */
 public class ServerPagesGenerator extends ServletGenerator
         implements CacheableProcessingComponent, Configurable {
+    
     /**
      * The sitemap-defined server pages program generator
      */
-    protected ProgramGenerator programGenerator = null;
+    protected ProgramGenerator programGenerator;
 
-    protected AbstractServerPage generator = null;
+    protected AbstractServerPage generator;
 
     /** The source */
     private Source inputSource;
@@ -79,11 +80,7 @@
      */
     public void service(ServiceManager manager) throws ServiceException {
         super.service(manager);
-
-        if (programGenerator == null) {
-            this.programGenerator =
-                    (ProgramGenerator) manager.lookup(ProgramGenerator.ROLE);
-        }
+        this.programGenerator = (ProgramGenerator) manager.lookup(ProgramGenerator.ROLE);
     }
 
     /* (non-Javadoc)
@@ -274,15 +271,15 @@
         super.recycle();
     }
 
-    /**
-     * dispose
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.activity.Disposable#dispose()
      */
     public void dispose() {
         if ( this.manager != null ) {
             this.manager.release(this.programGenerator);
             this.programGenerator = null;
-            this.manager = null;
         }
+        super.dispose();
     }
 
     /* Completion pipe */

Mime
View raw message