As the Java classes generated by the XML code generator (aka source generator) 
are JavaBeans compliant, the answer is ... well, no. I don't see a reason as to 
why a JavaBeans wrapper should be generated when the classes in question are 
JavaBeans themselves.


Werner

________________________________________
Von: Uday Kari [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 23. März 2007 02:03
An: [email protected]
Betreff: [castor-user] Java Bean Wrapper for Castor Classes

Another old concern of mine:  Is there a way to generate Java Bean (wrappers) 
for java classes that Castor generates from XSD?  If so, this would be very 
useful in writing "marshalling servlets".  Basically, we can use this to 
marshal XML from request parameters of a jsp.  This would be very useful for my 
project except that I am somewhat lazy and reluctant to write the bean wrappers 
myself (which will all have to change for any change in XSD).  Catch 22 is that 
I cannot use castor classes directly as beans since castor itself is using the 
default constructors.  Hope I am making sense...Thanks.  

________________________________________
From: Uday Kari 
Sent: Thursday, August 31, 2006 11:52 AM
To: 'Arnaud Blandin'; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: Java Bean Wrapper for Castor Classes

Arnaud:  Thanks for your response.  Look forward to hearing from Werner and/or 
Keith.  At this stage, all I have is raw source...anything that explains the 
inner working a little better would be useful.  As I said, I would be honored 
to contribute code, but need some help getting started and perhaps be more 
effective.  I would much rather prefer this type of team work (or endorsement 
or blessing!), rather than attempting to do an extension that is completely 
homegrown (especially in production).  Much Regards,  Uday

________________________________________
From: Arnaud Blandin [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 31, 2006 11:18 AM
To: Uday Kari; [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: Java Bean Wrapper for Castor Classes

Dear Uday,
 
It seems to me that you would like to take a look at the source generator.
Maybe you could expand the binding file to add the proper functionality.
Unfortunately I cannot help you more at this stage as I am not active anymore 
on the project.
I am sure Werner or Keith can guide you.
 
Best Regards,

Arnaud
 
________________________________________
From: Uday Kari [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 25, 2006 5:55 AM
To: [EMAIL PROTECTED]
Cc: Arnaud Blandin; [EMAIL PROTECTED]
Subject: Java Bean Wrapper for Castor Classes
Keith, Arnaud, Werner:

Is there a way to generate Java Bean (wrappers) for java classes that Castor 
generates from XSD?  

I am unable to use Castor generated classes directly as java beans since the 
required default constructor is used for all sorts of the namespace related 
housekeeping.  Therefore, I am unable to set member variable directly as bean 
properties from, say,  HTTPrequest.  Also, since Castor classes generate 
properties such as BigDecimal, I would like to handle converting string 
parameters from request before setting properties. Therefore, the best strategy 
was to create java bean wrappers to: 

A. Appropriately convert request parameters to Castor generated data types.  
B. Pass through these parameters from the java bean wrapper to the 
corresponding Castor "twin" class.  
C. When marshalling and unmarshalling, the presentation layer thinks it is 
dealing with the java bean, but it is the Castor implementation layer 
underneath that handles everything.  

I have tested the idea successfully, by hand-coding the required bean 
wrappers.  However, when dealing with complex XSD as follows: 

http://www.pdc.org/pride/xmlschema/ptwc.xsd ...

I really wish I could generate these bean wrappers "automagically" just like 
Castor generates classes from XSD, simply because since there are so many (140 
classes) of them   !!

If you could give me some tips on how exactly you conduct the transformation of 
XSD into Castor classes (through architecture documents, dataflow diagrams), I 
would be glad to contribute some code to your project that generates these java 
bean wrappers for Castor classes.  I am just beginning to decipher the code, 
but don't have much documentation or forums to work with.  I am sure there are 
other developers who could use this.

Alternatively, you could give me some tips on why I should not be doing this 
(i.e. can I somehow create one "master class" to marshal/unmarshall any of its 
140 child objects?).  

Much Regards (and keep up the good, no excellent, work!)

Uday S. Kari
Software Development Lead
PACIFIC DISASTER CENTER
1305 N Holopono St, Suite 2
Kihei, HI 96753
(808) 891-7942
www.pdc.org


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to