| Summary: | org.eclipse.uml2.uml.resources.util.UMLResourcesUtil.init(ResourceSet) creates URI mappings to platform:/plugin | ||
|---|---|---|---|
| Product: | [Modeling] MDT.UML2 | Reporter: | Mikaël Barbero <mikael.barbero> |
| Component: | Core | Assignee: | UML2 Inbox <mdt-uml2-inbox> |
| Status: | RESOLVED DUPLICATE | QA Contact: | |
| Severity: | blocker | ||
| Priority: | P3 | CC: | ed |
| Version: | 4.0.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Mac OS X | ||
| Whiteboard: | |||
Hmm, Ed Willink has been successfully using this utility in standalone scenarios... Perhaps a call to EcorePlugin.ExtensionProcessor.process(null) needs to be added to ensure that everything in EMF has been set up? (In reply to comment #1) > Hmm, Ed Willink has been successfully using this utility in standalone > scenarios... Perhaps a call to EcorePlugin.ExtensionProcessor.process(null) > needs to be added to ensure that everything in EMF has been set up? Yes, this may do the trick. I will give it a try asap. Ed Willink, do you usually call the method EcorePlugin.ExtensionProcessor.process(ClassLoader) when using the method UMLResourcesUtil#init? See Bug 401682 for a contributed fix. See the discussion for why it cannot be automatic. Pity the extra routine didn't appear in Kepler. Thanks for the info. I don't really care if it's automatic or not (even if automatic would be better). But putting wrong data in the registry is a bug to me. Moreover, I really don't understand why the method init(ResourceSet) initializes some static singletons. It should be split in init(EPackage.Registry), init(Resource.Factory.Registry), initEPackageNsURIToProfileLocationMap(Map), initURIConverterMap(Map) etc... With maybe a static helper method initStaticSingleton() calling each one. This method init(ResourceSet) is non sense to me as it does not do anything for the resourceset initialization except call another static method that effectively do the initialization of the resource set. Do you want me to open a bug about that? Marking this as a duplicate of bug 401682. We could perhaps consider splitting out the individual subroutines (e.g., as an enhancement in Luna) but the initial requirement was a utility that could be called once to properly initialize a standalone environment. The fact that another routine is called to do the work specific to the resource set is an internal implementation detail which clients shouldn't care about. *** This bug has been marked as a duplicate of bug 401682 *** More background on why some initializations are static and some are not can be found in bug 364419 and bug 389542. I've opened the bug 414572 to address the issue of splitting out of the method UMLResourcesUtil#init(ResourceSet). |
org.eclipse.uml2.uml.resources.util.UMLResourcesUtil.init(ResourceSet) is supposed to initialize registries for standalone usage of UML2. However, it puts mapping to platform:/plugin in the URIConverter.URI_MAP map! These URI are not resolvable in standalone usage. Map<URI, URI> uriMap = URIConverter.URI_MAP; uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), URI .createPlatformPluginURI( "/org.eclipse.uml2.uml.resources/libraries/", true)); //$NON-NLS-1$ uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), URI .createPlatformPluginURI( "/org.eclipse.uml2.uml.resources/metamodels/", true)); //$NON-NLS-1$ uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), URI .createPlatformPluginURI( "/org.eclipse.uml2.uml.resources/profiles/", true)); //$NON-NLS-1$ Currently, we have to override what is done by this method by doing the following registration: final URL umlJarFileLocation = org.eclipse.uml2.uml.resources.ResourcesPlugin.class.getResource("ResourcesPlugin.class"); String umlJarPath = umlJarFileLocation.toString(); umlJarPath = umlJarPath.substring(0, umlJarPath.indexOf('!')); final Map<URI, URI> uriMap = URIConverter.URI_MAP; uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), URI.createURI(umlJarPath + "!/libraries/")); uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), URI.createURI(umlJarPath + "!/metamodels/")); uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), URI.createURI(umlJarPath + "!/profiles/")); Also, I don't see why init(ResourceSet) is doing static singleton modification. It should be separated in another init method! But it may be discussed in another bug report ;)