I haven't read David and Marc's most recent emails, but here's an idea that I've been toying with in terms of unifying annotation and XML parsing: annotations are interfaces, so presumably we can create new instances of types that implement them somehow. (Maybe the JVM prevents this; I haven't tested.) If so, then we could just have a single annotation parser, and have the XML parser generate annotations to pipe into the annotation parser.
I'm not sure if that gets us anything, but it might be an interesting direction to explore. -Patrick On 7/20/07, David Ezzio (asmtp) <[EMAIL PROTECTED]> wrote:
Hi, I'm starting to design support of XML metadata for OpenJPA annotations in order to address OpenJPA-125 and OpenJPA-87. I've attached a zip containing a preliminary design document, a sample openjpa_orm_1_0.xsd file and a sample OpenJPA ORM instance. It took quite a while to create the text document and it is best viewed as the tracks of a design process. The design that I worked on the most (the one with the most documentation) is not necessarily the best design. There are two alternatives suggested, and there may be others that I haven't thought of. I think the fundamental choices facing us are these: 1. Do we construct an OpenJPA ORM schema that extends the JPA ORM schema? Doing so, allows the user to use one metadata file instead of two, and will enhance maintainability for our users' applications. Or do we construct a standalone OpenJPA ORM schema? I've chosen the first option in the preliminary design, and I think it is the best choice. 2. Do we use a syntactically loose "extension" element format or do we construct new elements for each supported annotation? Choosing the first makes it easy (I think) to support newly added annotations. Choosing the second allows the schema validator to do most of the validation work. I've chosen the first option in the preliminary design, but I'm not at all sure of the choice. 3. Do we envision support in XML for all OpenJPA annotations or for only a subset? If a subset, how do we draw a bright line that will be consistent and easily documented and followed over time? I've chosen the first option in the preliminary design simply because that is the brightest line that I can think of and because it gave me a chance to look over the field of OpenJPA annotations. I'll be off on vacation for a week with very limited Internet connections, so please, take as much time as necessary to consider the design, and carry on some discussions without me if the spirit moves you. Thanks, David Ezzio
-- Patrick Linskey 202 669 5907
