org.hfbk.util.Scripter Class Reference

Inheritance diagram for org.hfbk.util.Scripter:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 Scripter ()
void put (String name, Object object)
Object evaluate (String script) throws EvaluatorException, EcmaError
ScriptFunction getFunction (String name)
void source (String url)

Package Attributes

Scriptable scope
Context context
HashMap< String, Object > params = new HashMap<String, Object>()

Classes

class  ScriptFunction

Detailed Description

convenient ECMAScript engine (uses Mozilla Rhino).

ECMAScript code stored in a String can be evaluated via evaluate(..). java objects can be put into the script's top scope via put(..).

as the string needs to be interpreted everytime evaluate() is called, there is also the possibility to call an ECMAScript function defined via evaluate(). This Function is compiled only once at definition time and can be obtained by getFunction(), and evaluated on given arguments with their call(..) method.

Author:
paul

Definition at line 37 of file Scripter.java.


Constructor & Destructor Documentation

org.hfbk.util.Scripter.Scripter (  ) 

Definition at line 44 of file Scripter.java.

References org.hfbk.util.Scripter.context, and org.hfbk.util.Scripter.scope.


Member Function Documentation

void org.hfbk.util.Scripter.put ( String  name,
Object  object 
)

make a java Object visible to the script's top scope.

Parameters:
name ECMAScript variable name the object is assigned to.
object the Object to put.

Definition at line 55 of file Scripter.java.

References org.hfbk.util.Scripter.params.

Referenced by org.hfbk.vis.visnode.VisScript.renderSelf(), org.hfbk.util.ScriptShell.ScriptShell(), and org.hfbk.vis.VisClientScripter.VisClientScripter().

Here is the caller graph for this function:

Object org.hfbk.util.Scripter.evaluate ( String  script  )  throws EvaluatorException, EcmaError

invoke given script, returning the object that results, if any. doesn't catch errors.

Parameters:
script the ECMAScript code
Exceptions:
EvaluatorException if the script could not be parsed propperly.
EcmaError if the script execution fails at runtime.
Returns:
script return value, if any.

Definition at line 67 of file Scripter.java.

References org.hfbk.util.Scripter.context, org.hfbk.util.Scripter.params, and org.hfbk.util.Scripter.scope.

Referenced by org.hfbk.vis.visnode.VisScript.renderSelf(), org.hfbk.vis.UdpListener.script(), org.hfbk.util.ScriptShell.ScriptShell(), org.hfbk.util.Scripter.source(), org.hfbk.vis.ScriptRouter.updateRoutes(), org.hfbk.vis.VisClientScripter.VisClientScripter(), and org.hfbk.vis.visnode.VisFunction.VisFunction().

Here is the caller graph for this function:

ScriptFunction org.hfbk.util.Scripter.getFunction ( String  name  ) 

gets the named script Function which needs to be defined by evaluating an ECMAScript function definition before.

Returns:
a ScriptFunction or null if function name is not defined.

Definition at line 85 of file Scripter.java.

References org.hfbk.util.Scripter.context, and org.hfbk.util.Scripter.scope.

Referenced by org.hfbk.vis.ScriptRouter.dispatch(), org.hfbk.vis.visnode.VisFunction.heightMap(), and org.hfbk.vis.visnode.VisScript.renderSelf().

Here is the caller graph for this function:

void org.hfbk.util.Scripter.source ( String  url  ) 

Definition at line 107 of file Scripter.java.

References org.hfbk.util.Scripter.evaluate().

Referenced by org.hfbk.vis.VisClientWindow.buildScriptsMenu().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Scriptable org.hfbk.util.Scripter.scope [package]

Definition at line 39 of file Scripter.java.

Referenced by org.hfbk.util.Scripter.ScriptFunction.call(), org.hfbk.util.Scripter.evaluate(), org.hfbk.util.Scripter.getFunction(), and org.hfbk.util.Scripter.Scripter().

Context org.hfbk.util.Scripter.context [package]

Definition at line 40 of file Scripter.java.

Referenced by org.hfbk.util.Scripter.ScriptFunction.call(), org.hfbk.util.Scripter.evaluate(), org.hfbk.util.Scripter.getFunction(), and org.hfbk.util.Scripter.Scripter().

HashMap<String,Object> org.hfbk.util.Scripter.params = new HashMap<String, Object>() [package]

Definition at line 42 of file Scripter.java.

Referenced by org.hfbk.util.Scripter.evaluate(), and org.hfbk.util.Scripter.put().


The documentation for this class was generated from the following file:
Generated on Tue Apr 7 17:57:49 2009 for visclient by  doxygen 1.5.1