bobarnott.com
January 28, 2005
AlbumMaker

Last week at work I decided that I needed to learn something new, so I downloaded a few libraries from the Apache Jakarta Commons project to have a play. I was trying to figure out what sort of test application to write when I realised that some of the libraries would be perfect in the ImageBank software that I was going to write last year.

So I started to write a new application using a slightly modified Chain of Responsibility (CoR) pattern, where each of the items in the chain work together to produce a result, rather than just cone command in the chain. The result is a very flexible application that can have lots of commands that can be formed into chain to produce differing results. The Commons Chain package has all the necessary classes and interfaces and seems to work very well.

The idea being that you write a theme and then create a chain of commands that produce all the information you need to build the pages in the album. If you don’t want EXIF information then just leave the EXIF command out of the chain. So far I have two chains, one for the application to use and one for generating the album contents for a folder in the album hierarchy.

I was wondering how to produce the HTML pages and was going to use a template and tiles kind of affair. However, this would have required a load of string matching and inserting and I felt that it wouldn’t offer the flexibility that I was looking for. One of the downsides of Album, the software I’m using at the moment, is that the Perl script generates some of the HTML for you, even though you supply the template; I didn’t want that, I want the end user to have full control over the HTML that is generated.

So I started looking at the Commons Jelly package and decided to use it to generate the HTML; I could probably just use Jelly to generate the whole album, but that’s a different matter. So I have a command in my chain that create a JellyContext and executes the Jelly script to generate the necessary HTML. One of the benefits of using the CoR pattern is that I can add more Jelly template each with a command to process it, thus it is infinitely extendable.

The Jelly package comes with a load of tag libraries which are idea for iterating over the collections of images and breadcrumbs that are generated by some of the commands. All in all, it works quite well and I’ve even managed to link the set of chains and commands that get loaded to a particular set of templates, so you can have your Jelly templates as simple or as complicated as you like.

I’m nearing the functionality of Album that I personally use for generating my own online album, which I decided was a good starting point to get the software to. Once there I’ll then add more commands and templates to do the things that I’d like but that Album does do.

I’ve also decided to release it all under the GPL and have decided to make fatboab.org into my software repository. Hopefully sometime over the next couple of weeks AlbumMaker, as I’ve decided to call it, will make it to a redesigned fatboab.org.

Posted by fatboab at January 28, 2005 09:05 AM
Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?




Some rights reserved
This work is licensed under a Creative Commons License.
Copyright © 2000-2006 Bob Arnott, some rights reserved.
Powered by
Moveable Type 2.661