|
||||||||||
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
public abstract class ScriptLauncher
This is an abstract base class allowing to manage script initialization,
parameters binding and execution. This class implements Configurable
so that it can be configured through an interactive process.
Subclasses may implement behaviour specific to the script engine they are
wrapping. They may also be Configurable in order to add specific configuration
parameters to the one defined in base class (that is the script path).
Configurable
Field Summary | |
---|---|
protected static java.util.List |
parameters
List of ParameterDefinition s supported by this launcher |
static java.lang.String |
SCRIPT_PARAM
Name of configurable parameter denoting the path of script to run. |
protected static ParameterDefinition |
scriptParam
ParameterDefinition representation of parameter denoting the path of script to run. |
Constructor Summary | |
---|---|
protected |
ScriptLauncher()
Creates a new instance of ScriptLauncher. |
protected |
ScriptLauncher(java.lang.String scriptPath)
Creates a new instance of ScriptLauncher spceifying script path. |
Method Summary | |
---|---|
java.io.OutputStream |
getLogOutputStream()
|
ParameterDefinition[] |
getParameterDefinitions()
Get this object parameters definitions as an array. |
java.util.List |
getParameterDefinitionsAsList()
Get this object parameters definitions as a list |
java.io.File |
getScript()
|
java.lang.String |
getScriptPath()
|
abstract void |
runScript(java.util.Properties properties)
Abstract method that do the real job by running the script specified by scriptPath . |
void |
setLogOutputStream(java.io.OutputStream logOutputStream)
|
void |
setParameter(ParameterDefinition parameter,
java.lang.String parameterValue)
Set the value of a parameter using its definition. |
void |
setParameter(java.lang.String parameterName,
java.lang.String parameterValue)
Set the value of a parameter using its nama |
void |
setParameters(java.util.Properties parameters)
Convenient methods for setting all attributes values using a single method. |
void |
setScriptPath(java.lang.String scriptPath)
|
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 SCRIPT_PARAM
protected static java.util.List parameters
ParameterDefinition
s supported by this launcher
protected static final ParameterDefinition scriptParam
Constructor Detail |
---|
protected ScriptLauncher()
protected ScriptLauncher(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 getScriptPath()
public void setScriptPath(java.lang.String scriptPath) throws InvalidParameterException
scriptPath
- the path of script to execute
InvalidParameterException
- if path cannot be accessedpublic java.io.File getScript()
public java.io.OutputStream getLogOutputStream()
public void setLogOutputStream(java.io.OutputStream logOutputStream)
logOutputStream
- The output stream that script may use for logging outputpublic abstract void runScript(java.util.Properties properties) throws ScriptException
scriptPath
. Implementation may use properties
to initialize their runtime environment with corresponding global variables.
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
ParameterDefinition
objectspublic ParameterDefinition[] getParameterDefinitions()
getParameterDefintiionsAdList()
so that
subclasses may not override this implementation.
getParameterDefinitions
in interface Configurable
ParameterDefinition
objectspublic void setParameter(java.lang.String parameterName, java.lang.String parameterValue) throws InvalidParameterException
setParameter
in interface Configurable
parameterName
- The name of parameter so set value forparameterValue
- The value of the paramater
InvalidParameterException
- if this parameter is not supported by this objectpublic void setParameter(ParameterDefinition parameter, java.lang.String parameterValue) throws InvalidParameterException
setParameter(String, String)
so that subclasses may not ovveride this implementation.
setParameter
in interface Configurable
parameter
- The definitino of the paramater to setparameterValue
- The value of the parameter
InvalidParameterException
- if this parameter is not supported by this objectpublic void setParameters(java.util.Properties parameters) throws InvalidParameterException
setParameters
in interface Configurable
parameters
- Properties where keys are parameter names
InvalidParameterException
- if one of these parameters is not supported by this object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |