static ResponseList<Location> createLocationList(HttpResponse res, Configuration conf) throws TwitterException { if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); } return createLocationList(res.asJSONArray(), conf.isJSONStoreEnabled()); }
/*package*/ SavedSearchJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { super(res); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); } JSONObject json = res.asJSONObject(); init(json); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.registerJSONObject(this, json); } }
/*package*/UserJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { super(res); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); } JSONObject json = res.asJSONObject(); init(json); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.registerJSONObject(this, json); } }
/*package*/ UserListJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { super(res); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); } JSONObject json = res.asJSONObject(); init(json); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.registerJSONObject(this, json); } }
Status asStatus(JSONObject json) throws TwitterException { Status status = new StatusJSONImpl(json); if (CONF.isJSONStoreEnabled()) { TwitterObjectFactory.registerJSONObject(status, json); } return status; }
UserList asUserList(JSONObject json) throws TwitterException { UserList userList = new UserListJSONImpl(json); if (CONF.isJSONStoreEnabled()) { TwitterObjectFactory.registerJSONObject(userList, json); } return userList; }
/*package*/StatusJSONImpl(JSONObject json, Configuration conf) throws TwitterException { super(); init(json); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.registerJSONObject(this, json); } }
User asUser(JSONObject json) throws TwitterException { User user = new UserJSONImpl(json); if (CONF.isJSONStoreEnabled()) { TwitterObjectFactory.registerJSONObject(user, json); } return user; }
TrendsJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { super(res); init(res.asString(), conf.isJSONStoreEnabled()); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); TwitterObjectFactory.registerJSONObject(this, res.asString()); } }
/*package*/ RelationshipJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { this(res, res.asJSONObject()); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); TwitterObjectFactory.registerJSONObject(this, res.asJSONObject()); } }
/*package*/ AccountSettingsJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { this(res, res.asJSONObject()); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); TwitterObjectFactory.registerJSONObject(this, res.asJSONObject()); } }
/*package*/ IDsJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { super(res); String json = res.asString(); init(json); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); TwitterObjectFactory.registerJSONObject(this, json); } }
/*package*/StatusJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { super(res); JSONObject json = res.asJSONObject(); init(json); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); TwitterObjectFactory.registerJSONObject(this, json); } }
static Map<String, RateLimitStatus> createRateLimitStatuses(HttpResponse res, Configuration conf) throws TwitterException { JSONObject json = res.asJSONObject(); Map<String, RateLimitStatus> map = createRateLimitStatuses(json); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); TwitterObjectFactory.registerJSONObject(map, json); } return map; }
/*package*/ AccountTotalsJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { this(res, res.asJSONObject()); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); TwitterObjectFactory.registerJSONObject(this, res.asJSONObject()); } }
/*package*/ PlaceJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { super(res); JSONObject json = res.asJSONObject(); init(json); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); TwitterObjectFactory.registerJSONObject(this, json); } }
/*package*/ OEmbedJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { super(res); JSONObject json = res.asJSONObject(); init(json); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); TwitterObjectFactory.registerJSONObject(this, json); } }
DirectMessage asDirectMessage(JSONObject json) throws TwitterException { try { JSONObject dmJSON = json.getJSONObject("direct_message"); DirectMessage directMessage = new DirectMessageJSONImpl(dmJSON); if (CONF.isJSONStoreEnabled()) { TwitterObjectFactory.registerJSONObject(directMessage, dmJSON); } return directMessage; } catch (JSONException jsone) { throw new TwitterException(jsone); } }
/** * * @param kafkaHost the host * @param kafkaTopic the topic name on which to publish the tweets * @param kafkaPort the port for Kafka clients to connect */ public TweetIngestor(String kafkaHost,String kafkaTopic, int kafkaPort, String track, double tweetRate) { TwitterStreamFactory fact = new TwitterStreamFactory(); checkState(fact.getInstance().getConfiguration().isJSONStoreEnabled(), "Twitter4j JSON store is disabled. You must enabled it in the twitter4j.properties file!"); stream = fact.getInstance(); poster = new RemoteKafkaPoster(METRIC_REGISTRY, kafkaHost, kafkaPort); this.kafkaTopic = kafkaTopic; this.rateLimiter = RateLimiter.create(tweetRate); this.track = track; }
/*package*/DirectMessageJSONImpl(HttpResponse res, Configuration conf) throws TwitterException { super(res); JSONObject json = res.asJSONObject(); try { JSONObject event = json.getJSONObject("event"); init(event); if (conf.isJSONStoreEnabled()) { TwitterObjectFactory.clearThreadLocalMap(); TwitterObjectFactory.registerJSONObject(this, event); } } catch (JSONException jsone) { throw new TwitterException(jsone); } }