Author: apetrelli
Date: Fri May  9 08:15:42 2008
New Revision: 654850

URL: http://svn.apache.org/viewvc?rev=654850&view=rev
Log:
TILES-268
Fixed call to Tomcat 6.

TILES-269
Removed useless code and moved a class.
Now the classes follow Checkstyle rules.

Added:
    
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELContextImpl.java
      - copied, changed from r654818, 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/lang/ELContextImpl.java
Removed:
    
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/el/
    
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/
Modified:
    
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELAttributeEvaluator.java
    
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/TomcatExpressionFactoryFactory.java
    
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextBeanELResolverTest.java
    
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextELResolverTest.java
    
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java
    tiles/framework/trunk/tiles-test/pom.xml

Modified: 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELAttributeEvaluator.java
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELAttributeEvaluator.java?rev=654850&r1=654849&r2=654850&view=diff
==============================================================================
--- 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELAttributeEvaluator.java
 (original)
+++ 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELAttributeEvaluator.java
 Fri May  9 08:15:42 2008
@@ -36,7 +36,6 @@
 import org.apache.tiles.awareness.TilesApplicationContextAware;
 import org.apache.tiles.context.TilesRequestContext;
 import org.apache.tiles.evaluator.AttributeEvaluator;
-import org.apache.tiles.evaluator.el.tomcat.jasper.el.lang.ELContextImpl;
 import org.apache.tiles.util.ClassUtil;
 
 /**

Copied: 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELContextImpl.java
 (from r654818, 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/lang/ELContextImpl.java)
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELContextImpl.java?p2=tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELContextImpl.java&p1=tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/lang/ELContextImpl.java&r1=654818&r2=654850&rev=654850&view=diff
==============================================================================
--- 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/tomcat/jasper/el/lang/ELContextImpl.java
 (original)
+++ 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/ELContextImpl.java
 Fri May  9 08:15:42 2008
@@ -1,20 +1,25 @@
 /*
- * 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.
+ * $Id$
+ *
+ * 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.
  */
-package org.apache.tiles.evaluator.el.tomcat.jasper.el.lang;
+
+package org.apache.tiles.evaluator.el;
 
 import java.lang.reflect.Method;
 import java.util.HashMap;
