Bug 467587 - Avoid XMLResource inheritance on CDOResourceImpl
Summary: Avoid XMLResource inheritance on CDOResourceImpl
Status: NEW
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.13   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 467657
Blocks:
  Show dependency tree
 
Reported: 2015-05-19 09:50 EDT by Esteban DUGUEPEROUX CLA
Modified: 2020-12-11 10:46 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Esteban DUGUEPEROUX CLA 2015-05-19 09:50:35 EDT
Since commit 78e1c324c06816ca50cb2947c7e582103757bd4d "[458349] Consolidate UI" CDOResourceImpl inherits of XMLResource [1].

After talk with Eike, this change has been done for CDO/Papyrus integration, more specifically about GMF integration.
In our CDO based application, we use also GMF with CDO and we know that GMF has been designed to work specifically with XMLResource.
From this fact we have overriden and/or remplaced XMLResource specific code in GMF by our own generic code to have GMF work with XMLResource and CDOResource.
We cannot integrate this change in our products because it is too impacting, indeed we and our customers do often "resource instanceof XMLResource" test to do XML specific staff, like for example XMI migration or parsing. In addition I don't see advantages having CDOResourceImpl implements XMLResource with most default methods implementations throwing UnsupportedOperationException because CDO and XML are not related.

This bugzilla is to track this issue and give a solution.


[1] https://git.eclipse.org/r/#/c/46583/6/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/spi/cdo/InternalCDOResource.java
Comment 1 Eike Stepper CLA 2015-05-20 02:11:37 EDT
Generally you can't require that any class does not implement a public interface that's meant to be implemented. You could argue that all non-optional methods of that interface be implemented correctly according to the API contract, but that wouldn't help you, either, because you still wouldn't want to use the XML-specific methods on a CDOResource. In your case it would be best to test if the URI of the resource is a file: URI rather than a cdo: URI.

But you're not asking to implement all XMLResource method in CDOResourceImpl. The only reason that would justify the removal of the XMLResource interface from CDOResourceImpl is that GMF removes their assumption that all resources are XMLResources and we can't do that through a bugzilla against CDO.

(In reply to Esteban DUGUEPEROUX from comment #0)
> Since commit 78e1c324c06816ca50cb2947c7e582103757bd4d "[458349] Consolidate
> UI" CDOResourceImpl inherits of XMLResource [1].
> 
> After talk with Eike, this change has been done for CDO/Papyrus integration,
> more specifically about GMF integration.
> In our CDO based application, we use also GMF with CDO and we know that GMF
> has been designed to work specifically with XMLResource.
> From this fact we have overriden and/or remplaced XMLResource specific code
> in GMF by our own generic code to have GMF work with XMLResource and
> CDOResource.

I suggest that this be fixed in GMF directly. I think that GMF mostly wants to reuse some ID functionality from XMLResource and that might be done in a more flexible way. Can you point me to a bugzilla against GMF that asks for that?

> We cannot integrate this change in our products because it is too impacting,
> indeed we and our customers do often "resource instanceof XMLResource" test
> to do XML specific staff, like for example XMI migration or parsing. 

Whether you integrate this change into your product or not is up to you of course, but I think you'd be better off to check the URI and not the implementation class of a resource. Another option is to do the instanceof check against XMLResourceImpl instead of XMLResource. Notice that that would break if we decide in CDO to extend XMLResourceImpl rather than implement XMLResource.

> In addition I don't see advantages having CDOResourceImpl implements
> XMLResource with most default methods implementations throwing
> UnsupportedOperationException because CDO and XML are not related.

The advantage of a CDOResourceImpl that implements XMLResource is obvious if you use GMF over CDO. And it's not a question of whether CDO and XML are related or not. People might want to export their CDO models in XML format by virtue of using a non-cdo: URI with their CDOResourceImpl, which I discussed with Ed some time ago.

> This bugzilla is to track this issue and give a solution.

For this bugzilla a see two options:

1) You change it to an enhancement request in order to implement the XMLResource methods correctly (for example by extending XMLResourceImpl) and make the non-XMLResource methods URI scheme-aware, or

2) You fix the original problem in GMF and mark this bugzilla depending on the respective GMF-bugzilla, or

3) We close this bugzilla as wontfix.
Comment 2 Eike Stepper CLA 2015-07-14 02:19:51 EDT
Moving all open bugzillas to 4.5.
Comment 3 Eike Stepper CLA 2016-07-31 01:02:34 EDT
Moving all unaddressed bugzillas to 4.6.
Comment 4 Eike Stepper CLA 2017-12-28 01:18:11 EST
Moving all open bugs to 4.7
Comment 5 Eike Stepper CLA 2019-11-08 02:09:06 EST
Moving all unresolved issues to version 4.8-
Comment 6 Eike Stepper CLA 2019-12-13 12:46:43 EST
Moving all unresolved issues to version 4.9
Comment 7 Eike Stepper CLA 2020-12-11 10:46:29 EST
Moving to 4.13.