Package adams.flow.standalone.rats.input
Class AbstractBufferedRatInput
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.standalone.rats.input.AbstractRatInput
-
- adams.flow.standalone.rats.input.AbstractBufferedRatInput
-
- All Implemented Interfaces:
adams.core.AdditionalInformationHandler
,adams.core.CleanUpHandler
,adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.QuickInfoSupporter
,adams.core.ShallowCopySupporter<AbstractRatInput>
,adams.core.SizeOfHandler
,adams.core.Stoppable
,adams.core.StoppableWithFeedback
,BufferedRatInput
,RatInput
,Serializable
- Direct Known Subclasses:
RedisSubscribe
,RESTTextReception
,Socket
,Subscribe
,WebserviceInput
,WSBlobReception
,WSTextReception
public abstract class AbstractBufferedRatInput extends AbstractRatInput implements BufferedRatInput
Ancestor for buffering rat inputs.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BlockingQueue
m_Buffer
the queue to use for buffering.protected Object
m_Current
the current item to return.protected int
m_MaxBuffer
the maximum number of items to buffer.protected int
m_PollTimeout
the internal timeout interval for polling the queue in msec.-
Fields inherited from class adams.flow.standalone.rats.input.AbstractRatInput
m_LoggingPrefix, m_Owner, m_ReceptionInterrupted, m_ReceptionRunning, m_Stopped
-
-
Constructor Summary
Constructors Constructor Description AbstractBufferedRatInput()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bufferData(Object value)
For buffering the data received from the webservice.void
cleanUp()
Cleans up data structures, frees up memory.void
defineOptions()
Adds options to the internal list of options.protected int
getDefaultMaxBuffer()
Returns the default maximum for the buffer.int
getMaxBuffer()
Returns the maximum number of items to buffer.boolean
hasPendingOutput()
Checks whether any output can be collected.protected void
initialize()
Initializes the members.String
maxBufferTipText()
Returns the tip text for this property.Object
output()
Returns the received data.protected Object
poll()
Waits for the next data object, polling the queue.void
setMaxBuffer(int value)
Sets the maximum number of items to buffer.String
setUp()
Hook method for performing checks at setup time.void
stopExecution()
Stops the execution.-
Methods inherited from class adams.flow.standalone.rats.input.AbstractRatInput
canReceive, check, configureLogger, doReceive, doWait, generates, getAdditionalInformation, getFullName, getOwner, getQueue, getQuickInfo, getReceptionInterrupted, handleException, initReception, interruptReception, isReceptionRunning, isStopped, receive, setOwner, shallowCopy, shallowCopy, updatePrefix
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
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.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
Methods inherited from interface adams.flow.standalone.rats.input.RatInput
generates, getFullName, getOwner, getReceptionInterrupted, initReception, interruptReception, isReceptionRunning, isStopped, receive, setOwner
-
-
-
-
Field Detail
-
m_MaxBuffer
protected int m_MaxBuffer
the maximum number of items to buffer.
-
m_Buffer
protected BlockingQueue m_Buffer
the queue to use for buffering.
-
m_Current
protected Object m_Current
the current item to return.
-
m_PollTimeout
protected int m_PollTimeout
the internal timeout interval for polling the queue in msec.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.core.option.AbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractRatInput
-
setUp
public String setUp()
Hook method for performing checks at setup time.- Specified by:
setUp
in interfaceRatInput
- Overrides:
setUp
in classAbstractRatInput
- Returns:
- null if successful, otherwise error message
-
getDefaultMaxBuffer
protected int getDefaultMaxBuffer()
Returns the default maximum for the buffer.- Returns:
- the default
-
setMaxBuffer
public void setMaxBuffer(int value)
Sets the maximum number of items to buffer.- Specified by:
setMaxBuffer
in interfaceBufferedRatInput
- Parameters:
value
- the maximum number of items to buffer
-
getMaxBuffer
public int getMaxBuffer()
Returns the maximum number of items to buffer.- Specified by:
getMaxBuffer
in interfaceBufferedRatInput
- Returns:
- the maximum number of items to buffer
-
maxBufferTipText
public String maxBufferTipText()
Returns the tip text for this property.- Specified by:
maxBufferTipText
in interfaceBufferedRatInput
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
bufferData
public void bufferData(Object value)
For buffering the data received from the webservice.- Specified by:
bufferData
in interfaceBufferedRatInput
- Parameters:
value
- the data received
-
poll
protected Object poll()
Waits for the next data object, polling the queue.- Returns:
- the data, null if none available (eg when stopped)
-
hasPendingOutput
public boolean hasPendingOutput()
Checks whether any output can be collected. Blocks till either stopped or data has arrived.- Specified by:
hasPendingOutput
in interfaceRatInput
- Specified by:
hasPendingOutput
in classAbstractRatInput
- Returns:
- true if output available
-
output
public Object output()
Returns the received data.- Specified by:
output
in interfaceRatInput
- Specified by:
output
in classAbstractRatInput
- Returns:
- the data, null if none available or stopped
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceRatInput
- Specified by:
stopExecution
in interfaceadams.core.Stoppable
- Overrides:
stopExecution
in classAbstractRatInput
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceadams.core.CleanUpHandler
- Overrides:
cleanUp
in classAbstractRatInput
-
-