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 class:

The common foundation is also rooted in the abstract 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ürich to give a presentation on NetBeans Platform. There were around thirty people, also a couple of people from Berne and it was great to meet Florian Brunner , a Swiss NetBeans Platform Application developer who has an interesting blog (he did e.g a very interesting blog entry about using SAF session state in NB Platform) and his colleagues...

Joe Darcy posted Projec Coin: Post-Devoxx Update, closures and exception handling:

As has been announced recently at
Devoxx and covered in various places, including threads on the
coin-dev mailing list, Mark Reinhold made several announcements about JDK 7 at this year's Devoxx:

  1. JDK 7 will have a form of closures.
  2. The JDK 7 schedule is being
    extended to fall 2010.

On the first announcement, the coin-dev list is not the appropriate forum to discuss closures in Java. Closures are hereby decreed as off-topic for coin-dev...

In today's Weblogs, John Ferguson Smart demonstrates Data-driven tests with JUnit 4 and Excel:

One nice feature in JUnit 4 is that of Parameterized Tests, which let you do data-driven testing in JUnit with a minimum of fuss. It's easy enough, and very useful, to set up basic data-driven tests by defining your test data directly in your Java class. But what if you want to get your test data from somewhere else? In this article, we look at how to obtain test data from an Excel spreadsheet. Parameterized tests allow data-driven tests in JUnit. That is, rather than having different of test cases that explore various aspects of your class's (or your application's) behavior, you define sets of input parameters and expected results, and test how your application (or, more often, one particular component) behaves. Data-driven tests are great for applications involving calculations, for testing ranges, boundary conditions and corner cases...

Binod talks about CAFE Instant Messaging Demo with Google Translate API:

CommunicationBean defined in SailFin CAFE act as the listener for any communication events. For example, in case of instant messaging between
two SIP clients, a CommunicationBean would intercept all the messages. These messages are available to the CommunicationBean implementation
as POJO. That also mean that, you can implement the business logic in the CommunicationBean. This example demonstrates using google translate APIs to translate the IM between two SIP users. There is a nice and simple java client for the google translate API that I use for this sample. Take a look at this gist showing the CommunicationBean implementation. The translation is based on the language set in in the HTTP Servlet...

Bruno Ghisi asks Is LWUIT the new MIDP High Level UI in Java DTV?:

LWUIT was created in the Java ME world to solve an old problem related to the different UI components rendering by different mobiles. This introduction to MIDP UI can help you to understand. From the LWUIT project: Writing appealing cross device applications today in Java ME is challenging. Due to implementation differences in fonts, layout, menus, etc. the same application may look and behave very differently on different devices. In addition much of the advanced UI functionality is not accessible in LCDUI and requires the developer to write very low level "paint" type code. The Lightweight UI Toolkit was developed to address these issues...

In the Forums, summer09 has a problem with Missing texture on COLLADA files from Maya: "Hi, To try to get a COLLADA file to work in Wonderland I made a simple polygon cube in Maya2010. I have attached a texture (blinn) to the cube. The texture is linked to a .png file. I have used the .png before as a texture on a .kmz model that..."

abc3d needs to Display JavaFX program on JPanel...: "Hi, is it possible to execute javafx in swing container. if yes then how to do this. I have my Java Swing GUI Desktop Application, and Charts & DataGrids in JavaFX, i want to display this content in My Java Application How to..."

Felipe Gaucho asks about JPA 2 maven dependencies ?: "I am trying to use the JPA 2 Criteria, but I don't have the QueryBuilder in the classpath: QueryBuilder qb = em.getQueryBuilder(); what is the maven dependencies required to have JPA 2 in the project ? what I have..."

In our current Spotlight, Sebastien Arbogast talks about My Devoxx Discoveries of the Year
: "Every year, the main reason why I go to Devoxx is to discover new stuff. For me it’s all about technology watch. The internet and RSS feeds are my main tech watch instrument but there is one thing that is harder to get through RSS: feelings. Conferences like Devoxx are a unique opportunity, not only to see what’s happening but also to sense how the community is feeling about it, which is at least as important to anticipate on what’s going to be important..."

This week's Poll asks Is Java's parallel programming support sufficient to meet 'the Multicore Challenge'? The poll will run through Thursday / early Friday.

Our Feature Articles include Jeff Friesen's new article Learn about JavaFX's APIs for Reading RSS and Atom Newsfeeds, which introduces you to the RSS and Atom APIs in JavaFX 1.2. We're also featuring Sanjay Dasgupta's in-depth article Simplify Native Code Access with JNA.

The latest Java Mobility Podcast is Java Mobile Podcast 90: Augmented Reality: Excerpts from the JavaOne 2009 Augmented Reality session with Kenneth Andersson and Erik Hellman of Sony Ericsson.

Current and upcoming Java Events:

Registered users can submit event listings for the Events Page using our events submission form. All submissions go through an editorial review before being posted to the site.

Archives and Subscriptions: This blog is delivered weekdays as the Java Today RSS feed. Also, once this page is no longer featured as the front page of it will be archived along with other past issues in the Archive.

-- Kevin Farnham

O'Reilly Media

Related Topics >>


Kevin, thanks for the front

Kevin, thanks for the front page!