You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Steffen Glomb <gl...@googlemail.com> on 2007/05/20 18:08:56 UTC

Question about Changesummery for static Interfaces

Hi people,
I would appreciate if you could bring some light to my darkness regarding
the following:

After creating an XSD i generated corresponding interfaces and tried to see
the Changesummary working.
My assumption is the changesummary will give me changed Properties within
the DataObjects of a DataGraph.

So I did the following:

1. Created the datagraph + Created a rootObject + added another Object to
the Root Object
2. stored and loaded the datagraph
3. turned on logging for the graph
4. changed a property of a DataObject from the graph
5. expected a changed dataobject in the summary, but did not get one.

Am I missunderstanding how Changesummary works?

Thanks for your help

Steffen

please see my code below


        DataGraph myGraph = SDOUtil.createDataGraph();
        HelperContext hc = SDOUtil.createHelperContext();

        // Creating a sample Datagraph, with a Container having a List of
Vocables
        Type containerType = hc.getTypeHelper().getType(Container.class );
        Container container = (Container) myGraph.createRootObject
(containerType);

        Vocable vocable = SdoFactoryImpl.init().createVocable();
        vocable.setVocableID(123123);
        container.getVocables().add(vocable);

        // Storing and loading it
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        SDOUtil.saveDataGraph(myGraph, outputStream, null);
        System.out.println(new String(outputStream.toByteArray()));

        DataGraph loadGraph = SDOUtil.loadDataGraph(new
ByteArrayInputStream(outputStream.toByteArray()), null);

        // turn on logging
        loadGraph.getChangeSummary().beginLogging();

        // Making changes
        Container loadedContainer = (Container) loadGraph.getRootObject();
        Vocable voc = (Vocable) loadedContainer.getVocables().get(0);

        voc.setVocableID(1312);

        loadGraph.getChangeSummary().endLogging();
        List changedDataObjects = loadGraph.getChangeSummary
().getChangedDataObjects();

        // prints out 0 :-(
        System.out.println("Size of changedObjects after changing a
property:" + changedDataObjects.size());

Re: Question about Changesummery for static Interfaces

Posted by Frank Budinsky <fr...@ca.ibm.com>.
Hi Steffen,

What you're doing looks basically correct, so I think it should be 
working. What version of SDO are you using? I know that we fixed a bug in 
static (generated) SDO about 1 or 2 weeks ago, that may be related to 
this. Have you tried using the latest version from HEAD?

If it still doesn't work, can you open a JIRA and provide us with a JUnit 
test and the necessary files to reproduce the problem?

Thanks,
Frank

"Steffen Glomb" <gl...@googlemail.com> wrote on 05/20/2007 12:08:56 PM:

> Hi people,
> I would appreciate if you could bring some light to my darkness 
regarding
> the following:
> 
> After creating an XSD i generated corresponding interfaces and tried to 
see
> the Changesummary working.
> My assumption is the changesummary will give me changed Properties 
within
> the DataObjects of a DataGraph.
> 
> So I did the following:
> 
> 1. Created the datagraph + Created a rootObject + added another Object 
to
> the Root Object
> 2. stored and loaded the datagraph
> 3. turned on logging for the graph
> 4. changed a property of a DataObject from the graph
> 5. expected a changed dataobject in the summary, but did not get one.
> 
> Am I missunderstanding how Changesummary works?
> 
> Thanks for your help
> 
> Steffen
> 
> please see my code below
> 
> 
>         DataGraph myGraph = SDOUtil.createDataGraph();
>         HelperContext hc = SDOUtil.createHelperContext();
> 
>         // Creating a sample Datagraph, with a Container having a List 
of
> Vocables
>         Type containerType = hc.getTypeHelper().getType(Container.class 
);
>         Container container = (Container) myGraph.createRootObject
> (containerType);
> 
>         Vocable vocable = SdoFactoryImpl.init().createVocable();
>         vocable.setVocableID(123123);
>         container.getVocables().add(vocable);
> 
>         // Storing and loading it
>         ByteArrayOutputStream outputStream = new 
ByteArrayOutputStream();
>         SDOUtil.saveDataGraph(myGraph, outputStream, null);
>         System.out.println(new String(outputStream.toByteArray()));
> 
>         DataGraph loadGraph = SDOUtil.loadDataGraph(new
> ByteArrayInputStream(outputStream.toByteArray()), null);
> 
>         // turn on logging
>         loadGraph.getChangeSummary().beginLogging();
> 
>         // Making changes
>         Container loadedContainer = (Container) 
loadGraph.getRootObject();
>         Vocable voc = (Vocable) loadedContainer.getVocables().get(0);
> 
>         voc.setVocableID(1312);
> 
>         loadGraph.getChangeSummary().endLogging();
>         List changedDataObjects = loadGraph.getChangeSummary
> ().getChangedDataObjects();
> 
>         // prints out 0 :-(
>         System.out.println("Size of changedObjects after changing a
> property:" + changedDataObjects.size());


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