commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hen...@apache.org
Subject svn commit: r885553 [1/2] - in /commons/proper/jexl/trunk: src/main/java/org/apache/commons/jexl2/ src/main/java/org/apache/commons/jexl2/introspection/ src/main/java/org/apache/commons/jexl2/parser/ src/main/java/org/apache/commons/jexl2/scripting/ sr...
Date Mon, 30 Nov 2009 19:28:41 GMT
Author: henrib
Date: Mon Nov 30 19:28:40 2009
New Revision: 885553

URL: http://svn.apache.org/viewvc?rev=885553&view=rev
Log:
JEXL-92: follow up on Rahul's comments (JexlContext exposes set/get/has);
moved JexlContext.Mapped as MapContext;
moved Uberspect & related classes to oac.jexl2.introspection;
moved DebugInfo & JexlInfo to oac.jexl2

Added:
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/DebugInfo.java
      - copied, changed from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/Info.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlInfo.java
      - copied, changed from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/DebugInfo.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/MapContext.java   (with props)
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java
      - copied, changed from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlMethod.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java
      - copied, changed from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlPropertyGet.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java
      - copied, changed from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlPropertySet.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Uberspect.java
      - copied, changed from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/Uberspect.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/UberspectImpl.java
      - copied, changed from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/UberspectImpl.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html   (with props)
