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 BlockingQueuem_Bufferthe queue to use for buffering.protected Objectm_Currentthe current item to return.protected intm_MaxBufferthe maximum number of items to buffer.protected intm_PollTimeoutthe 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 voidbufferData(Object value)For buffering the data received from the webservice.voidcleanUp()Cleans up data structures, frees up memory.voiddefineOptions()Adds options to the internal list of options.protected intgetDefaultMaxBuffer()Returns the default maximum for the buffer.intgetMaxBuffer()Returns the maximum number of items to buffer.booleanhasPendingOutput()Checks whether any output can be collected.protected voidinitialize()Initializes the members.StringmaxBufferTipText()Returns the tip text for this property.Objectoutput()Returns the received data.protected Objectpoll()Waits for the next data object, polling the queue.voidsetMaxBuffer(int value)Sets the maximum number of items to buffer.StringsetUp()Hook method for performing checks at setup time.voidstopExecution()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:
defineOptionsin interfaceadams.core.option.OptionHandler- Overrides:
defineOptionsin classadams.core.option.AbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractRatInput
-
setUp
public String setUp()
Hook method for performing checks at setup time.- Specified by:
setUpin interfaceRatInput- Overrides:
setUpin 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:
setMaxBufferin interfaceBufferedRatInput- Parameters:
value- the maximum number of items to buffer
-
getMaxBuffer
public int getMaxBuffer()
Returns the maximum number of items to buffer.- Specified by:
getMaxBufferin interfaceBufferedRatInput- Returns:
- the maximum number of items to buffer
-
maxBufferTipText
public String maxBufferTipText()
Returns the tip text for this property.- Specified by:
maxBufferTipTextin 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:
bufferDatain 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:
hasPendingOutputin interfaceRatInput- Specified by:
hasPendingOutputin classAbstractRatInput- Returns:
- true if output available
-
output
public Object output()
Returns the received data.- Specified by:
outputin interfaceRatInput- Specified by:
outputin classAbstractRatInput- Returns:
- the data, null if none available or stopped
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecutionin interfaceRatInput- Specified by:
stopExecutionin interfaceadams.core.Stoppable- Overrides:
stopExecutionin classAbstractRatInput
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUpin interfaceadams.core.CleanUpHandler- Overrides:
cleanUpin classAbstractRatInput
-
-