I just committed the last changes to convert our old Castor tree to Jaxb2, and the resulting code is wonderful. Take a look if you have some time org.apache.openejb.config.sys. Here are some notes on the conversion:

* I started with a generated codebase using the following command:

  $ ls
activation.jar jaxb-api.jar jaxb-impl.jar jaxb- xjc.jar jsr173_1.0_api.jar

  $ java -jar jaxb-xjc.jar openejb.xsd

* The generated classes are very clean and easy to modify by hand as they don't have any generated marshaling logic. This does mean that the startup is a bit slower due to the need to generate this at runtime, but our schemas are tiny.

* Most of the elements in the OpenEJB tree implement the Service interface, and actually have the same implementation code. I was able to create (extract) an AbstractService that each of services extend. Inheritance just worked... no magic.

* I was able to convert the String "content" property in our services directly to a Properties object at marshall time with the PropertiesAdapter I wrote. Jaxb has a very clean properties adapter system that lets you convert any type the XML system understands to a non-annotated java type.

BTW, hats off to the Castor team! Castor carried us for a long time, and Jaxb2 was vastly influenced by the Castor team (it is effectly Castor 2.0).

-dain

Reply via email to