Package adams.flow.condition.test
Class Jython
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,FileBasedScripting
,FileBasedScriptingWithOptions
,ShallowCopySupporter<TestCondition>
,SizeOfHandler
,TestCondition
,Serializable
,Comparable
public class Jython extends AbstractScriptedCondition
A condition that uses the condition defined in an external Jython script.
Valid options are:
-D (property: debug) If set to true, scheme may output additional info to the console.
-script <adams.core.io.PlaceholderFile> (property: scriptFile) The script file to load and execute. default: .
-options <java.lang.String> (property: scriptOptions) The options for the Jython script; must consist of 'key=value' pairs separated by blanks; the value of 'key' can be accessed via the 'getAdditionalOption (String)' in the Jython actor. default:
- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
Jython
, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Hashtable<String,String>
m_AdditionalOptions
for storing the additional options.protected AbstractTestCondition
m_ConditionObject
the loaded script object.protected JythonScript
m_InlineScript
the inline script.-
Fields inherited from class adams.flow.condition.test.AbstractScriptedCondition
m_ScriptFile, m_ScriptObject, m_ScriptOptions
-
Fields inherited from class adams.flow.condition.test.AbstractTestCondition
m_Tested, m_TestResult
-
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 Jython()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
checkScriptObject()
Checks the script object.void
defineOptions()
Adds options to the internal list of options.String
getAdditionalOption(String name, String defValue)
Returns the value associated with the (additional) option.protected JythonScript
getDefaultInlineScript()
Returns the default inline script.JythonScript
getInlineScript()
Gets the inline script to use instead of the external script file.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.String
inlineScriptTipText()
Returns the tip text for this property.protected String
loadScriptObject()
Loads the scripts object and sets its options.protected String
performScriptTest()
Runs the script test.String
scriptOptionsTipText()
Returns the tip text for this property.void
setAdditionalOptions(Hashtable<String,String> options)
Sets the additional options.void
setInlineScript(JythonScript value)
Sets the inline script to use instead of the external script file.-
Methods inherited from class adams.flow.condition.test.AbstractScriptedCondition
getScriptFile, getScriptOptions, initScriptObject, performTest, reset, scriptFileTipText, setScriptFile, setScriptOptions
-
Methods inherited from class adams.flow.condition.test.AbstractTestCondition
compareTo, equals, forCommandLine, forName, getConditions, getQuickInfo, getTestResult, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, 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_ConditionObject
protected transient AbstractTestCondition m_ConditionObject
the loaded script object.
-
m_InlineScript
protected JythonScript m_InlineScript
the inline script.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractTestCondition
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractScriptedCondition
-
getDefaultInlineScript
protected JythonScript getDefaultInlineScript()
Returns the default inline script.- Returns:
- the default script
-
setInlineScript
public void setInlineScript(JythonScript value)
Sets the inline script to use instead of the external script file.- Parameters:
value
- the inline script
-
getInlineScript
public JythonScript getInlineScript()
Gets the inline script to use instead of the external script file.- Returns:
- the inline script
-
inlineScriptTipText
public String inlineScriptTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
scriptOptionsTipText
public String scriptOptionsTipText()
Returns the tip text for this property.- Specified by:
scriptOptionsTipText
in interfaceFileBasedScriptingWithOptions
- Overrides:
scriptOptionsTipText
in classAbstractScriptedCondition
- 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:
loadScriptObject
in classAbstractScriptedCondition
- Returns:
- null if OK, otherwise the error message
-
checkScriptObject
protected String checkScriptObject()
Checks the script object.- Specified by:
checkScriptObject
in classAbstractScriptedCondition
- Returns:
- always null, i.e., OK
-
performScriptTest
protected String performScriptTest()
Runs the script test.- Specified by:
performScriptTest
in classAbstractScriptedCondition
- Returns:
- the test result, null if everything OK, otherwise the error message
-
setAdditionalOptions
public void setAdditionalOptions(Hashtable<String,String> options)
Sets the additional options.- Parameters:
options
- the options (name <->value relation)
-
-