Categories
Technology

Migrating a Roller blog to WordPress

Ok I admit that I never made a formal announcement about it, but this blog has now moved to its new home at http://nullpointer.debashish.com. If you are reading this, you are at the right URL.

This blog used to be happily hosted at the excellent free service provided by the JRoller people. Roller is one of the advanced blogwares around, written using Java and I enjoyed using it throughout. If I could afford Java hosting, I would have probably gone for JRoller again. However, with PHP there is hardly any competition for WordPress. So dear readers, here is Null Pointer on WordPress, running on the pretty Squible theme.

Now to the crux of this post. How did I manage migrating all the Posts and comments from JRoller to WordPress?

It was not simple really; because JRoller does not provide any mechanism to backup blog posts, leave alone the comments. Therefore, I asked the Roller people and Dave Johnson was kind enough to come to my rescue. He gave the plausible suggestion of creating a custom RSS Feed. The basic modus operandi is:

  • create a new template in your blog
  • within the template use the $pageModel object to fetch all entries of your blog
  • iterate through those entries to output your blog in RSS or Atom format
  • create your own name-spaced XML element to represent comments within each item
  • write a simple program that parses that and uses MetaWeblog API to post to your new blog

Now the last step is not that intricate because, guess what, WordPress 2.0 does provide the facility to import a blog from a RSS feed. Yet the ordeal would be far from over, because while WordPress can import posts from your feed it cannot import the post comments. Nothing against WordPress, the RSS 2.0 specification does allow a comments sub element but that can only be a link to the actual comments page. So basically we need to defy them all, add the comments inline in our custom RSS Feed and then modify the wordpress RSS Import Utility to decipher and import the comments as well.

When you are ready with your JRoller blog feed, just backup the existing RSS Importer file (wp-admin/import/rss.php) and place the modified importer PHP there. Rest is easy, only remember to break up your RSS file into smaller chunks if you have a really large blog, the importer has the tendency to timeout often.

WP RSS Importer

  • Click here to view the Roller template to create your custom RSS2.0 Feed that includes comments as well.
  • Click here to view the modified WordPress RSS Importer.

I hope this post helped you, do leave your comments here.

Disclaimer: The information provided on this page comes without any warranty whatsoever. Use it at your own risk.

Categories
Technology

Make your own Java newsreader

XML feeds are the way today to keep a tab on what’s happening in the blogosphere as well as to know about site updates and new additions. I had heard about two popular open source feature-rich Java APIs to deal with the feeds, Rome and Informa but could never really savor them. For one of my own sites where I, sort of hand-built the aggregator as Myjavaserver does not allow deploying external JARs or Taglibs I did not get any chance to play with these APIs. So when I got some opportunity it was imperative that I tried them.

The following is a very elementary example of using the two news aggregation libraries that imitates a newsreader. The examples, as I said, are pretty basic and they would make a hit to the specified Feed URL every time you call the JSPs. The code snippets are not meant to demonstrate good coding practice.

Both the libraries support almost all versions of RSS, RDF and Atom and features such as dynamic discovery of feed format. Feature wise probably Informa has an upper hand (it supports OPML, recognizes the Enclosure element making it suitable to comprehend Podcast feeds and can be configured to use a persistence mechanism built over Hibernate) but what it lacks is availability of documents. There are no primers at the site and the code is very poorly commented making the Javadocs difficult to come to pace quickly. The two Java.net articles that I could, Google have been outdated, as I used the 0.6.5 version of the library. Rome, on the other hand, has very nice documentation available at its site, complete with code examples. Many desirable features are unfortunately still on the TODO list. While I have not investigated them, there are a number of sub-projects based on both Rome and Informa, for example: there is a JSP Tag library based on Informa. There is a short review of various libraries here but I guess much stuff on Informa is not relevant now since its latest release.

I am not mincing my words when I say that each API has its own strengths, Informa library is pretty bulky but supports OPML while Rome has a wider support for all kind of XML feeds and has a pluggable architecture. The good thing about these APIs is that they pretty much offer you everything that you may want to do with feeds, reading, generating your own, and creating a digest from multiple feeds and so on.

To run these JSPs, needless to say, you would need to download Informa and Rome libraries. I ran these on jakarta-tomcat-5.0.28 / j2sdk1.4.2_06 and the only dependency I was missing was the JDOM jar that Rome needs.

Click here for a bare-minimum Newsreader based on Informa. Click here for a bare-minimum Newsreader based on Rome.

I hope this post helped you, do leave your comments here.

Disclaimer: The information provided on this page comes without any warranty whatsoever. Use it at your own risk.