users@jaxb.java.net

Prostprocessing model - creating properties and classes from JAXB plugin

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Mon, 23 Feb 2009 10:46:47 +0100

Dear JAXB developers,

I need your help to resolve the compatibility issue with Hyperjaxb3
and XJC versions 2.1.9 and higher.

To address JAXB vs. JPA/EJB3 compatibility issues, ,my plugin
(Hyperjaxb3) generates some additional classes and properties in the
JAXB model. Basically, I do things like new CClassInfo(...) in my JAXB
plugin.

Recently I wanted to move to newer version of JAXB (2.1.9), but
started getting strange problems with BGMBuilder and Ring which I
never had before. After some research I've found out that in 2.1.9
(maybe in 2.1.8 as well) the CClassInfo constructor accesses
Ring.get(BGMBuilder.class) for some information. But, since my plugin
is invoked outside of the model building (not during the
BGMBuilder.build(...)), "Ring" is already "ended" and the BGMBuilder
is not available from the Ring. This makes Ring try to instantiate the
BGMBuilder, which fails.

So my problem is that in XJC 2.1.9 I cannot postprocess model in the
desired way. You assume that class infos are only created when the
model is built. This means I can't add any classes and properties to
the model from the JAXB plugin. Still this feature is crucial for
Hyperjaxb3 since otherwise I cannot provide EJB3 persistence for
complex cases like heterogeneous fields and so on.

I'm asking you for help with this problem. What I need is the
possibility to create classes and properties from JAXB plugin. I'm
unsure how to resolve this at the moment and hope that you'll have
some ideas.

Thank you!

Bye.
/lexi