Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF Transaction] EObject removed from ResourceSet has always TransactionChangeRecorder as Adapter
[EMF Transaction] EObject removed from ResourceSet has always TransactionChangeRecorder as Adapter [message #1430266] Wed, 24 September 2014 07:36 Go to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi EMF Community,

I expected to find a CDO bug [1], but after a little analysis this
doesn't seems a CDO bug. Indeed If I add a EObject to a ResourceSet and
this addition is rollback, i.e. removed from the ResourceSet, this
EObject has always the TransactionChangeRecorder as Adapter.
Consequently if I modify this EObject without EMF Command I get the
following exception :

Caused by: java.lang.IllegalStateException: Cannot modify resource set
without a write transaction
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.assertWriting(TransactionChangeRecorder.java:348)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.appendNotification(TransactionChangeRecorder.java:302)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.processObjectNotification(TransactionChangeRecorder.java:284)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.notifyChanged(TransactionChangeRecorder.java:240)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSettingDelegateSingleData.dynamicSet(EStructuralFeatureImpl.java:2237)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(BasicEObjectImpl.java:1127)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1101)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1071)
at
org.eclipse.emf.cdo.tests.model1.impl.CategoryImpl.setName(CategoryImpl.java:81)
at
org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_444824_Test.testRollBackInCDO(Bugzilla_444824_Test.java:109)


According to this exception, EMF Transaction considers that the EObject
is yet contained in the ResourceSet while it is not the case.
Is the TransactionChangeRecorder should remove itself of a EObject
removed from ResourceSet?

Best Regards.

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=444824


--
Esteban Dugueperoux - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: [EMF Transaction] EObject removed from ResourceSet has always TransactionChangeRecorder as Adapt [message #1430333 is a reply to message #1430266] Wed, 24 September 2014 09:03 Go to previous messageGo to next message
Felix Dorner is currently offline Felix DornerFriend
Messages: 295
Registered: March 2012
Senior Member
Hi Esteban,

I think you're hit by something that's documented in EMF Transaction doc
under "Working with Transactional Editing Domains". Once an object
belongs to a TED, it will be in that TED until you detach it manually
with TransactionUtil.disconnectFromEditingDomain(). Now your case is
interesting, because the add() gets rolled back instantly, so maybe the
object should have never been part of the domain, or at least EMFT
should remove its adapters during the rollback?

Felix
Re: [EMF Transaction] EObject removed from ResourceSet has always TransactionChangeRecorder as Adapt [message #1430546 is a reply to message #1430333] Wed, 24 September 2014 13:49 Go to previous messageGo to next message
Christian W. Damus is currently offline Christian W. DamusFriend
Messages: 1195
Registered: July 2009
Location: Canada
Senior Member

Hi, Felix, Esteban,

It's an interesting case, the rollback of the first attachment of a new
EObject. However, I'm not sure that it's really so different from any
other case of detaching an element from the content forest of a
resource set.

It's clear that the intention of the transaction that was rolled back
was to add this new EObject into the context of the particular editing
domain. It would be strange, then, for the application in question to
try to use that EObject in any other domain. Why would it? Other
domains would work with their own copies of all the resources and
objects involved.

I wouldn't recommend trying to make the editing domain treat this case
of detachment from the resource set differently from other cases. An
object that is intended for manipulation in a TED should only be
manipulated in transactions on the TED, whether it is attached or not,
and even before it is attached and therefore before it has the change
recorder in the first place.

Hope that makes sense.

Christian


On 2014-09-24 09:03:56 +0000, Felix Dorner said:

> Hi Esteban,
>
> I think you're hit by something that's documented in EMF Transaction
> doc under "Working with Transactional Editing Domains". Once an object
> belongs to a TED, it will be in that TED until you detach it manually
> with TransactionUtil.disconnectFromEditingDomain(). Now your case is
> interesting, because the add() gets rolled back instantly, so maybe the
> object should have never been part of the domain, or at least EMFT
> should remove its adapters during the rollback?
>
> Felix
Re: [EMF Transaction] EObject removed from ResourceSet has always TransactionChangeRecorder as Adapt [message #1430637 is a reply to message #1430546] Wed, 24 September 2014 15:40 Go to previous message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hi Felix, Christian,

Thanks for your answer.


Le 24/09/2014 15:49, Christian W. Damus a écrit :
> Hi, Felix, Esteban,
>
> It's an interesting case, the rollback of the first attachment of a new
> EObject. However, I'm not sure that it's really so different from any
> other case of detaching an element from the content forest of a resource
> set.
>
> It's clear that the intention of the transaction that was rolled back
> was to add this new EObject into the context of the particular editing
> domain. It would be strange, then, for the application in question to
> try to use that EObject in any other domain. Why would it? Other
> domains would work with their own copies of all the resources and
> objects involved.
>
> I wouldn't recommend trying to make the editing domain treat this case
> of detachment from the resource set differently from other cases. An
> object that is intended for manipulation in a TED should only be
> manipulated in transactions on the TED, whether it is attached or not,
> and even before it is attached and therefore before it has the change
> recorder in the first place.
>
> Hope that makes sense.
>
> Christian
>
>
> On 2014-09-24 09:03:56 +0000, Felix Dorner said:
>
>> Hi Esteban,
>>
>> I think you're hit by something that's documented in EMF Transaction
>> doc under "Working with Transactional Editing Domains". Once an object
>> belongs to a TED, it will be in that TED until you detach it manually
>> with TransactionUtil.disconnectFromEditingDomain(). Now your case is
>> interesting, because the add() gets rolled back instantly, so maybe
>> the object should have never been part of the domain, or at least EMFT
>> should remove its adapters during the rollback?
>>
>> Felix
>
>



--
Esteban Dugueperoux - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Synchronize a diagram with a mode
Next Topic:Geting the CDO Resource using CDOResource URI
Goto Forum:
  


Current Time: Wed May 22 00:34:08 GMT 2019

Powered by FUDForum. Page generated in 0.02614 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top