public class TwitterUserInformationProvider extends Object implements StreamsProvider, Serializable
Modifier and Type | Field and Description |
---|---|
protected Twitter |
client |
protected org.joda.time.DateTime |
end |
protected com.google.common.util.concurrent.ListeningExecutorService |
executor |
protected List<Long> |
ids |
protected ReadWriteLock |
lock |
protected static com.fasterxml.jackson.databind.ObjectMapper |
MAPPER |
static int |
MAX_NUMBER_WAITING |
protected List<String> |
names |
protected Queue<StreamsDatum> |
providerQueue |
protected AtomicBoolean |
running |
protected org.joda.time.DateTime |
start |
Constructor and Description |
---|
TwitterUserInformationProvider()
TwitterUserInformationProvider constructor.
|
TwitterUserInformationProvider(TwitterUserInformationConfiguration config) |
Modifier and Type | Method and Description |
---|---|
void |
cleanUp() |
protected Queue<StreamsDatum> |
constructQueue() |
TwitterUserInformationConfiguration |
getConfig() |
String |
getId() |
Queue<StreamsDatum> |
getProviderQueue() |
protected Twitter |
getTwitterClient() |
boolean |
isRunning() |
static void |
main(String[] args)
To use from command line:
Supply (at least) the following required configuration in application.conf:
twitter.oauth.consumerKey
twitter.oauth.consumerSecret
twitter.oauth.accessToken
twitter.oauth.accessTokenSecret
twitter.info
Launch using:
mvn exec:java -Dexec.mainClass=org.apache.streams.twitter.provider.TwitterUserInformationProvider -Dexec.args="application.conf tweets.json"
|
static ExecutorService |
newFixedThreadPoolWithQueueSize(int numThreads,
int queueSize) |
void |
prepare(Object configurationObject) |
StreamsResultSet |
readCurrent() |
StreamsResultSet |
readNew(BigInteger sequence) |
StreamsResultSet |
readRange(org.joda.time.DateTime start,
org.joda.time.DateTime end) |
void |
setConfig(TwitterUserInformationConfiguration config) |
void |
startStream() |
protected void |
submitUserInformationThreads(List<Long> ids,
List<String> names) |
protected static com.fasterxml.jackson.databind.ObjectMapper MAPPER
public static final int MAX_NUMBER_WAITING
protected final ReadWriteLock lock
protected volatile Queue<StreamsDatum> providerQueue
protected Twitter client
protected com.google.common.util.concurrent.ListeningExecutorService executor
protected org.joda.time.DateTime start
protected org.joda.time.DateTime end
protected final AtomicBoolean running
public TwitterUserInformationProvider()
public TwitterUserInformationProvider(TwitterUserInformationConfiguration config)
public TwitterUserInformationConfiguration getConfig()
public void setConfig(TwitterUserInformationConfiguration config)
public static void main(String[] args) throws Exception
args
- argsException
- Exceptionpublic static ExecutorService newFixedThreadPoolWithQueueSize(int numThreads, int queueSize)
public Queue<StreamsDatum> getProviderQueue()
public String getId()
getId
in interface StreamsOperation
public void prepare(Object configurationObject)
prepare
in interface StreamsOperation
protected void submitUserInformationThreads(List<Long> ids, List<String> names)
public void startStream()
startStream
in interface StreamsProvider
public StreamsResultSet readCurrent()
readCurrent
in interface StreamsProvider
protected Queue<StreamsDatum> constructQueue()
public StreamsResultSet readNew(BigInteger sequence)
readNew
in interface StreamsProvider
public StreamsResultSet readRange(org.joda.time.DateTime start, org.joda.time.DateTime end)
readRange
in interface StreamsProvider
public boolean isRunning()
isRunning
in interface StreamsProvider
protected Twitter getTwitterClient() throws InstantiationException
InstantiationException
public void cleanUp()
cleanUp
in interface StreamsOperation
Copyright © 2018 The Apache Software Foundation. All rights reserved.