本文整理匯總了Java中twitter4j.conf.ConfigurationBuilder.build方法的典型用法代碼示例。如果您正苦於以下問題:Java ConfigurationBuilder.build方法的具體用法?Java ConfigurationBuilder.build怎麽用?Java ConfigurationBuilder.build使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類twitter4j.conf.ConfigurationBuilder
的用法示例。
在下文中一共展示了ConfigurationBuilder.build方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: twitterFactory
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
@Bean
@ConditionalOnMissingBean
public TwitterFactory twitterFactory() {
if (this.properties.getConsumerKey() == null
|| this.properties.getConsumerSecret() == null
|| this.properties.getAccessToken() == null
|| this.properties.getAccessTokenSecret() == null) {
throw new RuntimeException(
"Twitter properties not configured properly. Please check twitter.* properties settings in configuration file.");
}
ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
configurationBuilder.setDebugEnabled(false)
.setOAuthConsumerKey(properties.getConsumerKey())
.setOAuthConsumerSecret(properties.getConsumerSecret())
.setOAuthAccessToken(properties.getAccessToken())
.setOAuthAccessTokenSecret(properties.getAccessTokenSecret());
return new TwitterFactory(configurationBuilder.build());
}
示例2: TwitterJobManagerUser
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
public TwitterJobManagerUser()
{
languageDetector = new LanguageDetector();
for(int i =0; i< twitKey.length; i++)
{
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(twitKey[i].getConsumer())
.setOAuthConsumerSecret(twitKey[i].getSecret())
.setOAuthAccessToken(twitKey[i].getAccess())
.setOAuthAccessTokenSecret(twitKey[i].getToken_secret());
TwitterFactory tf = new TwitterFactory(cb.build());
keys[i] = tf.getInstance();
}
}
示例3: TwitterCodeSwitchSJobManager
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
public TwitterCodeSwitchSJobManager()
{
languageDetector = new LanguageDetector();
for(int i =0; i< twitKey.length; i++)
{
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(twitKey[i].getConsumer())
.setOAuthConsumerSecret(twitKey[i].getSecret())
.setOAuthAccessToken(twitKey[i].getAccess())
.setOAuthAccessTokenSecret(twitKey[i].getToken_secret());
TwitterFactory tf = new TwitterFactory(cb.build());
keys[i] = tf.getInstance();
}
}
示例4: TwitterJobManager
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
public TwitterJobManager()
{
languageDetector = new LanguageDetector();
for(int i =0; i< twitKey.length; i++)
{
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(twitKey[i].getConsumer())
.setOAuthConsumerSecret(twitKey[i].getSecret())
.setOAuthAccessToken(twitKey[i].getAccess())
.setOAuthAccessTokenSecret(twitKey[i].getToken_secret());
TwitterFactory tf = new TwitterFactory(cb.build());
keys[i] = tf.getInstance();
}
}
示例5: TwitterSentimentJobManager
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
public TwitterSentimentJobManager()
{
languageDetector = new LanguageDetector();
for(int i =0; i< twitKey.length; i++)
{
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(twitKey[i].getConsumer())
.setOAuthConsumerSecret(twitKey[i].getSecret())
.setOAuthAccessToken(twitKey[i].getAccess())
.setOAuthAccessTokenSecret(twitKey[i].getToken_secret());
TwitterFactory tf = new TwitterFactory(cb.build());
keys[i] = tf.getInstance();
}
}
示例6: execute
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
@Override
protected Message execute(CommandManager.ParsedCommandInvocation parsedCommandInvocation, UserPermissions userPermissions) {
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(RubiconBot.getConfiguration().getString("twitterConsumerKey"))
.setOAuthConsumerSecret(RubiconBot.getConfiguration().getString("twitterConsumerSecret"))
.setOAuthAccessToken(RubiconBot.getConfiguration().getString("twitterAccessToken"))
.setOAuthAccessTokenSecret(RubiconBot.getConfiguration().getString("twitterAccessTokenSecret"));
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
try {
Status status = twitter.updateStatus(String.join(" ", parsedCommandInvocation.getArgs()));
parsedCommandInvocation.getMessage().getTextChannel().sendMessage(new EmbedBuilder()
.setDescription(status.getText())
.setColor(new Color(0, 153, 229))
.setAuthor("Take a look at the tweet on Twitter", "https://twitter.com/" + status.getUser().getScreenName() + "/status/" + status.getId(), "http://icons.iconarchive.com/icons/sicons/basic-round-social/512/twitter-icon.png")
.setFooter(new SimpleDateFormat("dd.MM.yyyy hh:mm:ss").format(status.getCreatedAt()), null)
.build()).queue();
} catch (TwitterException e) {
Logger.debug(e.getErrorMessage());
}
return null;
}
示例7: getTwitter
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
public Twitter getTwitter() throws TwitterException, IOException
{
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(CONSUMER_KEY)
.setOAuthConsumerSecret(CONSUMER_SECRET)
.setOAuthAccessToken(ACCESS_TOKEN)
.setOAuthAccessTokenSecret(ACCESS_SECRET);
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
twitter.setOAuthAccessToken(new AccessToken(ACCESS_TOKEN, ACCESS_SECRET));
return twitter;
}
示例8: getTwitter
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
public Twitter getTwitter() throws TwitterException, IOException
{
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(CONSUMER_KEY)
.setOAuthConsumerSecret(CONSUMER_KEY_SECRET);
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
twitter.setOAuthAccessToken(new AccessToken(ACCESS_TOKEN,
ACCESS_TOKEN_SECRET));
return twitter;
}
示例9: init
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
/**
* Instantiate a twitter artifact configured with a consumer
* key/secret and an access token/secret got for accessing
* a Twitter account-
*/
void init(String consumerKey, String consumerSecret, String accessToken, String accessSecret) {
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(consumerKey)
.setOAuthConsumerSecret(consumerSecret)
.setOAuthAccessToken(accessToken)
.setOAuthAccessTokenSecret(accessSecret);
factory = new TwitterFactory(cb.build());
twitter = factory.getInstance();
try {
List<Status> statuses = twitter.getHomeTimeline();
defineObsProperty("tw_user_status",statuses.get(0).getText());
} catch (Exception ex){
ex.printStackTrace();
defineObsProperty("tw_user_status","");
}
}
示例10: open
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
public void open(Map conf, TopologyContext context,
SpoutOutputCollector collector) {
queue = new LinkedBlockingQueue<String>(1000);
this.collector = collector;
StatusListener listener = new StatusListener() {
public void onStatus(Status status) {
queue.offer(TwitterObjectFactory.getRawJSON(status));
}
public void onDeletionNotice(StatusDeletionNotice sdn) { }
public void onTrackLimitationNotice(int i) { }
public void onScrubGeo(long l, long l1) { }
public void onStallWarning(StallWarning stallWarning) { }
public void onException(Exception e) { }
};
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setJSONStoreEnabled(true);
TwitterStreamFactory factory = new TwitterStreamFactory(cb.build());
twitterStream = factory.getInstance();
twitterStream.addListener(listener);
twitterStream.filter(new FilterQuery().language("en").track("trump"));
}
示例11: init
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
public void init() throws TwitterException {
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey("50S8DbHNUlryNiZ0PxRvp6GAC")
.setOAuthConsumerSecret("eMLgmvUyjd9hme7i7xTs4uzxk5Qm3tBi7mhtIQcMMjMl41tqi0")
.setOAuthAccessToken("776810737935257601-OtcUXTM7XDGthO8Yf194VM6MNAfHeWx")
.setOAuthAccessTokenSecret("VP2QqbSoecvK5vgQr7ySLBI0NoQPQ7oPXZhVOIdlPy7Fp");
TwitterFactory tf = new TwitterFactory(cb.build());
this.twitter = tf.getInstance();
//String review
this.loadLSTMModel();
}
示例12: getConfiguration
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
/**
* Builds a Twitter4J Configuration using the OAuth params.
*
* @return Configuration
*/
public Configuration getConfiguration() {
checkComplete();
ConfigurationBuilder confBuilder = new ConfigurationBuilder();
confBuilder.setOAuthConsumerKey(consumerKey);
confBuilder.setOAuthConsumerSecret(consumerSecret);
confBuilder.setOAuthAccessToken(accessToken);
confBuilder.setOAuthAccessTokenSecret(accessTokenSecret);
if (getHttpProxyHost() != null) {
confBuilder.setHttpProxyHost(getHttpProxyHost());
}
if (getHttpProxyUser() != null) {
confBuilder.setHttpProxyHost(getHttpProxyUser());
}
if (getHttpProxyPassword() != null) {
confBuilder.setHttpProxyHost(getHttpProxyPassword());
}
if (httpProxyPort != null) {
confBuilder.setHttpProxyPort(httpProxyPort);
}
return confBuilder.build();
}
示例13: publish
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
private static void publish(String appName, long appid) {
try {
String tweetString = "neuste App: http://www.govapps.de/?root=1&appid=" + appid + " " + appName + " veröffentlicht.";
_log.debug("tweetString: "+ tweetString);
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(false)
.setOAuthConsumerKey("7ZVgfKiOvBDcDFpytRWSA")
.setOAuthConsumerSecret("JmeJVeym78arzmGthrDUshQyhkq6nWA9tWLUKxc")
.setOAuthAccessToken("1128008024-blkDYfot8A0DdKj6kznxtcDi122hMZoXCbQuzXT")
.setOAuthAccessTokenSecret("c2YdcPPrB496YQ9QbYGXjNCVBavafCHWMbekAIRc");
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();
Status status = twitter.updateStatus(tweetString);
_log.debug("Successfully updated the status to [" + status.getText() + "].");
// System.exit(0);
} catch (TwitterException te) {
te.printStackTrace();
_log.debug("Failed to get timeline: " + te.getMessage());
// System.exit(-1);
}
}
示例14: TwitterHandler
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
public TwitterHandler() {
ConfigurationBuilder cb = new ConfigurationBuilder();
Settings current = SettingsManager.getInstance().getSettings();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(current.getTwitCKey())
.setOAuthConsumerSecret(current.getTwitCSecret())
.setOAuthAccessToken(current.getTwitToken())
.setOAuthAccessTokenSecret(current.getTwitTSecret());
TwitterFactory tf = new TwitterFactory(cb.build());
twitter = tf.getInstance();
try {
System.out.println("Twitter User ID: " + twitter.getId());
System.out.println("Twitter Screen Name: " + twitter.getScreenName());
} catch (Exception e) {
e.printStackTrace();
}
}
示例15: setup
import twitter4j.conf.ConfigurationBuilder; //導入方法依賴的package包/類
@Override
public void setup() throws IllegalStateException, TwitterException {
logInfo(log, "Twitter setup...");
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true).setOAuthConsumerKey(this.consumerKey)
.setOAuthConsumerSecret(this.consumerSecret).setOAuthAccessToken(this.accessToken)
.setOAuthAccessTokenSecret(this.accessTokenSecret);
TwitterFactory tf = new TwitterFactory(cb.build());
this.twitter = tf.getInstance();
this.loggedUser = this.twitter.getScreenName();
logInfo(log, "Twitter setup finished! Logged user is " + this.loggedUser);
}