Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 369252 - ResourceFactoryRegistry dilemmas
Summary: ResourceFactoryRegistry dilemmas
Status: CLOSED DUPLICATE of bug 364419
Alias: None
Product: MDT.UML2
Classification: Modeling
Component: Core (show other bugs)
Version: 3.2.0   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: UML2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-20 11:17 EST by Ed Willink CLA
Modified: 2012-01-21 10:29 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2012-01-20 11:17:52 EST
I've just tried to edit a 3.0.0 CMOF so that it became a 4.0.0 CMOF although referenced from a still 3.0.0 CMOF. My standalone build scripts no longer work because I was using a *.cmof factory registration. In trying to fix this, I've explained a number of recent problems, but have yet to find a clear solution.

*.ecore2xml must be registered globally since it is used from transiently created ResourceSets.

Registering content handlers globally is pointless since delegation does not use the global URIConverter. Content handlers must be registered on a local ResourceSet.

There must be no local registration of *.cmof, *.uml, *.xmi if reading is to be content type sensitive.

There must be a registration of *.cmof, *.uml, *.xmi if writing of default content is to succeed.

There must be no local registration of the extension * or the content type * if the reference to http://schema.omg.org/spec/XMI/2.1 is to successfully fall through to a demand created package. If a default XMIResourceFactory is in use you get

org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'null' not found. (http://schema.omg.org/spec/XMI/2.1, 1, 7) for 'http://schema.omg.org/spec/XMI/2.1'
org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'html' is not found or is abstract. (http://schema.omg.org/spec/XMI/2.1, 1, 7) for 'http://schema.omg.org/spec/XMI/2.1'
org.eclipse.emf.ecore.xmi.XMIException: org.xml.sax.SAXParseException: The element type "link" must be terminated by the matching end-tag "</link>". (http://schema.omg.org/spec/XMI/2.1, 9, 3) for 'http://schema.omg.org/spec/XMI/2.1'

since there is an HTML OMG web page at http://schema.omg.org/spec/XMI/2.1.
Comment 1 Ed Willink CLA 2012-01-20 16:06:54 EST
There is a solution.

The version of /org.eclipse.ocl.examples.pivot/src/org/eclipse/ocl/examples/pivot/uml/UMLUtils.java just committed to MDT/OCL branch bug/318092 applies distinct initialization for local and global contexts satisfying all the constraints.
Comment 2 Kenn Hussey CLA 2012-01-20 16:19:10 EST
So I can close this bug, then?
Comment 3 Ed Willink CLA 2012-01-21 00:51:15 EST
Yet another duplicate of 364419.
Comment 4 Kenn Hussey CLA 2012-01-21 08:33:01 EST

*** This bug has been marked as a duplicate of bug 364419 ***
Comment 5 Ed Willink CLA 2012-01-21 10:29:58 EST
(In reply to comment #0)
> Registering content handlers globally is pointless since delegation does not
> use the global URIConverter. Content handlers must be registered on a local
> ResourceSet.

No. global content handlers can be initialized on ContentHandler.Registry.INSTANCE. It is using URIConverter.INSTANCE.getContentHandlers() that is pointless.