You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Steffen Glomb (JIRA)" <tu...@ws.apache.org> on 2007/05/28 21:35:18 UTC
[jira] Created: (TUSCANY-1305) Changesummary of datagraph using
static interfaces.
Changesummary of datagraph using static interfaces.
---------------------------------------------------
Key: TUSCANY-1305
URL: https://issues.apache.org/jira/browse/TUSCANY-1305
Project: Tuscany
Issue Type: Bug
Components: Java SDO Implementation
Affects Versions: Java-SDO-Next
Reporter: Steffen Glomb
I cant get Changesummary on a datagraph working correctly with the following contents: (hope this is a realy a bug this time)
Schema, generated by the xsdhelper:
<xs:schema
xmlns:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java" xmlns:stn_1="http://example.com/customer" xmlns:xs="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://example.com/customer">
<xs:complexType abstract="false" name="Account">
<xs:sequence/>
<xs:attribute default="0" name="accountNum" type="xs:int"/>
</xs:complexType>
<xs:element name="account" type="stn_1:Account"/>
<xs:complexType abstract="false" name="Customer">
<xs:sequence>
<xs:element name="account" type="stn_1:Account"/>
</xs:sequence>
<xs:attribute name="firstName" type="xs:string"/>
</xs:complexType>
<xs:element name="customer" type="stn_1:Customer"/>
</xs:schema>
After generation of interfaces the following code fails to work as I would expect, because the changesummary does not contain the changed dataobject in the graph.
....
import org.apache.tuscany.sdo.api.SDOUtil;
import com.example.customer.Account;
import com.example.customer.Customer;
import com.example.customer.CustomerFactory;
import commonj.sdo.DataGraph;
import commonj.sdo.Type;
import commonj.sdo.helper.HelperContext;
import commonj.sdo.impl.HelperProvider;
public class TestChangesummary extends TestCase {
public void testChangeSummaryOnDatagraphWithContainmentStatic() throws Exception {
HelperContext hc = HelperProvider.getDefaultContext();
CustomerFactory.INSTANCE.register(hc);
Type customerType = hc.getTypeHelper().getType(Customer.class);
DataGraph dataGraph = SDOUtil.createDataGraph();
Customer customer = (Customer) dataGraph.createRootObject(customerType);
Account account = CustomerFactory.INSTANCE.createAccount();
customer.setAccount(account);
customer.setFirstName("John");
customer.getAccount().setAccountNum(1234);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
SDOUtil.saveDataGraph(dataGraph, outputStream, null);
DataGraph loadDataGraph = SDOUtil.loadDataGraph(new ByteArrayInputStream(outputStream.toByteArray()), null);
loadDataGraph.getChangeSummary().beginLogging();
customer = (Customer) loadDataGraph.getRootObject();
customer.getAccount().setAccountNum(987);
loadDataGraph.getChangeSummary().endLogging();
List changedDataObjects = loadDataGraph.getChangeSummary().getChangedDataObjects();
assertEquals("in fact 1 Object was changed in the code", 1, changedDataObjects.size());
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
[jira] Commented: (TUSCANY-1305) Changesummary of datagraph using
static interfaces.
Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
[ https://issues.apache.org/jira/browse/TUSCANY-1305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499819 ]
Kelvin Goodson commented on TUSCANY-1305:
-----------------------------------------
The issue here is that the generated code creates the metadata, and then initializes it, but in between these two steps, the getProperty() method of FactoryBase calls getEAllStructuralFeatures() in order to retrieve a newly created, but as yet uninitialized property. This method caches all structural features, and it is true that all structural features are present. But it does more than this, in that it caches state associated with the nature of the features, such as as which features are containments and which are not. At the time that the caching is done this information has not been set.
The result of this is that the call to ChangeRecorder.addAdapter, which recurses over the containment hierarchy, has an incorrect view of the containment hierarchy.
We need to avoid calling getEAllStructuralFeatures while metadata is still in the process of being established. I will investigate a way of altering the generator template so that it uses the local index into the classes local features.
> Changesummary of datagraph using static interfaces.
> ---------------------------------------------------
>
> Key: TUSCANY-1305
> URL: https://issues.apache.org/jira/browse/TUSCANY-1305
> Project: Tuscany
> Issue Type: Bug
> Components: Java SDO Implementation
> Affects Versions: Java-SDO-Next
> Reporter: Steffen Glomb
> Attachments: sources.zip
>
>
> I cant get Changesummary on a datagraph working correctly with the following contents: (hope this is a realy a bug this time)
> Schema, generated by the xsdhelper:
> <xs:schema
> xmlns:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java" xmlns:stn_1="http://example.com/customer" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://example.com/customer">
> <xs:complexType abstract="false" name="Account">
> <xs:sequence/>
> <xs:attribute default="0" name="accountNum" type="xs:int"/>
> </xs:complexType>
> <xs:element name="account" type="stn_1:Account"/>
> <xs:complexType abstract="false" name="Customer">
> <xs:sequence>
> <xs:element name="account" type="stn_1:Account"/>
> </xs:sequence>
> <xs:attribute name="firstName" type="xs:string"/>
> </xs:complexType>
> <xs:element name="customer" type="stn_1:Customer"/>
> </xs:schema>
> After generation of interfaces the following code fails to work as I would expect, because the changesummary does not contain the changed dataobject in the graph.
> ....
> import org.apache.tuscany.sdo.api.SDOUtil;
> import com.example.customer.Account;
> import com.example.customer.Customer;
> import com.example.customer.CustomerFactory;
> import commonj.sdo.DataGraph;
> import commonj.sdo.Type;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.impl.HelperProvider;
> public class TestChangesummary extends TestCase {
> public void testChangeSummaryOnDatagraphWithContainmentStatic() throws Exception {
>
> HelperContext hc = HelperProvider.getDefaultContext();
> CustomerFactory.INSTANCE.register(hc);
>
> Type customerType = hc.getTypeHelper().getType(Customer.class);
> DataGraph dataGraph = SDOUtil.createDataGraph();
> Customer customer = (Customer) dataGraph.createRootObject(customerType);
>
> Account account = CustomerFactory.INSTANCE.createAccount();
> customer.setAccount(account);
> customer.setFirstName("John");
> customer.getAccount().setAccountNum(1234);
>
> ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
> SDOUtil.saveDataGraph(dataGraph, outputStream, null);
> DataGraph loadDataGraph = SDOUtil.loadDataGraph(new ByteArrayInputStream(outputStream.toByteArray()), null);
>
> loadDataGraph.getChangeSummary().beginLogging();
>
> customer = (Customer) loadDataGraph.getRootObject();
> customer.getAccount().setAccountNum(987);
>
> loadDataGraph.getChangeSummary().endLogging();
>
> List changedDataObjects = loadDataGraph.getChangeSummary().getChangedDataObjects();
> assertEquals("in fact 1 Object was changed in the code", 1, changedDataObjects.size());
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
[jira] Resolved: (TUSCANY-1305) Changesummary of datagraph using
static interfaces.
Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
[ https://issues.apache.org/jira/browse/TUSCANY-1305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kelvin Goodson resolved TUSCANY-1305.
-------------------------------------
Resolution: Fixed
Fix Version/s: Java-SDO-1.0
resolved at revision 542588
> Changesummary of datagraph using static interfaces.
> ---------------------------------------------------
>
> Key: TUSCANY-1305
> URL: https://issues.apache.org/jira/browse/TUSCANY-1305
> Project: Tuscany
> Issue Type: Bug
> Components: Java SDO Implementation
> Affects Versions: Java-SDO-Next
> Reporter: Steffen Glomb
> Fix For: Java-SDO-1.0
>
> Attachments: sources.zip
>
>
> I cant get Changesummary on a datagraph working correctly with the following contents: (hope this is a realy a bug this time)
> Schema, generated by the xsdhelper:
> <xs:schema
> xmlns:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java" xmlns:stn_1="http://example.com/customer" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://example.com/customer">
> <xs:complexType abstract="false" name="Account">
> <xs:sequence/>
> <xs:attribute default="0" name="accountNum" type="xs:int"/>
> </xs:complexType>
> <xs:element name="account" type="stn_1:Account"/>
> <xs:complexType abstract="false" name="Customer">
> <xs:sequence>
> <xs:element name="account" type="stn_1:Account"/>
> </xs:sequence>
> <xs:attribute name="firstName" type="xs:string"/>
> </xs:complexType>
> <xs:element name="customer" type="stn_1:Customer"/>
> </xs:schema>
> After generation of interfaces the following code fails to work as I would expect, because the changesummary does not contain the changed dataobject in the graph.
> ....
> import org.apache.tuscany.sdo.api.SDOUtil;
> import com.example.customer.Account;
> import com.example.customer.Customer;
> import com.example.customer.CustomerFactory;
> import commonj.sdo.DataGraph;
> import commonj.sdo.Type;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.impl.HelperProvider;
> public class TestChangesummary extends TestCase {
> public void testChangeSummaryOnDatagraphWithContainmentStatic() throws Exception {
>
> HelperContext hc = HelperProvider.getDefaultContext();
> CustomerFactory.INSTANCE.register(hc);
>
> Type customerType = hc.getTypeHelper().getType(Customer.class);
> DataGraph dataGraph = SDOUtil.createDataGraph();
> Customer customer = (Customer) dataGraph.createRootObject(customerType);
>
> Account account = CustomerFactory.INSTANCE.createAccount();
> customer.setAccount(account);
> customer.setFirstName("John");
> customer.getAccount().setAccountNum(1234);
>
> ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
> SDOUtil.saveDataGraph(dataGraph, outputStream, null);
> DataGraph loadDataGraph = SDOUtil.loadDataGraph(new ByteArrayInputStream(outputStream.toByteArray()), null);
>
> loadDataGraph.getChangeSummary().beginLogging();
>
> customer = (Customer) loadDataGraph.getRootObject();
> customer.getAccount().setAccountNum(987);
>
> loadDataGraph.getChangeSummary().endLogging();
>
> List changedDataObjects = loadDataGraph.getChangeSummary().getChangedDataObjects();
> assertEquals("in fact 1 Object was changed in the code", 1, changedDataObjects.size());
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
[jira] Commented: (TUSCANY-1305) Changesummary of datagraph using
static interfaces.
Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
[ https://issues.apache.org/jira/browse/TUSCANY-1305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499773 ]
Kelvin Goodson commented on TUSCANY-1305:
-----------------------------------------
Steffen,
it does look like a bug. The AccountImpl's changeRecorder is null when changing the accountNum, so the ChangeSummary never sees the update. I haven't yet tracked down why this is happening.
Kelvin.
> Changesummary of datagraph using static interfaces.
> ---------------------------------------------------
>
> Key: TUSCANY-1305
> URL: https://issues.apache.org/jira/browse/TUSCANY-1305
> Project: Tuscany
> Issue Type: Bug
> Components: Java SDO Implementation
> Affects Versions: Java-SDO-Next
> Reporter: Steffen Glomb
> Attachments: sources.zip
>
>
> I cant get Changesummary on a datagraph working correctly with the following contents: (hope this is a realy a bug this time)
> Schema, generated by the xsdhelper:
> <xs:schema
> xmlns:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java" xmlns:stn_1="http://example.com/customer" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://example.com/customer">
> <xs:complexType abstract="false" name="Account">
> <xs:sequence/>
> <xs:attribute default="0" name="accountNum" type="xs:int"/>
> </xs:complexType>
> <xs:element name="account" type="stn_1:Account"/>
> <xs:complexType abstract="false" name="Customer">
> <xs:sequence>
> <xs:element name="account" type="stn_1:Account"/>
> </xs:sequence>
> <xs:attribute name="firstName" type="xs:string"/>
> </xs:complexType>
> <xs:element name="customer" type="stn_1:Customer"/>
> </xs:schema>
> After generation of interfaces the following code fails to work as I would expect, because the changesummary does not contain the changed dataobject in the graph.
> ....
> import org.apache.tuscany.sdo.api.SDOUtil;
> import com.example.customer.Account;
> import com.example.customer.Customer;
> import com.example.customer.CustomerFactory;
> import commonj.sdo.DataGraph;
> import commonj.sdo.Type;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.impl.HelperProvider;
> public class TestChangesummary extends TestCase {
> public void testChangeSummaryOnDatagraphWithContainmentStatic() throws Exception {
>
> HelperContext hc = HelperProvider.getDefaultContext();
> CustomerFactory.INSTANCE.register(hc);
>
> Type customerType = hc.getTypeHelper().getType(Customer.class);
> DataGraph dataGraph = SDOUtil.createDataGraph();
> Customer customer = (Customer) dataGraph.createRootObject(customerType);
>
> Account account = CustomerFactory.INSTANCE.createAccount();
> customer.setAccount(account);
> customer.setFirstName("John");
> customer.getAccount().setAccountNum(1234);
>
> ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
> SDOUtil.saveDataGraph(dataGraph, outputStream, null);
> DataGraph loadDataGraph = SDOUtil.loadDataGraph(new ByteArrayInputStream(outputStream.toByteArray()), null);
>
> loadDataGraph.getChangeSummary().beginLogging();
>
> customer = (Customer) loadDataGraph.getRootObject();
> customer.getAccount().setAccountNum(987);
>
> loadDataGraph.getChangeSummary().endLogging();
>
> List changedDataObjects = loadDataGraph.getChangeSummary().getChangedDataObjects();
> assertEquals("in fact 1 Object was changed in the code", 1, changedDataObjects.size());
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
[jira] Updated: (TUSCANY-1305) Changesummary of datagraph using
static interfaces.
Posted by "Steffen Glomb (JIRA)" <tu...@ws.apache.org>.
[ https://issues.apache.org/jira/browse/TUSCANY-1305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steffen Glomb updated TUSCANY-1305:
-----------------------------------
Attachment: sources.zip
I updated from head and rebuild 3 days ago.
> Changesummary of datagraph using static interfaces.
> ---------------------------------------------------
>
> Key: TUSCANY-1305
> URL: https://issues.apache.org/jira/browse/TUSCANY-1305
> Project: Tuscany
> Issue Type: Bug
> Components: Java SDO Implementation
> Affects Versions: Java-SDO-Next
> Reporter: Steffen Glomb
> Attachments: sources.zip
>
>
> I cant get Changesummary on a datagraph working correctly with the following contents: (hope this is a realy a bug this time)
> Schema, generated by the xsdhelper:
> <xs:schema
> xmlns:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java" xmlns:stn_1="http://example.com/customer" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://example.com/customer">
> <xs:complexType abstract="false" name="Account">
> <xs:sequence/>
> <xs:attribute default="0" name="accountNum" type="xs:int"/>
> </xs:complexType>
> <xs:element name="account" type="stn_1:Account"/>
> <xs:complexType abstract="false" name="Customer">
> <xs:sequence>
> <xs:element name="account" type="stn_1:Account"/>
> </xs:sequence>
> <xs:attribute name="firstName" type="xs:string"/>
> </xs:complexType>
> <xs:element name="customer" type="stn_1:Customer"/>
> </xs:schema>
> After generation of interfaces the following code fails to work as I would expect, because the changesummary does not contain the changed dataobject in the graph.
> ....
> import org.apache.tuscany.sdo.api.SDOUtil;
> import com.example.customer.Account;
> import com.example.customer.Customer;
> import com.example.customer.CustomerFactory;
> import commonj.sdo.DataGraph;
> import commonj.sdo.Type;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.impl.HelperProvider;
> public class TestChangesummary extends TestCase {
> public void testChangeSummaryOnDatagraphWithContainmentStatic() throws Exception {
>
> HelperContext hc = HelperProvider.getDefaultContext();
> CustomerFactory.INSTANCE.register(hc);
>
> Type customerType = hc.getTypeHelper().getType(Customer.class);
> DataGraph dataGraph = SDOUtil.createDataGraph();
> Customer customer = (Customer) dataGraph.createRootObject(customerType);
>
> Account account = CustomerFactory.INSTANCE.createAccount();
> customer.setAccount(account);
> customer.setFirstName("John");
> customer.getAccount().setAccountNum(1234);
>
> ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
> SDOUtil.saveDataGraph(dataGraph, outputStream, null);
> DataGraph loadDataGraph = SDOUtil.loadDataGraph(new ByteArrayInputStream(outputStream.toByteArray()), null);
>
> loadDataGraph.getChangeSummary().beginLogging();
>
> customer = (Customer) loadDataGraph.getRootObject();
> customer.getAccount().setAccountNum(987);
>
> loadDataGraph.getChangeSummary().endLogging();
>
> List changedDataObjects = loadDataGraph.getChangeSummary().getChangedDataObjects();
> assertEquals("in fact 1 Object was changed in the code", 1, changedDataObjects.size());
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
[jira] Commented: (TUSCANY-1305) Changesummary of datagraph using
static interfaces.
Posted by "Frank Budinsky (JIRA)" <tu...@ws.apache.org>.
[ https://issues.apache.org/jira/browse/TUSCANY-1305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499631 ]
Frank Budinsky commented on TUSCANY-1305:
-----------------------------------------
Hi Steffen,
What version of the SDO code are you using? I vaguely remember fixing a bug that sounded something like this a couple of weeks ago. If you try the latest code from HEAD, it may be fixed already.
If not, can you please attach a zip file containing the test program and the generated classes, to save us some time reproducing the problem.
Thanks,
Frank.
> Changesummary of datagraph using static interfaces.
> ---------------------------------------------------
>
> Key: TUSCANY-1305
> URL: https://issues.apache.org/jira/browse/TUSCANY-1305
> Project: Tuscany
> Issue Type: Bug
> Components: Java SDO Implementation
> Affects Versions: Java-SDO-Next
> Reporter: Steffen Glomb
>
> I cant get Changesummary on a datagraph working correctly with the following contents: (hope this is a realy a bug this time)
> Schema, generated by the xsdhelper:
> <xs:schema
> xmlns:sdo="commonj.sdo" xmlns:sdoJava="commonj.sdo/java" xmlns:stn_1="http://example.com/customer" xmlns:xs="http://www.w3.org/2001/XMLSchema"
> attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://example.com/customer">
> <xs:complexType abstract="false" name="Account">
> <xs:sequence/>
> <xs:attribute default="0" name="accountNum" type="xs:int"/>
> </xs:complexType>
> <xs:element name="account" type="stn_1:Account"/>
> <xs:complexType abstract="false" name="Customer">
> <xs:sequence>
> <xs:element name="account" type="stn_1:Account"/>
> </xs:sequence>
> <xs:attribute name="firstName" type="xs:string"/>
> </xs:complexType>
> <xs:element name="customer" type="stn_1:Customer"/>
> </xs:schema>
> After generation of interfaces the following code fails to work as I would expect, because the changesummary does not contain the changed dataobject in the graph.
> ....
> import org.apache.tuscany.sdo.api.SDOUtil;
> import com.example.customer.Account;
> import com.example.customer.Customer;
> import com.example.customer.CustomerFactory;
> import commonj.sdo.DataGraph;
> import commonj.sdo.Type;
> import commonj.sdo.helper.HelperContext;
> import commonj.sdo.impl.HelperProvider;
> public class TestChangesummary extends TestCase {
> public void testChangeSummaryOnDatagraphWithContainmentStatic() throws Exception {
>
> HelperContext hc = HelperProvider.getDefaultContext();
> CustomerFactory.INSTANCE.register(hc);
>
> Type customerType = hc.getTypeHelper().getType(Customer.class);
> DataGraph dataGraph = SDOUtil.createDataGraph();
> Customer customer = (Customer) dataGraph.createRootObject(customerType);
>
> Account account = CustomerFactory.INSTANCE.createAccount();
> customer.setAccount(account);
> customer.setFirstName("John");
> customer.getAccount().setAccountNum(1234);
>
> ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
> SDOUtil.saveDataGraph(dataGraph, outputStream, null);
> DataGraph loadDataGraph = SDOUtil.loadDataGraph(new ByteArrayInputStream(outputStream.toByteArray()), null);
>
> loadDataGraph.getChangeSummary().beginLogging();
>
> customer = (Customer) loadDataGraph.getRootObject();
> customer.getAccount().setAccountNum(987);
>
> loadDataGraph.getChangeSummary().endLogging();
>
> List changedDataObjects = loadDataGraph.getChangeSummary().getChangedDataObjects();
> assertEquals("in fact 1 Object was changed in the code", 1, changedDataObjects.size());
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org