Wednesday, May 25, 2005

Bodington Templates

At the moment Bodington has it's own template language that are compiled into servlets (very similar to JSPs). When building a Bodington distribution you can choose to precompile templates to check for errors but these compiled templates can also be shipped with Bodington which means Bodington runs slightly quicker and the user doesn't need a JDK (just a JRE). The downside is that the compiled templates increase the size of the distribution by about 25% (7MB to 9MB). Is it worth distributing the compiled templates?

Thursday, May 19, 2005

Log4J and PatternLayout

I recently moved all the logging in Bodington to use Log4J. Now when I originally did the translation I wanted the logs to look very similar to the output produced by java.util.logging to ease the transition. Under java.util.logging when an message is logged with an Exception object the stack trace from the Exception is written to the logs as well as the message which is often very useful. Now looking at the Log4J JavaDocs for 1.2.9 it said that only XMLLayout would deal with the Exceptions in the logging calls. Because of this I decided I would write a simple Log4J Layout that would write the stack trace to the logs. The result was a class called SimpleThrowableLayout. Now although this class works well it is nowhere near as flexible as PatternLayout (it extends TTCCLayout), but I was reasonably pleased with it. However the other day when testing some different logging setups I discovered that PatternLayout does actually output the stack trace to the logs when you ask it to output the message (%m). I was not very happy! But at least I now have a better understanding about how to write a Log4J layout. NB: PatternLayout has undergone a major refactoring in the later Log4J revisions and the JavaDoc has been corrected so hopefully this shouldn't bite too many other people.

Wednesday, May 18, 2005

Bodington Quickstart WAR

Bodington has a bit of a reputation of being difficult to install. To allow people to get going with Bodington quickly and easily I have been working on a quickstart WAR file. This WAR comes complete with a precreated database and is already configured to run out of the box. Performance probably isn't going to be great and memory usage will probably be moderate but it should work. Currently my work is against the WebLearn codebase, but it should be pushed across to the Bodington HEAD shortly. For anyone who would like a sneak preview you can grab a Quickstart copy of WebLearn.

Thursday, May 12, 2005

Hacking Bodington Installer

Had a rather productive day today getting the Bodington database installer to be callable from ant. You can now call an ant task (database-create) that will cleanout your Bodington database and install a new set of tables. This is part of my current work to remove the need to run SetupServlet before running Bodington. Removing the need to run setup make both development and new install easier. All this work involved quite a bit of refactoring of existing code and without a good unit testing suite I am a little worried that I may have broken something. Hopefully I should be able to put up a example WAR file showing the new setup free Bodington shortly.

Wednesday, May 04, 2005

Java IO (StringBufferInputStream and Reader)

I have a method with a signature of doStuff(InputStream input), now I want to be able to pass in an String and it seems the sensible way to do this would be using StringBufferInputStream but sadly this is deprecated. The recommended replacement is StringReader however there is no easy way to get from a Reader to an InputStream. Instead you have to bodge it with something like new ByteArrayInputStream(string.getBytes()); Sadly it seems that this bug has been around far too long and Sun still havn't fixed it.