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


Java ConfigurationBuilder類代碼示例

本文整理匯總了Java中twitter4j.conf.ConfigurationBuilder的典型用法代碼示例。如果您正苦於以下問題:Java ConfigurationBuilder類的具體用法?Java ConfigurationBuilder怎麽用?Java ConfigurationBuilder使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ConfigurationBuilder類屬於twitter4j.conf包,在下文中一共展示了ConfigurationBuilder類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import twitter4j.conf.ConfigurationBuilder; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // setup twitter client
    mTwitter = new TwitterFactory(new ConfigurationBuilder()
            .setOAuthConsumerKey(getResources().getString(R.string.twitter_consumer_key))
            .setOAuthConsumerSecret(getResources().getString(R.string.twitter_consumer_secret))
            .build()).getInstance();

    // setup twitter webview
    mTwitterView = new WebView(this);
    mTwitterView.getSettings().setJavaScriptEnabled(true);

    // initialize view
    setContentView(mTwitterView);

    // start the web view
    loginToTwitter();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:21,代碼來源:TwitterOAuthActivity.java

示例2: 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

示例3: getTwitter

import twitter4j.conf.ConfigurationBuilder; //導入依賴的package包/類
private Twitter getTwitter() {
    TwitterCredentials creds = readCredentials();
    if (creds.getConsumerKey() == null) {
        throw new RuntimeException("Incorrect Twitter client configuration: Consumer key is null");
    }
    if (creds.getConsumerSecret() == null) {
        throw new RuntimeException("Incorrect Twitter client configuration: Consumer secret is null");
    }
    if (creds.getAccessSecret() == null) {
        throw new RuntimeException("Incorrect Twitter client configuration: Access secret is null");
    }
    if (creds.getAccessToken() == null) {
        throw new RuntimeException("Incorrect Twitter client configuration: Access token is null");
    }
    ConfigurationBuilder twitterConfig = new ConfigurationBuilder();
    twitterConfig.setOAuthConsumerKey(creds.getConsumerKey());
    twitterConfig.setOAuthConsumerSecret(creds.getConsumerSecret());
    twitterConfig.setOAuthAccessToken(creds.getAccessToken());
    twitterConfig.setOAuthAccessTokenSecret(creds.getAccessSecret());
    twitterConfig.setJSONStoreEnabled(true);
    return new TwitterFactory(twitterConfig.build()).getInstance();
}
 
開發者ID:arun-gupta,項目名稱:tweet-analysis,代碼行數:23,代碼來源:TwitterFeed.java

示例4: TwSfValidationSteps

import twitter4j.conf.ConfigurationBuilder; //導入依賴的package包/類
public TwSfValidationSteps() {

		accountsDirectory = AccountsDirectory.getInstance();
		final Account twitterTalky = accountsDirectory.getAccount(RestConstants.getInstance().getSYNDESIS_TALKY_ACCOUNT()).get();
		//twitter
		final TwitterFactory factory = new TwitterFactory(new ConfigurationBuilder()
				.setOAuthConsumerKey(twitterTalky.getProperty("consumerKey"))
				.setOAuthConsumerSecret(twitterTalky.getProperty("consumerSecret"))
				.setOAuthAccessToken(twitterTalky.getProperty("accessToken"))
				.setOAuthAccessTokenSecret(twitterTalky.getProperty("accessTokenSecret"))
				.build());
		twitter = factory.getInstance();
		// salesforce
		final Account salesforceAccount = accountsDirectory.getAccount("salesforce").get();
		salesforce = new ForceApi(new ApiConfig()
				.setClientId(salesforceAccount.getProperty("clientId"))
				.setClientSecret(salesforceAccount.getProperty("clientSecret"))
				.setUsername(salesforceAccount.getProperty("userName"))
				.setPassword(salesforceAccount.getProperty("password"))
				.setForceURL(salesforceAccount.getProperty("loginUrl")));
	}
 
開發者ID:syndesisio,項目名稱:syndesis-qe,代碼行數:22,代碼來源:TwSfValidationSteps.java

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: configureTwitter

