|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.schmant.app.js.SunJavaScriptExecutor
public final class SunJavaScriptExecutor
This script executor runs JavaScript build scripts using the JavaScript support bundled in Sun JDK 6+.
Constructor Summary | |
---|---|
SunJavaScriptExecutor()
|
Method Summary | ||
---|---|---|
void |
init(NamedReadableFile scriptFile,
LauncherSettings ls,
Report r)
Initialize the script executor. |
|
boolean |
isClosure(Object o)
Is the object a closure that can be run? |
|
Runnable |
proxyRunnable(Runnable r)
Proxy the Runnable that the thread is configured to run with a
runnable that sets up the thread context. |
|
Object |
runClosure(Object closure,
Object... arguments)
Run the closure and return the result. |
|
void |
runDefaultPreparationScript(Report r)
Run the default environment preparation script. |
|
void |
runPreparationScript(File script,
Report r)
Run the preparation script in the file. |
|
Object |
runScriptFromFile(Object f)
|
|
Object |
runWithDefaultWrapperScript()
Run the script using the default wrapper script, if any. |
|
void |
setBindings(Bindings bnd,
int scope)
Set the variables stored in the bindings in the specified scope. |
|
void |
setGlobalVariable(String name,
Object value)
Set the value of a global variable in the script. |
|
void |
tearDown()
Tear down the script executor when Schmant terminates. |
|
|
tryAdd(FlatteningList<T> list,
int index,
Object o,
ObjectTransformer<T> transformer)
If o is an object that this decorator handles, add it to the
list. |
|
|
tryAdd(FlatteningList<T> list,
int index,
T o)
If o is an object that this decorator handles, add it to the
list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SunJavaScriptExecutor()
Method Detail |
---|
public void init(NamedReadableFile scriptFile, LauncherSettings ls, Report r)
ScriptExecutor
FlatteningList.registerDecorator(org.schmant.support.util.FlatteningListDecorator)
,
TaskExecutorThreadFactory.registerThreadContextInitializer(org.schmant.run.ThreadContextInitializer)
and
ClosureSupport.registerClosureRunner(org.schmant.lang.ClosureRunner)
.
init
in interface ScriptExecutor
scriptFile
- The script file that is run.ls
- The command line settings.r
- The report.ScriptExecutor.tearDown()
public void tearDown()
ScriptExecutor
ScriptExecutor.init(NamedReadableFile, LauncherSettings, Report)
registered
with.
tearDown
in interface ScriptExecutor
public Object runScriptFromFile(Object f) throws IOException
IOException
public void runDefaultPreparationScript(Report r) throws IOException
ScriptExecutor
runDefaultPreparationScript
in interface ScriptExecutor
r
- A report to log to.
IOException
public void runPreparationScript(File script, Report r) throws IOException
ScriptExecutor
runPreparationScript
in interface ScriptExecutor
script
- The script file.r
- A report to log to.
IOException
public Object runWithDefaultWrapperScript() throws IOException
ScriptExecutor
runWithDefaultWrapperScript
in interface ScriptExecutor
IOException
public void setBindings(Bindings bnd, int scope)
ScriptExecutor
setBindings
in interface ScriptExecutor
bnd
- The bindings containing a map of variables to set.scope
- The scope to set the variables in. See
ScriptContext
. For now this parameter can be
ignored and all variables set to the global scope.public void setGlobalVariable(String name, Object value)
ScriptExecutor
setGlobalVariable
in interface ScriptExecutor
name
- The name of the variable.value
- The variable value.public <T> int tryAdd(FlatteningList<T> list, int index, T o)
FlatteningListDecorator
o
is an object that this decorator handles, add it to the
list.
tryAdd
in interface FlatteningListDecorator
T
- The type of objects in the list.list
- The list to add the object to.index
- The index for the new object in the list. If this argument
is -1
, add the object to the end of the list.o
- The object to add.
-1
.public <T> int tryAdd(FlatteningList<T> list, int index, Object o, ObjectTransformer<T> transformer)
FlatteningListDecorator
o
is an object that this decorator handles, add it to the
list.
tryAdd
in interface FlatteningListDecorator
T
- The type of objects in the list.list
- The list to add the object to.index
- The index for the new object in the list. If this argument
is -1
, add the object to the end of the list.o
- The object to add.transformer
- The transformer used to transform the object into the
list's type before it is added.
-1
.public Runnable proxyRunnable(Runnable r)
ThreadContextInitializer
Runnable
that the thread is configured to run with a
runnable that sets up the thread context.
proxyRunnable
in interface ThreadContextInitializer
r
- The runnable that the thread is configured to run.
public boolean isClosure(Object o)
ClosureRunner
isClosure
in interface ClosureRunner
o
- The object.
true
if the object is a closure.public Object runClosure(Object closure, Object... arguments) throws SchmantException
ClosureRunner
runClosure
in interface ClosureRunner
closure
- The closure to run.arguments
- Arguments to the closure.
PyObject
.
SchmantException
- On errors.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |