Package twitter4j.conf

Examples of twitter4j.conf.ConfigurationBuilder


     * Builds a Twitter4J Configuration using the OAuth params.
     *
     * @return Configuration
     */
    public Configuration getConfiguration() {
        ConfigurationBuilder confBuilder = new ConfigurationBuilder();
        confBuilder.setOAuthConsumerKey(consumerKey);
        confBuilder.setOAuthConsumerSecret(consumerSecret);
        confBuilder.setOAuthAccessToken(accessToken);
        confBuilder.setOAuthAccessTokenSecret(accessTokenSecret);
        return confBuilder.build();
    }
View Full Code Here


        props.load(new FileInputStream(new File("/tmp/twitlogic.props")));
        TwitLogic.setConfiguration(props);

        TwitterCredentials cred = new TwitterCredentials();

        ConfigurationBuilder cb = new ConfigurationBuilder();
        cb.setDebugEnabled(true)
                .setOAuthConsumerKey(cred.getConsumerKey())
                .setOAuthConsumerSecret(cred.getConsumerSecret())
                .setOAuthAccessToken(cred.getAccessToken())
                .setOAuthAccessTokenSecret(cred.getTokenSecret());

        TwitterFactory tf = new TwitterFactory(cb.build());
        Twitter twitter = tf.getInstance();

        List<Status> statuses = twitter.getHomeTimeline();

        System.out.println("Showing friends timeline.");
View Full Code Here

    private final Twitter4jRateLimiter rateLimiter;

    public Twitter4jClient() throws TwitterClientException {
        TwitterCredentials cred = new TwitterCredentials();

        ConfigurationBuilder cb = new ConfigurationBuilder();
        cb.setDebugEnabled(true)
                .setOAuthConsumerKey(cred.getConsumerKey())
                .setOAuthConsumerSecret(cred.getConsumerSecret())
                .setOAuthAccessToken(cred.getAccessToken())
                .setOAuthAccessTokenSecret(cred.getTokenSecret());

        Configuration conf = cb.build();

        TwitterFactory tf = new TwitterFactory(conf);
        twitter = tf.getInstance();

        streamFactory = new TwitterStreamFactory(conf);
View Full Code Here

        t = new Thread(new Dequeuer());
    }

    public void connectAndRead() throws Exception {

        ConfigurationBuilder cb = new ConfigurationBuilder();
        Properties twitterProperties = new Properties();
        File twitter4jPropsFile = new File(System.getProperty("user.home") + "/twitter4j.properties");
        if (!twitter4jPropsFile.exists()) {
            logger.error(
                    "Cannot find twitter4j.properties file in this location :[{}]. Make sure it is available at this place and includes user/password credentials",
                    twitter4jPropsFile.getAbsolutePath());
            return;
        }
        twitterProperties.load(new FileInputStream(twitter4jPropsFile));

        cb.setDebugEnabled(Boolean.valueOf(twitterProperties.getProperty("debug")))
                .setUser(twitterProperties.getProperty("user")).setPassword(twitterProperties.getProperty("password"));
        TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance();
        StatusListener statusListener = new StatusListener() {

            @Override
            public void onException(Exception ex) {
                logger.error("error", ex);
View Full Code Here

import twitter4j.conf.Configuration;
import twitter4j.conf.ConfigurationBuilder;

public class Config {
    public static Configuration get() {
        ConfigurationBuilder cb = new ConfigurationBuilder();
        cb.setHttpProxyHost("proxy.msg.de").setHttpProxyPort(3128);
        return cb.build();
    }
View Full Code Here

  @Override
  protected void init(final String authorizationLocation, final String tokenLocation, final String clientId, final String clientSecret, final String redirectUri, final Class tokenResponseClass) {

    super.init(authorizationLocation, tokenLocation, clientId, clientSecret, redirectUri, tokenResponseClass);

    ConfigurationBuilder cb = new ConfigurationBuilder();
    cb.setOAuthAuthorizationURL(authorizationLocation);
    cb.setOAuthAccessTokenURL(tokenLocation);

    Configuration conf = cb.build();
   
    TwitterFactory tf = new TwitterFactory(conf);
    twitter = tf.getInstance();
    twitter.setOAuthConsumer(clientId, clientSecret);
   
View Full Code Here

        log.debug("configuration: clientId=" + clientID +
                ", clientSecret=" + clientSecret +
                ", redirectURL=" + redirectURL);

        // Create 'generic' twitterFactory for user authentication to GateIn
        ConfigurationBuilder builder = new ConfigurationBuilder();
        builder.setOAuthConsumerKey(clientID).setOAuthConsumerSecret(clientSecret);
        twitterFactory = new TwitterFactory(builder.build());
    }
View Full Code Here

        }
    }

    @Override
    public Twitter getAuthorizedTwitterInstance(TwitterAccessTokenContext accessTokenContext) {
        ConfigurationBuilder builder = new ConfigurationBuilder();
        builder.setOAuthConsumerKey(clientID).setOAuthConsumerSecret(clientSecret);

        // Now add accessToken properties to builder
        builder.setOAuthAccessToken(accessTokenContext.getAccessToken());
        builder.setOAuthAccessTokenSecret(accessTokenContext.getAccessTokenSecret());

        // Return twitter instance with successfully established accessToken
        return new TwitterFactory(builder.build()).getInstance();
    }
View Full Code Here

        log.debug("acces TOKEN "+accessToken);
        this.consumerKey = consumerKey;
        this.consumerSecret = consumerSecret;
        this.secretToken = secretToken;
        this.accessToken = accessToken;
        this.configurationBuilder = new ConfigurationBuilder();
        this.configurationBuilder.setDebugEnabled(true)
          .setOAuthConsumerKey(this.consumerKey)
          .setOAuthConsumerSecret(this.consumerSecret)
          .setOAuthAccessToken(this.accessToken)
          .setOAuthAccessTokenSecret(this.secretToken);
View Full Code Here

        this.consumerKey = consumerKey;
        this.consumerSecret = consumerSecret;
        this.secretToken = account.getSecretToken();
        this.accessToken = account.getAccessToken();
        this.socialAccount = account;
        this.configurationBuilder = new ConfigurationBuilder();
        this.configurationBuilder.setDebugEnabled(true)
          .setOAuthConsumerKey(this.consumerKey)
          .setOAuthConsumerSecret(this.consumerSecret)
          .setOAuthAccessToken(this.accessToken)
          .setOAuthAccessTokenSecret(this.secretToken);
View Full Code Here

TOP

Related Classes of twitter4j.conf.ConfigurationBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.