users@jaxb.java.net

RE: Accessing JAXB mappings

From: Moravec Jan <Jan.Moravec_at_ips-ag.cz>
Date: Wed, 8 Sep 2004 09:15:44 +0200

There are two types of use cases for the framework:

1) I get the schema before runtime (most cases) - in this case I want the framework to populate a JAXB bean and pass it to the business logic.

2) I get the schema at runtime (few cases, but quite useful) - this is to support, for instance, pluggable service registration - a service provider wants to register a new service with a system, they create a schema that describes required user registration info, they upload the schema to the system and when a user wants to use their service the framework generates a registration form, user fills in and submits the form, the data is passed to the business logic as a serialized XML instance, it gets stored in the system somewhere where it is made available to the service provider). The appearance of the generated form can be customized by using appInfo or a separate schema adjunct (Extensibility's way of adding extra info to schemas).

I hope this sheds some more light on what behavior I expect from my framework. I could surely use a type-annotated DOM, but I somehow feel that working with a type-annotated DOM (or whatever) and then repumping the data to JAXB just to populate and validate the JAXB beans would be a waste of resources, I would prefer to use JAXB beans directly through reflection.

In any case, if you guys say that the schema mapping info is available at schema compile time to add-ons, then I will have to write one that would store the mappings somewhere where my framework can find it. I think that would work just fine, I just thought that since JAXB needs this info at runtime anyway (I saw some promising Grammar instances flying around in the JAXBContext), it could be possible to get to that information at runtime, but apparently it is not.

Thank you (and Aleksei for his add-on tip),.

Cheers,
Jan Moravec


-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Tuesday, September 07, 2004 6:27 PM
To: users_at_jaxb.dev.java.net
Subject: Re: Accessing JAXB mappings


> To have a closure on this can somebody from the JAXB dev group please
> tell me whether the JAXB class-name/method name mappings are somehow
> accessible at the moment, or at least, if there are plans to make them
> accessible in future releases. I feel this would be an a very useful
> thing in cases when you work with schemas for which you generate and
> compile JAXB classes at runtime and you need to populate them with data.
> Obviously read-only access would be sufficient.

Like Aleksei wrote, much information is available at the compile-time
but not in the generated code.

I'm not trying to discourage you or anything, but I still don't
understand --- if you are building a framework and if you can't bind to
a particular schema at the compile time, what's the point of doing that
at the runtime?

Isn't it better to have a type-annotated DOM? In that way, you as the
framework can do any XML operations you want on it. If a particular user
of your framework wants to access it in a strongly-typed fashion, they
can always do that by using JAXB, but why does your framework want to
access its data in such a circuitous way?

Or is there any problem with an approach like this?


regards,
--
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net