I used Twitter4J as my library to log-in and post Twitter updates. I could create my own URL wrappers but why re-invent the lemonade right? so go and grab a copy of Twitter4J from http://yusuke.homeip.net/twitter4j/en/index.html and use your favorite IDE (I used Eclipse) to create your java class.
In order to pass the Twitter username and password I used the parameter values that you can setup in the Advanced tab of the iBot creation wizard. Then I referenced those two parameters within my java class like so:
Twitter twitter = new Twitter(jobInfo.parameter(0),jobInfo.parameter(1));
For the content to post, I used a modified version (removed HTML tags) of the Corporate Overview sample that is included with the Paint dashboard sample (Shared Folders/Paint Demo/Sales Summaries/Regional Analysis/Corporate Overview) which is a narrative view. I modified it and saved it to "My Folders". This is the text that will be posted to Twitter.
I setup the iBot as follows:
- Class Name: com.kerdock.delivers.DeliversToTwitter (the name of my Java class)
- ClassPath: kdqobiee.jar (the name of the jar containing the above class)
- Additional Class Path(s): twitter4j.jar (downloaded from the URL referenced above)
- Results: Pass delivery content to Java Program
- Other Parameters: two parameters containing my twitter username and password
Then I copied the jars (kdqobiee.jar and twitter4j.jar) to the appropriate folder (in my case is C:\OracleBI\web\javahost\lib)
Finally, when I save my iBot, my twitter status is updated with the text from the Answers view:
This rocks! I've been wanting to do this months.
ReplyDeleteJavaEE Training in Chennai JavaEE Training in Chennai
ReplyDeleteJava Training in Chennai Core Java Training in Chennai Core Java Training in Chennai
Java Online Training Java Online Training Core Java 8 Training in Chennai Java 8 Training in Chennai