Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345719 - [Legacy] Issue when importing fragmented Models (Controlled resources)
Summary: [Legacy] Issue when importing fragmented Models (Controlled resources)
Status: CLOSED WORKSFORME
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.legacy (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Martin Fluegge CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-13 07:37 EDT by Stephane fournier CLA
Modified: 2012-09-21 06:50 EDT (History)
2 users (show)

See Also:


Attachments
Test v1 (4.45 KB, patch)
2011-05-20 11:58 EDT, Martin Fluegge CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephane fournier CLA 2011-05-13 07:37:38 EDT
Build Identifier: 4.0 M6

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 attach Garage Root to its CDOResource.


With a native CDO model, it  works perfectly.

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) 

Reproducible: Always
Comment 1 Stephane fournier CLA 2011-05-18 07:53:00 EDT
Is this ticket planned for RC2 build (as I know RC1 is over) ?
Comment 2 Martin Fluegge CLA 2011-05-18 08:10:07 EDT
Hi Stephane,

I cannot guarantee that this fix will be in RC2. There are 1-2 more serious bugs to fix. But then this one is of the next I will care for.
Comment 3 Martin Fluegge CLA 2011-05-20 11:58:14 EDT
Created attachment 196230 [details]
Test v1

Stephane,

I attached a test, but was not yet able to reproduce the problem. Could you have a look at it and change it so that it reproduces the error, or give me a hint what is missing?
How are your casr storred in the Garage (containment, yes/no)?
Is "partners" a list that holds inter-resource cross references to garage2? If so, are these "Garage" or "Car" references?
Comment 4 Stephane fournier CLA 2011-05-27 10:10:58 EDT
I've updated my TP to CDO 4.0 RC2a and I don't reproduce the bug.
That seems fixed, I suggest to close this ticket.

(In reply to comment #3)
> Created attachment 196230 [details]
> Test v1
> 
> Stephane,
> 
> I attached a test, but was not yet able to reproduce the problem. Could you
> have a look at it and change it so that it reproduces the error, or give me a
> hint what is missing?
> How are your casr storred in the Garage (containment, yes/no)?
> Is "partners" a list that holds inter-resource cross references to garage2? If
> so, are these "Garage" or "Car" references?
Comment 5 Martin Fluegge CLA 2011-05-27 12:38:54 EDT
(In reply to comment #4)
> I've updated my TP to CDO 4.0 RC2a and I don't reproduce the bug.

Great. I am closing this one. Please reopen if the error occurs again.
Comment 6 Eike Stepper CLA 2012-09-21 06:50:52 EDT
Closing.