[CDO] Import fragmented Models (Controlled resources) [message #686893] |
Fri, 13 May 2011 10:06 |
Stephane fournier Messages: 340 Registered: July 2009 |
Senior Member |
|
|
Hi,
I'm trying to enhance the import operation to work with fragmented
models (i.e models based on controlled resources) without loosing the
initial resources structure.
First let's have a look at the initial XMI model (a dummy one).
-Garage Root (stored in garageRoot.xmi)
- car 1
- car 2
- car 3
- partners
Garage 2 (controlled and stored in garage2.xmi)
- car 4
- car 5
One important thing to have in mind : I'm using Legacy mode with Eclipse
3.6.2 and CDO 4.0 M6.
To implement the import operation :
1) I open a CDO transaction working with its own ResourceSet.
2) I use another ResourceSet to load the XMI resources.
3) I create empty CDO resources equivalent to XMI ones.
4) I use the EMF Copier mechanism (with copyReferences).
5) I try to reattach copied objects to their CDOResource.
When I try to attach copied objects to their respective CDO resources, I
got exceptions (see stack below), when attaching the CDO object Garage 2
to its child CDO resource. Please note, it worked perfectly to attache
the root Garage Root to its CDOResource.
I tried to commit the CDO transaction after each attachment, but I got
other exceptions...
Is CDO supporting controlled resources ?
Which is the right way to import such resources ?
Stephane.
Stack trace :
java.lang.IllegalStateException: Failing event PREPARE in state PREPARED
for CDOLegacyWrapper[CarImpl@oid12] (data=Pair[CDOTransaction[2:2],
[CDOLegacyWrapper[CarImpl@oid12], CDOLegacyWrapper[CarImpl@oid13],
CDOLegacyWrapper[CarImpl@oid12]]])
at
org.eclipse.net4j.util.fsm.FiniteStateMachine.process(FiniteStateMachine.java:153)
at
org.eclipse.emf.internal.cdo.view.CDOStateMachine$PrepareTransition.execute(CDOStateMachine.java:546)
at
org.eclipse.emf.internal.cdo.view.CDOStateMachine$PrepareTransition.execute(CDOStateMachine.java:1)
at
org.eclipse.net4j.util.fsm.FiniteStateMachine.process(FiniteStateMachine.java:162)
at
org.eclipse.emf.internal.cdo.view.CDOStateMachine.prepare(CDOStateMachine.java:222)
at
org.eclipse.emf.internal.cdo.view.CDOStateMachine.attach(CDOStateMachine.java:188)
at
org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.attached(CDOResourceImpl.java:1176)
at
org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl.access$0(CDOResourceImpl.java:1174)
at
org.eclipse.emf.cdo.eresource.impl.CDOResourceImpl$ContentsCDOList.inverseAdd(CDOResourceImpl.java:1410)
at
org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl.addUnique(DelegatingNotifyingListImpl.java:310)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:307)
at
CDOImportExportManager.fillRemoteResources(CDOImportExportManager.java:235)
|
|
|
Powered by
FUDForum. Page generated in 0.01724 seconds