org.apache.batik.script.rhino
public class RhinoInterpreter extends Object implements Interpreter
Interpreter
interface to use
Rhino ECMAScript interpreter.
Nested Class Summary | |
---|---|
interface | RhinoInterpreter.ArgumentsBuilder
To build an argument list. |
protected static class | RhinoInterpreter.Entry
Class to store cached compiled scripts. |
protected class | RhinoInterpreter.Factory
Factory for Context objects. |
Field Summary | |
---|---|
static String | BIND_NAME_WINDOW
Name of the "window" object when referenced by scripts |
protected ClassShutter | classShutter
Class shutter. |
protected LinkedList | compiledScripts
List of cached compiled scripts. |
protected ContextFactory | contextFactory
Factory object for creating Contexts. |
protected static List | contexts
Context vector, to make sure we are not
setting the security context too many times |
protected Context | defaultContext
Default Context for scripts. |
protected ScriptableObject | globalObject
The global object. |
protected RhinoClassLoader | rhinoClassLoader
The Rhino 'security domain'. |
protected SecurityController | securityController
The SecurityController implementation for Batik,
which ensures scripts have access to the
server they were downloaded from |
static String | SOURCE_NAME_SVG
Constant used to describe an SVG source |
protected static String[] | TO_BE_IMPORTED
Java packages that will be imported into the scripting environment. |
protected Window | window
The window object. |
protected WrapFactory | wrapFactory
Factory for Java wrapper objects. |
Constructor Summary | |
---|---|
RhinoInterpreter(URL documentURL)
Build a Interpreter for ECMAScript using Rhino.
|
Method Summary | |
---|---|
void | bindObject(String name, Object object)
This method registers a particular Java Object in
the environment of the interpreter. |
protected ScriptableObject | createGlobalObject(Context ctx)
Creates the global object. |
protected void | defineGlobalWrapperClass(Scriptable global)
Defines the class for the global object. |
void | dispose()
For RhinoInterpreter this method flushes the
Rhino caches to avoid memory leaks. |
Object | evaluate(Reader scriptreader)
This method evaluates a piece of ECMAScript. |
Object | evaluate(Reader scriptReader, String description)
This method evaluates a piece of ECMAScript. |
Object | evaluate(String scriptStr)
This method evaluates a piece of ECMA script.
|
String | formatMessage(String key, Object[] args)
Creates and returns a localized message, given the key of the message, 0, data.length
in the resource bundle and the message parameters.
|
AccessControlContext | getAccessControlContext()
Returns the AccessControlContext associated with this Interpreter. |
ContextFactory | getContextFactory()
Returns the ContextFactory for this interpreter. |
protected ScriptableObject | getGlobalObject()
This method returns the ECMAScript global object used by this
interpreter. |
Locale | getLocale()
Returns the current locale or null if the locale currently used is
the default one. |
Window | getWindow()
Returns the window object for this interpreter. |
void | setLocale(Locale locale)
Provides a way to the user to specify a locale which override the
default one. |
void | setOut(Writer out)
By default Rhino has no output method in its language. |
Interpreter
for ECMAScript using Rhino.
Parameters: documentURL the URL for the document which references
See Also: Interpreter InterpreterPool
Object
in
the environment of the interpreter.Parameters: name the name of the script object to create object the Java object
RhinoInterpreter
this method flushes the
Rhino caches to avoid memory leaks.Parameters: scriptreader a java.io.Reader
on the piece of script
Returns: if no exception is thrown during the call, should return the value of the last expression evaluated in the script.
Parameters: scriptReader a java.io.Reader
on the piece of script description description which can be later used (e.g., for error
messages).
Returns: if no exception is thrown during the call, should return the value of the last expression evaluated in the script.
Parameters: scriptStr the piece of script
Returns: if no exception is thrown during the call, should return the value of the last expression evaluated in the script.
Parameters: key The key used to retreive the message from the resource bundle. args The objects that compose the message.
Throws: MissingResourceException if the key is not in the bundle.
See Also: RhinoClassLoader
Parameters: locale The locale to set.
Parameters: out the new out Writer
.