|
OK,
since nobody wants to clarify what Twiki means, I will summarize here what
solution I found in order to solve the problem with schema
evolution:
1.
Broken the xsd-file into two parts: One part covers all definitions which stay
the same in both versions, the other one includes this first one and adds all
definitions which have altered in the new version. There are two (or more)
versions of this second xsd, each one according to the appropriate
specification.
2.
Created two binding files where all definitions of the second xsd are mapped to
the pattern xxxV1 resp. xxxV2 (where xxx is the original name of the
element resp. type). After calling the sourceGenerator twice (one time for
version 1 with V1.xsd and bindingV1.xml and one time with V2.xsd and
bindingV2.xml) I get one class for each definition which is unaltered between
the versions and two classes for each definition which has altered (beside the
appropriate xxxDescriptor class).
These
two steps didn't take too much time.
3. In
order to have an abstraction of the two versions to work within my application,
I created an adapter class for each class xxxVx and one Interface for both which
covers a superset of all methods of the xxxV1 and xxxV2 class. This step took
about 5 working days for a quite small schema (about 30 elements and types,
partly nested). Especially the array class wrappers required a big care to not
confuse the different class castings. Note: The representation of each nested
class within the interface classes (param types or return types) had to be
mapped to the appropriate interface too, and then calling the underlying castor
generated class the interface had to be typcasted.
I do
not see an elegant solution what castor could provide in order to solve these
problems as long as xml schemas do not support schema evolution.
One
possible approach could be: SourceGenerator must know of the two (or more)
different spec versions, so that it can be called only once instead of two or
more times (for each spec version). The needed informations (see the files
created in step 1 and 2) could be provided by a new defined xml file.
SourceGenerator now takes care of the mappings to the xxxVx classes when it
encounters the same element or type in the different Vx.xsd files. With this
knowledge the SourceGenerator also can create the adapter classes
(xxxVxAdpt.java) and the Interface (xxxIntf.java). Although this sounds like a
lot work it would save even more work for each user of
castor.
Hope
this makes sense
Heri
-----Original Message-----
From: Ostermueller, Erik [mailto:[EMAIL PROTECTED] Sent: Monday, November 17, 2003 3:36 PM To: [EMAIL PROTECTED] Subject: RE: [castor-dev] Different Spec versions
|
Title: [castor-dev] Different Spec versions
- [castor-dev] Different Spec versions Bender Heri
- Re: [castor-dev] Different Spec versions Keith Visco
- Re: [castor-dev] Different Spec versions Ostermueller, Erik
- Bender Heri
