Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324902

Summary: [uml2-adapter] Special mapping for UML 2.1 needed
Product: [Modeling] M2T Reporter: Karsten Thoms <karsten.thoms>
Component: XpandAssignee: Karsten Thoms <karsten.thoms>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 Flags: karsten.thoms: indigo+
Version: 1.0.1   
Target Milestone: RC   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Karsten Thoms CLA 2010-09-09 16:16:57 EDT
In this forum thread problems were reported which indicated that after reading an UML model the root object was of type AnyType:
http://www.eclipse.org/forums/index.php?t=rview&goto=557414#msg_557414

After some analysis it turned out that the UML model used declared the namespace for UML 2.1.0. This version seems to require a different Resource for reading, the org.eclipse.uml2.uml.resource.UML212UMLResource class. Next problem is a required URI mapping for standalone execution.

For models with NS URI xmlns:uml="http://www.eclipse.org/uml2/2.1.0/UML" the following mappings must be done:

ExtensionMap: 
  from = uml
  to   = org.eclipse.uml2.uml.resource.UML212UMLResource

URI Map
  from = platform:/plugin/org.eclipse.uml2.uml/model/UML21_2_UML.ecore2xml
  to   = EcoreUtil2.getURI("model/UML21_2_UML.ecore2xml").toString()

I think a good way to add these mappings is to add a property 'version' for the uml2 Setup class. Setting a concrete value won't change the default behavior except for version 2.1.x. For 2.1.x the above mappings are applied.

Pseudo Code:

public void setUmlVersion (String version) {
  if (version.matches("2\\.1\\.\\d")) {
    addExtensionMap(new Mapping("uml", "org.eclipse.uml2.uml.resource.UML212UMLResource
"));
    addUriMap(new Mapping("platform:/plugin/org.eclipse.uml2.uml/model/UML21_2_UML.ecore2xml", EcoreUtil2.getURI("model/UML21_2_UML.ecore2xml").toString())); 
  } 
}
Comment 1 Karsten Thoms CLA 2011-08-23 15:18:44 EDT
This one was already fixed on 2010-11-19
(b0c1773ec6d957814e31aac0ad3075c925899c9b)
Comment 2 Karsten Thoms CLA 2013-02-21 08:10:04 EST
Bug resolved before Xpand 1.2 release date => Closing