public class Script extends Object implements Serializable, Cloneable
RefArtifact
.
The script may be included inline in job XML as element text or CDATA, or reference an external resource via
src
attribute. For example,
<step id="batchletJavascriptSrc.step1"> <batchlet> <script src="javascript/simple-batchlet.js"/> </batchlet> </step>
<step id="batchletJavascriptInline.step1"> <batchlet> <script type="javascript"> function stop() { print('In stop function\n'); } //access built-in variables: jobContext, stepContext and batchProperties, //set job exit status to the value of testName property, and //return the value of testName property as step exit status, function process() { print('jobName: ' + jobContext.getJobName() + '\n'); print('stepName: ' + stepContext.getStepName() + '\n'); var testName = batchProperties.get('testName'); jobContext.setExitStatus(testName); return testName; } </script> </batchlet> </step>
Modifier and Type | Method and Description |
---|---|
protected Script |
clone() |
String |
getContent(ClassLoader classLoader)
Gets the content of the script as string.
|
ScriptEngine |
getEngine(ClassLoader classLoader)
Gets the javax.script.ScriptEngine for this script.
|
String |
getType()
Gets the type of the script, for example,
javascript . |
public String getContent(ClassLoader classLoader)
scr attribute
fo the script
element in job XML.classLoader
- class loader to load the resourcepublic String getType()
javascript
.public ScriptEngine getEngine(ClassLoader classLoader)
classLoader
- class loader used to obtain the script engineScriptEngine
for this scriptCopyright © 2015 JBoss by Red Hat. All rights reserved.