Hi Frank and Kelvin since I don't know how to make attachments work for the mailing list, here's a text copy of its content:
The XSD: ======== <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://abc.com/services" xmlns:tns="http://abc.com/services" xmlns:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java" xmlns:sdoXml="commonj.sdo/xml" sdoJava:package="com.abc.services" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:import namespace="commonj.sdo" schemaLocation="datagraph.xsd" /> <xsd:complexType name="NestedType"> <xsd:sequence> <xsd:element name="test1" type="xsd:string" /> <xsd:element name="test2" type="xsd:string" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="MyDataGraph"> <complexContent> <extension base="sdo:BaseDataGraphType"> <xsd:sequence> <xsd:element name="NestedType" type="tns:NestedType" /> </xsd:sequence> </extension> </complexContent> </xsd:complexType> <xsd:complexType name="Input"> <xsd:sequence> <xsd:element name="MyDataGraph" type="tns:MyDataGraph"/> </xsd:sequence> </xsd:complexType> </xsd:schema> The Java Test: ============== package com.abc.services; import java.io.ByteArrayOutputStream; import java.io.IOException; import org.apache.tuscany.sdo.util.SDOUtil; import com.abc.services.impl.TestFactoryImpl; import commonj.sdo.DataGraph; import commonj.sdo.DataObject; import commonj.sdo.Type; import commonj.sdo.helper.XMLHelper; import commonj.sdo.impl.HelperProvider; public class TestABC { public static void main(String[] args) { TestFactory.INSTANCE.register(HelperProvider.getDefaultContext()); NestedType nested; System.out.println("**************** static graph **********************\n"); Input input = TestFactory.INSTANCE.createInput(); MyDataGraph staticGraph = TestFactory.INSTANCE.createMyDataGraph(); nested = TestFactory.INSTANCE.createNestedType(); staticGraph.setNestedType(nested); ((DataObject)nested).set("test1", "test1"); ((DataObject)nested).set("test2", "test2"); staticGraph.getChangeSummary().beginLogging(); ((DataObject)nested).set("test2", "test2_modified"); nested.setTest1("test1_modified"); input.setMyDataGraph(staticGraph); saveGraph(staticGraph); System.out.println("\n\n"); System.out.println("**************** dynamic graph **********************\n"); DataGraph dynamicGraph = SDOUtil.createDataGraph(); Type type = ((TestFactoryImpl)TestFactory.INSTANCE).getNestedType(); nested = (NestedType)dynamicGraph.createRootObject(type); ((DataObject)nested).set("test1", "test1"); ((DataObject)nested).set("test2", "test2"); dynamicGraph.getChangeSummary().beginLogging(); ((DataObject)nested).set("test2", "test2_modified"); nested.setTest1("test1_modified"); saveGraph(dynamicGraph); } /** * @param dataobject */ private static void saveGraph(MyDataGraph dataobject) { ByteArrayOutputStream os = new ByteArrayOutputStream(); try { XMLHelper.INSTANCE.save((DataObject) dataobject, null, "datagraph", os); System.out.println(os.toString()); } catch (IOException e) { e.printStackTrace(); } } /** * @param datagraph */ private static void saveGraph(DataGraph datagraph) { try { ByteArrayOutputStream os = new ByteArrayOutputStream(); SDOUtil.saveDataGraph(datagraph, os, null); System.out.println(os.toString()); } catch (IOException e1) { e1.printStackTrace(); } } } Please note, it's the static graph approach which doesn't seem to record the summary. The dynamic approach using the commonj.sdo.DataGraph works fine. Thanks Erich --- Frank Budinsky <[EMAIL PROTECTED]> wrote: > Hi Erich, > > This sounds like a little fishy to me, since it > looks like you are > serializing your specialized DataGraph inside > another DataGraph. The SDO > spec says that you can't nest change summaries, > which could be the > problem. Note that in SDO 2.1, commonj.sdo.DataGraph > and a DataObject-type > DataGraph are two alternative ways of creating a > graph of dataobjects.This > is something that we'd like to clean up in SDO3. I > think tere may be a > Tuscany sample that explains the two approaches: is > that right Kelvin? > > For your specialized DataObject-type MyDataGraph > you should just > serialize it using XMLHelper.save(). You shouldn't > use a > commonj.sdo.DataGraph in this case. This may be the > problem, but then > again, there may also be a bug. You say below, that > you attached a test > case, but I don't see any attachments? > > Thanks, > Frank. > > Erich Rueede <[EMAIL PROTECTED]> wrote on 07/06/2007 > 10:21:26 AM: > > > Hi all > > > > I have created an XML Schema with a toplevel > > dataobject and a contained datagraph as specified > in > > the webservice sample part of the SDO 2.1 spec > (page > > 132). > > > > I then generated static SDO code from the XML > schema > > which resulted in implementations for the toplevel > > dataobject and the contained datagraph. > > > > The generated code for the static datagraph > somehow > > differs quite a lot from the dynamic programming > model > > using the commonj.sdo.DataGraph. > > > > When I turn on logging on the generated static > > datagraph, I notice that no changes are getting > > recorded. It contains a partial change summary > without > > any changes: > > > > <?xml version="1.0" encoding="ASCII"?> > > <datagraph > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xmlns:tns="http://abc.com/services" > > xsi:type="tns:MyDataGraph"> > > <changeSummary logging="true" /> > > <NestedType> > > <test1>test1_modified</test1> > > <test2>test2_modified</test2> > > </NestedType> > > </datagraph> > > > > Using the dynamic programming model, it contains a > > full change summary with recorded changes: > > > > <?xml version="1.0" encoding="ASCII"?> > > <sdo:datagraph > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xmlns:sdo="commonj.sdo" > > > > > xmlns:sdo_1="http://www.apache.org/tuscany/2005/SDO" > > xmlns:tns="http://abc.com/services"> > > <changeSummary xmlns="" > > logging="true"> > > <objectChanges key="#//@eRootObject"> > > <value xsi:type="sdo_1:ChangeSummarySetting" > > featureName="test2" dataValue="test2"/> > > <value xsi:type="sdo_1:ChangeSummarySetting" > > featureName="test1" dataValue="test1"/> > > </objectChanges> > > </changeSummary> > > <tns:NestedType> > > <test1>test1_modified</test1> > > <test2>test2_modified</test2> > > </tns:NestedType> > > </sdo:datagraph> > > > > Is the static approach of modelling a datagraph > within > > an XSD basically supported with the current > TUSCANY > > implementation? > > > > I attached a sample XSD and test implementation. > > > > Thanks > > Erich > > > > > > > > > > > ____________________________________________________________________________________ > > Choose the right car based on your needs. Check > out Yahoo! Autos > > new Car Finder tool. > > http://autos.yahoo.com/carfinder/ > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: > [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > ____________________________________________________________________________________ Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]