import twitter4j.conf.ConfigurationBuilder; //導入依賴的package包/類
private static Twitter configureTwitter(Account account) {
    final ConfigurationBuilder builder = new ConfigurationBuilder();

    builder.setOAuthConsumerKey(Config.TWITTER_CONSUMER_KEY);
    builder.setOAuthConsumerSecret(Config.TWITTER_CONSUMER_SECRET);
    builder.setOAuthAccessTokenSecret(account.tokenSecret());
    builder.setOAuthAccessToken(account.token());

    return new TwitterFactory(builder.build()).getInstance();
}
 
開發者ID:mecid,項目名稱:robird-reborn,代碼行數:11,代碼來源:BaseTwitterModel.java

示例11: twitterStream

import twitter4j.conf.ConfigurationBuilder; //導入依賴的package包/類
@Bean
public TwitterStream twitterStream() {
	String consumerKey = environment.getRequiredProperty("consumerKey");
	String consumerSecret = environment.getRequiredProperty("consumerSecret");
	String accessToken = environment.getRequiredProperty("accessToken");
	String accessTokenSecret = environment.getRequiredProperty("accessTokenSecret");

	ConfigurationBuilder cb = new ConfigurationBuilder();
	cb.setOAuthConsumerKey(consumerKey);
	cb.setOAuthConsumerSecret(consumerSecret);
	cb.setOAuthAccessToken(accessToken);
	cb.setOAuthAccessTokenSecret(accessTokenSecret);
	cb.setJSONStoreEnabled(true);
	cb.setIncludeEntitiesEnabled(true);

	return new TwitterStreamFactory(cb.build()).getInstance();
}
 
開發者ID:malejpavouk,項目名稱:kafka-twitter-producer,代碼行數:18,代碼來源:TwitterProducerApp.java

示例12: TwitterNotifier

import twitter4j.conf.ConfigurationBuilder; //導入依賴的package包/類
public TwitterNotifier() throws NotificationException {
    super(CLIENT_ID, SECRET_ID,
            PromptReceiver.class,
            "com.yfiton.notifiers.twitter.TwitterWebEngineListener");

    ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
    configurationBuilder
            .setGZIPEnabled(true)
            .setDebugEnabled(true)
            .setOAuthConsumerKey(getClientId())
            .setOAuthConsumerSecret(getClientSecret());

    com.yfiton.notifiers.twitter.AccessToken accessToken = getAccessToken();

    if (accessToken != null) {
        configurationBuilder.setOAuthAccessToken(accessToken.getAccessToken());
        configurationBuilder.setOAuthAccessTokenSecret(accessToken.getAccessTokenSecret());
    }

    twitter =
            new TwitterFactory(
                    configurationBuilder.build()).getInstance();
}
 
開發者ID:yfiton,項目名稱:yfiton,代碼行數:24,代碼來源:TwitterNotifier.java

示例13: 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

示例14: 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

示例15: generateRunners

import twitter4j.conf.ConfigurationBuilder; //導入依賴的package包/類
public static SearchRunner[] generateRunners(
        TwitterCredentials[] credentials,
        QueryAssemblyStrategy qaStrategy,
        ResultReceiver receiver
) throws TwitterException {
    SearchRunner[] runners = new SearchRunner[credentials.length];
    for (int i = 0; i < credentials.length; i++) {
        Twitter connection = new TwitterFactory(
                new ConfigurationBuilder()
                        .setOAuthConsumerKey(credentials[i].consumerKey)
                        .setOAuthConsumerSecret(credentials[i].consumerSecret)
                        .setOAuthAccessToken(credentials[i].token)
                        .setOAuthAccessTokenSecret(credentials[i].tokenSecret).build()
        ).getInstance();
        runners[i] = new SearchRunner(connection, qaStrategy, receiver);
    }
    return runners;
}
 
開發者ID:Remper,項目名稱:sociallink,代碼行數:19,代碼來源:SearchRunner.java


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