|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthelma.scripting.rhino.RhinoEngine
public class RhinoEngine
This is the implementation of ScriptingEnvironment for the Mozilla Rhino EcmaScript interpreter.
Field Summary | |
---|---|
Application |
app
|
Fields inherited from interface helma.scripting.ScriptingEngine |
---|
ARGS_WRAP_DEFAULT, ARGS_WRAP_NONE, ARGS_WRAP_XMLRPC |
Constructor Summary | |
---|---|
RhinoEngine()
Zero argument constructor. |
Method Summary | |
---|---|
void |
abort()
Let the evaluator know that the current evaluation has been aborted. |
java.lang.Object |
deserialize(java.io.InputStream in)
Provide object deserialization for this engine's scripted objects. |
void |
enterContext()
This method is called before an execution context is entered to let the engine know it should update its prototype information. |
void |
exitContext()
This method is called to let the scripting engine know that the current execution context has terminated. |
Application |
getApplication()
Return the application we're running in |
RhinoCore |
getCore()
Return the RhinoCore object for the application this engine belongs to. |
DocApplication |
getDoc()
Get an introspector to this engine. |
java.lang.Object |
getProperty(java.lang.Object obj,
java.lang.String propname)
Check if an object has a defined property (public field if it is a java object) with that name. |
RequestTrans |
getRequest()
Return the Request object of the current evaluation context. |
RequestEvaluator |
getRequestEvaluator()
Return the RequestEvaluator owningthis rhino engine. |
ResponseTrans |
getResponse()
Return the Response object of the current evaluation context. |
static RhinoEngine |
getRhinoEngine()
Return the RhinoEngine associated with the current thread, or null. |
Skin |
getSkin(java.lang.String protoName,
java.lang.String skinName)
Get a skin for the given prototype and skin name. |
boolean |
hasFunction(java.lang.Object obj,
java.lang.String fname,
boolean resolve)
Check if an object has a function property (public method if it is a java object) with that name. |
boolean |
hasProperty(java.lang.Object obj,
java.lang.String propname)
Check if an object has a value property defined with that name. |
void |
init(Application app,
RequestEvaluator reval)
Init the scripting engine with an application and a request evaluator |
void |
injectCodeResource(java.lang.String typename,
Resource resource)
Add a code resource to a given prototype by immediately compiling and evaluating it. |
java.lang.Object |
invoke(java.lang.Object thisObject,
java.lang.Object function,
java.lang.Object[] args,
int argsWrapMode,
boolean resolve)
Invoke a function on some object, using the given arguments and global vars. |
boolean |
isTypedObject(java.lang.Object obj)
Determine if the given object is mapped to a type of the scripting engine |
void |
serialize(java.lang.Object obj,
java.io.OutputStream out)
Provide object serialization for this engine's scripted objects. |
void |
setGlobals(java.util.Map globals)
This method is called when an execution context for a request evaluation is entered. |
void |
shutdown()
Shut down the scripting engine. |
Skin |
toSkin(java.lang.Object skinobj,
java.lang.String protoName)
Try to get a skin from the parameter object. |
java.lang.String |
toString(java.lang.Object obj)
Return a string representation for the given object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public Application app
Constructor Detail |
---|
public RhinoEngine()
Method Detail |
---|
public void init(Application app, RequestEvaluator reval)
init
in interface ScriptingEngine
app
- the applicationreval
- the request evaluatorpublic void shutdown()
shutdown
in interface ScriptingEngine
public static RhinoEngine getRhinoEngine()
public void enterContext() throws java.io.IOException
enterContext
in interface ScriptingEngine
java.io.IOException
- an I/O exception occurredpublic void setGlobals(java.util.Map globals) throws ScriptingException
setGlobals
in interface ScriptingEngine
globals
- map of global variables
ScriptingException
- a script related exception occurredpublic void exitContext()
exitContext
in interface ScriptingEngine
public java.lang.Object invoke(java.lang.Object thisObject, java.lang.Object function, java.lang.Object[] args, int argsWrapMode, boolean resolve) throws ScriptingException
invoke
in interface ScriptingEngine
thisObject
- the object to invoke the function on, or null for
global functionsfunction
- the function or name of the function to be invokedargs
- array of argument objectsargsWrapMode
- indicated the way to process the arguments. Must be
one of ARGS_WRAP_NONE
,
ARGS_WRAP_DEFAULT
,
ARGS_WRAP_XMLRPC
resolve
- indicates whether functionName may contain an object path
or just the plain function name
ScriptingException
- to indicate something went wrong
with the invocationpublic void abort()
abort
in interface ScriptingEngine
public boolean hasFunction(java.lang.Object obj, java.lang.String fname, boolean resolve)
hasFunction
in interface ScriptingEngine
obj
- the objectfname
- the function nameresolve
- if member path in function name should be resolved
public boolean hasProperty(java.lang.Object obj, java.lang.String propname)
hasProperty
in interface ScriptingEngine
obj
- the objectpropname
- the property name
public java.lang.Object getProperty(java.lang.Object obj, java.lang.String propname)
getProperty
in interface ScriptingEngine
obj
- the objectpropname
- the property name
public boolean isTypedObject(java.lang.Object obj)
isTypedObject
in interface ScriptingEngine
obj
- an object
public java.lang.String toString(java.lang.Object obj)
toString
in interface ScriptingEngine
obj
- an object
public DocApplication getDoc()
getDoc
in interface ScriptingEngine
public void serialize(java.lang.Object obj, java.io.OutputStream out) throws java.io.IOException
serialize
in interface ScriptingEngine
obj
- the object to serializeout
- the stream to write to
java.io.IOException
public java.lang.Object deserialize(java.io.InputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
deserialize
in interface ScriptingEngine
in
- the stream to read from
java.io.IOException
java.lang.ClassNotFoundException
public void injectCodeResource(java.lang.String typename, Resource resource)
injectCodeResource
in interface ScriptingEngine
typename
- the type this resource belongs toresource
- a code resourcepublic Application getApplication()
public RequestEvaluator getRequestEvaluator()
public ResponseTrans getResponse()
public RequestTrans getRequest()
public RhinoCore getCore()
public Skin toSkin(java.lang.Object skinobj, java.lang.String protoName) throws java.io.IOException
java.io.IOException
public Skin getSkin(java.lang.String protoName, java.lang.String skinName) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |