T
- Type of items in the streampublic abstract class AbstractTwitterSearchDataset<T> extends BlockingDroppingBufferedStream<T> implements StreamingDataset<T>
SearchResource.search(Query)
function periodically and offers all
discovered Status
instances with the underlying
BlockingDroppingBufferedStream
. This stream initially takes all
search results available and then attempts to retrieve results which occurred
after the latest Tweet seen. Apart form this, this Stream
makes no
special efforts to:
This class is abstract in terms of the object the stream consumes. Instances of this class can construct the specific object they require for each twitter status using:
Modifier and Type | Field and Description |
---|---|
protected twitter4j.conf.Configuration |
config |
protected org.apache.log4j.Logger |
logger |
protected twitter4j.Query |
query |
protected twitter4j.Twitter |
twitter |
Modifier | Constructor and Description |
---|---|
protected |
AbstractTwitterSearchDataset(TwitterAPIToken token,
BlockingDroppingQueue<T> buffer,
twitter4j.Query query) |
Modifier and Type | Method and Description |
---|---|
abstract twitter4j.Query |
getQuery()
Get the current query
|
T |
getRandomInstance() |
protected twitter4j.conf.Configuration |
makeConfiguration(TwitterAPIToken token) |
int |
numInstances()
Returns the number of instances in this dataset.
|
protected abstract void |
registerStatus(twitter4j.Query query,
twitter4j.Status status,
String rawjson)
Handle the given incoming status and optionally
BlockingDroppingBufferedStream.register(Object)
it with the stream. |
close, getBuffer, hasNext, next, register
filter, forEach, forEach, forEach, iterator, map, map, parallelForEach, parallelForEach, remove, transform
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
filter, forEach, forEach, forEach, map, map, parallelForEach, parallelForEach, transform
forEachRemaining, hasNext, next, remove
forEach, iterator, spliterator
protected twitter4j.Query query
protected org.apache.log4j.Logger logger
protected twitter4j.conf.Configuration config
protected twitter4j.Twitter twitter
protected AbstractTwitterSearchDataset(TwitterAPIToken token, BlockingDroppingQueue<T> buffer, twitter4j.Query query)
token
- buffer
- protected abstract void registerStatus(twitter4j.Query query, twitter4j.Status status, String rawjson) throws InterruptedException
BlockingDroppingBufferedStream.register(Object)
it with the stream.query
- the querystatus
- the parsed Status
rawjson
- the raw json stringInterruptedException
public abstract twitter4j.Query getQuery()
protected twitter4j.conf.Configuration makeConfiguration(TwitterAPIToken token)
public T getRandomInstance()
getRandomInstance
in interface Dataset<T>
public int numInstances()
Dataset
numInstances
in interface Dataset<T>