org.eclipse.higgins.util.jscript
Class JScriptScope

java.lang.Object
  extended byorg.eclipse.higgins.util.jscript.JScriptScope

public class JScriptScope
extends Object

Simplified representation of a Rhino scope for JavaScript evaluation. This allows multiple JavaScript fragments to be compiled and evaluated within a global shared scope, reusing functions and variables as appropriate. For further information on scopes please refer to the Mozilla documentation. Critical exceptions are logged as errors via commons logging

Author:
dbuss@novell.com

Constructor Summary
JScriptScope()
          Default constructor for a shared JavaScript Scope This should only be done during startup to prevent syncronization problems.
 
Method Summary
 void addToScope(String scriptText, String scriptID)
          Parses, complies and evaluates the script, the output of the script should result in the shared scope containing global variables.
 org.mozilla.javascript.ScriptableObject getScope()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JScriptScope

public JScriptScope()
Default constructor for a shared JavaScript Scope This should only be done during startup to prevent syncronization problems.

Method Detail

addToScope

public void addToScope(String scriptText,
                       String scriptID)
                throws JScriptException
Parses, complies and evaluates the script, the output of the script should result in the shared scope containing global variables. All Scripts should be added to the scope before it is used.

Parameters:
scriptText - - string version of a JavaScript
scriptID - - and identifier for the script
Throws:
JScriptException

getScope

public org.mozilla.javascript.ScriptableObject getScope()
Returns:
An instance of a scope suitable for calls to Rhino. Currently we setup the scope such that it can be used for calling back and forth to JAVA.