Package adams.core.scripting
Class SimpleJepScriptlet
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.scripting.AbstractJepScriptlet
-
- adams.core.scripting.SimpleJepScriptlet
-
- All Implemented Interfaces:
adams.core.logging.LoggingLevelHandler,adams.core.logging.LoggingSupporter,adams.core.SizeOfHandler,adams.flow.core.FlowContextHandler,Serializable
public class SimpleJepScriptlet extends AbstractJepScriptlet
Simple script that gets executed in memory, line by line.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,Object>m_Inputsthe inputs.protected String[]m_OptionalOutputNamesthe optional output names.protected String[]m_OutputNamesthe output names.protected Map<String,Object>m_Outputsthe outputs.protected Stringm_Scriptthe script to execute.-
Fields inherited from class adams.core.scripting.AbstractJepScriptlet
m_Finished, m_FlowContext, m_ID, m_LastError, m_Owner
-
-
Constructor Summary
Constructors Constructor Description SimpleJepScriptlet(String id, String script, Map<String,Object> inputs, String[] outputNames)Initializes the scriptlet.SimpleJepScriptlet(String id, String script, Map<String,Object> inputs, String[] outputNames, String[] optionalOutputNames)Initializes the scriptlet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringexecute()Executes the script.Map<String,Object>getInputs()Returns the input map of name/value.String[]getOptionalOutputNames()Returns the names of the optional outputs, i.e., ones that won't throw and exception when not present.String[]getOutputNames()Returns the outputs to retrieve from the interpreter.Map<String,Object>getOutputs()Returns the output map.StringgetScript()Returns the script to be executed (line by line).-
Methods inherited from class adams.core.scripting.AbstractJepScriptlet
configureLogger, fail, getFlowContext, getID, getLastError, getOwner, hasFinished, hasLastError, setFlowContext, setOwner
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Constructor Detail
-
SimpleJepScriptlet
public SimpleJepScriptlet(String id, String script, Map<String,Object> inputs, String[] outputNames)
Initializes the scriptlet.- Parameters:
id- the ID of the scriptscript- the script to execute (line by line)inputs- the inputs for the script (name/object)outputNames- the names of the outputs to retrieve
-
SimpleJepScriptlet
public SimpleJepScriptlet(String id, String script, Map<String,Object> inputs, String[] outputNames, String[] optionalOutputNames)
Initializes the scriptlet.- Parameters:
id- the ID of the scriptscript- the script to execute (line by line)inputs- the inputs for the script (name/object)outputNames- the names of the outputs to retrieveoptionalOutputNames- the names of the optional outputs (won't throw an exception if not present)
-
-
Method Detail
-
getScript
public String getScript()
Returns the script to be executed (line by line).- Returns:
- the script
-
getInputs
public Map<String,Object> getInputs()
Returns the input map of name/value.- Returns:
- the inputs
-
getOutputNames
public String[] getOutputNames()
Returns the outputs to retrieve from the interpreter.- Returns:
- the names
-
getOptionalOutputNames
public String[] getOptionalOutputNames()
Returns the names of the optional outputs, i.e., ones that won't throw and exception when not present.- Returns:
- the names
-
getOutputs
public Map<String,Object> getOutputs()
Returns the output map. Gets populated after execution.- Returns:
- the outputs (name/value)
-
execute
public String execute()
Executes the script.- Specified by:
executein classAbstractJepScriptlet- Returns:
- null if successful, otherwise error message
-
-