Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlSandbox.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlSandbox.java?rev=1718634&r1=1718633&r2=1718634&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlSandbox.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlSandbox.java Tue Dec 8 15:34:27 2015 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.jexl3.introspection; import java.util.HashMap; @@ -26,39 +27,34 @@ import java.util.Set; * through "whitelists" and "blacklists". * * <p>A <b>whitelist</b> explicitly allows methods/properties for a class;</p> + * * <ul> - * <li> - * If a whitelist is empty and thus does not contain any names, all properties/methods are allowed for its class. - * </li> - * <li> - * If it is not empty, the only allowed properties/methods are the ones contained. - * </li> + * <li>If a whitelist is empty and thus does not contain any names, all properties/methods are allowed for its class.</li> + * <li>If it is not empty, the only allowed properties/methods are the ones contained.</li> * </ul> * * <p>A <b>blacklist</b> explicitly forbids methods/properties for a class;</p> + * * <ul> - * <li> - * If a blacklist is empty and thus does not contain any names, all properties/methods are forbidden for its class. - * </li> - * <li> - * If it is not empty, the only forbidden properties/methods are the ones contained. - * </li> + * <li>If a blacklist is empty and thus does not contain any names, all properties/methods are forbidden for its class.</li> + * <li>If it is not empty, the only forbidden properties/methods are the ones contained.</li> * </ul> * * <p>Permissions are composed of three lists, read, write, execute, each being "white" or "black":</p> + * * <ul> - * <li><b>read</b> controls readable properties </li> - * <li><b>write</b> controls writeable properties</li> - * <li><b>execute</b> controls executable methods and constructor</li> + * <li><b>read</b> controls readable properties </li> + * <li><b>write</b> controls writeable properties</li> + * <li><b>execute</b> controls executable methods and constructor</li> * </ul> * - * <p> - * Note that a JexlUberspect allways uses a copy of the JexlSandbox used to built it to avoid synchronization and/or - * concurrent modifications at runtime. - * </p> + * <p>Note that a JexlUberspect allways uses a copy of the JexlSandbox used to built it to avoid synchronization and/or + * concurrent modifications at runtime.</p> + * * @since 3.0 */ public final class JexlSandbox { + /** * The map from class names to permissions. */ @@ -73,6 +69,7 @@ public final class JexlSandbox { /** * Creates a sandbox based on an existing permissions map. + * * @param map the permissions map */ protected JexlSandbox(Map<String, Permissions> map) { @@ -92,6 +89,7 @@ public final class JexlSandbox { /** * Gets the read permission value for a given property of a class. + * * @param clazz the class * @param name the property name * @return null if not allowed, the name of the property to use otherwise @@ -102,6 +100,7 @@ public final class JexlSandbox { /** * Gets the read permission value for a given property of a class. + * * @param clazz the class name * @param name the property name * @return null if not allowed, the name of the property to use otherwise @@ -117,6 +116,7 @@ public final class JexlSandbox { /** * Gets the write permission value for a given property of a class. + * * @param clazz the class * @param name the property name * @return null if not allowed, the name of the property to use otherwise @@ -127,6 +127,7 @@ public final class JexlSandbox { /** * Gets the write permission value for a given property of a class. + * * @param clazz the class name * @param name the property name * @return null if not allowed, the name of the property to use otherwise @@ -142,6 +143,7 @@ public final class JexlSandbox { /** * Gets the execute permission value for a given method of a class. + * * @param clazz the class * @param name the method name * @return null if not allowed, the name of the method to use otherwise @@ -152,6 +154,7 @@ public final class JexlSandbox { /** * Gets the execute permission value for a given method of a class. + * * @param clazz the class name * @param name the method name * @return null if not allowed, the name of the method to use otherwise @@ -169,8 +172,10 @@ public final class JexlSandbox { * A base set of names. */ public abstract static class Names { + /** * Adds a name to this set. + * * @param name the name to add * @return true if the name was really added, false if not */ @@ -179,6 +184,7 @@ public final class JexlSandbox { /** * Adds an alias to a name to this set. * <p>This only has an effect on white lists.</p> + * * @param name the name to alias * @param alias the alias * @return true if the alias was added, false if it was already present @@ -189,6 +195,7 @@ public final class JexlSandbox { /** * Whether a given name is allowed or not. + * * @param name the method/property name to check * @return null if not allowed, the actual name to use otherwise */ @@ -203,6 +210,7 @@ public final class JexlSandbox { return this; } } + /** * The pass-thru name set. */ @@ -290,15 +298,19 @@ public final class JexlSandbox { * Contains the white or black lists for properties and methods for a given class. */ public static final class Permissions { + /** The controlled readable properties. */ private final Names read; + /** The controlled writeable properties. */ private final Names write; + /** The controlled methods. */ private final Names execute; /** * Creates a new permissions instance. + * * @param readFlag whether the read property list is white or black * @param writeFlag whether the write property list is white or black * @param executeFlag whether the method list is white of black @@ -311,6 +323,7 @@ public final class JexlSandbox { /** * Creates a new permissions instance. + * * @param nread the read set * @param nwrite the write set * @param nexecute the method set @@ -330,6 +343,7 @@ public final class JexlSandbox { /** * Adds a list of readable property names to these permissions. + * * @param pnames the property names * @return this instance of permissions */ @@ -342,6 +356,7 @@ public final class JexlSandbox { /** * Adds a list of writeable property names to these permissions. + * * @param pnames the property names * @return this instance of permissions */ @@ -355,6 +370,7 @@ public final class JexlSandbox { /** * Adds a list of executable methods names to these permissions. * <p>The constructor is denoted as the empty-string, all other methods by their names.</p> + * * @param mnames the method names * @return this instance of permissions */ @@ -367,6 +383,7 @@ public final class JexlSandbox { /** * Gets the set of readable property names in these permissions. + * * @return the set of property names */ public Names read() { @@ -375,6 +392,7 @@ public final class JexlSandbox { /** * Gets the set of writeable property names in these permissions. + * * @return the set of property names */ public Names write() { @@ -383,6 +401,7 @@ public final class JexlSandbox { /** * Gets the set of method names in these permissions. + * * @return the set of method names */ public Names execute() { @@ -396,6 +415,7 @@ public final class JexlSandbox { /** * Creates the set of permissions for a given class. + * * @param clazz the class for which these permissions apply * @param readFlag whether the readable property list is white - true - or black - false - * @param writeFlag whether the writeable property list is white - true - or black - false - @@ -410,6 +430,7 @@ public final class JexlSandbox { /** * Creates a new set of permissions based on white lists for methods and properties for a given class. + * * @param clazz the whitened class name * @return the permissions instance */ @@ -419,6 +440,7 @@ public final class JexlSandbox { /** * Creates a new set of permissions based on black lists for methods and properties for a given class. + * * @param clazz the blackened class name * @return the permissions instance */ @@ -428,6 +450,7 @@ public final class JexlSandbox { /** * Gets the set of permissions associated to a class. + * * @param clazz the class name * @return the defined permissions or an all-white permission instance if none were defined */
Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlUberspect.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlUberspect.java?rev=1718634&r1=1718633&r2=1718634&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlUberspect.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/introspection/JexlUberspect.java Tue Dec 8 15:34:27 2015 @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.commons.jexl3.introspection; import org.apache.commons.jexl3.JexlArithmetic; @@ -38,14 +39,17 @@ public interface JexlUberspect { * These are used through 'strategies' to solve properties; a strategy orders a list of resolver types, * and each resolver type is tried in sequence; the first resolver that discovers a non null {s,g}etter * stops the search. + * * @see JexlResolver * @see JexlUberspect#getPropertyGet * @see JexlUberspect#getPropertySet * @since 3.0 */ interface PropertyResolver { + /** * Gets a property getter. + * * @param uber the uberspect * @param obj the object * @param identifier the property identifier @@ -55,6 +59,7 @@ public interface JexlUberspect { /** * Gets a property setter. + * * @param uber the uberspect * @param obj the object * @param identifier the property identifier @@ -69,33 +74,26 @@ public interface JexlUberspect { * <p> * Each resolver discovers how to set/get a property with different techniques; seeking * method names or field names, etc. + * * @since 3.0 */ enum JexlResolver implements PropertyResolver { - /** - * Seeks methods named get{P,p}property and is{P,p}property. - */ + /** Seeks methods named get{P,p}property and is{P,p}property. */ PROPERTY, - /** - * Seeks map methods get/put. - */ + + /** Seeks map methods get/put. */ MAP, - /** - * Seeks list methods get/set. - */ + + /** Seeks list methods get/set. */ LIST, - /** - * Seeks any get/{set,put} method (quacking like a list or a map). - */ + + /** Seeks any get/{set,put} method (quacking like a list or a map). */ DUCK, - /** - * Seeks public instance members. - */ + + /** Seeks public instance members.*/ FIELD, - /** - * Seeks a getContainer(property) and setContainer(property, value) - * as in <code>x.container.property</code>. - */ + + /** Seeks a getContainer(property) and setContainer(property, value) as in <code>x.container.property</code>. */ CONTAINER; @Override @@ -147,7 +145,7 @@ public interface JexlUberspect { interface ResolverStrategy { /** * Applies this strategy to a list of resolver types. - * <p> + * * @param operator the property access operator, may be null * @param obj the instance we seek to obtain a property setter/getter from, can not be null * @return the ordered list of resolvers types, must not be null @@ -179,9 +177,9 @@ public interface JexlUberspect { /** * The map strategy. - * <p> - * If the operator is '[]' or if the object is a map, use the MAP list of resolvers. - * Otherwise, use the POJO list of resolvers. + * + * <p>If the operator is '[]' or if the object is a map, use the MAP list of resolvers. + * Otherwise, use the POJO list of resolvers.</p> */ ResolverStrategy MAP_STRATEGY = new ResolverStrategy() { @Override @@ -201,6 +199,7 @@ public interface JexlUberspect { /** * Applies this uberspect property resolver strategy. + * * @param op the operator * @param obj the object * @return the applied strategy resolver list @@ -209,20 +208,23 @@ public interface JexlUberspect { /** * Sets the class loader to use. - * <p> - * This increments the version.</p> + * + * <p>This increments the version.</p> + * * @param loader the class loader */ void setClassLoader(ClassLoader loader); /** * Gets this uberspect version. + * * @return the class loader modification count */ int getVersion(); /** * Returns a class constructor. + * * @param ctorHandle a class or class name * @param args constructor arguments * @return a {@link JexlMethod} @@ -232,6 +234,7 @@ public interface JexlUberspect { /** * Returns a JexlMethod. + * * @param obj the object * @param method the method name * @param args method arguments @@ -241,8 +244,9 @@ public interface JexlUberspect { /** * Property getter. - * <p> - * returns a JelPropertySet apropos to an expression like <code>bar.woogie</code>.</p> + * + * <p>returns a JelPropertySet apropos to an expression like <code>bar.woogie</code>.</p> + * * @param obj the object to get the property from * @param identifier property name * @return a {@link JexlPropertyGet} or null @@ -267,6 +271,7 @@ public interface JexlUberspect { * Property setter. * <p> * Seeks a JelPropertySet apropos to an expression like <code>foo.bar = "geir"</code>.</p> + * * @param obj the object to get the property from. * @param identifier property name * @param arg value to set @@ -291,6 +296,7 @@ public interface JexlUberspect { /** * Gets an iterator from an object. + * * @param obj to get the iterator from * @return an iterator over obj or null */ @@ -298,6 +304,7 @@ public interface JexlUberspect { /** * Gets an arithmetic operator resolver for a given arithmetic instance. + * * @param arithmetic the arithmetic instance * @return the arithmetic uberspect or null if no operator method were overridden * @since 3.0 Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngine.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngine.java?rev=1718634&r1=1718633&r2=1718634&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngine.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngine.java Tue Dec 8 15:34:27 2015 @@ -58,9 +58,11 @@ import org.apache.commons.logging.LogFac * See * <a href="http://java.sun.com/javase/6/docs/api/javax/script/package-summary.html">Java Scripting API</a> * Javadoc. + * * @since 2.0 */ public class JexlScriptEngine extends AbstractScriptEngine implements Compilable { + /** The logger. */ private static final Log LOG = LogFactory.getLog(JexlScriptEngine.class); @@ -97,22 +99,25 @@ public class JexlScriptEngine extends Ab * Those properties are allways bound to the default engine scope context. * * <p>The following properties are defined:</p> + * * <ul> - * <li>in - refers to the engine scope reader that defaults to reading System.err</li> - * <li>out - refers the engine scope writer that defaults to writing in System.out</li> - * <li>err - refers to the engine scope writer that defaults to writing in System.err</li> - * <li>logger - the JexlScriptEngine logger</li> - * <li>System - the System.class</li> + * <li>in - refers to the engine scope reader that defaults to reading System.err</li> + * <li>out - refers the engine scope writer that defaults to writing in System.out</li> + * <li>err - refers to the engine scope writer that defaults to writing in System.err</li> + * <li>logger - the JexlScriptEngine logger</li> + * <li>System - the System.class</li> * </ul> * * @since 2.0 */ public class JexlScriptObject { + /** * Gives access to the underlying JEXL engine shared between all ScriptEngine instances. * <p>Although this allows to manipulate various engine flags (lenient, debug, cache...) * for <strong>all</strong> JexlScriptEngine instances, you probably should only do so * if you are in strict control and sole user of the JEXL scripting feature.</p> + * * @return the shared underlying JEXL engine */ public JexlEngine getEngine() { @@ -121,6 +126,7 @@ public class JexlScriptEngine extends Ab /** * Gives access to the engine scope output writer (defaults to System.out). + * * @return the engine output writer */ public PrintWriter getOut() { @@ -136,6 +142,7 @@ public class JexlScriptEngine extends Ab /** * Gives access to the engine scope error writer (defaults to System.err). + * * @return the engine error writer */ public PrintWriter getErr() { @@ -151,6 +158,7 @@ public class JexlScriptEngine extends Ab /** * Gives access to the engine scope input reader (defaults to System.in). + * * @return the engine input reader */ public Reader getIn() { @@ -159,6 +167,7 @@ public class JexlScriptEngine extends Ab /** * Gives access to System class. + * * @return System.class */ public Class<System> getSystem() { @@ -167,6 +176,7 @@ public class JexlScriptEngine extends Ab /** * Gives access to the engine logger. + * * @return the JexlScriptEngine logger */ public Log getLogger() { @@ -221,7 +231,6 @@ public class JexlScriptEngine extends Ab } } - /** {@inheritDoc} */ @Override public ScriptEngineFactory getFactory() { return parentFactory; @@ -253,6 +262,7 @@ public class JexlScriptEngine extends Ab /** * Read from a reader into a local buffer and return a String with * the contents of the reader. + * * @param scriptReader to be read. * @return the contents of the reader as a String. * @throws ScriptException on any error reading the reader. @@ -282,6 +292,7 @@ public class JexlScriptEngine extends Ab private static class FactorySingletonHolder { /** non instantiable. */ private FactorySingletonHolder() {} + /** The engine factory singleton instance. */ private static final JexlScriptEngineFactory DEFAULT_FACTORY = new JexlScriptEngineFactory(); } @@ -293,6 +304,7 @@ public class JexlScriptEngine extends Ab private static class EngineSingletonHolder { /** non instantiable. */ private EngineSingletonHolder() {} + /** The JEXL engine singleton instance. */ private static final JexlEngine DEFAULT_ENGINE = new JexlBuilder().logger(LOG).cache(CACHE_SIZE).create(); } @@ -305,8 +317,10 @@ public class JexlScriptEngine extends Ab private final class JexlContextWrapper implements JexlContext { /** The wrapped script context. */ private final ScriptContext scriptContext; + /** * Creates a context wrapper. + * * @param theContext the engine context. */ private JexlContextWrapper (final ScriptContext theContext){ @@ -351,19 +365,18 @@ public class JexlScriptEngine extends Ab /** * Creates an instance. + * * @param theScript to wrap */ private JexlCompiledScript(final JexlScript theScript) { script = theScript; } - /** {@inheritDoc} */ @Override public String toString() { return script.getSourceText(); } - /** {@inheritDoc} */ @Override public Object eval(final ScriptContext context) throws ScriptException { // This is mandated by JSR-223 (end of section SCR.4.3.4.1.2 - JexlScript Execution) @@ -376,12 +389,9 @@ public class JexlScriptEngine extends Ab } } - /** {@inheritDoc} */ @Override public ScriptEngine getEngine() { return JexlScriptEngine.this; } } - - } Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngineFactory.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngineFactory.java?rev=1718634&r1=1718633&r2=1718634&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngineFactory.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/JexlScriptEngineFactory.java Tue Dec 8 15:34:27 2015 @@ -37,6 +37,7 @@ import org.apache.commons.jexl3.parser.S * See * <a href="http://java.sun.com/javase/6/docs/api/javax/script/package-summary.html">Java Scripting API</a> * Javadoc. + * * @since 2.0 */ public class JexlScriptEngineFactory implements ScriptEngineFactory { Modified: commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/Main.java URL: http://svn.apache.org/viewvc/commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/Main.java?rev=1718634&r1=1718633&r2=1718634&view=diff ============================================================================== --- commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/Main.java (original) +++ commons/proper/jexl/trunk/src/main/java/org/apache/commons/jexl3/scripting/Main.java Tue Dec 8 15:34:27 2015 @@ -28,11 +28,14 @@ import javax.script.ScriptException; /** * Test application for JexlScriptEngine (JSR-223 implementation). + * * @since 2.0 */ public class Main { + /** * Reads an input. + * * @param charset the charset or null for default charset * @param fileName the file name or null for stdin * @return the reader