Removed:
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/DebugInfo.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/Info.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/Introspector.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlMethod.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlPropertyGet.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlPropertySet.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/Uberspect.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/UberspectImpl.java
Modified:
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlContext.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlException.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Main.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/package.html
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/JexlNode.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/Parser.jjt
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngine.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/AbstractExecutor.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/Introspector.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/IntrospectorBase.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/package.html
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ArithmeticTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ArrayLiteralTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/AssignTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/BlockTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/CacheTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ClassCreatorTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ForEachTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/IfTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/IssuesTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/Jexl.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/JexlTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/MapLiteralTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/MethodTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ScriptTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/UnifiedJEXLTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/WhileTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/examples/ArrayTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/examples/MethodPropertyTest.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/junit/Asserter.java
    commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/util/introspection/DiscoveryTest.java
    commons/proper/jexl/trunk/xdocs/index.xml
    commons/proper/jexl/trunk/xdocs/reference/examples.xml

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/DebugInfo.java (from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/Info.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/DebugInfo.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/DebugInfo.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/Info.java&r1=884622&r2=885553&rev=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/Info.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/DebugInfo.java Mon Nov 30 19:28:40 2009
@@ -14,19 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2.util.introspection;
+package org.apache.commons.jexl2;
+
 
 /**
- * Little class to carry in info such as a file or template name, line and column for
+ * Little class to carry in info such as a url/file name, line and column for
  * information error reporting from the uberspector implementations.
- * <p>
- * Originally taken from Velocity for self-sufficiency.
- * </p>
- * @since 1.0
- * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
  * @version $Id$
  */
-public class Info implements DebugInfo {
+public class DebugInfo implements JexlInfo {
     /** line number. */
     private final int line;
     /** column number. */
@@ -39,7 +35,7 @@
      * @param l line number
      * @param c column
      */
-    public Info(String tn, int l, int c) {
+    public DebugInfo(String tn, int l, int c) {
         name = tn;
         line = l;
         column = c;
@@ -77,16 +73,6 @@
     }
 
     /**
-     * Gets the template name.
-     * @return template name
-     * @deprecated Use {@link #getName()} instead
-     */
-    @Deprecated
-    public String getTemplateName() {
-        return name;
-    }
-
-    /**
      * Gets the line number.
      * @return line number.
      */

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java Mon Nov 30 19:28:40 2009
@@ -79,10 +79,10 @@
 import org.apache.commons.jexl2.parser.ParserVisitor;
 
 import org.apache.commons.jexl2.util.AbstractExecutor;
-import org.apache.commons.jexl2.util.introspection.Uberspect;
-import org.apache.commons.jexl2.util.introspection.JexlMethod;
-import org.apache.commons.jexl2.util.introspection.JexlPropertyGet;
-import org.apache.commons.jexl2.util.introspection.JexlPropertySet;
+import org.apache.commons.jexl2.introspection.Uberspect;
+import org.apache.commons.jexl2.introspection.JexlMethod;
+import org.apache.commons.jexl2.introspection.JexlPropertyGet;
+import org.apache.commons.jexl2.introspection.JexlPropertySet;
 
 /**
  * An interpreter of JEXL syntax.
@@ -360,7 +360,7 @@
                     variableName.append('.');
                     variableName.append(left.jjtGetChild(v).image);
                 }
-                object = context.getJexlVariable(variableName.toString());
+                object = context.get(variableName.toString());
                 // disallow mixing ant & bean with same root; avoid ambiguity
                 if (object != null) {
                     isVariable = false;
@@ -382,7 +382,7 @@
                     variableName.append(property);
                     property = variableName.toString();
                 }
-                context.setJexlVariable(String.valueOf(property), right);
+                context.set(String.valueOf(property), right);
                 return right;
             }
         } else if (propertyNode instanceof ASTIntegerLiteral) {
@@ -396,7 +396,7 @@
                     variableName.append(property);
                     property = variableName.toString();
                 }
-                context.setJexlVariable(String.valueOf(property), right);
+                context.set(String.valueOf(property), right);
                 return right;
             }
         } else if (propertyNode instanceof ASTArrayAccess) {
@@ -581,12 +581,14 @@
             // get an iterator for the collection/array etc via the
             // introspector.
             Iterator<?> itemsIterator = getUberspect().getIterator(iterableValue, node);
-            while (itemsIterator.hasNext()) {
-                // set loopVariable to value of iterator
-                Object value = itemsIterator.next();
-                context.setJexlVariable(loopVariable.image, value);
-                // execute statement
-                result = statement.jjtAccept(this, data);
+            if (itemsIterator != null) {
+                while (itemsIterator.hasNext()) {
+                    // set loopVariable to value of iterator
+                    Object value = itemsIterator.next();
+                    context.set(loopVariable.image, value);
+                    // execute statement
+                    result = statement.jjtAccept(this, data);
+                }
             }
         }
         return result;
@@ -626,10 +628,10 @@
                     return registers[3];
                 }
             }
-            Object value = context.getJexlVariable(name);
+            Object value = context.get(name);
             if (value == null
                 && !(node.jjtGetParent() instanceof ASTReference)
-                && JexlEngine.isVariableUndefined(context, name)) {
+                && !context.has(name)) {
                 JexlException xjexl = new JexlException(node, "undefined variable " + name);
                 return unknownVariable(xjexl);
             }
@@ -991,13 +993,13 @@
                     variableName.append('.');
                     variableName.append(node.jjtGetChild(v).image);
                 }
-                result = context.getJexlVariable(variableName.toString());
+                result = context.get(variableName.toString());
             }
         }
         if (result == null) {
             if (isVariable
                 && !(node.jjtGetParent() instanceof ASTTernaryNode)
-                && JexlEngine.isVariableUndefined(context, variableName.toString())) {
+                && !context.has(variableName.toString())) {
                 JexlException xjexl = new JexlException(node, "undefined variable " + variableName.toString());
                 return unknownVariable(xjexl);
             }

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlContext.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlContext.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlContext.java Mon Nov 30 19:28:40 2009
@@ -16,9 +16,6 @@
  */
 package org.apache.commons.jexl2;
 
-import java.util.HashMap;
-import java.util.Map;
-
 /**
  * Manages variables which can be referenced in a JEXL expression.
  *
@@ -31,69 +28,21 @@
      * @param name the variable's name
      * @return the value
      */
-    Object getJexlVariable(String name);
+    Object get(String name);
 
     /**
      * Sets the value of a variable.
      * @param name the variable's name
      * @param value the variable's value
      */
-    void setJexlVariable(String name, Object value);
+    void set(String name, Object value);
 
     /**
-     * A context that differentiates null valued variables and undefined ones.
-     * <p>A non-nullable context does not allow differentiating a variable whose
-     * value is null and an undefined one; thus the Nullable name for this kind of context.</p>
-     */
-    public interface Nullable extends JexlContext {
-        /**
-         * Checks whether a variable is defined in this context.
-         * <p>A variable may be defined with a null value; this method checks whether the
-         * value is null or if the variable is undefined.</p>
-         * @param name the variable's name
-         * @return true if it exists, false otherwise
-         */
-        boolean definesJexlVariable(String name);
-    }
-
-    /**
-     * Wraps a map in a context.
-     * <p>Each entry in the map is considered a variable name, value pair.</p>
+     * Checks whether a variable is defined in this context.
+     * <p>A variable may be defined with a null value; this method checks whether the
+     * value is null or if the variable is undefined.</p>
+     * @param name the variable's name
+     * @return true if it exists, false otherwise
      */
-    public static class Mapped implements Nullable {
-        /**
-         * The wrapped variable map.
-         */
-        protected final Map<Object,Object> map;
-        /**
-         * Creates an instance using an HashMap as the underlying variable storage.
-         */
-        public Mapped() {
-            this(null);
-        }
-        /**
-         * Creates an instance using a provided map as the underlying variable storage.
-         * @param vars the variables map
-         */
-        @SuppressWarnings("unchecked") // OK to cast Map<?,?> to Map<Object,Object>
-        public Mapped(Map<?, ?> vars) {
-            map = (Map<Object,Object>) (vars == null? new HashMap<String,Object>() : vars);
-        }
-
-        /** {@inheritDoc} */
-        public boolean definesJexlVariable(String name) {
-            return map.containsKey(name);
-        }
-
-        /** {@inheritDoc} */
-        public Object getJexlVariable(String name) {
-            return map.get(name);
-        }
-
-        /** {@inheritDoc} */
-        public void setJexlVariable(String name, Object value) {
-            map.put(name, value);
-        }
-    }
-
+    boolean has(String name);
 }

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlEngine.java Mon Nov 30 19:28:40 2009
@@ -39,10 +39,10 @@
 import org.apache.commons.jexl2.parser.JexlNode;
 import org.apache.commons.jexl2.parser.TokenMgrError;
 import org.apache.commons.jexl2.parser.ASTJexlScript;
-import org.apache.commons.jexl2.util.Introspector;
-import org.apache.commons.jexl2.util.introspection.Uberspect;
-import org.apache.commons.jexl2.util.introspection.Info;
-import org.apache.commons.jexl2.util.introspection.JexlMethod;
+
+import org.apache.commons.jexl2.introspection.Uberspect;
+import org.apache.commons.jexl2.introspection.UberspectImpl;
+import org.apache.commons.jexl2.introspection.JexlMethod;
 
 /**
  * <p>
@@ -88,39 +88,39 @@
  * @since 2.0
  */
 public class JexlEngine {    
-
-    /**
-     * Checks whether a variable is defined in a context.
-     * @param context the context
-     * @param name the variable's name
-     * @return true if the variable is defined, false otherwise
-     */
-    protected static boolean isVariableUndefined(JexlContext context, String name) {
-        if (context instanceof JexlContext.Nullable) {
-            return !((JexlContext.Nullable) context).definesJexlVariable(name);
-        }
-        return context.getJexlVariable(name) == null;
-    }
-    
     /**
      * An empty/static/non-mutable JexlContext used instead of null context.
      */
-    protected static final JexlContext EMPTY_CONTEXT = new JexlContext.Nullable() {
+    protected static final JexlContext EMPTY_CONTEXT = new JexlContext() {
         /** {@inheritDoc} */
-        public Object getJexlVariable(String name) {
+        public Object get(String name) {
             return null;
         }
         /** {@inheritDoc} */
-        public boolean definesJexlVariable(String name) {
+        public boolean has(String name) {
             return false;
         }
         /** {@inheritDoc} */
-        public void setJexlVariable(String name, Object value) {
+        public void set(String name, Object value) {
             throw new UnsupportedOperationException("Not supported in void context.");
         }
     };
 
     /**
+     *  Gets the default instance of Uberspect.
+     * <p>This is lazily initialized to avoid building a default instance if there
+     * is no use for it. The main reason for not using the default Uberspect instance is to
+     * be able to use a (low level) introspector created with a given logger
+     * instead of the default one.</p>
+     * <p>Implemented as on demand holder idiom.</p>
+     *  @return Uberspect the default uberspector instance.
+     */
+    private static class UberspectHolder {
+        /** The default uberspector that handles all introspection patterns. */
+        private static final Uberspect UBERSPECT = new UberspectImpl(LogFactory.getLog(JexlEngine.class));
+    }
+    
+    /**
      * The Uberspect instance.
      */
     protected final Uberspect uberspect;
@@ -176,20 +176,42 @@
      * @param log the logger for various messages
      */
     public JexlEngine(Uberspect anUberspect, JexlArithmetic anArithmetic, Map<String, Object> theFunctions, Log log) {
+        this.uberspect = anUberspect == null ? getUberspect(log) : anUberspect;
         if (log == null) {
             log = LogFactory.getLog(JexlEngine.class);
         }
-        if (log == null) {
-            throw new NullPointerException("logger can not be null");
-        }
         this.logger = log;
-        this.uberspect = anUberspect == null ? Introspector.getUberspect(log) : anUberspect;
         this.arithmetic = anArithmetic == null ? new JexlArithmetic(true) : anArithmetic;
         if (theFunctions != null) {
             this.functions = theFunctions;
         }
     }
 
+
+    /**
+     *  Gets the default instance of Uberspect.
+     * <p>This is lazily initialized to avoid building a default instance if there
+     * is no use for it. The main reason for not using the default Uberspect instance is to
+     * be able to use a (low level) introspector created with a given logger
+     * instead of the default one.</p>
+     * @param logger the logger to use for the underlying Uberspect
+     * @return Uberspect the default uberspector instance.
+     */
+    public static Uberspect getUberspect(Log logger) {
+        if (logger == null || logger.equals(LogFactory.getLog(JexlEngine.class))) {
+            return UberspectHolder.UBERSPECT;
+        }
+        return new UberspectImpl(logger);
+    }
+
+    /**
+     * Gets this engine underlying uberspect.
+     * @return the uberspect
+     */
+    public Uberspect getUberspect() {
+        return uberspect;
+    }
+
     /**
      * Sets whether this engine reports debugging information when error occurs.
      * <p>This method is <em>not</em> thread safe; it should be called as an optional step of the JexlEngine
@@ -259,7 +281,7 @@
      * @param loader the class loader to use
      */
     public void setClassLoader(ClassLoader loader) {
-        uberspect.getIntrospector().setLoader(loader);
+        uberspect.setClassLoader(loader);
     }
 
     /**
@@ -340,7 +362,7 @@
      *      parsing this expression, or if the expression is neither an
      *      expression or a reference.
      */
-    public Expression createExpression(String expression, Info info) {
+    public Expression createExpression(String expression, JexlInfo info) {
         // Parse the expression
         ASTJexlScript tree = parse(expression, info);
         if (tree.jjtGetNumChildren() > 1) {
@@ -371,7 +393,7 @@
      * @return A {@link Script} which can be executed using a {@link JexlContext}.
      * @throws JexlException if there is a problem parsing the script.
      */
-    public Script createScript(String scriptText, Info info) {
+    public Script createScript(String scriptText, JexlInfo info) {
         if (scriptText == null) {
             throw new NullPointerException("scriptText is null");
         }
@@ -399,9 +421,9 @@
             throw new IOException("Can't read scriptFile (" + scriptFile.getCanonicalPath() + ")");
         }
         BufferedReader reader = new BufferedReader(new FileReader(scriptFile));
-        Info info = null;
+        JexlInfo info = null;
         if (debug) {
-            info = new Info(scriptFile.getName(), 0, 0);
+            info = createInfo(scriptFile.getName(), 0, 0);
         }
         return createScript(readerToString(reader), info);
 
@@ -426,9 +448,9 @@
 
         BufferedReader reader = new BufferedReader(
                 new InputStreamReader(connection.getInputStream()));
-        Info info = null;
+        JexlInfo info = null;
         if (debug) {
-            info = new Info(scriptUrl.toString(), 0, 0);
+            info = createInfo(scriptUrl.toString(), 0, 0);
         }
         return createScript(readerToString(reader), info);
     }
@@ -468,7 +490,7 @@
         }
         // lets build 1 unique & unused identifiers wrt context
         String r0 = "$0";
-        for (int s = 0; !isVariableUndefined(context, r0); ++s) {
+        for (int s = 0; context.has(r0); ++s) {
             r0 = r0 + s;
         }
         expr = r0 + (expr.charAt(0) == '[' ? "" : ".") + expr + ";";
@@ -524,10 +546,10 @@
         }
         // lets build 2 unique & unused identifiers wrt context
         String r0 = "$0", r1 = "$1";
-        for (int s = 0; !isVariableUndefined(context, r0); ++s) {
+        for (int s = 0; context.has(r0); ++s) {
             r0 = r0 + s;
         }
-        for (int s = 0; !isVariableUndefined(context, r1); ++s) {
+        for (int s = 0; context.has(r1); ++s) {
             r1 = r1 + s;
         }
         // synthetize expr
@@ -560,7 +582,7 @@
     public Object invokeMethod(Object obj, String meth, Object... args) {
         JexlException xjexl = null;
         Object result = null;
-        Info info = debugInfo();
+        JexlInfo info = debugInfo();
         try {
             JexlMethod method = uberspect.getMethod(obj, meth, args, info);
             if (method == null && arithmetic.narrowArguments(args)) {
@@ -618,7 +640,7 @@
     protected Object doCreateInstance(Object clazz, Object...args) {
         JexlException xjexl = null;
         Object result = null;
-        Info info = debugInfo();
+        JexlInfo info = debugInfo();
         try {
             Constructor<?> ctor = uberspect.getConstructor(clazz, args, info);
             if (ctor == null && arithmetic.narrowArguments(args)) {
@@ -748,7 +770,7 @@
      * @return the parsed tree
      * @throws JexlException if any error occured during parsing
      */
-    protected ASTJexlScript parse(CharSequence expression, Info info) {
+    protected ASTJexlScript parse(CharSequence expression, JexlInfo info) {
         String expr = cleanExpression(expression);
         ASTJexlScript tree = null;
         synchronized (parser) {
@@ -778,13 +800,24 @@
     }
 
     /**
+     * Creates a JexlInfo instance.
+     * @param fn url/file name
+     * @param l line number
+     * @param c column number
+     * @return a JexlInfo instance
+     */
+    protected JexlInfo createInfo(String fn, int l, int c) {
+        return new DebugInfo(fn, l, c);
+    }
+
+    /**
      * Creates and fills up debugging information.
      * <p>This gathers the class, method and line number of the first calling method
      * not owned by JexlEngine, UnifiedJEXL or {Script,Expression}Factory.</p>
      * @return an Info if debug is set, null otherwise
      */
-    protected Info debugInfo() {
-        Info info = null;
+    protected JexlInfo debugInfo() {
+        JexlInfo info = null;
         if (debug) {
             Throwable xinfo = new Throwable();
             xinfo.fillInStackTrace();
@@ -810,7 +843,7 @@
                 }
             }
             if (se != null) {
-                info = new Info(se.getClassName() + "." + se.getMethodName(), se.getLineNumber(), 0);
+                info = createInfo(se.getClassName() + "." + se.getMethodName(), se.getLineNumber(), 0);
             }
         }
         return info;

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlException.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlException.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlException.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlException.java Mon Nov 30 19:28:40 2009
@@ -17,7 +17,6 @@
 package org.apache.commons.jexl2;
 
 import org.apache.commons.jexl2.parser.JexlNode;
-import org.apache.commons.jexl2.util.introspection.Info;
 
 /**
  * Wraps any error that might occur during interpretation of a script or expression.
@@ -29,7 +28,7 @@
     /** The point of origin for this exception. */
     protected final JexlNode mark;
     /** The debug info. */
-    protected final Info info;
+    protected final JexlInfo info;
     /** A marker to use in NPEs stating a null operand error. */
     public static final String NULL_OPERAND = "jexl.null";
     /**
@@ -61,7 +60,7 @@
      * @param dbg the debugging information associated
      * @param msg the error message
      */
-    public JexlException(Info dbg, String msg) {
+    public JexlException(JexlInfo dbg, String msg) {
         super(msg);
         mark = null;
         info = dbg;
@@ -73,7 +72,7 @@
      * @param msg the error message
      * @param cause the exception causing the error
      */
-    public JexlException(Info dbg, String msg, Throwable cause) {
+    public JexlException(JexlInfo dbg, String msg, Throwable cause) {
         super(msg, cause);
         mark = null;
         info = dbg;

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlInfo.java (from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/DebugInfo.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlInfo.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlInfo.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/DebugInfo.java&r1=884622&r2=885553&rev=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/DebugInfo.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlInfo.java Mon Nov 30 19:28:40 2009
@@ -14,20 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.jexl2.util.introspection;
+package org.apache.commons.jexl2;
 
 /**
- * A little class to abstract debugging info.
+ * Interface for objects carrying information usefull to debugging.
+ * @since 1.0
  */
-public interface DebugInfo {
-    /** A default debug info with (oviously) no information. */
-    DebugInfo NONE = new DebugInfo() {
-        public String debugString() {
-            return "?@?:?";
-        }
-    };
+public interface JexlInfo {
     /**
-     * Formats this information.
+     * Formats this information for debugging purpose.
      * @return a human readable string.
      */
     String debugString();

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Main.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Main.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Main.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Main.java Mon Nov 30 19:28:40 2009
@@ -43,8 +43,8 @@
      */
     public static void main(String[] args) throws Exception {
         JexlEngine engine = new JexlEngine();
-        JexlContext context = new JexlContext.Mapped();
-        context.setJexlVariable("args", args);
+        JexlContext context = new MapContext();
+        context.set("args", args);
         if (args.length == 1) {
             Script script = engine.createScript(new File(args[0]));
             Object value = script.execute(context);

Added: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/MapContext.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/MapContext.java?rev=885553&view=auto
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/MapContext.java (added)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/MapContext.java Mon Nov 30 19:28:40 2009
@@ -0,0 +1,62 @@
+/*
+ * 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.commons.jexl2;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Wraps a map in a context.
+ * <p>Each entry in the map is considered a variable name, value pair.</p>
+ */
+public class MapContext implements JexlContext {
+    /**
+     * The wrapped variable map.
+     */
+    protected final Map<String, Object> map;
+
+    /**
+     * Creates a MapContext on an automatically allocated underlying HashMap.
+     */
+    public MapContext() {
+        this(null);
+    }
+
+    /**
+     * Creates a MapContext wrapping an existing user provided map.
+     * @param vars the variable map
+     */
+    public MapContext(Map<String, Object> vars) {
+        super();
+        map = vars == null ? new HashMap<String, Object>() : vars;
+    }
+
+    /** {@inheritDoc} */
+    public boolean has(String name) {
+        return map.containsKey(name);
+    }
+
+    /** {@inheritDoc} */
+    public Object get(String name) {
+        return map.get(name);
+    }
+
+    /** {@inheritDoc} */
+    public void set(String name, Object value) {
+        map.put(name, value);
+    }
+}

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/MapContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/UnifiedJEXL.java Mon Nov 30 19:28:40 2009
@@ -19,7 +19,6 @@
 import java.util.ArrayList;
 import org.apache.commons.jexl2.parser.JexlNode;
 import org.apache.commons.jexl2.parser.StringParser;
-import org.apache.commons.jexl2.util.introspection.Info;
 
 /**
  * An evaluator similar to the Unified EL evaluator used in JSP/JSF based on JEXL.
@@ -801,7 +800,7 @@
      * @return the AST
      * @throws JexlException if an error occur during parsing
      */
-    private JexlNode toNode(CharSequence expression, Info info) {
+    private JexlNode toNode(CharSequence expression, JexlInfo info) {
         return jexl.parse(expression, info);
     }
 

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java (from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlMethod.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlMethod.java&r1=884622&r2=885553&rev=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlMethod.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java Mon Nov 30 19:28:40 2009
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.jexl2.util.introspection;
+package org.apache.commons.jexl2.introspection;
 
 /**
  * Interface used for regular method invocation.
@@ -33,13 +33,13 @@
      * invocation method - called when the method invocation should be performed
      * and a value returned.
 
-     * @param o the object
+     * @param obj the object
      * @param params method parameters.
      * @return the result
      * @throws Exception on any error.
      */
-    Object invoke(Object o, Object[] params) throws Exception;
-
+    Object invoke(Object obj, Object[] params) throws Exception;
+    
     /**
      * specifies if this JexlMethod is cacheable and able to be reused for this
      * class of object it was returned for.

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java (from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlPropertyGet.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlPropertyGet.java&r1=884622&r2=885553&rev=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlPropertyGet.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java Mon Nov 30 19:28:40 2009
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.jexl2.util.introspection;
+package org.apache.commons.jexl2.introspection;
 
 /**
  * Interface for getting values that appear to be properties.
@@ -31,11 +31,11 @@
     /**
      * invocation method - called when the 'get action' should be performed and
      * a value returned.
-     * @param o the object to get the property from.
+     * @param obj the object to get the property from.
      * @return the property value.
      * @throws Exception on any error.
      */
-    Object invoke(Object o) throws Exception;
+    Object invoke(Object obj) throws Exception;
 
     /**
      * Specifies if this JexlPropertyGet is cacheable and able to be reused for

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java (from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlPropertySet.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlPropertySet.java&r1=884622&r2=885553&rev=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/JexlPropertySet.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java Mon Nov 30 19:28:40 2009
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.jexl2.util.introspection;
+package org.apache.commons.jexl2.introspection;
 
 /**
  * Interface used for setting values that appear to be properties.

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Uberspect.java (from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/Uberspect.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Uberspect.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Uberspect.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/Uberspect.java&r1=884622&r2=885553&rev=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/Uberspect.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/Uberspect.java Mon Nov 30 19:28:40 2009
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.jexl2.util.introspection;
+package org.apache.commons.jexl2.introspection;
 
 import java.util.Iterator;
 import java.lang.reflect.Constructor;
+import org.apache.commons.jexl2.JexlInfo;
 
 /**
  * 'Federated' introspection/reflection interface to allow the introspection
@@ -29,18 +30,11 @@
  * @version $Id$
  */
 public interface Uberspect {
-    /** Gets underlying introspector.
-     * @return the introspector
+    /** Sets the class loader to use when getting a constructor with
+     * a class name parameter.
+     * @param loader the class loader
      */
-    Introspector getIntrospector();
-    
-    /**
-     * To support iteratives - #foreach().
-     * @param info template info.
-     * @param obj to get the iterator for.
-     * @return an iterator over obj.
-     */
-    Iterator<?> getIterator(Object obj, DebugInfo info);
+    void setClassLoader(ClassLoader loader);
 
     /**
      * Returns a class constructor.
@@ -49,35 +43,44 @@
      * @param info template info
      * @return a {@link Constructor}.
      */
-    Constructor<?> getConstructor(Object ctorHandle, Object[] args, DebugInfo info);
+    Constructor<?> getConstructor(Object ctorHandle, Object[] args, JexlInfo info);
     /**
-     * Returns a general method, corresponding to $foo.bar( $woogie ).
+     * Returns a JexlMethod.
      * @param obj the object
      * @param method the method name
      * @param args method arguments
      * @param info template info
      * @return a {@link JexlMethod}.
      */
-    JexlMethod getMethod(Object obj, String method, Object[] args, DebugInfo info);
+    JexlMethod getMethod(Object obj, String method, Object[] args, JexlInfo info);
 
     /**
-     * Property getter - returns VelPropertyGet appropos for #set($foo =
-     * $bar.woogie).
+     * Property getter.
+     * <p>Returns JexlPropertyGet appropos for ${bar.woogie}.
      * @param obj the object to get the property from.
      * @param identifier property name
      * @param info template info
      * @return a {@link JexlPropertyGet}.
      */
-    JexlPropertyGet getPropertyGet(Object obj, Object identifier, DebugInfo info);
+    JexlPropertyGet getPropertyGet(Object obj, Object identifier, JexlInfo info);
 
     /**
-     * Property setter - returns VelPropertySet appropos for #set($foo.bar =
-     * "geir").
+     * Property setter.
+     * <p>returns JelPropertySet appropos for ${foo.bar = "geir"}</p>.
      * @param obj the object to get the property from.
      * @param identifier property name
      * @param arg value to set.
      * @param info template info
      * @return a {@link JexlPropertySet}.
      */
-    JexlPropertySet getPropertySet(Object obj, Object identifier, Object arg, DebugInfo info);
+    JexlPropertySet getPropertySet(Object obj, Object identifier, Object arg, JexlInfo info);
+
+    /**
+     * Gets an iterator from an object.
+     * @param obj to get the iterator for.
+     * @param info some info.
+     * @return an iterator over obj.
+     */
+    Iterator<?> getIterator(Object obj, JexlInfo info);
+
 }
\ No newline at end of file

Copied: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/UberspectImpl.java (from r884622, commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/UberspectImpl.java)
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/UberspectImpl.java?p2=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/UberspectImpl.java&p1=commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/UberspectImpl.java&r1=884622&r2=885553&rev=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/UberspectImpl.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/UberspectImpl.java Mon Nov 30 19:28:40 2009
@@ -15,16 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.jexl2.util.introspection;
+package org.apache.commons.jexl2.introspection;
 
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
+import org.apache.commons.jexl2.util.Introspector;
 import java.lang.reflect.Constructor;
-import java.util.Collection;
 import java.util.Enumeration;
 import java.util.Iterator;
-import java.util.Map;
 
+import java.util.Map;
+import org.apache.commons.jexl2.JexlInfo;
+import org.apache.commons.jexl2.JexlException;
+import org.apache.commons.jexl2.util.AbstractExecutor;
 import org.apache.commons.jexl2.util.ArrayIterator;
 import org.apache.commons.jexl2.util.EnumerationIterator;
 import org.apache.commons.logging.Log;
@@ -39,109 +40,74 @@
  * @author <a href="mailto:henning@apache.org">Henning P. Schmiedehausen</a>
  * @version $Id$
  */
-public class UberspectImpl extends org.apache.commons.jexl2.util.Introspector implements Uberspect {
-    /** {@inheritDoc} */
-    public Introspector getIntrospector() {
-        return introspector.get();
-    }
-
+public class UberspectImpl extends Introspector implements Uberspect {
     /**
      * Creates a new UberspectImpl.
      * @param runtimeLogger the logger used for all logging needs
      */
     public UberspectImpl(Log runtimeLogger) {
-        this(runtimeLogger, new Introspector(runtimeLogger));
-    }
-
-    /**
-     * Creates a new UberspectImpl.
-     * @param runtimeLogger the logger used for all logging needs
-     * @param intro the introspector to use
-     */
-    public UberspectImpl(Log runtimeLogger, Introspector intro) {
-        super(runtimeLogger, intro);
+        super(runtimeLogger);
     }
 
     /**
      * {@inheritDoc}
      */
     @SuppressWarnings("unchecked")
-    public Iterator<?> getIterator(Object obj, DebugInfo info) {
+    public Iterator<?> getIterator(Object obj, JexlInfo info) {
+        if (obj instanceof Iterator<?>) {
+            return ((Iterator<?>) obj);
+        }
         if (obj.getClass().isArray()) {
             return new ArrayIterator(obj);
-        } else if (obj instanceof Collection<?>) {
-            return ((Collection<?>) obj).iterator();
-        } else if (obj instanceof Map<?,?>) {
+        }
+        if (obj instanceof Map<?,?>) {
             return ((Map<?,?>) obj).values().iterator();
-        } else if (obj instanceof Iterator<?>) {
-            rlog.warn(info.debugString()
-                    + "The iterative is not resetable; if used more than once, "
-                    + "this may lead to unexpected results.");
-
-            return ((Iterator<?>) obj);
-        } else if (obj instanceof Enumeration<?>) {
-            rlog.warn(info.debugString()
-                    + "The iterative is not resetable; if used more than once, "
-                    + "this may lead to unexpected results.");
+        }
+        if (obj instanceof Enumeration<?>) {
             return new EnumerationIterator<Object>((Enumeration<Object>) obj);
-        } else {
+        }
+        if (obj instanceof Iterable<?>) {
+            return ((Iterable<?>) obj).iterator();
+        }
+        try {
             // look for an iterator() method to support the JDK5 Iterable
             // interface or any user tools/DTOs that want to work in
             // foreach without implementing the Collection interface
-            Class<?> type = obj.getClass();
-            try {
-                Method iter = type.getMethod("iterator", (Class<?>[]) null);
-                Class<?> returns = iter.getReturnType();
-                if (Iterator.class.isAssignableFrom(returns)) {
-                    return (Iterator<?>) iter.invoke(obj, (Object[])null);
-                } else {
-                    rlog.error(info.debugString()
-                            + "iterator() method does not return a true Iterator.");
-                }
-            // CSOFF: EmptyBlock
-            } catch (NoSuchMethodException nsme) {
-                // eat this one, but let all other exceptions thru
-            } catch (IllegalArgumentException e) { // CSON: EmptyBlock
-                throw new RuntimeException(e);
-            } catch (IllegalAccessException e) {
-                throw new RuntimeException(e);
-            } catch (InvocationTargetException e) {
-                throw new RuntimeException(e);
+            AbstractExecutor.Method it = getMethodExecutor(obj, "iterator", null);
+            if (it != null && Iterator.class.isAssignableFrom(it.getReturnType())) {
+                return (Iterator<Object>) it.execute(obj, null);
             }
+        } catch(Exception xany) {
+            throw new JexlException(info, "unable to generate iterator()", xany);
         }
-
-        /*  we have no clue what this is  */
-        rlog.warn(info.toString()
-                + "Could not determine type of iterator");
-
         return null;
     }
 
     /**
      * {@inheritDoc}
      */
-   public Constructor<?> getConstructor(Object ctorHandle, Object[] args, DebugInfo info) {
+   public Constructor<?> getConstructor(Object ctorHandle, Object[] args, JexlInfo info) {
         return getConstructor(ctorHandle, args);
    }
 
     /**
      * {@inheritDoc}
      */
-    public JexlMethod getMethod(Object obj, String method, Object[] args, DebugInfo info) {
+    public JexlMethod getMethod(Object obj, String method, Object[] args, JexlInfo info) {
         return getMethodExecutor(obj, method, args);
     }
 
     /**
      * {@inheritDoc}
      */
-    public JexlPropertyGet getPropertyGet(Object obj, Object identifier, DebugInfo info) {
+    public JexlPropertyGet getPropertyGet(Object obj, Object identifier, JexlInfo info) {
         return getGetExecutor(obj, identifier);
     }
 
     /**
      * {@inheritDoc}
      */
-    public JexlPropertySet getPropertySet(final Object obj, final Object identifier, Object arg, DebugInfo info) {
+    public JexlPropertySet getPropertySet(final Object obj, final Object identifier, Object arg, JexlInfo info) {
         return getSetExecutor(obj, identifier, arg);
     }
 }
\ No newline at end of file

Added: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html?rev=885553&view=auto
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html (added)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html Mon Nov 30 19:28:40 2009
@@ -0,0 +1,35 @@
+<html>
+<!--
+   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.
+-->
+ <head>
+  <title>Package Documentation for org.apache.commons.jexl2.introspection Package</title>
+ </head>
+ <body bgcolor="white">
+  Provides high-level introspective services.
+  <br/>
+  <p>
+  The Uberspect, JexlMethod, JexlPropertyGet and JexlPropertySet interfaces
+  form the exposed face of introspective services.
+  </p>
+  <p>
+  The Uberspectimpl is the concrete class implementing the Uberspect interface.
+  Deriving from this class is the preferred way of augmenting Jexl introspective
+  capabilities when special needs to be fullfilled or when default behaviors
+  need to be modified.
+  </p>
+</body>
+</html>

Propchange: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/package.html
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/package.html?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/package.html (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/package.html Mon Nov 30 19:28:40 2009
@@ -59,7 +59,7 @@
 
             // Create a context and add data
             JexlContext jc = new JexlContext.Mapped();
-            jc.setJexlVariable("foo", new Foo() );
+            jc.set("foo", new Foo() );
 
             // Now evaluate the expression, getting the result
             Object o = e.evaluate(jc);
@@ -135,7 +135,7 @@
             JexlEngine jexl = nex JexlEngine();
 
             JexlContext jc = new JexlContext.Mapped();
-            jc.setJexlVariable("quuxClass", quux.class);
+            jc.set("quuxClass", quux.class);
 
             Expression create = jexl.createExpression("quux = new(quuxClass, 'xuuq', 100)");
             Expression assign = jexl.createExpression("quux.froboz.value = 10");
@@ -220,7 +220,7 @@
             jexl.setFunctions(funcs);
 
             JexlContext jc = new JexlContext.Mapped();
-            jc.setJexlVariable("pi", Math.PI);
+            jc.set("pi", Math.PI);
 
             e = JEXL.createExpression("math:cos(pi)");
             o = e.evaluate(jc);

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/JexlNode.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/JexlNode.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/JexlNode.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/JexlNode.java Mon Nov 30 19:28:40 2009
@@ -16,15 +16,14 @@
  */
 package org.apache.commons.jexl2.parser;
 
-import org.apache.commons.jexl2.util.introspection.Info;
-import org.apache.commons.jexl2.util.introspection.DebugInfo;
+import org.apache.commons.jexl2.JexlInfo;
 
 /**
  * Base class for parser nodes - holds an 'image' of the token for later use.
  *
  * @since 2.0
  */
-public abstract class JexlNode extends SimpleNode implements DebugInfo {
+public abstract class JexlNode extends SimpleNode implements JexlInfo {
     /** token value. */
     public String image;
 
@@ -36,11 +35,11 @@
         super(p, id);
     }
 
-    public Info getInfo() {
+    public JexlInfo getInfo() {
         JexlNode node = this;
         while (node != null) {
-            if (node.value instanceof Info) {
-                return (Info) node.value;
+            if (node.value instanceof JexlInfo) {
+                return (JexlInfo) node.value;
             }
             node = node.jjtGetParent();
         }
@@ -49,7 +48,7 @@
     
     /** {@inheritDoc} */
     public String debugString() {
-        Info info = getInfo();
+        JexlInfo info = getInfo();
         return info != null? info.debugString() : "";
     }
 }

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/Parser.jjt
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/Parser.jjt?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/Parser.jjt (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/Parser.jjt Mon Nov 30 19:28:40 2009
@@ -39,11 +39,11 @@
 package org.apache.commons.jexl2.parser;
 
 import java.io.Reader;
-import org.apache.commons.jexl2.util.introspection.Info;
+import org.apache.commons.jexl2.JexlInfo;
 
 public class Parser extends StringParser
 {
-    public ASTJexlScript parse(Reader reader, Info info)
+    public ASTJexlScript parse(Reader reader, JexlInfo info)
         throws ParseException
     {
         ReInit(reader);

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngine.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngine.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngine.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/JexlScriptEngine.java Mon Nov 30 19:28:40 2009
@@ -159,7 +159,7 @@
      *
      * Current implementation only gives access to ENGINE_SCOPE binding.
      */
-    private static class JexlContextWrapper implements JexlContext.Nullable {
+    private static class JexlContextWrapper implements JexlContext {
         /** The engine context. */
         private final ScriptContext engineContext;
         /**
@@ -172,12 +172,12 @@
         }
 
         /** {@inheritDoc} */
-        public Object getJexlVariable(String name) {
+        public Object get(String name) {
             return engineContext.getAttribute(name);
         }
 
         /** {@inheritDoc} */
-        public void setJexlVariable(String name, Object value) {
+        public void set(String name, Object value) {
             int scope = engineContext.getAttributesScope(name);
             if (scope == -1) { // not found, default to engine
                 scope = ScriptContext.ENGINE_SCOPE;
@@ -186,7 +186,7 @@
         }
 
         /** {@inheritDoc} */
-        public boolean definesJexlVariable(String name) {
+        public boolean has(String name) {
             Bindings bnd = engineContext.getBindings(ScriptContext.ENGINE_SCOPE);
             return bnd.containsKey(name);
         }

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/AbstractExecutor.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/AbstractExecutor.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/AbstractExecutor.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/AbstractExecutor.java Mon Nov 30 19:28:40 2009
@@ -16,9 +16,9 @@
  */
 package org.apache.commons.jexl2.util;
 import org.apache.commons.jexl2.util.introspection.MethodKey;
-import org.apache.commons.jexl2.util.introspection.JexlMethod;
-import org.apache.commons.jexl2.util.introspection.JexlPropertySet;
-import org.apache.commons.jexl2.util.introspection.JexlPropertyGet;
+import org.apache.commons.jexl2.introspection.JexlMethod;
+import org.apache.commons.jexl2.introspection.JexlPropertySet;
+import org.apache.commons.jexl2.introspection.JexlPropertyGet;
 import java.lang.reflect.InvocationTargetException;
 
 /**
@@ -306,8 +306,8 @@
         }
 
         /** {@inheritDoc} */
-        public final Object invoke(Object obj, Object[] args) throws Exception {
-            return execute(obj, args);
+        public final Object invoke(Object obj, Object[] params) throws Exception {
+            return execute(obj, params);
         }
 
         /** {@inheritDoc} */

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/Introspector.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/Introspector.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/Introspector.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/Introspector.java Mon Nov 30 19:28:40 2009
@@ -20,12 +20,10 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Constructor;
 
-import org.apache.commons.jexl2.util.introspection.Uberspect;
-import org.apache.commons.jexl2.util.introspection.UberspectImpl;
+import org.apache.commons.jexl2.util.introspection.IntrospectorBase;
 import org.apache.commons.jexl2.util.introspection.MethodKey;
 
 import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 
 /**
  *  Default introspection services.
@@ -33,103 +31,18 @@
  * @since 1.0
  */
 public class Introspector {
-    
-    private static class UberspectHolder{// Implements init on demand holder idiom
-        /** The default uberspector that handles all introspection patterns. */
-        private static final Uberspect UBERSPECT = new UberspectImpl(LogFactory.getLog(Introspector.class));
-    }
-
     /** The logger to use for all warnings & errors. */
     protected final Log rlog;
-    /** The (low level) introspector to use for introspection services. */
-    protected final Reference introspector;
-
-    /**
-     * A soft reference to an Introspector.
-     * <p>
-     * If memory pressure becomes critical, this will allow the introspector to be GCed;
-     * in turn, classes it introspected that are no longer in use may be GCed as well.
-     * </p>
-     */
-    protected final class Reference {
-        /**
-         * The introspector logger.
-         */
-        private final Log logger;
-        /**
-         * The soft reference to the introspector currently in use.
-         */
-        private volatile SoftReference<org.apache.commons.jexl2.util.introspection.Introspector> ref;
-        /**
-         * Creates a new instance.
-         * @param theLogger logger used by the underlying introspector instance
-         * @param is the underlying introspector instance
-         */
-        protected Reference(Log theLogger, org.apache.commons.jexl2.util.introspection.Introspector is) {
-            logger = theLogger;
-            ref = new SoftReference<org.apache.commons.jexl2.util.introspection.Introspector>(is);
-        }
-
-        /**
-         * Creates a new instance.
-         * @param theLogger logger used by the underlying introspector instance
-         */
-        protected Reference(Log theLogger) {
-            this(theLogger, new org.apache.commons.jexl2.util.introspection.Introspector(theLogger));
-        }
-
-        /**
-         * Gets the current introspector.
-         * <p>If the reference has been collected, this method will recreate the underlying introspector.</p>
-         * @return the introspector
-         */
-        // CSOFF: DoubleCheckedLocking
-        public org.apache.commons.jexl2.util.introspection.Introspector get() {
-            org.apache.commons.jexl2.util.introspection.Introspector intro = ref.get();
-            if (intro == null) {
-                // double checked locking (fixed by Java 5 memory model).
-                synchronized(this) {
-                    intro = ref.get();
-                    if (intro == null) {
-                        intro = new org.apache.commons.jexl2.util.introspection.Introspector(logger);
-                        ref = new SoftReference<org.apache.commons.jexl2.util.introspection.Introspector>(intro);
-                    }
-                }
-            }
-            return intro;
-        }
-        // CSON: DoubleCheckedLocking
-    }
-
-    /**
-     *  Gets the default instance of Uberspect.
-     * <p>This is lazily initialized to avoid building a default instance if there
-     * is no use for it. The main reason for not using the default Uberspect instance is to
-     * be able to use a (low level) introspector created with a given logger
-     * instead of the default one.</p>
-     *  @return Uberspect the default uberspector instance.
-     */
-    public static Uberspect getUberspect() {
-        return UberspectHolder.UBERSPECT;
-    }
-
-    /**
-     * Creates a new instance of Uberspect.
-     * @param logger the logger used by this Uberspect.
-     * @return the new instance
-     */
-    public static Uberspect getUberspect(Log logger) {
-        return new UberspectImpl(logger);
-    }
-
+    /** The soft reference to the introspector currently in use. */
+    private volatile SoftReference<IntrospectorBase> ref;
+    
     /**
      * Creates an introspector.
      * @param log the logger to use for warnings.
-     * @param is the low level introspector.
      */
-    public Introspector(Log log, org.apache.commons.jexl2.util.introspection.Introspector is) {
+    protected Introspector(Log log) {
         rlog = log;
-        introspector = new Reference(log, is);
+        ref = new SoftReference<IntrospectorBase>(null);
     }
 
     /**
@@ -161,6 +74,37 @@
     }
 
     /**
+     * Gets the current introspector base.
+     * <p>If the reference has been collected, this method will recreate the underlying introspector.</p>
+     * @return the introspector
+     */
+    // CSOFF: DoubleCheckedLocking
+    protected final IntrospectorBase base() {
+        IntrospectorBase intro = ref.get();
+        if (intro == null) {
+            // double checked locking (fixed by Java 5 memory model).
+            synchronized(this) {
+                intro = ref.get();
+                if (intro == null) {
+                    intro = new IntrospectorBase(rlog);
+                    ref = new SoftReference<IntrospectorBase>(intro);
+                }
+            }
+        }
+        return intro;
+    }
+    // CSON: DoubleCheckedLocking
+
+    /**
+     * Sets the underlying class loader for class solving resolution.
+     * @param loader the loader to use
+     */
+    public void setClassLoader(ClassLoader loader) {
+        base().setLoader(loader);
+    }
+
+
+    /**
      * Gets the method defined by <code>name</code> and
      * <code>params</code> for the Class <code>c</code>.
      *
@@ -174,7 +118,7 @@
      * CSOFF: RedundantThrows
      */
     protected final Method getMethod(Class<?> c, String name, Object[] params) throws IllegalArgumentException {
-        return introspector.get().getMethod(c, new MethodKey(name, params));
+        return base().getMethod(c, new MethodKey(name, params));
     }
 
     /**
@@ -188,7 +132,17 @@
      * CSOFF: RedundantThrows
      */
     protected final Method getMethod(Class<?> c, MethodKey key) throws IllegalArgumentException {
-        return introspector.get().getMethod(c, key);
+        return base().getMethod(c, key);
+    }
+
+
+    /**
+     * Gets the accessible methods names known for a given class.
+     * @param c the class
+     * @return the class method names
+     */
+    public final String[] getMethodNames(Class<?> c) {
+        return base().getMethodNames(c);
     }
 
     /**
@@ -208,7 +162,7 @@
         } else {
             return null;
         }
-        return introspector.get().getConstructor(clazz, new MethodKey(className, args));
+        return base().getConstructor(clazz, new MethodKey(className, args));
     }
 
     /**
@@ -225,7 +179,7 @@
 
     /**
      * Return a property getter.
-     * @param obj the object to get the property from.
+     * @param obj the object to base the property from.
      * @param identifier property name
      * @return a {@link AbstractExecutor.Get}.
      */
@@ -271,7 +225,7 @@
 
     /**
      * Return a property setter.
-     * @param obj the object to get the property from.
+     * @param obj the object to base the property from.
      * @param identifier property name (or identifier)
      * @param arg value to set
      * @return a {@link AbstractExecutor.Set}.

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/IntrospectorBase.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/IntrospectorBase.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/IntrospectorBase.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/IntrospectorBase.java Mon Nov 30 19:28:40 2009
@@ -90,14 +90,22 @@
      * @param key   Key of the method being searched for
      * @return The desired Method object.
      * @throws IllegalArgumentException     When the parameters passed in can not be used for introspection.
-     * @throws MethodKey.AmbiguousException When the method map contains more than
-     *  one match for the requested signature.
      *  
      */
     //CSOFF: RedundantThrows
     public Method getMethod(Class<?> c, MethodKey key) {
-        ClassMap classMap = getMap(c);
-        return classMap.findMethod(key);
+        try {
+            ClassMap classMap = getMap(c);
+            return classMap.findMethod(key);
+        } catch (MethodKey.AmbiguousException ae) {
+            // whoops.  Ambiguous.  Make a nice log message and return null...
+            if (rlog != null) {
+                rlog.error("ambiguous method invocation: "
+                           + c.getName() + "."
+                           + key.debugString());
+            }
+        }
+        return null;
 
     }
     // CSON: RedundantThrows
@@ -113,7 +121,6 @@
         }
         ClassMap classMap = getMap(c);
         return classMap.getMethodNames();
-
     }
 
     /**
@@ -150,8 +157,6 @@
      * @param key   Key of the constructor being searched for
      * @return The desired Constructor object.
      * @throws IllegalArgumentException     When the parameters passed in can not be used for introspection.
-     * @throws MethodKey.AmbiguousException When the method map contains more than
-     *  one match for the requested signature.
      */
     public Constructor<?> getConstructor(final MethodKey key) {
         return getConstructor(null, key);
@@ -163,57 +168,64 @@
      * @param key   Key of the constructor being searched for
      * @return The desired Constructor object.
      * @throws IllegalArgumentException     When the parameters passed in can not be used for introspection.
-     * @throws MethodKey.AmbiguousException When the method map contains more than
-     *  one match for the requested signature.
      */
     //CSOFF: RedundantThrows
     public Constructor<?> getConstructor(final Class<?> c, final MethodKey key) {
-        Constructor<?> ctor = null;
-        synchronized(constructorsMap) {
-            ctor = constructorsMap.get(key);
-            // that's a clear miss
-            if (CTOR_MISS.equals(ctor)) {
-                return null;
-            }
-            // let's introspect...
-            if (ctor == null) {
-                final String cname = key.getMethod();
-                // do we know about this class?
-                Class<?> clazz = constructibleClasses.get(cname);
-                try {
-                    // do find the most specific ctor
-                    if (clazz == null) {
-                        if (c != null && c.getName().equals(key.getMethod())) {
-                            clazz = c;
+        try {
+            Constructor<?> ctor = null;
+            synchronized(constructorsMap) {
+                ctor = constructorsMap.get(key);
+                // that's a clear miss
+                if (CTOR_MISS.equals(ctor)) {
+                    return null;
+                }
+                // let's introspect...
+                if (ctor == null) {
+                    final String cname = key.getMethod();
+                    // do we know about this class?
+                    Class<?> clazz = constructibleClasses.get(cname);
+                    try {
+                        // do find the most specific ctor
+                        if (clazz == null) {
+                            if (c != null && c.getName().equals(key.getMethod())) {
+                                clazz = c;
+                            } else {
+                                clazz = loader.loadClass(cname);
+                            }
+                            // add it to list of known loaded classes
+                            constructibleClasses.put(cname, clazz);
+                        }
+                        List<Constructor<?>> l = new LinkedList<Constructor<?>>();
+                        for(Constructor<?> ictor : clazz.getConstructors()) {
+                            l.add(ictor);
+                        }
+                        // try to find one
+                        ctor = key.getMostSpecificConstructor(l);
+                        if (ctor != null) {
+                            constructorsMap.put(key, ctor);
                         } else {
-                            clazz = loader.loadClass(cname);
+                            constructorsMap.put(key, CTOR_MISS);
                         }
-                        // add it to list of known loaded classes
-                        constructibleClasses.put(cname, clazz);
-                    }
-                    List<Constructor<?>> l = new LinkedList<Constructor<?>>();
-                    for(Constructor<?> ictor : clazz.getConstructors()) {
-                        l.add(ictor);
-                    }
-                    // try to find one
-                    ctor = key.getMostSpecificConstructor(l);
-                    if (ctor != null) {
-                        constructorsMap.put(key, ctor);
-                    } else {
-                        constructorsMap.put(key, CTOR_MISS);
-                    }
-                } catch(ClassNotFoundException xnotfound) {
-                    if (rlog.isDebugEnabled()) {
-                        rlog.debug("could not load class " + cname, xnotfound);
+                    } catch(ClassNotFoundException xnotfound) {
+                        if (rlog.isDebugEnabled()) {
+                            rlog.debug("could not load class " + cname, xnotfound);
+                        }
+                        ctor = null;
+                    } catch(MethodKey.AmbiguousException xambiguous) {
+                        rlog.warn("ambiguous ctor detected for " + cname, xambiguous);
+                        ctor = null;
                     }
-                    ctor = null;
-                } catch(MethodKey.AmbiguousException xambiguous) {
-                    rlog.warn("ambiguous ctor detected for " + cname, xambiguous);
-                    ctor = null;
                 }
             }
+            return ctor;
+        } catch (MethodKey.AmbiguousException ae) {
+            // whoops.  Ambiguous.  Make a nice log message and return null...
+            if (rlog != null) {
+                rlog.error("ambiguous constructor invocation: new "
+                           + key.debugString());
+            }
         }
-        return ctor;
+        return null;
     }
     // CSON: RedundantThrows
 

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/package.html
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/package.html?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/package.html (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/introspection/package.html Mon Nov 30 19:28:40 2009
@@ -19,37 +19,18 @@
   <title>Package Documentation for org.apache.commons.jexl2.introspection Package</title>
  </head>
  <body bgcolor="white">
-  Provides low &amp; high-level introspective services.
-  <br/><br/>
-  <p>
-   <ul>
-    <li><a href="#low">Low level</a></li>
-    <li><a href="#high">High level</a></li>
-   </ul>
-  </p>
+  Provides low-level introspective services.
+  <br/>
   <h2><a name="low">Low level</a></h2>
   <p>
-  The IntrospectorBase, Introspector, ClassMap, IntrospectionUtils form the
+  The IntrospectorBase, ClassMap, MethodKey, MethodMap form the
   base of the introspection service. They allow to describe classes and their
-  methods, keeping them in a cache (@see Introspector) to speed up property
+  methods, keeping them in a cache (@see IntrospectorBase) to speed up property
   getters/setters and method discovery used during expression evaluation.
   </p>
   <p>
   The cache materialized in Introspector creates one entry per class containing a map of all
   accessible public methods keyed by name and signature.
   </p>
-
-  <h2><a name="high">High level</a></h2>
-  
-  <p>
-  The Uberspect, JexlMethod, JexlPropertyGet and JexlPropertySet interfaces
-  form the exposed face of introspective services.
-  </p>
-  <p>
-  The Uberspectimpl is the concrete class implementing the Uberspect interface.
-  Deriving from this class is the preferred way of augmenting Jexl introspective
-  capabilities when special needs to be fullfilled or when default behaviors
-  need to be modified.
-  </p>
 </body>
 </html>

Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ArithmeticTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ArithmeticTest.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ArithmeticTest.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ArithmeticTest.java Mon Nov 30 19:28:40 2009
@@ -160,7 +160,7 @@
      */
     public void testDivideByZero() throws Exception {
         Map<String,Object> vars = new HashMap<String,Object>();
-        JexlContext context = new JexlContext.Mapped(vars);
+        JexlContext context = new MapContext(vars);
         vars.put("aByte", new Byte((byte) 1));
         vars.put("aShort", new Short((short) 2));
         vars.put("aInteger", new Integer(3));

Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ArrayLiteralTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ArrayLiteralTest.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ArrayLiteralTest.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/ArrayLiteralTest.java Mon Nov 30 19:28:40 2009
@@ -26,7 +26,7 @@
 
     public void testLiteralWithStrings() throws Exception {
         Expression e = JEXL.createExpression( "[ 'foo' , 'bar' ]" );
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
 
         Object o = e.evaluate( jc );
         Object[] check = { "foo", "bar" };
@@ -35,7 +35,7 @@
 
     public void testLiteralWithOneEntry() throws Exception {
         Expression e = JEXL.createExpression( "[ 'foo' ]" );
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
 
         Object o = e.evaluate( jc );
         Object[] check = { "foo" };
@@ -44,7 +44,7 @@
 
     public void testLiteralWithNumbers() throws Exception {
         Expression e = JEXL.createExpression( "[ 5.0 , 10 ]" );
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
 
         Object o = e.evaluate( jc );
         Object[] check = { new Float(5), new Integer(10) };
@@ -53,7 +53,7 @@
 
     public void testLiteralWithIntegers() throws Exception {
         Expression e = JEXL.createExpression( "[ 5 , 10 ]" );
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
 
         Object o = e.evaluate( jc );
         int[] check = { 5, 10 };
@@ -62,7 +62,7 @@
 
     public void testSizeOfSimpleArrayLiteral() throws Exception {
         Expression e = JEXL.createExpression( "size([ 'foo' , 'bar' ])" );
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
 
         Object o = e.evaluate( jc );
         assertEquals( new Integer( 2 ), o );
@@ -70,7 +70,7 @@
 
     public void notestCallingMethodsOnNewMapLiteral() throws Exception {
         Expression e = JEXL.createExpression( "size({ 'foo' : 'bar' }.values())" );
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
 
         Object o = e.evaluate( jc );
         assertEquals( new Integer( 1 ), o );
@@ -78,7 +78,7 @@
 
     public void testNotEmptySimpleArrayLiteral() throws Exception {
         Expression e = JEXL.createExpression( "empty([ 'foo' , 'bar' ])" );
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
 
         Object o = e.evaluate( jc );
         assertFalse( ( (Boolean) o ).booleanValue() );

Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/AssignTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/AssignTest.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/AssignTest.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/AssignTest.java Mon Nov 30 19:28:40 2009
@@ -79,7 +79,7 @@
     public void testAntish() throws Exception {
         Expression assign = ENGINE.createExpression("froboz.value = 10");
         Expression check = ENGINE.createExpression("froboz.value");
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
         Object o = assign.evaluate(jc);
         assertEquals("Result is not 10", new Integer(10), o);
         o = check.evaluate(jc);
@@ -89,9 +89,9 @@
     public void testBeanish() throws Exception {
         Expression assign = ENGINE.createExpression("froboz.value = 10");
         Expression check = ENGINE.createExpression("froboz.value");
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
         Froboz froboz = new Froboz(-169);
-        jc.setJexlVariable("froboz", froboz);
+        jc.set("froboz", froboz);
         Object o = assign.evaluate(jc);
         assertEquals("Result is not 10", new Integer(10), o);
         o = check.evaluate(jc);
@@ -100,9 +100,9 @@
     
     public void testAmbiguous() throws Exception {
         Expression assign = ENGINE.createExpression("froboz.nosuchbean = 10");
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
         Froboz froboz = new Froboz(-169);
-        jc.setJexlVariable("froboz", froboz);
+        jc.set("froboz", froboz);
         Object o = null;
         try {
             o = assign.evaluate(jc);
@@ -120,9 +120,9 @@
     public void testArray() throws Exception {
         Expression assign = ENGINE.createExpression("froboz[\"value\"] = 10");
         Expression check = ENGINE.createExpression("froboz[\"value\"]");
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
         Froboz froboz = new Froboz(0);
-        jc.setJexlVariable("froboz", froboz);
+        jc.set("froboz", froboz);
         Object o = assign.evaluate(jc);
         assertEquals("Result is not 10", new Integer(10), o);
         o = check.evaluate(jc);
@@ -130,8 +130,8 @@
     }
     
     public void testMore() throws Exception {
-        JexlContext jc = new JexlContext.Mapped();
-        jc.setJexlVariable("quuxClass", Quux.class);
+        JexlContext jc = new MapContext();
+        jc.set("quuxClass", Quux.class);
         Expression create = ENGINE.createExpression("quux = new(quuxClass, 'xuuq', 100)");
         Expression assign = ENGINE.createExpression("quux.froboz.value = 10");
         Expression check = ENGINE.createExpression("quux[\"froboz\"].value");

Modified: commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/BlockTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/BlockTest.java?rev=885553&r1=885552&r2=885553&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/BlockTest.java (original)
+++ commons/proper/jexl/trunk/src/test/java/org/apache/commons/jexl2/BlockTest.java Mon Nov 30 19:28:40 2009
@@ -33,44 +33,44 @@
 
     public void testBlockSimple() throws Exception {
         Expression e = JEXL.createExpression("if (true) { 'hello'; }");
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
         Object o = e.evaluate(jc);
         assertEquals("Result is wrong", "hello", o);
     }
 
     public void testBlockExecutesAll() throws Exception {
         Expression e = JEXL.createExpression("if (true) { x = 'Hello'; y = 'World';}");
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
         Object o = e.evaluate(jc);
-        assertEquals("First result is wrong", "Hello", jc.getJexlVariable("x"));
-        assertEquals("Second result is wrong", "World", jc.getJexlVariable("y"));
+        assertEquals("First result is wrong", "Hello", jc.get("x"));
+        assertEquals("Second result is wrong", "World", jc.get("y"));
         assertEquals("Block result is wrong", "World", o);
     }
 
     public void testEmptyBlock() throws Exception {
         Expression e = JEXL.createExpression("if (true) { }");
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
         Object o = e.evaluate(jc);
         assertNull("Result is wrong", o);
     }
 
     public void testBlockLastExecuted01() throws Exception {
         Expression e = JEXL.createExpression("if (true) { x = 1; } else { x = 2; }");
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
         Object o = e.evaluate(jc);
         assertEquals("Block result is wrong", new Integer(1), o);
     }
 
     public void testBlockLastExecuted02() throws Exception {
         Expression e = JEXL.createExpression("if (false) { x = 1; } else { x = 2; }");
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
         Object o = e.evaluate(jc);
         assertEquals("Block result is wrong", new Integer(2), o);
     }
 
     public void testNestedBlock() throws Exception {
         Expression e = JEXL.createExpression("if (true) { x = 'hello'; y = 'world';" + " if (true) { x; } y; }");
-        JexlContext jc = new JexlContext.Mapped();
+        JexlContext jc = new MapContext();
         Object o = e.evaluate(jc);
         assertEquals("Block result is wrong", "world", o);
     }



Mime
View raw message