Frank Budinsky wrote:
Sebastien was asking me about how to find the Java implementation class
for a given XMLSchema built-in type (e.g., xsd:decimal). The SDO spec
includes a table on page 95 that shows how XSD types map to SDO Types and
consequently to Java instanceClass (3 column table). Note that the mapping
from the second to third column (SDO Type to Java class) is provided by
the commonj.sdo.Type.getInstanceClass() method. But, unfortunately, there
is currently no API defined in the SDO spec that implements the first to
second column mapping (XSD type to SDO type). Therefore there is no
standard way to do it.
With the current EMF-based implementation, there is a simple EMF call that
can be used to directly go from the XSD type to the Java instanceClass,
but calling that would require an EMF dependency.
So, I think that there are several alternatives that we can provide in the
SDO project:
1. An SDOUtil method (e.g., getXSDJavaInstanceClass(String xsdType)) that
returns the Java instance class given an xsd type name
2. An SDOUtil method (e.g., getXSDSDOType(String xsdType) that returns the
SDO Type given an xsd type name
3. Provide both methods
The first one could be implemented in a matter of minutes using the
existing EMF function mentioned above. The Second one will be needed
eventually, but still needs to be implemented from scratch. Providing both
methods turns the first one into a simple convenience function, since
given the second call (that returns the Type) the Java class can be
retrieved from it.
Maybe these methods should be proposed as XSDHelper new methods.
Thoughts, preferences?
Thanks,
Frank.
Frank, I think option (2) is the cleaner long term solution. For now it
would be great if you could provide option (1) and I'll start to use it
right away. Let me know later when you get (2) in place and I'll adjust
the SCA model code to use it (and we should probably remove (1) then).
--
Jean-Sebastien