Modifier and Type | Field and Description |
---|---|
private final Map | beans
Beans to be provided to the script |
private boolean | compiled
Enable script compilation. |
private String | |
private boolean | keepEngine
Whether to keep the engine between calls to execute/eval |
private String | language
Script language |
private Project | project
Project this runner is used in |
private String | script
Script content |
private ClassLoader | scriptLoader
Classloader to be used when running the script. |
Access | Constructor and Description |
---|---|
public |
Modifier and Type | Method and Description |
---|---|
public void | |
public void | |
public void | |
public void | |
public void | bindToComponentMinimum(ProjectComponent
to become component)self Bind the runner to a project component. |
protected void | |
public void | |
public abstract Object | Returns: the result of evaluating the script.the name that will be passed to the
scripting engine for this script execution. execName)Evaluate the script. |
public abstract void | executeScript(String
the name that will be passed to BSF for this script
execution. execName)Do the work. |
protected Map | |
public final boolean | |
public boolean | |
public String | |
public abstract String | Returns: the prefix string.Get the name of the manager prefix used for this scriptrunner. |
public Project | |
public String | |
protected ClassLoader | |
public void | |
public void | loadResources(ResourceCollection
the resource to load collection)Add all resources in a resource collection to the source list. |
private void | readSource(InputStream
the input stream to pass into a buffered reader. in, String the name to use in error messages name, Charset the encoding for the reader, may be null. charset)Read some source in from the given reader |
protected ClassLoader | Returns: the current context classloader.Replace the current context classloader with the script context classloader. |
protected void | restoreContextLoader(ClassLoader
the original context classloader. origLoader)Restore the context loader with the original context classloader. |
public final void | setCompiled(boolean
if true, compile the script if possible. compiled)Whether to use script compilation if available. |
public void | setEncoding(String
encoding of the external file containing the script source. encoding)Set encoding of the script from an external file; optional. |
public void | setKeepEngine(boolean
if true, keep the engine. keepEngine)Whether to keep the script engine between calls. |
public void | setLanguage(String
the scripting language name for the script. language)Defines the language (required). |
public void | |
public void | |
public void | |
public abstract boolean | Returns: true if a script engine can be created, false otherwise.Check if a script engine can be created for this language. |
beans | back to summary |
---|---|
private final Map<String, Object> beans Beans to be provided to the script |
compiled | back to summary |
---|---|
private boolean compiled Enable script compilation. |
encoding | back to summary |
---|---|
private String encoding |
keepEngine | back to summary |
---|---|
private boolean keepEngine Whether to keep the engine between calls to execute/eval |
language | back to summary |
---|---|
private String language Script language |
project | back to summary |
---|---|
private Project project Project this runner is used in |
script | back to summary |
---|---|
private String script Script content |
scriptLoader | back to summary |
---|---|
private ClassLoader scriptLoader Classloader to be used when running the script. |
ScriptRunnerBase | back to summary |
---|---|
public ScriptRunnerBase() |
addBean | back to summary |
---|---|
public void addBean(String key, Object bean) Add a single object into the script context. |
addBeans | back to summary |
---|---|
public void addBeans(Map<String, ?> dictionary) Add a list of named objects to the list to be exported to the script |
addText | back to summary |
---|---|
public void addText(String text) Set the script text. Properties in the text are not expanded!
|
bindToComponent | back to summary |
---|---|
public void bindToComponent(ProjectComponent component) Bind the runner to a project component. Properties, targets and references are all added as beans; project is bound to project, and self to the component.
|
bindToComponentMinimum | back to summary |
---|---|
public void bindToComponentMinimum(ProjectComponent component) Bind the runner to a project component. The project and self are the only beans set.
|
checkLanguage | back to summary |
---|---|
protected void checkLanguage() Check if the language attribute is set.
|
clearScript | back to summary |
---|---|
public void clearScript() Clear the current script text content. |
evaluateScript | back to summary |
---|---|
public abstract Object evaluateScript(String execName) Evaluate the script. |
executeScript | back to summary |
---|---|
public abstract void executeScript(String execName) Do the work.
|
getBeans | back to summary |
---|---|
protected Map Get the beans used for the script. |
getCompiled | back to summary |
---|---|
public final boolean getCompiled() Get the compiled attribute.
|
getKeepEngine | back to summary |
---|---|
public boolean getKeepEngine() Get the keep engine attribute.
|
getLanguage | back to summary |
---|---|
public String getLanguage() Get the script language
|
getManagerName | back to summary |
---|---|
public abstract String getManagerName() Get the name of the manager prefix used for this scriptrunner.
|
getProject | back to summary |
---|---|
public Project getProject() Get the project for this runner.
|
getScript | back to summary |
---|---|
public String getScript() Get the current script text content.
|
getScriptClassLoader | back to summary |
---|---|
protected ClassLoader getScriptClassLoader() Get the classloader used to load the script engine.
|
loadResource | back to summary |
---|---|
public void loadResource(Resource sourceResource) Add a resource to the source list.
|
loadResources | back to summary |
---|---|
public void loadResources(ResourceCollection collection) Add all resources in a resource collection to the source list.
|
readSource | back to summary |
---|---|
private void readSource(InputStream in, String name, Charset charset) Read some source in from the given reader
|
replaceContextLoader | back to summary |
---|---|
protected ClassLoader replaceContextLoader() Replace the current context classloader with the script context classloader.
|
restoreContextLoader | back to summary |
---|---|
protected void restoreContextLoader(ClassLoader origLoader) Restore the context loader with the original context classloader. script context loader.
|
setCompiled | back to summary |
---|---|
public final void setCompiled(boolean compiled) Whether to use script compilation if available.
|
setEncoding | back to summary |
---|---|
public void setEncoding(String encoding) Set encoding of the script from an external file; optional.
|
setKeepEngine | back to summary |
---|---|
public void setKeepEngine(boolean keepEngine) Whether to keep the script engine between calls.
|
setLanguage | back to summary |
---|---|
public void setLanguage(String language) Defines the language (required).
|
setProject | back to summary |
---|---|
public void setProject(Project project) Set the project for this runner.
|
setScriptClassLoader | back to summary |
---|---|
public void setScriptClassLoader(ClassLoader classLoader) Set the script classloader.
|
setSrc | back to summary |
---|---|
public void setSrc(File file) Load the script from an external file; optional.
|
supportsLanguage | back to summary |
---|---|
public abstract boolean supportsLanguage() Check if a script engine can be created for this language.
|