Hi Stephen,
I'm not sure what the problem would be with handing over mapping files vs. handing over *Descriptor.class files, other than one is semi obfuscated compared with the other. In any case, we don't have a tool that will automatically do the translation for you, but when the mapping file is loaded, we create in-memory ClassDescriptors. So I suppose it should be fairly straight forward for one to take that same code and instead of creating in-memory ClassDescriptors, use the org.exolab.castor.builder.DescriptorSourceFactory to create the actual *Descriptor.java files.
If you want to do it manually, that should be pretty easy as well. For each <class> element in your mapping file you need a {fully qualified classname}Descriptor.java file. For simplicity you can simply extend the org.exolab.castor.xml.util.XMLClassDescriptorImpl, just like the SourceGenerator does. For each field you need a XMLFieldDescriptor, and for each XMLFieldDescriptor and associated FieldHandler.
Castor comes with some built-in descriptors in the org.exolab.castor.types package as well as in the org.exolab.castor.xml.descriptors package which you can use for reference.
--Keith
Stephen Bash wrote:
Everyone-
I've been puzzling over this problem in my head for a while now and would like some input from the rest of the community. I have an existing class structure that I am initializing with Castor (so I instantiated everything once, set it up the way I want, then marshalled to XML and when I need that setup again, I unmarshal). I have written a few very detailed mapping files to get the XML to look the way I want (well, close enough), but I realized last night that I don't really want to have to hand the mapping files to users... I'd really prefer to only have to hand them the XML file and have Castor do the rest of the work.
So that leads me to the conclusion I need to use ClassDescriptors (if there is another possibility, I'm open to input). Following this conclusion, I am wondering if it is possible to translate the preexisting mapping files into ClassDescriptors that can be included in a code distribution... I have a vague idea of how the mapping file is used internally in Castor, but not enough to know how easy/hard this problem is. Any comments on better implementations or tools to use would be greatly appreciated.
Thanks, Stephen
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
