Class DeQueue

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, StorageUpdater, Actor, ErrorHandler, OutputProducer, Serializable, Comparable

    public class DeQueue
    extends AbstractSource
    implements StorageUpdater
    Polls the specified queue in internal storage for an item, blocks till an item is available.
    NB: The user needs to stop the flow as the DeQueue source will never stop, as it assumes that there will be more data coming through.

    Input/output:
    - generates:
       adams.flow.core.Unknown


    -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: DeQueue
     
    -annotation <adams.core.base.BaseText> (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
     
    -storage-name <adams.flow.control.StorageName> (property: storageName)
        The name of the queue in the internal storage.
        default: queue
     
    -interval <int> (property: interval)
        The polling interval in milli-seconds.
        default: 50
        minimum: 1
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_StorageName

        protected StorageName m_StorageName
        the name of the queue in the internal storage.
      • m_Interval

        protected int m_Interval
        the poll interval in msec.
    • Constructor Detail

      • DeQueue

        public DeQueue()
        Default constructor.
      • DeQueue

        public DeQueue​(StorageName storageName)
        Initializes with the specified storage name.
        Parameters:
        storageName - the name
      • DeQueue

        public DeQueue​(String storageName)
        Initializes with the specified storage name.
        Parameters:
        storageName - the name
    • Method Detail

      • isUpdatingStorage

        public boolean isUpdatingStorage()
        Returns whether storage items are being updated.
        Specified by:
        isUpdatingStorage in interface StorageUpdater
        Returns:
        true if storage items are updated
      • setStorageName

        public void setStorageName​(String value)
        Sets the name for the queue in the internal storage.
        Parameters:
        value - the name
      • setStorageName

        public void setStorageName​(StorageName value)
        Sets the name for the queue in the internal storage.
        Parameters:
        value - the name
      • getStorageName

        public StorageName getStorageName()
        Returns the name for the queue in the internal storage.
        Returns:
        the name
      • 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.
      • setInterval

        public void setInterval​(int value)
        Sets the polling interval in seconds.
        Parameters:
        value - the interval
      • getInterval

        public int getInterval()
        Returns the polling interval in milli-seconds.
        Returns:
        the interval
      • intervalTipText

        public String intervalTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • generates

        public Class[] generates()
        Returns the class of objects that it generates.
        Specified by:
        generates in interface OutputProducer
        Returns:
        adams.flow.core.Unknown.class
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything ok, otherwise error message
      • hasPendingOutput

        public boolean hasPendingOutput()
        Checks whether there is pending output to be collected after executing the flow item.
        Specified by:
        hasPendingOutput in interface OutputProducer
        Returns:
        true if there is pending output
      • output

        public Token output()
        Returns the generated token.
        Specified by:
        output in interface OutputProducer
        Returns:
        the generated token