[CDO] Trouble exporting an (xsd based) model using EFeatureMapEntry [message #992013] |
Thu, 20 December 2012 17:09 |
|
Hello,
I am currently working on the CDO 4.0-maintenance branch and I am having an issue with a BPMN2 sample (available on https://github.com/ObeoNetwork/BPMN-Designer). The metamodel has been created from an XSD Schemas. I have tried to export some samples on a CDO Repository but the export fails.
First, I tried with no change on the metamodels in org.eclipse.bpmn2 (therefore in legacy mode). The issue seems to be on the loading of the mixed attribute of DocumentRoot. This attribute is an EFeatureMapEntry and it seems to cause NPE because it tries to load a feature with featureID as -1.
Then I saw that CDO provides CDOFeatureMapEntry that extends FeatureMap.Entry. Therefore, I switched the type of metamodels elements from EFeatureMapEntry to CDOFeatureMapEntry and regenerated in CDO Native. At this point, exporting a sample will throw ClassCastException because getMixed() now returns a List<CDOFeatureMapEntry> instead of a FeatureMap (even if this one extends List<FeatureMap.Entry>).
Here is a copy if this method:
public List<CDOFeatureMapEntry> getMixed() {
return (List<CDOFeatureMapEntry>) eDynamicGet(Bpmn2Package.DOCUMENT_ROOT__MIXED,
Bpmn2Package.Literals.DOCUMENT_ROOT__MIXED, true, false);
}
Next, I tested to switch back to that method previous implementation as a FeatureMap to solve the ClassCastException (minus the mixed attribute declared in the class).
public FeatureMap getMixed() {
return new BasicFeatureMap(this, Bpmn2Package.DOCUMENT_ROOT__MIXED);
}
At this point, a local bpmn2 model does not display any element under DocumentRoot, the map is always empty. The export ends without exceptions but as the local model, there is no element beside the root (DocumentRoot). I also have a bigger sample that rise UnresolvedReferenceException. I have tested to revert the method has it was before, using a class attribute.
public FeatureMap getMixed() {
if (mixed == null) {
mixed = new BasicFeatureMap(this, Bpmn2Package.DOCUMENT_ROOT__MIXED);
}
return mixed;
}
Now the local bpmn2 model displays its element under DocumentRoot as it should. However, even if the export ends without exceptions it still only have a root element and nothing else.
Do you have any advice to handle this kind of feature? Any clue if I'm dealing with it properly or completly wrong?
Thanks,
Steve
PS : Note that as BPMNDI.ecore and DI.ecore both have a DocumentRoot EClass in a di EPackage, I renamed one of these to avoid a duplicate DBTable name:
Rollback in DBStore: org.eclipse.net4j.db.DBException: DBTable exists: di_DocumentRoot
at org.eclipse.net4j.spi.db.DBSchema.addTable(DBSchema.java:73)
at org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.AbstractHorizontalClassMapping.initTable(AbstractHorizontalClassMapping.java:115)
Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Re: [CDO] Trouble exporting an (xsd based) model using EFeatureMapEntry [message #992275 is a reply to message #992013] |
Fri, 21 December 2012 08:59 |
|
Hi Steve,
FeatureMap support in CDO has always been half-hearted and unfortunately I don't see a chance to work on this unthankful
topic anytime soon. If you consider to debug/fix possible issues I'd be happy to review patches or help with knowledge.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Am 20.12.2012 18:09, schrieb Steve Monnier:
> Hello,
>
> I am currently working on the CDO 4.0-maintenance branch and I am having an issue with a BPMN2 sample (available on
> https://github.com/ObeoNetwork/BPMN-Designer). The metamodel has been created from an XSD Schemas. I have tried to
> export some samples on a CDO Repository but the export fails.
>
> First, I tried with no change on the metamodels in org.eclipse.bpmn2 (therefore in legacy mode). The issue seems to be
> on the loading of the mixed attribute of DocumentRoot. This attribute is an EFeatureMapEntry and it seems to cause NPE
> because it tries to load a feature with featureID as -1.
>
> Then I saw that CDO provides CDOFeatureMapEntry that extends FeatureMap.Entry. Therefore, I switched the type of
> metamodels elements from EFeatureMapEntry to CDOFeatureMapEntry and regenerated in CDO Native. At this point,
> exporting a sample will throw ClassCastException because getMixed() now returns a List<CDOFeatureMapEntry> instead of
> a FeatureMap (even if this one extends List<FeatureMap.Entry>). Here is a copy if this method:
> public List<CDOFeatureMapEntry> getMixed() {
> return (List<CDOFeatureMapEntry>) eDynamicGet(Bpmn2Package.DOCUMENT_ROOT__MIXED,
> Bpmn2Package.Literals.DOCUMENT_ROOT__MIXED, true, false);
> }
>
> Next, I tested to switch back to that method previous implementation as a FeatureMap to solve the ClassCastException
> (minus the mixed attribute declared in the class).
> public FeatureMap getMixed() {
> return new BasicFeatureMap(this, Bpmn2Package.DOCUMENT_ROOT__MIXED);
> }
>
> At this point, a local bpmn2 model does not display any element under DocumentRoot, the map is always empty. The
> export ends without exceptions but as the local model, there is no element beside the root (DocumentRoot). I also have
> a bigger sample that rise UnresolvedReferenceException. I have tested to revert the method has it was before, using a
> class attribute. public FeatureMap getMixed() {
> if (mixed == null) {
> mixed = new BasicFeatureMap(this, Bpmn2Package.DOCUMENT_ROOT__MIXED);
> }
> return mixed; }
>
> Now the local bpmn2 model displays its element under DocumentRoot as it should. However, even if the export ends
> without exceptions it still only have a root element and nothing else.
>
> Do you have any advice to handle this kind of feature? Any clue if I'm dealing with it properly or completly wrong?
>
> Thanks,
> Steve
>
>
> PS : Note that as BPMNDI.ecore and DI.ecore both have a DocumentRoot EClass in a di EPackage, I renamed one of these
> to avoid a duplicate DBTable name:
> Rollback in DBStore: org.eclipse.net4j.db.DBException: DBTable exists: di_DocumentRoot
> at org.eclipse.net4j.spi.db.DBSchema.addTable(DBSchema.java:73)
> at
> org.eclipse.emf.cdo.server.internal.db.mapping.horizontal.AbstractHorizontalClassMapping.initTable(AbstractHorizontalClassMapping.java:115)
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03127 seconds