Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF] [CDO] Use MappedResourceLocator with CDO
[EMF] [CDO] Use MappedResourceLocator with CDO [message #1553029] Thu, 08 January 2015 13:08 Go to next message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 300
Registered: July 2009
Senior Member
Hi,

I think there is a problem to use MappedResourceLocator with CDO.

At the MappedResourceLocator creation, a EContentAdapter [1] is added on
the resource set. Then when a CDOResource is added to this resource set,
setTarget(Notifier) [2] is called, and then setTarget(EObject) [3] as
CDOResource is an EObject.

But the EContentAdapter of the MappedResourceLocator is not able to
handle this case. For example, there is ClassCast on line: URI newURI =
(URI)notification.getNewValue();

Is my analysis correct?

What are the options to use MappedResourceLocator with CDO? Indeed, this
would allow performance improvements.

Proposition: Override the setTarget(EObject) of
ResourceSetImpl.MappedResourceLocator.ResourceAdapter to change the
order bewteen EObject and Resource (same for unsetTarget).

[1]
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.MappedResourceLocator.ResourceAdapter

[2] org.eclipse.emf.ecore.util.EContentAdapter.setTarget(Notifier)
[3] org.eclipse.emf.ecore.util.EContentAdapter.setTarget(EObject)

Regards,


--
Laurent - Obeo


Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: [EMF] [CDO] Use MappedResourceLocator with CDO [message #1553644 is a reply to message #1553029] Thu, 08 January 2015 20:48 Go to previous message
Stephane  fournier is currently offline Stephane fournierFriend
Messages: 340
Registered: July 2009
Senior Member
Hi Laurent,

I agree with your analysis.

The fact that a CDOResource is an EObject, is really painful since the CDO creation.

Indeed, all EMF based-code, in EMF Technologies, most of the time, tests first if an object is an EObject and then a Resource and so on...

Ed Merks answered regarding this order, that is a question of performance especially in EContentAdapter. When working on CDO-based Modeler (based on Sirius ;D) , these points were raised with no change many years later.

EMF committers did not want to reverse the order between EObject and Resource tests in code (EMF core code) and CDO committers wanted to keep the inheritance between CDOResource and EObject...

You have to recode / override EMF code to adapt it to CDO that the only way we have I'm afraid.

Stéphane.
PS: Happy new Year to you and to Obeo members.


Previous Topic:XSD -> ECore; internal missmatch (auto-creation)
Next Topic:Is there a way to autofill a modelinstance with data?
Goto Forum:
  


Current Time: Thu Mar 28 20:01:30 GMT 2024

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

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

Back to the top