David Blevins wrote:
On Thu, Oct 28, 2004 at 01:38:31PM -0500, David Blevins wrote:
On Thu, Oct 28, 2004 at 06:50:33AM -0600, Bruce Snyder wrote:
David Blevins wrote:
An informal feature request for the devs and community at large.
The SourceGenerator can already create essentialy POJOs and has the smarts to create Descriptor classes that can marshal data to and from the schema and generated classes. I would really, really love it if it could use those smarts to create a mapping.xml file instead.
Note that I am NOT requesting a tool that can analyze and existing tree of objects and attempt to match them up with a schema or guess what the schema might look like--there already is a tool to do this.
What I am asking for is that the SourceGenerator have the ability to either create class descriptor java files with the schema-to-java marshalling data (as it does now) or create class elements a new mapping.xml file instead.
Has anyone else ever wanted this and/or have thought of implementing it?
David,
This is something that I have given some thought to in the past as well as more recently. However, generating a mapping descriptor from the SourceGenerator would only satisfy the needs of Castor XML (within the mapping descriptor that's created). While this would meet my needs for the Castor XML portions of the mapping descriptor, it still leaves me out in the cold as far as the Castor JDO portions.
What I have been doing recently is using XDoclet to generate the mapping descriptor. I've done this in the past for just the Castor JDO portions. but last month I expanded the capability of the XDoclet Castor functionality to support the entire Castor mapping descriptor. This satisfies both of the Castor XML and Castor JDO portions of the mapping descriptor. I start out by placing XDoclet taglets in the XSD. These taglets get carried through to the POJOs created by the SourceGenerator. From within Ant I call the SourceGenerator and then XDoclet using the <castormapping> element. This process then spits out a perfectly usable mapping descriptor.
If you want some additional detail on this process, see the Castor Live blog here:
http://jroller.org/page/CastorLive/20041015#round_trip_code_generation_with
I'm not sure if this will help you or not. Let me know what you're doing exactly and maybe we can find a solution for you.
Trying to use Castor XML to handle the entire set of J2EE schemas and vendor schemas for the Geronimo project. Unfortunately, editing them is not an option for compliance reasons. Also unfortunate, is that we use XmlBeans now, so making a latteral move from XmlBeans generated marshalling code to Castor generated marshalling code isn't a big enough win to convince everyone to switch.
A big win is to have Castor generate the pojos (which it can do now) and a mapping file. Then we could copy and modify that mapping file for each version of the J2EE schemas/DTD. So a mapping file(s) for J2EE 1.2, another set for J2EE 1.3, and the original set for 1.4.
XDoclet usage is not an option.
-David
Any further ideas on this?
Actually I have had some thoughts about this topic but I haven't had the time to work on it yet. Because we'll both be in Vegas at ApacheCon next week, I figured we could work on it together there.
This sounds like it's very doable, so here are my thoughts on this topic. I'm thinking about adding an option to the SourceGenerator for generating the mapping descriptor (Castor XML portions only) using the MappingTool or something like it (maybe a <Foo>MappingTool, I'm not sure yet on that). The problem with the MappingTool is that it's very rough. But it's definitely a good start and I think we can polish it to meet our needs.
Bruce
--
perl -e 'print unpack("u30","<0G)[EMAIL PROTECTED]&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
The Castor Project http://www.castor.org/
Apache Geronimo http://geronimo.apache.org/
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
