|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.figure8.join.services.scripting.ScriptLauncher org.figure8.join.services.scripting.jsr223.JSR223ScriptLauncher
public class JSR223ScriptLauncher
Extension of ScriptLauncher
dedicated to the Java Scripting API
(aka JSR-223, see http://www.jcp.org/en/jsr/detail?id=223). This implementation
lets you wrap the execution of JSR-223 compatible scripts within a
ScriptLauncher.
As a Configurable
implementation, this
launcher defines 1 more configurable parameters that is the name of the
script engine to use for running the specified script.
Configurable
Field Summary | |
---|---|
static java.lang.String |
ENGINE_PARAM
Name of configurable parameter denoting the engine for executing script. |
protected static ParameterDefinition |
engineParam
ParameterDefinition of the parameter representing the engine for executing script. |
protected static java.util.List |
parameters
List of ParameterDefinition s supported by this launcher |
Fields inherited from class org.figure8.join.services.scripting.ScriptLauncher |
---|
SCRIPT_PARAM, scriptParam |
Constructor Summary | |
---|---|
JSR223ScriptLauncher()
Creates a new instance of JSR223ScriptLauncher. |
|
JSR223ScriptLauncher(java.lang.String scriptPath)
Creates a new instance of JSR223ScriptLauncher with script path |
Method Summary | |
---|---|
java.lang.String |
getEngine()
|
ParameterDefinition[] |
getParameterDefinitions()
Get this object parameters definitions as an array |
java.util.List |
getParameterDefinitionsAsList()
Get this object parameters definitions as a list |
void |
runScript(java.util.Properties properties)
Run the Groovy script file identified by scriptPath inner
field according to the specified engine . |
void |
setEngine(java.lang.String engine)
|
void |
setParameter(java.lang.String parameterName,
java.lang.String parameterValue)
Set the value of a parameter using its nama |
Methods inherited from class org.figure8.join.services.scripting.ScriptLauncher |
---|
getLogOutputStream, getScript, getScriptPath, setLogOutputStream, setParameter, setParameters, setScriptPath |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ENGINE_PARAM
protected static java.util.List parameters
ParameterDefinition
s supported by this launcher
protected static final ParameterDefinition engineParam
Constructor Detail |
---|
public JSR223ScriptLauncher()
public JSR223ScriptLauncher(java.lang.String scriptPath) throws InvalidParameterException
scriptPath
- the path of script to later execute
InvalidParameterException
- if path cannot be accessedMethod Detail |
---|
public java.lang.String getEngine()
public void setEngine(java.lang.String engine)
engine
- The name of the script engine used for evaluating scriptpublic void runScript(java.util.Properties properties) throws ScriptException
scriptPath
inner
field according to the specified engine
. Properties passed as
param are injected into the script context as namespace properties. Script
can directly use them using the ${property_name} form. Warning: "."
in properties keys passing in are modified into "_" before injected. This
is necessary because "." may have a special meaning in target script language
(nested field) that we don't want to have here.
runScript
in class ScriptLauncher
properties
- The runtime properties to inject into execution environment
ScriptException
- if something wrong occurs during script parsing, evaluation, ...public java.util.List getParameterDefinitionsAsList()
getParameterDefinitionsAsList
in interface Configurable
getParameterDefinitionsAsList
in class ScriptLauncher
ParameterDefinition
objectspublic ParameterDefinition[] getParameterDefinitions()
getParameterDefinitions
in interface Configurable
getParameterDefinitions
in class ScriptLauncher
ParameterDefinition
objectspublic void setParameter(java.lang.String parameterName, java.lang.String parameterValue) throws InvalidParameterException
setParameter
in interface Configurable
setParameter
in class ScriptLauncher
parameterName
- The name of parameter so set value forparameterValue
- The value of the paramater
InvalidParameterException
- if this parameter is not supported by this object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |