adams.flow.core
Class AbstractTemplate

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.flow.core.AbstractActor
              extended by adams.flow.core.AbstractTemplate
All Implemented Interfaces:
AdditionalInformationHandler, CleanUpHandler, Debuggable, DebugOutputHandler, Destroyable, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<AbstractActor>, SizeOfHandler, Stoppable, VariableChangeListener, Actor, ErrorHandler, Serializable, Comparable
Direct Known Subclasses:
TemplateSink, TemplateSource, TemplateStandalone, TemplateTransformer

public abstract class AbstractTemplate
extends AbstractActor

Abstract ancestor for all actors that use a template to generate the actual actor/sub-flow to be executed.

Version:
$Revision: 6830 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Field Summary
static String BACKUP_ACTOR
          the key for storing the current actor in the backup.
protected  AbstractActor 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_Headless, m_Name, m_Parent, m_Root, m_ScopeHandler, m_Self, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
 
Constructor Summary
AbstractTemplate()
           
 
Method Summary
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.
 AbstractActor getActualActor()
          Returns the actual actor that was generated from the template.
protected abstract  AbstractActorTemplate getDefaultTemplate()
          Returns the default template to use.
 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.
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, debug, destroy, doExecute, equals, execute, findVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isExecuting, isHeadless, isStopped, nameTipText, performSetUpChecks, postExecute, preExecute, pruneBackup, setAnnotations, setErrorHandler, setHeadless, setName, setParent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, globalInfo, isDebugOn, newOptionManager, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
 

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 AbstractActor m_Actor
the generated actor.

Constructor Detail

AbstractTemplate

public AbstractTemplate()
Method Detail

defineOptions

public void defineOptions()
Adds options to the internal list of options.

Specified by:
defineOptions in interface OptionHandler
Overrides:
defineOptions in class AbstractActor

reset

protected void reset()
Resets the scheme.

Overrides:
reset in class AbstractActor

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.

Parameters:
value - the global name

getTemplate

public AbstractActorTemplate getTemplate()
Returns the name of the global actor in use.

Returns:
the global name

templateTipText

public String templateTipText()
Returns the tip text for this property.

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 interface QuickInfoSupporter
Specified by:
getQuickInfo in interface Actor
Overrides:
getQuickInfo in class AbstractActor
Returns:
null if no info available, otherwise short string

pruneBackup

protected void pruneBackup()
Removes entries from the backup.

Overrides:
pruneBackup in class AbstractActor

backupState

protected Hashtable<String,Object> backupState()
Backs up the current state of the actor before update the variables.

Overrides:
backupState in class AbstractActor
Returns:
the backup

restoreState

protected void restoreState(Hashtable<String,Object> state)
Restores the state of the actor before the variables got updated.

Overrides:
restoreState in class AbstractActor
Parameters:
state - the backup of the state to restore from

setUpTemplate

protected String setUpTemplate()
Initializes the template for flow execution.

Returns:
null if everything is fine, otherwise error message

getActualActor

public AbstractActor 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 interface Actor
Overrides:
isFinished in class AbstractActor
Returns:
true if finished

stopExecution

public void stopExecution()
Stops the execution. No message set.

Specified by:
stopExecution in interface Stoppable
Specified by:
stopExecution in interface Actor
Overrides:
stopExecution in class AbstractActor

wrapUp

public void wrapUp()
Cleans up after the execution has finished. Graphical output is left untouched.

Specified by:
wrapUp in interface Actor
Overrides:
wrapUp in class AbstractActor

cleanUp

public void cleanUp()
Cleans up after the execution has finished.

Specified by:
cleanUp in interface CleanUpHandler
Specified by:
cleanUp in interface Actor
Overrides:
cleanUp in class AbstractActor


Copyright © 2013 University of Waikato, Hamilton, NZ. All Rights Reserved.