Can you help me? I’m about to reinvent the wheel for this project I’m working on.The requirements are as follows. I need an app that:
- Allows users to define their own report layouts
- Allows users to customize existing report layouts
- Draws data from objects in our existing application
- Quietly sneaks $.001 off of each order transaction processed and deposits that amount into a Swiss bank account which only I have access to.
The last line item is what you would call an optional requirement or a “nice to have” feature. The product would function just fine without it but if you could help me implement it then all the better off I’d be. The truth is that I’ve been asked to create a report engine. More accurately, I’ve been asked to rewrite a very restrictive homegrown database table-template driven report engine to include such features as XML serialization of our existing application objects. I’ve also been asked repeatedly to fix the broken hot water heater that sits in the basement of my house and requires frequent re-igniting of the pilot light but it is the rewriting of this engine that has me more concerned. The application code that we use now is restrictive because for input it builds a fat object that knows all about the current order, depends on and involves every object known to order entry (and practically every object known under to the default JVM) and uses rows in a DB table to drive the output. It has become apparent over the years that a DB table offers little flexibility for defining templates and thus we want to shift to a new Golden Hammer, XML/XSL.
That’s where I come in. I was involved because… well because I kinda like XSL transforms. Also because I am the author of one of the most complicated XSL stylsheets known to man. The one that powers our sales analysis reports. (I’d go into detail about why it is so complicated and ridiculous but that’s food for another post.) The powers that be (that is my boss of course, a rather nice gentleman and very sharp with data driven design) have coerced me into building what would be a report designer. (Well it would be if I had a year or two to develop, a staff of my own developers, a separate office building, funding, a jacuzzi, advertising and a team mascot. Don’t worry about what the jacuzzi is for. Just know that it would be necessary.) I have now embarked on a quest that has lead me on trails through object to XML conversion, the Java TrAX API and now custom XML schema definition.
What I’ve come up with
I hereby present to you my progress. I have an object to xml converter that uses reflection to generate SAX events so that it can be dropped into the TrAX API as an XMLReader. Also, I have the buddings of what is to become the greatest programming language known to man, SSML. What the heck is SSML? It’s a cool acronym I just made up moments ago to describe my over-engineered solution to what probably should just be a simple parameterized report. SSML embodies everything I would ever want an end user to know about the inner workings of our report generator. It is the language which will revolutionize programming in the future. It may also be used to bring our struggling troops home from Iraq once it becomes formalized as a w3c reccomendation. It is the end to world famine and the cure for infetious disease. Honestly, it’s just a stoopid XML grammar that I’m inventing to capture the intentions of a user that is trying to print out invoices from our system. (See what I mean about over-engineering?)
Enter the SSML (…and the dragon while you’re at it)
Simple Stylesheet Markup Language: My hair brained idea is to create a simple XML grammar that will function as a stripped down version of XSL-FO. I mean really stripped down to the bare bone marrow. It will provide a means of defining an output document. The document will consist of an optional first and/or last page, middle pages, and sections within those pages. A section may be positioned anywhere within a page. A page may be sequenced anywhere within the document, such as first-page, last-page, page23, etc. Within section you can define data (which is just literal values), variable data (which is data derived from an XML-serialized object), and possibly tables. I have not yet determined how I’ll use the tables. These are very early ideas that you can play with at your own liesure. (Early as in I just thought of them as I keyed them into this here blog). However I am hereby copywriting them so that if you decide to use them for your own evil schemes you will be required to pay royalties to me or else suffer a wrath of 738 attornys showing at your doorstep. If you do develop something I can use please email me the source code so that I can claim it as my own and charge $259 per copy for my shrink-wrapped version of your hard work. (Don’t worry, I’ll cut you in on some of the profits, I promise.)
If you have any ideas on how any of this can be done better I’m open to suggestions. I’m still not telling you what the jacuzzi is for, but please hit me off on the comments and how-tos and I’ll holla…
(The phrase “hit me off” is a ghetto-slick way of requesting your thoughts and input on the subject matter. Please do not assume aggression as the author does not promote violence. Comments, criticism, and code examples are all welcome contributions but will become property of the site master and ultimately used for world domination.)