Sunday, November 26, 2006

Off to .nl for the week

In a couple hours I'll be heading off to the airport for a flight to the Netherlands, as I'll be visiting our office in Leiden for the next week. It's a lovely place, or at least I think it is based on the short stay I had when I was out there for my interview, and I'm looking forward to actually getting a chance to sit down with my coworkers in person and talk about all the stuff we're doing. Hopefully this time I'll actually get a chance to recover from the jet lag before I fly home.

So, if you're trying to get a hold of me this week, and can't figure out why I'm never home and don't answer my cell phone, that's why ;-)

Sunday, November 19, 2006

Using Apache Abdera with JRuby

A while back I attempted to play with one of the initial versions of Abdera in JRuby, just to see how difficult it would be to get some scripts that manipulate Atom data with Abdera doing the low level heavy lifting. It seemed like a match made in heaven, but unfortunately the theory was somewhat better than the practice, mainly due to difficulties with the JRuby/Java integration and the way that early versions of Abdera expected you to access the default versions of various interfaces.

Fortunately, the way Abdera has evolved between then and now happens to make it considerably easier to use from JRuby. Rather than static variables defined on the org.apache.abdera.parser.Parser classes you now use a top level org.apache.abdera.Abdera object to access the default implementations of org.apache.abdera.parser.Parser, org.apache.abdera.factory.Factory, and other major interfaces. This works a LOT better with JRuby.

So without further ado, here's a simple little example, which uses the not-quite-out-yet Abdera 0.2.0 release to parse the Atom feed that lists Abdera's releases from within a JRuby 0.9.1 script:

require 'java'

include_class 'org.apache.abdera.Abdera'
include_class ''

abdera =

parser = abdera.parser

url ='file:///Users/garrett/Code/abdera-site-trunk/releases.xml')

doc = parser.parse(url.open_stream(), url.to_string())

feed = doc.root

print "#{feed.title}\n"

for entry in feed.entries do
if and
author =
elsif and
author =
author = "Someone"

print " #{author} posted '#{entry.title}' on #{entry.updated}\n"

Then run it like this:

$ ./bin/jruby parse.rb
Apache Abdera - Releases
Abdera PPMC posted 'Abdera 0.2.0-incubating' on Thu Nov 09 19:00:00 EST 2006
Abdera PPMC posted 'Abdera 0.1.0-incubating' on Thu Nov 09 19:00:00 EST 2006

Note that in order for this to work the jar files for Abdera and it's dependencies will have to be in your CLASSPATH. Naturally, once the release is final that Atom feed will be located on our actual web site, and those updated dates will need to be tweaked, but you get the idea. I'm absolutely going to be looking at using Abdera via JRuby the next time I want to mess around with some Atom data.

Friday, November 10, 2006

Moving On

So I am now officially unemployed. At least until Monday, when I start my new job ;-)

No, I can't tell you what I'm going to be doing, other than working on neat stuff with cool people.

Saturday, November 4, 2006

REST Web Services: The Book

So it looks like Leonard Richardson (who I just barely managed to avoid working with at CollabNet, as he left just before I started) and Sam Ruby are working on a book about REST Web Services (and FWIW, I think that's a great title, calling it "REST Web Services with Ruby" just limits the audience, and if it's written correctly the concepts should be applicable anywhere).

It's great to see this subject getting some attention from publishers, since so much of the "Web Services" books out there are devoted to the WS-* pile of crap, and totally ignore what you can do with just the building blocks HTTP gives you. Perhaps even more importantly, it's great to see people as capable as Sam and Leonard taking it on. This will clearly be a book to keep an eye out for in the future...