Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Trouble exporting an (xsd based) model using EFeatureMapEntry
[CDO] Trouble exporting an (xsd based) model using EFeatureMapEntry [message #992013] Thu, 20 December 2012 12:09 Go to next message
Steve Monnier is currently offline Steve Monnier
Messages: 42
Registered: May 2011
Member
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)
Re: [CDO] Trouble exporting an (xsd based) model using EFeatureMapEntry [message #992275 is a reply to message #992013] Fri, 21 December 2012 03:59 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5486
Registered: July 2009
Senior Member
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)
Re: [CDO] Trouble exporting an (xsd based) model using EFeatureMapEntry [message #992290 is a reply to message #992275] Fri, 21 December 2012 04:35 Go to previous messageGo to next message
Steve Monnier is currently offline Steve Monnier
Messages: 42
Registered: May 2011
Member
Hi Eike, thanks for your quick answer. Is there somewhere a list of known limitation about FeatureMap Support I could use?

Steve
Re: [CDO] Trouble exporting an (xsd based) model using EFeatureMapEntry [message #992303 is a reply to message #992290] Fri, 21 December 2012 05:09 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5486
Registered: July 2009
Senior Member
Am 21.12.2012 10:35, schrieb Steve Monnier:
> Hi Eike, thanks for your quick answer. Is there somewhere a list of known limitation about FeatureMap Support I could
> use?
Not that I know of. Long time ago we've tried to get basic feature map support working and it does work in many cases.
Later many other functionalities have been added to CDO and I'm pretty sure that many of them do not cooperate nicely
with feature maps because feature map support is like cross cutting cancer to the implementation ;-(

It's probably best to start with some simple test cases and evolve them into the direction of your specific problems.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Trouble exporting an (xsd based) model using EFeatureMapEntry [message #992377 is a reply to message #992303] Fri, 21 December 2012 08:57 Go to previous messageGo to next message
Steve Monnier is currently offline Steve Monnier
Messages: 42
Registered: May 2011
Member
Ok thanks, I'll continue working on this subject and I'll update this thread if I find something interesting.

Steve
Re: [CDO] Trouble exporting an (xsd based) model using EFeatureMapEntry [message #992489 is a reply to message #992377] Fri, 21 December 2012 14:26 Go to previous message
Eike Stepper is currently offline Eike Stepper
Messages: 5486
Registered: July 2009
Senior Member
Am 21.12.2012 14:57, schrieb Steve Monnier:
> Ok thanks, I'll continue working on this subject and I'll update this thread if I find something interesting.
Thank you for your understanding!

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Previous Topic:[CDO] NPE starting CDO Server with MongoDB store
Next Topic:[Teneo] How to specify a Foreign Key name with a one to many relationship
Goto Forum:
  


Current Time: Thu Jul 31 05:37:23 EDT 2014

Powered by FUDForum. Page generated in 0.05561 seconds