Package adams.flow.template
Class Scripted
-
- All Implemented Interfaces:
CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,FileBasedScripting,FileBasedScriptingWithOptions,ShallowCopySupporter<AbstractActorTemplate>,SizeOfHandler,Serializable
public class Scripted extends AbstractScriptedTemplate
Uses a Groovy script to generate a sub-flow.
Valid options are:
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-name <java.lang.String> (property: name) The new name for the actor; leave empty to use current. default:
-script <adams.core.io.PlaceholderFile> (property: scriptFile) The script file to load and execute. default: ${CWD}-options <java.lang.String> (property: scriptOptions) The options for the script; must consist of 'key=value' pairs separated by blanks; the value of 'key' can be accessed via the 'getAdditionalOptions ().getXYZ("key")' method in the script actor. default:-handler <adams.core.scripting.AbstractScriptingHandler> (property: handler) The handler to use for scripting. default: adams.core.scripting.Dummy
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
Scripted, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractScriptingHandlerm_Handlerthe scripting handler to use.-
Fields inherited from class adams.flow.template.AbstractScriptedTemplate
m_ScriptFile, m_ScriptObject, m_ScriptOptions
-
Fields inherited from class adams.flow.template.AbstractActorTemplate
m_Name
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description Scripted()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringcheckScriptObject()Checks the script object.voiddefineOptions()Adds options to the internal list of options.protected ActorexecuteScript()Executes the script to generate the actor.AbstractScriptingHandlergetHandler()Gets the handler to use for scripting.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringglobalInfo()Returns a string describing the object.StringhandlerTipText()Returns the tip text for this property.booleanisInteractive()Whether the flow generated is an interactive one.protected StringloadScriptObject()Loads the scripts object and sets its options.StringscriptOptionsTipText()Returns the tip text for this property.voidsetHandler(AbstractScriptingHandler value)Sets the handler to use for scripting.-
Methods inherited from class adams.flow.template.AbstractScriptedTemplate
cleanUp, doGenerate, getScriptFile, getScriptOptions, initScriptObject, scriptFileTipText, setScriptFile, setScriptOptions
-
Methods inherited from class adams.flow.template.AbstractActorTemplate
compareTo, equals, forCommandLine, forName, generate, getBaselineCorrections, getDefaultName, getName, nameTipText, postGenerate, preGenerate, setName, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Handler
protected AbstractScriptingHandler m_Handler
the scripting handler to use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractScriptedTemplate
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Overrides:
getQuickInfoin classAbstractScriptedTemplate- Returns:
- null if no info available, otherwise short string
-
scriptOptionsTipText
public String scriptOptionsTipText()
Returns the tip text for this property.- Specified by:
scriptOptionsTipTextin interfaceFileBasedScriptingWithOptions- Overrides:
scriptOptionsTipTextin classAbstractScriptedTemplate- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setHandler
public void setHandler(AbstractScriptingHandler value)
Sets the handler to use for scripting.- Parameters:
value- the handler
-
getHandler
public AbstractScriptingHandler getHandler()
Gets the handler to use for scripting.- Returns:
- the handler
-
handlerTipText
public String handlerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
loadScriptObject
protected String loadScriptObject()
Loads the scripts object and sets its options.- Specified by:
loadScriptObjectin classAbstractScriptedTemplate- Returns:
- null if OK, otherwise the error message
-
checkScriptObject
protected String checkScriptObject()
Checks the script object.- Specified by:
checkScriptObjectin classAbstractScriptedTemplate- Returns:
- null if OK, otherwise the error message
-
executeScript
protected Actor executeScript()
Executes the script to generate the actor.- Specified by:
executeScriptin classAbstractScriptedTemplate- Returns:
- the generated actor
-
isInteractive
public boolean isInteractive()
Whether the flow generated is an interactive one.- Specified by:
isInteractivein classAbstractActorTemplate- Returns:
- true if interactive
-
-