Java And XML
My story about Java and XML — In the recent past, I designed and developed an application using XML and Java Swing together. I used Java Architecture for XML Binding (JAXB) as the enabling technology. The application was a configuration utility that was nothing more than a series of "wizards" used to configure our product (an enterprise search engine) for an environment. I developed two XML Schemas, one representing a set of tasks and one representing resources that would be used by the tasks. Feeding the XML schemas to JAXB I was able to create object models (actual java classes). Next I created XML documents representing specific resources and tasks and used JAXB at run time to read and populate these documents into my object models, giving me a collection of task and resource objects. I then wrote some simple java code to render a java swing framework ("application wizard" panels) for each task. The "wizards" would take a user through configuration of our product. It was the most fun project I have ever been a part of and was highly successful.
Why Did I Do This? — This product ran on many different operating systems, used many different databases and ran on three different application servers, so it was extremely difficult to install, configure, and administer. Our installation, configuration and administration had to be very flexible because of the varied hardware and software that it ran on. The beauty of the configuration application that I created was that it allowed us to add new technologies (represented by resources and tasks) by simply creating new XML documents. Also, I used the Inversion of Control (IoC) design pattern, which allowed our more advanced customers to write their own custom configuration wizards and deployers to fit their needs. The product was constantly being updated to support new platforms and technologies, so we had to design our installation, configuration, and administration software to be as flexible as possible without having to make constant changes just to keep up. Our main goal (primary requirement) was to be able to give our product CDs to a novice user and have them install, configure and have the product running in under 30 minutes, which we achieved!
This architecture could be applied in many different ways to solve many different problems.
Java and XML References
- Java Architecture for XML Binding (JAXB) — An article on JAXB technology on Sun's website.
- Java and XML Book — A Great book on Java and XML that I highly recommend! Brett McLaughlin is the man when it comes to XML technologies.
- Java and XML Tutorials — An O'Reilly site dedicated to providing tutorials and articles about XML. A good place to start your education!
- Java and XML Schemas — A Java World article on using validating XML Schemas. This is part 1 of 4, so read the entire series!