On Dec 12, 2007, at 4:10 PM, David Blevins wrote:


On Dec 12, 2007, at 3:56 PM, Dain Sundstrom wrote:

On Dec 12, 2007, at 2:51 PM, David Blevins wrote:

On Dec 12, 2007, at 2:29 PM, Jacek Laskowski wrote:

Hi,

I'd like to get the ejb 2.0 issue around message-driven-destination
fixed soon and am wondering how *I* should approach fixing OPENEJB-701 EJB 2.0 depricated message-driven-destination tag not supported [1].
Any code pointers greatly appreciated.

Should be a fairly straightforward process of adding the extra elements (i.e. a couple more classes marked up with jaxb annotations so jaxb has somewhere to put the data). Then we need to find a good spot early in deployment to copy the data from the deprecated EJB 2.0 elements to the new EJB 2.1 elements.

You could probably put the little conversion step right in the JaxbJavaee object. Maybe add a little test case with a small before and after xml files. Coder's choice.

Typically, I make the legacy "extra" elements private fields in the jaxb tree, then when calls the getter for the new element, I convert the old element to the new element. For example see:

https://svn.apache.org/repos/asf/openejb/trunk/openejb3/container/ openejb-jee/src/main/java/org/apache/openejb/jee/PortComponent.java

The handlerChains element is the new element and the handlerChain element is a legacy element. When someone gets the HandlerChains we detect if the old handlerChain element was used and covert it to a handlerChains.


That's an even better technique. Lazy conversion like lazy instantiation. Convert the element on first access and set it to null so it's not converted again. Nice and simple.

What I really like about this technique it the legacy field is private, so no one really knows what is going on behind the curtain.

-dain

Reply via email to