dev@jaxb.java.net

Re: Prostprocessing model - creating properties and classes from JAXB plugin

From: Pavel Bucek <Pavel.Bucek_at_Sun.COM>
Date: Wed, 25 Feb 2009 11:20:12 +0100

Hello,

I moved model postprocessing inside the BGMBuilder.build(...) ring
cycle, please let me know if it solved your issue.

(changes were made in trunk, I can send you my current jaxb build if you
want).

Regards,

Pavel


Aleksei Valikov wrote:
> Hi.
>
>
>> we'll look at it. It would help us if you could locate which exact version
>> of JAXB introduced this problem.
>>
>
> Thanks a lot.
> I've checked the releases, the problem first appears with 2.1.8.
>
> The problem is caused by the following line in the CClassInfo constructor:
>
> BIFactoryMethod factoryMethod =
> Ring.get(BGMBuilder.class).getBindInfo(source).get(BIFactoryMethod.class);
>
> In 2.1.7 this constructor is as follows:
>
> public CClassInfo(Model model,JCodeModel cm, String fullName,
> Locator location, QName typeName, QName elementName, XSComponent
> source, CCustomizations customizations) {
> super(model,source,location,customizations);
> this.model = model;
> int idx = fullName.indexOf('.');
> if(idx<0) {
> this.parent = model.getPackage(cm.rootPackage());
> this.shortName = model.allocator.assignClassName(parent,fullName);
> } else {
> this.parent =
> model.getPackage(cm._package(fullName.substring(0,idx)));
> this.shortName =
> model.allocator.assignClassName(parent,fullName.substring(idx+1));
> }
> this.typeName = typeName;
> this.elementName = elementName;
>
> model.add(this);
> }
>
> In 2.1.8 it looks as follows:
>
> public CClassInfo(Model model,CClassInfoParent p, String
> shortName, Locator location, QName typeName, QName elementName,
> XSComponent source, CCustomizations customizations) {
> super(model,source,location,customizations);
> this.model = model;
> this.parent = p;
> this.shortName = model.allocator.assignClassName(parent,shortName);
> this.typeName = typeName;
> this.elementName = elementName;
>
> Language schemaLanguage = model.options.getSchemaLanguage();
> if ((schemaLanguage != null) &&
> (schemaLanguage.equals(Language.XMLSCHEMA) ||
> schemaLanguage.equals(Language.WSDL))) {
> BIFactoryMethod factoryMethod =
> Ring.get(BGMBuilder.class).getBindInfo(source).get(BIFactoryMethod.class);
> if(factoryMethod!=null) {
> factoryMethod.markAsAcknowledged();
> this.squeezedName = factoryMethod.name;
> }
> }
>
> model.add(this);
> }
>
> When invoked outside of the Ring.begin() .... Ring.end(...) cycle of
> the BGMBuilder.build(...), this constructor fails since the Ring is
> empty.
> I think there are two possibilities to resolve this:
> * Execute model postprocessing inside this BGMBuilder.build(...) ring cycle.
> * Allow BGMBuilder to live longer.
>
> The first one seems more elegant to me...
>
> Thank you for the prompt reaction.
>
> Bye.
> /lexi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: dev-help_at_jaxb.dev.java.net
>
>