Package adams.core.scripting
Class FlowJepScriptlet
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.scripting.AbstractJepScriptlet
-
- adams.core.scripting.FlowJepScriptlet
-
- All Implemented Interfaces:
adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.SizeOfHandler
,adams.flow.core.FlowContextHandler
,Serializable
public class FlowJepScriptlet extends AbstractJepScriptlet
Encapsulates Jep/Python scripts that are run in the flow.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_ExpandVariables
whether to expand variables.protected adams.core.base.BaseString[]
m_Forwards
the forwards.protected Map<String,Object>
m_ForwardsMap
the forwards map.protected adams.flow.control.VariableNameStorageNamePair[]
m_Inputs
the inputs.protected adams.flow.control.VariableNameStorageNamePair[]
m_Outputs
the outputs.protected String
m_Script
the script to execute.protected File
m_ScriptFile
the script file 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 FlowJepScriptlet(String id, File scriptFile)
Initializes the scriptlet.FlowJepScriptlet(String id, File scriptFile, adams.flow.control.VariableNameStorageNamePair[] inputs, adams.flow.control.VariableNameStorageNamePair[] outputs, adams.core.base.BaseString[] forwards, boolean expandVars)
Initializes the scriptlet.FlowJepScriptlet(String id, String script)
Initializes the scriptlet.FlowJepScriptlet(String id, String script, adams.flow.control.VariableNameStorageNamePair[] inputs, adams.flow.control.VariableNameStorageNamePair[] outputs, adams.core.base.BaseString[] forwards, boolean expandVars)
Initializes the scriptlet.FlowJepScriptlet(String id, String script, File scriptFile, adams.flow.control.VariableNameStorageNamePair[] inputs, adams.flow.control.VariableNameStorageNamePair[] outputs, adams.core.base.BaseString[] forwards, boolean expandVars)
Initializes the scriptlet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
execute()
Executes the script.boolean
getExpandVariables()
Returns whether ADAMS variables get expanded in the script.adams.core.base.BaseString[]
getForwards()
Returns the variables to forward.Map<String,Object>
getForwardsMap()
Returns the parameter values to forward as map.adams.flow.control.VariableNameStorageNamePair[]
getInputs()
Returns the inputs to use (objects to retrieve from storage), if any.adams.flow.control.VariableNameStorageNamePair[]
getOutputs()
Returns the outputs to use (objects to store back in storage), if any.String
getScriptContent()
Returns the script content.-
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
-
-
-
-
Field Detail
-
m_Script
protected String m_Script
the script to execute.
-
m_ScriptFile
protected File m_ScriptFile
the script file to execute.
-
m_ExpandVariables
protected boolean m_ExpandVariables
whether to expand variables.
-
m_Inputs
protected adams.flow.control.VariableNameStorageNamePair[] m_Inputs
the inputs.
-
m_Outputs
protected adams.flow.control.VariableNameStorageNamePair[] m_Outputs
the outputs.
-
m_Forwards
protected adams.core.base.BaseString[] m_Forwards
the forwards.
-
-
Constructor Detail
-
FlowJepScriptlet
public FlowJepScriptlet(String id, String script)
Initializes the scriptlet.- Parameters:
id
- the ID of the scriptscript
- the script to execute
-
FlowJepScriptlet
public FlowJepScriptlet(String id, String script, adams.flow.control.VariableNameStorageNamePair[] inputs, adams.flow.control.VariableNameStorageNamePair[] outputs, adams.core.base.BaseString[] forwards, boolean expandVars)
Initializes the scriptlet.- Parameters:
id
- the ID of the scriptscript
- the script to executeinputs
- the inputs for the script (from storage)outputs
- the outputs from the script (to go back into storage)forwards
- the variable values from the script to forward as map
-
FlowJepScriptlet
public FlowJepScriptlet(String id, File scriptFile)
Initializes the scriptlet.- Parameters:
id
- the ID of the scriptscriptFile
- the script file to execute
-
FlowJepScriptlet
public FlowJepScriptlet(String id, File scriptFile, adams.flow.control.VariableNameStorageNamePair[] inputs, adams.flow.control.VariableNameStorageNamePair[] outputs, adams.core.base.BaseString[] forwards, boolean expandVars)
Initializes the scriptlet.- Parameters:
id
- the ID of the scriptscriptFile
- the script file to executeinputs
- the inputs for the script (from storage)outputs
- the outputs from the script (to go back into storage)forwards
- the variable values from the script to forward as map
-
FlowJepScriptlet
public FlowJepScriptlet(String id, String script, File scriptFile, adams.flow.control.VariableNameStorageNamePair[] inputs, adams.flow.control.VariableNameStorageNamePair[] outputs, adams.core.base.BaseString[] forwards, boolean expandVars)
Initializes the scriptlet.- Parameters:
id
- the ID of the scriptscript
- the script to execute, can be nullscriptFile
- the script file to execute, can be nullinputs
- the inputs for the script (from storage)outputs
- the outputs from the script (to go back into storage)forwards
- the variable values from the script to forward as map
-
-
Method Detail
-
getScriptContent
public String getScriptContent()
Returns the script content.- Returns:
- the content
-
getInputs
public adams.flow.control.VariableNameStorageNamePair[] getInputs()
Returns the inputs to use (objects to retrieve from storage), if any.- Returns:
- the inputs, can be null
-
getOutputs
public adams.flow.control.VariableNameStorageNamePair[] getOutputs()
Returns the outputs to use (objects to store back in storage), if any.- Returns:
- the outputs, can be null
-
getForwards
public adams.core.base.BaseString[] getForwards()
Returns the variables to forward.- Returns:
- the forwards, can be null
-
getForwardsMap
public Map<String,Object> getForwardsMap()
Returns the parameter values to forward as map.- Returns:
- the map, can be null
-
getExpandVariables
public boolean getExpandVariables()
Returns whether ADAMS variables get expanded in the script.- Returns:
- true if expanded
-
execute
public String execute()
Executes the script.- Specified by:
execute
in classAbstractJepScriptlet
- Returns:
- null if successful, otherwise error message
-
-