|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ScriptingEngine
This is the interface that must be implemented to make a scripting environment usable by the Helma application server. Implementations of this interface must have a public zero-argument constructor to be usable by the Helma framework.
Field Summary | |
---|---|
static int |
ARGS_WRAP_DEFAULT
Argument wrapping mode that indicates arguments may be arbitrary Java objects that may need to be wrapped. |
static int |
ARGS_WRAP_NONE
Argument wrapping mode that indicates arguments are wrapped already and should be passed along unchanged. |
static int |
ARGS_WRAP_XMLRPC
Argument wrapping mode that indicates this is an XML-RPC call and arguments should be processed accordingly. |
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 when an execution context for a request evaluation 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. |
DocApplication |
getDoc()
Get an IPathElement that offers introspection services into the application. |
java.lang.Object |
getProperty(java.lang.Object thisObject,
java.lang.String propertyName)
Get a property on an object |
boolean |
hasFunction(java.lang.Object thisObject,
java.lang.String functionName,
boolean resolve)
Return true if a function by that name is defined for that object. |
boolean |
hasProperty(java.lang.Object thisObject,
java.lang.String propertyName)
Return true if a property by that name is defined for that object. |
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. |
java.lang.String |
toString(java.lang.Object obj)
Return a string representation for the given object |
Field Detail |
---|
static final int ARGS_WRAP_NONE
static final int ARGS_WRAP_DEFAULT
static final int ARGS_WRAP_XMLRPC
Method Detail |
---|
void init(Application app, RequestEvaluator reval)
app
- the applicationreval
- the request evaluatorvoid shutdown()
void enterContext() throws java.io.IOException, ScriptingException
java.io.IOException
- an I/O exception occurred
ScriptingException
- a script related exception occurredvoid setGlobals(java.util.Map globals) throws ScriptingException
globals
- map of global variables
ScriptingException
- a script related exception occurredvoid exitContext()
java.lang.Object invoke(java.lang.Object thisObject, java.lang.Object function, java.lang.Object[] args, int argsWrapMode, boolean resolve) throws ScriptingException
thisObject
- the object to invoke the function on, or null for
global functionsfunction
- the 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 invocationvoid abort()
java.lang.Object getProperty(java.lang.Object thisObject, java.lang.String propertyName)
thisObject
- the objectpropertyName
- the property name
boolean hasFunction(java.lang.Object thisObject, java.lang.String functionName, boolean resolve)
thisObject
- the objectfunctionName
- the function nameresolve
- if member path in function name should be resolved
boolean hasProperty(java.lang.Object thisObject, java.lang.String propertyName)
thisObject
- the objectpropertyName
- the property name
boolean isTypedObject(java.lang.Object obj)
obj
- an object
java.lang.String toString(java.lang.Object obj)
obj
- an object
DocApplication getDoc()
void serialize(java.lang.Object obj, java.io.OutputStream out) throws java.io.IOException
obj
- the object to serializeout
- the stream to write to
java.io.IOException
java.lang.Object deserialize(java.io.InputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
in
- the stream to read from
java.io.IOException
java.lang.ClassNotFoundException
void injectCodeResource(java.lang.String typename, Resource resource)
typename
- the type this resource belongs toresource
- a code resource
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |