Wednesday, February 18, 2009

transformations galore: OSS humour

It was a dark and stormless night as I stared at a stack trace from the hearts of the JAXP subsystem of JDK 5.0, specifically the Xalan 2.6.0 snapshot shipped by Sun Microsystems under a modified package:

at GregorSamsa.template$dot$0()
at GregorSamsa.applyTemplates()
at GregorSamsa.transform()

GregorSamsa?? Was I seeing visions? An examination of the JDK 5.0 source code (1.5.0_12, to be precise) and the Xalan-J SVN repository told me that I wasn't. All of Kafka's obsession with an individual trapped in a cruel cold bureaucratic labyrinth aside, this is kinda cool in a geeky way. The pun should be obvious if you knew that Xalan's used for effecting XSL transformations. XSLTC (Xalan-J's compiling XML processor) compiles XSL stylesheets into Java classes. A set of such classes is referred to as a translet. A set of steps is followed to determine the name of the main translet class; the final option, should all preceding ones fail, is the built-in default class name, GregorSamsa. Here's the extract from the source code (the comments serve as software development's answer to exposition):

* As Gregor Samsa awoke one morning from uneasy dreams he found himself
* transformed in his bed into a gigantic insect. He was lying on his hard,
* as it were armour plated, back, and if he lifted his head a little he
* could see his big, brown belly divided into stiff, arched segments, on
* top of which the bed quilt could hardly keep in position and was about
* to slide off completely. His numerous legs, which were pitifully thin
* compared to the rest of his bulk, waved helplessly before his eyes.
* "What has happened to me?", he thought. It was no dream....
protected static String DEFAULT_TRANSLET_NAME = "GregorSamsa";

1 comment:

Extreme said...

Glad you are blogging! It looks great by the way. Haven't had time to read more of your essays yet, but I will when things are less hectic.
See you tomorrow!

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.