jenkins-commons-jexl-1.1-jenkins-20111212/0000775000175000017500000000000011746230570020434 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/LICENSE.txt0000664000175000017500000002645011671435474022275 0ustar jamespagejamespage Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed 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. jenkins-commons-jexl-1.1-jenkins-20111212/.checkclipse0000664000175000017500000000040311671435474022716 0ustar jamespagejamespage#Tue May 02 15:43:07 EST 2006 filenames.properties=/Jexl/src/conf/checkstyle.properties enabled=true projectclassloader=true filenames.config=/Jexl/src/conf/checkstyle.xml additional_jars=| filenames.filter=/Jexl/src/conf/checkclipse-filter.properties jenkins-commons-jexl-1.1-jenkins-20111212/pom.xml0000664000175000017500000000726511671435474021772 0ustar jamespagejamespage 4.0.0 org.jenkins-ci commons-jexl Commons JEXL 1.1-jenkins-20111212 Jexl is an implementation of the JSTL Expression Language with extensions. http://jakarta.apache.org/commons/jexl/ The Apache Software License, Version 2.0 /LICENSE.txt The Apache Software Foundation http://jakarta.apache.org src/java src/test maven-surefire-plugin org.apache.xerces.parsers.SAXParser **/*Test.java maven-jar-plugin org.apache.commons.jexl Apache Software Foundation 1.0 Apache Software Foundation org.apache 1.1-SNAPSHOT ${maven.compile.source} ${maven.compile.target} maven-compiler-plugin true false true 1.2 1.2 org.codehaus.mojo javacc-maven-plugin 2.5 jjtree-javacc src/java org/apache/commons/jexl/parser/*.jjt commons-logging commons-logging 1.0.3 junit junit 3.8.1 true false maven.jenkins-ci.org http://maven.jenkins-ci.org:8081/content/repositories/releases maven2-repository.dev.java.net Java.net Repository for Maven http://download.java.net/maven/2/ jenkins-commons-jexl-1.1-jenkins-20111212/src/0000775000175000017500000000000011671435474021232 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/java/0000775000175000017500000000000011671435474022153 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/0000775000175000017500000000000011671435474022742 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/0000775000175000017500000000000011671435474024163 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/0000775000175000017500000000000011671435474025636 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/0000775000175000017500000000000011671435474026600 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/resolver/0000775000175000017500000000000011671435474030441 5ustar jamespagejamespage././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/resolver/FlatResolver.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/resolver/FlatResolver.jav0000664000175000017500000000455211671435474033561 0ustar jamespagejamespage/* * 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.jexl.resolver; import org.apache.commons.jexl.JexlExprResolver; import org.apache.commons.jexl.JexlContext; /** * Simple resolver to try the expression as-is from the context. * * For example, you could resolve ant-ish properties (foo.bar.woogie) * using this... * * hint, hint... * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: FlatResolver.java 480412 2006-11-29 05:11:23Z bayard $ */ public class FlatResolver implements JexlExprResolver { /** * Flag to return NO_VALUE on null from context. * this allows jexl to try to evaluate */ protected boolean noValOnNull = true; /** * Default CTOR. */ public FlatResolver() { } /** * CTOR that lets you override the default behavior of * noValOnNull, which is true. (jexl gets a shot after if null) * * @param valOnNull Whether NO_VALUE will be returned instead of null. */ public FlatResolver(boolean valOnNull) { noValOnNull = valOnNull; } /** * Try to resolve expression as-is. * * @param context The context for resolution. * @param expression The flat expression. * @return The resolved value. */ public Object evaluate(JexlContext context, String expression) { Object val = context.getVars().get(expression); if (val == null && noValOnNull) { return JexlExprResolver.NO_VALUE; } return val; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/ExpressionImpl.java0000664000175000017500000001075511671435474032434 0ustar jamespagejamespage/* * 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.jexl; import java.util.ArrayList; import java.util.List; import org.apache.commons.jexl.parser.SimpleNode; /** * Instances of ExpressionImpl are created by the {@link ExpressionFactory}, * and this is the default implementation of the {@link Expression} interface. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: ExpressionImpl.java 480412 2006-11-29 05:11:23Z bayard $ */ class ExpressionImpl implements Expression { /** resolvers called before expression evaluation. */ protected List preResolvers; /** resolvers called after expression evaluation. */ protected List postResolvers; /** * Original expression. This is just a 'snippet', not a valid statement * (i.e. foo.bar() vs foo.bar(); */ protected String expression; /** * The resulting AST we can call value() on. */ protected SimpleNode node; /** * do not let this be generally instantiated with a 'new'. * * @param expr the expression. * @param ref the parsed expression. */ ExpressionImpl(String expr, SimpleNode ref) { expression = expr; node = ref; } /** * {@inheritDoc} */ public Object evaluate(JexlContext context) throws Exception { Object val = null; /* * if we have pre resolvers, give them a wack */ if (preResolvers != null) { val = tryResolver(preResolvers, context); if (val != JexlExprResolver.NO_VALUE) { return val; } } val = node.value(context); /* * if null, call post resolvers */ if (val == null && postResolvers != null) { val = tryResolver(postResolvers, context); if (val != JexlExprResolver.NO_VALUE) { return val; } } return val; } /** * Tries the resolvers in the given resolverlist against the context. * * @param resolverList list of JexlExprResolvers * @param context JexlContext to use for evauluation * @return value (including null) or JexlExprResolver.NO_VALUE */ protected Object tryResolver(List resolverList, JexlContext context) { Object val = JexlExprResolver.NO_VALUE; String expr = getExpression(); for (int i = 0; i < resolverList.size(); i++) { JexlExprResolver jer = (JexlExprResolver) resolverList.get(i); val = jer.evaluate(context, expr); /* * as long as it's not NO_VALUE, return it */ if (val != JexlExprResolver.NO_VALUE) { return val; } } return val; } /** * {@inheritDoc} */ public String getExpression() { return expression; } /** * {@inheritDoc} */ public void addPreResolver(JexlExprResolver resolver) { if (preResolvers == null) { preResolvers = new ArrayList(); } preResolvers.add(resolver); } /** * {@inheritDoc} */ public void addPostResolver(JexlExprResolver resolver) { if (postResolvers == null) { postResolvers = new ArrayList(); } postResolvers.add(resolver); } /** * Provide a string representation of the expression. * * @return the expression or blank if it's null. */ public String toString() { String expr = getExpression(); return expr == null ? "" : expr; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/ExpressionFactory.java0000664000175000017500000001430311671435474033133 0ustar jamespagejamespage/* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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.jexl; import java.io.StringReader; import org.apache.commons.jexl.parser.ASTExpressionExpression; import org.apache.commons.jexl.parser.ASTForeachStatement; import org.apache.commons.jexl.parser.ASTIfStatement; import org.apache.commons.jexl.parser.ASTReferenceExpression; import org.apache.commons.jexl.parser.ASTStatementExpression; import org.apache.commons.jexl.parser.ASTWhileStatement; import org.apache.commons.jexl.parser.Parser; import org.apache.commons.jexl.parser.SimpleNode; import org.apache.commons.jexl.parser.TokenMgrError; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** *

* Creates Expression objects. To create a JEXL Expression object, pass * valid JEXL syntax to the static createExpression() method: *

* *
 * String jexl = "array[1]";
 * Expression expression = ExpressionFactory.createExpression( jexl );
 * 
* *

* When an {@link Expression} object is created, the JEXL syntax is * parsed and verified. If the supplied expression is neither an * expression nor a reference, an exception is thrown from createException(). *

* @since 1.0 * @author Geir Magnusson Jr. * @version $Id: ExpressionFactory.java 429169 2006-08-06 11:36:29 -0700 (Sun, 06 Aug 2006) rahul $ */ public class ExpressionFactory { /** * The Log to which all ExpressionFactory messages will be logged. */ protected static Log log = LogFactory.getLog("org.apache.commons.jexl.ExpressionFactory"); /** * The singleton ExpressionFactory also holds a single instance of * {@link Parser}. * When parsing expressions, ExpressionFactory synchronizes on Parser. */ protected static Parser parser = new Parser(new StringReader(";")); //$NON-NLS-1$ /** * ExpressionFactory is a singleton and this is the private * instance fufilling that pattern. */ protected static ExpressionFactory ef = new ExpressionFactory(); /** * Private constructor, the single instance is always obtained * with a call to getInstance(). */ private ExpressionFactory() { } /** * Returns the single instance of ExpressionFactory. * @return the instance of ExpressionFactory. */ protected static ExpressionFactory getInstance() { return ef; } /** * Creates an Expression from a String containing valid * JEXL syntax. This method parses the expression which * must contain either a reference or an expression. * @param expression A String containing valid JEXL syntax * @return An Expression object which can be evaluated with a JexlContext * @throws Exception An exception can be thrown if there is a problem * parsing this expression, or if the expression is neither an * expression or a reference. */ public static Expression createExpression(String expression) throws Exception { return getInstance().createNewExpression(expression); } /** * Creates a new Expression based on the expression string. * * @param expression valid Jexl expression * @return Expression * @throws Exception for a variety of reasons - mostly malformed * Jexl expression */ protected Expression createNewExpression(final String expression) throws Exception { String expr = cleanExpression(expression); // Parse the Expression SimpleNode tree; synchronized (parser) { log.debug("Parsing expression: " + expr); try { tree = parser.parse(new StringReader(expr)); } catch (TokenMgrError e) { // this is thrown if there's syntax error. // most callers aren't expecting the parsing error to be this fatal, // so let's wrap it to Exception (not Error) to let the caller catch it throw new JexlException("Failed to parse "+expr,e); } } if (tree.jjtGetNumChildren() > 1 && log.isWarnEnabled()) { log.warn("The JEXL Expression created will be a reference" + " to the first expression from the supplied script: \"" + expression + "\" "); } // Must be a simple reference, expression, statement or if, otherwise // throw an exception. SimpleNode node = (SimpleNode) tree.jjtGetChild(0); // TODO: Can we get rid of these checks? if (node instanceof ASTReferenceExpression || node instanceof ASTExpressionExpression || node instanceof ASTStatementExpression || node instanceof ASTIfStatement || node instanceof ASTWhileStatement || node instanceof ASTForeachStatement ) { return new ExpressionImpl(expression, node); } log.error("Invalid Expression, node of type: " + node.getClass().getName()); throw new Exception("Invalid Expression: not a Reference, Expression, " + "Statement or If"); } /** * Trims the expression and adds a semi-colon if missing. * @param expression to clean * @return trimmed expression ending in a semi-colon */ private String cleanExpression(String expression) { String expr = expression.trim(); if (!expr.endsWith(";")) { expr += ";"; } return expr; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/package.html0000664000175000017500000000536211671435474031067 0ustar jamespagejamespage Package Documentation for org.apache.commons.jexl Package Provides a framework for evaluating JEXL expressions.

Introduction

Java Expression Language (JEXL) is an expression language engine which can be embedded in applications and frameworks. JEXL is inspired by Jakarta Velocity and the Expression Language defined in the JavaServer Pages Standard Tag Library version 1.1 (JSTL) and JavaServer Pages version 2.0 (JSP).

JEXL attempts to bring some of the lessons learned by the Velocity community about expression languages in templating to a wider audience. Commons Jelly needed Velocity-ish method access, it just had to have it.

It must be noted that JEXL is not a compatibile implementation of EL as defined in JSTL 1.1 (JSR-052) or JSP 2.0 (JSR-152). For a compatible implementation of these specifications, see the Commons EL project.

A Brief Example

When evaluating expressions, JEXL merges an Expression with a JexlContext. An Expression is created using ExpressionFactory.createExpression(), passing a String containing valid JEXL syntax. A JexlContext is created using JexlHelper.createContext(), and variables are put into a map exposed through the getVars() method on JexlContext. The following example, takes a variable named foo, and invokes the bar() method on the property innerFoo:

    // Create an expression object
    String jexlExp = "foo.innerFoo.bar()";
    Expression e = ExpressionFactory.createExpression( jexlExp );

    // Create a context and add data
    JexlContext jc = JexlHelper.createContext();
    jc.getVars().put("foo", new Foo() );

    // Now evaluate the expression, getting the result
    Object o = e.evaluate(jc);
jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/context/0000775000175000017500000000000011671435474030264 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/context/package.html0000664000175000017500000000102611671435474032544 0ustar jamespagejamespage Package Documentation for org.apache.commons.jexl.context Package Simple JexlContext implementations.

Introduction

This package only contains one JexlContext implementation, the HashMapContext. A HashMapContext is simply an extension of HashMap which implements the JexlContext interface.

././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/context/HashMapContext.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/context/HashMapContext.ja0000664000175000017500000000311211671435474033463 0ustar jamespagejamespage/* * 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.jexl.context; import org.apache.commons.jexl.JexlContext; import java.util.HashMap; import java.util.Map; /** * Implementation of JexlContext based on a HashMap. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: HashMapContext.java 480412 2006-11-29 05:11:23Z bayard $ */ public class HashMapContext extends HashMap implements JexlContext { /** serialization version id jdk13 generated. */ static final long serialVersionUID = 5715964743204418854L; /** * {@inheritDoc} */ public void setVars(Map vars) { clear(); putAll(vars); } /** * {@inheritDoc} */ public Map getVars() { return this; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/JexlExprResolver.java0000664000175000017500000000337211671435474032733 0ustar jamespagejamespage/* * 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.jexl; /** * A Resolver allows custom resolution of the expression, and can be * added in front of the jexl engine, or after in the evaluation. * * @todo This needs to be explained in detail. Why do this? * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: JexlExprResolver.java 480412 2006-11-29 05:11:23Z bayard $ */ public interface JexlExprResolver { /** represents an expression result of no value. */ Object NO_VALUE = new Object(); /** * Evaluates an expression against the context. * * @todo Must detail the expectations and effects of this resolver. * @param context current data context * @param expression expression to evauluate * @return value (may be null) or the NO_VALUE object to * indicate no resolution. */ Object evaluate(JexlContext context, String expression); } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/Script.java0000664000175000017500000000353011671435474030710 0ustar jamespagejamespage/* * 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.jexl; /** *

A JEXL Script.

*

A script is some valid JEXL syntax to be executed with * a given set of {@link JexlContext variables}.

*

A script is a group of statements, separated by semicolons.

*

The statements can be blocks (curly braces containing code), * Control statements such as if and while * as well as expressions and assignment statements.

* * @since 1.1 */ public interface Script { /** * Executes the script with the variables contained in the * supplied {@link JexlContext}. * * @param context A JexlContext containing variables. * @return The result of this script, usually the result of * the last statement. * @throws Exception on any script parse or execution error. */ Object execute(JexlContext context) throws Exception; /** * Returns the text of this Script. * @return The script to be executed. */ String getText(); } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/junit/0000775000175000017500000000000011671435474027731 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/junit/package.html0000664000175000017500000000227611671435474032221 0ustar jamespagejamespage Package Documentation for org.apache.commons.jexl.junit Package Using JEXL expressions in JUnit assertions.

Introduction

This package only contains one class, Asserter, which allows you to use a JEXL expression in a JUnit assertion. The following example demonstrates the use of the Asserter class. An instance is created, and the internal JexlContext is populated via calls to setVariable(). Calls to assertExpression() succeed if the expression evaluates to the value of the second parameter, otherwise an AssertionFailedException is thrown.

   Asserter asserter = new Asserter();
   asserter.setVariable("foo", new Foo());
   asserter.setVariable("person", "James");

   asserter.assertExpression("person", "James");
   asserter.assertExpression("size(person)", new Integer(5));
        
   asserter.assertExpression("foo.getCount()", new Integer(5));
   asserter.assertExpression("foo.count", new Integer(5));
  
jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/junit/Asserter.java0000664000175000017500000000576311671435474032377 0ustar jamespagejamespage/* * 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.jexl.junit; import java.util.HashMap; import java.util.Map; import junit.framework.Assert; import org.apache.commons.jexl.Expression; import org.apache.commons.jexl.ExpressionFactory; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.JexlHelper; /** * A utility class for performing JUnit based assertions using Jexl * expressions. This class can make it easier to do unit tests using * Jexl navigation expressions. * * @since 1.0 * @author James Strachan * @version $Revision: 480412 $ */ public class Asserter extends Assert { /** variables used during asserts. */ private final Map variables = new HashMap(); /** context to use during asserts. */ private final JexlContext context = JexlHelper.createContext(); /** * * Create an asserter. */ public Asserter() { } /** * This constructor will register the given variableValue as the * "this" variable. * * @param variableValue 'this'. */ public Asserter(Object variableValue) { setVariable("this", variableValue); } /** * Performs an assertion that the value of the given Jexl expression * evaluates to the given expected value. * * @param expression is the Jexl expression to evaluate * @param expected is the expected value of the expression * @throws Exception if the expression could not be evaluationed or an assertion * fails */ public void assertExpression(String expression, Object expected) throws Exception { Expression exp = ExpressionFactory.createExpression(expression); context.setVars(variables); Object value = exp.evaluate(context); assertEquals("expression: " + expression, expected, value); } /** * Puts a variable of a certain name in the context so that it can be used from * assertion expressions. * * @param name variable name * @param value variable value */ public void setVariable(String name, Object value) { variables.put(name, value); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/ScriptImpl.java0000664000175000017500000000337511671435474031541 0ustar jamespagejamespage/* * 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.jexl; import org.apache.commons.jexl.parser.ASTJexlScript; /** * Simple script implementation. * @since 1.1 */ class ScriptImpl implements Script { /** text of the script. */ private final String text; /** syntax tree. */ private final ASTJexlScript parsedScript; /** * Create a new Script from the given string and parsed syntax. * @param scriptText the text of the script. * @param scriptTree the parsed script. */ public ScriptImpl(String scriptText, ASTJexlScript scriptTree) { text = scriptText; parsedScript = scriptTree; } /** * {@inheritDoc} */ public Object execute(JexlContext context) throws Exception { // TODO Auto-generated method stub return parsedScript.value(context); } /** * {@inheritDoc} */ public String getText() { return text; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/JexlContext.java0000664000175000017500000000353011671435474031713 0ustar jamespagejamespage/* * 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.jexl; import java.util.Map; /** * Holds a Map of variables which are referenced in a JEXL expression. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: JexlContext.java 480412 2006-11-29 05:11:23Z bayard $ */ public interface JexlContext { /** * Replaces variables in a JexlContext with the variables contained * in the supplied Map. When setVars() is called on a JexlContext, * it clears the current Map and puts each entry of the * supplied Map into the current variable Map. * * @param vars Contents of vars will be replaced with the content * of this Map */ void setVars(Map vars); /** * Retrives the Map of variables associated with this JexlContext. The * keys of this map correspond to variable names referenced in a * JEXL expression. * * @return A reference to the variable Map associated with this JexlContext. */ Map getVars(); } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/JexlException.java0000664000175000017500000000225711671435474032232 0ustar jamespagejamespage/* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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.jexl; /** * Signals an error inside JEXL. * * @author Kohsuke Kawaguchi */ public class JexlException extends Exception { private Throwable cause; public JexlException(String message) { this(message,null); } public JexlException(String message, Throwable cause) { super(message); this.cause = cause; } public JexlException(Throwable cause) { this(cause.getMessage(),cause); } public Throwable getCause() { return cause; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/Expression.java0000664000175000017500000000463011671435474031605 0ustar jamespagejamespage/* * 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.jexl; /** *

* Represents a single JEXL expression. This simple interface * provides access to the underlying expression through getExpression(), * and it provides hooks to add a pre- and post- expression resolver. *

* *

* An expression is different than a script - it is simply a reference of * an expression. *

* * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: Expression.java 480412 2006-11-29 05:11:23Z bayard $ */ public interface Expression { /** * Evaluates the expression with the variables contained in the * supplied {@link JexlContext}. * * @param context A JexlContext containing variables. * @return The result of this evaluation * @throws Exception on any error */ Object evaluate(JexlContext context) throws Exception; /** * Returns the JEXL expression this Expression was created with. * * @return The JEXL expression to be evaluated */ String getExpression(); /** * Allows addition of a resolver to allow custom interdiction of * expression evaluation. * * @param resolver resolver to be called before Jexl expression evaluated */ void addPreResolver(JexlExprResolver resolver); /** * Allows addition of a resolver to allow custom interdiction of * expression evaluation. * * @param resolver resolver to be called if Jexl expression * evaluated to null. */ void addPostResolver(JexlExprResolver resolver); } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/ScriptFactory.java0000664000175000017500000001637011671435474032246 0ustar jamespagejamespage/* * Copyright 2002-2006 The Apache Software Foundation. * * Licensed 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.jexl; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StringReader; import java.net.URL; import java.net.URLConnection; import org.apache.commons.jexl.parser.ASTJexlScript; import org.apache.commons.jexl.parser.ParseException; import org.apache.commons.jexl.parser.Parser; import org.apache.commons.jexl.parser.SimpleNode; import org.apache.commons.jexl.parser.TokenMgrError; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** *

* Creates {@link Script}s. To create a JEXL Script, pass * valid JEXL syntax to the static createScript() method: *

* *
 * String jexl = "y = x * 12 + 44; y = y * 4;";
 * Script script = ScriptFactory.createScript( jexl );
 * 
* *

* When an {@link Script} is created, the JEXL syntax is * parsed and verified. *

* @since 1.1 * @version $Id: ScriptFactory.java 429175 2006-08-06 12:05:23 -0700 (Sun, 06 Aug 2006) rahul $ */ public class ScriptFactory { /** The Log to which all ScriptFactory messages will be logged.*/ protected static Log log = LogFactory.getLog("org.apache.commons.jexl.ScriptFactory"); /** * The singleton ScriptFactory also holds a single instance of * {@link Parser}. When parsing expressions, ScriptFactory * synchronizes on Parser. */ protected static Parser parser = new Parser(new StringReader(";")); /** * ScriptFactory is a singleton and this is the private * instance fufilling that pattern. */ protected static ScriptFactory factory = new ScriptFactory(); /** * Private constructor, the single instance is always obtained * with a call to getInstance(). */ private ScriptFactory() { } /** * Returns the single instance of ScriptFactory. * @return the instance of ScriptFactory. */ protected static ScriptFactory getInstance() { return factory; } /** * Creates a Script from a String containing valid JEXL syntax. * This method parses the script which validates the syntax. * * @param scriptText A String containing valid JEXL syntax * @return A {@link Script} which can be executed with a * {@link JexlContext}. * @throws Exception An exception can be thrown if there is a * problem parsing the script. */ public static Script createScript(String scriptText) throws Exception { return getInstance().createNewScript(scriptText); } /** * Creates a Script from a {@link File} containing valid JEXL syntax. * This method parses the script and validates the syntax. * * @param scriptFile A {@link File} containing valid JEXL syntax. * Must not be null. Must be a readable file. * @return A {@link Script} which can be executed with a * {@link JexlContext}. * @throws Exception An exception can be thrown if there is a problem * parsing the script. */ public static Script createScript(File scriptFile) throws Exception { if (scriptFile == null) { throw new NullPointerException("scriptFile is null"); } if (!scriptFile.canRead()) { throw new IOException("Can't read scriptFile (" + scriptFile.getCanonicalPath() + ")"); } BufferedReader reader = new BufferedReader(new FileReader(scriptFile)); return createScript(readerToString(reader)); } /** * Creates a Script from a {@link URL} containing valid JEXL syntax. * This method parses the script and validates the syntax. * * @param scriptUrl A {@link URL} containing valid JEXL syntax. * Must not be null. Must be a readable file. * @return A {@link Script} which can be executed with a * {@link JexlContext}. * @throws Exception An exception can be thrown if there is a problem * parsing the script. */ public static Script createScript(URL scriptUrl) throws Exception { if (scriptUrl == null) { throw new NullPointerException("scriptUrl is null"); } URLConnection connection = scriptUrl.openConnection(); BufferedReader reader = new BufferedReader( new InputStreamReader(connection.getInputStream())); return createScript(readerToString(reader)); } /** * Creates a new Script based on the string. * * @param scriptText valid Jexl script * @return Script a new script * @throws Exception for a variety of reasons - mostly malformed scripts */ protected Script createNewScript(String scriptText) throws Exception { String cleanText = cleanScript(scriptText); SimpleNode script; // Parse the Expression synchronized (parser) { log.debug("Parsing script: " + cleanText); try { script = parser.parse(new StringReader(cleanText)); } catch (TokenMgrError tme) { throw new ParseException(tme.getMessage()); } } if (script instanceof ASTJexlScript) { return new ScriptImpl(cleanText, (ASTJexlScript) script); } else { throw new IllegalStateException("Parsed script is not " + "an ASTJexlScript"); } } /** * @todo move to ParseUtils? * Trims the expression and adds a semi-colon if missing. * @param script to clean * @return trimmed expression ending in a semi-colon */ private String cleanScript(String script) { String expr = script.trim(); if (!expr.endsWith(";")) { expr += ";"; } return expr; } /** * Read a buffered reader into a StringBuffer and return a String with * the contents of the reader. * @param reader to be read. * @return the contents of the reader as a String. * @throws IOException on any error reading the reader. */ private static String readerToString(BufferedReader reader) throws IOException { StringBuffer buffer = new StringBuffer(); try { String line = null; while ((line = reader.readLine()) != null) { buffer.append(line).append('\n'); } return buffer.toString(); } finally { reader.close(); } } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/0000775000175000017500000000000011671435474027555 5ustar jamespagejamespage././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/EnumerationIterator.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/EnumerationIterator.0000664000175000017500000000412411671435474033557 0ustar jamespagejamespage/* * 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.jexl.util; import java.util.Iterator; import java.util.Enumeration; /** * An Iterator wrapper for an Enumeration. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: EnumerationIterator.java 480412 2006-11-29 05:11:23Z bayard $ */ public class EnumerationIterator implements Iterator { /** * The enumeration to iterate over. */ private final Enumeration enumeration; /** * Creates a new iteratorwrapper instance for the specified * Enumeration. * * @param enumer The Enumeration to wrap. */ public EnumerationIterator(Enumeration enumer) { enumeration = enumer; } /** * Move to next element in the array. * * @return The next object in the array. */ public Object next() { return enumeration.nextElement(); } /** * Check to see if there is another element in the array. * * @return Whether there is another element. */ public boolean hasNext() { return enumeration.hasMoreElements(); } /** * Unimplemented. No analogy in Enumeration */ public void remove() { // not implemented } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/ArrayIterator.java0000664000175000017500000000662411671435474033220 0ustar jamespagejamespage/* * 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.jexl.util; import java.util.Iterator; import java.util.NoSuchElementException; import java.lang.reflect.Array; /** *

* An Iterator wrapper for an Object[]. This will * allow us to deal with all array like structures * in a consistent manner. *

*

* WARNING : this class's operations are NOT synchronized. * It is meant to be used in a single thread, newly created * for each use in the #foreach() directive. * If this is used or shared, synchronize in the * next() method. *

* * @since 1.0 * @author Jason van Zyl * @author Geir Magnusson Jr. * @version $Id: ArrayIterator.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ArrayIterator implements Iterator { /** * The objects to iterate over. */ private final Object array; /** * The current position and size in the array. */ private int pos; /** * The size of the array. */ private final int size; /** * Creates a new iterator instance for the specified array. * * @param arr The array for which an iterator is desired. */ public ArrayIterator(Object arr) { /* * if this isn't an array, then throw. Note that this is * for internal use - so this should never happen - if it does * we screwed up. */ if (!arr.getClass().isArray()) { throw new IllegalArgumentException("Programmer error :" + " internal ArrayIterator invoked w/o array"); } array = arr; pos = 0; size = Array.getLength(array); } /** * Move to next element in the array. * * @return The next object in the array. */ public Object next() { if (pos < size) { return Array.get(array, pos++); } /* * we screwed up... */ throw new NoSuchElementException("No more elements: " + pos + " / " + size); } /** * Check to see if there is another element in the array. * * @return Whether there is another element. */ public boolean hasNext() { return (pos < size); } /** * No op--merely added to satify the Iterator interface. */ public void remove() { throw new UnsupportedOperationException(); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/PropertyExecutor.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/PropertyExecutor.jav0000664000175000017500000000744411671435474033633 0ustar jamespagejamespage/* * 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.jexl.util; import java.lang.reflect.InvocationTargetException; import org.apache.commons.jexl.util.introspection.Introspector; import org.apache.commons.logging.Log; /** * Returned the value of object property when executed. * @since 1.0 */ public class PropertyExecutor extends AbstractExecutor { /** index of the first character of the property. */ private static final int PROPERTY_START_INDEX = 3; /** The JEXL introspector used. */ protected Introspector introspector = null; /** The method used. */ protected String methodUsed = null; /** * Constructor. * * @param r The log for this property executor instance. * @param ispctr The JEXL introspector. * @param clazz The class being examined. * @param property The property being addressed. */ public PropertyExecutor(Log r, Introspector ispctr, Class clazz, String property) { rlog = r; introspector = ispctr; discover(clazz, property); } /** * Locate the getter method for this property. * * @param clazz The class being analyzed. * @param property Name of the property. */ protected void discover(Class clazz, String property) { /* * this is gross and linear, but it keeps it straightforward. */ try { char c; StringBuffer sb; Object[] params = {}; /* * start with get * this leaves the property name * as is... */ sb = new StringBuffer("get"); sb.append(property); methodUsed = sb.toString(); method = introspector.getMethod(clazz, methodUsed, params); if (method != null) { return; } /* * now the convenience, flip the 1st character */ c = sb.charAt(PROPERTY_START_INDEX); if (Character.isLowerCase(c)) { sb.setCharAt(PROPERTY_START_INDEX, Character.toUpperCase(c)); } else { sb.setCharAt(PROPERTY_START_INDEX, Character.toLowerCase(c)); } methodUsed = sb.toString(); method = introspector.getMethod(clazz, methodUsed, params); if (method != null) { return; } /** * pass through application level runtime exceptions */ } catch( RuntimeException e ) { throw e; } catch(Exception e) { rlog.error("PROGRAMMER ERROR : PropertyExector() : " + e); } } /** * {@inheritDoc} */ public Object execute(Object o) throws IllegalAccessException, InvocationTargetException { if (method == null) { return null; } return method.invoke(o, null); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/MapGetExecutor.java0000664000175000017500000000444411671435474033322 0ustar jamespagejamespage/* * 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.jexl.util; import java.util.Map; import org.apache.commons.logging.Log; /** * GetExecutor that is smart about Maps. If it detects one, it does not * use Reflection but a cast to access the getter. * * @author Henning P. Schmiedehausen * @version $Id$ */ public class MapGetExecutor extends AbstractExecutor { private final String property; public MapGetExecutor(final Log rlog, final Class clazz, final String property) { this.rlog = rlog; this.property = property; discover(clazz); } protected void discover(final Class clazz) { Class[] interfaces = clazz.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { if (interfaces[i].equals(Map.class)) { try { if (property != null) { method = Map.class.getMethod("get", new Class[]{Object.class}); } /** * pass through application level runtime exceptions */ } catch (RuntimeException e) { throw e; } catch (Exception e) { rlog.error("While looking for get('" + property + "') method:", e); } break; } } } public Object execute(final Object o) { return ((Map) o).get(property); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/Coercion.java0000664000175000017500000001256711671435474032174 0ustar jamespagejamespage/* * 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.jexl.util; /** * Coercion utilities for the JSTL EL-like coercion. * * @since 1.0 * @author Geir Magnusson Jr. */ public class Coercion { /** * Coerce to a Boolean. * * @param val Object to be coerced. * @return The Boolean coerced value, or null if none possible. */ public static Boolean coerceBoolean(Object val) { if (val == null) { return Boolean.FALSE; } else if (val instanceof Boolean) { return (Boolean) val; } else if (val instanceof String) { return Boolean.valueOf((String) val); } return null; } /** * Coerce to a Integer. * * @param val Object to be coerced. * @return The Integer coerced value. * @throws Exception If Integer coercion fails. */ public static Integer coerceInteger(Object val) throws Exception { if (val == null) { return new Integer(0); } else if (val instanceof String) { if ("".equals(val)) { return new Integer(0); } return Integer.valueOf((String) val); } else if (val instanceof Character) { return new Integer(((Character) val).charValue()); } else if (val instanceof Boolean) { throw new Exception("Boolean->Integer coercion exception"); } else if (val instanceof Number) { return new Integer(((Number) val).intValue()); } throw new Exception("Integer coercion exception"); } /** * Coerce to a Long. * * @param val Object to be coerced. * @return The Long coerced value. * @throws Exception If Long coercion fails. */ public static Long coerceLong(Object val) throws Exception { if (val == null) { return new Long(0); } else if (val instanceof String) { if ("".equals(val)) { return new Long(0); } return Long.valueOf((String) val); } else if (val instanceof Character) { return new Long(((Character) val).charValue()); } else if (val instanceof Boolean) { throw new Exception("Boolean->Long coercion exception"); } else if (val instanceof Number) { return new Long(((Number) val).longValue()); } throw new Exception("Long coercion exception"); } /** * Coerce to a Double. * * @param val Object to be coerced. * @return The Double coerced value. * @throws Exception If Double coercion fails. */ public static Double coerceDouble(Object val) throws Exception { if (val == null) { return new Double(0); } else if (val instanceof String) { if ("".equals(val)) { return new Double(0); } /* * the spec seems to be iffy about this. Going to give it a wack * anyway */ return new Double((String) val); } else if (val instanceof Character) { int i = ((Character) val).charValue(); return new Double(Double.parseDouble(String.valueOf(i))); } else if (val instanceof Boolean) { throw new Exception("Boolean->Double coercion exception"); } else if (val instanceof Double) { return (Double) val; } else if (val instanceof Number) { //The below construct is used rather than ((Number)val).doubleValue() to ensure //equality between comparint new Double( 6.4 / 3 ) and the jexl expression of 6.4 / 3 return new Double(Double.parseDouble(String.valueOf(val))); } throw new Exception("Double coercion exception"); } /** * Is Object a floating point number. * * @param o Object to be analyzed. * @return true if it is a Float or a Double. */ public static boolean isFloatingPoint(final Object o) { return o instanceof Float || o instanceof Double; } /** * Is Object a whole number. * * @param o Object to be analyzed. * @return true if Integer, Long, Byte, Short or Character. */ public static boolean isNumberable(final Object o) { return o instanceof Integer || o instanceof Long || o instanceof Byte || o instanceof Short || o instanceof Character; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/AbstractExecutor.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/AbstractExecutor.jav0000664000175000017500000000455311671435474033550 0ustar jamespagejamespage/* * 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.jexl.util; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.apache.commons.logging.Log; /** * Abstract class that is used to execute an arbitrary * method that is in introspected. This is the superclass * for the GetExecutor and PropertyExecutor. * * @since 1.0 * @author Jason van Zyl * @author Geir Magnusson Jr. * @version $Id: AbstractExecutor.java 584046 2007-10-12 05:14:37Z proyal $ */ public abstract class AbstractExecutor { /** The executor instance log. */ protected Log rlog = null; /** * Method to be executed. */ protected Method method = null; /** * Execute method against context. * * @param o The owner. * @return The return value. * @throws IllegalAccessException Method is inaccessible. * @throws InvocationTargetException Method body throws an exception. */ public abstract Object execute(Object o) throws IllegalAccessException, InvocationTargetException; /** * Tell whether the executor is alive by looking * at the value of the method. * * @return boolean Whether the executor is alive. */ public boolean isAlive() { return (method != null); } /** * Get the method to be executed. * * @return Method The method to be executed. */ public Method getMethod() { return method; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/0000775000175000017500000000000011671435474032455 5ustar jamespagejamespage././@LongLink0000000000000000000000000000016600000000000011570 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/IntrospectionUtils.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/Intros0000664000175000017500000001740011671435474033660 0ustar jamespagejamespage/* * 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.jexl.util.introspection; /** * @author Jason van Zyl * @author Bob McWhirter * @author Christoph Reck * @author Geir Magnusson Jr. * @author Attila Szegedi * @author Nathan Bubna * @version $Id: IntrospectionUtils.java 476785 2006-11-19 10:06:21Z henning $ */ public class IntrospectionUtils { /** * Determines whether a type represented by a class object is * convertible to another type represented by a class object using a * method invocation conversion, treating object types of primitive * types as if they were primitive types (that is, a Boolean actual * parameter type matches boolean primitive formal type). This behavior * is because this method is used to determine applicable methods for * an actual parameter list, and primitive types are represented by * their object duals in reflective method calls. * * @param formal the formal parameter type to which the actual * parameter type should be convertible * @param actual the actual parameter type. * @param possibleVarArg whether or not we're dealing with the last parameter * in the method declaration * @return true if either formal type is assignable from actual type, * or formal is a primitive type and actual is its corresponding object * type or an object type of a primitive type that can be converted to * the formal type. */ public static boolean isMethodInvocationConvertible(Class formal, Class actual, boolean possibleVarArg) { /* if it's a null, it means the arg was null */ if (actual == null && !formal.isPrimitive()) { return true; } /* Check for identity or widening reference conversion */ if (actual != null && formal.isAssignableFrom(actual)) { return true; } /* Check for boxing with widening primitive conversion. Note that * actual parameters are never primitives. */ if (formal.isPrimitive()) { if (formal == Boolean.TYPE && actual == Boolean.class) return true; if (formal == Character.TYPE && actual == Character.class) return true; if (formal == Byte.TYPE && actual == Byte.class) return true; if (formal == Short.TYPE && (actual == Short.class || actual == Byte.class)) return true; if (formal == Integer.TYPE && (actual == Integer.class || actual == Short.class || actual == Byte.class)) return true; if (formal == Long.TYPE && (actual == Long.class || actual == Integer.class || actual == Short.class || actual == Byte.class)) return true; if (formal == Float.TYPE && (actual == Float.class || actual == Long.class || actual == Integer.class || actual == Short.class || actual == Byte.class)) return true; if (formal == Double.TYPE && (actual == Double.class || actual == Float.class || actual == Long.class || actual == Integer.class || actual == Short.class || actual == Byte.class)) return true; } /* Check for vararg conversion. */ if (possibleVarArg && formal.isArray()) { if (actual.isArray()) { actual = actual.getComponentType(); } return isMethodInvocationConvertible(formal.getComponentType(), actual, false); } return false; } /** * Determines whether a type represented by a class object is * convertible to another type represented by a class object using a * method invocation conversion, without matching object and primitive * types. This method is used to determine the more specific type when * comparing signatures of methods. * * @param formal the formal parameter type to which the actual * parameter type should be convertible * @param actual the actual parameter type. * @param possibleVarArg whether or not we're dealing with the last parameter * in the method declaration * @return true if either formal type is assignable from actual type, * or formal and actual are both primitive types and actual can be * subject to widening conversion to formal. */ public static boolean isStrictMethodInvocationConvertible(Class formal, Class actual, boolean possibleVarArg) { /* we shouldn't get a null into, but if so */ if (actual == null && !formal.isPrimitive()) { return true; } /* Check for identity or widening reference conversion */ if (formal.isAssignableFrom(actual)) { return true; } /* Check for widening primitive conversion. */ if (formal.isPrimitive()) { if (formal == Short.TYPE && (actual == Byte.TYPE)) return true; if (formal == Integer.TYPE && (actual == Short.TYPE || actual == Byte.TYPE)) return true; if (formal == Long.TYPE && (actual == Integer.TYPE || actual == Short.TYPE || actual == Byte.TYPE)) return true; if (formal == Float.TYPE && (actual == Long.TYPE || actual == Integer.TYPE || actual == Short.TYPE || actual == Byte.TYPE)) return true; if (formal == Double.TYPE && (actual == Float.TYPE || actual == Long.TYPE || actual == Integer.TYPE || actual == Short.TYPE || actual == Byte.TYPE)) return true; } /* Check for vararg conversion. */ if (possibleVarArg && formal.isArray()) { if (actual.isArray()) { actual = actual.getComponentType(); } return isStrictMethodInvocationConvertible(formal.getComponentType(), actual, false); } return false; } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/Info.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/Info.j0000664000175000017500000000463611671435474033534 0ustar jamespagejamespagepackage org.apache.commons.jexl.util.introspection; /* * 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. */ /** * Little class to carry in info such as template name, line and column * for information error reporting from the uberspector implementations * * @author Geir Magnusson Jr. * @version $Id: Info.java 584046 2007-10-12 05:14:37Z proyal $ */ public class Info { private int line; private int column; private String templateName; /** * @param source Usually a template name. * @param line The line number from source. * @param column The column number from source. */ public Info(String source, int line, int column) { this.templateName = source; this.line = line; this.column = column; } /** * Force callers to set the location information. */ private Info() { } /** * @return The template name. */ public String getTemplateName() { return templateName; } /** * @return The line number. */ public int getLine() { return line; } /** * @return The column number. */ public int getColumn() { return column; } /** * Formats a textual representation of this object as SOURCE * [line X, column Y]. * * @return String representing this object. */ public String toString() { return getTemplateName() + " [line " + getLine() + ", column " + getColumn() + ']'; } } ././@LongLink0000000000000000000000000000015400000000000011565 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/ClassMap.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/ClassM0000664000175000017500000003062611671435474033571 0ustar jamespagejamespage/* * 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.jexl.util.introspection; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; /** * Taken from the Velocity tree so we can be self-sufficient * * A cache of introspection information for a specific class instance. Keys * {@link Method} objects by a concatenation of the method name and * the names of classes that make up the parameters. * * @author Jason van Zyl * @author Bob McWhirter * @author Attila Szegedi * @author Geir Magnusson Jr. * @author Henning P. Schmiedehausen * @version $Id: ClassMap.java 584046 2007-10-12 05:14:37Z proyal $ * @since 1.0 */ public class ClassMap { /** * Class passed into the constructor used to as the basis for the Method * map. */ private final Class clazz; private final Log rlog; private final MethodCache methodCache; /** * Standard constructor. * * @param aClass the class to deconstruct. */ public ClassMap(Class aClass, Log rlog) { clazz = aClass; this.rlog = rlog; methodCache = new MethodCache(); populateMethodCache(); } /** * @return the class object whose methods are cached by this map. */ Class getCachedClass() { return clazz; } /** * Find a Method using the method name and parameter objects. * * @param name The method name to look up. * @param params An array of parameters for the method. * @return A Method object representing the method to invoke or null. * @throws MethodMap.AmbiguousException When more than one method is a match for the parameters. */ public Method findMethod(final String name, final Object[] params) throws MethodMap.AmbiguousException { return methodCache.get(name, params); } /** * Populate the Map of direct hits. These * are taken from all the public methods * that our class, its parents and their implemented interfaces provide. */ private void populateMethodCache() { // // Build a list of all elements in the class hierarchy. This one is bottom-first (i.e. we start // with the actual declaring class and its interfaces and then move up (superclass etc.) until we // hit java.lang.Object. That is important because it will give us the methods of the declaring class // which might in turn be abstract further up the tree. // // We also ignore all SecurityExceptions that might happen due to SecurityManager restrictions (prominently // hit with Tomcat 5.5). // // We can also omit all that complicated getPublic, getAccessible and upcast logic that the class map had up // until Velocity 1.4. As we always reflect all elements of the tree (that's what we have a cache for), we will // hit the public elements sooner or later because we reflect all the public elements anyway. // List classesToReflect = new ArrayList(); // Ah, the miracles of Java for(;;) ... for (Class classToReflect = getCachedClass(); classToReflect != null; classToReflect = classToReflect.getSuperclass()) { if (Modifier.isPublic(classToReflect.getModifiers())) { classesToReflect.add(classToReflect); } Class[] interfaces = classToReflect.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { if (Modifier.isPublic(interfaces[i].getModifiers())) { classesToReflect.add(interfaces[i]); } } } for (Iterator it = classesToReflect.iterator(); it.hasNext();) { Class classToReflect = (Class) it.next(); try { Method[] methods = classToReflect.getMethods(); for (int i = 0; i < methods.length; i++) { // Strictly spoken that check shouldn't be necessary // because getMethods only returns public methods. int modifiers = methods[i].getModifiers(); if (Modifier.isPublic(modifiers) && (modifiers&ACC_BRIDGE)==0) // && !) { // Some of the interfaces contain abstract methods. That is fine, because the actual object must // implement them anyway (else it wouldn't be implementing the interface). If we find an abstract // method in a non-interface, we skip it, because we do want to make sure that no abstract methods end up in // the cache. // KK: if (classToReflect.isInterface() || !Modifier.isAbstract(modifiers)) { methodCache.put(methods[i]); // KK: } // KK: this abstract check prevents us from having a public base class definining a public abstract method // and use private subclass to implement that. When we actually try to invoke the method on an object, // we can reasonably expect that all the abstract methods are implemented. } } } catch (SecurityException se) // Everybody feels better with... { if (rlog.isDebugEnabled()) { rlog.debug("While accessing methods of " + classToReflect + ": ", se); } } } } /** * This is the cache to store and look up the method information. * * @author Henning P. Schmiedehausen * @version $Id: ClassMap.java 584046 2007-10-12 05:14:37Z proyal $ */ private static final class MethodCache { private static final class CacheMiss { } private static final CacheMiss CACHE_MISS = new CacheMiss(); private static final Object OBJECT = new Object(); private static final Map convertPrimitives = new HashMap(); static { convertPrimitives.put(Boolean.TYPE, Boolean.class.getName()); convertPrimitives.put(Byte.TYPE, Byte.class.getName()); convertPrimitives.put(Character.TYPE, Character.class.getName()); convertPrimitives.put(Double.TYPE, Double.class.getName()); convertPrimitives.put(Float.TYPE, Float.class.getName()); convertPrimitives.put(Integer.TYPE, Integer.class.getName()); convertPrimitives.put(Long.TYPE, Long.class.getName()); convertPrimitives.put(Short.TYPE, Short.class.getName()); } /** * Cache of Methods, or CACHE_MISS, keyed by method * name and actual arguments used to find it. */ private final Map cache = new HashMap(); /** * Map of methods that are searchable according to method parameters to find a match */ private final MethodMap methodMap = new MethodMap(); /** * Find a Method using the method name and parameter objects. * * Look in the methodMap for an entry. If found, * it'll either be a CACHE_MISS, in which case we * simply give up, or it'll be a Method, in which * case, we return it. * * If nothing is found, then we must actually go * and introspect the method from the MethodMap. * * @param name The method name to look up. * @param params An array of parameters for the method. * @return A Method object representing the method to invoke or null. * @throws MethodMap.AmbiguousException When more than one method is a match for the parameters. */ public synchronized Method get(final String name, final Object[] params) throws MethodMap.AmbiguousException { String methodKey = makeMethodKey(name, params); Object cacheEntry = cache.get(methodKey); // We looked this up before and failed. if (cacheEntry == CACHE_MISS) { return null; } if (cacheEntry == null) { try { // That one is expensive... cacheEntry = methodMap.find(name, params); } catch (MethodMap.AmbiguousException ae) { /* * that's a miss :-) */ cache.put(methodKey, CACHE_MISS); throw ae; } cache.put(methodKey, (cacheEntry != null) ? cacheEntry : CACHE_MISS); } // Yes, this might just be null. return (Method) cacheEntry; } public synchronized void put(Method method) { String methodKey = makeMethodKey(method); // We don't overwrite methods. Especially not if we fill the // cache from defined class towards java.lang.Object because // abstract methods in superclasses would else overwrite concrete // classes further down the hierarchy. if (cache.get(methodKey) == null) { cache.put(methodKey, method); methodMap.add(method); } } /** * Make a methodKey for the given method using * the concatenation of the name and the * types of the method parameters. * * @param method to be stored as key * @return key for ClassMap */ private String makeMethodKey(final Method method) { Class[] parameterTypes = method.getParameterTypes(); StringBuffer methodKey = new StringBuffer(method.getName()); for (int j = 0; j < parameterTypes.length; j++) { /* * If the argument type is primitive then we want * to convert our primitive type signature to the * corresponding Object type so introspection for * methods with primitive types will work correctly. * * The lookup map (convertPrimitives) contains all eight * primitives (boolean, byte, char, double, float, int, long, short) * known to Java. So it should never return null for the key passed in. */ if (parameterTypes[j].isPrimitive()) { methodKey.append((String) convertPrimitives.get(parameterTypes[j])); } else { methodKey.append(parameterTypes[j].getName()); } } return methodKey.toString(); } private String makeMethodKey(String method, Object[] params) { StringBuffer methodKey = new StringBuffer().append(method); for (int j = 0; j < params.length; j++) { Object arg = params[j]; if (arg == null) { arg = OBJECT; } methodKey.append(arg.getClass().getName()); } return methodKey.toString(); } } private static final int ACC_BRIDGE = 0x00000040; } ././@LongLink0000000000000000000000000000016100000000000011563 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/UberspectImpl.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/Ubersp0000664000175000017500000002737311671435474033654 0ustar jamespagejamespage/* * Copyright 2002,2004 The Apache Software Foundation. * * Licensed 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.jexl.util.introspection; import org.apache.commons.jexl.util.ArrayIterator; import org.apache.commons.jexl.util.EnumerationIterator; import org.apache.commons.jexl.util.AbstractExecutor; import org.apache.commons.jexl.util.GetExecutor; import org.apache.commons.jexl.util.BooleanPropertyExecutor; import org.apache.commons.jexl.util.PropertyExecutor; import org.apache.commons.logging.Log; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Field; import java.util.Iterator; import java.util.Collection; import java.util.Map; import java.util.Enumeration; import java.util.ArrayList; /** * Implementation of Uberspect to provide the default introspective * functionality of Velocity. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: UberspectImpl.java 398509 2006-05-01 03:34:35Z dion $ */ public class UberspectImpl implements Uberspect, UberspectLoggable { /** index of the first character of the property. */ private static final int PROPERTY_START_INDEX = 3; /** * Our runtime logger. */ private Log rlog; /** * the default Velocity introspector. */ private static Introspector introspector; /** * init - does nothing - we need to have setRuntimeLogger called before * getting our introspector, as the default vel introspector depends upon * it. * @throws Exception on any error. */ public void init() throws Exception { } /** * Sets the runtime logger - this must be called before anything else * besides init() as to get the logger. Makes the pull model appealing... * @param runtimeLogger service to use for logging. */ public void setRuntimeLogger(Log runtimeLogger) { rlog = runtimeLogger; introspector = new Introspector(rlog); } /** * {@inheritDoc} */ public Iterator getIterator(Object obj, Info i) throws Exception { if (obj.getClass().isArray()) { return new ArrayIterator(obj); } else if (obj instanceof Collection) { return ((Collection) obj).iterator(); } else if (obj instanceof Map) { return ((Map) obj).values().iterator(); } else if (obj instanceof Iterator) { rlog.warn("Warning! The iterative " + " is an Iterator in the #foreach() loop at [" + i.getLine() + "," + i.getColumn() + "]" + " in template " + i.getTemplateName() + ". Because it's not resetable," + " if used in more than once, this may lead to" + " unexpected results."); return ((Iterator) obj); } else if (obj instanceof Enumeration) { rlog.warn("Warning! The iterative " + " is an Enumeration in the #foreach() loop at [" + i.getLine() + "," + i.getColumn() + "]" + " in template " + i.getTemplateName() + ". Because it's not resetable," + " if used in more than once, this may lead to" + " unexpected results."); return new EnumerationIterator((Enumeration) obj); } /* we have no clue what this is */ rlog.warn("Could not determine type of iterator in " + "#foreach loop " + " at [" + i.getLine() + "," + i.getColumn() + "]" + " in template " + i.getTemplateName()); return null; } /** * {@inheritDoc} */ public VelMethod getMethod(Object obj, String methodName, Object[] args, Info i) throws Exception { if (obj == null) { return null; } Method m = introspector.getMethod(obj.getClass(), methodName, args); if (m == null && obj instanceof Class) { m = introspector.getMethod((Class) obj, methodName, args); } return (m == null) ? null : new VelMethodImpl(m); } /** * {@inheritDoc} */ public VelPropertyGet getPropertyGet(Object obj, final String identifier, Info i) throws Exception { AbstractExecutor executor; Class claz = obj.getClass(); /* * first try for a getFoo() type of property (also getfoo() ) */ executor = new PropertyExecutor(rlog, introspector, claz, identifier); /* * look for boolean isFoo() */ if (!executor.isAlive()) { executor = new BooleanPropertyExecutor(rlog, introspector, claz, identifier); } // llok for field if (!executor.isAlive()) { try { final Field field = obj.getClass().getField(identifier); return new VelPropertyGet() { public Object invoke(Object o) throws Exception { return field.get(o); } public boolean isCacheable() { return false; } public String getMethodName() { return identifier; } public boolean isAlive() { return true; } }; } catch (NoSuchFieldException e) { // fall through } } /* * if that didn't work, look for get("foo") */ if (!executor.isAlive()) { executor = new GetExecutor(rlog, introspector, claz, identifier); } return (executor == null) ? null : new VelGetterImpl(executor); } /** * {@inheritDoc} */ public VelPropertySet getPropertySet(Object obj, String identifier, Object arg, Info i) throws Exception { Class claz = obj.getClass(); VelMethod vm = null; try { /* * first, we introspect for the set setter method */ Object[] params = {arg}; try { vm = getMethod(obj, "set" + identifier, params, i); if (vm == null) { throw new NoSuchMethodException(); } } catch (NoSuchMethodException nsme2) { StringBuffer sb = new StringBuffer("set"); sb.append(identifier); if (Character.isLowerCase(sb.charAt(PROPERTY_START_INDEX))) { sb.setCharAt(PROPERTY_START_INDEX, Character.toUpperCase(sb.charAt(PROPERTY_START_INDEX))); } else { sb.setCharAt(PROPERTY_START_INDEX, Character.toLowerCase(sb.charAt(PROPERTY_START_INDEX))); } vm = getMethod(obj, sb.toString(), params, i); if (vm == null) { throw new NoSuchMethodException(); } } } catch (NoSuchMethodException nsme) { /* * right now, we only support the Map interface */ if (Map.class.isAssignableFrom(claz)) { Object[] params = {new Object(), new Object()}; vm = getMethod(obj, "put", params, i); if (vm != null) { return new VelSetterImpl(vm, identifier); } } } return (vm == null) ? null : new VelSetterImpl(vm); } /** * An implementation of {@link VelMethod}. */ public class VelMethodImpl implements VelMethod { /** the method. */ protected Method method = null; /** * Create a new instance. * * @param m the method. */ public VelMethodImpl(Method m) { method = m; } /** * {@inheritDoc} */ public Object invoke(Object o, Object[] params) throws Exception { try { return method.invoke(o, params); } catch (InvocationTargetException e) { final Throwable t = e.getTargetException(); if (t instanceof Exception) { throw (Exception) t; } else if (t instanceof Error) { throw (Error) t; } else { throw e; } } } /** * {@inheritDoc} */ public boolean isCacheable() { return true; } /** * {@inheritDoc} */ public String getMethodName() { return method.getName(); } /** * {@inheritDoc} */ public Class getReturnType() { return method.getReturnType(); } } /** * {@inheritDoc} */ public class VelGetterImpl implements VelPropertyGet { /** executor for performing the get. */ protected AbstractExecutor ae = null; /** * Create the getter using an {@link AbstractExecutor} to * do the work. * @param exec the executor. */ public VelGetterImpl(AbstractExecutor exec) { ae = exec; } /** * {@inheritDoc} */ public Object invoke(Object o) throws Exception { return ae.execute(o); } /** * {@inheritDoc} */ public boolean isCacheable() { return true; } /** * {@inheritDoc} */ public String getMethodName() { return ae.getMethod().getName(); } public boolean isAlive() { return true; } } /** * {@inheritDoc} */ public class VelSetterImpl implements VelPropertySet { /** the method to call. */ protected VelMethod vm = null; /** the key for indexed and other properties. */ protected String putKey = null; /** * Create an instance. * @param velmethod the method to call on set. */ public VelSetterImpl(VelMethod velmethod) { this.vm = velmethod; } /** * Create an instance. * @param velmethod the method to call on set. * @param key the index or other value passed to a * setProperty(xxx, value) method. */ public VelSetterImpl(VelMethod velmethod, String key) { this.vm = velmethod; putKey = key; } /** {@inheritDoc} */ public Object invoke(Object o, Object value) throws Exception { ArrayList al = new ArrayList(); if (putKey == null) { al.add(value); } else { al.add(putKey); al.add(value); } return vm.invoke(o, al.toArray()); } /** {@inheritDoc} */ public boolean isCacheable() { return true; } /** {@inheritDoc} */ public String getMethodName() { return vm.getMethodName(); } } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/Uberspect.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/Ubersp0000664000175000017500000000510111671435474033635 0ustar jamespagejamespagepackage org.apache.commons.jexl.util.introspection; /* * 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. */ import java.util.Iterator; /** * 'Federated' introspection/reflection interface to allow the introspection * behavior in Velocity to be customized. * * @author Geir Magusson Jr. * @version $Id: Uberspect.java 584046 2007-10-12 05:14:37Z proyal $ */ public interface Uberspect { /** * Initializer - will be called before use * @throws Exception */ public void init() throws Exception; /** * To support iteratives - #foreach() * @param obj * @param info * @return An Iterator. * @throws Exception */ public Iterator getIterator(Object obj, Info info) throws Exception; /** * Returns a general method, corresponding to $foo.bar( $woogie ) * @param obj * @param method * @param args * @param info * @return A Velocity Method. * @throws Exception */ public VelMethod getMethod(Object obj, String method, Object[] args, Info info) throws Exception; /** * Property getter - returns VelPropertyGet appropos for #set($foo = $bar.woogie) * @param obj * @param identifier * @param info * @return A Velocity Getter. * @throws Exception */ public VelPropertyGet getPropertyGet(Object obj, String identifier, Info info) throws Exception; /** * Property setter - returns VelPropertySet appropos for #set($foo.bar = "geir") * @param obj * @param identifier * @param arg * @param info * @return A Velocity Setter. * @throws Exception */ public VelPropertySet getPropertySet(Object obj, String identifier, Object arg, Info info) throws Exception; } ././@LongLink0000000000000000000000000000016000000000000011562 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/Introspector.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/Intros0000664000175000017500000001043411671435474033660 0ustar jamespagejamespage/* * 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.jexl.util.introspection; import java.lang.reflect.Method; import org.apache.commons.logging.Log; /** * This basic function of this class is to return a Method * object for a particular class given the name of a method * and the parameters to the method in the form of an Object[] * * The first time the Introspector sees a * class it creates a class method map for the * class in question. Basically the class method map * is a Hashtable where Method objects are keyed by a * concatenation of the method name and the names of * classes that make up the parameters. * * For example, a method with the following signature: * * public void method(String a, StringBuffer b) * * would be mapped by the key: * * "method" + "java.lang.String" + "java.lang.StringBuffer" * * This mapping is performed for all the methods in a class * and stored for * @since 1.0 * @author Jason van Zyl * @author Bob McWhirter * @author Attila Szegedi * @author Paulo Gaspar * @version $Id: Introspector.java 584046 2007-10-12 05:14:37Z proyal $ */ public class Introspector extends IntrospectorBase { /** * define a public string so that it can be looked for * if interested. */ public static final String CACHEDUMP_MSG = "Introspector : detected classloader change. Dumping cache."; /** * our engine runtime services. */ private final Log rlog; /** * Recieves our RuntimeServices object. * @param logger a {@link Log}. */ public Introspector(Log logger) { super(logger); this.rlog = logger; } /** * Gets the method defined by name and * params for the Class c. * * @param c Class in which the method search is taking place * @param name Name of the method being searched for * @param params An array of Objects (not Classes) that describe the * the parameters * * @return The desired Method object. * @throws IllegalArgumentException When the parameters passed in can not be used for introspection. */ public Method getMethod(Class c, String name, Object[] params) throws IllegalArgumentException { /* * just delegate to the base class */ try { return super.getMethod(c, name, params); } catch (MethodMap.AmbiguousException ae) { /* * whoops. Ambiguous. Make a nice log message and return null... */ StringBuffer msg = new StringBuffer("Introspection Error : Ambiguous method invocation ") .append(name).append("( "); for (int i = 0; i < params.length; i++) { if (i > 0) { msg.append(", "); } msg.append(null == params[i] ? "null" : params[i].getClass().getName()); } msg.append(") for class ").append(c.getName()); rlog.error(msg.toString()); } return null; } /** * Clears the classmap and classname * caches, and logs that we did so. */ protected void clearCache() { super.clearCache(); rlog.info(CACHEDUMP_MSG); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/VelPropertySet.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/VelPro0000664000175000017500000000365611671435474033621 0ustar jamespagejamespage/* * 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.jexl.util.introspection; /** * Interface used for setting values that appear to be properties in Velocity. * Ex. * * #set($foo.bar = "hello") * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: VelPropertySet.java 584046 2007-10-12 05:14:37Z proyal $ */ public interface VelPropertySet { /** * method used to set the value in the object. * * @param o Object on which the method will be called with the arg * @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; /** * specifies if this VelPropertySet 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(); } ././@LongLink0000000000000000000000000000016500000000000011567 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/UberspectLoggable.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/Ubersp0000664000175000017500000000263311671435474033644 0ustar jamespagejamespage/* * 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.jexl.util.introspection; import org.apache.commons.logging.Log; /** * Marker interface to let an uberspector indicate it can and wants to log. * * Thanks to Paulo for the suggestion * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: UberspectLoggable.java 480412 2006-11-29 05:11:23Z bayard $ * */ public interface UberspectLoggable { /** * Sets the logger. This will be called before any calls to the uberspector * @param logger the logger. */ void setRuntimeLogger(Log logger); } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/VelMethod.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/VelMet0000664000175000017500000000373411671435474033603 0ustar jamespagejamespagepackage org.apache.commons.jexl.util.introspection; /* * 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. */ /** * Method used for regular method invocation * * $foo.bar() * * * @author Geir Magnusson Jr. * @version $Id: VelMethod.java 584046 2007-10-12 05:14:37Z proyal $ */ public interface VelMethod { /** * invocation method - called when the method invocation should be * performed and a value returned * @param o * @param params * @return The resulting object. * @throws Exception */ public Object invoke(Object o, Object[] params) throws Exception; /** * specifies if this VelMethod 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 */ public boolean isCacheable(); /** * returns the method name used * @return The method name used */ public String getMethodName(); /** * returns the return type of the method invoked * @return The return type of the method invoked */ public Class getReturnType(); } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/MethodMap.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/Method0000664000175000017500000003225211671435474033624 0ustar jamespagejamespage/* * 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.jexl.util.introspection; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Hashtable; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; /** * @author Jason van Zyl * @author Bob McWhirter * @author Christoph Reck * @author Geir Magnusson Jr. * @author Attila Szegedi * @version $Id: MethodMap.java 584046 2007-10-12 05:14:37Z proyal $ * @since 1.0 */ public class MethodMap { /** * whether a method is more specific than a previously compared one. */ private static final int MORE_SPECIFIC = 0; /** * whether a method is less specific than a previously compared one. */ private static final int LESS_SPECIFIC = 1; /** * A method doesn't match a previously compared one. */ private static final int INCOMPARABLE = 2; /** * Keep track of all methods with the same name. */ Map methodByNameMap = new Hashtable(); /** * Add a method to a list of methods by name. For a particular class we are * keeping track of all the methods with the same name. * * @param method the method. */ public void add(Method method) { String methodName = method.getName(); List l = get(methodName); if (l == null) { l = new ArrayList(); methodByNameMap.put(methodName, l); } l.add(method); } /** * Return a list of methods with the same name. * * @param key * @return List list of methods */ public List get(String key) { return (List) methodByNameMap.get(key); } /** *

* Find a method. Attempts to find the * most specific applicable method using the * algorithm described in the JLS section * 15.12.2 (with the exception that it can't * distinguish a primitive type argument from * an object type argument, since in reflection * primitive type arguments are represented by * their object counterparts, so for an argument of * type (say) java.lang.Integer, it will not be able * to decide between a method that takes int and a * method that takes java.lang.Integer as a parameter. *

* *

* This turns out to be a relatively rare case * where this is needed - however, functionality * like this is needed. *

* * @param methodName name of method * @param args the actual arguments with which the method is called * @return the most specific applicable method, or null if no * method is applicable. * @throws AmbiguousException if there is more than one maximally * specific applicable method */ public Method find(String methodName, Object[] args) throws AmbiguousException { List methodList = get(methodName); if (methodList == null) { return null; } int l = args.length; Class[] classes = new Class[l]; for (int i = 0; i < l; ++i) { Object arg = args[i]; /* * if we are careful down below, a null argument goes in there * so we can know that the null was passed to the method */ classes[i] = arg == null ? null : arg.getClass(); } return getMostSpecific(methodList, classes); } /** * Simple distinguishable exception, used when * we run across ambiguous overloading. Caught * by the introspector. */ public static class AmbiguousException extends RuntimeException { /** * Version Id for serializable */ private static final long serialVersionUID = -2314636505414551663L; } private static Method getMostSpecific(List methods, Class[] classes) throws AmbiguousException { LinkedList applicables = getApplicables(methods, classes); if (applicables.isEmpty()) { return null; } if (applicables.size() == 1) { return (Method) applicables.getFirst(); } /* * This list will contain the maximally specific methods. Hopefully at * the end of the below loop, the list will contain exactly one method, * (the most specific method) otherwise we have ambiguity. */ LinkedList maximals = new LinkedList(); for (Iterator applicable = applicables.iterator(); applicable.hasNext();) { Method app = (Method) applicable.next(); Class[] appArgs = app.getParameterTypes(); boolean lessSpecific = false; for (Iterator maximal = maximals.iterator(); !lessSpecific && maximal.hasNext();) { Method max = (Method) maximal.next(); switch (moreSpecific(appArgs, max.getParameterTypes())) { case MORE_SPECIFIC: { /* * This method is more specific than the previously * known maximally specific, so remove the old maximum. */ maximal.remove(); break; } case LESS_SPECIFIC: { /* * This method is less specific than some of the * currently known maximally specific methods, so we * won't add it into the set of maximally specific * methods */ lessSpecific = true; break; } } } if (!lessSpecific) { maximals.addLast(app); } } if (maximals.size() > 1) { // We have more than one maximally specific method throw new AmbiguousException(); } return (Method) maximals.getFirst(); } /** * Determines which method signature (represented by a class array) is more * specific. This defines a partial ordering on the method signatures. * * @param c1 first signature to compare * @param c2 second signature to compare * @return MORE_SPECIFIC if c1 is more specific than c2, LESS_SPECIFIC if * c1 is less specific than c2, INCOMPARABLE if they are incomparable. */ private static int moreSpecific(Class[] c1, Class[] c2) { boolean c1MoreSpecific = false; boolean c2MoreSpecific = false; // compare lengths to handle comparisons where the size of the arrays // doesn't match, but the methods are both applicable due to the fact // that one is a varargs method if (c1.length > c2.length) { return MORE_SPECIFIC; } if (c2.length > c1.length) { return LESS_SPECIFIC; } // ok, move on and compare those of equal lengths for (int i = 0; i < c1.length; ++i) { if (c1[i] != c2[i]) { boolean last = (i == c1.length - 1); c1MoreSpecific = c1MoreSpecific || isStrictConvertible(c2[i], c1[i], last); c2MoreSpecific = c2MoreSpecific || isStrictConvertible(c1[i], c2[i], last); } } if (c1MoreSpecific) { if (c2MoreSpecific) { /* * Incomparable due to cross-assignable arguments (i.e. * foo(String, Object) vs. foo(Object, String)) */ return INCOMPARABLE; } return MORE_SPECIFIC; } if (c2MoreSpecific) { return LESS_SPECIFIC; } /* * Incomparable due to non-related arguments (i.e. * foo(Runnable) vs. foo(Serializable)) */ return INCOMPARABLE; } /** * Returns all methods that are applicable to actual argument types. * * @param methods list of all candidate methods * @param classes the actual types of the arguments * @return a list that contains only applicable methods (number of * formal and actual arguments matches, and argument types are assignable * to formal types through a method invocation conversion). */ private static LinkedList getApplicables(List methods, Class[] classes) { LinkedList list = new LinkedList(); for (Iterator imethod = methods.iterator(); imethod.hasNext();) { Method method = (Method) imethod.next(); if (isApplicable(method, classes)) { list.add(method); } } return list; } /** * Returns true if the supplied method is applicable to actual * argument types. * * @param method method that will be called * @param classes arguments to method * @return true if method is applicable to arguments */ private static boolean isApplicable(Method method, Class[] classes) { Class[] methodArgs = method.getParameterTypes(); if (methodArgs.length > classes.length) { // if there's just one more methodArg than class arg // and the last methodArg is an array, then treat it as a vararg return methodArgs.length == classes.length + 1 && methodArgs[methodArgs.length - 1].isArray(); } if (methodArgs.length == classes.length) { // this will properly match when the last methodArg // is an array/varargs and the last class is the type of array // (e.g. String when the method is expecting String...) for (int i = 0; i < classes.length; ++i) { if (!isConvertible(methodArgs[i], classes[i], false)) { // if we're on the last arg and the method expects an array if (i == classes.length - 1 && methodArgs[i].isArray()) { // check to see if the last arg is convertible // to the array's component type return isConvertible(methodArgs[i], classes[i], true); } return false; } } return true; } if (methodArgs.length > 0) {// more arguments given than the method accepts; check for varargs // check that the last methodArg is an array Class lastarg = methodArgs[methodArgs.length - 1]; if (!lastarg.isArray()) { return false; } // check that they all match up to the last method arg for (int i = 0; i < methodArgs.length - 1; ++i) { if (!isConvertible(methodArgs[i], classes[i], false)) { return false; } } // check that all remaining arguments are convertible to the vararg type Class vararg = lastarg.getComponentType(); for (int i = methodArgs.length - 1; i < classes.length; ++i) { if (!isConvertible(vararg, classes[i], false)) { return false; } } return true; } return false; } private static boolean isConvertible(Class formal, Class actual, boolean possibleVarArg) { return IntrospectionUtils. isMethodInvocationConvertible(formal, actual, possibleVarArg); } private static boolean isStrictConvertible(Class formal, Class actual, boolean possibleVarArg) { return IntrospectionUtils. isStrictMethodInvocationConvertible(formal, actual, possibleVarArg); } } ././@LongLink0000000000000000000000000000016200000000000011564 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/VelPropertyGet.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/VelPro0000664000175000017500000000414711671435474033615 0ustar jamespagejamespage/* * 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.jexl.util.introspection; /** * Interface defining a 'getter'. For uses when looking for resolution of * property references * * $foo.bar * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: VelPropertyGet.java 584050 2007-10-12 05:27:50Z proyal $ */ public interface VelPropertyGet { /** * invocation method - called when the 'get action' should be performed and * a value returned. * @param o the object to get the property from. * @return the property value. * @throws Exception on any error. */ Object invoke(Object o) throws Exception; /** * specifies if this VelPropertyGet 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 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. * * @return boolean Whether 'property' is alive. */ boolean isAlive(); } ././@LongLink0000000000000000000000000000016400000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/IntrospectorBase.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/introspection/Intros0000664000175000017500000001274211671435474033664 0ustar jamespagejamespage/* * 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.jexl.util.introspection; import java.lang.reflect.Method; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.commons.logging.Log; /** * This basic function of this class is to return a Method object for a * particular class given the name of a method and the parameters to the method * in the form of an Object[] *

* The first time the Introspector sees a class it creates a class method map * for the class in question. Basically the class method map is a Hastable where * Method objects are keyed by a concatenation of the method name and the names * of classes that make up the parameters. * * For example, a method with the following signature: * * public void method(String a, StringBuffer b) * * would be mapped by the key: * * "method" + "java.lang.String" + "java.lang.StringBuffer" * * This mapping is performed for all the methods in a class and stored for * * @author Jason van Zyl * @author Bob McWhirter * @author Attila Szegedi * @author Paulo Gaspar * @author Henning P. Schmiedehausen * @version $Id: IntrospectorBase.java 584046 2007-10-12 05:14:37Z proyal $ * @since 1.0 */ public class IntrospectorBase { private final Log rlog; /** * Holds the method maps for the classes we know about, keyed by Class * object. */ protected final Map classMethodMaps = new HashMap(); /** * Holds the qualified class names for the classes we hold in the * classMethodMaps hash. */ private Set cachedClassNames = new HashSet(); public IntrospectorBase(Log rlog) { this.rlog = rlog; } /** * Gets the method defined by name and params * for the Class c. * * @param c Class in which the method search is taking place * @param name Name of the method being searched for * @param params An array of Objects (not Classes) that describe the the * parameters * @return The desired Method object. * @throws IllegalArgumentException When the parameters passed in can not be used for introspection. * @throws MethodMap.AmbiguousException When the method map contains more than one match for the requested signature. */ public Method getMethod(Class c, String name, Object[] params) throws IllegalArgumentException, MethodMap.AmbiguousException { if (c == null) { throw new IllegalArgumentException("Introspector.getMethod(): Class method key was null: " + name); } if (params == null) { throw new IllegalArgumentException("params object is null!"); } ClassMap classMap; synchronized (classMethodMaps) { classMap = (ClassMap) classMethodMaps.get(c); /* * if we don't have this, check to see if we have it by name. if so, * then we have a classloader change so dump our caches. */ if (classMap == null) { if (cachedClassNames.contains(c.getName())) { /* * we have a map for a class with same name, but not this * class we are looking at. This implies a classloader * change, so dump */ clearCache(); } classMap = createClassMap(c); } } return classMap.findMethod(name, params); } /** * Creates a class map for specific class and registers it in the cache. * Also adds the qualified name to the name->class map for later Classloader * change detection. * @param c class. * @return a {@link ClassMap} */ protected ClassMap createClassMap(Class c) { ClassMap classMap = new ClassMap(c,rlog); classMethodMaps.put(c, classMap); cachedClassNames.add(c.getName()); return classMap; } /** * Clears the classmap and classname caches. */ protected void clearCache() { /* * since we are synchronizing on this object, we have to clear it rather * than just dump it. */ classMethodMaps.clear(); /* * for speed, we can just make a new one and let the old one be GC'd */ cachedClassNames = new HashSet(); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/Introspector.java0000664000175000017500000000372411671435474033121 0ustar jamespagejamespage/* * 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.jexl.util; import org.apache.commons.jexl.util.introspection.Uberspect; import org.apache.commons.jexl.util.introspection.UberspectImpl; import org.apache.commons.jexl.util.introspection.UberspectLoggable; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** * Little class to manage a Velocity uberspector (Vel 1.4+) for instrospective * services. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: Introspector.java 480412 2006-11-29 05:11:23Z bayard $ */ public class Introspector { /** * The uberspector from Velocity that handles all instrospection patterns. */ private static Uberspect uberSpect; static { Log logger = LogFactory.getLog(Introspector.class); uberSpect = new UberspectImpl(); ((UberspectLoggable) uberSpect).setRuntimeLogger(logger); } /** * For now, expose the raw uberspector to the AST. * * @return Uberspect The Velocity uberspector. */ public static Uberspect getUberspect() { return uberSpect; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/ArrayListWrapper.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/ArrayListWrapper.jav0000664000175000017500000000312311671435474033531 0ustar jamespagejamespage/* * 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.jexl.util; import java.lang.reflect.Array; import java.util.AbstractList; /** * A class that wraps an array with a List interface. * * @author Chris Schultz <chris@christopherschultz.net$gt; * @version $Revision$ $Date: 2006-04-14 19:40:41 $ */ public class ArrayListWrapper extends AbstractList { private Object array; public ArrayListWrapper( Object array ) { this.array = array; } public Object get( int index ) { return Array.get( array, index ); } public Object set( int index, Object element ) { Object old = get( index ); Array.set( array, index, element ); return old; } public int size() { return Array.getLength( array ); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/GetExecutor.java0000664000175000017500000000567711671435474032675 0ustar jamespagejamespage/* * 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.jexl.util; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import org.apache.commons.logging.Log; /** * Executor that simply tries to execute a get(key) * operation. This will try to find a get(key) method * for any type of object, not just objects that * implement the Map interface as was previously * the case. * * @since 1.0 * @author Jason van Zyl * @version $Id: GetExecutor.java 584046 2007-10-12 05:14:37Z proyal $ */ public class GetExecutor extends AbstractExecutor { /** * Container to hold the 'key' part of * get(key). */ private final Object[] args; /** * Default constructor. * * @param r The instance log. * @param ispect The JEXL introspector. * @param c The class being examined. * @param key The key for the get(key) operation. * @throws Exception Failure while trying to obtain the pertinent method. */ public GetExecutor(Log r, org.apache.commons.jexl.util.introspection.Introspector ispect, Class c, String key) throws Exception { rlog = r; // If you passed in null as property, we don't use the value // for parameter lookup. Instead we just look for get() without // any parameters. // // In any other case, the following condition will set up an array // for looking up get(String) on the class. if (key != null) { args = new Object[] { key }; } else { args = null; } method = ispect.getMethod(c, "get", args); } /** * {@inheritDoc} */ public Object execute(Object o) throws IllegalAccessException, InvocationTargetException { if (method == null) { return null; } try { return method.invoke(o, args); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Failed to invoke "+method+" on "+o+" with "+ Arrays.asList(args),e); } } } ././@LongLink0000000000000000000000000000015500000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/BooleanPropertyExecutor.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/util/BooleanPropertyExecu0000664000175000017500000000700311671435474033616 0ustar jamespagejamespage/* * 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.jexl.util; import org.apache.commons.logging.Log; /** * Handles discovery and valuation of a * boolean object property, of the * form public boolean is<Property> when executed. * * We do this separately as to preserve the current * quasi-broken semantics of get <as is property> * get<flip 1st char> get("property") and now followed * by is<Property>. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: BooleanPropertyExecutor.java 584046 2007-10-12 05:14:37Z proyal $ */ public class BooleanPropertyExecutor extends PropertyExecutor { /** * Constructor. * * @param rlog The instance log. * @param is The JEXL introspector. * @param clazz The class being analyzed. * @param property The boolean property. */ public BooleanPropertyExecutor(Log rlog, org.apache.commons.jexl.util.introspection.Introspector is, Class clazz, String property) { super(rlog, is, clazz, property); } /** * Locate the getter method for this boolean property. * * @param clazz The class being analyzed. * @param property Name of boolean property. */ protected void discover(Class clazz, String property) { try { char c; StringBuffer sb; Object[] params = {}; /* * now look for a boolean isFoo */ sb = new StringBuffer("is"); sb.append(property); methodUsed = sb.toString(); method = introspector.getMethod(clazz, methodUsed, params); if (null == method) { c = sb.charAt(2); if (Character.isLowerCase(c)) { sb.setCharAt(2, Character.toUpperCase(c)); } else { sb.setCharAt(2, Character.toLowerCase(c)); } methodUsed = sb.toString(); method = introspector.getMethod(clazz, methodUsed, params); } if (method != null) { /* * now, this has to return a boolean */ if (method.getReturnType() == Boolean.TYPE) { return; } method = null; } /** * pass through application level runtime exceptions */ } catch( RuntimeException e ) { throw e; } catch (Exception e) { rlog.error("PROGRAMMER ERROR : BooleanPropertyExector() : " + e, e); } } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/JexlHelper.java0000664000175000017500000000403511671435474031507 0ustar jamespagejamespage/* * 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.jexl; import org.apache.commons.jexl.context.HashMapContext; /** * Helper to create a context. In the current implementation of JEXL, there * is one implementation of JexlContext - {@link HashMapContext}, and there * is no reason not to directly instantiate {@link HashMapContext} in your * own application. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: JexlHelper.java 480412 2006-11-29 05:11:23Z bayard $ */ public class JexlHelper { /** singleton instance. */ protected static JexlHelper helper = new JexlHelper(); /** @return the single instance. */ protected static JexlHelper getInstance() { return helper; } /** * Returns a new {@link JexlContext}. * @return a new JexlContext */ public static JexlContext createContext() { return getInstance().newContext(); } /** * Creates and returns a new {@link JexlContext}. * The current implementation creates a new instance of * {@link HashMapContext}. * @return a new JexlContext */ protected JexlContext newContext() { return new HashMapContext(); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/0000775000175000017500000000000011671435474030074 5ustar jamespagejamespage././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/JJTParserState.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/JJTParserState.jav0000664000175000017500000001047411671435474033411 0ustar jamespagejamespage/* * 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. */ /* Generated By:JJTree: Do not edit this line. JJTParserState.java */ package org.apache.commons.jexl.parser; import java.util.Stack; class JJTParserState { private final Stack nodes; private final Stack marks; private int sp; // number of nodes on stack private int mk; // current mark private boolean node_created; JJTParserState() { nodes = new Stack(); marks = new Stack(); sp = 0; mk = 0; } /* * Determines whether the current node was actually closed and pushed. This * should only be called in the final user action of a node scope. */ boolean nodeCreated() { return node_created; } /* * Call this to reinitialize the node stack. It is called automatically by * the parser's ReInit() method. */ void reset() { nodes.removeAllElements(); marks.removeAllElements(); sp = 0; mk = 0; } /* * Returns the root node of the AST. It only makes sense to call this after * a successful parse. */ Node rootNode() { return (Node) nodes.elementAt(0); } /* Pushes a node on to the stack. */ void pushNode(Node n) { nodes.push(n); ++sp; } /* * Returns the node on the top of the stack, and remove it from the stack. */ Node popNode() { if (--sp < mk) { mk = ((Integer) marks.pop()).intValue(); } return (Node) nodes.pop(); } /* Returns the node currently on the top of the stack. */ Node peekNode() { return (Node) nodes.peek(); } /* * Returns the number of children on the stack in the current node scope. */ int nodeArity() { return sp - mk; } void clearNodeScope(Node n) { while (sp > mk) { popNode(); } mk = ((Integer) marks.pop()).intValue(); } void openNodeScope(Node n) { marks.push(new Integer(mk)); mk = sp; n.jjtOpen(); } /* * A definite node is constructed from a specified number of children. That * number of nodes are popped from the stack and made the children of the * definite node. Then the definite node is pushed on to the stack. */ void closeNodeScope(Node n, int num) { mk = ((Integer) marks.pop()).intValue(); while (num-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, num); } n.jjtClose(); pushNode(n); node_created = true; } /* * A conditional node is constructed if its condition is true. All the nodes * that have been pushed since the node was opened are made children of the * the conditional node, which is then pushed on to the stack. If the * condition is false the node is not constructed and they are left on the * stack. */ void closeNodeScope(Node n, boolean condition) { if (condition) { int a = nodeArity(); mk = ((Integer) marks.pop()).intValue(); while (a-- > 0) { Node c = popNode(); c.jjtSetParent(n); n.jjtAddChild(c, a); } n.jjtClose(); pushNode(n); node_created = true; } else { mk = ((Integer) marks.pop()).intValue(); node_created = false; } } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/Parser.jjt0000664000175000017500000002074111671435474032045 0ustar jamespagejamespage/* * 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. */ /** * Jexl : Java Expression Language * * @author Geir Magnusson Jr. * @author Mark H. Wilkinson * * @version $Id: Parser.jjt 584037 2007-10-12 03:35:21Z proyal $ */ options { MULTI=true; STATIC=false; VISITOR=true; NODE_USES_PARSER=true; UNICODE_INPUT=true; } PARSER_BEGIN(Parser) package org.apache.commons.jexl.parser; import java.io.Reader; import java.io.ByteArrayInputStream; import org.apache.commons.jexl.util.Introspector; import org.apache.commons.jexl.util.introspection.Uberspect; public class Parser { private Uberspect uberspect = Introspector.getUberspect(); public void setUberspect(Uberspect uberspect) { this.uberspect = uberspect; } protected Uberspect getUberspect() { return uberspect; } public SimpleNode parse(Reader reader) throws Exception { ReInit(reader); /* * lets do the 'Unique Init' in here to be * safe - it's a pain to remember */ SimpleNode tree = JexlScript(); return tree; } } PARSER_END(Parser) SKIP : /* WHITE SPACE */ { | " " | "\t" | "\n" | "\r" | "\f" } TOKEN : /* LITERALS */ { < INTEGER_LITERAL: ()+ > | < FLOAT_LITERAL: ()+ "."()+ > } /* * Program structuring syntax follows. */ SimpleNode JexlScript() : { String name; } { ( Statement() )* { return jjtThis;} } void Block() : {} { "{" ( Statement() )* "}" } void EmptyFunction() : {} { "empty" ( Reference() | "(" Reference() ")" ) } void SizeFunction() : {} { "size" "(" Reference() ")" } void Identifier() : { Token t; } { t= { jjtThis.val = t.image; } } /* * Expression syntax follows. */ void Expression() : {} { LOOKAHEAD( PrimaryExpression() "=" ) Assignment() | ElvisExpression() } void Assignment() #Assignment(2) : {} { PrimaryExpression() "=" Expression() } void ElvisExpression() #void : {} { ConditionalOrExpression() ( "?:" Expression() #ElvisNode(2) | "?" Expression() ":" Expression() #TernaryNode(3) )? } void ConditionalOrExpression() #void : {} { ConditionalAndExpression() ( "||" ConditionalAndExpression() #OrNode(2) | "or" ConditionalAndExpression() #OrNode(2) )* } void ConditionalAndExpression() #void : {} { InclusiveOrExpression() ( "&&" InclusiveOrExpression() #AndNode(2) | "and" InclusiveOrExpression() #AndNode(2) )* } void InclusiveOrExpression() #void : {} { ExclusiveOrExpression() ( "|" ExclusiveOrExpression() #BitwiseOrNode(2) )* } void ExclusiveOrExpression() #void : {} { AndExpression() ( "^" AndExpression() #BitwiseXorNode(2) )* } void AndExpression() #void : {} { EqualityExpression() ( "&" EqualityExpression() #BitwiseAndNode(2) )* } void EqualityExpression() #void : {} { RelationalExpression() ( "==" RelationalExpression() #EQNode(2) | "eq" RelationalExpression() #EQNode(2) | "!=" RelationalExpression() #NENode(2) | "ne" RelationalExpression() #NENode(2) )* } void RelationalExpression() #void : {} { AdditiveExpression() ( "<" AdditiveExpression() #LTNode(2) | "lt" AdditiveExpression() #LTNode(2) | ">" AdditiveExpression() #GTNode(2) | "gt" AdditiveExpression() #GTNode(2) | "<=" AdditiveExpression() #LENode(2) | "le" AdditiveExpression() #LENode(2) | ">=" AdditiveExpression() #GENode(2) | "ge" AdditiveExpression() #GENode(2) )* } void AdditiveExpression() #void : {} { MultiplicativeExpression() ( "+" MultiplicativeExpression() #AddNode(2) | "-" MultiplicativeExpression() #SubtractNode(2) )* } void MultiplicativeExpression() #void : {} { UnaryExpression() ( "*" UnaryExpression() #MulNode(2) | "/" UnaryExpression() #DivNode(2) | "div" UnaryExpression() #DivNode(2) | "%" UnaryExpression() #ModNode(2) | "mod" UnaryExpression() #ModNode(2) )* } void UnaryExpression() #void : {} { "-" UnaryExpression() #UnaryMinusNode(1) | "~" UnaryExpression() #BitwiseComplNode(1) | "!" UnaryExpression() #NotNode(1) | "not" UnaryExpression() #NotNode(1) | PrimaryExpression() } void PrimaryExpression() #void : {} { Literal() | LOOKAHEAD(3) Reference() | "(" Expression() ")" | EmptyFunction() | SizeFunction() | LOOKAHEAD(3) ArrayLiteral() | MapLiteral() } void Literal() #void : { Token t; } { IntegerLiteral() | FloatLiteral() | BooleanLiteral() | StringLiteral() | NullLiteral() } void NullLiteral() : {} { "null" } void BooleanLiteral() #void : {} { "true" #TrueNode | "false" #FalseNode } void IntegerLiteral() : { Token t; } { ( t= { jjtThis.val = Integer.valueOf(t.image); } ) } void FloatLiteral() : { Token t; } { ( t= { jjtThis.val = Float.valueOf(t.image); } ) } void StringLiteral() : { Token t; } { ( t= { jjtThis.literal = t.image.substring(1,t.image.length()-1); } ) } /* * Statement syntax follows. */ void Statement() #void : {} { ";" | LOOKAHEAD(3) Block() | LOOKAHEAD( Reference() ";" ) ReferenceExpression() | LOOKAHEAD( PrimaryExpression() "=" ) StatementExpression() | ExpressionExpression() | IfStatement() | ForeachStatement() | WhileStatement() } void ExpressionExpression() : {} { Expression() ";" } void StatementExpression() : {} { Assignment() ";" } void ReferenceExpression() : {} { Reference() ";" } void IfStatement() :{} { "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ] } void WhileStatement() : {} { "while" "(" Expression() ")" Statement() } void ForeachStatement() : {} { "foreach" "(" Reference() "in" Reference() ")" Statement() } void MapLiteral() : {} { "[" MapEntry() ( "," MapEntry() )* "]" } void ArrayLiteral() : {} { "[" Parameter() ( "," Parameter() )* "]" } void MapEntry() : {} { Parameter() "=>" Parameter() } void Method() : {} { Identifier() "("[ Parameter() ( "," Parameter() )* ] ")" } void ArrayAccess() : {} { Identifier() ("[" ( LOOKAHEAD(3) Expression() | IntegerLiteral() | Reference() ) "]")+ } void SizeMethod() : {} { "size" "(" ")" } void Reference() : {} { (LOOKAHEAD(Identifier() "[" ( Expression() | IntegerLiteral() | Reference()) "]") ArrayAccess() | Identifier() | LOOKAHEAD(3) MapLiteral() | ArrayLiteral() ) (LOOKAHEAD(2) "." ( LOOKAHEAD(Identifier() "[" ( Expression() | IntegerLiteral() | Reference()) "]") ArrayAccess() | // (LOOKAHEAD(3) Method() | Identifier() | IntegerLiteral() ) (LOOKAHEAD(3) Method() | SizeMethod() | Identifier() | IntegerLiteral() ) ) )* } void Parameter() #void: {} { LOOKAHEAD(3) Expression() | Literal() | Reference() } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: [ "a"-"z", "A"-"Z", "_", "$" ] > | < #DIGIT: [ "0"-"9"] > } TOKEN : { }././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTEmptyFunction.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTEmptyFunction.j0000664000175000017500000000515311671435474033427 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import java.util.Collection; import java.util.Map; /** * function to see if reference doesn't exist in context. * * @author Geir Magnusson Jr. * @author Tim O'Brien * @version $Id: ASTEmptyFunction.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTEmptyFunction extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTEmptyFunction(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTEmptyFunction(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { SimpleNode sn = (SimpleNode) jjtGetChild(0); /* * I can't believe this */ Object o = sn.value(jc); if (o == null) { return Boolean.TRUE; } if (o instanceof String && "".equals(o)) { return Boolean.TRUE; } if (o.getClass().isArray() && ((Object[]) o).length == 0) { return Boolean.TRUE; } if (o instanceof Collection && ((Collection) o).isEmpty()) { return Boolean.TRUE; } /* * Map isn't a collection */ if (o instanceof Map && ((Map) o).isEmpty()) { return Boolean.TRUE; } return Boolean.FALSE; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTUnaryMinusNode.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTUnaryMinusNode.0000664000175000017500000000612711671435474033373 0ustar jamespagejamespage/* * 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.jexl.parser; import java.math.BigDecimal; import java.math.BigInteger; import org.apache.commons.jexl.JexlContext; /** * - (unary minus). * * @author Mark H. Wilkinson * @version $Id: ASTUnaryMinusNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTUnaryMinusNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTUnaryMinusNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTUnaryMinusNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object val = ((SimpleNode) jjtGetChild(0)).value(jc); if (val instanceof Byte) { byte valueAsByte = ((Byte) val).byteValue(); return new Byte((byte) -valueAsByte); } else if (val instanceof Short) { short valueAsShort = ((Short) val).shortValue(); return new Short((short) -valueAsShort); } else if (val instanceof Integer) { int valueAsInt = ((Integer) val).intValue(); return new Integer(-valueAsInt); } else if (val instanceof Long) { long valueAsLong = ((Long) val).longValue(); return new Long(-valueAsLong); } else if (val instanceof Float) { float valueAsFloat = ((Float) val).floatValue(); return new Float(-valueAsFloat); } else if (val instanceof Double) { double valueAsDouble = ((Double) val).doubleValue(); return new Double(-valueAsDouble); } else if (val instanceof BigDecimal) { BigDecimal valueAsBigD = (BigDecimal) val; return valueAsBigD.negate(); } else if (val instanceof BigInteger) { BigInteger valueAsBigI = (BigInteger) val; return valueAsBigI.negate(); } throw new Exception("expression not a number"); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTNullLiteral.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTNullLiteral.jav0000664000175000017500000000321511671435474033376 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * 'null'. * * @author Geir Magnusson Jr. */ public class ASTNullLiteral extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTNullLiteral(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTNullLiteral(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) { return null; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTIfStatement.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTIfStatement.jav0000664000175000017500000000453611671435474033401 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * if ( expression ) statement [else statement]. * * @author Dion Gillard * @since 1.1 */ public class ASTIfStatement extends SimpleNode { /** child index of the else statement to execute. */ private static final int ELSE_STATEMENT_INDEX = 2; /** * Create the node given an id. * * @param id node id. */ public ASTIfStatement(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTIfStatement(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object result = null; /* first child is the expression */ Object expression = ((SimpleNode) jjtGetChild(0)).value(jc); if (Coercion.coerceBoolean(expression).booleanValue()) { // true statement result = ((SimpleNode) jjtGetChild(1)).value(jc); } else { // if there is a false, execute it if (jjtGetNumChildren() == ELSE_STATEMENT_INDEX + 1) { result = ((SimpleNode) jjtGetChild(2)).value(jc); } } return result; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTMapLiteral.java0000664000175000017500000000332311671435474033342 0ustar jamespagejamespage/* * 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. */ /* Generated By:JJTree: Do not edit this line. ASTMapLiteral.java */ package org.apache.commons.jexl.parser; import java.util.HashMap; import java.util.Map; import org.apache.commons.jexl.JexlContext; public class ASTMapLiteral extends SimpleNode { public ASTMapLiteral(int id) { super(id); } public ASTMapLiteral(Parser p, int id) { super(p, id); } /** Accept the visitor. * */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } public Object value(JexlContext context) throws Exception { int childCount = jjtGetNumChildren(); Map map = new HashMap(); for (int i = 0; i < childCount; i++) { Object[] entry = (Object[]) ((SimpleNode) jjtGetChild(i)).value(context); map.put(entry[0], entry[1]); } return map; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTMapEntry.java0000664000175000017500000000302111671435474033042 0ustar jamespagejamespage/* * 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. */ /* Generated By:JJTree: Do not edit this line. ASTMapEntry.java */ package org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; public class ASTMapEntry extends SimpleNode { public ASTMapEntry(int id) { super(id); } public ASTMapEntry(Parser p, int id) { super(p, id); } /** Accept the visitor. * */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } public Object value(JexlContext context) throws Exception { return new Object[]{ ((SimpleNode) jjtGetChild(0)).value(context), ((SimpleNode) jjtGetChild(1)).value(context) }; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTGTNode.java0000664000175000017500000000666111671435474032440 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * GT : a > b. * * Follows A.3.6.1 of the JSTL 1.0 specification * * @author Geir Magnusson Jr. * @author Peter Royal * @version $Id: ASTGTNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTGTNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTGTNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTGTNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { /* * now get the values */ Object left = ((SimpleNode) jjtGetChild(0)).value(jc); Object right = ((SimpleNode) jjtGetChild(1)).value(jc); if ((left == right) || (left == null) || (right == null)) { return Boolean.FALSE; } else if (Coercion.isFloatingPoint(left) || Coercion.isFloatingPoint(right)) { double leftDouble = Coercion.coerceDouble(left).doubleValue(); double rightDouble = Coercion.coerceDouble(right).doubleValue(); return leftDouble > rightDouble ? Boolean.TRUE : Boolean.FALSE; } else if (Coercion.isNumberable(left) || Coercion.isNumberable(right)) { long leftLong = Coercion.coerceLong(left).longValue(); long rightLong = Coercion.coerceLong(right).longValue(); return leftLong > rightLong ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof String || right instanceof String) { String leftString = left.toString(); String rightString = right.toString(); return leftString.compareTo(rightString) > 0 ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Comparable) { return ((Comparable) left).compareTo(right) > 0 ? Boolean.TRUE : Boolean.FALSE; } else if (right instanceof Comparable) { return ((Comparable) right).compareTo(left) < 0 ? Boolean.TRUE : Boolean.FALSE; } throw new Exception("Invalid comparison : GT "); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTTernaryNode.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTTernaryNode.jav0000664000175000017500000000200311671435474033373 0ustar jamespagejamespagepackage org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * "x?y:z" operator. * * @author Kohsuke Kawaguchi */ public class ASTTernaryNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTTernaryNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTTernaryNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object cond = ((SimpleNode) jjtGetChild(0)).value(jc); boolean leftValue = Coercion.coerceBoolean(cond).booleanValue(); return ((SimpleNode) jjtGetChild(leftValue?1:2)).value(jc); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTLENode.java0000664000175000017500000000675511671435474032432 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * LE : a <= b. * * Follows A.3.6.1 of the JSTL 1.0 specification * * @author Geir Magnusson Jr. * @author Peter Royal * @version $Id: ASTLENode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTLENode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTLENode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTLENode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { /* * now get the values */ Object left = ((SimpleNode) jjtGetChild(0)).value(jc); Object right = ((SimpleNode) jjtGetChild(1)).value(jc); if (left == right) { return Boolean.TRUE; } else if ((left == null) || (right == null)) { return Boolean.FALSE; } else if (Coercion.isFloatingPoint(left) || Coercion.isFloatingPoint(right)) { double leftDouble = Coercion.coerceDouble(left).doubleValue(); double rightDouble = Coercion.coerceDouble(right).doubleValue(); return leftDouble <= rightDouble ? Boolean.TRUE : Boolean.FALSE; } else if (Coercion.isNumberable(left) || Coercion.isNumberable(right)) { long leftLong = Coercion.coerceLong(left).longValue(); long rightLong = Coercion.coerceLong(right).longValue(); return leftLong <= rightLong ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof String || right instanceof String) { String leftString = left.toString(); String rightString = right.toString(); return leftString.compareTo(rightString) <= 0 ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Comparable) { return ((Comparable) left).compareTo(right) <= 0 ? Boolean.TRUE : Boolean.FALSE; } else if (right instanceof Comparable) { return ((Comparable) right).compareTo(left) >= 0 ? Boolean.TRUE : Boolean.FALSE; } throw new Exception("Invalid comparison : LE "); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/Node.java0000664000175000017500000000477011671435474031634 0ustar jamespagejamespage/* * 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. */ /* Generated By:JJTree: Do not edit this line. Node.java */ package org.apache.commons.jexl.parser; /** * All AST nodes must implement this interface. It provides basic machinery for * constructing the parent and child relationships between nodes. */ public interface Node { /** * This method is called after the node has been made the current node. It * indicates that child nodes can now be added to it. */ void jjtOpen(); /** * This method is called after all the child nodes have been added. */ void jjtClose(); /** * This pair of methods are used to inform the node of its parent. * @param n the parent node. */ void jjtSetParent(Node n); /** * Gets the parent node. * @return the parent to this node. */ Node jjtGetParent(); /** * This method tells the node to add its argument to the node's list of * children. * @param n the child node to add * @param i the index to add it at. */ void jjtAddChild(Node n, int i); /** * This method returns a child node. The children are numbered from zero, * left to right. * @param i the index of the child to get. * @return the child at the given index. */ Node jjtGetChild(int i); /** * Gets the number of children the node has. * @return the number of children the node has. */ int jjtGetNumChildren(); /** * Accept the visitor. * @param data arbitrary data. * @param visitor the visitor. * @return the result of the visit. */ Object jjtAccept(ParserVisitor visitor, Object data); } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/TokenMgrError.java0000664000175000017500000001206411671435474033502 0ustar jamespagejamespage/* * 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. */ /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ package org.apache.commons.jexl.parser; public class TokenMgrError extends Error { /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occured. */ static final int LEXICAL_ERROR = 0; /** * An attempt wass made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their espaced (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexicl error * curLexState : lexical state in which this error occured * errorLine : line number when the error occured * errorColumn : column number when the error occured * errorAfter : prefix that was seen before this error occured * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ public TokenMgrError() { } public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTStringLiteral.j0000664000175000017500000000350211671435474033402 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * represents a quoted string. * * @author Geir Magnusson Jr. * @version $Id: ASTStringLiteral.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTStringLiteral extends SimpleNode { /** the parsed literal. */ protected String literal; /** * Create the node given an id. * * @param id node id. */ public ASTStringLiteral(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTStringLiteral(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return literal; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTGENode.java0000664000175000017500000000675511671435474032425 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * GE : a >= b. * * Follows A.3.6.1 of the JSTL 1.0 specification * * @author Geir Magnusson Jr. * @author Peter Royal * @version $Id: ASTGENode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTGENode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTGENode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTGENode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { /* * now get the values */ Object left = ((SimpleNode) jjtGetChild(0)).value(jc); Object right = ((SimpleNode) jjtGetChild(1)).value(jc); if (left == right) { return Boolean.TRUE; } else if ((left == null) || (right == null)) { return Boolean.FALSE; } else if (Coercion.isFloatingPoint(left) || Coercion.isFloatingPoint(right)) { double leftDouble = Coercion.coerceDouble(left).doubleValue(); double rightDouble = Coercion.coerceDouble(right).doubleValue(); return leftDouble >= rightDouble ? Boolean.TRUE : Boolean.FALSE; } else if (Coercion.isNumberable(left) || Coercion.isNumberable(right)) { long leftLong = Coercion.coerceLong(left).longValue(); long rightLong = Coercion.coerceLong(right).longValue(); return leftLong >= rightLong ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof String || right instanceof String) { String leftString = left.toString(); String rightString = right.toString(); return leftString.compareTo(rightString) >= 0 ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Comparable) { return ((Comparable) left).compareTo(right) >= 0 ? Boolean.TRUE : Boolean.FALSE; } else if (right instanceof Comparable) { return ((Comparable) right).compareTo(left) <= 0 ? Boolean.TRUE : Boolean.FALSE; } throw new Exception("Invalid comparison : GE "); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTStatementExpression.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTStatementExpres0000664000175000017500000000324711671435474033530 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * Assignment as an expression. */ public class ASTStatementExpression extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTStatementExpression(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTStatementExpression(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { return ((SimpleNode) jjtGetChild(0)).value(context); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTLTNode.java0000664000175000017500000000666311671435474032447 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * LT : a < b. * * Follows A.3.6.1 of the JSTL 1.0 specification * * @author Geir Magnusson Jr. * @author Peter Royal * @version $Id: ASTLTNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTLTNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTLTNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTLTNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { /* * now get the values */ Object left = ((SimpleNode) jjtGetChild(0)).value(jc); Object right = ((SimpleNode) jjtGetChild(1)).value(jc); if ((left == right) || (left == null) || (right == null)) { return Boolean.FALSE; } else if (Coercion.isFloatingPoint(left) || Coercion.isFloatingPoint(right)) { double leftDouble = Coercion.coerceDouble(left).doubleValue(); double rightDouble = Coercion.coerceDouble(right).doubleValue(); return leftDouble < rightDouble ? Boolean.TRUE : Boolean.FALSE; } else if (Coercion.isNumberable(left) || Coercion.isNumberable(right)) { long leftLong = Coercion.coerceLong(left).longValue(); long rightLong = Coercion.coerceLong(right).longValue(); return leftLong < rightLong ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof String || right instanceof String) { String leftString = left.toString(); String rightString = right.toString(); return leftString.compareTo(rightString) < 0 ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Comparable) { return ((Comparable) left).compareTo(right) < 0 ? Boolean.TRUE : Boolean.FALSE; } else if (right instanceof Comparable) { return ((Comparable) right).compareTo(left) > 0 ? Boolean.TRUE : Boolean.FALSE; } throw new Exception("Invalid comparison : LT "); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/Parser.jj0000664000175000017500000014170611671435474031666 0ustar jamespagejamespage/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. ./Parser.jj */ /*@egen*//* * 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. */ /** * Jexl : Java Expression Language * * @author Geir Magnusson Jr. * @author Mark H. Wilkinson * * @version $Id: Parser.jj 584037 2007-10-12 03:35:21Z proyal $ */ options { STATIC=false; UNICODE_INPUT=true; } PARSER_BEGIN(Parser) package org.apache.commons.jexl.parser; import java.io.Reader; import java.io.ByteArrayInputStream; import org.apache.commons.jexl.util.introspection.Uberspect; public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/ protected JJTParserState jjtree = new JJTParserState(); /*@egen*/ private Uberspect uberspect; public void setUberspect(Uberspect uberspect) { this.uberspect = uberspect; } protected Uberspect getUberspect() { return uberspect; } public SimpleNode parse(Reader reader) throws Exception { ReInit(reader); /* * lets do the 'Unique Init' in here to be * safe - it's a pain to remember */ SimpleNode tree = JexlScript(); return tree; } } PARSER_END(Parser) SKIP : /* WHITE SPACE */ { | " " | "\t" | "\n" | "\r" | "\f" } TOKEN : /* LITERALS */ { < INTEGER_LITERAL: ()+ > | < FLOAT_LITERAL: ()+ "."()+ > } /* * Program structuring syntax follows. */ SimpleNode JexlScript() : {/*@bgen(jjtree) JexlScript */ ASTJexlScript jjtn000 = new ASTJexlScript(this, JJTJEXLSCRIPT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ String name; } {/*@bgen(jjtree) JexlScript */ try { /*@egen*/ ( Statement() )* /*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { return jjtn000;}/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Block() : {/*@bgen(jjtree) Block */ ASTBlock jjtn000 = new ASTBlock(this, JJTBLOCK); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) Block */ try { /*@egen*/ "{" ( Statement() )* "}"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void EmptyFunction() : {/*@bgen(jjtree) EmptyFunction */ ASTEmptyFunction jjtn000 = new ASTEmptyFunction(this, JJTEMPTYFUNCTION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) EmptyFunction */ try { /*@egen*/ "empty" ( Reference() | "(" Reference() ")" )/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void SizeFunction() : {/*@bgen(jjtree) SizeFunction */ ASTSizeFunction jjtn000 = new ASTSizeFunction(this, JJTSIZEFUNCTION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) SizeFunction */ try { /*@egen*/ "size" "(" Reference() ")"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Identifier() : {/*@bgen(jjtree) Identifier */ ASTIdentifier jjtn000 = new ASTIdentifier(this, JJTIDENTIFIER); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) Identifier */ try { /*@egen*/ t=/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { jjtn000.val = t.image; }/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } /* * Expression syntax follows. */ void Expression() : {/*@bgen(jjtree) Expression */ ASTExpression jjtn000 = new ASTExpression(this, JJTEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) Expression */ try { /*@egen*/ LOOKAHEAD( PrimaryExpression() "=" ) Assignment() | ConditionalOrExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Assignment() : {/*@bgen(jjtree) #Assignment( 2) */ ASTAssignment jjtn000 = new ASTAssignment(this, JJTASSIGNMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) #Assignment( 2) */ try { /*@egen*/ PrimaryExpression() "=" Expression()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, 2); } } /*@egen*/ } void ConditionalOrExpression() : {} { ConditionalAndExpression() ( "||"/*@bgen(jjtree) #OrNode( 2) */ { ASTOrNode jjtn001 = new ASTOrNode(this, JJTORNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ ConditionalAndExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ | "or"/*@bgen(jjtree) #OrNode( 2) */ { ASTOrNode jjtn002 = new ASTOrNode(this, JJTORNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ ConditionalAndExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } /*@egen*/ )* } void ConditionalAndExpression() : {} { InclusiveOrExpression() ( "&&"/*@bgen(jjtree) #AndNode( 2) */ { ASTAndNode jjtn001 = new ASTAndNode(this, JJTANDNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ InclusiveOrExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ | "and"/*@bgen(jjtree) #AndNode( 2) */ { ASTAndNode jjtn002 = new ASTAndNode(this, JJTANDNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ InclusiveOrExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } /*@egen*/ )* } void InclusiveOrExpression() : {} { ExclusiveOrExpression() ( "|"/*@bgen(jjtree) #BitwiseOrNode( 2) */ { ASTBitwiseOrNode jjtn001 = new ASTBitwiseOrNode(this, JJTBITWISEORNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ ExclusiveOrExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ )* } void ExclusiveOrExpression() : {} { AndExpression() ( "^"/*@bgen(jjtree) #BitwiseXorNode( 2) */ { ASTBitwiseXorNode jjtn001 = new ASTBitwiseXorNode(this, JJTBITWISEXORNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ AndExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ )* } void AndExpression() : {} { EqualityExpression() ( "&"/*@bgen(jjtree) #BitwiseAndNode( 2) */ { ASTBitwiseAndNode jjtn001 = new ASTBitwiseAndNode(this, JJTBITWISEANDNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ EqualityExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ )* } void EqualityExpression() : {} { RelationalExpression() ( "=="/*@bgen(jjtree) #EQNode( 2) */ { ASTEQNode jjtn001 = new ASTEQNode(this, JJTEQNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ RelationalExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ | "eq"/*@bgen(jjtree) #EQNode( 2) */ { ASTEQNode jjtn002 = new ASTEQNode(this, JJTEQNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ RelationalExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } /*@egen*/ | "!="/*@bgen(jjtree) #NENode( 2) */ { ASTNENode jjtn003 = new ASTNENode(this, JJTNENODE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); } try { /*@egen*/ RelationalExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { throw (RuntimeException)jjte003; } if (jjte003 instanceof ParseException) { throw (ParseException)jjte003; } throw (Error)jjte003; } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } } /*@egen*/ | "ne"/*@bgen(jjtree) #NENode( 2) */ { ASTNENode jjtn004 = new ASTNENode(this, JJTNENODE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); } try { /*@egen*/ RelationalExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { throw (RuntimeException)jjte004; } if (jjte004 instanceof ParseException) { throw (ParseException)jjte004; } throw (Error)jjte004; } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 2); } } /*@egen*/ )* } void RelationalExpression() : {} { AdditiveExpression() ( "<"/*@bgen(jjtree) #LTNode( 2) */ { ASTLTNode jjtn001 = new ASTLTNode(this, JJTLTNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ | "lt"/*@bgen(jjtree) #LTNode( 2) */ { ASTLTNode jjtn002 = new ASTLTNode(this, JJTLTNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } /*@egen*/ | ">"/*@bgen(jjtree) #GTNode( 2) */ { ASTGTNode jjtn003 = new ASTGTNode(this, JJTGTNODE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { throw (RuntimeException)jjte003; } if (jjte003 instanceof ParseException) { throw (ParseException)jjte003; } throw (Error)jjte003; } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } } /*@egen*/ | "gt"/*@bgen(jjtree) #GTNode( 2) */ { ASTGTNode jjtn004 = new ASTGTNode(this, JJTGTNODE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { throw (RuntimeException)jjte004; } if (jjte004 instanceof ParseException) { throw (ParseException)jjte004; } throw (Error)jjte004; } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 2); } } /*@egen*/ | "<="/*@bgen(jjtree) #LENode( 2) */ { ASTLENode jjtn005 = new ASTLENode(this, JJTLENODE); boolean jjtc005 = true; jjtree.openNodeScope(jjtn005); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte005) { if (jjtc005) { jjtree.clearNodeScope(jjtn005); jjtc005 = false; } else { jjtree.popNode(); } if (jjte005 instanceof RuntimeException) { throw (RuntimeException)jjte005; } if (jjte005 instanceof ParseException) { throw (ParseException)jjte005; } throw (Error)jjte005; } finally { if (jjtc005) { jjtree.closeNodeScope(jjtn005, 2); } } /*@egen*/ | "le"/*@bgen(jjtree) #LENode( 2) */ { ASTLENode jjtn006 = new ASTLENode(this, JJTLENODE); boolean jjtc006 = true; jjtree.openNodeScope(jjtn006); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte006) { if (jjtc006) { jjtree.clearNodeScope(jjtn006); jjtc006 = false; } else { jjtree.popNode(); } if (jjte006 instanceof RuntimeException) { throw (RuntimeException)jjte006; } if (jjte006 instanceof ParseException) { throw (ParseException)jjte006; } throw (Error)jjte006; } finally { if (jjtc006) { jjtree.closeNodeScope(jjtn006, 2); } } /*@egen*/ | ">="/*@bgen(jjtree) #GENode( 2) */ { ASTGENode jjtn007 = new ASTGENode(this, JJTGENODE); boolean jjtc007 = true; jjtree.openNodeScope(jjtn007); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte007) { if (jjtc007) { jjtree.clearNodeScope(jjtn007); jjtc007 = false; } else { jjtree.popNode(); } if (jjte007 instanceof RuntimeException) { throw (RuntimeException)jjte007; } if (jjte007 instanceof ParseException) { throw (ParseException)jjte007; } throw (Error)jjte007; } finally { if (jjtc007) { jjtree.closeNodeScope(jjtn007, 2); } } /*@egen*/ | "ge"/*@bgen(jjtree) #GENode( 2) */ { ASTGENode jjtn008 = new ASTGENode(this, JJTGENODE); boolean jjtc008 = true; jjtree.openNodeScope(jjtn008); } try { /*@egen*/ AdditiveExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte008) { if (jjtc008) { jjtree.clearNodeScope(jjtn008); jjtc008 = false; } else { jjtree.popNode(); } if (jjte008 instanceof RuntimeException) { throw (RuntimeException)jjte008; } if (jjte008 instanceof ParseException) { throw (ParseException)jjte008; } throw (Error)jjte008; } finally { if (jjtc008) { jjtree.closeNodeScope(jjtn008, 2); } } /*@egen*/ )* } void AdditiveExpression() : {} { MultiplicativeExpression() ( "+"/*@bgen(jjtree) #AddNode( 2) */ { ASTAddNode jjtn001 = new ASTAddNode(this, JJTADDNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ MultiplicativeExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ | "-"/*@bgen(jjtree) #SubtractNode( 2) */ { ASTSubtractNode jjtn002 = new ASTSubtractNode(this, JJTSUBTRACTNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ MultiplicativeExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } /*@egen*/ )* } void MultiplicativeExpression() : {} { UnaryExpression() ( "*"/*@bgen(jjtree) #MulNode( 2) */ { ASTMulNode jjtn001 = new ASTMulNode(this, JJTMULNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 2); } } /*@egen*/ | "/"/*@bgen(jjtree) #DivNode( 2) */ { ASTDivNode jjtn002 = new ASTDivNode(this, JJTDIVNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 2); } } /*@egen*/ | "div"/*@bgen(jjtree) #DivNode( 2) */ { ASTDivNode jjtn003 = new ASTDivNode(this, JJTDIVNODE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { throw (RuntimeException)jjte003; } if (jjte003 instanceof ParseException) { throw (ParseException)jjte003; } throw (Error)jjte003; } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 2); } } /*@egen*/ | "%"/*@bgen(jjtree) #ModNode( 2) */ { ASTModNode jjtn004 = new ASTModNode(this, JJTMODNODE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { throw (RuntimeException)jjte004; } if (jjte004 instanceof ParseException) { throw (ParseException)jjte004; } throw (Error)jjte004; } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 2); } } /*@egen*/ | "mod"/*@bgen(jjtree) #ModNode( 2) */ { ASTModNode jjtn005 = new ASTModNode(this, JJTMODNODE); boolean jjtc005 = true; jjtree.openNodeScope(jjtn005); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte005) { if (jjtc005) { jjtree.clearNodeScope(jjtn005); jjtc005 = false; } else { jjtree.popNode(); } if (jjte005 instanceof RuntimeException) { throw (RuntimeException)jjte005; } if (jjte005 instanceof ParseException) { throw (ParseException)jjte005; } throw (Error)jjte005; } finally { if (jjtc005) { jjtree.closeNodeScope(jjtn005, 2); } } /*@egen*/ )* } void UnaryExpression() : {} { "-"/*@bgen(jjtree) #UnaryMinusNode( 1) */ { ASTUnaryMinusNode jjtn001 = new ASTUnaryMinusNode(this, JJTUNARYMINUSNODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte001) { if (jjtc001) { jjtree.clearNodeScope(jjtn001); jjtc001 = false; } else { jjtree.popNode(); } if (jjte001 instanceof RuntimeException) { throw (RuntimeException)jjte001; } if (jjte001 instanceof ParseException) { throw (ParseException)jjte001; } throw (Error)jjte001; } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, 1); } } /*@egen*/ | "~"/*@bgen(jjtree) #BitwiseComplNode( 1) */ { ASTBitwiseComplNode jjtn002 = new ASTBitwiseComplNode(this, JJTBITWISECOMPLNODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte002) { if (jjtc002) { jjtree.clearNodeScope(jjtn002); jjtc002 = false; } else { jjtree.popNode(); } if (jjte002 instanceof RuntimeException) { throw (RuntimeException)jjte002; } if (jjte002 instanceof ParseException) { throw (ParseException)jjte002; } throw (Error)jjte002; } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, 1); } } /*@egen*/ | "!"/*@bgen(jjtree) #NotNode( 1) */ { ASTNotNode jjtn003 = new ASTNotNode(this, JJTNOTNODE); boolean jjtc003 = true; jjtree.openNodeScope(jjtn003); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte003) { if (jjtc003) { jjtree.clearNodeScope(jjtn003); jjtc003 = false; } else { jjtree.popNode(); } if (jjte003 instanceof RuntimeException) { throw (RuntimeException)jjte003; } if (jjte003 instanceof ParseException) { throw (ParseException)jjte003; } throw (Error)jjte003; } finally { if (jjtc003) { jjtree.closeNodeScope(jjtn003, 1); } } /*@egen*/ | "not"/*@bgen(jjtree) #NotNode( 1) */ { ASTNotNode jjtn004 = new ASTNotNode(this, JJTNOTNODE); boolean jjtc004 = true; jjtree.openNodeScope(jjtn004); } try { /*@egen*/ UnaryExpression()/*@bgen(jjtree)*/ } catch (Throwable jjte004) { if (jjtc004) { jjtree.clearNodeScope(jjtn004); jjtc004 = false; } else { jjtree.popNode(); } if (jjte004 instanceof RuntimeException) { throw (RuntimeException)jjte004; } if (jjte004 instanceof ParseException) { throw (ParseException)jjte004; } throw (Error)jjte004; } finally { if (jjtc004) { jjtree.closeNodeScope(jjtn004, 1); } } /*@egen*/ | PrimaryExpression() } void PrimaryExpression() : {} { Literal() | LOOKAHEAD(3) Reference() | "(" Expression() ")" | EmptyFunction() | SizeFunction() | LOOKAHEAD(3) ArrayLiteral() | MapLiteral() } void Literal() : { Token t; } { IntegerLiteral() | FloatLiteral() | BooleanLiteral() | StringLiteral() | NullLiteral() } void NullLiteral() : {/*@bgen(jjtree) NullLiteral */ ASTNullLiteral jjtn000 = new ASTNullLiteral(this, JJTNULLLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) NullLiteral */ try { /*@egen*/ "null"/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void BooleanLiteral() : {} {/*@bgen(jjtree) TrueNode */ { ASTTrueNode jjtn001 = new ASTTrueNode(this, JJTTRUENODE); boolean jjtc001 = true; jjtree.openNodeScope(jjtn001); } try { /*@egen*/ "true"/*@bgen(jjtree)*/ } finally { if (jjtc001) { jjtree.closeNodeScope(jjtn001, true); } } /*@egen*/ |/*@bgen(jjtree) FalseNode */ { ASTFalseNode jjtn002 = new ASTFalseNode(this, JJTFALSENODE); boolean jjtc002 = true; jjtree.openNodeScope(jjtn002); } try { /*@egen*/ "false"/*@bgen(jjtree)*/ } finally { if (jjtc002) { jjtree.closeNodeScope(jjtn002, true); } } /*@egen*/ } void IntegerLiteral() : {/*@bgen(jjtree) IntegerLiteral */ ASTIntegerLiteral jjtn000 = new ASTIntegerLiteral(this, JJTINTEGERLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) IntegerLiteral */ try { /*@egen*/ ( t=/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { jjtn000.val = Integer.valueOf(t.image); } )/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void FloatLiteral() : {/*@bgen(jjtree) FloatLiteral */ ASTFloatLiteral jjtn000 = new ASTFloatLiteral(this, JJTFLOATLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) FloatLiteral */ try { /*@egen*/ ( t=/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { jjtn000.val = Float.valueOf(t.image); } )/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void StringLiteral() : {/*@bgen(jjtree) StringLiteral */ ASTStringLiteral jjtn000 = new ASTStringLiteral(this, JJTSTRINGLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) StringLiteral */ try { /*@egen*/ ( t=/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { jjtn000.literal = t.image.substring(1,t.image.length()-1); } )/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } /* * Statement syntax follows. */ void Statement() : {} { ";" | LOOKAHEAD(3) Block() | LOOKAHEAD( Reference() ";" ) ReferenceExpression() | LOOKAHEAD( PrimaryExpression() "=" ) StatementExpression() | ExpressionExpression() | IfStatement() | ForeachStatement() | WhileStatement() } void ExpressionExpression() : {/*@bgen(jjtree) ExpressionExpression */ ASTExpressionExpression jjtn000 = new ASTExpressionExpression(this, JJTEXPRESSIONEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) ExpressionExpression */ try { /*@egen*/ Expression() ";"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void StatementExpression() : {/*@bgen(jjtree) StatementExpression */ ASTStatementExpression jjtn000 = new ASTStatementExpression(this, JJTSTATEMENTEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) StatementExpression */ try { /*@egen*/ Assignment() ";"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void ReferenceExpression() : {/*@bgen(jjtree) ReferenceExpression */ ASTReferenceExpression jjtn000 = new ASTReferenceExpression(this, JJTREFERENCEEXPRESSION); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) ReferenceExpression */ try { /*@egen*/ Reference() ";"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void IfStatement() :{/*@bgen(jjtree) IfStatement */ ASTIfStatement jjtn000 = new ASTIfStatement(this, JJTIFSTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) IfStatement */ try { /*@egen*/ "if" "(" Expression() ")" Statement() [ LOOKAHEAD(1) "else" Statement() ]/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void WhileStatement() : {/*@bgen(jjtree) WhileStatement */ ASTWhileStatement jjtn000 = new ASTWhileStatement(this, JJTWHILESTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) WhileStatement */ try { /*@egen*/ "while" "(" Expression() ")" Statement()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void ForeachStatement() : {/*@bgen(jjtree) ForeachStatement */ ASTForeachStatement jjtn000 = new ASTForeachStatement(this, JJTFOREACHSTATEMENT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) ForeachStatement */ try { /*@egen*/ "foreach" "(" Reference() "in" Reference() ")" Statement()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void MapLiteral() : {/*@bgen(jjtree) MapLiteral */ ASTMapLiteral jjtn000 = new ASTMapLiteral(this, JJTMAPLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) MapLiteral */ try { /*@egen*/ "[" MapEntry() ( "," MapEntry() )* "]"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void ArrayLiteral() : {/*@bgen(jjtree) ArrayLiteral */ ASTArrayLiteral jjtn000 = new ASTArrayLiteral(this, JJTARRAYLITERAL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) ArrayLiteral */ try { /*@egen*/ "[" Parameter() ( "," Parameter() )* "]"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void MapEntry() : {/*@bgen(jjtree) MapEntry */ ASTMapEntry jjtn000 = new ASTMapEntry(this, JJTMAPENTRY); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) MapEntry */ try { /*@egen*/ Parameter() "=>" Parameter()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Method() : {/*@bgen(jjtree) Method */ ASTMethod jjtn000 = new ASTMethod(this, JJTMETHOD); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) Method */ try { /*@egen*/ Identifier() "("[ Parameter() ( "," Parameter() )* ] ")"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void ArrayAccess() : {/*@bgen(jjtree) ArrayAccess */ ASTArrayAccess jjtn000 = new ASTArrayAccess(this, JJTARRAYACCESS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) ArrayAccess */ try { /*@egen*/ Identifier() ("[" ( LOOKAHEAD(3) Expression() | IntegerLiteral() | Reference() ) "]")+/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void SizeMethod() : {/*@bgen(jjtree) SizeMethod */ ASTSizeMethod jjtn000 = new ASTSizeMethod(this, JJTSIZEMETHOD); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) SizeMethod */ try { /*@egen*/ "size" "(" ")"/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Reference() : {/*@bgen(jjtree) Reference */ ASTReference jjtn000 = new ASTReference(this, JJTREFERENCE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) Reference */ try { /*@egen*/ (LOOKAHEAD(Identifier() "[" ( Expression() | IntegerLiteral() | Reference()) "]") ArrayAccess() | Identifier() | LOOKAHEAD(3) MapLiteral() | ArrayLiteral() ) (LOOKAHEAD(2) "." ( LOOKAHEAD(Identifier() "[" ( Expression() | IntegerLiteral() | Reference()) "]") ArrayAccess() | (LOOKAHEAD(3) Method() | SizeMethod() | Identifier() | IntegerLiteral() ) ) )*/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Parameter() : {} { LOOKAHEAD(3) Expression() | Literal() | Reference() } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: (|)* > | < #LETTER: [ "a"-"z", "A"-"Z", "_", "$" ] > | < #DIGIT: [ "0"-"9"] > } TOKEN : { }././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTArrayLiteral.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTArrayLiteral.ja0000664000175000017500000000311211671435474033350 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; public class ASTArrayLiteral extends SimpleNode { public ASTArrayLiteral( int id ) { super( id ); } public ASTArrayLiteral( Parser p, int id ) { super( p, id ); } /** Accept the visitor. * */ public Object jjtAccept( ParserVisitor visitor, Object data ) { return visitor.visit( this, data ); } public Object value( JexlContext context ) throws Exception { int childCount = jjtGetNumChildren(); Object[] array = new Object[childCount]; for ( int i = 0; i < childCount; i++ ) { array[i] = ( (SimpleNode) jjtGetChild( i ) ).value( context ); } return array; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTNENode.java0000664000175000017500000000655011671435474032425 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Not equal to. Use '!=' or 'ne', do not use <>. * * @author Geir Magnusson Jr. * @version $Id: ASTNENode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTNENode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTNENode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTNENode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext pc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(pc); Object right = ((SimpleNode) jjtGetChild(1)).value(pc); if (left == null && right == null) { /* * first, the possibility that both *are* null */ return Boolean.FALSE; } else if (left == null || right == null) { /* * otherwise, both aren't, so it's clear L != R */ return Boolean.TRUE; } else if (left.getClass().equals(right.getClass())) { return (left.equals(right)) ? Boolean.FALSE : Boolean.TRUE; } else if (left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double) { return (Coercion.coerceDouble(left).equals(Coercion.coerceDouble(right))) ? Boolean.FALSE : Boolean.TRUE; } else if (left instanceof Number || right instanceof Number || left instanceof Character || right instanceof Character) { return (Coercion.coerceLong(left).equals(Coercion.coerceLong(right))) ? Boolean.FALSE : Boolean.TRUE; } else if (left instanceof Boolean || right instanceof Boolean) { return (Coercion.coerceBoolean(left).equals(Coercion.coerceBoolean(right))) ? Boolean.FALSE : Boolean.TRUE; } else if (left instanceof java.lang.String || right instanceof String) { return (left.toString().equals(right.toString())) ? Boolean.FALSE : Boolean.TRUE; } return (left.equals(right)) ? Boolean.FALSE : Boolean.TRUE; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTForeachStatement.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTForeachStatemen0000664000175000017500000000642011671435474033441 0ustar jamespagejamespage/* * 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.jexl.parser; import java.util.Iterator; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.introspection.Info; /** * ForEach statement. Syntax: foreach (var in iterable) Statement() * * @author Dion Gillard * @since 1.1 */ public class ASTForeachStatement extends SimpleNode { /** dummy velocity info. */ private static final Info DUMMY = new Info("", 1, 1); /** index of the loop variable. */ private static final int VAR_INDEX = 0; /** index of the items. */ private static final int ITEMS_INDEX = 1; /** index of the code to execute. */ private static final int STATEMENT_INDEX = 2; /** * Create the node given an id. * * @param id node id. */ public ASTForeachStatement(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTForeachStatement(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object result = null; /* first child is the loop variable */ ASTReference loopVariable = (ASTReference) jjtGetChild(VAR_INDEX); /* second child is the variable to iterate */ SimpleNode iterable = (SimpleNode) jjtGetChild(ITEMS_INDEX); Object iterableValue = iterable.value(jc); // make sure there is a value to iterate on and a statement to execute if (iterableValue != null && jjtGetNumChildren() >= (STATEMENT_INDEX + 1)) { /* third child is the statement to execute */ SimpleNode statement = (SimpleNode) jjtGetChild(2); // get an iterator for the collection/array etc via the // introspector. Iterator itemsIterator = getUberspect().getIterator( iterableValue, DUMMY); while (itemsIterator.hasNext()) { // set loopVariable to value of iterator Object value = itemsIterator.next(); jc.getVars().put(loopVariable.getRootString(), value); // execute statement result = statement.value(jc); } } return result; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTBlock.java0000664000175000017500000000410511671435474032341 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * { code }, a block of statements enclosed in curly braces. * * @author Dion Gillard * */ public class ASTBlock extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTBlock(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTBlock(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * @return the value of the block. Execute all statements inside and return * the value of the last. * @param context the {@link JexlContext} to execute against. * @throws Exception on any error. */ public Object value(JexlContext context) throws Exception { int numChildren = jjtGetNumChildren(); Object result = null; for (int i = 0; i < numChildren; i++) { result = ((SimpleNode) jjtGetChild(i)).value(context); } return result; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTSizeFunction.ja0000664000175000017500000000730511671435474033405 0ustar jamespagejamespage/* * 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.jexl.parser; import java.lang.reflect.Array; import java.util.Collection; import java.util.Map; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.introspection.Info; import org.apache.commons.jexl.util.introspection.Uberspect; import org.apache.commons.jexl.util.introspection.VelMethod; /** * generalized size() function for all classes we can think of. * * @author Geir Magnusson Jr. * @author Mark H. Wilkinson * @version $Id: ASTSizeFunction.java 548229 2007-06-18 06:11:32Z dion $ */ public class ASTSizeFunction extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTSizeFunction(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTSizeFunction(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { SimpleNode arg = (SimpleNode) jjtGetChild(0); Object val = arg.value(jc); if (val == null) { throw new Exception("size() : null arg"); } return new Integer(ASTSizeFunction.sizeOf(val, getUberspect())); } /** * Calculate the size of various types: Collection, Array, Map, String, * and anything that has a int size() method. * * @param val the object to get the size of. * @param uberspect * @return the size of val * @throws Exception if the size cannot be determined. */ public static int sizeOf(Object val, Uberspect uberspect) throws Exception { if (val instanceof Collection) { return ((Collection) val).size(); } else if (val.getClass().isArray()) { return Array.getLength(val); } else if (val instanceof Map) { return ((Map) val).size(); } else if (val instanceof String) { return ((String) val).length(); } else { // check if there is a size method on the object that returns an // integer // and if so, just use it Object[] params = new Object[0]; Info velInfo = new Info("", 1, 1); VelMethod vm = uberspect.getMethod(val, "size", params, velInfo); if (vm != null && vm.getReturnType() == Integer.TYPE) { Integer result = (Integer) vm.invoke(val, params); return result.intValue(); } throw new Exception("size() : unknown type : " + val.getClass()); } } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTEQNode.java0000664000175000017500000001017511671435474032426 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Represents equality between values. * * If the values are of the same class, .equals() is used. * * If either value is a {@link Float} or {@link Double} (but both are not the same class), * the values are coerced to {@link Double}s before comparing. * * If either value is a {@link Number} or {@link Character} (but both are not the same class), * the values are coerced to {@link Long}s before comparing. * * If either value is a {@link Boolean} (but both are not the same class), * the values are coerced to {@link Boolean}s before comparing. * * If either value is a {@link String} (but both are not the same class), * toString() is called on both before comparing. * * Otherwise left.equals(right) is returned. * * @author Geir Magnusson Jr. * @version $Id: ASTEQNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTEQNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTEQNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTEQNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext pc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(pc); Object right = ((SimpleNode) jjtGetChild(1)).value(pc); if (left == null && right == null) { /* * if both are null L == R */ return Boolean.TRUE; } else if (left == null || right == null) { /* * we know both aren't null, therefore L != R */ return Boolean.FALSE; } else if (left.getClass().equals(right.getClass())) { return left.equals(right) ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double) { Double l = Coercion.coerceDouble(left); Double r = Coercion.coerceDouble(right); return l.equals(r) ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Number || right instanceof Number || left instanceof Character || right instanceof Character) { return Coercion.coerceLong(left).equals(Coercion.coerceLong(right)) ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof Boolean || right instanceof Boolean) { return Coercion.coerceBoolean(left).equals( Coercion.coerceBoolean(right)) ? Boolean.TRUE : Boolean.FALSE; } else if (left instanceof java.lang.String || right instanceof String) { return left.toString().equals(right.toString()) ? Boolean.TRUE : Boolean.FALSE; } return left.equals(right) ? Boolean.TRUE : Boolean.FALSE; } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTArrayAccess.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTArrayAccess.jav0000664000175000017500000001402511671435474033350 0ustar jamespagejamespage/* * 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.jexl.parser; import java.lang.reflect.Array; import java.util.List; import java.util.Map; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; import org.apache.commons.jexl.util.introspection.Info; import org.apache.commons.jexl.util.introspection.Uberspect; import org.apache.commons.jexl.util.introspection.VelPropertyGet; /** * Like an ASTIdentifier, but with array access allowed. * * $foo[2] * * @author Geir Magnusson Jr. * @version $Id: ASTArrayAccess.java 548229 2007-06-18 06:11:32Z dion $ */ public class ASTArrayAccess extends SimpleNode { /** dummy velocity info. */ private static final Info DUMMY = new Info("", 1, 1); /** * Create the node given an id. * * @param id node id. */ public ASTArrayAccess(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTArrayAccess(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * evaluate array access upon a base object. * * foo.bar[2] * * makes me rethink the array operator :) * @param jc the {@link JexlContext} to evaluate against. * @param obj not used. * @return the value of the array expression. * @throws Exception on any error */ public Object execute(Object obj, JexlContext jc) throws Exception { ASTIdentifier base = (ASTIdentifier) jjtGetChild(0); Object result = base.execute(obj, jc); /* * ignore the first child - it's our identifier */ for (int i = 1; i < jjtGetNumChildren(); i++) { Object loc = ((SimpleNode) jjtGetChild(i)).value(jc); if (loc == null) { return null; } result = evaluateExpr(result, loc, getUberspect()); } return result; } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { /* * get the base ASTIdentifier */ ASTIdentifier base = (ASTIdentifier) jjtGetChild(0); Object o = base.value(jc); /* * ignore the first child - it's our identifier */ for (int i = 1; i < jjtGetNumChildren(); i++) { Object loc = ((SimpleNode) jjtGetChild(i)).value(jc); if (loc == null) { return null; } o = evaluateExpr(o, loc, getUberspect()); } return o; } /** * Evaluate the Array expression 'loc' on the given object, o. * e.g. in 'a[2]', 2 is 'loc' and a is 'o'. * * If o or loc are null, null is returned. * If o is a Map, o.get(loc) is returned. * If o is a List, o.get(loc) is returned. loc must resolve to an int value. * If o is an Array, o[loc] is returned. loc must resolve to an int value. * Otherwise loc is treated as a bean property of o. * * @param o an object to be accessed using the array operator or '.' operator. * @param loc the index of the object to be returned. * @param uberspect Uberspector to use during evaluation * @return the resulting value. * @throws Exception on any error. */ public static Object evaluateExpr(Object o, Object loc, Uberspect uberspect) throws Exception { /* * following the JSTL EL rules */ if (o == null) { return null; } if (loc == null) { return null; } if (o instanceof Map) { if (!((Map) o).containsKey(loc)) { return null; } return ((Map) o).get(loc); } else if (o instanceof List) { int idx = Coercion.coerceInteger(loc).intValue(); try { return ((List) o).get(idx); } catch (IndexOutOfBoundsException iobe) { return null; } } else if (o.getClass().isArray()) { int idx = Coercion.coerceInteger(loc).intValue(); try { return Array.get(o, idx); } catch (ArrayIndexOutOfBoundsException aiobe) { return null; } } else { /* * "Otherwise (a JavaBean object)..." huh? :) */ String s = loc.toString(); VelPropertyGet vg = uberspect.getPropertyGet(o, s, DUMMY); if (vg != null) { return vg.invoke(o); } } throw new Exception("Unsupported object type for array [] accessor"); } /** * Gets the variable name piece of the expression. * @return a String of the identifer. * @see ASTIdentifier#getIdentifierString(). */ public String getIdentifierString() { return ((ASTIdentifier) jjtGetChild(0)).getIdentifierString(); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/package.html0000664000175000017500000000062111671435474032354 0ustar jamespagejamespage Package Documentation for org.apache.commons.jexl.parser Package Contains the Parser for JEXL script.

Introduction

This package contains the Parser for JEXL script.

jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTFalseNode.java0000664000175000017500000000336711671435474033160 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * represents Boolean false. * * @author Geir Magnusson Jr. * @version $Id: ASTFalseNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTFalseNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTFalseNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTFalseNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return Boolean.FALSE; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTSubtractNode.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTSubtractNode.ja0000664000175000017500000000640511671435474033362 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.util.Coercion; import org.apache.commons.jexl.JexlContext; /** * Subtraction. * * @author Geir Magnusson Jr. * @author Mark H. Wilkinson * @version $Id: ASTSubtractNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTSubtractNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTSubtractNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTSubtractNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Object right = ((SimpleNode) jjtGetChild(1)).value(context); /* * the spec says 'and', I think 'or' */ if (left == null && right == null) { return new Byte((byte) 0); } /* * if anything is float, double or string with ( "." | "E" | "e") coerce * all to doubles and do it */ if (left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double || (left instanceof String && (((String) left).indexOf(".") != -1 || ((String) left).indexOf("e") != -1 || ((String) left).indexOf("E") != -1)) || (right instanceof String && (((String) right).indexOf(".") != -1 || ((String) right).indexOf("e") != -1 || ((String) right).indexOf("E") != -1))) { Double l = Coercion.coerceDouble(left); Double r = Coercion.coerceDouble(right); return new Double(l.doubleValue() - r.doubleValue()); } /* * otherwise to longs with thee! */ Long l = Coercion.coerceLong(left); Long r = Coercion.coerceLong(right); return new Long(l.longValue() - r.longValue()); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTNotNode.java0000664000175000017500000000412111671435474032653 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Not : 'not' or '!'. * * @author Geir Magnusson Jr. * @version $Id: ASTNotNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTNotNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTNotNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTNotNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object val = ((SimpleNode) jjtGetChild(0)).value(jc); /* * coercion rules */ Boolean b = Coercion.coerceBoolean(val); if (b != null) { return b.booleanValue() ? Boolean.FALSE : Boolean.TRUE; } throw new Exception("expression not boolean valued"); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTMulNode.java0000664000175000017500000000626111671435474032657 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Multiplication. * * @author Geir Magnusson Jr. * @version $Id: ASTMulNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTMulNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTMulNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTMulNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Object right = ((SimpleNode) jjtGetChild(1)).value(context); /* * the spec says 'and', I think 'or' */ if (left == null && right == null) { return new Byte((byte) 0); } /* * if anything is float, double or string with ( "." | "E" | "e") coerce * all to doubles and do it */ if (left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double || (left instanceof String && (((String) left).indexOf(".") != -1 || ((String) left).indexOf("e") != -1 || ((String) left).indexOf("E") != -1)) || (right instanceof String && (((String) right).indexOf(".") != -1 || ((String) right).indexOf("e") != -1 || ((String) right).indexOf("E") != -1))) { Double l = Coercion.coerceDouble(left); Double r = Coercion.coerceDouble(right); return new Double(l.doubleValue() * r.doubleValue()); } /* * otherwise to longs with thee! */ Long l = Coercion.coerceLong(left); Long r = Coercion.coerceLong(right); return new Long(l.longValue() * r.longValue()); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/SimpleNode.java0000664000175000017500000001443011671435474033000 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.introspection.Uberspect; /** * A Useful implementation of {@link Node}. Mostly autogenerated by javacc * * @author Geir Magnusson Jr. * @version $Id: SimpleNode.java 548229 2007-06-18 06:11:32Z dion $ */ public class SimpleNode implements Node { /** parent node. */ protected Node parent; /** children of this node. */ protected Node[] children; /** id of the node. */ protected int id; /** parser that created the node. */ protected Parser parser; /** * Create the node given an id. * * @param i node id. */ public SimpleNode(int i) { id = i; } /** * Create a node with the given parser and id. * * @param p a parser. * @param i node id. */ public SimpleNode(Parser p, int i) { this(i); parser = p; } /** * Start of the node. */ public void jjtOpen() { } /** * End of the node. */ public void jjtClose() { } /** {@inheritDoc} */ public void jjtSetParent(Node n) { parent = n; } /** {@inheritDoc} */ public Node jjtGetParent() { return parent; } /** {@inheritDoc} */ public void jjtAddChild(Node n, int i) { if (children == null) { children = new Node[i + 1]; } else if (i >= children.length) { Node[] c = new Node[i + 1]; System.arraycopy(children, 0, c, 0, children.length); children = c; } children[i] = n; } /** {@inheritDoc} */ public Node jjtGetChild(int i) { return children[i]; } /** {@inheritDoc} */ public int jjtGetNumChildren() { return (children == null) ? 0 : children.length; } /** * Accept the visitor. * * @param visitor a {@link ParserVisitor}. * @param data data to be passed along to the visitor. * @return the value from visiting. * @see ParserVisitor#visit */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * Visit all children. * * @param visitor a {@link ParserVisitor}. * @param data data to be passed along to the visitor. * @return the value from visiting. * @see ParserVisitor#visit */ public Object childrenAccept(ParserVisitor visitor, Object data) { if (children != null) { for (int i = 0; i < children.length; ++i) { children[i].jjtAccept(visitor, data); } } return data; } /** * Gets a string representation of the node. * @return the node name. */ public String toString() { return ParserTreeConstants.jjtNodeName[id]; } /** * Used during dumping to output the node with a prefix. * @param prefix text to prefix {@link #toString()} * @return text. */ public String toString(String prefix) { return prefix + toString(); } /** * Dump the node and all children. * @param prefix text to prefix the node output. */ public void dump(String prefix) { System.out.println(toString(prefix)); if (children != null) { for (int i = 0; i < children.length; ++i) { SimpleNode n = (SimpleNode) children[i]; if (n != null) { n.dump(prefix + " "); } } } } /** * basic interpret - just invoke interpret on all children. * @param pc the {@link JexlContext context} to interpret against. * @return true if interpretation worked. * @throws Exception on any error. */ public boolean interpret(JexlContext pc) throws Exception { for (int i = 0; i < jjtGetNumChildren(); i++) { SimpleNode node = (SimpleNode) jjtGetChild(i); if (!node.interpret(pc)) { return false; } } return true; } /** * Gets the value of this node. * * @param context the context to retrieve values from. * @return the value of the node. * @throws Exception when evaluating the operands fails. */ public Object value(JexlContext context) throws Exception { return null; } /** * Sets the value for the node - again, only makes sense for some nodes but * lazyness tempts me to put it here. Keeps things simple. * * @param context the context to retrieve values from. * @param value the value. * @return the result. * @throws Exception when evaluating the operands fails. */ public Object setValue(JexlContext context, Object value) throws Exception { return null; } /** * Used to let a node calcuate it's value.. * @param o the object to calculate with. * @param ctx the context to retrieve values from. * @throws Exception when calculating the value fails. * @return the result of the calculation. */ public Object execute(Object o, JexlContext ctx) throws Exception { return null; } protected Uberspect getUberspect() { return parser.getUberspect(); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTReference.java0000664000175000017500000001070511671435474033210 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * reference - any variable expression. * * @author Geir Magnusson Jr. * @version $Id: ASTReference.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTReference extends SimpleNode { /** first variable in the expression. */ protected SimpleNode root; /** * Create the node given an id. * * @param id node id. */ public ASTReference(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTReference(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return execute(null, jc); } /** Store the first child as {@link ASTReference#root root}. */ public void jjtClose() { root = (SimpleNode) jjtGetChild(0); } /** * evaluate each piece of the reference. * * e.g. foo.bar.woogie[2].name, foo is our 'root', and we need to * evaluate 'bar.woogie[2].name' relative to foo. * * @param jc the {@link JexlContext} to evaluate against. * @param obj not used. root.value(jc) is used instead. * @return the value of the array expression. * @throws Exception on any error */ public Object execute(Object obj, JexlContext jc) throws Exception { Object o = root.value(jc); /* * ignore the first child - it's our identifier */ for (int i = 1; i < jjtGetNumChildren(); i++) { o = ((SimpleNode) jjtGetChild(i)).execute(o, jc); // check for a variable in the context named // child0.child1.child2 etc if (o == null) { String varName = getIdentifierToDepth(i); o = jc.getVars().get(varName); } } return o; } /** * This method returns a variable from this identifier and it's children. * For an expression like 'a.b.c', a is child zero, b is child 1 and c is * child 2. * * @param i the depth of the child nodes to go to * @return the a dotted variable from this identifier and it's child nodes. */ private String getIdentifierToDepth(int i) { StringBuffer varName = new StringBuffer(); for (int j = 0; j <= i; j++) { SimpleNode node = (SimpleNode) jjtGetChild(j); if (node instanceof ASTIdentifier) { varName.append(((ASTIdentifier) node).getIdentifierString()); if (j != i) { varName.append('.'); } } } return varName.toString(); } /** * Gets the variable name of {@link ASTReference#root root}. * @return the identifier. * @throws Exception on any error * @see ASTIdentifier#getIdentifierString() * @see ASTArrayAccess#getIdentifierString() */ public String getRootString() throws Exception { if (root instanceof ASTIdentifier) { return ((ASTIdentifier) root).getIdentifierString(); } if (root instanceof ASTArrayAccess) { return ((ASTArrayAccess) root).getIdentifierString(); } throw new Exception("programmer error : ASTReference : root not known" + root); } } ././@LongLink0000000000000000000000000000015700000000000011570 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTExpressionExpression.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTExpressionExpre0000664000175000017500000000356111671435474033537 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * represents equality between integers - use .equals() for strings. * * @author Geir Magnusson Jr. * @version $Id: ASTExpressionExpression.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTExpressionExpression extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTExpressionExpression(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTExpressionExpression(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { return ((SimpleNode) jjtGetChild(0)).value(context); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTSizeMethod.java0000664000175000017500000000420211671435474033360 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * Size Method, e.g. size(). * * @author Mark H. Wilkinson * @version $Id: ASTSizeMethod.java 548229 2007-06-18 06:11:32Z dion $ */ public class ASTSizeMethod extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTSizeMethod(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTSizeMethod(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * evaluate size as part of an expression on a base object. * * foo.bar.size * * @param jc the {@link JexlContext} to evaluate against. * @param obj not used. * @return the value of the array expression. * @throws Exception on any error */ public Object execute(Object obj, JexlContext jc) throws Exception { if (null == obj) { return null; } return new Integer(ASTSizeFunction.sizeOf(obj, getUberspect())); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTIntegerLiteral.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTIntegerLiteral.0000664000175000017500000000452211671435474033362 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * represents an integer. * * @author Geir Magnusson Jr. * @version $Id: ASTIntegerLiteral.java 548229 2007-06-18 06:11:32Z dion $ */ public class ASTIntegerLiteral extends SimpleNode { /** literal value. */ protected Integer val; /** * Create the node given an id. * * @param id node id. */ public ASTIntegerLiteral(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTIntegerLiteral(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * Part of reference resolution - wierd... in JSTL EL you can have foo.2 * which is equiv to foo[2] it appears... * * @param obj the object to evaluate against. * @param ctx the {@link JexlContext}. * @throws Exception on any error. * @return the resulting value. * @see ASTArrayAccess#evaluateExpr(Object, Object, Uberspect) */ public Object execute(Object obj, JexlContext ctx) throws Exception { return ASTArrayAccess.evaluateExpr(obj, val, getUberspect()); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return val; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTJexlScript.java0000664000175000017500000000356411671435474033406 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * Top of the syntax tree - parsed Jexl code. * * @since 1.1 */ public class ASTJexlScript extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTJexlScript(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTJexlScript(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { int numChildren = jjtGetNumChildren(); Object result = null; for (int i = 0; i < numChildren; i++) { SimpleNode child = (SimpleNode) jjtGetChild(i); result = child.value(jc); } return result; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTDivNode.java0000664000175000017500000000453411671435474032645 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.util.Coercion; import org.apache.commons.jexl.JexlContext; /** * a / b, mathematical divide. * * @author Geir Magnusson Jr. * @version $Id: ASTDivNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTDivNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTDivNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTDivNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(jc); Object right = ((SimpleNode) jjtGetChild(1)).value(jc); /* * the spec says 'and', I think 'or' */ if (left == null && right == null) { return new Byte((byte) 0); } Double l = Coercion.coerceDouble(left); Double r = Coercion.coerceDouble(right); /* * catch div/0 */ if (r.doubleValue() == 0.0) { return new Double(0.0); } return new Double(l.doubleValue() / r.doubleValue()); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTExpression.java0000664000175000017500000000343611671435474033454 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * AST node for expression. * * @author Geir Magnusson Jr. * @version $Id: ASTExpression.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTExpression extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTExpression(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTExpression(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { return ((SimpleNode) jjtGetChild(0)).value(context); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTAndNode.java0000664000175000017500000000414211671435474032620 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * && and 'and'. * * @author Geir Magnusson Jr. * @version $Id: ASTAndNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTAndNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTAndNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTAndNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(jc); boolean leftValue = Coercion.coerceBoolean(left).booleanValue(); /* * coercion rules */ return (leftValue && Coercion.coerceBoolean( ((SimpleNode) jjtGetChild(1)).value(jc)).booleanValue()) ? Boolean.TRUE : Boolean.FALSE; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTAddNode.java0000664000175000017500000001010311671435474032600 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Addition : either integer addition or string concatenation. * * @author Geir Magnusson Jr. * @version $Id: ASTAddNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTAddNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTAddNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTAddNode(Parser p, int id) { super(p, id); } /** * {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Object right = ((SimpleNode) jjtGetChild(1)).value(context); /* * the spec says 'and' */ if (left == null && right == null) { return new Long(0); } // Kohsuke addition - handle null gracefully if (left == null) return right; if (right == null) return left; // Kohsuke addition until here /* * if anything is float, double or string with ( "." | "E" | "e") * coerce all to doubles and do it */ if (left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double || (left instanceof String && (((String) left).indexOf(".") != -1 || ((String) left).indexOf("e") != -1 || ((String) left).indexOf("E") != -1) ) || (right instanceof String && (((String) right).indexOf(".") != -1 || ((String) right).indexOf("e") != -1 || ((String) right).indexOf("E") != -1) ) ) { /* * in the event that either is null and not both, then just make the * null a 0 */ try { Double l = Coercion.coerceDouble(left); Double r = Coercion.coerceDouble(right); return new Double(l.doubleValue() + r.doubleValue()); } catch (java.lang.NumberFormatException nfe) { /* * Well, use strings! */ return left.toString().concat(right.toString()); } } /* * attempt to use Longs */ try { Long l = Coercion.coerceLong(left); Long r = Coercion.coerceLong(right); return new Long(l.longValue() + r.longValue()); } catch (java.lang.NumberFormatException nfe) { /* * Well, use strings! */ return left.toString().concat(right.toString()); } } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTMethod.java0000664000175000017500000001230311671435474032526 0ustar jamespagejamespage/* * 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.jexl.parser; import java.lang.reflect.InvocationTargetException; import java.math.BigDecimal; import java.math.BigInteger; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.introspection.Info; import org.apache.commons.jexl.util.introspection.VelMethod; /** * Method execution. */ public class ASTMethod extends SimpleNode { /** dummy velocity info. */ private static final Info DUMMY = new Info("", 1, 1); /** * Create the node given an id. * * @param id node id. */ public ASTMethod(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTMethod(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * evaluate a method invocation upon a base object. * * foo.bar(2) * * @param jc the {@link JexlContext} to evaluate against. * @param obj The object to have the method invoked. * @return the value of the method invocation. * @throws Exception on any error */ public Object execute(Object obj, JexlContext jc) throws Exception { String methodName = ((ASTIdentifier) jjtGetChild(0)).val; int paramCount = jjtGetNumChildren() - 1; /* * get our params */ Object[] params = new Object[paramCount]; try { for (int i = 0; i < paramCount; i++) { params[i] = ((SimpleNode) jjtGetChild(i + 1)).value(jc); } VelMethod vm = getUberspect().getMethod(obj, methodName, params, DUMMY); /* * DG: If we can't find an exact match, narrow the parameters and * try again! */ if (vm == null) { // replace all numbers with the smallest type that will fit for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param instanceof Number) { params[i] = narrow((Number) param); } } vm = getUberspect().getMethod(obj, methodName, params, DUMMY); if (vm == null) { return null; } } return vm.invoke(obj, params); } catch (InvocationTargetException e) { Throwable t = e.getTargetException(); if (t instanceof Exception) { throw (Exception) t; } throw e; } } /** * Given a Number, return back the value using the smallest type the result * will fit into. This works hand in hand with parameter 'widening' in java * method calls, e.g. a call to substring(int,int) with an int and a long * will fail, but a call to substring(int,int) with an int and a short will * succeed. * * @param original the original number. * @return a value of the smallest type the original number will fit into. * @since 1.1 */ private Number narrow(Number original) { if (original == null || original instanceof BigDecimal || original instanceof BigInteger) { return original; } Number result = original; if (original instanceof Double || original instanceof Float) { double value = original.doubleValue(); if (value <= Float.MAX_VALUE && value >= Float.MIN_VALUE) { result = new Float(result.floatValue()); } // else it was already a double } else { long value = original.longValue(); if (value <= Byte.MAX_VALUE && value >= Byte.MIN_VALUE) { // it will fit in a byte result = new Byte((byte) value); } else if (value <= Short.MAX_VALUE && value >= Short.MIN_VALUE) { result = new Short((short) value); } else if (value <= Integer.MAX_VALUE && value >= Integer.MIN_VALUE) { result = new Integer((int) value); } // else it was already a long } return result; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTTrueNode.java0000664000175000017500000000336111671435474033037 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * represents Boolean true. * * @author Geir Magnusson Jr. * @version $Id: ASTTrueNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTTrueNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTTrueNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTTrueNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return Boolean.TRUE; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTAssignment.java0000664000175000017500000000445711671435474033431 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * x = y, assigns a value to a variable in the context. * * @author Dion Gillard * */ public class ASTAssignment extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTAssignment(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTAssignment(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { // left should be the variable (reference) to assign to SimpleNode left = (SimpleNode) jjtGetChild(0); // right should be the expression to evaluate Object right = ((SimpleNode) jjtGetChild(1)).value(context); if (left instanceof ASTReference) { ASTReference reference = (ASTReference) left; left = (SimpleNode) reference.jjtGetChild(0); if (left instanceof ASTIdentifier) { String identifier = ((ASTIdentifier) left) .getIdentifierString(); context.getVars().put(identifier, right); } } return right; } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTFloatLiteral.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTFloatLiteral.ja0000664000175000017500000000350211671435474033342 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * represents a float point number. * * @author Geir Magnusson Jr. * @version $Id: ASTFloatLiteral.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTFloatLiteral extends SimpleNode { /** the value of the literal. */ protected Float val; /** * Create the node given an id. * * @param id node id. */ public ASTFloatLiteral(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTFloatLiteral(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return val; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTBitwiseXorNode.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTBitwiseXorNode.0000664000175000017500000000410011671435474033345 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Bitwise Or. Syntax: a ^ b Result is a Long * * @author Dion Gillard * @since 1.1 */ public class ASTBitwiseXorNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTBitwiseXorNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTBitwiseXorNode(Parser p, int id) { super(p, id); } /** * {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** * {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Object right = ((SimpleNode) jjtGetChild(1)).value(context); Long l = left == null ? new Long(0) : Coercion.coerceLong(left); Long r = right == null ? new Long(0) : Coercion.coerceLong(right); return new Long(l.longValue() ^ r.longValue()); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTElvisNode.java0000664000175000017500000000163611671435474033205 0ustar jamespagejamespagepackage org.apache.commons.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * "x?:y" operator. * * @author Kohsuke Kawaguchi */ public class ASTElvisNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTElvisNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTElvisNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object cond = ((SimpleNode) jjtGetChild(0)).value(jc); if(cond!=null) return cond; return ((SimpleNode) jjtGetChild(1)).value(jc); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/SimpleCharStream.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/SimpleCharStream.j0000664000175000017500000003022311671435474033452 0ustar jamespagejamespage/* * 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. */ /* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 3.0 */ package org.apache.commons.jexl.parser; /** * An implementation of interface CharStream, where the stream is assumed to * contain only ASCII characters (without unicode processing). */ public class SimpleCharStream { public static final boolean staticFlag = false; int bufsize; int available; int tokenBegin; public int bufpos = -1; protected int bufline[]; protected int bufcolumn[]; protected int column = 0; protected int line = 1; protected boolean prevCharIsCR = false; protected boolean prevCharIsLF = false; protected java.io.Reader inputStream; protected char[] buffer; protected int maxNextCharInd = 0; protected int inBuf = 0; protected int tabSize = 8; protected void setTabSize(int i) { tabSize = i; } protected int getTabSize(int i) { return tabSize; } protected void ExpandBuff(boolean wrapAround) { char[] newbuffer = new char[bufsize + 2048]; int newbufline[] = new int[bufsize + 2048]; int newbufcolumn[] = new int[bufsize + 2048]; try { if (wrapAround) { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos += (bufsize - tokenBegin)); } else { System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin); buffer = newbuffer; System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin); bufline = newbufline; System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin); bufcolumn = newbufcolumn; maxNextCharInd = (bufpos -= tokenBegin); } } catch (Throwable t) { throw new Error(t.getMessage()); } bufsize += 2048; available = bufsize; tokenBegin = 0; } protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxNextCharInd = 0; else ExpandBuff(false); } else if (available > tokenBegin) available = bufsize; else if ((tokenBegin - available) < 2048) ExpandBuff(true); else available = tokenBegin; } int i; try { if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1) { inputStream.close(); throw new java.io.IOException(); } else maxNextCharInd += i; return; } catch(java.io.IOException e) { --bufpos; backup(0); if (tokenBegin == -1) tokenBegin = bufpos; throw e; } } public char BeginToken() throws java.io.IOException { tokenBegin = -1; char c = readChar(); tokenBegin = bufpos; return c; } protected void UpdateLineColumn(char c) { column++; if (prevCharIsLF) { prevCharIsLF = false; line += (column = 1); } else if (prevCharIsCR) { prevCharIsCR = false; if (c == '\n') { prevCharIsLF = true; } else line += (column = 1); } switch (c) { case '\r' : prevCharIsCR = true; break; case '\n' : prevCharIsLF = true; break; case '\t' : column--; column += (tabSize - (column % tabSize)); break; default : break; } bufline[bufpos] = line; bufcolumn[bufpos] = column; } public char readChar() throws java.io.IOException { if (inBuf > 0) { --inBuf; if (++bufpos == bufsize) bufpos = 0; return buffer[bufpos]; } if (++bufpos >= maxNextCharInd) FillBuff(); char c = buffer[bufpos]; UpdateLineColumn(c); return (c); } /** * @deprecated * @see #getEndColumn */ public int getColumn() { return bufcolumn[bufpos]; } /** * @deprecated * @see #getEndLine */ public int getLine() { return bufline[bufpos]; } public int getEndColumn() { return bufcolumn[bufpos]; } public int getEndLine() { return bufline[bufpos]; } public int getBeginColumn() { return bufcolumn[tokenBegin]; } public int getBeginLine() { return bufline[tokenBegin]; } public void backup(int amount) { inBuf += amount; if ((bufpos -= amount) < 0) bufpos += bufsize; } public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } public SimpleCharStream(java.io.Reader dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } public SimpleCharStream(java.io.Reader dstream) { this(dstream, 1, 1, 4096); } public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (buffer == null || buffersize != buffer.length) { available = bufsize = buffersize; buffer = new char[buffersize]; bufline = new int[buffersize]; bufcolumn = new int[buffersize]; } prevCharIsLF = prevCharIsCR = false; tokenBegin = inBuf = maxNextCharInd = 0; bufpos = -1; } public void ReInit(java.io.Reader dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); } public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { this(dstream, encoding, startline, startcolumn, 4096); } public SimpleCharStream(java.io.InputStream dstream, int startline, int startcolumn) { this(dstream, startline, startcolumn, 4096); } public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { this(dstream, encoding, 1, 1, 4096); } public SimpleCharStream(java.io.InputStream dstream) { this(dstream, 1, 1, 4096); } public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException { ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize); } public void ReInit(java.io.InputStream dstream, int startline, int startcolumn, int buffersize) { ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize); } public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, 1, 1, 4096); } public void ReInit(java.io.InputStream dstream) { ReInit(dstream, 1, 1, 4096); } public void ReInit(java.io.InputStream dstream, String encoding, int startline, int startcolumn) throws java.io.UnsupportedEncodingException { ReInit(dstream, encoding, startline, startcolumn, 4096); } public void ReInit(java.io.InputStream dstream, int startline, int startcolumn) { ReInit(dstream, startline, startcolumn, 4096); } public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); } public char[] GetSuffix(int len) { char[] ret = new char[len]; if ((bufpos + 1) >= len) System.arraycopy(buffer, bufpos - len + 1, ret, 0, len); else { System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0, len - bufpos - 1); System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1); } return ret; } public void Done() { buffer = null; bufline = null; bufcolumn = null; } /** * Method to adjust line and column numbers for the start of a token. */ public void adjustBeginLineColumn(int newLine, int newCol) { int start = tokenBegin; int len; if (bufpos >= tokenBegin) { len = bufpos - tokenBegin + inBuf + 1; } else { len = bufsize - tokenBegin + bufpos + 1 + inBuf; } int i = 0, j = 0, k = 0; int nextColDiff = 0, columnDiff = 0; while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) { bufline[j] = newLine; nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j]; bufcolumn[j] = newCol + columnDiff; columnDiff = nextColDiff; i++; } if (i < len) { bufline[j] = newLine++; bufcolumn[j] = newCol + columnDiff; while (i++ < len) { if (bufline[j = start % bufsize] != bufline[++start % bufsize]) bufline[j] = newLine++; else bufline[j] = newLine; } } line = bufline[j]; column = bufcolumn[j]; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTOrNode.java0000664000175000017500000000412511671435474032477 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.util.Coercion; import org.apache.commons.jexl.JexlContext; /** * || and 'or'. * * @author Geir Magnusson Jr. * @version $Id: ASTOrNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTOrNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTOrNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTOrNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(jc); boolean leftValue = Coercion.coerceBoolean(left).booleanValue(); /* * coercion rules */ return (leftValue || Coercion.coerceBoolean(((SimpleNode) jjtGetChild(1)).value(jc)).booleanValue()) ? Boolean.TRUE : Boolean.FALSE; } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTBitwiseAndNode.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTBitwiseAndNode.0000664000175000017500000000405311671435474033306 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Bitwise And. Syntax: a & b Result is a {@link Long} * * @author Dion Gillard * @since 1.1 */ public class ASTBitwiseAndNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTBitwiseAndNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTBitwiseAndNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Object right = ((SimpleNode) jjtGetChild(1)).value(context); Long l = left == null ? new Long(0) : Coercion.coerceLong(left); Long r = right == null ? new Long(0) : Coercion.coerceLong(right); return new Long(l.longValue() & r.longValue()); } } ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTReferenceExpression.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTReferenceExpres0000664000175000017500000000325311671435474033457 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; /** * variable; A reference by itself. */ public class ASTReferenceExpression extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTReferenceExpression(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTReferenceExpression(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { return ((SimpleNode) jjtGetChild(0)).value(context); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTModNode.java0000664000175000017500000000670311671435474032642 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * % (mod). * * @author Geir Magnusson Jr. * @version $Id: ASTModNode.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ASTModNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTModNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTModNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(jc); Object right = ((SimpleNode) jjtGetChild(1)).value(jc); /* * the spec says 'and', I think 'or' */ if (left == null && right == null) { return new Byte((byte) 0); } /* * if anything is float, double or string with ( "." | "E" | "e") coerce * all to doubles and do it */ if (left instanceof Float || left instanceof Double || right instanceof Float || right instanceof Double || (left instanceof String && (((String) left).indexOf(".") != -1 || ((String) left).indexOf("e") != -1 || ((String) left).indexOf("E") != -1)) || (right instanceof String && (((String) right).indexOf(".") != -1 || ((String) right).indexOf("e") != -1 || ((String) right).indexOf("E") != -1))) { Double l = Coercion.coerceDouble(left); Double r = Coercion.coerceDouble(right); /* * catch div/0 */ if (r.doubleValue() == 0.0) { return new Double(0.0); } return new Double(l.doubleValue() % r.doubleValue()); } /* * otherwise to longs with thee! */ Long l = Coercion.coerceLong(left); Long r = Coercion.coerceLong(right); /* * catch the div/0 */ if (r.longValue() == 0) { return new Long(0); } return new Long(l.longValue() % r.longValue()); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTBitwiseOrNode.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTBitwiseOrNode.j0000664000175000017500000000404111671435474033333 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Bitwise Or. Syntax: a | b Result is a Long * * @author Dion Gillard * @since 1.1 */ public class ASTBitwiseOrNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTBitwiseOrNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTBitwiseOrNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Object right = ((SimpleNode) jjtGetChild(1)).value(context); Long l = left == null ? new Long(0) : Coercion.coerceLong(left); Long r = right == null ? new Long(0) : Coercion.coerceLong(right); return new Long(l.longValue() | r.longValue()); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ParseException.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ParseException.jav0000664000175000017500000001642511671435474033537 0ustar jamespagejamespage/* * 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. */ /* Generated By:JavaCC: Do not edit this line. ParseException.java Version 3.0 */ package org.apache.commons.jexl.parser; /** * This exception is thrown when parse errors are encountered. * You can explicitly create objects of this exception type by * calling the method generateParseException in the generated * parser. * * You can modify this class to customize your error reporting * mechanisms so long as you retain the public fields. */ public class ParseException extends Exception { /** * This constructor is used by the method "generateParseException" * in the generated parser. Calling this constructor generates * a new object of this type with the fields "currentToken", * "expectedTokenSequences", and "tokenImage" set. The boolean * flag "specialConstructor" is also set to true to indicate that * this constructor was used to create this object. * This constructor calls its super class with the empty string * to force the "toString" method of parent class "Throwable" to * print the error message in the form: * ParseException: */ public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal ) { super(""); specialConstructor = true; currentToken = currentTokenVal; expectedTokenSequences = expectedTokenSequencesVal; tokenImage = tokenImageVal; } /** * The following constructors are for use by you for whatever * purpose you can think of. Constructing the exception in this * manner makes the exception behave in the normal way - i.e., as * documented in the class "Throwable". The fields "errorToken", * "expectedTokenSequences", and "tokenImage" do not contain * relevant information. The JavaCC generated code does not use * these constructors. */ public ParseException() { super(); specialConstructor = false; } public ParseException(String message) { super(message); specialConstructor = false; } /** * This variable determines which constructor was used to create * this object and thereby affects the semantics of the * "getMessage" method (see below). */ protected boolean specialConstructor; /** * This is the last token that has been consumed successfully. If * this object has been created due to a parse error, the token * followng this token will (therefore) be the first error token. */ public Token currentToken; /** * Each entry in this array is an array of integers. Each array * of integers represents a sequence of tokens (by their ordinal * values) that is expected at this point of the parse. */ public int[][] expectedTokenSequences; /** * This is a reference to the "tokenImage" array of the generated * parser within which the parse error occurred. This array is * defined in the generated ...Constants interface. */ public String[] tokenImage; /** * This method has the standard behavior when this object has been * created using the standard constructors. Otherwise, it uses * "currentToken" and "expectedTokenSequences" to generate a parse * error message and returns it. If this object has been created * due to a parse error, and you do not catch it (it gets thrown * from the parser), then this method is called during the printing * of the final stack trace, and hence the correct error message * gets displayed. */ public String getMessage() { if (!specialConstructor) { return super.getMessage(); } StringBuffer expected = new StringBuffer(); int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected.append(tokenImage[expectedTokenSequences[i][j]]).append(" "); } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected.append("..."); } expected.append(eol).append(" "); } String retval = "Encountered \""; Token tok = currentToken.next; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += add_escapes(tok.image); tok = tok.next; } retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn; retval += "." + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected.toString(); return retval; } /** * The end of line string for this machine. */ protected String eol = System.getProperty("line.separator", "\n"); /** * Used to convert raw characters to their escaped version * when these raw version cannot be used as part of an ASCII * string literal. */ protected String add_escapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } } ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTWhileStatement.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTWhileStatement.0000664000175000017500000000406211671435474033404 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * A while loop. Syntax: while ( expression ) statement * * @author Dion Gillard * @since 1.1 */ public class ASTWhileStatement extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTWhileStatement(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTWhileStatement(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { Object result = null; /* first child is the expression */ SimpleNode expressionNode = (SimpleNode) jjtGetChild(0); while (Coercion.coerceBoolean(expressionNode.value(jc)).booleanValue()) { // execute statement result = ((SimpleNode) jjtGetChild(1)).value(jc); } return result; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTIdentifier.java0000664000175000017500000000542311671435474033375 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.introspection.Uberspect; /** * Simple identifier - $foo or $foo.bar (both parts are identifiers). * * @author Geir Magnusson Jr. * @version $Id: ASTIdentifier.java 548229 2007-06-18 06:11:32Z dion $ */ public class ASTIdentifier extends SimpleNode { /** the name of the variable. */ protected String val; /** * Create the node given an id. * * @param id node id. */ public ASTIdentifier(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTIdentifier(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext jc) throws Exception { return jc.getVars().get(val); } /** * returns the value of itself applied to the object. We assume that an * identifier can be gotten via a get(String). * e.g. if we have bean.property, 'property' has been parsed as an identifier, * and we need to resolve the expression by calling the property getter. * * @param obj the object to evaluate against. * @param jc the {@link JexlContext}. * @throws Exception on any error. * @return the resulting value. * @see ASTArrayAccess#evaluateExpr(Object, Object, Uberspect) */ public Object execute(Object obj, JexlContext jc) throws Exception { return ASTArrayAccess.evaluateExpr(obj, val, getUberspect()); } /** * Gets the name of the variable. * @return the variable name. */ public String getIdentifierString() { return val; } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootjenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTBitwiseComplNode.javajenkins-commons-jexl-1.1-jenkins-20111212/src/java/org/apache/commons/jexl/parser/ASTBitwiseComplNod0000664000175000017500000000361611671435474033437 0ustar jamespagejamespage/* * 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.jexl.parser; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.util.Coercion; /** * Bitwise Complement. Syntax: ~a Result is a Long * * @author Dion Gillard * @since 1.1 */ public class ASTBitwiseComplNode extends SimpleNode { /** * Create the node given an id. * * @param id node id. */ public ASTBitwiseComplNode(int id) { super(id); } /** * Create a node with the given parser and id. * * @param p a parser. * @param id node id. */ public ASTBitwiseComplNode(Parser p, int id) { super(p, id); } /** {@inheritDoc} */ public Object jjtAccept(ParserVisitor visitor, Object data) { return visitor.visit(this, data); } /** {@inheritDoc} */ public Object value(JexlContext context) throws Exception { Object left = ((SimpleNode) jjtGetChild(0)).value(context); Long l = left == null ? new Long(0) : Coercion.coerceLong(left); return new Long(~l.longValue()); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test-scripts/0000775000175000017500000000000011671435474023676 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/test-scripts/test1.jexl0000664000175000017500000000032611671435474025623 0ustar jamespagejamespage## ## This is a test script ## if (out != null) out.println('Starting test script'); x = 1; y = 2; result = x * y + 5; if (out != null) out.println("The result is " + result); ## return the result. result;jenkins-commons-jexl-1.1-jenkins-20111212/src/test/0000775000175000017500000000000011671435474022211 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/0000775000175000017500000000000011671435474023000 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/0000775000175000017500000000000011671435474024221 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/0000775000175000017500000000000011671435474025674 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/0000775000175000017500000000000011671435474026636 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/ScriptTest.java0000664000175000017500000000722511671435474031613 0ustar jamespagejamespage/* * 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.jexl; import java.io.File; import java.net.URL; import junit.framework.TestCase; /** * Tests for Script * @since 1.1 */ public class ScriptTest extends TestCase { // test class for testScriptUpdatesContext // making this class private static will cause the test to fail. // this is due to unusual code in ClassMap.getAccessibleMethods(Class) // that treats non-public classes in a specific way. Why getAccessibleMethods // does this is not known yet. public static class Tester { private String code; public String getCode () { return code; } public void setCode(String c) { code = c; } } /** * Create a new test case. * @param name case name */ public ScriptTest(String name) { super(name); } /** * Test creating a script from a string. */ public void testSimpleScript() throws Exception { String code = "while (x < 10) x = x + 1;"; Script s = ScriptFactory.createScript(code); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(1)); Object o = s.execute(jc); assertEquals("Result is wrong", new Long(10), o); assertEquals("getText is wrong", code, s.getText()); } public void testScriptFromFile() throws Exception { File testScript = new File("src/test-scripts/test1.jexl"); Script s = ScriptFactory.createScript(testScript); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("out", System.out); Object result = s.execute(jc); assertNotNull("No result", result); assertEquals("Wrong result", new Long(7), result); } public void testScriptFromURL() throws Exception { URL testUrl = new File("src/test-scripts/test1.jexl").toURL(); Script s = ScriptFactory.createScript(testUrl); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("out", System.out); Object result = s.execute(jc); assertNotNull("No result", result); assertEquals("Wrong result", new Long(7), result); } public void testScriptUpdatesContext() throws Exception { String jexlCode = "resultat.setCode('OK')"; Expression e = ExpressionFactory.createExpression(jexlCode); Script s = ScriptFactory.createScript(jexlCode); Tester resultatJexl = new Tester(); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("resultat", resultatJexl); resultatJexl.setCode(""); e.evaluate(jc); assertEquals("OK", resultatJexl.getCode()); resultatJexl.setCode(""); s.execute(jc); assertEquals("OK", resultatJexl.getCode()); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/JexlTest.java0000664000175000017500000010475111671435474031253 0ustar jamespagejamespage/* * 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.jexl; import java.io.StringReader; import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; import java.util.BitSet; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import org.apache.commons.jexl.parser.ParseException; import org.apache.commons.jexl.parser.Parser; import org.apache.commons.jexl.resolver.FlatResolver; /** * Simple testcases * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: JexlTest.java 548229 2007-06-18 06:11:32Z dion $ */ public class JexlTest extends TestCase { protected static final String METHOD_STRING = "Method string"; protected static final String GET_METHOD_STRING = "GetMethod string"; protected static final String[] GET_METHOD_ARRAY = new String[] { "One", "Two", "Three" }; protected static final String[][] GET_METHOD_ARRAY2 = new String[][] { {"One", "Two", "Three"},{"Four", "Five", "Six"} }; public static Test suite() { return new TestSuite(JexlTest.class); } public JexlTest(String testName) { super(testName); } /** * test a simple property expression */ public void testProperty() throws Exception { /* * tests a simple property expression */ Expression e = ExpressionFactory.createExpression("foo.bar"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); Object o = e.evaluate(jc); assertTrue("o not instanceof String", o instanceof String); assertEquals("o incorrect", GET_METHOD_STRING, o); } /** * test a simple method expression */ public void testMethod() throws Exception { /* * tests a simple method expression */ JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); assertExpression(jc, "foo.bar()", METHOD_STRING); } /** * test a simple method expression */ public void testArrayAccess() throws Exception { JexlContext jc = JexlHelper.createContext(); /* * test List access */ List l = new ArrayList(); l.add(new Integer(1)); l.add(new Integer(2)); l.add(new Integer(3)); jc.getVars().put("list", l); assertExpression(jc, "list[1]", new Integer(2)); assertExpression(jc, "list[1+1]", new Integer(3)); jc.getVars().put("loc", new Integer(1)); assertExpression(jc, "list[loc+1]", new Integer(3)); /* * test array access */ String[] args = {"hello", "there"}; jc.getVars().put("array", args); assertExpression(jc, "array[0]", "hello"); /* * to think that this was an intentional syntax... */ assertExpression(jc, "array.0", "hello"); /* * test map access */ Map m = new HashMap(); m.put("foo", "bar"); jc.getVars().put("map", m); jc.getVars().put("key", "foo"); assertExpression(jc, "map[\"foo\"]", "bar"); assertExpression(jc, "map[key]", "bar"); /* * test bean access */ jc.getVars().put("foo", new Foo()); assertExpression(jc, "foo[\"bar\"]", GET_METHOD_STRING); assertExpression(jc, "foo[\"bar\"] == foo.bar", Boolean.TRUE); } public void testMulti() throws Exception { /* * tests a simple property expression */ JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); assertExpression(jc, "foo.innerFoo.bar()", METHOD_STRING); } public void testBoolean() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); jc.getVars().put("a", Boolean.TRUE); jc.getVars().put("b", Boolean.FALSE); assertExpression(jc, "foo.convertBoolean(a==b)", "Boolean : false"); assertExpression(jc, "foo.convertBoolean(a==true)", "Boolean : true"); assertExpression(jc, "foo.convertBoolean(a==false)", "Boolean : false"); assertExpression(jc, "foo.convertBoolean(true==false)", "Boolean : false"); assertExpression(jc, "true eq false", Boolean.FALSE); assertExpression(jc, "true ne false", Boolean.TRUE); } public void testStringLit() throws Exception { /* * tests a simple property expression */ JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); assertExpression(jc, "foo.get(\"woogie\")", "Repeat : woogie"); } public void testExpression() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo() ); jc.getVars().put("a", Boolean.TRUE); jc.getVars().put("b", Boolean.FALSE); jc.getVars().put("num", new Integer(5)); jc.getVars().put("now", Calendar.getInstance().getTime()); GregorianCalendar gc = new GregorianCalendar(5000, 11, 20); jc.getVars().put("now2", gc.getTime()); assertExpression(jc, "a == b", Boolean.FALSE); assertExpression(jc, "a==true", Boolean.TRUE); assertExpression(jc, "a==false", Boolean.FALSE); assertExpression(jc, "true==false", Boolean.FALSE); assertExpression(jc, "2 < 3", Boolean.TRUE); assertExpression(jc, "num < 5", Boolean.FALSE); assertExpression(jc, "num < num", Boolean.FALSE); assertExpression(jc, "num < null", Boolean.FALSE); assertExpression(jc, "num < 2.5", Boolean.FALSE); assertExpression(jc, "now2 < now", Boolean.FALSE); // test comparable // assertExpression(jc, "'6' <= '5'", Boolean.FALSE); assertExpression(jc, "num <= 5", Boolean.TRUE); assertExpression(jc, "num <= num", Boolean.TRUE); assertExpression(jc, "num <= null", Boolean.FALSE); assertExpression(jc, "num <= 2.5", Boolean.FALSE); assertExpression(jc, "now2 <= now", Boolean.FALSE); // test comparable // assertExpression(jc, "'6' >= '5'", Boolean.TRUE); assertExpression(jc, "num >= 5", Boolean.TRUE); assertExpression(jc, "num >= num", Boolean.TRUE); assertExpression(jc, "num >= null", Boolean.FALSE); assertExpression(jc, "num >= 2.5", Boolean.TRUE); assertExpression(jc, "now2 >= now", Boolean.TRUE); // test comparable assertExpression(jc, "'6' > '5'", Boolean.TRUE); assertExpression(jc, "num > 4", Boolean.TRUE); assertExpression(jc, "num > num", Boolean.FALSE); assertExpression(jc, "num > null", Boolean.FALSE); assertExpression(jc, "num > 2.5", Boolean.TRUE); assertExpression(jc, "now2 > now", Boolean.TRUE); // test comparable assertExpression(jc, "\"foo\" + \"bar\" == \"foobar\"", Boolean.TRUE); } public void testEmpty() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("string", ""); jc.getVars().put("array", new Object[0]); jc.getVars().put("map", new HashMap()); jc.getVars().put("list", new ArrayList()); jc.getVars().put("set", (new HashMap()).keySet()); jc.getVars().put("longstring", "thingthing"); /* * I can't believe anyone thinks this is a syntax.. :) */ assertExpression(jc, "empty nullthing", Boolean.TRUE); assertExpression(jc, "empty string", Boolean.TRUE); assertExpression(jc, "empty array", Boolean.TRUE); assertExpression(jc, "empty map", Boolean.TRUE); assertExpression(jc, "empty set", Boolean.TRUE); assertExpression(jc, "empty list", Boolean.TRUE); assertExpression(jc, "empty longstring", Boolean.FALSE); assertExpression(jc, "not empty longstring", Boolean.TRUE); } public void testSize() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("s", "five!"); jc.getVars().put("array", new Object[5]); Map map = new HashMap(); map.put("1", new Integer(1)); map.put("2", new Integer(2)); map.put("3", new Integer(3)); map.put("4", new Integer(4)); map.put("5", new Integer(5)); jc.getVars().put("map", map); List list = new ArrayList(); list.add("1"); list.add("2"); list.add("3"); list.add("4"); list.add("5"); jc.getVars().put("list", list); // 30652 - support for set Set set = new HashSet(); set.addAll(list); set.add("1"); jc.getVars().put("set", set); // support generic int size() method BitSet bitset = new BitSet(5); jc.getVars().put("bitset", bitset); assertExpression(jc, "size(s)", new Integer(5)); assertExpression(jc, "size(array)", new Integer(5)); assertExpression(jc, "size(list)", new Integer(5)); assertExpression(jc, "size(map)", new Integer(5)); assertExpression(jc, "size(set)", new Integer(5)); assertExpression(jc, "size(bitset)", new Integer(64)); assertExpression(jc, "list.size()", new Integer(5)); assertExpression(jc, "map.size()", new Integer(5)); assertExpression(jc, "set.size()", new Integer(5)); assertExpression(jc, "bitset.size()", new Integer(64)); assertExpression(jc, "list.get(size(list) - 1)", "5"); assertExpression(jc, "list[size(list) - 1]", "5"); assertExpression(jc, "list.get(list.size() - 1)", "5"); } public void testSizeAsProperty() throws Exception { JexlContext jc = JexlHelper.createContext(); Map map = new HashMap(); map.put("size", "cheese"); jc.getVars().put("map", map); jc.getVars().put("foo", new Foo()); assertExpression(jc, "map['size']", "cheese"); // PR - unsure whether or not we should support map.size or force usage of the above 'escaped' version // assertExpression(jc, "map.size", "cheese"); assertExpression(jc, "foo.getSize()", new Integer(22)); // failing assertion for size property //assertExpression(jc, "foo.size", new Integer(22)); } /** * test some String method calls */ public void testStringMethods() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", "abcdef"); assertExpression(jc, "foo.substring(3)", "def"); assertExpression(jc, "foo.substring(0,(size(foo)-3))", "abc"); assertExpression(jc, "foo.substring(0,size(foo)-3)", "abc"); assertExpression(jc, "foo.substring(0,foo.length()-3)", "abc"); assertExpression(jc, "foo.substring(0, 1+1)", "ab"); } /** * test some simple mathematical calculations */ public void testUnaryMinus() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("aByte", new Byte((byte)1)); jc.getVars().put("aShort", new Short((short)2)); jc.getVars().put("anInteger", new Integer(3)); jc.getVars().put("aLong", new Long(4)); jc.getVars().put("aFloat", new Float(5.5)); jc.getVars().put("aDouble", new Double(6.6)); jc.getVars().put("aBigInteger", new BigInteger("7")); jc.getVars().put("aBigDecimal", new BigDecimal("8.8")); assertExpression(jc, "-3", new Integer("-3")); assertExpression(jc, "-3.0", new Float("-3.0")); assertExpression(jc, "-aByte", new Byte((byte)-1)); assertExpression(jc, "-aShort", new Short((short)-2)); assertExpression(jc, "-anInteger", new Integer(-3)); assertExpression(jc, "-aLong", new Long(-4)); assertExpression(jc, "-aFloat", new Float(-5.5)); assertExpression(jc, "-aDouble", new Double(-6.6)); assertExpression(jc, "-aBigInteger", new BigInteger("-7")); assertExpression(jc, "-aBigDecimal", new BigDecimal("-8.8")); } /** * test some simple mathematical calculations */ public void testCalculations() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Integer(2) ); assertExpression(jc, "foo + 2", new Long(4)); assertExpression(jc, "3 + 3", new Long(6)); assertExpression(jc, "3 + 3 + foo", new Long(8)); assertExpression(jc, "3 * 3", new Long(9)); assertExpression(jc, "3 * 3 + foo", new Long(11)); assertExpression(jc, "3 * 3 - foo", new Long(7)); /* * test some floaty stuff */ assertExpression(jc, "3 * \"3.0\"", new Double(9)); assertExpression(jc, "3 * 3.0", new Double(9)); /* * test / and % */ assertExpression(jc, "6 / 3", new Double(6/3)); assertExpression(jc, "6.4 / 3", new Double(6.4 / 3)); assertExpression(jc, "0 / 3", new Double(0 / 3)); assertExpression(jc, "3 / 0", new Double(0)); assertExpression(jc, "4 % 3", new Long(1)); assertExpression(jc, "4.8 % 3", new Double(4.8 % 3)); /* * test to ensure new string cat works */ jc.getVars().put("stringy", "thingy" ); assertExpression(jc, "stringy + 2", "thingy2"); /* * test new null coersion */ jc.getVars().put("imanull", null ); assertExpression(jc, "imanull + 2", new Integer(2)); assertExpression(jc, "imanull + imanull", new Long(0)); /* test for bugzilla 31577 */ jc.getVars().put("n", new Integer(0)); assertExpression(jc, "n != null && n != 0", Boolean.FALSE); } /** * test some simple conditions */ public void testConditions() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Integer(2) ); jc.getVars().put("aFloat", new Float(1)); jc.getVars().put("aDouble", new Double(2)); jc.getVars().put("aChar", new Character('A')); jc.getVars().put("aBool", Boolean.TRUE); StringBuffer buffer = new StringBuffer("abc"); List list = new ArrayList(); List list2 = new LinkedList(); jc.getVars().put("aBuffer", buffer); jc.getVars().put("aList", list); jc.getVars().put("bList", list2); assertExpression(jc, "foo == 2", Boolean.TRUE); assertExpression(jc, "2 == 3", Boolean.FALSE); assertExpression(jc, "3 == foo", Boolean.FALSE); assertExpression(jc, "3 != foo", Boolean.TRUE); assertExpression(jc, "foo != 2", Boolean.FALSE); // test float and double equality assertExpression(jc, "aFloat eq aDouble", Boolean.FALSE); assertExpression(jc, "aFloat ne aDouble", Boolean.TRUE); assertExpression(jc, "aFloat == aDouble", Boolean.FALSE); assertExpression(jc, "aFloat != aDouble", Boolean.TRUE); // test number and character equality assertExpression(jc, "foo == aChar", Boolean.FALSE); assertExpression(jc, "foo != aChar", Boolean.TRUE); // test string and boolean assertExpression(jc, "aBool == 'true'", Boolean.TRUE); assertExpression(jc, "aBool == 'false'", Boolean.FALSE); assertExpression(jc, "aBool != 'false'", Boolean.TRUE); // test null and boolean assertExpression(jc, "aBool == notThere", Boolean.FALSE); assertExpression(jc, "aBool != notThere", Boolean.TRUE); // anything and string as a string comparison assertExpression(jc, "aBuffer == 'abc'", Boolean.TRUE); assertExpression(jc, "aBuffer != 'abc'", Boolean.FALSE); // arbitrary equals assertExpression(jc, "aList == bList", Boolean.TRUE); assertExpression(jc, "aList != bList", Boolean.FALSE); } /** * test some simple conditions */ public void testNotConditions() throws Exception { JexlContext jc = JexlHelper.createContext(); Foo foo = new Foo(); jc.getVars().put("x", Boolean.TRUE ); jc.getVars().put("foo", foo ); jc.getVars().put("bar", "true" ); assertExpression(jc, "!x", Boolean.FALSE); assertExpression(jc, "x", Boolean.TRUE); assertExpression(jc, "!bar", Boolean.FALSE); assertExpression(jc, "!foo.isSimple()", Boolean.FALSE); assertExpression(jc, "foo.isSimple()", Boolean.TRUE); assertExpression(jc, "!foo.simple", Boolean.FALSE); assertExpression(jc, "foo.simple", Boolean.TRUE); assertExpression(jc, "foo.getCheeseList().size() == 3", Boolean.TRUE); assertExpression(jc, "foo.cheeseList.size() == 3", Boolean.TRUE); jc.getVars().put("string", ""); assertExpression(jc, "not empty string", Boolean.FALSE); assertExpression(jc, "not(empty string)", Boolean.FALSE); assertExpression(jc, "not empty(string)", Boolean.FALSE); assertExpression(jc, "! empty string", Boolean.FALSE); assertExpression(jc, "!(empty string)", Boolean.FALSE); assertExpression(jc, "!empty(string)", Boolean.FALSE); } /** * GMJ : disabled - need to fix * * test some simple conditions */ public void testNotConditionsWithDots() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x.a", Boolean.TRUE ); jc.getVars().put("x.b", Boolean.FALSE ); assertExpression(jc, "x.a", Boolean.TRUE); assertExpression(jc, "!x.a", Boolean.FALSE); assertExpression(jc, "!x.b", Boolean.TRUE); } /** * test some simple conditions */ public void testComparisons() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", "the quick and lazy fox" ); assertExpression(jc, "foo.indexOf('quick') > 0", Boolean.TRUE); assertExpression(jc, "foo.indexOf('bar') >= 0", Boolean.FALSE); assertExpression(jc, "foo.indexOf('bar') < 0", Boolean.TRUE); } /** * test some null conditions */ public void testNull() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("bar", new Integer(2) ); assertExpression(jc, "empty foo", Boolean.TRUE); assertExpression(jc, "bar == null", Boolean.FALSE); assertExpression(jc, "foo == null", Boolean.TRUE); assertExpression(jc, "bar != null", Boolean.TRUE); assertExpression(jc, "foo != null", Boolean.FALSE); assertExpression(jc, "empty(bar)", Boolean.FALSE); assertExpression(jc, "empty(foo)", Boolean.TRUE); } /** * test some blank strings */ public void testBlankStrings() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("bar", "" ); assertExpression(jc, "foo == ''", Boolean.FALSE); assertExpression(jc, "bar == ''", Boolean.TRUE); assertExpression(jc, "barnotexist == ''", Boolean.FALSE); assertExpression(jc, "empty bar", Boolean.TRUE); assertExpression(jc, "bar.length() == 0", Boolean.TRUE); assertExpression(jc, "size(bar) == 0", Boolean.TRUE); } /** * test some blank strings */ public void testLogicExpressions() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", "abc" ); jc.getVars().put("bar", "def" ); assertExpression(jc, "foo == 'abc' || bar == 'abc'", Boolean.TRUE); assertExpression(jc, "foo == 'abc' or bar == 'abc'", Boolean.TRUE); assertExpression(jc, "foo == 'abc' && bar == 'abc'", Boolean.FALSE); assertExpression(jc, "foo == 'abc' and bar == 'abc'", Boolean.FALSE); assertExpression(jc, "foo == 'def' || bar == 'abc'", Boolean.FALSE); assertExpression(jc, "foo == 'def' or bar == 'abc'", Boolean.FALSE); assertExpression(jc, "foo == 'abc' && bar == 'def'", Boolean.TRUE); assertExpression(jc, "foo == 'abc' and bar == 'def'", Boolean.TRUE); } /** * test some simple double array lookups */ public void testDoubleArrays() throws Exception { JexlContext jc = JexlHelper.createContext(); Object[][] foo = new Object[2][2]; foo[0][0] = "one"; foo[0][1] = "two"; jc.getVars().put("foo", foo ); assertExpression(jc, "foo[0][1]", "two"); } /** * test variables with underscore names */ public void testVariableNames() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo_bar", "123" ); assertExpression(jc, "foo_bar", "123"); } /** * test the use of dot notation to lookup map entries */ public void testMapDot() throws Exception { Map foo = new HashMap(); foo.put( "bar", "123" ); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", foo ); assertExpression(jc, "foo.bar", "123"); } /** * Tests string literals */ public void testStringLiterals() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", "bar" ); assertExpression(jc, "foo == \"bar\"", Boolean.TRUE); assertExpression(jc, "foo == 'bar'", Boolean.TRUE); } /** * test the use of an int based property */ public void testIntProperty() throws Exception { Foo foo = new Foo(); // lets check the square function first.. assertEquals(4, foo.square(2)); assertEquals(4, foo.square(-2)); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", foo ); assertExpression(jc, "foo.count", new Integer(5)); assertExpression(jc, "foo.square(2)", new Integer(4)); assertExpression(jc, "foo.square(-2)", new Integer(4)); } /** * test the -1 comparison bug */ public void testNegativeIntComparison() throws Exception { JexlContext jc = JexlHelper.createContext(); Foo foo = new Foo(); jc.getVars().put("foo", foo ); assertExpression(jc, "foo.count != -1", Boolean.TRUE); assertExpression(jc, "foo.count == 5", Boolean.TRUE); assertExpression(jc, "foo.count == -1", Boolean.FALSE); } public void testArrayProperty() throws Exception { Foo foo = new Foo(); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", foo ); assertExpression(jc, "foo.array[1]", GET_METHOD_ARRAY[1]); assertExpression(jc, "foo.array.1", GET_METHOD_ARRAY[1]); assertExpression(jc, "foo.array2[1][1]", GET_METHOD_ARRAY2[1][1]); //assertExpression(jc, "foo.array2.1.1", GET_METHOD_ARRAY2[1][1]); } /** * Attempts to recreate bug http://jira.werken.com/ViewIssue.jspa?key=JELLY-8 */ public void testCharAtBug() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", "abcdef"); assertExpression(jc, "foo.substring(2,4)", "cd"); assertExpression(jc, "foo.charAt(2)", new Character('c')); try { assertExpression(jc, "foo.charAt(-2)", null); fail("this test should have thrown an exception" ); } catch (IndexOutOfBoundsException e) { // expected behaviour } catch (Exception e) { throw e; } } public void testEmptyDottedVariableName() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put( "this.is.a.test", ""); assertExpression(jc, "empty(this.is.a.test)", Boolean.TRUE); } public void testEmptySubListOfMap() throws Exception { JexlContext jc = JexlHelper.createContext(); Map m = new HashMap(); m.put("aList", new ArrayList()); jc.getVars().put( "aMap", m ); assertExpression( jc, "empty( aMap.aList )", Boolean.TRUE ); } public void testCoercionWithComparisionOperators() throws Exception { JexlContext jc = JexlHelper.createContext(); assertExpression(jc, "'2' > 1", Boolean.TRUE); assertExpression(jc, "'2' >= 1", Boolean.TRUE); assertExpression(jc, "'2' >= 2", Boolean.TRUE); assertExpression(jc, "'2' < 1", Boolean.FALSE); assertExpression(jc, "'2' <= 1", Boolean.FALSE); assertExpression(jc, "'2' <= 2", Boolean.TRUE); assertExpression(jc, "2 > '1'", Boolean.TRUE); assertExpression(jc, "2 >= '1'", Boolean.TRUE); assertExpression(jc, "2 >= '2'", Boolean.TRUE); assertExpression(jc, "2 < '1'", Boolean.FALSE); assertExpression(jc, "2 <= '1'", Boolean.FALSE); assertExpression(jc, "2 <= '2'", Boolean.TRUE); } public void testResolver() throws Exception { /* * first, a simple override */ Expression expr = ExpressionFactory.createExpression("foo.bar"); expr.addPreResolver(new FlatResolver()); JexlContext jc = JexlHelper.createContext(); Foo foo = new Foo(); jc.getVars().put("foo.bar", "flat value"); jc.getVars().put("foo", foo ); Object o = expr.evaluate(jc); assertEquals("flat override", "flat value", o); /* * now, let the resolver not find it and have it drop to jexl */ expr = ExpressionFactory.createExpression("foo.bar.length()"); expr.addPreResolver(new FlatResolver()); o = expr.evaluate(jc); assertEquals("flat override 1", new Integer(GET_METHOD_STRING.length()), o); /* * now, let the resolver not find it and NOT drop to jexl */ expr = ExpressionFactory.createExpression("foo.bar.length()"); expr.addPreResolver(new FlatResolver(false)); o = expr.evaluate(jc); assertEquals("flat override 2", o, null); // now for a post resolver expr = ExpressionFactory.createExpression("foo.bar.baz"); Long result = new Long(1); jc.getVars().put("foo.bar.baz", result); expr.addPostResolver(new FlatResolver()); assertEquals("flat override", result, expr.evaluate(jc)); } /** * Test that 'and' only evaluates the second item if needed * @throws Exception if there are errors */ public void testBooleanShortCircuitAnd() throws Exception { // handle false for the left arg of 'and' Foo tester = new Foo(); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("first", Boolean.FALSE); jc.getVars().put("foo", tester); Expression expr = ExpressionFactory.createExpression("first and foo.trueAndModify"); expr.evaluate(jc); assertTrue("Short circuit failure: rhs evaluated when lhs FALSE", !tester.getModified()); // handle true for the left arg of 'and' tester = new Foo(); jc.getVars().put("first", Boolean.TRUE); jc.getVars().put("foo", tester); expr.evaluate(jc); assertTrue("Short circuit failure: rhs not evaluated when lhs TRUE", tester.getModified()); } /** * Test that 'or' only evaluates the second item if needed * @throws Exception if there are errors */ public void testBooleanShortCircuitOr() throws Exception { // handle false for the left arg of 'or' Foo tester = new Foo(); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("first", Boolean.FALSE); jc.getVars().put("foo", tester); Expression expr = ExpressionFactory.createExpression("first or foo.trueAndModify"); expr.evaluate(jc); assertTrue("Short circuit failure: rhs not evaluated when lhs FALSE", tester.getModified()); // handle true for the left arg of 'or' tester = new Foo(); jc.getVars().put("first", Boolean.TRUE); jc.getVars().put("foo", tester); expr.evaluate(jc); assertTrue("Short circuit failure: rhs evaluated when lhs TRUE", !tester.getModified()); } /** * Simple test of '+' as a string concatenation operator * @throws Exception */ public void testStringConcatenation() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("first", "Hello"); jc.getVars().put("second", "World"); assertExpression(jc, "first + ' ' + second", "Hello World"); } /** * Ensures static methods on objects can be called. */ public void testStaticMethodInvocation() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("aBool", Boolean.FALSE); assertExpression(jc, "aBool.valueOf('true')", Boolean.TRUE); } public void testStaticMethodInvocationOnClasses() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("Boolean", Boolean.class); assertExpression(jc, "Boolean.valueOf('true')", Boolean.TRUE); } public void testToString() throws Exception { String code = "abcd"; Expression expr = ExpressionFactory.createExpression(code); assertEquals("Bad expression value", code, expr.toString()); } /** * Make sure bad syntax throws ParseException * @throws Exception on errors */ public void testBadParse() throws Exception { try { assertExpression(JexlHelper.createContext(), "empty()", null); fail("Bad expression didn't throw ParseException"); } catch (ParseException pe) { // expected behaviour } } /** * Test the ## comment in a string * @throws Exception */ public void testComment() throws Exception { assertExpression(JexlHelper.createContext(), "## double or nothing\n 1 + 1", Long.valueOf("2")); } /** * Test assignment. * @throws Exception */ public void testAssignment() throws Exception { JexlContext jc = JexlHelper.createContext(); jc.getVars().put("aString", "Hello"); Foo foo = new Foo(); jc.getVars().put("foo", foo); Parser parser = new Parser(new StringReader(";")); parser.parse(new StringReader("aString = 'World';")); assertExpression(jc, "hello = 'world'", "world"); assertEquals("hello variable not changed", "world", jc.getVars().get("hello")); assertExpression(jc, "result = 1 + 1", new Long(2)); assertEquals("result variable not changed", new Long(2), jc.getVars().get("result")); // todo: make sure properties can be assigned to, fall back to flat var if no property // assertExpression(jc, "foo.property1 = '99'", "99"); // assertEquals("property not set", "99", foo.getProperty1()); } public void testAntPropertiesWithMethods() throws Exception { JexlContext jc = JexlHelper.createContext(); String value = "Stinky Cheese"; jc.getVars().put("maven.bob.food", value); assertExpression(jc, "maven.bob.food.length()", new Integer(value.length())); assertExpression(jc, "empty(maven.bob.food)", Boolean.FALSE); assertExpression(jc, "size(maven.bob.food)", new Integer(value.length())); assertExpression(jc, "maven.bob.food + ' is good'", value + " is good"); // DG: Note the following ant properties don't work // String version = "1.0.3"; // jc.getVars().put("commons-logging", version); // assertExpression(jc, "commons-logging", version); } public void testUnicodeSupport() throws Exception { assertExpression(JexlHelper.createContext(), "myvar == 'Użytkownik'", Boolean.FALSE); } /** * Asserts that the given expression returns the given value when applied to the * given context */ protected void assertExpression(JexlContext jc, String expression, Object expected) throws Exception { Expression e = ExpressionFactory.createExpression(expression); Object actual = e.evaluate(jc); assertEquals(expression, expected, actual); } /** * Helps in debugging the testcases when working with it * */ public static void main(String[] args) throws Exception { JexlTest jt = new JexlTest("foo"); jt.testEmpty(); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/ForEachTest.java0000664000175000017500000001250011671435474031646 0ustar jamespagejamespage/* * 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.jexl; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.util.StringTokenizer; import junit.framework.TestCase; /** * Tests for the foreach statement * @author Dion Gillard * @since 1.1 */ public class ForEachTest extends TestCase { /** create a named test */ public ForEachTest(String name) { super(name); } public void testForEachWithEmptyStatement() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) ;"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertNull("Result is not null", o); } public void testForEachWithEmptyList() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) 1+1"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertNull("Result is not null", o); } public void testForEachWithArray() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) item"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("list", new Object[] {"Hello", "World"}); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", "World", o); } public void testForEachWithCollection() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) item"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("list", Arrays.asList(new Object[] {"Hello", "World"})); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", "World", o); } public void testForEachWithEnumeration() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) item"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("list", new StringTokenizer("Hello,World", ",")); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", "World", o); } public void testForEachWithIterator() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) item"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("list", Arrays.asList(new Object[] {"Hello", "World"}).iterator()); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", "World", o); } public void testForEachWithMap() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) item"); JexlContext jc = JexlHelper.createContext(); Map map = System.getProperties(); String lastProperty = (String) new ArrayList(map.values()).get(System.getProperties().size() - 1); jc.getVars().put("list", map); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", lastProperty, o); } public void testForEachWithBlock() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list) { x = x + item; }"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("list", new Object[] {"1", "1"}); jc.getVars().put("x", new Integer(0)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(2), o); assertEquals("x is wrong", new Long(2), jc.getVars().get("x")); } public void testForEachWithListExpression() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list.keySet()) item"); JexlContext jc = JexlHelper.createContext(); Map map = System.getProperties(); String lastKey = (String) new ArrayList(map.keySet()).get(System.getProperties().size() - 1); jc.getVars().put("list", map); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", lastKey, o); } public void testForEachWithProperty() throws Exception { Expression e = ExpressionFactory.createExpression("foreach (item in list.cheeseList) item"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("list", new Foo()); Object o = e.evaluate(jc); assertEquals("Result is not last evaluated expression", "brie", o); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/BitwiseOperatorTest.java0000664000175000017500000002003311671435474033461 0ustar jamespagejamespage/* * 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.jexl; import junit.framework.TestCase; /** * Tests for the bitwise operators. * @author Dion Gillard * @since 1.1 */ public class BitwiseOperatorTest extends TestCase { /** * Create the named test. * @param name test name */ public BitwiseOperatorTest(String name) { super(name); } public void testAndWithTwoNulls() throws Exception { Expression e = ExpressionFactory.createExpression("null & null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(0), o); } public void testAndWithLeftNull() throws Exception { Expression e = ExpressionFactory.createExpression("null & 1"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(0), o); } public void testAndWithRightNull() throws Exception { Expression e = ExpressionFactory.createExpression("1 & null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(0), o); } public void testAndSimple() throws Exception { Expression e = ExpressionFactory.createExpression("15 & 3"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(3), o); } public void testAndVariableNumberCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("x & y"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(15)); jc.getVars().put("y", new Short((short)7)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(7), o); } public void testAndVariableStringCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("x & y"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(15)); jc.getVars().put("y", "7"); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(7), o); } public void testComplementWithNull() throws Exception { Expression e = ExpressionFactory.createExpression("~null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(-1), o); } public void testComplementSimple() throws Exception { Expression e = ExpressionFactory.createExpression("~128"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(-129), o); } public void testComplementVariableNumberCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("~x"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(15)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(-16), o); } public void testComplementVariableStringCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("~x"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", "15"); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(-16), o); } public void testOrWithTwoNulls() throws Exception { Expression e = ExpressionFactory.createExpression("null | null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(0), o); } public void testOrWithLeftNull() throws Exception { Expression e = ExpressionFactory.createExpression("null | 1"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(1), o); } public void testOrWithRightNull() throws Exception { Expression e = ExpressionFactory.createExpression("1 | null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(1), o); } public void testOrSimple() throws Exception { Expression e = ExpressionFactory.createExpression("12 | 3"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(15), o); } public void testOrVariableNumberCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("x | y"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(12)); jc.getVars().put("y", new Short((short) 3)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(15), o); } public void testOrVariableStringCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("x | y"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(12)); jc.getVars().put("y", "3"); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(15), o); } public void testXorWithTwoNulls() throws Exception { Expression e = ExpressionFactory.createExpression("null ^ null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(0), o); } public void testXorWithLeftNull() throws Exception { Expression e = ExpressionFactory.createExpression("null ^ 1"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(1), o); } public void testXorWithRightNull() throws Exception { Expression e = ExpressionFactory.createExpression("1 ^ null"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(1), o); } public void testXorSimple() throws Exception { Expression e = ExpressionFactory.createExpression("1 ^ 3"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(2), o); } public void testXorVariableNumberCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("x ^ y"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(1)); jc.getVars().put("y", new Short((short) 3)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(2), o); } public void testXorVariableStringCoercion() throws Exception { Expression e = ExpressionFactory.createExpression("x ^ y"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(1)); jc.getVars().put("y", "3"); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(2), o); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/ArrayLiteralTest.java0000664000175000017500000000523411671435474032740 0ustar jamespagejamespage/* * 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.jexl; import java.util.Arrays; import junit.framework.TestCase; /** * Tests Array map literals * * @author Peter Royal * @since 1.2 */ public class ArrayLiteralTest extends TestCase { public void testLiteralWithStrings() throws Exception { Expression e = ExpressionFactory.createExpression( "[ 'foo', 'bar' ]" ); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate( jc ); assertNotNull( o ); assertTrue( o.getClass().isArray() ); assertArrayEquals( new Object[]{ "foo", "bar" }, (Object[]) o ); } private void assertArrayEquals( Object[] expected, Object[] actual ) { assertTrue( "expected:" + Arrays.asList( expected ) + " but was:" + Arrays.asList( actual ), Arrays.equals( expected, actual ) ); } public void testLiteralWithNumbers() throws Exception { Expression e = ExpressionFactory.createExpression( "[ 5, 10 ]" ); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate( jc ); assertNotNull( o ); assertTrue( o.getClass().isArray() ); assertArrayEquals( new Object[]{ new Integer( 5 ), new Integer( 10 ) }, (Object[]) o ); } public void testSizeOfSimpleArrayLiteral() throws Exception { Expression e = ExpressionFactory.createExpression( "size([ 'foo' ])" ); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate( jc ); assertEquals( new Integer( 1 ), o ); } public void testNotEmptySimpleMapLiteral() throws Exception { Expression e = ExpressionFactory.createExpression( "empty([ 'foo' ])" ); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate( jc ); assertFalse( ( (Boolean) o ).booleanValue() ); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/MapLiteralTest.java0000664000175000017500000000607311671435474032401 0ustar jamespagejamespage/* * 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.jexl; import java.util.Collections; import java.util.HashMap; import java.util.Map; import junit.framework.TestCase; /** * Tests for map literals * * @author Peter Royal * @since 1.2 */ public class MapLiteralTest extends TestCase { public void testLiteralWithStrings() throws Exception { Expression e = ExpressionFactory.createExpression( "[ 'foo' => 'bar' ]" ); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate( jc ); assertEquals( Collections.singletonMap( "foo", "bar" ), o ); } public void testLiteralWithMultipleEntries() throws Exception { Expression e = ExpressionFactory.createExpression( "[ 'foo' => 'bar', 'eat' => 'food' ]" ); JexlContext jc = JexlHelper.createContext(); Map expected = new HashMap(); expected.put( "foo", "bar" ); expected.put( "eat", "food" ); Object o = e.evaluate( jc ); assertEquals( expected, o ); } public void testLiteralWithNumbers() throws Exception { Expression e = ExpressionFactory.createExpression( "[ 5 => 10 ]" ); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate( jc ); assertEquals( Collections.singletonMap( new Integer( 5 ), new Integer( 10 ) ), o ); } public void testSizeOfSimpleMapLiteral() throws Exception { Expression e = ExpressionFactory.createExpression( "size([ 'foo' => 'bar' ])" ); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate( jc ); assertEquals( new Integer( 1 ), o ); } public void testCallingMethodsOnNewMapLiteral() throws Exception { Expression e = ExpressionFactory.createExpression( "size([ 'foo' => 'bar' ].values())" ); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate( jc ); assertEquals( new Integer( 1 ), o ); } public void testNotEmptySimpleMapLiteral() throws Exception { Expression e = ExpressionFactory.createExpression( "empty([ 'foo' => 'bar' ])" ); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate( jc ); assertFalse( ( (Boolean) o ).booleanValue() ); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/WhileTest.java0000664000175000017500000000442611671435474031417 0ustar jamespagejamespage/* * 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.jexl; import junit.framework.TestCase; /** * Tests for while statement. * @author Dion Gillard * @since 1.1 */ public class WhileTest extends TestCase { public WhileTest(String testName) { super(testName); } public void testSimpleWhileFalse() throws Exception { Expression e = ExpressionFactory.createExpression("while (false) ;"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertNull("Result is not null", o); } public void testWhileExecutesExpressionWhenLooping() throws Exception { Expression e = ExpressionFactory.createExpression("while (x < 10) x = x + 1;"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(1)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(10), o); } public void testWhileWithBlock() throws Exception { Expression e = ExpressionFactory.createExpression("while (x < 10) { x = x + 1; y = y * 2; }"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(1)); jc.getVars().put("y", new Integer(1)); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Long(512), o); assertEquals("x is wrong", new Long(10), jc.getVars().get("x")); assertEquals("y is wrong", new Long(512), jc.getVars().get("y")); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/ParseFailuresTest.java0000664000175000017500000000710611671435474033112 0ustar jamespagejamespage/** * 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.jexl; import junit.framework.TestCase; import org.apache.commons.jexl.parser.ParseException; /** * Tests for malformed expressions and scripts. * ({@link ExpressionFactory} and {@link ScriptFactory} should throw * {@link ParseException}s). * * @since 1.1 */ public class ParseFailuresTest extends TestCase { /** * Create the test. * * @param testName name of the test */ public ParseFailuresTest(String testName) { super(testName); } public void testMalformedExpression1() throws Exception { // this will throw a ParseException String badExpression = "eq"; try { ExpressionFactory.createExpression(badExpression); fail("Parsing \"" + badExpression + "\" should result in a ParseException"); } catch (ParseException pe) { // expected } } public void testMalformedExpression2() throws Exception { // this will throw a TokenMgrErr, which we rethrow as a ParseException String badExpression = "?"; try { ExpressionFactory.createExpression(badExpression); fail("Parsing \"" + badExpression + "\" should result in a ParseException"); } catch (ParseException pe) { // expected } catch (JexlException pe) { // expected } } public void testMalformedScript1() throws Exception { // this will throw a TokenMgrErr, which we rethrow as a ParseException String badScript = "eq"; try { ScriptFactory.createScript(badScript); fail("Parsing \"" + badScript + "\" should result in a ParseException"); } catch (ParseException pe) { // expected } } public void testMalformedScript2() throws Exception { // this will throw a TokenMgrErr, which we rethrow as a ParseException String badScript = "?"; try { ScriptFactory.createScript(badScript); fail("Parsing \"" + badScript + "\" should result in a ParseException"); } catch (ParseException pe) { // expected } } // KOHSUKE - Elvis operator is now supported // public void testMalformedScript3() throws Exception { // // this will throw a TokenMgrErr, which we rethrow as a ParseException // String badScript = "foo=1;bar=2;a?b:c;"; // try { // ScriptFactory.createScript(badScript); // fail("Parsing \"" + badScript // + "\" should result in a ParseException"); // } catch (ParseException pe) { // // expected // } // } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/BlockTest.java0000664000175000017500000000640211671435474031375 0ustar jamespagejamespage/* * 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.jexl; import junit.framework.TestCase; /** * Tests for blocks * @since 1.1 */ public class BlockTest extends TestCase { /** * Create the test * * @param testName name of the test */ public BlockTest(String testName) { super(testName); } public void testBlockSimple() throws Exception { Expression e = ExpressionFactory .createExpression("if (true) { 'hello'; }"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", "hello", o); } public void testBlockExecutesAll() throws Exception { Expression e = ExpressionFactory .createExpression("if (true) { x = 'Hello'; y = 'World';}"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("First result is wrong", "Hello", jc.getVars().get("x")); assertEquals("Second result is wrong", "World", jc.getVars().get("y")); assertEquals("Block result is wrong", "World", o); } public void testEmptyBlock() throws Exception { Expression e = ExpressionFactory .createExpression("if (true) { }"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertNull("Result is wrong", o); } public void testBlockLastExecuted01() throws Exception { Expression e = ExpressionFactory .createExpression("if (true) { x = 1; } else { x = 2; }"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Block result is wrong", new Integer(1), o); } public void testBlockLastExecuted02() throws Exception { Expression e = ExpressionFactory .createExpression("if (false) { x = 1; } else { x = 2; }"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Block result is wrong", new Integer(2), o); } public void testNestedBlock() throws Exception { Expression e = ExpressionFactory .createExpression("if (true) { x = 'hello'; y = 'world';" + " if (true) { x; } y; }"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Block result is wrong", "world", o); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/Jexl.java0000664000175000017500000000313111671435474030401 0ustar jamespagejamespage/* * 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.jexl; import java.util.Map; /** * @author Dion Gillard * @since 1.0 * Command line interface for Jexl for use in testing */ public class Jexl { public static void main(String[] args) { // dummy context to get variables JexlContext context = new JexlContext() { public Map getVars() { return System.getProperties(); } public void setVars(Map map) { } }; try { for (int i = 0; i < args.length; i++) { Expression e = ExpressionFactory.createExpression(args[i]); System.out.println("evaluate(" + args[i] + ") = '" + e.evaluate(context) + "'"); } } catch (Exception e) { e.printStackTrace(); } } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/junit/0000775000175000017500000000000011671435474027767 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/junit/AsserterTest.java0000664000175000017500000000533411671435474033267 0ustar jamespagejamespage/* * 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.jexl.junit; import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.apache.commons.jexl.Foo; /** * Simple testcases * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: AsserterTest.java 480412 2006-11-29 05:11:23Z bayard $ */ public class AsserterTest extends TestCase { public static Test suite() { return new TestSuite(AsserterTest.class); } public static void main(String[] args) { TestRunner.run(suite()); } public AsserterTest(String testName) { super(testName); } public void testThis() throws Exception { Asserter asserter = new Asserter(new Foo()); asserter.assertExpression("this.get('abc')", "Repeat : abc"); try { asserter.assertExpression("this.count", "Wrong Value"); fail("This method should have thrown an assertion exception"); } catch (AssertionFailedError e) { // it worked! } } public void testVariable() throws Exception { Asserter asserter = new Asserter(); asserter.setVariable("foo", new Foo()); asserter.setVariable("person", "James"); asserter.assertExpression("person", "James"); asserter.assertExpression("size(person)", new Integer(5)); asserter.assertExpression("foo.getCount()", new Integer(5)); asserter.assertExpression("foo.count", new Integer(5)); try { asserter.assertExpression("bar.count", new Integer(5)); fail("This method should have thrown an assertion exception"); } catch (AssertionFailedError e) { // it worked! } } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/ScriptFactoryTest.java0000664000175000017500000000741711671435474033146 0ustar jamespagejamespage/* * 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.jexl; import java.io.File; import java.net.URL; import junit.framework.TestCase; /** * Tests for ScriptFactory * @since 1.1 */ public class ScriptFactoryTest extends TestCase { /** * Creates a new test case. * @param name the test case name. */ public ScriptFactoryTest(String name) { super(name); } /** * Ensure the factory can create a script from a String * @throws Exception on a parse error */ public void testCreateFromString() throws Exception { String code = ";"; assertNotNull("No script created", ScriptFactory.createScript(code)); } /** * Ensure the factory can create a script from a String * @throws Exception on a parse error */ public void testCreateFromSimpleString() throws Exception { String code = "(1 + 2) * 4"; assertNotNull("No script created", ScriptFactory.createScript(code)); } /** * Ensure the factory throws an NPE on an null String * @throws Exception on a parse error */ public void testCreateFromNullString() throws Exception { String code = null; try { assertNotNull("No script created", ScriptFactory.createScript(code)); fail("Null script created"); } catch (NullPointerException e) { // expected } } /** * Ensure the factory can create a script from a file. * @throws Exception on a parse error. */ public void testCreateFromFile() throws Exception { File testScript = new File("src/test-scripts/test1.jexl"); assertNotNull("No script created", ScriptFactory.createScript(testScript)); } /** * Ensure the factory throws npe on a null file. * @throws Exception on a parse error. */ public void testCreateFromNullFile() throws Exception { File testScript = null; try { assertNotNull("No script created", ScriptFactory.createScript(testScript)); fail("Null script created"); } catch (NullPointerException e) { // expected } } /** * Ensure the factory can create a script from a URL. * @throws Exception on a parse error. */ public void testCreateFromURL() throws Exception { URL testUrl = new File("src/test-scripts/test1.jexl").toURL(); assertNotNull("No script created", ScriptFactory.createScript(testUrl)); } /** * Ensure the factory throws an NPE on an null URL * @throws Exception on a parse error */ public void testCreateFromNullURL() throws Exception { URL code = null; try { assertNotNull("No script created", ScriptFactory.createScript(code)); fail("Null script created"); } catch (NullPointerException e) { // expected } } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/ElvisTest.java0000664000175000017500000000223211671435474031422 0ustar jamespagejamespagepackage org.apache.commons.jexl; import junit.framework.TestCase; /** * @author Kohsuke Kawaguchi */ public class ElvisTest extends TestCase { public void testTernary1() throws Exception { Expression e = ExpressionFactory.createExpression("true?1.0:2.0"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals(new Float(1.0f), o); } public void testTernary2() throws Exception { Expression e = ExpressionFactory.createExpression("false?1.0:2.0"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals(new Float(2.0f), o); } public void testElvis1() throws Exception { Expression e = ExpressionFactory.createExpression("1?:2"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals(new Integer(1), o); } public void testElvis2() throws Exception { Expression e = ExpressionFactory.createExpression("null?:2"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals(new Integer(2), o); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/Foo.java0000664000175000017500000000513211671435474030225 0ustar jamespagejamespage/* * 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.jexl; import java.util.ArrayList; import java.util.List; /** * A simple bean used for testing purposes * * @since 1.0 * @author Geir Magnusson Jr. * @version $Revision: 480412 $ */ public class Foo { private boolean beenModified = false; private String property1 = "some value"; public String bar() { return JexlTest.METHOD_STRING; } public String getBar() { return JexlTest.GET_METHOD_STRING; } public Foo getInnerFoo() { return new Foo(); } public String get(String arg) { return "Repeat : " + arg; } public String convertBoolean(boolean b) { return "Boolean : " + b; } public int getCount() { return 5; } public List getCheeseList() { ArrayList answer = new ArrayList(); answer.add("cheddar"); answer.add("edam"); answer.add("brie"); return answer; } public String[] getArray() { return JexlTest.GET_METHOD_ARRAY; } public String[][] getArray2() { return JexlTest.GET_METHOD_ARRAY2; } public boolean isSimple() { return true; } public int square(int value) { return value * value; } public boolean getTrueAndModify() { beenModified = true; return true; } public boolean getModified() { return beenModified; } public int getSize() { return 22; } public String getProperty1() { return property1; } public void setProperty1(String newValue) { property1 = newValue; } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/IfTest.java0000664000175000017500000001242411671435474030702 0ustar jamespagejamespage/* * 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.jexl; import junit.framework.TestCase; /** * Test cases for the if statement. * * @author Dion Gillard * @since 1.1 */ public class IfTest extends TestCase { public IfTest(String testName) { super(testName); } /** * Make sure if true executes the true statement * * @throws Exception on any error */ public void testSimpleIfTrue() throws Exception { Expression e = ExpressionFactory.createExpression("if (true) 1"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is not 1", new Integer(1), o); } /** * Make sure if false doesn't execute the true statement * * @throws Exception on any error */ public void testSimpleIfFalse() throws Exception { Expression e = ExpressionFactory.createExpression("if (false) 1"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertNull("Return value is not empty", o); } /** * Make sure if false executes the false statement * * @throws Exception on any error */ public void testSimpleElse() throws Exception { Expression e = ExpressionFactory .createExpression("if (false) 1; else 2;"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is not 2", new Integer(2), o); } /** * Test the if statement handles blocks correctly * * @throws Exception on any error */ public void testBlockIfTrue() throws Exception { Expression e = ExpressionFactory .createExpression("if (true) { 'hello'; }"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", "hello", o); } /** * Test the if statement handles blocks in the else statement correctly * * @throws Exception on any error */ public void testBlockElse() throws Exception { Expression e = ExpressionFactory .createExpression("if (false) {1;} else {2;}"); JexlContext jc = JexlHelper.createContext(); Object o = e.evaluate(jc); assertEquals("Result is wrong", new Integer(2), o); } /** * Test the if statement evaluates expressions correctly * * @throws Exception on any error */ public void testIfWithSimpleExpression() throws Exception { Expression e = ExpressionFactory .createExpression("if (x == 1) true;"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(1)); Object o = e.evaluate(jc); assertEquals("Result is not true", Boolean.TRUE, o); } /** * Test the if statement evaluates arithmetic expressions correctly * * @throws Exception on any error */ public void testIfWithArithmeticExpression() throws Exception { Expression e = ExpressionFactory .createExpression("if ((x * 2) + 1 == 5) true;"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Integer(2)); Object o = e.evaluate(jc); assertEquals("Result is not true", Boolean.TRUE, o); } /** * Test the if statement evaluates decimal arithmetic expressions correctly * * @throws Exception on any error */ public void testIfWithDecimalArithmeticExpression() throws Exception { Expression e = ExpressionFactory .createExpression("if ((x * 2) == 5) true;"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Float(2.5f)); Object o = e.evaluate(jc); assertEquals("Result is not true", Boolean.TRUE, o); } /** * Test the if statement works with assignment * * @throws Exception on any error */ public void testIfWithAssignment() throws Exception { Expression e = ExpressionFactory .createExpression("if ((x * 2) == 5) {y = 1;} else {y = 2;}"); JexlContext jc = JexlHelper.createContext(); jc.getVars().put("x", new Float(2.5f)); e.evaluate(jc); Object result = jc.getVars().get("y"); assertEquals("y has the wrong value", new Integer(1), result); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/parser/0000775000175000017500000000000011671435474030132 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/test/org/apache/commons/jexl/parser/ParserTest.java0000664000175000017500000000432311671435474033073 0ustar jamespagejamespage/* * 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.jexl.parser; import junit.framework.TestCase; import junit.framework.TestSuite; import junit.framework.Test; import java.io.StringReader; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.JexlHelper; /** * @since 1.0 * */ public class ParserTest extends TestCase { public static Test suite() { return new TestSuite(ParserTest.class); } public ParserTest(String testName) { super(testName); } /** * parse test : see if we can parse a little script */ public void testParse1() throws Exception { Parser parser = new Parser(new StringReader(";")); SimpleNode sn = parser.parse(new StringReader("foo = 1;")); JexlContext jc = JexlHelper.createContext(); sn.interpret(jc); } public void testParse2() throws Exception { Parser parser = new Parser(new StringReader(";")); JexlContext jc = JexlHelper.createContext(); SimpleNode sn = parser.parse(new StringReader("foo = \"bar\";")); sn.interpret(jc); sn = parser.parse(new StringReader("foo = 'bar';")); sn.interpret(jc); } public static void main(String[] args) throws Exception { ParserTest pt = new ParserTest("foo"); pt.testParse1(); } } jenkins-commons-jexl-1.1-jenkins-20111212/src/conf/0000775000175000017500000000000011671435474022157 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/src/conf/checkclipse-filter.properties0000664000175000017500000000370611671435474030043 0ustar jamespagejamespage# # 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. # file to specify filters # Files matching one of the given filters are excluded from style checking. # example usage: # - All leading and trailing whitespaces are ignored # - All lines starting with a '#' are comments. # - Regular expressions are Java RegExp-style. See java.util.regex.Pattern. # # Additional notes on Regular expressions: # # 1) Relative pathes (not starting with a '/') get the project location # prepended. Exp: "src/org/test" gets /Project/src/org/test" # 2) Regular Expressions must not use the start-of-line ('^') or the # end-of-line ('$') markers. (They are automatically inserted internally). # 3) Make sure to escape the escape character --> \\ # # The path passed to the filter can be found right-click on a file # -> properties -> Info -> File Path # e.g. /Checklipse/testsrc/testpackage/TestSrc.java # or testsrc/testpackage/TestSrc.java # src/java/org/apache/commons/jexl/parser/JJT.* src/java/org/apache/commons/jexl/parser/Parse.* src/java/org/apache/commons/jexl/parser/SimpleCharStream\.java src/java/org/apache/commons/jexl/parser/Token.* # ignore test code src/test/.* # ignore example code examples/.*\.java jenkins-commons-jexl-1.1-jenkins-20111212/src/conf/header.txt0000664000175000017500000000146111671435474024152 0ustar jamespagejamespage/* * 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. */jenkins-commons-jexl-1.1-jenkins-20111212/src/conf/checkstyle.properties0000664000175000017500000000163011671435474026433 0ustar jamespagejamespage# # 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. basedir=$SAMEDIR/../.. checkstyle.cache.file=$SAMEDIR/checkstyle.cache checkstyle.header.file=$SAMEDIR/header.txt jenkins-commons-jexl-1.1-jenkins-20111212/src/conf/MANIFEST.MF0000664000175000017500000000072711671435474023617 0ustar jamespagejamespageManifest-Version: 1.0 Ant-Version: Apache Ant 1.5.3 Package: org.apache.commons.jexl Extension-Name: commons-jexl Specification-Title: Commons JEXL Expression Language Engine Specification-Vendor: The Apache Software Foundation Implementation-Title: org.apache.commons.jexl Implementation-Vendor: The Apache Software Foundation Implementation-Version: 1.1.1-SNAPSHOT Implementation-Vendor-Id: org.apache X-Compile-Source-JDK: 1.2 X-Compile-Target-JDK: 1.2 jenkins-commons-jexl-1.1-jenkins-20111212/src/conf/checkstyle.xml0000664000175000017500000001775011671435474025051 0ustar jamespagejamespage jenkins-commons-jexl-1.1-jenkins-20111212/.project0000664000175000017500000000166111671435474022116 0ustar jamespagejamespage Jexl Jexl is an implementation of the JSTL Expression Language with extensions. org.eclipse.jdt.core.javabuilder com.ibm.sse.model.structuredbuilder de.tobject.findbugs.findbugsBuilder de.mvmsoft.checkclipse.CheckclipseBuilder de.mvmsoft.checkclipse.CheckclipseNature org.eclipse.jdt.core.javanature de.tobject.findbugs.findbugsNature jenkins-commons-jexl-1.1-jenkins-20111212/project.properties0000664000175000017500000000660711671435474024240 0ustar jamespagejamespage# 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. maven.repo.remote=http://repo1.maven.org/maven # uncomment the next line to work in offline mode (no jar download & no linkcheck) #maven.mode.online= maven.changelog.factory=org.apache.maven.svnlib.SvnChangeLogFactory maven.javadoc.author=false maven.javadoc.links=http://java.sun.com/j2se/1.4.2/docs/api,http://commons.apache.org/logging/apidocs # xdocs maven.xdoc.date=left maven.xdoc.poweredby.image=maven-feather.png maven.xdoc.version=${pom.currentVersion} maven.xdoc.developmentProcessUrl=http://commons.apache.org/charter.html maven.xdoc.distributionUrl=http://www.apache.org/dist/java-repository/commons-jexl/jars # Compile targets maven.compile.source=1.2 maven.compile.target=1.2 # for changes.xml maven.changes.issue.template=%URL%/browse/%ISSUE% # for compilation maven.compile.debug=on maven.compile.deprecation=on maven.compile.optimize=off # Jar Manifest Additional Attributes maven.jar.manifest.attributes.list=Extension-Name,Specification-Vendor,Specification-Version,Implementation-Vendor,Implementation-Vendor-Id,Implementation-Version,X-Compile-Source-JDK,X-Compile-Target-JDK maven.jar.manifest.attribute.Extension-Name=org.apache.commons.jexl maven.jar.manifest.attribute.Specification-Vendor=Apache Software Foundation maven.jar.manifest.attribute.Specification-Version=1.0 maven.jar.manifest.attribute.Implementation-Vendor=Apache Software Foundation maven.jar.manifest.attribute.Implementation-Vendor-Id=org.apache maven.jar.manifest.attribute.Implementation-Version=1.1-SNAPSHOT maven.jar.manifest.attribute.X-Compile-Source-JDK=${maven.compile.source} maven.jar.manifest.attribute.X-Compile-Target-JDK=${maven.compile.target} # tests maven.junit.fork=true maven.junit.sysproperties=org.xml.sax.driver org.xml.sax.driver=org.apache.xerces.parsers.SAXParser # clover code coverage clover.excludes=**/Test*.java maven.linkcheck.enable=false maven.pmd.rulesetfiles=\ rulesets/basic.xml,\ rulesets/unusedcode.xml,\ rulesets/imports.xml,\ rulesets/codesize.xml,\ rulesets/coupling.xml,\ rulesets/design.xml,\ rulesets/strings.xml maven.checkstyle.properties=${basedir}/src/conf/checkstyle.xml maven.checkstyle.excludes=org/apache/commons/jexl/parser/Parser*.java,\ org/apache/commons/jexl/parser/SimpleCharStream.java,\ org/apache/commons/jexl/parser/Token*.java,\ org/apache/commons/jexl/parser/JJTParserState.java maven.checkstyle.header.file=${basedir}/src/conf/header.txt # Source distro should unpack in a different directory (as against the binary distro) maven.dist.src.assembly.dir=${maven.dist.assembly.dir}/src/${maven.final.name}-src jenkins-commons-jexl-1.1-jenkins-20111212/build.properties.sample0000664000175000017500000000176111671435474025145 0ustar jamespagejamespage# 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. # The ant script is mostly self-sufficient as it fetches the # dependencies it needs. # # Commons JEXL dependency information is here: # # http://jakarta.apache.org/commons/jexl/dependencies.html jenkins-commons-jexl-1.1-jenkins-20111212/maven.xml0000664000175000017500000001151211671435474022273 0ustar jamespagejamespage jenkins-commons-jexl-1.1-jenkins-20111212/doap_jexl.rdf0000664000175000017500000000315011671435474023104 0ustar jamespagejamespage Apache Commons JEXL Java Commons JEXL Expression Language Engine Jexl is an implementation of the JSTL Expression Language with extensions. commons-jexl 2004-09-06 1.0 jenkins-commons-jexl-1.1-jenkins-20111212/RELEASE-NOTES.txt0000664000175000017500000000412111671435474023150 0ustar jamespagejamespage $Id: RELEASE-NOTES.txt 441680 2006-09-08 15:55:31 -0700 (Fri, 08 Sep 2006) rahul $ Commons JEXL Package Version 1.1 Release Notes INTRODUCTION: ============= Jexl is an Expression Language supporting most of the constructs in the JSTL Expression Language, along with some additional extensions. http://jakarta.apache.org/commons/jexl/ Changes in this version include: New Features: ============= o Added Script and ScriptFactory to allow scripts to be executed from text, files or a URL. o Added implementation for bitwise operators: and, complement, or, xor. o Added implementation for the foreach statement. o Added implementation for the while statement. o Added implementation for block statements, e.g. curly braces containing multiple statements. o Added implementation for the if statement. o [JEXL-4] Support assignment to variables. Thanks to Barry Lagerweij. Bugs fixed: =========== o [JEXL-17] Consistently throw ParseException in case of a parsing failure, not an Error. Thanks to Kohsuke Kawaguchi. o [JEXL-3] Allow for static methods to be called on classes and not just objects. Thanks to Guido Anzuoni. o [JEXL-6] Unary minus was only working for integer values. o [JEXL-5] 'abc'.substring(0,1+1) is empty (method matching problem). Other Changes: ============== o Add @since tags to code so we can track API additions via javadoc jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/0000775000175000017500000000000011671435474021563 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/xdocs/issue-tracking.xml0000664000175000017500000000727211671435474025245 0ustar jamespagejamespage Issue tracking Commons Documentation Team

Commons JEXL uses ASF JIRA for tracking issues. Issues for Commons JEXL are tracked at http://issues.apache.org/jira/browse/JEXL

To create a new issue you will need to sign up for a new account, unless you had previously used the Commons product in Bugzilla in which case your username is your email address and you will need to use the Forgot Password page to get a new password.

Bugs and enhancements should be filed under the "Commons JEXL" project in JIRA. If you would like to report a bug, or raise an enhancement request with Commons JEXL please do the following:

  1. Search existing bugs. If you find your issue listed then please add a comment with your details.
  2. Search the mailing list archive. You may find your issue or idea has already been discussed.
  3. Decide if your issue is a bug or an enhancement.
  4. Submit either a bug report or enhancement request.

Please also remember these points:

  • The more information you provide, the better we can help you
  • Test cases are vital, particularly for any proposed enhancements
  • Patches containing new files must contain the ASL v2.0 header at the top of every new file
  • A test class for Foo.java must be named FooTest.java

You may also find these links useful:

jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/cvs-usage.xml0000664000175000017500000000326511671435474024210 0ustar jamespagejamespage Source repository Commons Documentation Team

Apache Commons JEXL is hosted on the Apache subversion repository.

The project URL is:
http://svn.apache.org/repos/asf/commons/proper/jexl/trunk

The best way to view the repository is via the subversion viewer.

The alternative is to use the native subversion display.

jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/style/0000775000175000017500000000000011671435474022723 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/xdocs/style/tigris.css0000664000175000017500000002732411671435474024746 0ustar jamespagejamespage/* $Id: tigris.css 155421 2005-02-26 13:07:10Z dirkv $ This file defines basic default formatting for HTML conforming to Tigris application style. To extend or override these rules for your instance, edit inst.css instead of this file. */ /* colors, backgrounds, borders, link indication */ body { background: #fff; color: #000; } .app h3, .app h4, .tabs td, .tabs th, .functnbar { background-image: url(../images/nw_maj_rond.gif); background-repeat: no-repeat; } .functnbar, .functnbar2 { background-color: #aaa; } .functnbar2, .functnbar3 { background-color: #aaa; background-image: url(../images/sw_maj_rond.gif); background-repeat: no-repeat; background-position: bottom left; } .functnbar3 { background-color: #ddd; background-image: url(../images/sw_med_rond.gif); } .functnbar, .functnbar2, .functnbar3 { color: #000; } .functnbar a, .functnbar2 a, .functnbar3 a { color: #000; text-decoration: underline; } #navcolumn .body div, body.docs #toc li li { background-image: url(../images/strich.gif); background-repeat: no-repeat; background-position: .5em .5em; } #searchbox .body div, #navcolumn .body .heading { background-image: none; } a:link, #navcolumn a:visited, .app a:visited, .tasknav a:visited { color: blue; } a:link.selfref, a:visited.selfref { color: #555 !important; text-decoration: none; } a:active, a:hover, #leftcol a:active, #leftcol a:hover { color: #f30 !important; } #leftcol a, #breadcrumbs a { text-decoration: none; } .app h3, .app h4 { color: #fff; } .app h3 { background-color: #333; } .app h3 a:link, .app h3 a:visited, .app h4 a:link, .app h4 a:visited { color: #fff !important; text-decoration: underline; } .app h4 { background-color: #888; } .a td { background: #ddd; } .b td { background: #efefef; } table, th, td { border: none; } div.colbar { background: #eee; border-color: #999 #EEE #EEE #999; border-width: 1px; border-style: solid; } .toolgroup { background: #efefef; } .toolgroup .label { border-bottom: 1px solid #666; border-right: 1px solid #666; background: #ddd; color: #555; } .toolgroup .body { border-right: 1px solid #aaa; border-bottom: 1px solid #aaa; } #breadcrumbs { border-top: 1px solid #fff; background-color: #ccc; } #main { border-top: 1px solid #999; } #rightcol div.www, #rightcol div.help { border: 1px solid #ddd; } body.docs div.docs { background-color: #fff; border-left: 1px solid #ddd; border-top: 1px solid #ddd; } #helptext .label { background-image: url(../images/icon_help_sml.gif); background-repeat: no-repeat; background-position: 97%; } body.docs { background: #eee url(../images/help_logo.gif) top right no-repeat !important; } .docs h3, .docs h4 { border-top: solid 1px #000; } #apphead h2 em { color: #777; } .app th { background-color: #bbb; } .tabs th { border-right: 1px solid #333; background-color: #ddd; color: #fff; border-left: 1px solid #fff; } .tabs td { background-color: #999; border-bottom: 1px solid #fff; border-right: 1px solid #fff; border-left: 1px solid #fff; } .tabs { border-bottom: 6px #ddd solid; } .tabs th, .tabs th a:link, .tabs th a:visited { color: #555; } .tabs td, .tabs td a:link, .tabs td a:visited { color: #fff; } .tabs a { text-decoration: none; } .axial th { background-color: #ddd; color: black; } .alert { background-color: #ff9; } .expandedwaste { background: url(../images/icon_arrowwaste2_sml.gif) no-repeat; } .collapsedwaste { background: url(../images/icon_arrowwaste1_sml.gif) no-repeat; } .filebrowse .expanded, .filebrowse-alt .expanded { background-image: url(../images/icon_arrowfolderopen2_sml.gif); background-repeat: no-repeat; } .filebrowse .collapsed, .filebrowse-alt .collapsed { background-image: url(../images/icon_arrowfolderclosed1_sml.gif); background-repeat: no-repeat; } .filebrowse .leafnode, .filebrowse-alt .leafnode { background-image: url(../images/icon_folder_sml.gif); background-repeat: no-repeat; } .filebrowse .leaf, .filebrowse-alt .leaf { background-image: url(../images/icon_doc_sml.gif); background-repeat: no-repeat; } .sortup { background: url(../images/icon_sortup.gif) no-repeat; } .sortdown { background: url(../images/icon_sortdown.gif) no-repeat; } .collapsedwaste { background: url(../images/icon_arrowwaste1_sml.gif) no-repeat; } body .grid td { border-top: 1px solid #ccc; border-left: 1px solid #ccc; background-color: transparent; } .confirm { color: #090; } .info { color: #069; } .errormessage, .warningmessage, .donemessage, .infomessage { border-top: 5px solid #900; border-left: 1px solid #900; background-image: url(../images/icon_error_lrg.gif); background-repeat: no-repeat; background-position: 5px 1.33em; } .warningmessage { background-image: url(../images/icon_warning_lrg.gif); border-color: #c60; } .donemessage { background-image: url(../images/icon_success_lrg.gif); border-color: #090; } .infomessage { background-image: url(../images/icon_info_lrg.gif); border-color: #069; } .docinfo { background: url(../images/icon_doc_lrg.gif) no-repeat; } .dirinfo { background: url(../images/icon_folder_lrg.gif) no-repeat; } .memberinfo { background: url(../images/icon_members_lrg.gif) no-repeat; } .usergroupinfo { background: url(../images/icon_usergroups_lrg.gif) no-repeat; } .errormark, .warningmark, .donemark, .infomark { background: url(../images/icon_error_sml.gif) no-repeat; } .warningmark { background-image: url(../images/icon_warning_sml.gif); } .donemark { background-image: url(../images/icon_success_sml.gif); } .infomark { background-image: url(../images/icon_info_sml.gif); } .cvsdiff, .cvsblame { background-color: #ccc; } .cvsdiffadd { background-color: #afa; } .cvsdiffremove { background-color: #faa; } .cvsdiffchanges1 { background-color: #ff7; } .cvsdiffchanges2 { background-color: #ff7; } li.selection ul a { background: #fff; } .band1 { color: #fff; background-color: #663; } .band2 { color: #fff; background-color: #66C; } .band3 { background-color: #C99; } .band4 { background-color: #CFF; } .band5 { color: #fff; background-color: #336; } .band6 { color: #fff; background-color: #966; } .band7 { background-color: #9CC; } .band8 { background-color: #FFC; } .band9 { color: #fff; background-color: #633; } .band10 { color: #fff; background-color: #699; } .band11 { background-color: #CC9; } .band12 { background-color: #CCF; } .band13 { color: #fff; background-color: #366; } .band14 { color: #fff; background-color: #996; } .band15 { background-color: #99C; } .band16 { background-color: #FCC; } .app .helplink, #helptext .helplink { cursor: help; } .legend th, .bars th { background-color: #fff; } /* font and text properties, exclusive of link indication, alignment, text-indent */ body, th, td, input, select { font-family: Verdana, Helvetica, Arial, sans-serif; } code, pre { font-family: 'Andale Mono', Courier, monospace; } body, .app h3, .app h4, #rightcol h3, pre, code, #apphead h2 small, h4, th, td { font-size: x-small; voice-family: "\"}\""; voice-family: inherit; font-size: small; } small, div#footer, div#login, div.tabs th, div.tabs td, input, select, .paginate, .functnbar, .functnbar2, .functnbar3, #breadcrumbs, .courtesylinks, #rightcol div.help, .colbar, .tasknav, body.docs div#toc, #leftcol, .legend, .bars { font-size: xx-small; voice-family: "\"}\""; voice-family: inherit; font-size: x-small; } .tabs td, .tabs th, dt, .tasknav .selfref, #login .username, .selection { font-weight: bold; } li.selection ul { font-weight: normal; } #apphead h2 em { font-style: normal; } #banner h1 { font-size: 1.25em; } /* box properties (exclusive of borders), positioning, alignments, list types, text-indent */ #bodycol h2 { margin-top: .3em; margin-bottom: .5em; } p, ul, ol, dl, .bars table { margin-top: .67em; margin-bottom: .67em; } h3, h4 { margin-bottom: 0; } form { margin: 0; } #bodycol { padding-left: 12px; padding-right: 12px; width: 100%; voice-family: "\"}\""; voice-family: inherit; width: auto; } html>body #bodycol { width: auto; } .docs { line-height: 1.4; } ol ol { list-style-type: lower-alpha; } ol ol ol { list-style-type: lower-roman; } .app h3, .app h4 { padding: 5px; margin-right: 2px; margin-left: 2px; } .app td, .app th { padding: 2px 3px; } .h3 p, .h4 p, .h3 dt, .h4 dt { margin-right: 7px; margin-left: 7px; } .tasknav { margin-bottom: 1.33em; } div.colbar { padding: 3px; margin: 2px 2px 0; } .tabs { margin-top: .67em; margin-right: 2px; margin-left: 2px; padding-left: 8px; } .tabs td, .tabs th { padding: 3px 9px; } #rightcol div.www, #rightcol div.help { padding: 0 .5em; } body.docs #toc { position: absolute; top: 15px; left: 0px; width: 120px; padding: 0 20px 0 0; } body.docs #toc ul, #toc ol { margin-left: 0; padding-left: 0; } body.docs #toc li { margin-top: 7px; padding-left: 10px; list-style-type: none; } body.docs div.docs { margin: 61px 0 0 150px; padding: 1em 2em 1em 1em !important; } .docs p+p { text-indent: 5%; margin-top: -.67em; } .docs h3, .docs h4 { margin-bottom: .1em; padding-top: .3em; } .functnbar, .functnbar2, .functnbar3 { padding: 5px; margin: .67em 2px; } .functnbar3 { margin-top: 0; } body { padding: 1em; } body.composite, body.docs { margin: 0; padding: 0; } th, td { text-align: left; vertical-align: top; } .right { text-align: right !important; } .center { text-align: center !important; } .axial th, .axial th .strut { text-align: right; } .app .axial td th { text-align: left; } body .stb { margin-top: 1em; text-indent: 0; } body .mtb { margin-top: 2em; text-indent: 0; } .courtesylinks { margin-top: 1em; padding-top: 1em; } dd { margin-bottom: .67em; } .toolgroup { margin-bottom: 6px; } .toolgroup .body { padding: 4px 4px 4px 0; } .toolgroup .label { padding: 4px; } .toolgroup .body div { padding-bottom: .3em; padding-left: 1em; } .toolgroup .body div div { margin-top: .3em; padding-bottom: 0; } .tier1 { margin-left: 0; } .tier2 { margin-left: 1.5em; } .tier3 { margin-left: 3em; } .tier4 { margin-left: 4.5em; } .tier5 { margin-left: 6em; } .tier6 { margin-left: 7.5em; } .tier7 { margin-left: 9em; } .tier8 { margin-left: 10.5em; } .tier9 { margin-left: 12em; } .tier10 { margin-left: 13.5em; } .filebrowse .expanded, .filebrowse .collapsed { padding-left: 34px; } .filebrowse .leafnode, .filebrowse .leaf { padding-left: 20px; } .messagechild { padding-left: 34px; } .filebrowse-alt .expanded, .filebrowse-alt .collapsed, .filebrowse-alt .leaf, .filebrowse-alt .leafnode, .expandedwaste, .collapsedwaste, .sortup, .sortdown { /* hide from macie5\*/ float: left; /* resume */ display: inline-block; height: 15px; width: 34px; padding-left: 0 !important; } .filebrowse-alt .leaf, .filebrowse-alt .leafnode, .sortup, .sortdown { width: 20px; } .filebrowse ul, .filebrowse-alt ul { list-style-type: none; padding-left: 0; margin-left: 0; } .filebrowse ul ul, .filebrowse-alt ul ul { margin-left: 1.5em; margin-top: 0; padding-top: .67em; } .filebrowse li, .filebrowse-alt li { margin-bottom: .67em; } td.filebrowse h3 { margin-top: 0; } .errormessage, .warningmessage, .donemessage, .infomessage, .docinfo, .dirinfo, .memberinfo, .usergroupinfo { margin: .67em 0; padding: .33em 0 .67em 42px; min-height: 32px; } .errormark, .warningmark, .donemark, .infomark { padding-left: 20px; min-height: 15px; } .alt { display: none; } #banner h1 { margin: 0; } #leftcol { width: 14em; } .axial th, .axial th .strut, #leftcol .strut { width: 12em; } #breadcrumbs { padding: 2px 8px; } .app h3, .app h4, .bars { clear: both; } .legend { float: right; } .legend th, .bars th { text-align: right; padding-left: 1em; } .bars table { table-layout: fixed; } .bars th { width: 12em; } #projectdocumentlist td.filebrowse-alt { padding-right: .75em; } jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/style/maven.css0000664000175000017500000000317011671435474024544 0ustar jamespagejamespagebody { background: #fff; color: #000; } .app h3 { color: #fff; background-color: #036; } .app h4 { color: #fff; background-color: #888; } .a td { background: #ddd; color: #000; } .b td { background: #efefef; color: #000; } .app th { background-color: #bbb; color: #fff; } div#banner { border-top: 1px solid #369; border-bottom: 1px solid #003; } #banner, #banner td { background: #036; color: #fff; } #leftcol { background: #eee; color: #000; border-right: 1px solid #aaa; border-bottom: 1px solid #aaa; border-top: 1px solid #fff; } #navcolumn { background: #eee; color: #000; border-right: none; border-bottom: none; border-top: none; } #breadcrumbs { background-color: #ddd; color: #000; border-top: 1px solid #fff; border-bottom: 1px solid #aaa; } #source { background-color: #fff; color: #000; border-right: 1px solid #888; border-left: 1px solid #888; border-top: 1px solid #888; border-bottom: 1px solid #888; margin-right: 7px; margin-left: 7px; margin-top: 1em; } #source pre { margin-right: 7px; margin-left: 7px; } a[name]:hover, #leftcol a[name]:hover { color: inherit !important; } a:link, #breadcrumbs a:visited, #navcolumn a:visited, .app a:visited, .tasknav a:visited { color: blue; } a:active, a:hover, #leftcol a:active, #leftcol a:hover { color: #f30 !important; } a:link.selfref, a:visited.selfref { color: #555 !important; } h3, h4 { margin-top: 1em; margin-bottom: 0; } img.handle { border: 0; padding-right: 2px; } #navcolumn div div { background-image: none; background-repeat: no-repeat; } #navcolumn div div { padding-left: 10px; } jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/style/print.css0000664000175000017500000000025011671435474024566 0ustar jamespagejamespage#banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks { display: none; } body.docs div.docs { margin: 0 !important; border: none !important } jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/style/project.css0000664000175000017500000000010211671435474025074 0ustar jamespagejamespage@import url("http://commons.apache.org/style/commons-maven.css"); jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/releases.xml0000664000175000017500000000330211671435474024106 0ustar jamespagejamespage Downloads

Latest Stable Release

Nightly Builds

Archived Releases
Older releases are retained by the Apache Software Foundation but are moved into a special archive area.

jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/building.xml0000664000175000017500000000445711671435474024114 0ustar jamespagejamespage Building Commons JEXL Commons Documentation Team

Commons JEXL uses Maven or Ant as a build system. The source is here.

To build a jar file, change into JEXL's root directory (see source link above) and run "maven jar". The result will be in the "target" subdirectory.

To build the Javadocs, run "maven javadoc". The result will be in "target/docs/apidocs".

To build the full website, run "maven site". The result will be in "target/docs".

To build the site, you need Maven 1.0.2 and version 1.9.2 of the maven-xdoc-plugin installed.

To build a jar file, change into JEXL's root directory and run "ant jar". The result will be in the "target" subdirectory.

To build the Javadocs, run "ant javadoc". The result will be in "dist/docs".

jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/images/0000775000175000017500000000000011671435474023030 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/xdocs/images/jexl-logo-white.xcf0000664000175000017500000005002311671435474026550 0ustar jamespagejamespagegimp xcf fileæSBBK/ gimp-commentCreated with The GIMP¦¯å% N0>'jexlÿ     ˜$JO>'c>'s r r rüªU0ü8ª8þªÿÿþU-ú8ÆÿÿUÿþª+ýUâÿÿþUþâÿÿþ+üqÿÿþUûâÿª/ÿþU8ÿþU8ÿþU8ÿþU8ÿþU8ÿþUüqýUªªýq8þUUþ8UUÿþUúÿÿªùÿƪÆÿÿýÆüUÆÿÿýâUý8ªÿÿýÆUÿþUýÆÿÿþªûââ8ù8âÿÿâþªÿÿþªÿþUÿþUÿþªûâÿþÿÿþÆþâÿÿþüqÿUÿþUûÆÿÿªüÿþªÿÿþUþÿÿþâüâªÿþUûªÿÿªûÿÿ8þUÿÿþªþqÿÿþªý⪠ÿþUûªÿÿªüqÿÿUUþÿÿþªÿÿúqªâ ÿþUûªÿÿªþªÿ ÿýâÿÿüÆâ ÿþUûªÿÿªÿþ8ÿÿþU ÿþUûªÿÿªÿþqÿÿþª ÿþUûªÿÿªÿþ8þÿÿþU ÿþUûªÿÿªÿþqÆþâÿÿþ ÿþUûªÿÿªûâÿÿâ þ8ûªâÿÿþâ ÿþUûªÿÿªþªÿÿþqþÆùqÿqÿÿþªÿþUûªÿÿªþUÿÿþUýqüUÿUþªÿÿþUÿþUûªÿÿªþâÿÿþqüUÿüâqýâÿÿþÿþUûªÿÿªþUÿÿ÷âUUqÆÿâþUÿÿþÆÿþUûªÿÿªþUÿÿþªüªÿqþÆÿÿþþÿÿþqûªÿÿªþUÿÿþªùªÿÿªý8âÿÿýýªÿÿýâ8ûªÿÿªüÆÿÿýª8ªþ8þqªªü8qªªûªÿÿª8ûªÿÿ8ûªÿÿU8ûªÿÿ8üªÿÆ5þüâÿ85ùâUÿU6úÿâªâU7ªþU9\EDrop-Shadow#2Ì     ‘KY\EqÙ\E¹ÉR7þ2/üú þ ÷÷ ÷  ÷þê üõ õ ýè  üç  ûæ  úô õ û ç   ú õ !!ö ú õ  ""÷        ú ê  "##!  ü ûã !#$$# ýûë "%&&%" úúüê  $'))(&# ù "#$$ý#"!!"#ô"! ë #'*,,+*'%#!!ó#$&')*+,,+*)((ý)*++ø*)'&$"!  þ!ò  %*-00û.,*(''ø(*+-/0233ü20/..î/0123321/-+)'%$#$ë "(-1455420/..ø/124679::û987544û578:;;õ9752/-*('&ì %+159::98655ø689;<>?@@û?=<:99î:<>@ABBA?<952/,*(Æ  '.49=?@?>=<;;<=?@ABCDEEDCB@>=<<>@BEGHIHFC@<73/,+ì ")18=ADEDDCBBúCDEEFGGúFECA@>>î?BEHKMNNLIEA<72.,ð #+3:@EHIIHIJøIHGFDB@>>î@CFJMPRRQNJE@:50-ð $,5=<=?BFJORUVURNIC=72.ï %-6>EJNPQQRñSRQPNMKIGEC@><::î=@EJOSVXXURLF@940î %.7?FLPRSTTUVÞUTROMJGEB@=:8767:>BHMRVYYXTOIB<61Æ %.7@GMQSUVVWWXYYXVTPMJFC@=:754347;@FLQVXZYVQKE>83ê %.7@GMQTVWWXYZZÞYWUQMIEA>:74211248=CIOTWYYWSMGA:6Æ %.7@GMQTVWWXYZ[[ZYVRNIEA<9520../26;@FLQUWXWSOIC=8é %.7@GMQTUVWXYZ[[ßYWSOJE@<841.--.038=CINRUVUSOJD?:Æ %.7?FLPSTUUVWXZ[[YWTOKFA<730-,+,.26;@EJNQSSROKFA<Ú %-6?FKOQRRSSTVWYYXWTPKFA<830-++î-038EJMOOPÛRTUVVUSPKGB=830-+**,.148=ADHJLLJHEA=ð $-5=DHKLLKÚLMOQRSRQNJFA<73/,*))*+.148;?BDFGGEB?<ñ $,5@AAü?<:ì $,4;@DFFECA@@üBCEGGâEC?;73/+(&%$%&')*-/2479:;;:86Ù #+39>BCCA><:99:<=?@@?=:73/+'%#!!"ñ$%'(*-/1344321Ú #*17<964212356787530-)&# ð!"$&(*+,--,*Ø ")059;<:740-+**+,-.//-,)&# ÷ "$%%þ$ä "(.368752.*'$#"#$%&&õ%$" øþØ  &,03431-)%!öè $),//.+($ ÷   ÷ç "&)**)&#ú   û  ç "$%%$!  ù   æ  !   ç   ç  ç   ö ö &÷  õ 'ùö)üú+03i«  üþü ûùù  ö ø õ ø õ ê  ê  é "$%$" é  $(*+*'# é$)-010-(# é"(.25651-'  é%,169:950*# é"(/5:=>=93,% è$+18=@A?;6.' è!'-3:?BCA=70(  è $)/5;@CDC?91)! è#&+06BEFEA:3*" è)+.38>BFGEA:3*" è*+/38>BEFEA;3*" è+,/38>BEFEA;3*" ,ê/38=BEFEA;3*" -ê/38=BEFEA:3*" -ê/38=BEFEA:3*" è/.048=BEFEA:3*" 0ê149>BEFE@:3*" è2135:>CEFEA:3*" è5347:?CEFD@:2*" è7568;?BEEC?92*! è977981)! è:889:5.& è98779;=>=;72+$ þ755ì689:973.(" þ422í45542/*% ý/.--î.//.-*%  é)(''(())(&$  ý#"!!"ñ!  ýñ þò ó   õ þ ÷     ó@@@@ŒŒŒŒ."×commonsÿ     ‰×¥$õ%×ÁÆÄ#k€€€ý8qªªüUý8Uªªýq8üq8ýqâÿÿýª ýqâÿÿüâ úUªÿÿUõ8âÿÿ8ªÿÿþUôUâÿÿ8qâÿÿþUüqªÿÿþUúUÿÿÆþÆÿÿþUþqÿÿþUþªÿÿþªüªªÿÿüUÆûUÿÿâþqÿÿþâþUÿÿþUþªÿÿþªþqÿÿùªÿÆ8ÿÿþþÿÿþUþ8ÿÿþÆ þâÿÿþUÿþªûâÿÿþÆÿÿþþÆÿÿþU þ8ÿÿþâÿþÆþqÿÿþ8úâÿÿUþ8ÿÿ þâÿÿþqÿþªþÆÿÿ þþªÿÿþÆ þÿÿþÆÿûªÿÿþÆÿþª þ8ÿÿÿûªUÿÿþªþÿÿþª ÿþ8ÿûªÿÿþªþUÿÿþª þâÿÿþUÿûªªÿÿþªþUÿÿþª þªÿÿþUÿûªªÿÿþâþUÿÿ þªÿÿþUÿûªªÿÿþUÿÿ þªÿÿþ8ÿûªªÿÿþUÿþU þªÿÿÿûªUÿÿþÆ þ8þâÿÿþ þªÿÿþÆÿûª8ÿÿþ8 ýUâþÿÿþÆ ÿþqÿþªþâÿÿýâ ü8ÿ8þ8ÿÿþ8 þÿÿþÿþªþqÿÿýªü8âÆþÆÿÿþ þqÿÿþÿþªþâÿÿýâ8ûqÿÿþÿÿþûâÿÿâÿþªþUÿÿýâUUúâÿÿUþUÿÿþÆúqÿÿâÿþªþUÿ ÿþUþUÿÿþªúUÿÿâþÿÿþªþUÿ ÿýâU ý8âÿÿôâqUÆÿÿÆþqÿÿþýÆÿÿý ýqâÿÿýÆ8üUqÆÿÿýâªýUªªýUý8qªªýU ª€€€ù8qªª8ùUªª8 ý8ùUªªqùUª8ÆÿÿýÆýqâÿÿýÆúqÆÿÿýqâÿÿþýÿÿþÿÿþÆý8âÿÿþâü8ÆÿÿýÆÿÿþqþqÿÿúâUUÿÿùqUÿÿªUUýâÿÿþqüƪÆÿÿöUâÿÆqUUÆÿÿùªÿâUUþ8þÿÿúâUÿªýâÿÿþâþÆÿÿûªÿþqÿÿûªÿq þÿÿþªþqÿÿþ8þUÿÿþUþâÿÿþU þ8ÿÿþÆþ8ÿÿþUþUÿÿþqþÿÿþq ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU ÿþªÿþªþUÿÿþUþUÿÿþU þÿÿþâÿþÆþqÿÿþUþqÿÿþ þqÿÿþUþqÿÿþþÆÿÿþÆþÆÿÿýâøU8qÆÿÿ÷ªU88qÆÿÿ÷âU8UâÿÿüÆUüUâÿÿóâUUª8qª ªûqqª ªýq8ª ª ªü8ª€€€ªýqüUªªýUü88ýqªªþUÿþ ý8Æÿÿýª8 õ8âÿÿUÿÿýâUÿþ ùÆÿÿÆUýUÆÿÿþªüUªâÿÿûU8âÿÿûUªÿÿþú8âÿÿªþUÿÿýâªÿUøÿâUUâÿÿþâþUÿÿþúâÿÿªþUÿÿýâþªÿÿûâÿªþÆÿÿþUþÆÿÿþâþâÿÿþþÿÿþªþUÿÿþUþ8ÿÿþªþÿÿþqÿÿþª þâÿÿþ8þUÿÿþqþâÿÿþâþUÿÿþUþâÿÿþU þÿÿþÆþUÿÿþUþªÿÿþUÿÿþUþUÿÿþ þ8ÿÿþþUÿÿþUþªÿÿþUÿÿþUþªÿÿ þâÿÿþUþUÿÿþUþªÿÿþUÿÿþUþÆÿÿ þªÿÿþþUÿÿþUþªÿÿþUÿÿþUÿ þÿÿþªþUÿÿþUþªÿÿþUÿÿþUÿ þUÿÿþªþUÿÿþUþªÿÿþUÿÿþUÿþU þUÿÿþªþUÿÿþUþªÿÿþUÿÿþUÿþU þUÿÿþþUÿÿþUþªÿÿþUÿÿþUþªÿÿþª þUÿÿþUþUÿÿþUþªÿÿþUÿÿþUþÿÿþâ þUÿÿþþUÿÿþUþªÿÿþUÿÿþUþ8ÿÿþ þªÿÿþÆþUÿÿþUþªÿÿþUÿÿþUþâÿÿþ þÆÿÿþqþUÿÿþUþªÿÿþUÿÿþUþqÿÿþâ þÿÿþâþUÿÿþUþªÿÿþUÿÿþUþÆÿÿþqþÿÿþ8þUÿÿþUþªÿÿþUÿÿþUýâÿÿþþÿÿþUþUÿÿþUþªÿÿþUÿÿþqýâÿÿýâúâÿÿUþqÿÿþUþâÿÿûÆÿÿþÆýªÿÿõ88ÿÿâUþâÿÿþÆþUÿÿüqâÿÿûÆqUý8Æÿÿýâqü8qâÿÿ÷âUUªÿÿ ªþ8ýUªªýq8 þqª ªþ8ªªVVV ýUªªúU óÿÿ⪪ÆÿÿªÆÿûÆÿâ8ý8Æÿÿûªÿÿ8üâÿÿû8ÿÿÆü8ÿÿûÿÿªýªÿûªÿÿâýUÿþªÿÿþqþÿþqÿÿþqþ8þÿÿýÆ8þÿÿýÆ þªÿÿý þÿÿýâq ý8âÿÿýâ þqÿÿýâU ýÿÿýâ ýªÿÿþýªqþUÿÿþ⪠þÿÿýªÿþÿÿüªÿqÿþÆûªÿâþÿÿþqûªÿÿªûÿÿªþªÿÿýÆ8öÿÿªÆqøªÆªªÿÿ⪪ÿýâqªþ8ý8ø8UªªUk 5õ8 Drop-ShadowÌ     ÿÿÿúÿÿÿú9%µõ8%ÑNN$õ8%í0=:êEÁU  þþþþ øúùù ô  í     ù  ò ÷ ø ø ×  øî ÷ôøí  !#$%%÷$# ó!"##$%%ù$" Ð  "$&')*+,,+*'%"!#$&'())*+,,ú*(&#!é !$&(*+-.0122ç1.,)&#! !#$'(*+,--./02344ú31.,)×  #'),-/01346787642/,)(''(*,./11223û568:;;û9752ß !&*-/12334679:;<;9742/..è0245677665668:=?ABCB@=:ð "',024566Ù78:<=>>=;97544579;<==<:9878:>á=;:99:<>ABCCB@=;988:=@EIMOPONKâ &-38;==<:8655679;<=>==å>@BEGIIHFC?;9779<@FKPSUVTRÅ $+29=@AA>;853223579:;<==?ADGKMOOMJE@;7556:?EKQVZ[ZXé  (08>CEED@<830..Ü024689;=@CGLPSTSQLGA;63237=CKRX\__]à $,5=CGJIGB=72.+))*,.1369<@EJOTWXWTOHA:40/04:AJRY^abaè '09AHLNMID>71+(%%Ý'),/26:@FLRW[\[WQIA93.,-17?HQY_cddà  )3=ELPRPLF?70*%"!!"$'*.38?FMTZ^_^YSJA92-*+/5=FOX_dfeà ",6@HOTUSOIA81*$!!#'+06>ENU\`a`[TKB91,))-3;DNW^cffà #-8BKSWYWRLC;2+% !$(.55-'" #'-471,)&%&'*.3:AJRZ_bc`ZSJA93/-/28@HOUY[[à !+6ALV]bdd`[TME>83/,*)*+.38?GOV\`a_ZTLC<610149@FMRUWWã (3>IS[aeec_ZSLE?:52/--â/27=DKRX\]\YSME>94336:?EJOQRRà %/:EOX_ceeb^XRLFA<741/./149?FMSWYYWSMF@;7557;?CGKLMLÅ !+5@JS[`dec`\WQLFA<741/./15:@FLQTUSPLGB=9778;>ADFGGFÏ &0:DMU\`bba]YTOID?:51.-,.04:?EJMOOMJFA=:88÷:<>@AA@?Ä !*3=FNUZ]_^\YUPJE?:50-*))+.27=AEHIHFC@=:87789:;;:98Ð $-5>FMRVYYXVRNIC>83.*'%$%(+059=@BBA?=:8755ü421Å &-5=DINPRQPMID?:4/*%" !$(,048:;;:875321100/.,+*Ø %,3:?CFHIHEB>94/*%! $(,/133ò10/.-,+*('%$#Ö $*059<>?><:62.)$  #&)+,,ò+*)('&%#" È !&+.134431.*&"!#$%%$$#"! É !$')**)'%" ò   õ ö ö Ú   õ ô é   ö  ö  ÷ ø øù "    þü      ú  ô      ø ø   ë  üø  ÷ ó ûöø  öî !!û"#$$%%û$#"!  !þ"##ø!ö !!ð"#$%!$&'))*û+,-.//õ.-,*))()*+,,ì*(%!"$&())**ú+,-.÷ #&*-/12334ü57899ú8764211ü23455í31-*&" #'*-01233í4567'%%&(+/369;<==<<ó=>@ACCDCB@><::ý;=>>ì=:62.)&$$%'+/37:;<=<<ñ=>@/--.037<@CEFFþEDDûFGIKMMÞKIGECAABCDFGFEC?:51-+*,.27<@CEFFEDDEFH86558;@DILNOOMLKJJLNPSUVVTROMJHGGIJLMNMKGB=841125:?DILNONMKJJKLN@>==?CHLQTVWVTRPOOPRUX[\]\YVSPMLLMOQSTTRNID?:778;@FKPTVVUSQOO€ÅQSHEDDFJNSX[]][YVSRQRUX\_aba_\XTQONOQTVXXWTPJE@=<=@EKQWZ\\ZXUSQQSVOLKJLOTY]`ba_\XUSRSUY^adfec_[VRPOPRUX[\[YUOJEA@ADJPV[_``^ZWTRRTWUSQPQTY]adedb^YURQRUY^bfhgea\WSONOQUY\^^\XSNHECDHMSY_bcb`\WTQQSV[XUU€;X\`dggfc^YTPOPSW]bfhhfb\WRNLMPTX\_`_[VQLHFGJOU\aded`[WRPOQT_\YXY[^bfhhfb]WRNLMPU[`ehhfb\VPLJKNRW\_a`]YSNJHHKPW]befd`[UPMLNRb_\[[]`dgiifb\UPKIJMRY_dggea[TNJHHKPU[_ba_ZUPKIJLQW]beec_YSNJIKOca^\\^adgiheaZTMIGGJPV]befd`YSLHEFINTZ_ab`\VQLJJMRX]beeb^WQKHGHLda_]]^adghhe`YRKGDEHMT[`dec^XQKFCDGLRY^ab`\WQMJJMRW]bdda\VOIFDFJda_]]^adghgd^XPJEBCFLRY_cdb]WPIDBBEKQX^aba]XRNKKMRW]adc`[UNHDBDHc`^\\^`cfgfc^WOICAAEJQX^bca\VOHCAADJPW]aba]XSNKKMRW]acc`ZTMFBABG`^\[[]_cegfc]VNHC@@DJQX^aba\UNHB@@DIPW]aba^YSOLLNRW]acc_ZSLFB@BF][YXY[^befeb\UNGB?@CIPW]ab`\UNGB@@CIPW]aba^YSOLLNRW\`cb_YRKEA@AEZXVVWY]`deea\UNGB?@CIPW]ab`[UNGB@@CIOW]aba^YTOLLNRW\`bb_YRKEA?AEUTRRTW[_bdda[UMGB?@CIPW\`a`[UNGB@@CIOV\`ba^YTOMLNRW\`ba^YRKEA?AEPONNPTX]acb_[TMFB?@CHOV\_`_ZTMGB@@CHOV\`a`]YTPMMNRW\_a`]XQJEA?AEJIIJLPUZ^``^YSLFA??CHNU[^_^YTMGB@@CHNU[_`_\XSOMLNRV[^`_\WQJD@?ADD€2EHMRW[^^\WQKEA>?BGMSY\]\XRLFA??BGMSY]^][WRNLLMQUY]^]ZUOIC@>@D>=>@CHMSWZZXTNHC?==@EKQVYZXUOJD@>>AEKQVY[ZXTPLJIKNRVY[ZWRLFA>=>B778:>CHNRUUTPKE@=;;>BHMRUVTQLGB><<>CHMRUWVTPLIGGHKOSUVVSOID?<;CHLOPNKGB>:88;>CHLOPPNKHECCDFJMOPPMID?;878;))+.27BFHIHEA=96446:>BFHJIGEB?>>?ADGIIÂGC?:64347"#$'+059=?@?<952/..037;>@A@>:731//147;>@AA@=;9878:=?AAí?<841/./1!$(-1466×41.+)((*,/2578752/,*))*-035788753100134688È630-*)()+!%(+-.-+)'$#""#%(*-./.,*(%$##$&(+-.//.-+*))ü+,.//ú-+)&$""î$!#$%$#! ë #$%&%$" !#$&&õ%$#"!!"#$%&&ú%#!î óû÷úõ õûûî ü  û õ û  ó                õ ü 9 þ,  ú   ô û üþþ     ù ÷  þ  ù ÷ üþö õ ú  é ö  õ ùõ%%û$#"!  ü!""##ö"   óë !"#//õ.,+*)(()*+,,ç+)&# !"#$%%ù$#!ô"$')+,,899õ875321122455Ç42/+'" "$%&'()*+,--,+*(&#"!!"$'*.13566BCDCCA?=;::ü;<=>>å<84/*&" "%')*+,-./012344Ê20.,*))*-037;=?@@JLMMLKIFDBAABCEFGFDA=83.)&%%&(*,.01122Ã34689;<<;975321358=AEGIJJQSUVUTQNLIHGHIKMNNLJE@;61.,,-/2456766è5679<>ABCCB@><::;>AFJNQSSÚVY[\\[XUROMLLMORSTSQMHC>964468:;==<;988‰9;>BEHJKJIGECBCFINRVY[[ZZ]`bba^ZVRPNNPRUWYYWTOJEA><=>@ACCB@>;9889;?CHLOQQPOMKJKMQUY]`aa_[_cefeb^YUQOOQSWZ\]\ZVQLHFDEFGII€ùGD@=9778;?DIOSVWWVTRQRTW[_cefebZ_dghgd`ZUQONPSV[^``^[WSOMLLMOPONKGB=86458=CIPUZ\]\ZYWWY\_cghigdY^cghhe`ZUPMLNQUZ^acb_\XUSRSTUVURNIC=74236;AIPW\`aa`^\\]`cfikjhdW]bfhhe`ZTOKJLOTY_bdec`][YXYZ[[ZVQJC<61/028?GOW^bdedb``acehklkhcT[`eggd_XRMIHIMRX^cfgfda_^^€=`a`^ZTLD<50--055.*(*.5>HQZaeggfeddegijjhc]LSZ_bb_ZSLFA@AFLS[bgijjhggÂijkkid]TJ@70+)+/5>GPX_ceedcbbdfhiigb\LSY_bb_YSLEA@AELS[afijihffåhijjid^ULB92-+,/5=FNV\`bba``Ãbdghhfb\KRY^aa^YRKEA?AEKSZafhihfeddeghigd^VMD<50-.16=EMTY]^^]]…^`ceggea[KRY^aa^YRKEA@AEKSZ`eghfdbaabdefeb^WOF>830037=DKQVXZYYXYZ]`cefd`ZKQX]``]XRKEA@AEKRY_dffdb_^]^_abb`\WPHA:63358>CINRTTÂUWZ]addc_ZJQW\__\WQKEA@AEJQX^bcca^[YXYZ\]^]ZUOIC=86569=BGJMNONNÃPRVZ^aba^XIOUZ]]ZVPJDA?@DIPV[_``]ZWTSRSUWXXVSNIC>:878:=@DFHIHHÛJMRV[^_^[WGMRWYYWSMHB?>?BGMSX[\[XUQNLLìNPQRQOLGC?;9889;>@ABBAÂBDHLQVY[ZXSDJOSUUSOJE@=<=@DJOSVWVSOKHEDEFHIKKJGDA>;97789:;<<;::Ê<>BGLPTVVSO@EIMOOMJE@<989<@EIMPPOLHD@><<=?ABCCB@>;976556ý5433’57;@EJMOOMJ;?CGHIGD@;85457;?CFHIGDA=9654568:;<;:9754221100/.-,+,.049>BFHHFC48?@><-14677641.+*))+.13677530,)&%$$%'(*+,,Ú+*)('&%$"!  "&*.256764&)+-./.,)'%##é$&)+-..,*(%" "#$%%â$#"! #&),-.-+!#$%%¢#" !#$%%$" !#$%$#ä ûýú  û î ú û   þù û   ð  ü      þ  ú ô üþ   ! ˜ ˜ ˜×*   þþ    ù÷÷ ú     öö ù ô ì ñ þ#$$%ì$" ñ -.Ù-,)&"  678ö753/+'"ø!#$%&&ï%$#! @?ê@AA@?<84/*%" !#%(*,--í,+*(&# ýIHGGþHIIÙGEA<71,)&%&'*-/1344321/-*'# ýQPNNÖOPPOMJE?94/-,,.1479:;::8641.*&! æWUSRRSTUVVTQLF@;632247;>@AAì?=;851-(# ü\YVUUÖWYZ[ZWRMGA<978:=ADFHHGEB?<840*% Ð_[XVUVX[]^^\XRLFA><=?BFJLNNMKHD@<72,'! Ð_[WUTUX[^`a_\VPJEB@ACGKNQSSRPMID@:5/(" Ð_ZVSRSVZ^aba^YTMHDCCFINRUWXWURNID>81*$ Ï^XSPOQTX]acc`\VPJFDEGKPTXZ\[YWSNHB<4-& Ï\VQNMNRV\`cca]WQKGEEGKPUY\^^][WSMG@91)" ÏZTNKJKOTZ_bcb^XRLGEDFJOTY]`aa_\XSLE=5-% ÏYRLIGIMSY^bcb^XRLGDCDHMRW\_bcb`\XRKC:1)  ÎWPJGFGLQX^bcb^XRKFBABEJOUZ^acdc`\WPH?6-$ ÎVOIEDFJPW]acb^XQKEA?@BFKQV[_bddc`[UMD;1( ÎUNHDCEJPV]acb^XQJD@==?CGMRW\`bdcb^XQH?5+" ÎUNHDCEIPV\acb^XQJD?<;;:;=@EINSX\_aa_[UMD:0& ÎTMGDCEIOV\`bb^XQJD>;99;>AEJNSW[]^]ZUNE;1( ÎSMGDCEIOU[`ba^XQJD>;98:<>BFJNRVYZZXSMD;1( ÎRLGCCDINUZ_a`]WQJD>;989::8789:@CFIJJIE@:2*" ÎJEA?>?CHMRUWVSOJD?;75445678:<>@BCCB?:4-& êEA=;:BFHJIGC?;630/..è/0123455430,'" ê95311247;>@AA?<840.+*))*+ë,--..-+)%! ë1.,**+-025787630-*'%$$%&î'&%$! ü)'%$$ð&(*-./.-+(&#! ð é! !"$%&%$#!ñ üñò õøó þ  ù ù    ô þ       û  þ  øz=,d Backgroundÿ     ÿÿÿÿN×,dN÷OïOûP,dO+OIOYOiOyO‰O¯O¿OÏOßÿÿÿùÿûúôÿþÿ:ÿý Åÿÿÿÿÿÿÿÿÿÿÿÿÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ&ÿüþýüÿ>ÿýþýÿ>ÿüþÿüÿQÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ ÿ0ÿ0ÿ0ÿ0ÿ–2K% jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/images/jexl-logo-white.png0000664000175000017500000002623311671435474026562 0ustar jamespagejamespage‰PNG  IHDRæS‹m{}bKGDÿÿÿ ½§“ pHYs  ÒÝ~ütIMEÔ0,ÏãVY IDATxœí]ipUUòÿ½$èÔÌ|P—â̇¿¢EdQ–DT”Áab‰ÈÈ8Ö` 8(¢5Žã P²¹ "‹J‚l"›ƒHdQš"‹£ ÙÈ‚ *ämçÿûÚ·oŸû^pA§^WÝzïÝw–>ÝýëîsÎ]ƃf/Þ̪. Íîï§ÔÕI´YׯžßÍåU+:<Ûˆ·¥µ+û?]}&Âów‘­ýÒ†üdH˜[·nu¢óÏ?999ÈÍÍEÛ¶m=Œz:ûæ·6Ø@ €­[·âðáÃX¾|¹ë¿ÜÜ\äææ"''ÇÕ¾ßm­¬¬Ä²eËpùå—#77×Ó^YY¶nÝŠ²²2gŒ………®¾m´bÅ lÛ¶ ‡vÕÍÍ͵*Nò+ù.++ÃòåËñÄO¨c_¾|9ÊÊÊœ>sssQTTäч&‡mÛ¶¹dMu³²²âצ_jŸäH¼@VV–ÓO<Ó‹z’MQQ‘£Kj“ìˆô………(**ŠÛŸŸ Iy@QQ.¿ürGæ÷ß?žxâ «óöûí|7qèÉ'Ÿ4YYY€ïQXXh>þøcÓÔÔd=B¡ …B&›H$b¢Ñ¨‰F£æ‰'žH¨¬¬,3räÈf÷‰DÌ’%KLQQ‘ÓÖ’%KL$1ápØ„B!³yóf“““cí;''Ç1O<ñ„ÉÍÍuÚ ^‰ßÇÜ·Ï{î¹ÇÓ߉'ÌÌ=÷Üã+gªK‡Æ+ç—ëòí·ßvñÏf6mÚdššš\ýiú¤±oÙ²ÅÜ{ï½®±¿ð Ž\þóŸÿ˜‘#GúÚÐÂ… =r±é‚Æwß}÷¹Ú(**2EEE®±:6”¨]’ܢѨ‰Åb&‹cŒ±sëÖ­®Áßwß}fË–-Ž>þøcSXXèø‚ ÌW_}å9¾þúkGÄèâÅ‹]}Ü{ï½fóæÍ& ™¦¦&óñÇ›Ç{L5Àxýâ*Ý»w7_~ù¥9~ü¸9~ü¸yóÍ7MÛ¶mªÛ¶m[óå—_zâ»´´ÔÜsÏ=Vç@¼~üñǾ„“&Mrñ;iÒ¤„ê0#FŒ°ò*u …Ì'Ÿ|â2ÒÜÜ\³dÉÇ^Hßïýû÷÷Õå¢E‹Laa¡Õ‘.7nܘƒ`æÏŸïÈåøñã¾ã#ž³²²ÌæÍ›]²©©ÉlÚ´É3®'N˜¯¿þÚiË~8U`¾øâ‹.:tÈÅHSS“Óq÷îÝ=ƒž7ožùâ‹/œãرc®Áýõ×fÊ”)V ðöIXýû÷÷ôSPP`ígĈ¦ÿþfÀ€ªb.\höïßïðß¶m[s÷Ýw›çŸÞÌ›7ÏÜu×]j½ &˜£Gš¹sç:çòóóMII‰™7ožSWì„ ÌgŸ}æ:>ÿüsóÅ_˜îÝ»›þýû«ò$E/\¸Ði·{÷îfâĉNŸÝºuSëíÞ½Û=zÔäçç;ã>|¸‹ß‚‚k]W’3éR¢°°Ðe+uIŸóçÏWׇ~¨ê³ÿþqu¹`Á—ãé¢mÛ¶æèÑ£Î!ÇG¶Êû¤ènï‡;Dͱq§&³˜”YYYN Åùꫯ̗_~iŽ;f&Nœèt›6mLcc£ihh0¦±±Ñ=zÔøóÏ?ï,÷0ÔþñãÇ%}þùçŽqñ#??ßéƒúùì³Ïœz¶HA@ïÖ­›Y·nùì³Ïœ6LCCƒùàƒԱ͙3Ç0yyy¦¢¢Â9rÄ9êêêL}}½Ù¹s§iÓ¦§./{äÈS__ïȉƒÔÆï]wÝeöìÙcŽ=êáwüøñžzwÞy§ÉËË3̸qãT^ëëëÍsÏ=§ÖÕÊ766:2þè£\9`ÀW ÌõyìØ1G—%%%ªl?øà>9`4Mý˜]»v92©¯¯7uuu¦®®ÎtíÚÕSoΜ9¾ã[¿~½S¶{÷îNôÓìôرc®òšC“ ç•àt-þlݺ=zô ŸøôÓOѦMc‹Å‹ÅœïôyøðatìØ’Š‹‹‘——àÛ…‚@ €ŠŠ ôéÓÇ)×½{w¼ùæ›ÎïoÒkç ¾èèܹ3ª««Õ¾ø‚DJJ RRRè\øÜsÏm!yÌÏÏÇܹsÕ±7ÅÅÅžñõë׳fÍr~ó1ÅÅÅ7nœ«ÞªU«pÙe—9¿‰Gâ755«V­Â!C<}Î;7Ýt“‡WÎo·nÝ<ò€Y³f¡_¿~¾üÞtÓM(//wÊdffbûöíž:œ×N:¡ªªÊ)³ÿ~gDò(¿3Ï>û¬‹Ï¼¼<»ø¢>€U6Ï=÷òòò\¶J<cPQQüü|W®CÞoìØ±xæ™gX°`€ÇF©OøóŸÿŒÕ«W£¾¾ÞÕ—”ÿ.@ U4Æ`àÀNC÷Þ{¯Êh4ŠX,†h4ŠH$‚H$‚p8Œp8ŒôôttéÒÅ#¨Ž;" ¹Žp8ŒGyÄUîÎ;ïtÚäG8F(rõ‡Aqúç?ÿ‰P(„¦¦&4559u©ÏP(”*ëtíÚÅÅÅN9ªË¿755áúë¯÷ô×¹sgL:'Ož´MMMªÃ:tè«}*ËùŽF£žzãÇG¿~ý\üJ^Ož<érzD=ôz÷î­òÈyèܹ³«^MM«}.£P(„3f¸@YPP€ôôt«>é ½Œ=™™™®>׬Yƒ²²2W_¼Ž&›qãÆáÆoTåAckß¾=222\õÊËËU]P_|åõÝwßuÆÂq@c‹D"…BŽóãö§É#:¸’N`Àœ:u**++F 0Æb1•ô¬Y³\ž>}:Z·níQƶmÛ\8åµd{tÐ`ù¹Ž;z”YSSƒÙ³g;ýpãùÜ)”‘‘áüO ኤïíÛ·÷B0ô%µ‘í©»víZ«±ŸˆÏÙ³g»ÊæååY(Feúöíëésܸq.ýq#‘ˆ§|ëÖ­¹4ÇQÖÖÖzÊð飯ªÂôéÓ]¶ÉÇIã"ǨÉA“ð¥e?iÀ)¤.[¶ÌÅt·nÝ\ˆ–(ç žwÞyزe ªªª‘‘c Âá°g¯Q¦„—]v™GÐZºL¨$c B¡K.@iiiÎaÓÆ¯ ˜äÑ90äœÇLê—ø¥²Ü`‰(rq9ÅÓg‡‘‘ÚÚZW[ååå¸îºë<¼ÚdCÑÔÌ@  f"œ_Ì´´4ôîÝ“'Ov•;v,V¯^Q£F¡S§Nê³³³‡]ú• ¤þx¿3iðÎ;ï¸:oÛ¶­ JNé­IØr2L¿ëêê¦3/øŒ©©©Î§mÌü))).o/brprçÀ·.7!l†Ku‰¨Žp*ú”…Îq^©½Ž;zÚÛ±c®¹æ—.RRR\¼QËI²áýh“ë‚dB™KË–-qÛm·aÁ‚®:0`:wîŒ'Ÿ|Á`Ð5FmÑ*55Õ3 7Di°mÛ6WÇ”~‘ðüX›°ÊºtŽƒ÷ý÷ß÷…R^"ài \xééé8r䈫½êêj\tÑEžz~““÷/êñìË€”šššªÕ•ãKKKsÎÙ¢‚œ«.øXµº4‘Ž„!9[]âä¿{÷nOY[öõ¶œžžîi«¶¶Ö ï7Ñl‚Û¨‚¬ëZtùFÄûÈ‘#Q[[‹uëÖyêîØ±½{÷ÆàÁƒqë­·" :ÿÙ¦4ä ø¡ñ–fŒq­>‘Pm+OÒå²6'Ê™mÄ•®åêR¨|€:uÂo¼áá› šG­oZ哈÷«Õ%CãÆÎÛ%~µˆÉ# —œ“ÙdÅÊû&^5gÀ§Ò‘Äb1g~k««Z#Š˜r*#³‰@ €N:y¢ÉAÌ/•åÑ’“d£Ù¢\WÐÒʉ'"== .TǽhÑ"¬[··Ür  äÉÖ´È-Ì<½V‡SKÃ2bÊÕ%™Çks¹o#iݺujû2*hi‰FdÄ7_ ”D†®­˜Ùú•}qi‹cš¡óº<…–}Ûø•KöÚ‚G<^mumüjë ½ú꫞-2[úÍÁf#Î+ß>“F}íGs„Úøxò9r$JJJÔèuuu˜>}: PUUåÁŠäCK_IWÀ7Û%òϪª*kÄÔ&Ø$`>g¡ tjjª5òhÂ×€L5l@ƒžhOíH¢èª¹¹ýH¦l‰Ô•% %oÚœ X<«Ñ¢™ŸÑR}îL4Ç|¹´ýk)_ΗféééGK‡&›£áNÀ¤d{ÑhÙÙÙX»v-î»ï>k;õõõ>|8Ö¯_¯â…g-rŽÉIG €—_~Ù3Ç´EK2_ö竌iii¸ñÆÕ~Ö­[§z)MÀÔÍËfgg{ŒÝ¦Lndš"ãªÆG¢@–@‘É67•Æ#WlrÑæuß•ß+®¸ÂS®´´TÍ~ø4HÚŒMŸ´,#™_ª.39>­96jËšgOÑhƒ ªU«0hÐ U^õõõ˜5kjjjT矈CL1Æ °°ÐóGqq±šbi“ ˜@¹k×.¤¥¥¡E‹hÑ¢ÒÒÒˆ?~M5QCCƒ%üæX²Ý×_ÝÕNÇŽ‘‘‘a•M66Gåç”l‹—ÆLš4 +V¬ðm¿uëÖ=z4~øaOÛ›6mR3ÁxóNà›ˆ™““£Þñ>räHTWW{@£Í…hP;vìÀðáÃ1{öl0ùEÔD»wïÆîÝ»] ±1Kýh{h×]wêýüÒ?E°«\äâå1thÉO¼#‰Üœ'¹|¯&ç•oU]xá…hÕª•§üK/½¤ÎÏlsoMŸ×_½‡'­%Ù€Ãùµ­qð5M†~ø¡Ú®‹7¢´´6lÀÔ©Sqà 7`Ê”)€™3g"33ÓêÁÚ´iƒ§Ÿ~Úóߣ>ê|— 2üܼy󜋧333‹ïýÀá'tÍèdäÔÈ~ý& ÞD(‘þx9nTòüéï}÷ÝçIiŸþy444xÕäQ[[ëæôéÓq饗ZÇ•(Z[]M’–/_Žºº:5Øpp=zÔU¯GžÕ]¿´–;-—›,((Àœ9sTæ€S9óË/¿Œ‰'âÑGÅØ±c±dÉçÒ¸©S§¢OŸ>q÷ûöí‹ýë_®s{÷îŤI“œß2jcðúë¯; 33Ë—/Gff¦jx\xR`D~¡ÿä ¯ÔËÑd6C8räˆ/1jŸ~ÄÇÐÐРòk3ðxŽ2[¹V­ZaâĉpŽ5 ¼YòÖ[ouÊϘ1}ûöUçr\—Ô&'m £tÏž=Ípj…uÆŒž¨I‘’€ùÒK/9u®¸â ל“g¶¬Ó3ÇäLåçç»îÌO„‚Á &OžŒk¯½Võšbúôéƒ ¸Âÿ–-[pÇw`õêÕ.¥–––â/ù þñ8u£òÒ¥K‘‘‘¡.îpp¦¦¦z.Ò§¾}#] À[o½å©[WW‡ÒÒÒ¸véÒ¥žº»wïV/èç$ç5<·åÙ¢|ii©§î† | ÎiünذÁ—×@ €V­ZaÒ¤I¸üòËó>|8,X€ýû÷8¥Ë={öàé§ŸF¿~ýpäÈdddàé§ŸÆ7Þh%ç¿ÿýo«V­Š›únܸQuxš¼4*--ÅwÜ]»v¹ø¡‹hžyæçQ W]u~øa§‘1î‡ø-Âá°¡½>ºr£©© Ÿ|ò î¾ûn|ðÁ¾ bРAÈÊÊÂYg…³Î:ËÙ·$`HÆø… ¡PóçÏÇ’%KâFŠ:à@—.]oEá7I‡Ãa¬_¿uuuØ´i>úè#µ½óÎ;_|1zôèáZe¼ýöÛjÔ€öíÛãâ‹/F»víœ4 8uwаyóf« ƒÁ zöì‰víÚ¡]»v8÷ÜsœzœÌþýû}ëfgg£gÏž8÷Üsñÿ÷8çœs+£Ó¾}û0wî\Œ6 ƒ¸í¶Û0dÈÇVÈ0érJÒçÎ;±{÷n¬\¹Ò*›óÎ;=zô@»víÑØØˆƒâwÞÁ–-[¬¼´oßW]uzôèáŒ-àñÇGcc#‚Á RRR§§§;7]c°~ýzgL7ß|3 àà‰oZ´h³Î: ¿øÅ/\ÇO rê@®•#º“ûĉøôÓOQ^^Ž7ß|Ó‰N­ZµB»víгgO¤¥¥9}öÙ® (Ä“ÒÈ´þB¡vî܉]»v¹ :%%×\s :uê„óÏ?ß|jS^Ò …0fÌÏj.ÿ”~B^BG&--ÍašÚ&ó¼_mâÊÙ@´ 9^jjªkLäd¤# kAùUPüŠ'ž=p§$ŸcCuµëŒ‰ø¢“ò¾½ÚŠxåuiœÚR=É—äIã%gJcå¼òËëH®ÔÜØ‰8Ÿèàãä}Ê…Û&w’œ7Ù'Ɉœï‹ú!Û“v-ƒ Ÿ;jÊH;$y 5`¦ÙVš8èä£/\¹p à0¡ ‹§´rþFçyyÞ•Ó¼b,s)“—çcà`ãž’§ò\¡ȶù¤¶ÈoAů®ü~óñiuµ¶m¿å8´ß~¼ÊŹI/)#«tŽrœ2E–Ó!Î+Ï­v<ó°YÊ÷ŸÙ¶š¨M™ÎJ-{±íùÚÆÂù%Jc#Ò.Á“ L5é<¥ÌÜÆ‹¼Œ¶à£)S’œ›Hƒ³Úãç%@¸Ò¸!HÃ’•;ÀuðsÜ‘È,ƒxæ"W 5ï-Ó|.W9'æòâÆJýÈi‚œ?K]p=nEê‘Ú$ûãºæ¶ªE'.7©3Þ­®Ì:¤ÃçAGÊ]S”äŸÆ…¬EÌ-Z¨ PTã—³yl9y–†Ošµy¯/•+IòB©çIz>?¥Èù)ñ&So>?ç Ušc‘‹~©¡ä•êhJ溕Ñ%žçui¬ZD•c•LFM›.Ɉ¤ü¨íh4ê²éœåZ ˜4ͲéB[gñã•GO锸=J`J‡šÆ™’)‹D;ª¶:ÈSi(rµQ „öô p™ÂpAi©õ%‡L94`ÊH ûá·Õ劑u¥áóÔŠˆ"­–ÚIpqjR.Õ—ýrÝʱj™E¼tVÎ¥yôá€×ô)ù§v#‘ˆ‹?0¸,9°è?éø¥.¤ƒ•)/' N[ÖÈåm‹š®9&)œƒ³E‹`¤¦¦ª¨d”`Ú!=+åú|©™~ótˆÈ–ëKã·EDj›{)m¿‰œŒL£9¸å‚õÅ•(ërÒœæ8¨L4EZZšÇ kààõøXej¥•3ѺZ*ÌÍÉs;úÔtIe¸<øøù¦KÑi|š.¤\©¾L @ÞŽ-SЂ—c?Ò{r¦e˜O˜š‘ðÎýRšËðv¥°¸@¥W†T¨…dêMÆJuø—4­.'w<šò$ï”zIgÅû’ –ÎÈ–…ð±r“ñÏÚÞ°œcÊúr¾)Xê’ÿæ2àmsy8i||n*ÇÇÛ#]ÊCf/¼®Ô''-BÒy>.¼´9º+•å†EÄ…AùU RY2“©¬ô Ò³’Ép):HcÒ”éJ.$ž6S_¸´èEmð=ÛÊ£­.Õ—u¥Aò±ÊºÜx?Òé‘ñѸej)‰¬KZs"rœÚüKFÍqãÆ¡ºº}ûöE¿~ý\ À” ”6#çõd3~ú ²é‚ëAœGàÔSãŸ}öY :]ºtñdxÒVwF%ç®®T–£š#[k”çLéä" 7<ò9PÈðmiü´¥°˜\‰¼?M)Üð¥2¥‘sÙq^è;•ñ««É[3pIXšñiNŽêJ^¥Ã´9HÍ!pYqÞéàÔ»fRSS×'ʨ"å/Ïñq‘ÅoK“©_ªÍÇEŸååå5jÞ{ï=§n‘+ÉšN9yzì.¯È…“’â^ÙâLj©ÍƒÛÒ,Íx¨Ù¶˜$ Œ~Àäž–Gú_³$É—4jõ傋öÉËhuü²j’_[DÑêqÞlz•N—@IôÊ+¯`À€ÖñH@J§ÁÇ%AÉÇ'e¤9-?=J‡¿jÕ*Œ5Êõ BàÛE?)/Þ——ÌP¸ìÒxÃZää‘þ'ƒÖ¢™f”šâ4ÃãmSÙx‘B¶¥)‚“t>™má ” ±ñæç8¶qIÙð:ü3^Ü€©ž6Ïk.¿²o-SѨmÛ¶.cÎÊÊr?~i¶f‹~ÎNã-Q=Òqùå—ã£>ÂŒ3ðÐCydáL- Kgàz£4gT~òkBˆ7 ›òüŒÝOhš"5áKïHä§H­]´(ÂûLÄÐe]ɳƿ¯§ËosêjýÒwmn œ’÷áÇѫW/TUU¡  óæÍóØ”lKÚ ß¶’ùtuO.|<<@cð«_ýÊ)?oÞ<äçç» 'î\heyÛ@À19C|àÒÈ(—ˆ¡Ä󨼜 ¤ñH¢$j¢$?Gß5`øÄ6~íS«ãW_ã_#¿±Çã·9u3Äh IDATé»ÇÃ' ûßüæ78xð  ˆ”~rû¢>¸½IçÎ3+)Ÿxº”dÓ…Ÿe6¢µ/£&“þãÑžï[IÚ¦E5­>}jÊò’ ¤~”HÛÚxÛšRl¿› , L[=¿vNW²^<~­œ¼_È£‹¤,¸N´y=•ósðÍÑesäÂëhé·ì›O$Ï4~Hj—¾[)™‘ßmƒÓêÛÎi ”Fáçá]÷`‰ŒÁ×Óá§¹õN‡ü ¶¹õOG6I]jà’†-m…¯­ÿDíD‹x‰”—Ÿ’x St4ü<Šrò&gŠ:µ'^]ÛïDÿã}~ßí5ô‰¶ý}Öû®ôCó›h9%åæ>'CæÑE.üÈ(Ý 5×Aj ÔÚ m8¹•Hã¡I×kót–'!`ý˜l«û] û»òócD¼Ÿ#5Ç©jÓY†Ï½´sZß?†~%'_äáÎ(øöÓÔ~³€©1ùs§ï+EN’Nš>|Ó¦MC›6mð׿þ€÷¢ 1+++ñÞ{ïáå—_v››ëR/‡FYY™¯¾ŠŠŠ\¿ËÊÊPYYi-ËçÁ890åcEŒÜ9Ñøä‹ïâO’’ô}See%¦NŠiÓ¦8õã;ï¼Ó1V¹Ñ‹ÅPSSƒââb<óÌ3èÖ­²²²PYY‰íÛ·cÅŠ€œœ,^¼Øõr,jë©§žÂ¶mÛ\|deeá±ÇsÝïKu–-[æ´Km9Ò³ÿËxˆèœ ˜Úå­6«û˜IJÒ÷EÆTVVbàÀ(++sýWPP€¹sçzž­JTSSƒüü|Àܹs‘››ëôöíÛqÛm·9.++ ¥¥¥êk>þøÇ?båÊ•Îï`Ñ¢E.9ýò—¿,\¸………žu~üú׿vþ›={6úôéãyý ¿›„?ª’Ư#÷¿Ë8IIú(++ /¾ø">ýôÓ„ÊcP]]üü|TWWcíÚµèÚµ«ëbünݺ¹F]YY‰Áƒ«¯!˜7ož °+W®Ä¡C‡<¯Æ‹D"xê©§óçÏGAA:g¤CF\1µ§åÉ×jÑÒÙ.:]a')IÍ¡¬¬,dee!''ÇóŸÜS6Æ`Μ9¨®®ÆÐ¡C‘™™é%zzºë5Û·oÇòåË=oÖ ‡Ãž7ÄõîÝÛóÏC‡aæÌ™ÈÏÏG^^žúM¿w·òUXmeVÛJ‘ã'J3I?*É—$ËÔ0‹¡ººÚy‡N¿~ý\`äs¸H$‚›nºÉÕÞÊ•+Õ×̃AŒ7Î)WUU…Ûo¿ÝUî†nÀe—]†ââb×st5€ÊgRÑXl@”çmsK¢äâO’~pÒ®ÆÑÊá®Y³Æ9_UU…êêjgÁD®²–——»~¯Y³¡PHÝï¾ãŽ;ðî»ï:ï?Y½z5:wC‡bذa0Æ`ôèÑ…Bž=RÛ];¶1HàÑê«í6FII`&錒Œ*ÑhÎÿÇov›¡PÈipïs>üðÃ(//w^å8~üx¬Y³µµµX¶lZµjåÔç€Lœ2çä{¬¶y%?—f’Îi ŒÅbxõÕW2ô |žÆ¯²EÌ””´jÕ Ó¦MÃÀÿÞÿ}<õÔShÕªšššœòÚm‹ÚÅ~÷½Úd QrŽ™¤3Jr.&çm|ŽGï·áïü.z7Nvv6xàW?¯¼òŠ«]zìK¾¦ÝoL¶s~ilrU6I?*Ù¶䢎4öŠŠ  4°qÐøün"‘®½öZW?o¼ñ^}õUW›òHdñÇÍ¡$0“tFIn/ð—S§ÒLµÈ¨­žÊïÑh÷ß?:vìˆôôt§¯|UUUž>x4æ Ô@(ÉvMV”<ðŽ9‚É“'£¤¤ÄÅÏСC]íÙÀÎç´?%™¤li_4‰ÅbÈÎÎvÊÔÕÕyÀé–iÓ¦Y·,Œ1X´hÖ¯_’’¤§§# bäÈ‘®þÆŒ÷‚D÷]( Ì$Q’àŒF£èÕ«—«ÌôéÓ±nÝ:PäBÌ /¼€ììlϼŽ@²aÃL:S¦LAff¦“f<¿ûÝïœò7nDii©ç’:íÒ¼æR¢€M3Ig”´¨Ù«W/´nÝÚUnìØ±X²d‰gÎHdž 0sæLÜ|óÍàÙ{lhhÀÔ©Sñ·¿ý }úôq=+%%÷Þ{/‚Á Óߣ>Šºº:€2…M¦²IúŸ'™nÆb1õ‚gžy·Ür fÍš…ÒÒR”––bÙ²e¸ûî»1nÜ8Ü|ó̓žýÇÔÔT 2pûí·»žsLàÌÈÈÀˆ#\ýM˜0Á“f˹«6–$é'Cøàƒ8räþþ÷¿{Þ|ûžÌk¯½K–,Áž={{÷îÅìÙ³1lØ0(éš^Nµµµ®qHjμ31“ô“¥ž={bÔ¨QqË]uÕU=z´ëò·@ €úúz<øàƒX¿~=àƒ>@]]çUtìÙ³õõõ®¶_zé%£®®Î5kjjðøã»ÊΛ7;wît~'²b£äÒIúA‰GÁh4Š?üáÎMËyyy˜1c†s• ]i‡]󹺺:¬\¹{÷îÅÞ½{¶¯¼òJ 0íÛ·wÒRþf¹GyÄó¾‘@ €!C† sçή§’’ìܹSÝb!8p :tè€+VàÃ?´^&hŒÁäÉ“‰DœßÄ_‹-œ›¤Ï>ûl× Ó®·€ýÊIR’N—‚Á † @¿‚ˆÎóÿ`Ê”)ž·ÌI Ñóvn¿ývußR>ƒn¹å´hÑÂó6h¹'ËŸªGc‘c³¥·I`&錑| ˆ|Þ¬ö\Yú®-¾hwwØÚ¥öèa_|¡ˆ×µ]ác[™µmÕhcô£$0“tƨK—.¼‘C¯vG‰|ÿ_’v§ ï‡?ˆY{ÁýÖ@åwA:w&~/^Ò¾'™¤3F]»võ(ò åòÞF-*ò²‰\@Îûâ¯+¾¿½L{U¡_›D|‹FÞ>Æë%™¤3BݺuC›6mÔûy#"£¥ÈÆ÷y-2iÆÏÏÉHpÞËÉk}}^àÛ§ÆÓ'O•å… É9f’ÎUVVºæ’Û·opêÊ"-µ”Ä&¯âàÔ¶Bl7;ó¶ø9¨RSSy&ïGÛná¼ÒÜ•——oU—W'qJ3I?(õèч¬X±•••˜?>ºuë†p8ì*k‹”šñÊ^Q9Ú2ÑÀÉ·Nø‘ƒ’G=zS•Óø’ÎDGKÍqÈHžf’~Pª¬¬Äoû[äææ¢¬¬ .D~~¾JÛŠ)ßÔ¢ ¿¾žêó=AÚßä)¤|A‘Öž¼üN¾âÀ/eÖxJIIqí³ú-%™¤ŒŒ1ÎûA ±hÑ"õfhVðÙæeò¶.¾rJe$8eô”¼Ò9™*óm‘xÛ0T†Jž88y 튜?á+ ;¼³ó$ýä‰1ßxç·mÑÍÏ|cŸ_-CßÈ×úà}qðÅKýxÖªm½øm£Pâ‹Æâç4ŸöK…ßÀ·M^Ûû?Hܰi>ÇSNíÊmËD¶É£”La5pʽKú䀴]@à·}¢ñ#·O~®©,Ô|óE2Šþ,I‹8€tŽG<>O´EMþÉܶH¤2ZòKíâ‘6ŽÁ.À$"î“ ü‘Õl‹=ümGÛ?´EL¿ãtøwÁ‚_»Úxµçäªl’ÎÙ"–ô˜~àäíÈï@ ´Kò´~³Ö¿m«ä§>ÇLÒÿÑœ¾kÑR–‘Àä¿©L¼>µÔ5‘ˆéz[„N„l‘;1“ô£“Jú.畼Žmå2ÞÊ*oƒÊïÍ!?p6”Zyí|˜IúQ‰§qòøþ>Éo!êÿªŠ)ÝjIEND®B`‚jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/xdoc.xsl0000664000175000017500000000431711671435474023255 0ustar jamespagejamespage

				
			
jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/navigation.xml0000664000175000017500000000365011671435474024450 0ustar jamespagejamespage Commons JEXL &commons; jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/index.xml0000664000175000017500000001521611671435474023421 0ustar jamespagejamespage Commons JEXL Overview

Java Expression Language (JEXL) is an expression language engine which can be embedded in applications and frameworks. JEXL is inspired by Jakarta Velocity and the Expression Language defined in the JavaServer Pages Standard Tag Library version 1.1 (JSTL) and JavaServer Pages version 2.0 (JSP). While inspired by JSTL EL, it must be noted that JEXL is not a compatible implementation of EL as defined in JSTL 1.1 (JSR-052) or JSP 2.0 (JSR-152). For a compatible implementation of these specifications, see the Commons EL project.

JEXL attempts to bring some of the lessons learned by the Velocity community about expression languages in templating to a wider audience. Commons Jelly needed Velocity-ish method access, it just had to have it.

When evaluating expressions, JEXL merges an Expression with a JexlContext. An Expression is created using ExpressionFactory.createExpression(), passing a String containing valid JEXL syntax. A JexlContext is created using JexlHelper.createContext(), and variables are put into a map exposed through the getVars() method on JexlContext. The following example, takes a variable named foo, and invokes the bar() method on the property innerFoo:

While JEXL is similar to the expression language defined in JSTL, it has improved upon the syntax in a few areas:

  • Support for invocation of any accessible method (see example above).
  • Added a general size() method, which works on:
    • String - returns length
    • Map - returns number of keys
    • List - returns number of elements.
  • Optional syntax for the 'empty' function : empty(obj)
  • Misc : '+' has been overloaded to be use as a String concatenation operator

JEXL 1.1 has been released. See the releases page for information on obtaining releases.

JEXL is not a product of the Java Community Process (JCP), but it provides a similar expression syntax. For more information about JSP 2.0 EL and JSTL 1.1 EL:

Jakarta Velocity implements a similar expression language.

In particular the References section of the User Guide has some good information on properties and method which correlate directly to JEXL.

jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/changes.xml0000664000175000017500000000664011671435474023723 0ustar jamespagejamespage Changes dIon Gillard Fix jdk1.3 only code that has crept into Jexl tests Allow unicode literals to be used Consistently throw ParseException in case of a parsing failure, not an Error. Allow for static methods to be called on classes and not just objects. Added Script and ScriptFactory to allow scripts to be executed from text, files or a URL. Added implementation for bitwise operators: and, complement, or, xor. Added implementation for the foreach statement. Added implementation for the while statement. Added implementation for block statements, e.g. curly braces containing multiple statements. Added implementation for the if statement. Unary minus was only working for integer values. Add @since tags to code so we can track API additions via javadoc Support assignment to variables 'abc'.substring(0,1+1) is empty (method matching problem) Support ant-style properties Fix string concatenation broken for variables Implement short circuit logic for boolean and/or Handle any size() method that returns an int Can't issue .size() on java.util.Set jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/reference/0000775000175000017500000000000011671435474023521 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/xdocs/reference/examples.xml0000664000175000017500000002203211671435474026060 0ustar jamespagejamespage Commons JEXL Examples

In this reference you will find the following topics to help with your use of JEXL.

You can find two sample programs in JEXL's CVS repository:

As well, JEXL's Unit Tests provide handy examples of expressions. The test code also contains a simple class that evaluates its command line arguments as JEXL expressions when run.

To evaluate expressions using JEXL, you need two things:

The easiest way of obtaining a a context is to use the JexlHelper.createContext() method. This creates a context which is simply an extension of a HashMap

Expressions are created using the ExpressionFactory.createExpression(String) method.

Once you have your expression, you can then use use the evaluate to execute it and obtain a result.

Here's a typical scenario:

// Create an expression object for our calculation String calculateTax = taxManager.getTaxCalc(); //e.g. "((G1 + G2 + G3) * 0.1) + G4"; Expression e = ExpressionFactory.createExpression( calculateTax ); // populate the context JexlContext context = JexlHelper.createContext(); context.getVars().put("G1", businessObject.getTotalSales()); context.getVars().put("G2", taxManager.getTaxCredit(businessObject.getYear())); context.getVars().put("G3", businessObject.getIntercompanyPayments()); context.getVars().put("G4", -taxManager.getAllowances()); // ... // work it out Float result = (Float)e.evaluate(context);

Often you have the objects and values that are needed in the context available elsewhere, and instead of creating the default context and populating it manually in the code, it may be simpler to create a context implementation of your own.

The JexlContext interface is very simple with only two methods, one to get the variables of the context as a Map and another to set the variables of the context from a Map.

Here's a simple context that wraps the JVM's system properties: JexlContext context = new JexlContext() { public Map getVars() { return System.getProperties(); } public void setVars(Map map) { } };

JEXL allows you to add custom expression resolvers that will get called with before or after expression evaluation.

If pre-resolvers is added to an expression, any value it returns will be used instead of that normally provided by JEXL. If JEXL evaluates an expression to null post-resolvers of an expression are called in turn in an attempt to get a value.

Expression resolvers are called in the order that they are added.

Most valid arithmetic expressions in Java are also valid in Jexl.

1 + 2 12.0 - 5.2 6 * 12 + 5 / 2.6 12 % 2 6 div 4 -12 + 77.2 x * 1.1 + y

Arithmetic expressions can use variables. null is treated as a zero for arithmetic.

JEXL allows you to call any method on a Java object using the same syntax. If you have a string in the context under the name aString, you could call it's length method like this: aString.length() aString.substring(6)

Often the values you want to pass to a method are other variables or expressions. If you have a number in the context, named i, you could use it in a method call: aString.substring(i)

JEXL provides a shorthand syntax to access methods that follow the JavaBean naming convention for properties, i.e. setters and getters.

If you have some object foo in the context and it has a method getBar(), you can call that method using the following syntax: foo.bar

Since java.lang.Object has a getClass() method that returns a java.lang.Class object, and the class has a getName() method, the following is a shorthand for obtaining the class name of an object foo in the context: foo.class.name

Array elements can be accessed using either square brackets or a dotted index notation, e.g. the following are equivalent arr[0] arr.0 The same holds true for lists.

For a map, the syntax is very similar, except the 'index' is an object, e.g. the following are equivalent. aMap['key'] aMap.get('key') Please note that the index does not have to be a string, and that the string usage above is just one possible option.

jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/reference/index.xml0000664000175000017500000000243411671435474025355 0ustar jamespagejamespage Commons JEXL Reference

The JEXL Reference documentation is made up of the following:

jenkins-commons-jexl-1.1-jenkins-20111212/xdocs/reference/syntax.xml0000664000175000017500000003326411671435474025601 0ustar jamespagejamespage Commons JEXL Syntax

This reference is split up into the following sections:

  1. Language Elements
  2. Literals
  3. Functions
  4. Operators
  5. Conditional Statements

For more technical information about the JEXL Grammar, you can find the JavaCC grammar for JEXL here: Parser.jj

ItemDescription
Comments Specified using ## and extend to the end of line, e.g. ## This is a comment
Identifiers / variables Must start with a-z, A-Z, _ or $. Can then be followed by 0-9, a-z, A-Z, _ or $. e.g.
  • Valid: var1,_a99,$1
  • Invalid: 9v,!a99,1$

JEXL also supports ant-style variables, e.g. my.dotted.var is a valid variable name.

NOTE: JEXL does not support variables with hyphens in them, e.g. commons-logging is not a valid variable, but instead is treated as a subtraction of the variable logging from the variable commons

Scripts A script in Jexl is made up of zero or more statements. Scripts can be read from a String, File or URL.
Statements A statement can be the empty statement, the semicolon (;) , block, assignment or an expression. Statements are optionally terminated with a semicolon.
Block A block is simply multiple statements inside curly braces ({, }).
ItemDescription
Integer Literals 1 or more digits from 0 to 9
Floating point Literals 1 or more digits from 0 to 9, followed by a decimal point and then one or more digits from 0 to 9.
String literals Can start and end with either ' or ", e.g. "Hello world" and 'Hello world' are equivalent.
Boolean literals The literals true and false can be used, e.g. val1 == true
Null literal The null value is represented as in java using the literal null, e.g. val1 == null
Map literal You can construct a java.util.HashMap by using [ key => value, key => value ]. key and value can be any valid expression.
Array literal You can construct an Object[] array by using [ item, item, item ]. item can be be any valid expression.
FunctionDescription
empty Returns true if the expression following is either:
  1. null
  2. An empty string
  3. An array of length zero
  4. A collection of size zero
  5. An empty map
empty(var1)
size Returns the information about the expression:
  1. Length of an array
  2. Size of a List
  3. Size of a Map
  4. Size of a Set
  5. Length of a string
size("Hello") returns 5.
OperatorDescription
Boolean and The usual && operator can be used as well as the word and, e.g. cond1 and cond2 and cond1 && cond2 are equivalent
Boolean or The usual || operator can be used as well as the word or, e.g. cond1 or cond2 and cond1 || cond2 are equivalent
Boolean not The usual ! operator can be used as well as the word not, e.g. !cond1 and not cond1 are equivalent
Bitwise and The usual & operator is used, e.g. 33 & 4, 0010 0001 & 0000 0100 = 0.
Bitwise or The usual | operator is used, e.g. 33 | 4, 0010 0001 | 0000 0100 = 0010 0101 = 37.
Bitwise xor The usual ^ operator is used, e.g. 33 ^ 4, 0010 0001 ^ 0000 0100 = 0010 0100 = 37.
Bitwise complement The usual ~ operator is used, e.g. ~33, ~0010 0001 = 1101 1110 = -34.
Equality The usual == operator can be used as well as the abbreviation eq. For example val1 == val2 and val1 eq val2 are equivalent.
  1. null is only ever equal to null, that is if you compare null to any non-null value, the result is false.
  2. Equality uses the java equals method
Inequality The usual != operator can be used as well as the abbreviation ne. For example val1 != val2 and val1 ne val2 are equivalent.
Less Than The usual < operator can be used as well as the abbreviation lt. For example val1 < val2 and val1 lt val2 are equivalent.
Less Than Or Equal To The usual <= operator can be used as well as the abbreviation le. For example val1 <= val2 and val1 le val2 are equivalent.
Greater Than The usual > operator can be used as well as the abbreviation gt. For example val1 > val2 and val1 gt val2 are equivalent.
Greater Than Or Equal To The usual >= operator can be used as well as the abbreviation ge. For example val1 >= val2 and val1 ge val2 are equivalent.
Addition The usual + operator is used. For example val1 + val2
Subtraction The usual - operator is used. For example val1 - val2
Multiplication The usual * operator is used. For example val1 * val2
Division The usual / operator is used. For example val1 / val2
Integer Division The div operator is used. For example 4 div 3 gives 1.
Modulus (or remainder) The % operator is used. An alternative is the mod operator. For example 5 mod 2 gives 1 and is equivalent to 5 % 2
Negation The unary - operator is used. For example -12
Array access Array elements may be accessed using either square brackets or a dotted numeral, e.g. arr1[0] and arr1.0 are equivalent
OperatorDescription
if Classic, if/else statement, e.g. if ((x * 2) == 5) {y = 1;} else {y = 2;}
foreach Loop through items of an Array, Collection, Map, Iterator or Enumeration, e.g. foreach (item in list) { x = x + item; } Where item and list are variables.
while Loop until a condition is satisfied, e.g. while (x lt 10) { x = x + 2; }
jenkins-commons-jexl-1.1-jenkins-20111212/STATUS.html0000664000175000017500000000552711671435474022365 0ustar jamespagejamespage Status File for Apache Commons "Jexl" Package

The Apache Commons Jexl Package

$Id: STATUS.html 561592 2007-07-31 23:25:16Z dennisl $
[Introduction] [Dependencies] [Release Info] [Committers] [Action Items]

1. INTRODUCTION

The Jexl package implements a simple expression language engine. It borrows many ideas from the JSTL Expression Language. Liberally. Ok, it's an attempt at and idependent implementation of the JSTL EL with extensions.

2. DEPENDENCIES

The Jexl package is dependent upon the following external components for development and use:

3. RELEASE INFO

Current Release:

Planned Next Release: TBD

4. COMMITTERS

The following individuals are the primary developers and maintainers of this component. Developers who plan to use Jexl in their own projects are encouraged to collaborate on the future development of this component to ensure that it continues to meet a variety of needs.

 

5. ACTION ITEMS

Want to help? Here's some "to do" items the team has identified.

Action Item Volunteer
Please read the TODO.txt document in CVS  
jenkins-commons-jexl-1.1-jenkins-20111212/.classpath0000664000175000017500000000076011671435474022431 0ustar jamespagejamespage jenkins-commons-jexl-1.1-jenkins-20111212/examples/0000775000175000017500000000000011671435474022261 5ustar jamespagejamespagejenkins-commons-jexl-1.1-jenkins-20111212/examples/ArrayExample.java0000664000175000017500000000416511671435474025524 0ustar jamespagejamespage/* * 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. */ import org.apache.commons.jexl.Expression; import org.apache.commons.jexl.ExpressionFactory; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.JexlHelper; import java.util.List; import java.util.ArrayList; /** * Simple example to show how to access arrays. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: ArrayExample.java 480412 2006-11-29 05:11:23Z bayard $ */ public class ArrayExample { /** * Command line entry point. * @param args command line arguments * @throws Exception cos jexl does. */ public static void main(String[] args) throws Exception { /* * First make a jexlContext and put stuff in it */ JexlContext jc = JexlHelper.createContext(); List l = new ArrayList(); l.add("Hello from location 0"); l.add(new Integer(2)); jc.getVars().put("array", l); Expression e = ExpressionFactory.createExpression("array[1]"); Object o = e.evaluate(jc); System.out.println("Object @ location 1 = " + o); e = ExpressionFactory.createExpression("array[0].length()"); o = e.evaluate(jc); System.out.println("The length of the string at location 0 is : " + o); } } jenkins-commons-jexl-1.1-jenkins-20111212/examples/MethodPropertyExample.java0000664000175000017500000000703411671435474027431 0ustar jamespagejamespage/* * 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. */ import org.apache.commons.jexl.JexlHelper; import org.apache.commons.jexl.JexlContext; import org.apache.commons.jexl.Expression; import org.apache.commons.jexl.ExpressionFactory; /** * Simple example to show how to access method and properties. * * @since 1.0 * @author Geir Magnusson Jr. * @version $Id: MethodPropertyExample.java 480412 2006-11-29 05:11:23Z bayard $ */ public class MethodPropertyExample { /** * Command line entry point. * @param args Command line arguments * @throws Exception on any error. */ public static void main(String[] args) throws Exception { /* * First make a jexlContext and put stuff in it */ JexlContext jc = JexlHelper.createContext(); jc.getVars().put("foo", new Foo()); jc.getVars().put("number", new Integer(10)); /* * access a method w/o args */ Expression e = ExpressionFactory.createExpression("foo.getFoo()"); Object o = e.evaluate(jc); System.out.println("value returned by the method getFoo() is : " + o); /* * access a method w/ args */ e = ExpressionFactory.createExpression("foo.convert(1)"); o = e.evaluate(jc); System.out.println("value of " + e.getExpression() + " is : " + o); e = ExpressionFactory.createExpression("foo.convert(1+7)"); o = e.evaluate(jc); System.out.println("value of " + e.getExpression() + " is : " + o); e = ExpressionFactory.createExpression("foo.convert(1+number)"); o = e.evaluate(jc); System.out.println("value of " + e.getExpression() + " is : " + o); /* * access a property */ e = ExpressionFactory.createExpression("foo.bar"); o = e.evaluate(jc); System.out.println("value returned for the property 'bar' is : " + o); } /** * Helper example class. */ public static class Foo { /** * Gets foo. * @return a string. */ public String getFoo() { return "This is from getFoo()"; } /** * Gets an arbitrary property. * @param arg property name. * @return arg prefixed with 'This is the property '. */ public String get(String arg) { return "This is the property " + arg; } /** * Gets a string from the argument. * @param i a long. * @return The argument prefixed with 'The value is : ' */ public String convert(long i) { return "The value is : " + i; } } } jenkins-commons-jexl-1.1-jenkins-20111212/NOTICE.txt0000664000175000017500000000026211671435474022165 0ustar jamespagejamespageApache Commons JEXL Copyright 2001-2006 The Apache Software Foundation This product includes software developed by The Apache Software Foundation (http://www.apache.org/). jenkins-commons-jexl-1.1-jenkins-20111212/build.xml0000664000175000017500000001427411671435474022274 0ustar jamespagejamespage ================================= WARNING ================================ Junit isn't present in your ${ANT_HOME}/lib directory. Tests not executed. ========================================================================== jenkins-commons-jexl-1.1-jenkins-20111212/.hgignore0000664000175000017500000000007211671435474022245 0ustar jamespagejamespagecommons-jexl.iml commons-jexl.ipr commons-jexl.iws target jenkins-commons-jexl-1.1-jenkins-20111212/project.xml0000664000175000017500000001550411671435474022640 0ustar jamespagejamespage 3 commons-jexl commons-jexl 2003 1.1-hudson-20061106 Commons JEXL Commons JEXL Expression Language Engine Jexl is an implementation of the JSTL Expression Language with extensions. /images/jexl-logo-white.png http://jakarta.apache.org/commons/jexl/ org.apache.commons.jexl The Apache Software Foundation http://jakarta.apache.org http://jakarta.apache.org/images/jakarta-logo.gif The Apache Software License, Version 2.0 /LICENSE.txt repo jakarta http://issues.apache.org/jira/ people.apache.org /www/jakarta.apache.org/commons/jexl/ /www/jakarta.apache.org/builds/jakarta-commons/jexl/ scm:svn:http://svn.apache.org/repos/asf/jakarta/commons/proper/jexl/trunk scm:svn:https://svn.apache.org/repos/asf/jakarta/commons/proper/jexl/trunk http://svn.apache.org/repos/asf/jakarta/commons/proper/jexl/trunk Commons Dev List commons-dev-subscribe@jakarta.apache.org commons-dev-unsubscribe@jakarta.apache.org http://mail-archives.apache.org/mod_mbox/jakarta-commons-dev/ Commons User List commons-user-subscribe@jakarta.apache.org commons-user-unsubscribe@jakarta.apache.org http://mail-archives.apache.org/mod_mbox/jakarta-commons-user/ 1.1 1.1 COMMONS_JEXL-1_1 1.0 1.0 COMMONS_JEXL-1_0 dIon Gillard dion dion@apache.org Apache Software Foundation Geir Magnusson Jr. geirm geirm@apache.org independent Tim O'Brien tobrien tobrien@apache.org independent Peter Royal proyal proyal@apache.org Pace Systems Group, Inc. James Strachan jstrachan jstrachan@apache.org SpiritSoft, Inc. Rahul Akolkar rahul rahul AT apache.org Apache Software Foundation commons-logging commons-logging 1.0.3 http://jakarta.apache.org/commons/logging/ <strong>Required</strong> junit junit 3.8.1 http://www.junit.org/ <strong>Test Only</strong> maven maven-xdoc-plugin 1.9.2 http://maven.apache.org/maven-1.x/reference/plugins/xdoc/ plugin <strong>Site Only</strong> - v1.9.2 (minimum) maven-plugins maven-findbugs-plugin 1.1 http://maven-plugins.sourceforge.net/maven-findbugs-plugin/ plugin <strong>Site Only</strong> - v1.1 (minimum) commons-dev@jakarta.apache.org src/java src/test **/*Test.java maven-changes-plugin maven-checkstyle-plugin maven-javadoc-plugin maven-jcoverage-plugin maven-jdepend-plugin maven-junit-report-plugin maven-jxr-plugin maven-license-plugin maven-pmd-plugin maven-tasklist-plugin jenkins-commons-jexl-1.1-jenkins-20111212/PROPOSAL.html0000664000175000017500000000417611671435474022600 0ustar jamespagejamespage Proposal for Jexl Package

Proposal for Jexl Package

(0) Rationale

The Jexl package implements a simple expression language for accessing Java objects.

(1) Scope of the Package

The package will create and maintain a number of classes for implementing a simple expression language and processing engine, and to be distributed under the ASF license.

(1.5) Interaction With Other Packages

Jexl relies on standard JDK 1.2 (or later) APIs for production deployment.

Jexl utilizes the JUnit unit testing framework for developing and executing unit tests, but this is of interest only to developers of the component.

Jexl also depends on Jakarta Velocity, Commons Logging, dom4j and Velocity DVSL for documentation rendering.

(2) Initial Source of the Package

The code base is new and uses ideas from Jakarta Velocity.

The proposed package name for the new component is org.apache.commons.jexl.

(3) Required Jakarta-Commons Resources

  • CVS Repository - New directory jexl in the jakarta-commons CVS repository. All initial committers are already committers on jakarta-commons, so no additional user setups are required.
  • Mailing List - Discussions will take place on the general jakarta-commons@jakarta.apache.org mailing list. To help list subscribers identify messages of interest, it is suggested that the message subject of messages about this component be prefixed with [Jexl]. Strongly suggested.
  • Bugzilla - New component "Jexl" under the "Commons" product category, with appropriate version identifiers as needed.
  • Jyve FAQ - New category "commons-jexl" (when available).

(4) Initial Committers

  • Geir Magnusson Jr.
  • James Strachan
jenkins-commons-jexl-1.1-jenkins-20111212/build-maven.xml0000664000175000017500000000735611671435474023403 0ustar jamespagejamespage