當前位置: 首頁>>代碼示例>>Java>>正文


Java ConfigurationBuilder.build方法代碼示例

本文整理匯總了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());
}
 
開發者ID:donovanmuller,項目名稱:camel-twitter-stream,代碼行數:20,代碼來源:TwitterSourceConfiguration.java

示例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();

    }
}
 
開發者ID:gidim,項目名稱:Babler,代碼行數:19,代碼來源:TwitterJobManagerUser.java

示例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();
    }
}
 
開發者ID:gidim,項目名稱:Babler,代碼行數:18,代碼來源:TwitterCodeSwitchSJobManager.java

示例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();

    }
}
 
開發者ID:gidim,項目名稱:Babler,代碼行數:20,代碼來源:TwitterJobManager.java

示例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();
    }
}
 
開發者ID:gidim,項目名稱:Babler,代碼行數:18,代碼來源:TwitterSentimentJobManager.java

示例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;
}
 
開發者ID:Rubicon-Bot,項目名稱:Rubicon,代碼行數:24,代碼來源:CommandTwitter.java

示例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;
}
 
開發者ID:prosecconetwork,項目名稱:The-NOC-List,代碼行數:18,代碼來源:TweetSearcher.java

示例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;
}
 
開發者ID:prosecconetwork,項目名稱:The-NOC-List,代碼行數:17,代碼來源:TweetLaunchpad.java

示例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","");
    }
}
 
開發者ID:jacamo-lang,項目名稱:jacamo,代碼行數:25,代碼來源:Twitter.java

示例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"));
}
 
開發者ID:mayconbordin,項目名稱:erad2016-streamprocessing,代碼行數:26,代碼來源:TwitterSpout.java

示例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();
	
}
 
開發者ID:jpatanooga,項目名稱:strata-2016-nyc-dl4j-rnn,代碼行數:18,代碼來源:LagerBot.java

示例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();
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:28,代碼來源:TwitterConfiguration.java

示例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);
    }
}
 
開發者ID:fraunhoferfokus,項目名稱:govapps,代碼行數:23,代碼來源:ContentPortlet.java

示例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();
	}
}
 
開發者ID:MCUpdater,項目名稱:RavenBot,代碼行數:18,代碼來源:TwitterHandler.java

示例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);
}
 
開發者ID:brunocvcunha,項目名稱:taskerbox,代碼行數:17,代碼來源:TwitterChannel.java


注:本文中的twitter4j.conf.ConfigurationBuilder.build方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。