You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2009/12/09 18:13:10 UTC

svn commit: r888877 - 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/ src/m...

Author: henrib
Date: Wed Dec  9 17:13:09 2009
New Revision: 888877

URL: http://svn.apache.org/viewvc?rev=888877&view=rev
Log:
document separation between user land & non-public code; reduced dependency between Interpreter & non-public code

Modified:
    commons/proper/jexl/trunk/pom.xml
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/Interpreter.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.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/introspection/JexlMethod.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html
    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/package.html
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/package.html
    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/introspection/package.html
    commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/package.html
    commons/proper/jexl/trunk/src/site/site.xml
    commons/proper/jexl/trunk/xdocs/index.xml

Modified: commons/proper/jexl/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/pom.xml?rev=888877&r1=888876&r2=888877&view=diff
==============================================================================
--- commons/proper/jexl/trunk/pom.xml (original)
+++ commons/proper/jexl/trunk/pom.xml Wed Dec  9 17:13:09 2009
@@ -235,7 +235,7 @@
                     <instrumentation>
                         <excludes>
                             <exclude>org/apache/commons/jexl2/parser/*.class</exclude>
-                            <exclude>apache/commons/jexl2/**/*Test.class</exclude>
+                            <exclude>org/apache/commons/jexl2/**/*Test.class</exclude>
                         </excludes>
                     </instrumentation>
                 </configuration>
@@ -245,6 +245,10 @@
                 <artifactId>findbugs-maven-plugin</artifactId>
                 <version>2.1</version>
                 <configuration>
+                        <excludes>
+                            <exclude>org/apache/commons/jexl2/parser/*.class</exclude>
+                            <exclude>org/apache/commons/jexl2/**/*Test.class</exclude>
+                        </excludes>
                     <xmlOutput>true</xmlOutput>
                     <!-- Optional directory to put findbugs xdoc xml report -->
                     <xmlOutputDirectory>target/site</xmlOutputDirectory>
@@ -257,7 +261,8 @@
                 <configuration>
                     <targetJdk>1.5</targetJdk>
                     <excludes>
-                        <exclude>org/apache/commons/jexl/parser/*.java</exclude>
+                        <exclude>org/apache/commons/jexl2/parser/*.class</exclude>
+                        <exclude>org/apache/commons/jexl2/**/*Test.class</exclude>
                     </excludes>
                     <rulesets>
                         <ruleset>/rulesets/braces.xml</ruleset>

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=888877&r1=888876&r2=888877&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 Wed Dec  9 17:13:09 2009
@@ -78,7 +78,6 @@
 import org.apache.commons.jexl2.parser.Node;
 import org.apache.commons.jexl2.parser.ParserVisitor;
 
-import org.apache.commons.jexl2.util.AbstractExecutor;
 import org.apache.commons.jexl2.introspection.Uberspect;
 import org.apache.commons.jexl2.introspection.JexlMethod;
 import org.apache.commons.jexl2.introspection.JexlPropertyGet;
