public void installRMIModule() {
bind(RMIServer.class).toInstance(new RMIServer(config));
}
public void installTwitterModule() {
final Credits cred = config.getTwitterSearchCredits();
// logger.info("TWITTER:"+cred.getConsumerKey() + " " + cred.getConsumerSecret());
// logger.info(cred.getToken() + " " + cred.getTokenSecret());
final TwitterSearch ts = createTwitterSearch().setConsumer(
cred.getConsumerKey(), cred.getConsumerSecret());
try {
ts.initTwitter4JInstance(cred.getToken(), cred.getTokenSecret(), true);
} catch (Exception ex) {
logger.error("Cannot create twitter4j instance!\n######### TWITTER4J ERROR: But start jetwick nevertheless! Error:" + ex);
}
bind(TwitterSearch.class).toProvider(new Provider<TwitterSearch>() {
@Override
public TwitterSearch get() {
// avoid exception in this getter: do not call twitter.verify which can fail if twitter down etc
return createTwitterSearch().setConsumer(
cred.getConsumerKey(), cred.getConsumerSecret()).
setTwitter4JInstance(ts.getTwitter4JInstance());
}
});
}