MetaDone
metadone.metabusiness.script.js.JSEvaluator Class Reference
Inheritance diagram for metadone.metabusiness.script.js.JSEvaluator:
Collaboration diagram for metadone.metabusiness.script.js.JSEvaluator:

List of all members.

Public Member Functions

 JSEvaluator ()
void declareVariable (String name, Object value)
void clearVariables ()
void reset ()
synchronized ScriptResult evaluate (String script)
final ProgLanguage getLanguage ()
String toString ()

Static Public Attributes

static final String WRAP_COLLECTIONS = "wrap.collections"
static final String COMPILER_OPTIMIZATION_LEVEL = "compiler.optimization_level"

Protected Member Functions

Object getSecurityDomain ()
synchronized void checkConfiguration () throws Exception
void initContext (Context cx)
ScriptableObject createScope (Context cx)
void updateScope (Context cx, Scriptable scope)
synchronized Context enterContext ()
synchronized void exitContext ()
synchronized Scriptable getScope ()

Protected Attributes

final Map< String, Object > variables = new HashMap<String, Object>()

Private Attributes

volatile Context jsContext = null
volatile Scriptable jsScope = null
volatile boolean jsUpdateScope = true

Static Private Attributes

static final Logger logger = Logger.getLogger(JSEvaluator.class)

Detailed Description

A JavaScript evaluator based on Rhino.

Author:
kma

Constructor & Destructor Documentation

metadone.metabusiness.script.js.JSEvaluator.JSEvaluator ( )

Member Function Documentation

synchronized void metadone.metabusiness.script.js.JSEvaluator.checkConfiguration ( ) throws Exception [protected]

Checks the configuration before running a script.

Exceptions:
Exceptionwhen the class is not configured properly

Referenced by metadone.metabusiness.script.js.JSEvaluator.evaluate().

void metadone.metabusiness.script.js.JSEvaluator.clearVariables ( )
ScriptableObject metadone.metabusiness.script.js.JSEvaluator.createScope ( Context  cx) [protected]

Creates and updates a new scope.

Parameters:
cxThe context
Returns:
A new updated scope

References metadone.metabusiness.script.js.JSEvaluator.updateScope().

Referenced by metadone.metabusiness.script.js.JSEvaluator.getScope().

void metadone.metabusiness.script.js.JSEvaluator.declareVariable ( String  name,
Object  value 
)

Declares a new variable called name and sets it to value.

updateContext() should be called afterwards.

Parameters:
nameThe name of the variable
valueThe new value
Exceptions:
NullPointerExceptionwhen name is null

Implements metadone.metabusiness.script.ScriptEvaluator.

References metadone.metabusiness.script.js.JSEvaluator.jsUpdateScope, and metadone.metabusiness.script.js.JSEvaluator.variables.

synchronized Context metadone.metabusiness.script.js.JSEvaluator.enterContext ( ) [protected]
synchronized void metadone.metabusiness.script.js.JSEvaluator.exitContext ( ) [protected]

Exits the current context.

Referenced by metadone.metabusiness.script.js.JSEvaluator.evaluate().

final ProgLanguage metadone.metabusiness.script.js.JSEvaluator.getLanguage ( )

Gets the evaluated language.

Returns:
The language

Implements metadone.metabusiness.script.ScriptEvaluator.

synchronized Scriptable metadone.metabusiness.script.js.JSEvaluator.getScope ( ) [protected]
Object metadone.metabusiness.script.js.JSEvaluator.getSecurityDomain ( ) [protected]

Gets the security domain used to run the script.

Returns:
A security domain or null

Referenced by metadone.metabusiness.script.js.JSEvaluator.evaluate().

String metadone.metabusiness.script.js.JSEvaluator.toString ( )
void metadone.metabusiness.script.js.JSEvaluator.updateScope ( Context  cx,
Scriptable  scope 
) [protected]

Sets the required parameters for this scope.

Parameters:
cxThe context
scopeThe scope

References metadone.metabusiness.script.js.JSEvaluator.variables.

Referenced by metadone.metabusiness.script.js.JSEvaluator.createScope(), and metadone.metabusiness.script.js.JSEvaluator.getScope().


Member Data Documentation

final Logger metadone.metabusiness.script.js.JSEvaluator.logger = Logger.getLogger(JSEvaluator.class) [static, private]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations