tuscany-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Gavlin <rgav...@yahoo.com>
Subject Re: Problem w/SDO xsd:dateTime value being validated using EMF Diagnostician.validate()
Date Wed, 17 Jan 2007 14:38:08 GMT
Thanks for the reply, Frank.

I believe in EMF SDO 1, loading a DataGraph with an invalid xsd:dateTime value behaved much
like loading a DataGraph with an invalid xsd:integer. Here, xsd:dateTime fields were parsed
into EMF XMLCalendar instances and therefore parsing errors were reported at load time. Tuscany
SDO does not behave this way. Does the fact that the SDO spec states that xsd:dateTime gets
rendered as a String imply that parsing should not be performed at load time and therefore
invalid xsd:dateTime values ignored? 

Does the SDO spec plan to address validation in a later revision? If Tuscany SDO were to support
validation, do you think Tuscany would roll its own validation, use the validation capabilities
built-in to EMF, or use the EMFT Validation Framework? Would it be appropriate for me to create
a JIRA to document this enhancement request?

I was thinking of writing a ModelValidator that is responsible for validating the types defined
in ModelPackageImpl. It would delegate to EMF's DynamicEDataValidator for some types and implement
custom validation for others like DateTime. In order to implement this capability, I would
register the ModelPackageImpl and ModelValidator with the EMF EValidatorRegistry. Does this
seem like a reasonable approach? Where do you think it would make most sense to perform this
registration? 

- Ron 

----- Original Message ----
From: Frank Budinsky <frankb@ca.ibm.com>
To: tuscany-user@ws.apache.org
Sent: Tuesday, January 16, 2007 3:24:59 PM
Subject: Re: Problem w/SDO xsd:dateTime value being validated using EMF Diagnostician.validate()


I don't know if it worked in SDO 1 either, but a big change in this area 
is that the xsd types now map to commonj.sdo types as descirbed in the SDO 
2 spec. In SDO 1, they mapped to types in the EMF XMLTypePackage. 

In SDO 2 (Tuscany), xsd:dateTime maps to this type (defined in 
sdoModel.xsd):

<xsd:simpleType name="DateTime" sdoJava:instanceClass="java.lang.String">
  <xsd:restriction base="xsd:dateTime"/>
</xsd:simpleType>

It, along with all of the commonj types, is generated in class 
org.apache.tuscany.sdo.model.impl.ModelFactoryImpl. I don't know how the 
EMF validator will handle this type.

Frank.




Ron Gavlin <rgavlin@yahoo.com> 
01/16/2007 01:05 PM
Please respond to
tuscany-user@ws.apache.org


To
tuscany-user tuscany-user <tuscany-user@ws.apache.org>
cc

Subject
Problem w/SDO xsd:dateTime value being validated using EMF 
Diagnostician.validate()






Greetings,

I have an xsd:dateTime child element in an XML Schema that I use to 
statically generate Tuscany SDO classes. Since Tuscany does not currently 
provide a schema validation API, I have been using EMF to accomplish this 
task using the following code:

...
Diagnostic diagnostic = 
   Diagnostician.INSTANCE.validate((EObject) 
myDataObjectwithDateTimeChildProperty);
if (diagnostic.getSeverity() == Diagnostic.ERROR)
{
    throw new Exception(diagnostic.getChildren().toString());
}

This technique works fine for most schema validation issues, like min/max 
facet length enforcement for child xsd:strings, etc. However, EMF is 
performing no validation against my Tuscany DateTime field (I can supply a 
bogus dateTime and no diagnostic error is generated). Is this an EMF 
problem or a Tuscany/EMF integration problem? I thought this used to work 
with the Eclipse EMF-based SDO 1.0 implementation but I may be wrong. Any 
suggestions would be greatly appreciated.

Thanks in advance,

- Ron

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Mime
View raw message