List of usage examples for twitter4j.conf PropertyConfiguration REST_BASE_URL
String REST_BASE_URL
To view the source code for twitter4j.conf PropertyConfiguration REST_BASE_URL.
Click Source Link
From source file:org.rhq.plugins.twitter.FeedComponent.java
License:Open Source License
/** * Start the resource connection/*from w ww .jav a 2 s .c o m*/ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext) */ public void start(ResourceContext<TwitterComponent> context) throws InvalidPluginConfigurationException, Exception { Configuration conf = context.getPluginConfiguration(); String kind = conf.getSimpleValue("kind", "user"); if (kind.equals("search")) isSearch = true; keyword = conf.getSimpleValue("keyword", "Jopr"); // Jopr is fallback .. just in case String serverUrl = context.getParentResourceComponent().getServerUrl(); String searchBase = context.getParentResourceComponent().getSearchUrl(); eventContext = context.getEventContext(); eventPoller = new TwitterEventPoller(TOPIC_EVENT); eventContext.registerEventPoller(eventPoller, 63); Properties props = new Properties(); //props.put(PropertyConfiguration.SOURCE,"Jopr"); props.put(PropertyConfiguration.HTTP_USER_AGENT, "Jopr"); props.put(PropertyConfiguration.SEARCH_BASE_URL, searchBase); props.put(PropertyConfiguration.REST_BASE_URL, serverUrl); twitter4j.conf.Configuration tconf = new PropertyConfiguration(props); tFactory = new TwitterFactory(tconf); }
From source file:org.rhq.plugins.twitter.TwitterComponent.java
License:Open Source License
/** * Start the resource connection/* w ww. j a v a 2s. c o m*/ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext) */ public void start(ResourceContext context) throws Exception { Configuration conf = context.getPluginConfiguration(); username = conf.getSimpleValue("user", null); password = conf.getSimpleValue("password", null); String url = conf.getSimpleValue("baseurl", HTTP_TWITTER_COM); if (!url.endsWith("/")) url = url + "/"; try { new URL(url); serverUrl = url; } catch (MalformedURLException e) { throw new InvalidPluginConfigurationException(e.getMessage()); } url = conf.getSimpleValue("searchBaseUrl", "http://search.twitter.com/"); if (!url.endsWith("/")) url = url + "/"; try { new URL(url); searchBaseUrl = url; } catch (MalformedURLException e) { throw new InvalidPluginConfigurationException(e.getMessage()); } eventContext = context.getEventContext(); eventPoller = new TwitterEventPoller(TWIT_EVENT); eventContext.registerEventPoller(eventPoller, 53); Properties props = new Properties(); //props.put(PropertyConfiguration.SOURCE,"Jopr"); props.put(PropertyConfiguration.HTTP_USER_AGENT, "Jopr"); props.put(PropertyConfiguration.SEARCH_BASE_URL, searchBaseUrl); props.put(PropertyConfiguration.REST_BASE_URL, serverUrl); twitter4j.conf.Configuration tconf = new PropertyConfiguration(props); tFactory = new TwitterFactory(tconf); }