Skip to main content

New Article: JavaFX 1.2 APIs for Reading RSS and Atom Newsfeeds

Posted by editor on December 1, 2009 at 5:24 AM PST

We've just published a new article by Jeff Friesen, Learn about JavaFX's APIs for Reading RSS and Atom Newsfeeds. In this article, Jeff introduces the JavaFX 1.2 RSS and Atom APIs, covering their common foundation and each API's key classes. The article then explores the FeedTask class's newsfeed-polling implementation.

Jeff begins the discussion of the RSS and Atom APIs by noting that:

The RSS and Atom APIs are offshoots of a common foundation that's rooted in the abstract javafx.async.Task
class. This class makes it possible to start, stop, and track an activity (task) that runs on a background thread.

After listing the common functions and variables shared by the APIs, Jeff points us to the javafx.data.fee.Base class:

The common foundation is also rooted in the abstract javafx.data.feed.Base class, which is the base class for
RSS and Atom classes that describe various newsfeed elements. RSS's RSS and Atom's Feed top-level
element classes are examples of

Base subclasses.


The article then covers the RSS API, detailing the primary classes and variables, and concluding with an example program, a NetBeans RSSDemo project that demonstrates the RssTask class in terms of its interval, location, onStart, onChannel,
onItem, onException, onForeignEvent, and onDone variables.

The JavaFX 1.2 Atom API is presented in similar manner and detail, ending with an equivalent application that demonstrates the AtomTask class.

In the section Behind the Scenes with FeedTask, Jeff pulls back the hood on the FeedTask class and some related classes, to show us what's going on in the lower level processing when the RSS and Atom APIs are engaged:

The important task of polling an RSS or Atom newsfeed occurs in FeedTask and a related class. I recently
decompiled these classes to explore how newsfeeds are polled, and share my findings in this section to deepen your
understanding of RssTask and AtomTask.

FeedTask creates an instance of the java.util.Timer class in its static initializer. This instance
starts a background thread and works with an instance of FeedTask's nested SubscriptionTask class
(a java.util.TimerTask subclass) to support newsfeed-polling.

Learn about JavaFX's APIs for Reading RSS and Atom Newsfeeds provides a quite comprehensive introduction to the RSS and Atom APIs that are available in JavaFZ 1.2. But, Jeff isn't done yet. A companion article that puts all this theory to practical use is coming soon:

Enough theory! Now that you've gained knowledge of JavaFX's RSS and Atom APIs, you might want to create your own newsfeed reader. To help you with this task, I present a practical example that handles RSS and Atom newsfeeds in my forthcoming companion to this article.


In Java Today, the NetBeans team announces NetBeans 6.8 Release Candidate 1 Available for Download:

The NetBeans Team is pleased to announce that the first release candidate build of NetBeans IDE 6.8 is now available for download.

Toni Epple talks about JUGS & NetBeans Platform:

Last Thursday Geertjan and I visited the JUG Switzerland in Z

Related Topics >>

Comments

Kevin, thanks for the front

Kevin, thanks for the front page!
Bruno