I spent a couple of hours this morning to write a JNDI ObjectFactory for DBXML so access to XML databases can be located and shared across web applications via JNDI similar to the way JDBC DataSources are handled automatically by Tomcat. Unfortunately, ObjectFactory doesn't handle object lifecycle meaning it just ships objects out the door and not worry about them afterward.
To close down those databases gracefully, I need to receive notification of the container shutting down. Tomcat provides varioius kinds of Listener support but there are two problems:
- Tomcat-specific interfaces must be used.
- Listeners are specified by class name.
I think a JCA (J2EE Connector Architecture) connector version would be more portable but I am not sure if Tomcat supports this. Looks like I'll have to wander around the inner city a little longer.
After dinner, I am going to tinker with DBXML TagLib to make it look more like JSTL's SQL tags and support EL as well. I don't usually get to play around at this level, so it's fun in a way.