Friday, July 20, 2007

New Zocalo release; OpenSource JavaMail incorporated

I just published a new release of Zocalo that includes the ability for new users to register for an account. I'm writing this note to report on what I learned from integrating JavaMail into Zocalo about Sun's progress on Open Sourcing the Java libraries. More than a year ago, I started down the path to integrate email into Zocalo for new account creation. On the web today, if users are to create their own accounts without requiring intervention from an administrator, the application pretty much has to be able to send mail. (You can do it just with a captcha to ensure they're a real person, but doing a round-trip confirmation is better, since you can update forgotten passwords, and you end up with the ability to send transaction reports.)

What I discovered at the time was that Sun had announced that they were going to open source all the Java libraries, but hadn't made much progress. The mail libraries hadn't been freed up, and in order to use any of the third-party open email packages I could find, I would have had to require that people installing Zocalo manually download the base package from Sun themselves. This seemed like enough of an additional burden on the installation process that I punted. I actually implemented a rudimentary utility function that would invoke a local process to send mail. I know how to make this work on Linux machines, and it could probably have been coerced into being usable on Macintoshes, but I don't know what it would take to make it work on Windows. And then I never made any use of that functionality, since it didn't seem likely to work on most platforms.

In early July, I decided it was time to revisit the issue, and spent some time searching through the status of Sun's open source efforts. I was pleased and surprised to find that they've actually released a lot of it. (It might be all of Sun's libraries for all I know. I couldn't quickly find an overview, history, or description of the source of all this code.) It all seems to be gathered together at the GlassFish project.

I was able to find the JavaMail area reasonably easily, though figuring out what jars I would need was somewhat harder. And figuring out what the open source terms were took some reading. The license itself seems pretty impenetrable to me, but I was reassured by re-reading the Open Source Definition at Open Source.org. Since OpenSource.org thinks that Sun's CDDL meets their definition, I don't have any qualms about shipping the GlassFish JavaMail libraries with Zocalo.

I then downloaded one of the releases (GlassFish's release numbering is confusing to me; I couldn't easily figure out which version was the best stable release for basic operations), and tried adding one jar file at a time to Zocalo, to see how much I would need to get things running. The GlassFish documentation implies that you have to buy into their whole paradigm to get it to work. There's lots of J2EE stuff, and a JavaBeans Activation Framework, and I don't know what-all. All I want to do is send SMTP mail via someone else's server. The person installing Zocalo will have to specify an SMTP server, and give a password (unless there's something running on the local machine, or the SMTP server is accessed securely on a LAN, but I haven't set those up yet.) I could have included an SMTP server, but the person installing still has to make a secure connection to an external server; it isn't any easier if you're a server than if you're logging in as an SMTP client. In the end, all I needed was activation.jar and mail.jar. No extra XML configuration files, no extra VM parameters, no hassle. There are a few more configuration parameters in Zocalo's startup files, but whatever I did, you'd have to specify the SMTP server and password somewhere.

In the end I was extremely pleased with how easy it was to use Sun's recently released JavaMail package. The 2007.2 release of Zocalo Open Source Prediction Markets makes good use of it, and it wasn't too painful to incorporate.

No comments: