Package org.forgerock.script.javascript
Class RhinoScript
- java.lang.Object
-
- org.forgerock.script.javascript.RhinoScript
-
- All Implemented Interfaces:
org.forgerock.script.engine.CompiledScript
public class RhinoScript extends Object implements org.forgerock.script.engine.CompiledScript
A JavaScript script.This implementation pre-compiles the provided script. Any syntax errors in the source code will throw an exception during construction of the object.
-
-
Field Summary
Fields Modifier and Type Field Description static org.mozilla.javascript.tools.shell.GlobalGLOBAL
-
Constructor Summary
Constructors Constructor Description RhinoScript(String name, RhinoScriptEngine engine, org.mozilla.javascript.commonjs.module.RequireBuilder requireBuilder, boolean sharedScope)TEMPORARYRhinoScript(String name, org.mozilla.javascript.Script compiledScript, RhinoScriptEngine engine, org.mozilla.javascript.commonjs.module.RequireBuilder requireBuilder, boolean sharedScope)Compiles the JavaScript source code into an executable script.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objecteval(org.forgerock.services.context.Context ctx, Bindings request, Bindings... scopes)BindingsprepareBindings(org.forgerock.services.context.Context context, Bindings request, Bindings... scopes)
-
-
-
Constructor Detail
-
RhinoScript
public RhinoScript(String name, org.mozilla.javascript.Script compiledScript, RhinoScriptEngine engine, org.mozilla.javascript.commonjs.module.RequireBuilder requireBuilder, boolean sharedScope) throws ScriptException
Compiles the JavaScript source code into an executable script. IfuseSharedScopeistrue, then a sealed shared scope containing standard JavaScript objects (Object, String, Number, Date, etc.) will be used for script execution; otherwise a new unsealed scope will be allocated for each execution.- Parameters:
compiledScript- the source code of the JavaScript script.sharedScope- iftrue, uses the shared scope, otherwise allocates new scope.- Throws:
ScriptException- if there was an exception encountered while compiling the script.
-
RhinoScript
public RhinoScript(String name, RhinoScriptEngine engine, org.mozilla.javascript.commonjs.module.RequireBuilder requireBuilder, boolean sharedScope) throws ScriptException
TEMPORARY- Throws:
ScriptException
-
-
Method Detail
-
prepareBindings
public Bindings prepareBindings(org.forgerock.services.context.Context context, Bindings request, Bindings... scopes)
- Specified by:
prepareBindingsin interfaceorg.forgerock.script.engine.CompiledScript
-
eval
public Object eval(org.forgerock.services.context.Context ctx, Bindings request, Bindings... scopes) throws ScriptException
- Specified by:
evalin interfaceorg.forgerock.script.engine.CompiledScript- Throws:
ScriptException
-
-