Tuscany
  1. Tuscany
  2. TUSCANY-832

Needs to support serialization and deserialization of SDO URI type property that references a DataObject in a different tree

    Details

    • Type: New Feature New Feature
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: Java-SDO-Next
    • Fix Version/s: Java-SDO-Next
    • Labels:
      None

      Description

      The XSD anyURI type is mapped to SDO URI type with sdo:propertyType annotation. When I used the SDO URI type property to reference a DataObject in a different tree and tried to serialize it, I would get the exception below.

      Exception in thread "main" org.eclipse.emf.ecore.resource.Resource$IOWrappedException: The object 'org.apache.tuscany.sdo.impl.DynamicDataObjectImpl@1e344fe3 (eClass: org.apache.tuscany.sdo.impl.ClassImpl@5c80fe3 (name: Person) (instanceClassName: null) (abstract: false, interface: false))' is not contained in a resource.
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.endSave(XMLSaveImpl.java:284)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:247)
      at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLResourceImpl.java:203)
      at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:988)
      at org.apache.tuscany.sdo.helper.XMLDocumentImpl.save(XMLDocumentImpl.java:183)
      at org.apache.tuscany.sdo.helper.XMLHelperImpl.save(XMLHelperImpl.java:107)
      at org.apache.tuscany.sdo.helper.XMLHelperImpl.save(XMLHelperImpl.java:102)
      at AnyURITest.testAnySimpleType(AnyURITest.java:45)
      at AnyURITest.main(AnyURITest.java:29)
      Caused by: org.eclipse.emf.ecore.xmi.DanglingHREFException: The object 'org.apache.tuscany.sdo.impl.DynamicDataObjectImpl@1e344fe3 (eClass: org.apache.tuscany.sdo.impl.ClassImpl@5c80fe3 (name: Person) (instanceClassName: null) (abstract: false, interface: false))' is not contained in a resource.
      at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.handleDanglingHREF(XMLHelperImpl.java:680)
      at org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl.getHREF(XMLHelperImpl.java:711)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementReference(XMLSaveImpl.java:1874)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementReferenceSingle(XMLSaveImpl.java:1917)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1420)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XMLSaveImpl.java:2458)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:1032)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSaveImpl.java:918)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementFeatureMap(XMLSaveImpl.java:2208)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLSaveImpl.java:1351)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.writeTopObject(XMLSaveImpl.java:624)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveImpl.java:549)
      at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl.java:233)
      ... 7 more

      1. anyURI.xsd
        1 kB
        Fuhwei Lwo
      2. AnyURITest.java
        2 kB
        Fuhwei Lwo

        Activity

        Hide
        Yang ZHONG added a comment -

        Might seem like a usage error: URI can't be computed without "person" contained within a Resource.

        Do you want to try to contain "person" inside a Resource which can have any URI you want to see in the XML output/serialization?

        Show
        Yang ZHONG added a comment - Might seem like a usage error: URI can't be computed without "person" contained within a Resource. Do you want to try to contain "person" inside a Resource which can have any URI you want to see in the XML output/serialization?
        Hide
        Fuhwei Lwo added a comment -

        EMF can handle the cross document link but not SDO. I have opened a new JIRA against the future SDO spec 3.0. For Tuscany SDO implementation, I think we need some SPIs to support this feature.

        Show
        Fuhwei Lwo added a comment - EMF can handle the cross document link but not SDO. I have opened a new JIRA against the future SDO spec 3.0. For Tuscany SDO implementation, I think we need some SPIs to support this feature.
        Hide
        Yang ZHONG added a comment -

        Not sure how EMF gets a URI without Resource. Are you proposing SDO SPI something like "SDOUtil.setURI(DataObject person,String URI)"?

        Show
        Yang ZHONG added a comment - Not sure how EMF gets a URI without Resource. Are you proposing SDO SPI something like "SDOUtil.setURI(DataObject person,String URI)"?

          People

          • Assignee:
            Unassigned
            Reporter:
            Fuhwei Lwo
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development