Package adams.data.conversion
Class AbstractScriptedConversion
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.conversion.AbstractConversion
-
- adams.data.conversion.AbstractScriptedConversion
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,FileBasedScripting,FileBasedScriptingWithOptions,ShallowCopySupporter<AbstractConversion>,SizeOfHandler,Stoppable,Conversion,ConversionWithInitialization,Serializable
public abstract class AbstractScriptedConversion extends AbstractConversion implements ConversionWithInitialization, FileBasedScriptingWithOptions
Abstract ancestor for actors that execute external scripts.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected PlaceholderFilem_ScriptFilethe script.protected Objectm_ScriptObjectthe loaded script object.protected Stringm_ScriptOptionsthe options for the script.-
Fields inherited from class adams.data.conversion.AbstractConversion
m_Input, m_Output, m_Owner, m_Stopped
-
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 AbstractScriptedConversion()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancanSetUpScript()Method for checking whether we can setUp the script.protected abstract StringcheckScriptObject()Checks the script object.voiddefineOptions()Adds options to the internal list of options.voiddestroy()Frees up memory in a "destructive" non-reversible way.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.PlaceholderFilegetScriptFile()Gets the script file.BaseTextgetScriptOptions()Gets the script options.protected StringinitScriptObject()Tries to initialize the scripts object, sets its options and performs some checks.protected abstract StringloadScriptObject()Loads the scripts object and sets its options.booleanrequiresSetUp()Checks whether we still need to perform a setup.protected voidreset()Resets the conversion.StringscriptFileTipText()Returns the tip text for this property.StringscriptOptionsTipText()Returns the tip text for this property.voidsetScriptFile(PlaceholderFile value)Sets the script file.voidsetScriptOptions(BaseText value)Sets the script options.StringsetUp()Performs some initializations.-
Methods inherited from class adams.data.conversion.AbstractConversion
accepts, checkData, cleanUp, convert, doConvert, generates, getAdditionalInformation, getInput, getInput, getOutput, getOutput, getOwner, setInput, setOwner, shallowCopy, shallowCopy, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.CleanUpHandler
cleanUp
-
Methods inherited from interface adams.data.conversion.Conversion
accepts, convert, generates, getInput, getInput, getOutput, getOutput, getOwner, setInput, setOwner
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.Stoppable
stopExecution
-
-
-
-
Field Detail
-
m_ScriptFile
protected PlaceholderFile m_ScriptFile
the script.
-
m_ScriptOptions
protected String m_ScriptOptions
the options for the script.
-
m_ScriptObject
protected transient Object m_ScriptObject
the loaded script object.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
reset
protected void reset()
Resets the conversion.- Overrides:
resetin classAbstractConversion
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractConversion- Returns:
- null if no info available, otherwise short string
-
setScriptFile
public void setScriptFile(PlaceholderFile value)
Sets the script file.- Specified by:
setScriptFilein interfaceFileBasedScripting- Parameters:
value- the script
-
getScriptFile
public PlaceholderFile getScriptFile()
Gets the script file.- Specified by:
getScriptFilein interfaceFileBasedScripting- Returns:
- the script
-
scriptFileTipText
public String scriptFileTipText()
Returns the tip text for this property.- Specified by:
scriptFileTipTextin interfaceFileBasedScripting- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setScriptOptions
public void setScriptOptions(BaseText value)
Sets the script options.- Specified by:
setScriptOptionsin interfaceFileBasedScriptingWithOptions- Parameters:
value- the options
-
getScriptOptions
public BaseText getScriptOptions()
Gets the script options.- Specified by:
getScriptOptionsin interfaceFileBasedScriptingWithOptions- Returns:
- the options
-
scriptOptionsTipText
public String scriptOptionsTipText()
Returns the tip text for this property.- Specified by:
scriptOptionsTipTextin interfaceFileBasedScriptingWithOptions- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
loadScriptObject
protected abstract String loadScriptObject()
Loads the scripts object and sets its options.- Returns:
- null if OK, otherwise the error message
-
checkScriptObject
protected abstract String checkScriptObject()
Checks the script object.- Returns:
- null if OK, otherwise the error message
-
initScriptObject
protected String initScriptObject()
Tries to initialize the scripts object, sets its options and performs some checks.- Returns:
- null if OK, otherwise the error message
-
canSetUpScript
protected boolean canSetUpScript()
Method for checking whether we can setUp the script.- Returns:
- true if it can be setUp
-
setUp
public String setUp()
Performs some initializations.- Specified by:
setUpin interfaceConversionWithInitialization- Returns:
- null if successful, otherwise error message
-
requiresSetUp
public boolean requiresSetUp()
Checks whether we still need to perform a setup.- Specified by:
requiresSetUpin interfaceConversionWithInitialization- Returns:
- true if
setUp()call is necessary
-
destroy
public void destroy()
Frees up memory in a "destructive" non-reversible way.- Specified by:
destroyin interfaceDestroyable- Overrides:
destroyin classAbstractOptionHandler- See Also:
AbstractOptionHandler.cleanUpOptions()
-
-