Getting JBloglines
Grab a dist from Downloads and unpack.
Or alternatively grab the src from cvs.
the bloglines-xxx.jar depends on :
- commons-httpclient-2.0.2.jar
- commons-logging.jar
- jdom.jar
- rome-0.6.jar
- xpp3-1.1.3.4-RC8.jar
- xstream-SNAPSHOT.jar
Using JBloglines
Get the subscription hirarchy :
Bloglines bloglines = new Bloglines();
bloglines.setCredentials(userName,password);
Outline subscriptions = bloglines.listSubscriptions();
Recurisvely display the subscriptions with the number of unread items:
private void showSubscriptions(Outline subscription) { if(subscription.isFeed()){ System.out.println(subscription.getTitle()+"("+subscription.getUnread()+")"); }else{ Outline[] children = subscription.getChildren(); for (int i = 0; i < children.length; i++) { showSubscriptions(children[i]); } } }
Display a feed item.
Notice that once you get to the getItems call, the classes used originate from the Rome Project, and
you should read the Rome docs especialy SyndFeed and SyndEntry.
SyndFeed feed = bloglines.getItems(subscription, false, null); List entries = items.getEntries(); for (Iterator iter = entries.iterator(); iter.hasNext();) { SyndEntry entry = (SyndEntry) iter.next(); System.out.println("Title = "+entry.getTitle()); SyndContent description = entry.getDescription(); System.out.println(description.getValue()); }
Demo Application
JBLoglines ships with a simple demo app (a single class - org.codehaus.bloglines.demo.JBloglinesDemo) which ilustrates
simple usage ( the only supported variety).
In addition to the standard dependencies stated above the demo app depnends on:
- forms-1.0.5.jar
- looks-1.3.1.jar
Usage:
java -cp commons-httpclient-2.0.2.jar;commons-logging.jar;jdom.jar;rome-0.6.jar;xpp3-1.1.3.4-RC8.jar;
xstream-SNAPSHOT.jar;bloglines-0.1.0.jar;forms-1.0.5.jar;looks-1.3.1.jar org.codehaus.bloglines.demo.JBloglinesDemo
Result

