public class ScriptingModule
extends org.eclipse.ease.modules.AbstractScriptModule
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MODULE_ID
Module identifier.
|
Constructor and Description |
---|
ScriptingModule() |
Modifier and Type | Method and Description |
---|---|
static org.eclipse.ease.IScriptEngine |
createScriptEngine(java.lang.String identifier)
Create a new script engine instance.
|
java.lang.Object |
executeSync(java.lang.Object monitor,
java.lang.Object code)
Run a code fragment in a synchronized block.
|
org.eclipse.ease.ScriptResult |
fork(java.lang.Object resource,
java.lang.String arguments,
java.lang.String engineID)
Fork a new script engine and execute provided resource.
|
java.lang.Object |
getSharedObject(java.lang.String key)
Get an object from the shared object store.
|
static boolean |
join(org.eclipse.ease.IScriptEngine engine,
long timeout)
Wait for a script engine to shut down.
|
static java.lang.String[] |
listScriptEngines()
Retrieve a list of available script engines.
|
static void |
notify(java.lang.Object monitor)
Wakes up a single thread that is waiting on the monitor.
|
static void |
notifyAll(java.lang.Object monitor)
Wakes up all threads that are waiting on the monitor.
|
void |
setSharedObject(java.lang.String key,
java.lang.Object object,
boolean permanent,
boolean writable)
Add an object to the shared object store.
|
static void |
wait(java.lang.Object monitor,
long timeout)
Causes the current thread to wait until either another thread invokes the
Object.notify() method or the
Object.notifyAll() method for this object, or a specified amount of time has elapsed. |
public static final java.lang.String MODULE_ID
public static org.eclipse.ease.IScriptEngine createScriptEngine(java.lang.String identifier)
identifier
- engine ID, literal engine name or accepted file extensionnull
public static java.lang.String[] listScriptEngines()
public org.eclipse.ease.ScriptResult fork(java.lang.Object resource, @ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null") java.lang.String arguments, @ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null") java.lang.String engineID)
resource
- resource to execute (path, URI or file instance)arguments
- optional script arguments delimited by commas ','engineID
- engine ID to be usedpublic static boolean join(org.eclipse.ease.IScriptEngine engine, @ScriptParameter(defaultValue="0") long timeout)
engine
- script engine to wait fortimeout
- time to wait for shutdown [ms]true
when engine is shut downpublic java.lang.Object executeSync(java.lang.Object monitor, java.lang.Object code)
String
, File
, IFile
or any other object that can be adapted to IScriptable
.monitor
- monitor to synchronize oncode
- code to run.public static void wait(java.lang.Object monitor, @ScriptParameter(defaultValue="0") long timeout) throws java.lang.InterruptedException
Object.notify()
method or the
Object.notifyAll()
method for this object, or a specified amount of time has elapsed. Calls the java method monitor.wait(timeout).monitor
- monitor to wait fortimeout
- max timeout (0 does not time out)java.lang.InterruptedException
- when wait gets interruptedpublic static void notify(java.lang.Object monitor)
monitor
- monitor to notifypublic static void notifyAll(java.lang.Object monitor)
monitor
- monitor to notifypublic void setSharedObject(java.lang.String key, java.lang.Object object, @ScriptParameter(defaultValue="false") boolean permanent, @ScriptParameter(defaultValue="false") boolean writable) throws java.lang.IllegalAccessException
true
, this object will be stored forever.key
- key to store the objectobject
- instance to storepermanent
- flag indicating permanent storagewritable
- flag indicating that any engine may write this valuejava.lang.IllegalAccessException
- when scriptEngine is not the owner of the shared objectpublic java.lang.Object getSharedObject(java.lang.String key)
key
- key to retrieve object fornull