You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gk...@apache.org on 2007/07/02 01:13:45 UTC

svn commit: r552371 - in /cocoon/trunk: blocks/cocoon-template/cocoon-template-impl/src/main/resources/META-INF/cocoon/avalon/ blocks/cocoon-template/cocoon-template-impl/src/main/resources/org/apache/cocoon/components/expression/ core/cocoon-expressio...

Author: gkossakowski
Date: Sun Jul  1 16:13:44 2007
New Revision: 552371

URL: http://svn.apache.org/viewvc?view=rev&rev=552371
Log:
COCOON-2082: Getting rid of Avalon dependencies, it includes:
* conversion JS, JXPath and JEXL compilers to Spring beans
* conversion DefaultExpressionFactory to Spring bean, it collects language compilers by using bean-map from Spring configurator

Added:
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/DefaultExpressionFactory.xml   (with props)
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JXPathCompiler.xml   (with props)
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JavaScriptCompiler.xml   (with props)
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JexlCompiler.xml   (with props)
Modified:
    cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-template-expression.xconf
    cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/resources/org/apache/cocoon/components/expression/expression.roles
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/pom.xml
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/DefaultExpressionFactory.java
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/javascript/JavaScriptCompiler.java
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/jexl/JexlCompiler.java
    cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/jxpath/JXPathCompiler.java

Modified: cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-template-expression.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-template-expression.xconf?view=diff&rev=552371&r1=552370&r2=552371
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-template-expression.xconf (original)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/resources/META-INF/cocoon/avalon/cocoon-template-expression.xconf Sun Jul  1 16:13:44 2007
@@ -23,15 +23,6 @@
 <components>
   <!-- Include roles -->
   <include src="resource://org/apache/cocoon/components/expression/expression.roles"/>
-
-  <expression-factory/>
-  
-  <expression-compilers>
-    <component-instance class="org.apache.cocoon.components.expression.jxpath.JXPathCompiler" name="default"/>
-    <component-instance class="org.apache.cocoon.components.expression.jexl.JexlCompiler" name="jexl"/>
-    <component-instance class="org.apache.cocoon.components.expression.jxpath.JXPathCompiler" name="jxpath"/>
-    <component-instance class="org.apache.cocoon.components.expression.javascript.JavaScriptCompiler" name="js"/>
-  </expression-compilers>
   
   <string-template-parsers>
     <component-instance class="org.apache.cocoon.template.expression.JXTGStringTemplateParser" name="jxtg"/>

Modified: cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/resources/org/apache/cocoon/components/expression/expression.roles
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/resources/org/apache/cocoon/components/expression/expression.roles?view=diff&rev=552371&r1=552370&r2=552371
==============================================================================
--- cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/resources/org/apache/cocoon/components/expression/expression.roles (original)
+++ cocoon/trunk/blocks/cocoon-template/cocoon-template-impl/src/main/resources/org/apache/cocoon/components/expression/expression.roles Sun Jul  1 16:13:44 2007
@@ -17,12 +17,7 @@
 -->
 <!-- $Id$ -->
 <role-list>
-  <role name="org.apache.cocoon.components.expression.ExpressionCompilerSelector"
-        shorthand="expression-compilers"
-        default-class="org.apache.cocoon.core.container.DefaultServiceSelector"/>
-  <role name="org.apache.cocoon.components.expression.ExpressionFactory"
-        shorthand="expression-factory"
-        default-class="org.apache.cocoon.components.expression.DefaultExpressionFactory"/>
+
   <!-- TODO move it somewhere else! -->
   <role name="org.apache.cocoon.template.expression.StringTemplateParserSelector" 
         shorthand="string-template-parsers" 

Modified: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/pom.xml?view=diff&rev=552371&r1=552370&r2=552371
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/pom.xml (original)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/pom.xml Sun Jul  1 16:13:44 2007
@@ -60,5 +60,9 @@
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-flowscript-impl</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-flowscript-impl</artifactId>
+    </dependency>
   </dependencies>
 </project>

Modified: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/DefaultExpressionFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/DefaultExpressionFactory.java?view=diff&rev=552371&r1=552370&r2=552371
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/DefaultExpressionFactory.java (original)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/DefaultExpressionFactory.java Sun Jul  1 16:13:44 2007
@@ -16,61 +16,22 @@
  */
 package org.apache.cocoon.components.expression;
 
-import org.apache.avalon.framework.activity.Disposable;
-import org.apache.avalon.framework.logger.AbstractLogEnabled;
-import org.apache.avalon.framework.service.ServiceException;
-import org.apache.avalon.framework.service.ServiceManager;
-import org.apache.avalon.framework.service.ServiceSelector;
-import org.apache.avalon.framework.service.Serviceable;
-import org.apache.avalon.framework.thread.ThreadSafe;
+import java.util.Map;
 
 /**
  * @version $Id$
  */
-public class DefaultExpressionFactory
-    extends AbstractLogEnabled
-    implements Disposable, Serviceable, ThreadSafe, ExpressionFactory {
+public class DefaultExpressionFactory implements ExpressionFactory {
 
     public static final String DEFAULT_EXPRESSION_LANGUAGE = "default";
-
-    /** The component manager */
-    protected ServiceManager manager;
-
-    /** The Expression compiler selector */
-    protected ServiceSelector compilerSelector;
-
-    /**
-     * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
-     */
-    public void service(final ServiceManager manager) throws ServiceException {
-        this.manager = manager;
-        this.compilerSelector = (ServiceSelector) this.manager.lookup(ExpressionCompiler.ROLE + "Selector");
-    }
-
-    /**
-     * @see org.apache.avalon.framework.activity.Disposable#dispose()
-     */
-    public void dispose() {
-        if (null != this.manager) {
-            this.manager.release(this.compilerSelector);
-            this.compilerSelector = null;
-            this.manager = null;
-        }
-    }
+    
+    protected Map expressionCompilers;
 
     public Expression getExpression(String language, String expression) throws ExpressionException {
-
-        Expression expressionImpl = null;
-        ExpressionCompiler compiler = null;
-        try {
-            compiler = (ExpressionCompiler) this.compilerSelector.select(language);
-            expressionImpl = compiler.compile(language, expression);
-        } catch (final ServiceException ce) {
+        if (!this.expressionCompilers.containsKey(language))
             throw new ExpressionException("Can't find a compiler for " + language);
-        } finally {
-            this.compilerSelector.release(compiler);
-        }
-        return expressionImpl;
+        ExpressionCompiler compiler = (ExpressionCompiler) this.expressionCompilers.get(language);
+        return compiler.compile(language, expression);
     }
 
     public Expression getExpression(String expression) throws ExpressionException {
@@ -81,5 +42,13 @@
             expression = expression.substring(end + 1);
         }
         return getExpression(language, expression);
+    }
+
+    public Map getExpressionCompilers() {
+        return expressionCompilers;
+    }
+
+    public void setExpressionCompilers(Map expressionCompilers) {
+        this.expressionCompilers = expressionCompilers;
     }
 }

Modified: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/javascript/JavaScriptCompiler.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/javascript/JavaScriptCompiler.java?view=diff&rev=552371&r1=552370&r2=552371
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/javascript/JavaScriptCompiler.java (original)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/javascript/JavaScriptCompiler.java Sun Jul  1 16:13:44 2007
@@ -16,7 +16,6 @@
  */
 package org.apache.cocoon.components.expression.javascript;
 
-import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.components.expression.Expression;
 import org.apache.cocoon.components.expression.ExpressionCompiler;
 import org.apache.cocoon.components.expression.ExpressionException;
@@ -24,7 +23,7 @@
 /**
  * @version $Id$
  */
