Scripting Module

Commands to launch additional script engines.

Method Overview

Method Description
createScriptEngine() Create a new script engine instance.
executeSync() Run a code fragment in a synchronized block.
fork() Fork a new script engine and execute provided resource.
getSharedObject() Get an object from the shared object store.
join() Wait for a script engine to shut down.
listScriptEngines() Retrieve a list of available script engines.
notify() Wakes up a single thread that is waiting on the monitor.
notifyAll() Wakes up all threads that are waiting on the monitor.
setSharedObject() Add an object to the shared object store.
wait() Causes the current thread to wait until either another thread invokes the {@link java.

Methods

createScriptEngine

org.eclipse.ease.IScriptEngine createScriptEngine(java.lang.String identifier)

Create a new script engine instance.

identifier
engine ID, literal engine name or accepted file extension

script engine instance (not started) or null

executeSync

java.lang.Object executeSync(java.lang.Object monitor, java.lang.Object code)

Run a code fragment in a synchronized block. Executes code within a synchronized block on the monitor object. The code object might be a String, File, IFile or any other object that can be adapted to IScriptable.

monitor
monitor to synchronize on
code
code to run.

fork

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.

resource
resource to execute (path, URI or file instance)
arguments
optional script arguments delimited by commas ','Optional: defaults to <null>.
engineID
engine ID to be usedOptional: defaults to <null>.

execution result

getSharedObject

java.lang.Object getSharedObject(java.lang.String key)

Get an object from the shared object store.

key
key to retrieve object for

shared object or null

join

boolean join(org.eclipse.ease.IScriptEngine engine, [long timeout])

Wait for a script engine to shut down. If timeout is set to 0 this method will wait endlessly.

engine
script engine to wait for
timeout
time to wait for shutdown [ms]Optional: defaults to <0>.

true when engine is shut down

listScriptEngines

java.lang.String listScriptEngines()

Retrieve a list of available script engines.

array of engine IDs

notify

void notify(java.lang.Object monitor)

Wakes up a single thread that is waiting on the monitor. Calls the java method monitor.notify().

monitor
monitor to notify

notifyAll

void notifyAll(java.lang.Object monitor)

Wakes up all threads that are waiting on the monitor. Calls the java method monitor.notifyAll().

monitor
monitor to notify

setSharedObject

void setSharedObject(java.lang.String key, java.lang.Object object, [boolean permanent], [boolean writable])

Add an object to the shared object store. The shared object store allows to share java instances between several script engines. By default objects are stored until the script engine providing it is terminated. This helps to avoid polluting the java heap. When permanent is set to true , this object will be stored forever.

key
key to store the object
object
instance to store
permanent
flag indicating permanent storageOptional: defaults to <false>.
writable
flag indicating that any engine may write this valueOptional: defaults to <false>.
IllegalAccessException
when scriptEngine is not the owner of the shared object

wait

void wait(java.lang.Object monitor, [long timeout])

Causes the current thread to wait until either another thread invokes the java.lang.Objectnotify() method or the java.lang.ObjectnotifyAll() method for this object, or a specified amount of time has elapsed. Calls the java method monitor.wait(timeout).

monitor
monitor to wait for
timeout
max timeout (0 does not time out)Optional: defaults to <0>.
InterruptedException
when wait gets interrupted