@@ -765,10 +764,10 @@
             // attempt to reuse last executor cached in volatile JexlNode.value
             if (cache) {
                 Object cached = node.jjtGetValue();
-                if (cached instanceof AbstractExecutor.Method) {
-                    AbstractExecutor.Method me = (AbstractExecutor.Method) cached;
-                    Object eval = me.tryExecute(methodName, data, argv);
-                    if (eval != AbstractExecutor.TRY_FAILED) {
+                if (cached instanceof JexlMethod) {
+                    JexlMethod me = (JexlMethod) cached;
+                    Object eval = me.tryInvoke(methodName, data, argv);
+                    if (!me.tryFailed(eval)) {
                         return eval;
                     }
                 }
@@ -857,10 +856,10 @@
             // attempt to reuse last executor cached in volatile JexlNode.value
             if (cache) {
                 Object cached = node.jjtGetValue();
-                if (cached instanceof AbstractExecutor.Method) {
-                    AbstractExecutor.Method me = (AbstractExecutor.Method) cached;
-                    Object eval = me.tryExecute(function, namespace, argv);
-                    if (eval != AbstractExecutor.TRY_FAILED) {
+                if (cached instanceof JexlMethod) {
+                    JexlMethod me = (JexlMethod) cached;
+                    Object eval = me.tryInvoke(function, namespace, argv);
+                    if (!me.tryFailed(eval)) {
                         return eval;
                     }
                 }
@@ -1157,10 +1156,10 @@
         // attempt to reuse last executor cached in volatile JexlNode.value
         if (node != null && cache) {
             Object cached = node.jjtGetValue();
-            if (cached instanceof AbstractExecutor.Get) {
-                AbstractExecutor.Get vg = (AbstractExecutor.Get) cached;
-                Object value = vg.tryExecute(object, attribute);
-                if (value != AbstractExecutor.TRY_FAILED) {
+            if (cached instanceof JexlPropertyGet) {
+                JexlPropertyGet vg = (JexlPropertyGet) cached;
+                Object value = vg.tryInvoke(object, attribute);
+                if (!vg.tryFailed(value)) {
                     return value;
                 }
             }
@@ -1217,10 +1216,10 @@
         // attempt to reuse last executor cached in volatile JexlNode.value
         if (node != null && cache) {
             Object cached = node.jjtGetValue();
-            if (cached instanceof AbstractExecutor.Set) {
-                AbstractExecutor.Set setter = (AbstractExecutor.Set) cached;
-                Object eval = setter.tryExecute(object, attribute, value);
-                if (eval != AbstractExecutor.TRY_FAILED) {
+            if (cached instanceof JexlPropertySet) {
+                JexlPropertySet setter = (JexlPropertySet) cached;
+                Object eval = setter.tryInvoke(object, attribute, value);
+                if (!setter.tryFailed(eval)) {
                     return;
                 }
             }

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java?rev=888877&r1=888876&r2=888877&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/JexlArithmetic.java Wed Dec  9 17:13:09 2009
@@ -123,7 +123,7 @@
         }
         if (val instanceof String) {
             String string = (String) val;
-            return string.indexOf(".") != -1 || string.indexOf("e") != -1 || string.indexOf("E") != -1;
+            return string.indexOf('.') != -1 || string.indexOf('e') != -1 || string.indexOf('E') != -1;
         }
         return false;
     }

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=888877&r1=888876&r2=888877&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 Wed Dec  9 17:13:09 2009
@@ -849,7 +849,7 @@
                 se = stack[s];
                 String className = se.getClassName();
                 if (!className.equals(clazz.getName())) {
-                    // go deeper if called from JexlEngine, UnifiedJEXL or a Factory
+                    // go deeper if called from JexlEngine or UnifiedJEXL
                     if (className.equals(JexlEngine.class.getName())) {
                         clazz = JexlEngine.class;
                     } else if (className.equals(UnifiedJEXL.class.getName())) {

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java?rev=888877&r1=888876&r2=888877&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlMethod.java Wed Dec  9 17:13:09 2009
@@ -30,7 +30,7 @@
  */
 public interface JexlMethod {
     /**
-     * invocation method - called when the method invocation should be performed
+     * Invocation method, called when the method invocation should be performed
      * and a value returned.
 
      * @param obj the object
@@ -39,7 +39,25 @@
      * @throws Exception on any error.
      */
     Object invoke(Object obj, Object[] params) throws Exception;
-    
+
+    /**
+     * Attempts to reuse this JexlMethod, checking that it is compatible with
+     * the actual set of arguments.
+     * @param obj the object to invoke the method upon
+     * @param name the method name
+     * @param params the method arguments
+     * @return the result of the method invocation that should be checked by tryFailed to determine if it succeeded
+     * or failed.
+     */
+    Object tryInvoke(String name, Object obj, Object[] params);
+
+    /**
+     * Checks wether a tryExecute failed or not.
+     * @param rval the value returned by tryInvoke
+     * @return true if tryInvoke failed, false otherwise
+     */
+    boolean tryFailed(Object rval);
+
     /**
      * specifies if this JexlMethod is cacheable and able to be reused for this
      * class of object it was returned for.
@@ -49,12 +67,6 @@
     boolean isCacheable();
 
     /**
-     * Gets the method name used.
-     * @return method name
-     */
-    String getMethodName();
-
-    /**
      * returns the return type of the method invoked.
      * @return return type
      */

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java?rev=888877&r1=888876&r2=888877&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertyGet.java Wed Dec  9 17:13:09 2009
@@ -29,15 +29,32 @@
  */
 public interface JexlPropertyGet {
     /**
-     * invocation method - called when the 'get action' should be performed and
-     * a value returned.
-     * @param obj the object to get the property from.
+     * Method used to get the property value of an object.
+     * 
+     * @param obj the object to get the property value from.
      * @return the property value.
      * @throws Exception on any error.
      */
     Object invoke(Object obj) throws Exception;
 
     /**
+     * Attempts to reuse this JexlPropertyGet, checking that it is compatible with
+     * the actual set of arguments.
+     * @param obj the object to invoke the property get upon
+     * @param key the property key to get
+     * @return the result of the method invocation that should be checked by tryFailed to determine if it succeeded
+     * or failed.
+     */
+    Object tryInvoke(Object obj, Object key);
+
+    /**
+     * Checks wether a tryExecute failed or not.
+     * @param rval the value returned by tryInvoke
+     * @return true if tryInvoke failed, false otherwise
+     */
+    boolean tryFailed(Object rval);
+
+    /**
      * Specifies if this JexlPropertyGet is cacheable and able to be reused for
      * this class of object it was returned for.
      *
@@ -46,12 +63,6 @@
     boolean isCacheable();
 
     /**
-     * returns the method name used to return this 'property'.
-     * @return the method name.
-     */
-    String getMethodName();
-
-    /**
      * Tell whether the method underlying this 'property' is alive by
      * checking to see if represents a successful name resolution.
      *

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java?rev=888877&r1=888876&r2=888877&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/JexlPropertySet.java Wed Dec  9 17:13:09 2009
@@ -29,26 +29,39 @@
  */
 public interface JexlPropertySet {
     /**
-     * method used to set the value in the object.
+     * Method used to set the property value of an object.
      * 
-     * @param o Object on which the method will be called with the arg
+     * @param obj Object on which the property setter will be called with the value
      * @param arg value to be set
      * @return the value returned from the set operation (impl specific)
      * @throws Exception on any error.
      */
-    Object invoke(Object o, Object arg) throws Exception;
+    Object invoke(Object obj, Object arg) throws Exception;
 
     /**
-     * specifies if this JexlPropertySet is cacheable and able to be reused for
+     * Attempts to reuse this JexlPropertySet, checking that it is compatible with
+     * the actual set of arguments.
+     * @param obj the object to invoke the the get upon
+     * @param key the property key to get
+     * @param value the property value to set
+     * @return the result of the method invocation that should be checked by tryFailed to determine if it succeeded
+     * or failed.
+     */
+    Object tryInvoke(Object obj, Object key, Object value);
+
+    /**
+     * Checks wether a tryInvoke failed or not.
+     * @param rval the value returned by tryInvoke
+     * @return true if tryExecute failed, false otherwise
+     */
+    boolean tryFailed(Object rval);
+    
+    /**
+     * Specifies if this JexlPropertySet is cacheable and able to be reused for
      * this class of object it was returned for.
      * 
      * @return true if can be reused for this class, false if not
      */
     boolean isCacheable();
 
-    /**
-     * returns the method name used to set this 'property'.
-     * @return the method name.
-     */
-    String getMethodName();
 }

Modified: 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=888877&r1=888876&r2=888877&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/introspection/package.html Wed Dec  9 17:13:09 2009
@@ -1,35 +1,34 @@
 <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
+    <!--
+       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
 
-       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>
+       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">
+        <h2>Provides high-level introspective services.</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/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=888877&r1=888876&r2=888877&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 Wed Dec  9 17:13:09 2009
@@ -43,11 +43,10 @@
             {@link org.apache.commons.jexl2.JexlContext}.
             An Expression is created using
             {@link org.apache.commons.jexl2.JexlEngine#createExpression(java.lang.String)},
-            passing a String containing valid JEXL syntax.  A JexlContext is created using
-            {@link org.apache.commons.jexl2.JexlHelper#createContext()},
-            and variables are put into a map exposed through the
-            {@link org.apache.commons.jexl2.JexlContext#getVars()}
-            method on JexlContext.  The following example, takes a variable named foo, and
+            passing a String containing valid JEXL syntax.  A simple JexlContext can be created using
+            a {@link org.apache.commons.jexl2.MapContext} instance;
+            a map of variables that will be internally wrapped can be optionally provided through its constructor.
+            The following example, takes a variable named foo, and
             invokes the bar() method on the property innerFoo:
         </p>
         <pre>
@@ -58,13 +57,14 @@
             Expression e = jexl.createExpression( jexlExp );
 
             // Create a context and add data
-            JexlContext jc = new JexlContext.Mapped();
+            JexlContext jc = new MapContext();
             jc.set("foo", new Foo() );
 
             // Now evaluate the expression, getting the result
             Object o = e.evaluate(jc);
         </pre>
 
+
         <h2><a name="usage">Using JEXL</a></h2>
         The API is composed of three levels addressing different functional needs:
         <ul>
@@ -73,6 +73,23 @@
             <li>JSP/JSF like expression known as UnifiedJEXL expressions</li>
         </ul>
 
+        <h3><a name="usage_note">Important note</a></h3>
+            The only public packages you should use are:
+        <ul>
+            <li>org.apache.commons.jexl2</li>
+            <li>org.apache.commons.jexl2.introspection</li>
+        </ul>
+            The following packages follow a "use at your own maintenance cost" policy.
+            Their classes and methods are not guaranteed to remain compatible in subsequent versions.
+            If you think you need to use some of their features, it might be a good idea to check with
+            the community through the mailing list first.
+       <ul>
+            <li>org.apache.commons.jexl2.parser</li>
+            <li>org.apache.commons.jexl2.scripting</li>
+            <li>org.apache.commons.jexl2.util</li>
+            <li>org.apache.commons.jexl2.util.introspection</li>
+        </ul>
+
         <h3><a name="usage_api">Dynamic invocation</a></h3>
         <p>
             These functionalities are close to the core level utilities found in
@@ -134,7 +151,7 @@
         <pre>
             JexlEngine jexl = nex JexlEngine();
 
-            JexlContext jc = new JexlContext.Mapped();
+            JexlContext jc = new MapContext();
             jc.set("quuxClass", quux.class);
 
             Expression create = jexl.createExpression("quux = new(quuxClass, 'xuuq', 100)");
@@ -219,7 +236,7 @@
             JexlEngine jexl = new JexlEngine();
             jexl.setFunctions(funcs);
 
-            JexlContext jc = new JexlContext.Mapped();
+            JexlContext jc = new MapContext();
             jc.set("pi", Math.PI);
 
             e = JEXL.createExpression("math:cos(pi)");
@@ -249,7 +266,7 @@
             for variable contexts or add factory based support to the 'new' operator.
         </p>
         <p>
-            {@link org.apache.commons.jexl2.util.introspection.UberspectImpl}
+            {@link org.apache.commons.jexl2.introspection.UberspectImpl}
             is the class to derive if you need to add introspection or reflection capabilities for some objects.
             For instance, being able to expose and manipulate public fields instead of Java-beans conventions.
         </p>

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/package.html
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/package.html?rev=888877&r1=888876&r2=888877&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/package.html (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/parser/package.html Wed Dec  9 17:13:09 2009
@@ -1,34 +1,31 @@
 <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
+    <!--
+       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
+           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.parser Package</title>
- </head>
- <body bgcolor="white">
-  Contains the Parser for JEXL script.
-  <br/><br/>
-  <p>
-   <ul>
-    <li><a href="#intro">Introduction</a></li>
-   </ul>
-  </p>
-  <h2><a name="intro">Introduction</a></h2>
-  <p>
-   This package contains the Parser for JEXL script.
-  </p>
-</body>
+       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.parser Package</title>
+    </head>
+    <body bgcolor="white">
+        <p>
+            Contains the Parser for JEXL script.
+        </p>
+        <p>
+            This internal package is not intended for public usage and there is <b>no</b>
+            guarantee that its public classes or methods will remain as is in subsequent
+            versions.
+        <p/>
+    </body>
 </html>

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/package.html
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/package.html?rev=888877&r1=888876&r2=888877&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/package.html (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/scripting/package.html Wed Dec  9 17:13:09 2009
@@ -1,34 +1,31 @@
 <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
+    <!--
+       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
+           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.scripting Package</title>
- </head>
- <body bgcolor="white">
-  Contains the JSR-223 Scripting Engine for JEXL script.
-  <br/><br/>
-  <p>
-   <ul>
-    <li><a href="#intro">Introduction</a></li>
-   </ul>
-  </p>
-  <h2><a name="intro">Introduction</a></h2>
-  <p>
-   This package contains the JSR-223 Scripting Engine for JEXL script.
-  </p>
-</body>
+       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.scripting Package</title>
+    </head>
+    <body bgcolor="white">
+        <p>
+        Contains the JSR-223 Scripting Engine for JEXL script.
+        </p>
+        <p>
+            This internal package is not intended for public usage and there is <b>no</b>
+            guarantee that its public classes or methods will remain as is in subsequent
+            versions.
+        <p/>
+    </body>
 </html>

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=888877&r1=888876&r2=888877&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 Wed Dec  9 17:13:09 2009
@@ -171,6 +171,16 @@
         return method.getName();
     }
 
+
+    /**
+     * Checks wether a tryExecute failed or not.
+     * @param exec the value returned by tryExecute
+     * @return true if tryExecute failed, false otherwise
+     */
+    public final boolean tryFailed(Object exec) {
+        return exec == TRY_FAILED;
+    }
+
     /**
      * Abstract class that is used to execute an arbitrary 'get' method.
      */
@@ -188,6 +198,11 @@
         public final Object invoke(Object obj) throws Exception {
             return execute(obj);
         }
+        
+        /** {@inheritDoc} */
+        public final Object tryInvoke(Object obj, Object key) {
+            return tryExecute(obj, key);
+        }
 
         /**
          * Gets the property value from an object.
@@ -232,10 +247,15 @@
         }
 
         /** {@inheritDoc} */
-        public Object invoke(Object obj, Object arg) throws Exception {
+        public final Object invoke(Object obj, Object arg) throws Exception {
             return execute(obj, arg);
         }
 
+        /** {@inheritDoc} */
+        public final Object tryInvoke(Object obj, Object key, Object value) {
+            return tryExecute(obj, key, value);
+        }
+
         /**
          * Sets the property value of an object.
          *
@@ -311,6 +331,11 @@
         }
 
         /** {@inheritDoc} */
+        public final Object tryInvoke(String name, Object obj, Object[] params) {
+            return tryExecute(name, obj, params);
+        }
+
+        /** {@inheritDoc} */
         @Override
         public Object getTargetProperty() {
             return key;
@@ -342,7 +367,7 @@
          * @param obj the object to invoke the method upon
          * @param name the method name
          * @param args the method arguments
-         * @return the result of the method invocation or INVOKE_FAILED if checking failed.
+         * @return the result of the method invocation or TRY_FAILED if checking failed.
          */
         public Object tryExecute(String name, Object obj, Object[] args){
             return TRY_FAILED;

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=888877&r1=888876&r2=888877&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 Wed Dec  9 17:13:09 2009
@@ -1,36 +1,39 @@
 <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
+    <!--
+       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
+           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 low-level introspective services.
-  <br/>
-  <h2><a name="low">Low level</a></h2>
-  <p>
-  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 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>
-</body>
+       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 low-level introspective services.
+        <p>
+            This internal package is not intended for public usage and there is <b>no</b>
+            guarantee that its public classes or methods will remain as is in subsequent
+            versions.
+        </p>
+        <p>
+            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 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>
+    </body>
 </html>

Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/package.html
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/package.html?rev=888877&r1=888876&r2=888877&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/package.html (original)
+++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl2/util/package.html Wed Dec  9 17:13:09 2009
@@ -1,33 +1,37 @@
 <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
+    <!--
+       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
+           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 Package</title>
- </head>
- <body bgcolor="white">
-  Provides utilities for introspection services.
-  <br/><br/>
-  <p>
-  This set of classes implement the various forms of setters and getters
-  used by Jexl. These are specialized forms for 'pure' properties, discovering
-  methods of the {s,g}etProperty form, for Maps, Lists and Ducks -
-  attempting to discover a 'get' or 'set' method, making an object walk and
-  quack.
-  </p>
-  
-</body>
+       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 Package</title>
+    </head>
+    <body bgcolor="white">
+        <h2>Provides utilities for introspection services.</h2>
+        <p>
+            This internal package is not intended for public usage and there is <b>no</b>
+            guarantee that its public classes or methods will remain as is in subsequent
+            versions.
+        <p/>
+        <p>
+            This set of classes implement the various forms of setters and getters
+            used by Jexl. These are specialized forms for 'pure' properties, discovering
+            methods of the {s,g}etProperty form, for Maps, Lists and Ducks -
+            attempting to discover a 'get' or 'set' method, making an object walk and
+            quack.
+        </p>
+
+    </body>
 </html>

Modified: commons/proper/jexl/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/site/site.xml?rev=888877&r1=888876&r2=888877&view=diff
==============================================================================
--- commons/proper/jexl/trunk/src/site/site.xml (original)
+++ commons/proper/jexl/trunk/src/site/site.xml Wed Dec  9 17:13:09 2009
@@ -18,26 +18,26 @@
 <project name="JEXL">
     <bannerRight>
         <name>Commons JEXL</name>
-        <src>/images/jexl-logo-white.png</src>
-        <href>/index.html</href>
+        <src>images/jexl-logo-white.png</src>
+        <href>index.html</href>
     </bannerRight>
 
     <body>
         <menu name="Commons&#xA0;Jexl">
-            <item name="Overview"                href="/index.html" />
-            <item name="2.0&#xA0;Javadoc"        href="/apidocs/index.html"/>
-            <item name="1.1&#xA0;Javadoc"        href="/apidocs-1.1/index.html"/>
-            <item name="Releases and Builds"     href="/releases.html"/>
+            <item name="Overview"                href="index.html" />
+            <item name="2.0&#xA0;Javadoc"        href="apidocs/index.html"/>
+            <item name="1.1&#xA0;Javadoc"        href="apidocs-1.1/index.html"/>
+            <item name="Releases and Builds"     href="releases.html"/>
             <item name="Download"                href="http://commons.apache.org/downloads/download_jexl.cgi"/>
-            <item name="Reference"               href="/reference/index.html"/>
+            <item name="Reference"               href="reference/index.html"/>
             <item name="JEXL Wiki"               href="http://wiki.apache.org/commons/JEXL"/>
         </menu>
 
         <menu name="Development">
-            <item name="Mailing Lists"           href="/mail-lists.html"/>
-            <item name="Issue Tracking"          href="/issue-tracking.html"/>
-            <item name="Source Repository"       href="/source-repository.html"/>
-            <item name="Building"                href="/building.html"/>
+            <item name="Mailing Lists"           href="mail-lists.html"/>
+            <item name="Issue Tracking"          href="issue-tracking.html"/>
+            <item name="Source Repository"       href="source-repository.html"/>
+            <item name="Building"                href="building.html"/>
             <item name="Javadoc (SVN latest)"    href="apidocs/index.html"/>
         </menu>
 

Modified: commons/proper/jexl/trunk/xdocs/index.xml
URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/xdocs/index.xml?rev=888877&r1=888876&r2=888877&view=diff
==============================================================================
--- commons/proper/jexl/trunk/xdocs/index.xml (original)
+++ commons/proper/jexl/trunk/xdocs/index.xml Wed Dec  9 17:13:09 2009
@@ -85,17 +85,15 @@
         <section name="A Brief Example">
             <p>
             When evaluating expressions, JEXL merges an
-                <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/Expression.html">Expression</a>
+                <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl2/Expression.html">Expression</a>
             with a
-                <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/JexlContext.html">JexlContext</a>.
+                <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl2/JexlContext.html">JexlContext</a>.
             An Expression is created using
-                <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/JexlEngine.html#createExpression(java.lang.String)">ExpressionFactory.createExpression()</a>,
-            passing a String containing valid JEXL syntax.  A JexlContext is created using
-                <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/JexlHelper.html#createContext()">new JexlContext.Mapped()</a>,
-            and variables are put into a map exposed through the
-                <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl/JexlContext.html#getVars()">getVars()</a>
-            method on JexlContext.  The following example, takes a variable named foo, and
-            invokes the bar() method on the property innerFoo:
+                <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl2/JexlEngine.html#createExpression(java.lang.String)">ExpressionFactory.createExpression()</a>,
+            passing a String containing valid JEXL syntax.  A JexlContext can be created using a
+                <a href="http://commons.apache.org/jexl/apidocs/org/apache/commons/jexl2/MapContext.html">new MapContext.Mapped()</a>;
+            a map of variables that will be internally wrapped can be optionally provided through its constructor.
+            The following example, takes a variable named foo, and invokes the bar() method on the property innerFoo:
             </p>
 
             <source><![CDATA[
@@ -106,7 +104,7 @@
             Expression e = jexl.createExpression( jexlExp );
 
             // Create a context and add data
-            JexlContext jc = new JexlContext.Mapped();
+            JexlContext jc = new MapContext();
             jc.set("foo", new Foo() );
 
             // Now evaluate the expression, getting the result