|
|
Re: MARTE errors on genmodel [message #1850991 is a reply to message #1850927] |
Thu, 24 March 2022 07:41 |
|
I can confirm that the genmodel has errors. The genmodel needs to be re-generated. In the context of adapting the MARTE plugin to the version 1.2 of the spec (the plugin version number is not aligned with the spec), we are currently discussing internally whether we keep the patch in the UMLUtil package during the creation of the genmodel/ecore (i.e. mapping datatypes to strings) or revert tot eh standard mapping. We keep you updated concerning the progress on MARTE 1.2.
Ansgar
|
|
|
|
Re: MARTE errors on genmodel [message #1851006 is a reply to message #1850994] |
Thu, 24 March 2022 12:44 |
|
Sure, here it is. I haven't tested it in a while, so your mileage may vary:
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java
index c78760f..7eb961f 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/util/UMLUtil.java
@@ -16,6 +16,7 @@
* E.D.Willink - 420338, 512439
* Christian W. Damus - 444588, 497359, 501740
* Camille Letavernier - 528925, 529564
+ * CEA: Patch that returns strings for MARTE datatypes
*
*/
package org.eclipse.uml2.uml.util;
@@ -4671,7 +4672,13 @@ public class UMLUtil
@Override
public Boolean caseDataType(DataType dataType) {
- return Boolean.TRUE;
+ // CEA modification
+ if(mapDataTypeToString(dataType)) {
+ return Boolean.FALSE;
+ }
+ else {
+ return Boolean.TRUE;
+ }
}
@Override
@@ -4801,17 +4808,33 @@ public class UMLUtil
.getNearestPackage();
if (package_ != null) {
- EClass eClass = EcoreFactory.eINSTANCE.createEClass();
- elementToEModelElementMap.put(dataType, eClass);
- EPackage ePackage = (EPackage) doSwitch(package_);
- ePackage.getEClassifiers().add(eClass);
+ // CEA modification
+ if(mapDataTypeToString(dataType)) {
+ EDataType eDataType = EcoreFactory.eINSTANCE.createEDataType();
+ elementToEModelElementMap.put(dataType, eDataType);
- setName(eClass, dataType);
+ EPackage ePackage = (EPackage)doSwitch(package_);
+ ePackage.getEClassifiers().add(eDataType);
- defaultCase(dataType);
+ setName(eDataType, dataType);
+ eDataType.setInstanceClassName("java.lang.String"); //$NON-NLS-1$
- return eClass;
+ return eDataType;
+ }
+ else {
+ EClass eClass = EcoreFactory.eINSTANCE.createEClass();
+ elementToEModelElementMap.put(dataType, eClass);
+
+ EPackage ePackage = (EPackage) doSwitch(package_);
+ ePackage.getEClassifiers().add(eClass);
+
+ setName(eClass, dataType);
+
+ defaultCase(dataType);
+
+ return eClass;
+ }
}
}
return super.caseDataType(dataType);
@@ -5214,7 +5237,13 @@ public class UMLUtil
setName(eDataType, primitiveType);
- eDataType.setInstanceClassName(eDataType.getName());
+ // CEA modification
+ if(mapDataTypeToString(primitiveType)) {
+ eDataType.setInstanceClassName("java.lang.String"); //$NON-NLS-1$
+ }
+ else {
+ eDataType.setInstanceClassName(eDataType.getName());
+ }
defaultCase(primitiveType);
@@ -13478,7 +13507,7 @@ public class UMLUtil
if (resourceSet != null) {
Map<String, Object> contentTypeToFactoryMap = resourceSet
.getResourceFactoryRegistry().getContentTypeToFactoryMap();
-
+
contentTypeToFactoryMap.put(
UML402UMLResource.UML_4_0_0_CONTENT_TYPE_IDENTIFIER,
UML402UMLResource.Factory.INSTANCE);
@@ -13746,4 +13775,15 @@ public class UMLUtil
return allSubsetFeatures;
}
+ /**
+ * CEA: Map certain data types to string. This is useful for instance for MARTE types
+ *
+ * @param dataType
+ * @return true, if data-type should be mapped to a string
+ */
+ private static boolean mapDataTypeToString(DataType dataType) {
+ // currently: map all data types to string
+ return true;
+ }
+
}
|
|
|
|
Re: MARTE errors on genmodel [message #1851033 is a reply to message #1851024] |
Fri, 25 March 2022 08:11 |
|
Hi Ed,
thanks for the feedback. We don't intend to submit the patch, it was a workaround used many years ago to enforce the string serialization of datatypes in the MARTE profile (notably those that can be expressed in MARTE's value specification language VSL). It's more likely than not, that we will use the default ecore mapping in an upcoming version of MARTE.
Best
Ansgar
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: MARTE errors on genmodel [message #1851899 is a reply to message #1851831] |
Thu, 21 April 2022 11:15 |
|
Dear Alberto.
this is not planned as it would be problematic to ship a modified version of a plugin that is used by many other components. It will not be necessary as well in the future (for people that plan to extend MARTE), since we will migrate to the standard UML mappings.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04558 seconds