public class ScriptingModule extends AbstractScriptModule
| Modifier and Type | Field and Description |
|---|---|
static String |
MODULE_ID
Module identifier.
|
| Constructor and Description |
|---|
ScriptingModule() |
| Modifier and Type | Method and Description |
|---|---|
static IScriptEngine |
createScriptEngine(String identifier)
Create a new script engine instance.
|
Object |
executeSync(Object monitor,
Object code)
Run a code fragment in a synchronized block.
|
IScriptEngine |
fork(Object resource,
String arguments,
String engineID)
Fork a new script engine and execute provided resource.
|
Object |
getSharedObject(String key)
Get an object from the shared object store.
|
static boolean |
join(IScriptEngine engine,
long timeout)
Wait for a script engine to shut down.
|
static String[] |
listScriptEngines()
Retrieve a list of available script engines.
|
static void |
notify(Object monitor)
Wakes up a single thread that is waiting on the monitor.
|
static void |
notifyAll(Object monitor)
Wakes up all threads that are waiting on the monitor.
|
void |
setSharedObject(String key,
Object object,
boolean permanent,
boolean writable)
Add an object to the shared object store.
|
static void |
wait(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. |
getScriptEngine, initializepublic static final String MODULE_ID
public static IScriptEngine createScriptEngine(String identifier)
identifier - engine ID, literal engine name or accepted file extensionnullpublic static String[] listScriptEngines()
public IScriptEngine fork(Object resource, @ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null") String arguments, @ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null") String engineID)
resource - resource to execute (path, URI or file instance)arguments - optional script arguments delimited by commas ','engineID - engine ID to be usednull in case of errorpublic static boolean join(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 Object executeSync(Object monitor, 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(Object monitor, @ScriptParameter(defaultValue="0") long timeout) throws 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)InterruptedException - when wait gets interruptedpublic static void notify(Object monitor)
monitor - monitor to notifypublic static void notifyAll(Object monitor)
monitor - monitor to notifypublic void setSharedObject(String key, Object object, @ScriptParameter(defaultValue="false") boolean permanent, @ScriptParameter(defaultValue="false") boolean writable) throws 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 valueIllegalAccessException - when scriptEngine is not the owner of the shared object