-public class JavaScriptCompiler implements ExpressionCompiler, ThreadSafe {
+public class JavaScriptCompiler implements ExpressionCompiler {
 
     /**
      * @see org.apache.cocoon.components.expression.ExpressionCompiler#compile(java.lang.String, java.lang.String)

Modified: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/jexl/JexlCompiler.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/jexl/JexlCompiler.java?view=diff&rev=552371&r1=552370&r2=552371
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/jexl/JexlCompiler.java (original)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/jexl/JexlCompiler.java Sun Jul  1 16:13:44 2007
@@ -16,7 +16,6 @@
  */
 package org.apache.cocoon.components.expression.jexl;
 
-import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.components.expression.Expression;
 import org.apache.cocoon.components.expression.ExpressionCompiler;
 import org.apache.cocoon.components.expression.ExpressionException;
@@ -24,7 +23,7 @@
 /**
  * @version $Id$
  */
-public class JexlCompiler implements ExpressionCompiler, ThreadSafe {
+public class JexlCompiler implements ExpressionCompiler {
 
     /**
      * @see org.apache.cocoon.components.expression.ExpressionCompiler#compile(java.lang.String, java.lang.String)

Modified: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/jxpath/JXPathCompiler.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/jxpath/JXPathCompiler.java?view=diff&rev=552371&r1=552370&r2=552371
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/jxpath/JXPathCompiler.java (original)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/java/org/apache/cocoon/components/expression/jxpath/JXPathCompiler.java Sun Jul  1 16:13:44 2007
@@ -16,7 +16,6 @@
  */
 package org.apache.cocoon.components.expression.jxpath;
 
-import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.components.expression.Expression;
 import org.apache.cocoon.components.expression.ExpressionCompiler;
 import org.apache.cocoon.components.expression.ExpressionException;
@@ -24,7 +23,7 @@
 /**
  * @version SVN $Id$
  */
-public class JXPathCompiler implements ExpressionCompiler, ThreadSafe {
+public class JXPathCompiler implements ExpressionCompiler {
     public Expression compile(String language, String expression)
         throws ExpressionException{
         return new JXPathExpression(language, expression);

Added: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/DefaultExpressionFactory.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/DefaultExpressionFactory.xml?view=auto&rev=552371
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/DefaultExpressionFactory.xml (added)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/DefaultExpressionFactory.xml Sun Jul  1 16:13:44 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- SVN $Id: cocoon-servlet-service-block-path-module.xml 504719 2007-02-07 22:17:36Z danielf $ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:configurator="http://cocoon.apache.org/schema/configurator"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+  http://cocoon.apache.org/schema/configurator http://cocoon.apache.org/schema/configurator/cocoon-configurator-1.0.1.xsd">
+  
+  <bean id="org.apache.cocoon.components.expression.ExpressionFactory" class="org.apache.cocoon.components.expression.DefaultExpressionFactory">
+    <property name="expressionCompilers">
+      <configurator:bean-map type="org.apache.cocoon.components.expression.ExpressionCompiler"/>
+    </property>
+  </bean>
+  
+</beans>

Propchange: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/DefaultExpressionFactory.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JXPathCompiler.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JXPathCompiler.xml?view=auto&rev=552371
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JXPathCompiler.xml (added)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JXPathCompiler.xml Sun Jul  1 16:13:44 2007
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- SVN $Id $ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+  <bean name="org.apache.cocoon.components.expression.ExpressionCompiler/jxpath" class="org.apache.cocoon.components.expression.jxpath.JXPathCompiler"/>
+
+</beans>
\ No newline at end of file

Propchange: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JXPathCompiler.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JavaScriptCompiler.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JavaScriptCompiler.xml?view=auto&rev=552371
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JavaScriptCompiler.xml (added)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JavaScriptCompiler.xml Sun Jul  1 16:13:44 2007
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- SVN $Id $ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+  <bean name="org.apache.cocoon.components.expression.ExpressionCompiler/jexl" class="org.apache.cocoon.components.expression.javascript.JavaScriptCompiler"/>
+
+</beans>
\ No newline at end of file

Propchange: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JavaScriptCompiler.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JexlCompiler.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JexlCompiler.xml?view=auto&rev=552371
==============================================================================
--- cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JexlCompiler.xml (added)
+++ cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JexlCompiler.xml Sun Jul  1 16:13:44 2007
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!-- SVN $Id $ -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+  <bean name="org.apache.cocoon.components.expression.ExpressionCompiler/js" class="org.apache.cocoon.components.expression.jexl.JexlCompiler"/>
+
+</beans>
\ No newline at end of file

Propchange: cocoon/trunk/core/cocoon-expression-language/cocoon-expression-language-impl/src/main/resources/META-INF/cocoon/spring/JexlCompiler.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Re: svn commit: r552371 - trunk broken, help needed

Posted by Reinhard Poetz <re...@apache.org>.
Grzegorz Kossakowski wrote:
> gkossakowski@apache.org pisze:
>> Author: gkossakowski
>> Date: Sun Jul  1 16:13:44 2007
>> New Revision: 552371
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=552371
>> Log:
>> COCOON-2082: Getting rid of Avalon dependencies, it includes:
>> * conversion JS, JXPath and JEXL compilers to Spring beans
>> * conversion DefaultExpressionFactory to Spring bean, it collects 
>> language compilers by using bean-map from Spring configurator
> 
> As you see, I'm in between of Avalon->Spring conversion process for 
> expression languages. I have not moved and adjusted tests (thus build 
> will fail) because I came across very obscure problem.
> 
> First of all I would like you to ask to do svn up and mvn clean install 
> -Dmaven.test.skip=true for trunk, run cocoon-webapp, access 
> http://localhost:8888/blocks/cocoon-template-sample/view/caching2
> and check if you get following error:
> TypeError: Cannot read property "parameters" from undefined (#1)

AFAICS the problem is that we want to support the syntax

   cocoon.request.parameters.foo

to access request parameters. For some reason this isn't supported anymore after 
your refactorings though I can't see from your commits where this could be 
caused. (Well actually I don't have an idea where this feature is implemented at 
all.)

> I would be grateful for any reports to be sure if it's not a JDK issue 
> or so. Also, any help with sorting this out is really appreciated 
> because I'm really out of ideas how to track such a weird problem. 
> Details below.
> 
> 
> After conversion (changes in r552371) ExpressionContext creation is 
> slightly broken. Take a look at 
> TemplateObjectModelHelper#getTemplateObjectModel method, the most 
> interesting fragment is line:
> 
> cocoon.put("settings", 
> (Settings)WebAppContextUtils.getCurrentWebApplicationContext().getBean(Settings.ROLE)); 
> 
> 
> Cocoon object is normal Java's HashMap, so it seems that there should 
> happen nothing fancy. As you guess, something weird happens, though ;)
> More specifically, this put breaks completely cocoon object. Inspection 
> in debugger of this object shows that before put operation mentioned 
> above everything looks ok and just after keys of HashMap are getting out 
> of sync of values (table). In a fact, the table of values contains 3 
> items (and is lacking request object, that explains an exception) and 
> keySet contains 4 items (including request). Moreover, if I change key 
> from "settings" to something else like "test", cocoon object is less 
> broken (table includes request) but if you iterate the cocoon object you 
> will never reach the request object.

 From using the debugger I came to the conclustion that the cocoon object is 
setup correctly (at least for me). I don't see this weird behaviour.

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

Re: svn commit: r552371 - trunk broken, help needed

Posted by Reinhard Poetz <re...@apache.org>.
Grzegorz Kossakowski wrote:
> Reinhard Poetz pisze:
>> Grzegorz Kossakowski wrote:
>>> Reinhard, could you give it another try? I'll try to reproduce it on 
>>> Windows.
>>
>> Now I can reproduce the problem. Sorry.
> 
> I think that my last commit (r552518) fixes the problem. It was a silly 
> mistake: JS and JEXL beans where mixed up so initialization was not done 
> properly.
> 
> Test and report if it works for you, please. Thanks!

works again. Thanks!

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

Re: svn commit: r552371 - trunk broken, help needed

Posted by Grzegorz Kossakowski <gk...@apache.org>.
Reinhard Poetz pisze:
> Grzegorz Kossakowski wrote:
>> Reinhard, could you give it another try? I'll try to reproduce it on 
>> Windows.
> 
> Now I can reproduce the problem. Sorry.

I think that my last commit (r552518) fixes the problem. It was a silly mistake: JS and JEXL beans where mixed up so initialization was not 
done properly.

Test and report if it works for you, please. Thanks!

-- 
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/

Re: svn commit: r552371 - trunk broken, help needed

Posted by Reinhard Poetz <re...@apache.org>.
Grzegorz Kossakowski wrote:
> Reinhard, could you give it another try? I'll try to reproduce it on 
> Windows.

Now I can reproduce the problem. Sorry.

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

Re: svn commit: r552371 - trunk broken, help needed

Posted by Grzegorz Kossakowski <gk...@apache.org>.
Grzegorz Kossakowski pisze:
> Reinhard Poetz pisze:
>> I'm not sure if it is really a JDK issue. I guess that your setup got 
>> messed up by your refactorings. After fixing the compilation error 
>> (see my commit) I was able to run the cocoon-template-sample using the 
>> webapp produced by the rcl goal (I checked in the configuration) of 
>> the Cocoon Maven plugin with Java 5 (1.5.0_11) without a problem.
> 
> Sorry for compilation problem, I use Java 6 (1.6.0).
> 
>> Make sure that there are no old Java classes that haven't been deleted 
>> by SVN (run 'svn stat' on your working copy) and then run 'mvn clean'. 
>> As a next step I suggest that you remove all org.apache.cocoon 
>> artifacts from your local repository and finally run 'mvn install 
>> -Dmaven.test.skip=true'. This should make sure that your classpath 
>> doesn't contain any unwanted classes. HTH
> 
> I tried it few times, even checking classpath and I still get the same 
> error :(
> I'll try to downgrade my Java version or try it on another machine...

I have tried it on my second machine (openSUSE 10.2, Java 1.5.0_8) with clean installation (no Maven repo, fresh cocoon checkout) and got 
exactly the same error.

Reinhard, could you give it another try? I'll try to reproduce it on Windows.

-- 
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/

Re: svn commit: r552371 - trunk broken, help needed

Posted by Grzegorz Kossakowski <gk...@apache.org>.
Reinhard Poetz pisze:
> I'm not sure if it is really a JDK issue. I guess that your setup got 
> messed up by your refactorings. After fixing the compilation error (see 
> my commit) I was able to run the cocoon-template-sample using the webapp 
> produced by the rcl goal (I checked in the configuration) of the Cocoon 
> Maven plugin with Java 5 (1.5.0_11) without a problem.

Sorry for compilation problem, I use Java 6 (1.6.0).

> Make sure that there are no old Java classes that haven't been deleted 
> by SVN (run 'svn stat' on your working copy) and then run 'mvn clean'. 
> As a next step I suggest that you remove all org.apache.cocoon artifacts 
> from your local repository and finally run 'mvn install 
> -Dmaven.test.skip=true'. This should make sure that your classpath 
> doesn't contain any unwanted classes. HTH

I tried it few times, even checking classpath and I still get the same error :(
I'll try to downgrade my Java version or try it on another machine...

-- 
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/

Re: svn commit: r552371 - trunk broken, help needed

Posted by Reinhard Poetz <re...@apache.org>.
Grzegorz Kossakowski wrote:
> gkossakowski@apache.org pisze:
>> Author: gkossakowski
>> Date: Sun Jul  1 16:13:44 2007
>> New Revision: 552371
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=552371
>> Log:
>> COCOON-2082: Getting rid of Avalon dependencies, it includes:
>> * conversion JS, JXPath and JEXL compilers to Spring beans
>> * conversion DefaultExpressionFactory to Spring bean, it collects 
>> language compilers by using bean-map from Spring configurator
> 
> As you see, I'm in between of Avalon->Spring conversion process for 
> expression languages. I have not moved and adjusted tests (thus build 
> will fail) because I came across very obscure problem.
> 
> First of all I would like you to ask to do svn up and mvn clean install 
> -Dmaven.test.skip=true for trunk, run cocoon-webapp, access 
> http://localhost:8888/blocks/cocoon-template-sample/view/caching2
> and check if you get following error:
> TypeError: Cannot read property "parameters" from undefined (#1)
> 
> I would be grateful for any reports to be sure if it's not a JDK issue 
> or so. Also, any help with sorting this out is really appreciated 
> because I'm really out of ideas how to track such a weird problem. 
> Details below.

I'm not sure if it is really a JDK issue. I guess that your setup got messed up 
by your refactorings. After fixing the compilation error (see my commit) I was 
able to run the cocoon-template-sample using the webapp produced by the rcl goal 
(I checked in the configuration) of the Cocoon Maven plugin with Java 5 
(1.5.0_11) without a problem.

Make sure that there are no old Java classes that haven't been deleted by SVN 
(run 'svn stat' on your working copy) and then run 'mvn clean'. As a next step I 
suggest that you remove all org.apache.cocoon artifacts from your local 
repository and finally run 'mvn install -Dmaven.test.skip=true'. This should 
make sure that your classpath doesn't contain any unwanted classes. HTH

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------

Re: svn commit: r552371 - trunk broken, help needed

Posted by Grzegorz Kossakowski <gk...@apache.org>.
gkossakowski@apache.org pisze:
> Author: gkossakowski
> Date: Sun Jul  1 16:13:44 2007
> New Revision: 552371
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=552371
> Log:
> COCOON-2082: Getting rid of Avalon dependencies, it includes:
> * conversion JS, JXPath and JEXL compilers to Spring beans
> * conversion DefaultExpressionFactory to Spring bean, it collects language compilers by using bean-map from Spring configurator

As you see, I'm in between of Avalon->Spring conversion process for expression languages. I have not moved and adjusted tests (thus build 
will fail) because I came across very obscure problem.

First of all I would like you to ask to do svn up and mvn clean install -Dmaven.test.skip=true for trunk, run cocoon-webapp, access 
http://localhost:8888/blocks/cocoon-template-sample/view/caching2
and check if you get following error:
TypeError: Cannot read property "parameters" from undefined (#1)

I would be grateful for any reports to be sure if it's not a JDK issue or so. Also, any help with sorting this out is really appreciated 
because I'm really out of ideas how to track such a weird problem. Details below.


After conversion (changes in r552371) ExpressionContext creation is slightly broken. Take a look at 
TemplateObjectModelHelper#getTemplateObjectModel method, the most interesting fragment is line:

cocoon.put("settings", (Settings)WebAppContextUtils.getCurrentWebApplicationContext().getBean(Settings.ROLE));

Cocoon object is normal Java's HashMap, so it seems that there should happen nothing fancy. As you guess, something weird happens, though ;)
More specifically, this put breaks completely cocoon object. Inspection in debugger of this object shows that before put operation mentioned 
above everything looks ok and just after keys of HashMap are getting out of sync of values (table). In a fact, the table of values contains 
3 items (and is lacking request object, that explains an exception) and keySet contains 4 items (including request). Moreover, if I change 
key from "settings" to something else like "test", cocoon object is less broken (table includes request) but if you iterate the cocoon 
object you will never reach the request object.

All of that is really weird for me and I guess I lack enough Java skills to sort that out so I appreciate any help. If this problem is not 
fixed soon I'm going to revert my changes to not keep trunk in broken state.

-- 
Grzegorz Kossakowski
http://reflectingonthevicissitudes.wordpress.com/