@@ -27,22 +32,33 @@
 import javax.el.VariableMapper;
 
 /**
- * Implementation of ELContext
- * 
- * @author Jacob Hookom
+ * Implementation of ELContext.<br>
+ * Copied from Apache Tomcat 6.0.16 source code.
+ *
+ * @since 2.1.0
  */
 public final class ELContextImpl extends ELContext {
 
-    private final static FunctionMapper NullFunctionMapper = new 
FunctionMapper() {
+    /**
+     * A null function mapper.
+     */
+    private static final FunctionMapper NULL_FUNCTION_MAPPER = new 
FunctionMapper() {
         public Method resolveFunction(String prefix, String localName) {
             return null;
         }
     };
 
-    private final static class VariableMapperImpl extends VariableMapper {
-
+    /**
+     * Default implementation for the variable mapper.
+     */
+    private static final class VariableMapperImpl extends VariableMapper {
+
+        /**
+         * The mapped variables.
+         */
         private Map<String, ValueExpression> vars;
 
+        /** [EMAIL PROTECTED] */
         public ValueExpression resolveVariable(String variable) {
             if (vars == null) {
                 return null;
@@ -50,33 +66,52 @@
             return vars.get(variable);
         }
 
+        /** [EMAIL PROTECTED] */
         public ValueExpression setVariable(String variable,
                 ValueExpression expression) {
-            if (vars == null)
+            if (vars == null) {
                 vars = new HashMap<String, ValueExpression>();
+            }
             return vars.put(variable, expression);
         }
 
     }
 
+    /**
+     * The EL resolver to use.
+     */
     private final ELResolver resolver;
 
-    private FunctionMapper functionMapper = NullFunctionMapper; // immutable
-
+    /**
+     * The function mapper to use.
+     */
+    private FunctionMapper functionMapper = NULL_FUNCTION_MAPPER;
+
+    /**
+     * The variable mapper to use.
+     */
     private VariableMapper variableMapper;
 
+    /**
+     * Constructor.
+     *
+     * @param resolver The resolver to use.
+     */
     public ELContextImpl(ELResolver resolver) {
         this.resolver = resolver;
     }
 
+    /** [EMAIL PROTECTED] */
     public ELResolver getELResolver() {
         return this.resolver;
     }
 
+    /** [EMAIL PROTECTED] */
     public FunctionMapper getFunctionMapper() {
         return this.functionMapper;
     }
 
+    /** [EMAIL PROTECTED] */
     public VariableMapper getVariableMapper() {
         if (this.variableMapper == null) {
             this.variableMapper = new VariableMapperImpl();
@@ -84,12 +119,21 @@
         return this.variableMapper;
     }
 
+    /**
+     * Sets the function mapper to use.
+     *
+     * @param functionMapper The function mapper.
+     */
     public void setFunctionMapper(FunctionMapper functionMapper) {
         this.functionMapper = functionMapper;
     }
 
+    /**
+     * Sets the variable mapper to use.
+     *
+     * @param variableMapper The variable mapper.
+     */
     public void setVariableMapper(VariableMapper variableMapper) {
         this.variableMapper = variableMapper;
     }
-
 }

Modified: 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/TomcatExpressionFactoryFactory.java
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/TomcatExpressionFactoryFactory.java?rev=654850&r1=654849&r2=654850&view=diff
==============================================================================
--- 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/TomcatExpressionFactoryFactory.java
 (original)
+++ 
tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/evaluator/el/TomcatExpressionFactoryFactory.java
 Fri May  9 08:15:42 2008
@@ -1,11 +1,39 @@
+/*
+ * $Id$
+ *
+ * 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.
+ */
+
 package org.apache.tiles.evaluator.el;
 
 import javax.el.ExpressionFactory;
 
 import org.apache.el.ExpressionFactoryImpl;
 
+/**
+ * Creates an expression factory using Tomcat's Jasper engine.
+ *
+ * @version $Rev$ $Date$
+ * @since 2.1.0
+ */
 public class TomcatExpressionFactoryFactory implements 
ExpressionFactoryFactory {
 
+    /** [EMAIL PROTECTED] */
     public ExpressionFactory getExpressionFactory() {
         return new ExpressionFactoryImpl();
     }

Modified: 
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextBeanELResolverTest.java
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextBeanELResolverTest.java?rev=654850&r1=654849&r2=654850&view=diff
==============================================================================
--- 
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextBeanELResolverTest.java
 (original)
+++ 
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextBeanELResolverTest.java
 Fri May  9 08:15:42 2008
@@ -31,7 +31,6 @@
 
 import org.apache.tiles.TilesApplicationContext;
 import org.apache.tiles.context.TilesRequestContext;
-import org.apache.tiles.evaluator.el.tomcat.jasper.el.lang.ELContextImpl;
 import org.easymock.EasyMock;
 
 import junit.framework.TestCase;

Modified: 
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextELResolverTest.java
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextELResolverTest.java?rev=654850&r1=654849&r2=654850&view=diff
==============================================================================
--- 
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextELResolverTest.java
 (original)
+++ 
tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/evaluator/el/TilesContextELResolverTest.java
 Fri May  9 08:15:42 2008
@@ -35,7 +35,6 @@
 
 import org.apache.tiles.TilesApplicationContext;
 import org.apache.tiles.context.TilesRequestContext;
-import org.apache.tiles.evaluator.el.tomcat.jasper.el.lang.ELContextImpl;
 import org.easymock.EasyMock;
 
 /**

Modified: 
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java?rev=654850&r1=654849&r2=654850&view=diff
==============================================================================
--- 
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java
 (original)
+++ 
tiles/framework/trunk/tiles-jsp/src/main/java/org/apache/tiles/jsp/context/JspTilesContextFactory.java
 Fri May  9 08:15:42 2008
@@ -69,13 +69,9 @@
      *
      * @param context The application context.
      * @return The original servlet context, if found.
+     * @deprecated Use [EMAIL PROTECTED] TilesApplicationContext#getContext()}.
      */
     protected ServletContext getServletContext(TilesApplicationContext 
context) {
-        if (context instanceof ServletTilesApplicationContext) {
-            ServletTilesApplicationContext app = 
(ServletTilesApplicationContext) context;
-            return app.getServletContext();
-        }
-        return null;
-
+        return (ServletContext) context.getContext();
     }
 }

Modified: tiles/framework/trunk/tiles-test/pom.xml
URL: 
http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/pom.xml?rev=654850&r1=654849&r2=654850&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-test/pom.xml (original)
+++ tiles/framework/trunk/tiles-test/pom.xml Fri May  9 08:15:42 2008
@@ -110,12 +110,12 @@
                <configuration>
                    <container>
                        <containerId>tomcat6x</containerId>
-                       <home>${cargo.tomcat5x.home}</home>
-                       <log>${project.build.directory}/tomcat5x.log</log>
-                       <output>${project.build.directory}/tomcat5x.out</output>
+                       <home>${cargo.tomcat6x.home}</home>
+                       <log>${project.build.directory}/tomcat6x.log</log>
+                       <output>${project.build.directory}/tomcat6x.out</output>
                    </container>
                    <configuration>
-                       <home>${project.build.directory}/tomcat5x</home>
+                       <home>${project.build.directory}/tomcat6x</home>
                    </configuration>
                </configuration>
            </plugin>


Reply via email to