private static twitter4j.conf.Configuration getTwitterConfiguration( String strAccessToken, String token_secret) { ConfigurationBuilder builder = new ConfigurationBuilder(); builder.setUseSSL(true); builder.setOAuthConsumerKey(Constants.OFFICIAL_TWITTER_CONSUMER_KEY); builder.setOAuthConsumerSecret(Constants.OFFICIAL_TWITTER_CONSUMER_SECRET_KEY); if (token_secret != null && strAccessToken != null) { builder.setOAuthAccessToken(strAccessToken).setOAuthAccessTokenSecret(token_secret); } return builder.build(); }
public void configureNeedingPersistence(PlatformConfiguration pc) { try { // Twitter twitter = TwitterFactory.getSingleton(); ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setUseSSL(true); cb.setOAuthConsumerKey(TwitterUtilities.getApiKey()) .setOAuthConsumerSecret(TwitterUtilities.getApiKeySecret()); TwitterFactory tf = new TwitterFactory(cb.build()); twitter = tf.getInstance(); } catch (Throwable t) { Tracer.platformLogger.error("TwitterBaseImpl.setOAuthConsumer ", t); } /*try { MpJobsLauncher.launch("system"); } catch (Exception e) { Tracer.logExceptionOnPlatformOrOther(e); } */ }