Bug 251467 - Load the root resource only optionally into the ResourceSet
Summary: Load the root resource only optionally into the ResourceSet
Status: CLOSED DUPLICATE of bug 346636
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.1   Edit
Hardware: PC Windows XP
: P2 enhancement (vote)
Target Milestone: Galileo   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: Appealing to a Broader Community
Keywords:
Depends on:
Blocks: 252956
  Show dependency tree
 
Reported: 2008-10-20 15:46 EDT by Victor Roldan Betancort CLA
Modified: 2012-09-21 07:18 EDT (History)
4 users (show)

See Also:
smcduff: galileo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Roldan Betancort CLA 2008-10-20 15:46:14 EDT
The aim of this bugzilla is to discuss whether it's appropiate to have root resource loaded out-of-the-box in a ResourceSet.

Pros:
- Stuctured ResourceSet
- Consistency with the new Structured CDOResources
- RootResource reachable by EcoreUtil.getEObject() & EcoreUtil.getURI(object).

Cons:
- Strange resource get's loaded without user permision, not desirable to client apps.

Eike, Simon, could you comment on this?
Comment 1 Simon Mc Duff CLA 2008-10-20 20:13:38 EDT
I think for people that wants to have the same behavior as EMF it could be good to hide it.

Victor, in your application is it bothering you to have another resource when using CDO ? I know you wanted to have the same behavior as straight EMF...


We could have an option under CDOView.setRootResourceInResourcesetEnabled() :-)

We will wait Eike to respond before doing anything!!

Simon

Comment 2 Victor Roldan Betancort CLA 2008-10-21 10:10:06 EDT
Simon,

I've found a situation where the root object produces great performance decrease.

When removing an object in EMF Sample Ecore Editor, the following method is called to determine CrossReferences:

EcoreUtil.UsageCrossReferencer.findAll(eObjects, domain.getResourceSet());

If the removed object is the Resource itself, it will perform a cross-reference check for ALL resources in the ResourceSet which, by having the root resource, will end up performing a cross reference check for the whole repository. This hangs up the editor for a while....
Comment 3 Simon Mc Duff CLA 2008-10-21 10:12:17 EDT
(In reply to comment #2)
> Simon,
> 
> I've found a situation where the root object produces great performance
> decrease.
> 
> When removing an object in EMF Sample Ecore Editor, the following method is
> called to determine CrossReferences:
> 
> EcoreUtil.UsageCrossReferencer.findAll(eObjects, domain.getResourceSet());
> 
> If the removed object is the Resource itself, it will perform a cross-reference
> check for ALL resources in the ResourceSet which, by having the root resource,
> will end up performing a cross reference check for the whole repository. This
> hangs up the editor for a while....
> 

It could be a feature for some people... but not a good things for others!! :-)
Comment 4 Victor Roldan Betancort CLA 2008-10-21 10:17:14 EDT
(In reply to comment #3)
> (In reply to comment #2)
> > Simon,
> > 
> > I've found a situation where the root object produces great performance
> > decrease.
> > 
> > When removing an object in EMF Sample Ecore Editor, the following method is
> > called to determine CrossReferences:
> > 
> > EcoreUtil.UsageCrossReferencer.findAll(eObjects, domain.getResourceSet());
> > 
> > If the removed object is the Resource itself, it will perform a cross-reference
> > check for ALL resources in the ResourceSet which, by having the root resource,
> > will end up performing a cross reference check for the whole repository. This
> > hangs up the editor for a while....
> > 
> 
> It could be a feature for some people... but not a good things for others!! :-)
> 

Well, ResourceSet is a "set of interrelated resources". By adding the root resource, you are considering ALL resources of the repository related somehow. I think that could be too excesive. At the end, all resources in a repository will always be related, and therefore, will alway be in every ResourceSet!

This is just an example, but I think it could have major impact in many client applications.
Comment 5 Eike Stepper CLA 2008-10-27 03:35:48 EDT
ViK, I guess when you say "set of interrelated resources" you mean "a set of resources that must be interrelated".
I'm not sure if I agree. How must they be interrelated? Pair-wise? I can not imagine that any spec forbids unrelated resources.

On the other hand I'm also not sure if it's always "nice" to have the root resource in the resource set. Maybe we can make that optional and false by default? Simon, do you remember if there was an internal technical reason that *required* us to add the root resource?
Comment 6 Victor Roldan Betancort CLA 2008-10-27 05:42:55 EDT
Eike,

(In reply to comment #5)
> ViK, I guess when you say "set of interrelated resources" you mean "a set of
> resources that must be interrelated".
> I'm not sure if I agree. How must they be interrelated? Pair-wise? I can not
> imagine that any spec forbids unrelated resources.

Sure it doesn't forbid this. I just fit to ResourceSet definition:

"A collection of related persistent documents"

and also I recall a discussion we had regarding this issue, we you recommended me not to use a ResourceSet as a mere collection of unrelated resources, since it should be treat as a whole (I recall you saying "I would cut anyone's hand that dares to make a partial commit to CVS!"). 

Since structured repository was introduced there is, in fact, some sort of "relation" between all CDOResources.

> On the other hand I'm also not sure if it's always "nice" to have the root
> resource in the resource set. Maybe we can make that optional and false by
> default? Simon, do you remember if there was an internal technical reason that
> *required* us to add the root resource?

I believe it's implicitly loaded into the ResourceSet due to the new structured CDOResourceFolder implementation.
Comment 7 Simon Mc Duff CLA 2008-10-27 09:44:52 EDT
(In reply to comment #5)
> ViK, I guess when you say "set of interrelated resources" you mean "a set of
> resources that must be interrelated".
> I'm not sure if I agree. How must they be interrelated? Pair-wise? I can not
> imagine that any spec forbids unrelated resources.
> 
> On the other hand I'm also not sure if it's always "nice" to have the root
> resource in the resource set. Maybe we can make that optional and false by
> default? Simon, do you remember if there was an internal technical reason that
> *required* us to add the root resource?
> 

The reason is to have all objects reachable with rset.getEObject()
Lets say we have the  following structure:

resourceSet
|__RootResource
|  |_____ResourceA
|  |_____ResourceB
|  |_____ResourceFolder
|        |___ResourceC
|__ResourceA
|__ResourceB
|__ResourceC


RootResource, ResourceA, resourceB and ResourceFolder needs to have RootResource in the resourceset to be reachable from RootResource.

ResourceC doesn't needs to.


Simon
Comment 8 Victor Roldan Betancort CLA 2008-11-17 10:31:49 EST
Eike,

could you fix the bug name? (I don't know If I'm allowed to do that myself).

I meant "Should root resource be optionally loaded in the ResourceSet?"
Comment 9 Simon Mc Duff CLA 2008-12-02 16:37:48 EST
I will add an option in the view.
Comment 10 Eike Stepper CLA 2009-11-01 06:00:30 EST
Rebasing all unresolved enhancement requests to 3.0
Comment 11 Eike Stepper CLA 2010-06-29 04:51:27 EDT
Rebasing all outstanding enhancements requests to version 4.0
Comment 12 Eike Stepper CLA 2011-06-23 03:59:26 EDT
Moving all open enhancement requests to 4.1
Comment 13 Eike Stepper CLA 2011-07-16 09:50:35 EDT
Duplicate

*** This bug has been marked as a duplicate of bug 346636 ***
Comment 14 Eike Stepper CLA 2012-09-21 07:18:55 EDT
Closing.