Package adams.flow.core
Class AbstractTemplate
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.core.AbstractActor
-
- adams.flow.core.AbstractTemplate
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,Actor
,ErrorHandler
,InternalActorHandler
,ActorTemplateUser
,Serializable
,Comparable
- Direct Known Subclasses:
TemplateSink
,TemplateSource
,TemplateStandalone
,TemplateTransformer
public abstract class AbstractTemplate extends AbstractActor implements ActorTemplateUser
Abstract ancestor for all actors that use a template to generate the actual actor/sub-flow to be executed.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
BACKUP_ACTOR
the key for storing the current actor in the backup.protected Actor
m_Actor
the generated actor.protected AbstractActorTemplate
m_Template
the template.-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description AbstractTemplate()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Hashtable<String,Object>
backupState()
Backs up the current state of the actor before update the variables.void
cleanUp()
Cleans up after the execution has finished.void
defineOptions()
Adds options to the internal list of options.protected void
forceVariables(Variables value)
Updates the Variables instance in use.Actor
getActualActor()
Returns the actual actor that was generated from the template.protected abstract AbstractActorTemplate
getDefaultTemplate()
Returns the default template to use.Actor
getInternalActor()
Returns the internal actor.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.AbstractActorTemplate
getTemplate()
Returns the name of the global actor in use.boolean
isFinished()
Returns whether the actor has finished.boolean
isModifyingStructure()
Returns whether the actor is modifying the structure.protected void
pruneBackup()
Removes entries from the backup.protected void
reset()
Resets the scheme.protected void
restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.void
setTemplate(AbstractActorTemplate value)
Sets the name of the global actor to use.protected String
setUpTemplate()
Initializes the template for flow execution.void
stopExecution()
Stops the execution.String
templateTipText()
Returns the tip text for this property.void
wrapUp()
Cleans up after the execution has finished.-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, compareTo, configureLogger, destroy, doExecute, equals, execute, finalUpdateVariables, findVariables, findVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isExecuting, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, preExecute, pruneBackup, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
compareTo, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
BACKUP_ACTOR
public static final String BACKUP_ACTOR
the key for storing the current actor in the backup.- See Also:
- Constant Field Values
-
m_Template
protected AbstractActorTemplate m_Template
the template.
-
m_Actor
protected Actor m_Actor
the generated actor.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractActor
-
reset
protected void reset()
Resets the scheme.- Overrides:
reset
in classAbstractActor
-
getDefaultTemplate
protected abstract AbstractActorTemplate getDefaultTemplate()
Returns the default template to use.- Returns:
- the template
-
setTemplate
public void setTemplate(AbstractActorTemplate value)
Sets the name of the global actor to use.- Specified by:
setTemplate
in interfaceActorTemplateUser
- Parameters:
value
- the global name
-
getTemplate
public AbstractActorTemplate getTemplate()
Returns the name of the global actor in use.- Specified by:
getTemplate
in interfaceActorTemplateUser
- Returns:
- the global name
-
templateTipText
public String templateTipText()
Returns the tip text for this property.- Specified by:
templateTipText
in interfaceActorTemplateUser
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceActor
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractActor
- Returns:
- null if no info available, otherwise short string
-
pruneBackup
protected void pruneBackup()
Removes entries from the backup.- Overrides:
pruneBackup
in classAbstractActor
- See Also:
AbstractActor.reset()
-
backupState
protected Hashtable<String,Object> backupState()
Backs up the current state of the actor before update the variables.- Overrides:
backupState
in classAbstractActor
- Returns:
- the backup
- See Also:
AbstractActor.updateVariables()
,AbstractActor.restoreState(Hashtable)
-
restoreState
protected void restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.- Overrides:
restoreState
in classAbstractActor
- Parameters:
state
- the backup of the state to restore from- See Also:
AbstractActor.updateVariables()
,AbstractActor.backupState()
-
getInternalActor
public Actor getInternalActor()
Returns the internal actor.- Specified by:
getInternalActor
in interfaceInternalActorHandler
- Returns:
- the actor, null if not available
-
isModifyingStructure
public boolean isModifyingStructure()
Returns whether the actor is modifying the structure.- Returns:
- true if the actor is modifying the structure
-
forceVariables
protected void forceVariables(Variables value)
Updates the Variables instance in use.
Use with caution!- Overrides:
forceVariables
in classAbstractActor
- Parameters:
value
- the instance to use
-
setUpTemplate
protected String setUpTemplate()
Initializes the template for flow execution.- Returns:
- null if everything is fine, otherwise error message
-
getActualActor
public Actor getActualActor()
Returns the actual actor that was generated from the template.- Returns:
- the actual actor, null if not available
-
isFinished
public boolean isFinished()
Returns whether the actor has finished.- Specified by:
isFinished
in interfaceActor
- Overrides:
isFinished
in classAbstractActor
- Returns:
- true if finished
-
stopExecution
public void stopExecution()
Stops the execution. No message set.- Specified by:
stopExecution
in interfaceActor
- Specified by:
stopExecution
in interfaceStoppable
- Overrides:
stopExecution
in classAbstractActor
-
wrapUp
public void wrapUp()
Cleans up after the execution has finished. Graphical output is left untouched.- Specified by:
wrapUp
in interfaceActor
- Overrides:
wrapUp
in classAbstractActor
-
cleanUp
public void cleanUp()
Cleans up after the execution has finished.- Specified by:
cleanUp
in interfaceActor
- Specified by:
cleanUp
in interfaceCleanUpHandler
- Overrides:
cleanUp
in classAbstractActor
-
-