Package adams.flow.standalone
Class QueueInit
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,StorageUpdater
,Actor
,CallableActorUser
,ErrorHandler
,Serializable
,Comparable
public class QueueInit extends AbstractStandalone implements StorageUpdater, CallableActorUser
Creates an empty queue in internal storage under the specified name.
-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 name of the actor. default: QueueInit
-annotation <adams.core.base.BaseAnnotation> (property: annotations) The annotations to attach to this actor. default:
-skip <boolean> (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is. default: false
-stop-flow-on-error <boolean> (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors. default: false
-silent <boolean> (property: silent) If enabled, then no errors are output in the console; Note: the enclosing actor handler must have this enabled as well. default: false
-storage-name <adams.flow.control.StorageName> [-storage-name ...] (property: storageName) The name(s) of the queue(s) in the internal storage. default: queue
-keep-existing <boolean> (property: keepExisting) If enabled, existing queues won't get re-initialized. default: false
-limit <int> (property: limit) The limit of the queue; use <= 0 for unlimited size. default: -1 minimum: -1
-log <adams.flow.core.CallableActorReference> (property: log) The name of the (optional) callable actor to use for logging errors of type adams.db.LogEntry. default: unknown
-monitor <adams.flow.core.CallableActorReference> (property: monitor) The name of the (optional) callable actor to use for monitoring; generates tokens of type adams.db.LogEntry. default: unknown
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
BACKUP_LOGACTOR
the key for backing up the log actor.static String
BACKUP_MONITORACTOR
the key for backing up the monitoring actor.protected CallableActorHelper
m_Helper
the helper class.protected boolean
m_KeepExisting
whether to keep existing queues.protected int
m_Limit
the limit of the queue (<= 0 is unlimited).protected CallableActorReference
m_Log
the callable name for the log.protected Actor
m_LogActor
the log actor.protected CallableActorReference
m_Monitor
the callable name for the monitor.protected Actor
m_MonitorActor
the monitor actor.protected StorageName[]
m_StorageName
the name(s) of the queue in the internal storage.-
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 QueueInit()
-
Method Summary
All Methods Instance 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
defineOptions()
Adds options to the internal list of options.protected String
doExecute()
Executes the flow item.protected Actor
findCallableActor(CallableActorReference name)
Tries to find the callable actor referenced by its callable name.Actor
getCallableActor()
Returns the currently set callable actor.boolean
getKeepExisting()
Returns whether to keep any existing queue rather than overwriting it.int
getLimit()
Returns the limit of the queue.CallableActorReference
getLog()
Returns the name of the callable actor in use for logging errors.CallableActorReference
getMonitor()
Returns the name of the callable actor in use for monitoring.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.StorageName[]
getStorageName()
Returns the names for the queue in the internal storage.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.boolean
isUpdatingStorage()
Returns whether storage items are being updated.String
keepExistingTipText()
Returns the tip text for this property.String
limitTipText()
Returns the tip text for this property.String
logTipText()
Returns the tip text for this property.String
monitorTipText()
Returns the tip text for this property.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
setKeepExisting(boolean value)
Sets whether to keep any existing queue rather than overwriting it.void
setLimit(int value)
Sets the limit of the queue.void
setLog(CallableActorReference value)
Sets the name of the callable actor to use for logging errors.void
setMonitor(CallableActorReference value)
Sets the name of the callable actor to use for monitoring.void
setStorageName(StorageName[] value)
Sets the names for the queue in the internal storage.String
setUp()
Initializes the item for flow execution.String
storageNameTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.standalone.AbstractStandalone
preExecute
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forceVariables, 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, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, pruneBackup, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged, wrapUp
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, 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
toCommandLine
-
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
-
-
-
-
Field Detail
-
BACKUP_LOGACTOR
public static final String BACKUP_LOGACTOR
the key for backing up the log actor.- See Also:
- Constant Field Values
-
BACKUP_MONITORACTOR
public static final String BACKUP_MONITORACTOR
the key for backing up the monitoring actor.- See Also:
- Constant Field Values
-
m_StorageName
protected StorageName[] m_StorageName
the name(s) of the queue in the internal storage.
-
m_KeepExisting
protected boolean m_KeepExisting
whether to keep existing queues.
-
m_Limit
protected int m_Limit
the limit of the queue (<= 0 is unlimited).
-
m_Log
protected CallableActorReference m_Log
the callable name for the log.
-
m_LogActor
protected Actor m_LogActor
the log actor.
-
m_Monitor
protected CallableActorReference m_Monitor
the callable name for the monitor.
-
m_MonitorActor
protected Actor m_MonitorActor
the monitor actor.
-
m_Helper
protected CallableActorHelper m_Helper
the helper class.
-
-
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
-
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
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractActor
-
isUpdatingStorage
public boolean isUpdatingStorage()
Returns whether storage items are being updated.- Specified by:
isUpdatingStorage
in interfaceStorageUpdater
- Returns:
- true if storage items are updated
-
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
-
setStorageName
public void setStorageName(StorageName[] value)
Sets the names for the queue in the internal storage.- Parameters:
value
- the names
-
getStorageName
public StorageName[] getStorageName()
Returns the names for the queue in the internal storage.- Returns:
- the names
-
storageNameTipText
public String storageNameTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setKeepExisting
public void setKeepExisting(boolean value)
Sets whether to keep any existing queue rather than overwriting it.- Parameters:
value
- true if to keep existing
-
getKeepExisting
public boolean getKeepExisting()
Returns whether to keep any existing queue rather than overwriting it.- Returns:
- true if to keep existing
-
keepExistingTipText
public String keepExistingTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLimit
public void setLimit(int value)
Sets the limit of the queue.- Parameters:
value
- the limit, <=0 for unlimited
-
getLimit
public int getLimit()
Returns the limit of the queue.- Returns:
- the limit, <=0 is unlimited
-
limitTipText
public String limitTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLog
public void setLog(CallableActorReference value)
Sets the name of the callable actor to use for logging errors.- Parameters:
value
- the callable name
-
getLog
public CallableActorReference getLog()
Returns the name of the callable actor in use for logging errors.- Returns:
- the callable name
-
logTipText
public String logTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMonitor
public void setMonitor(CallableActorReference value)
Sets the name of the callable actor to use for monitoring.- Parameters:
value
- the callable name
-
getMonitor
public CallableActorReference getMonitor()
Returns the name of the callable actor in use for monitoring.- Returns:
- the callable name
-
monitorTipText
public String monitorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
findCallableActor
protected Actor findCallableActor(CallableActorReference name)
Tries to find the callable actor referenced by its callable name.- Parameters:
name
- the name of the actor- Returns:
- the callable actor or null if not found
-
getCallableActor
public Actor getCallableActor()
Returns the currently set callable actor.- Specified by:
getCallableActor
in interfaceCallableActorUser
- Returns:
- the actor, can be null
-
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()
-
setUp
public String setUp()
Initializes the item for flow execution.- Specified by:
setUp
in interfaceActor
- Overrides:
setUp
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractActor.reset()
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecute
in classAbstractActor
- Returns:
- null if everything is fine, otherwise error message
-
-