Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.etrice.core.etmap/src')
-rw-r--r--plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/ETMap.xtext104
-rw-r--r--plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/ETMapPostprocessor.ext32
-rw-r--r--plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/GenerateETMap.mwe2304
-rw-r--r--plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/postprocessing/DocuPostprocessor.xtend278
-rw-r--r--plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/postprocessing/PostprocessorController.java44
-rw-r--r--plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/util/ETMapUtil.java498
6 files changed, 630 insertions, 630 deletions
diff --git a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/ETMap.xtext b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/ETMap.xtext
index 3da23f852..cce486692 100644
--- a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/ETMap.xtext
+++ b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/ETMap.xtext
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-grammar org.eclipse.etrice.core.etmap.ETMap with org.eclipse.xtext.common.Terminals
-
-generate eTMap "http://www.eclipse.org/etrice/core/etmap/ETMap"
-
-import "http://www.eclipse.org/emf/2002/Ecore" as ecore
-import "http://www.eclipse.org/etrice/Room" as room
-import "http://www.eclipse.org/etrice/core/etphys/ETPhys" as phys
-
-MappingModel:
- 'MappingModel' name=FQN '{'
- (imports+=Import)*
- mappings+=Mapping*
- '}'
-;
-
-Mapping:
- 'Mapping' logicalSys=[room::LogicalSystem|FQN] '->' physicalSys=[phys::PhysicalSystem|FQN] '{'
- subsysMappings+=SubSystemMapping*
- '}'
-;
-
-SubSystemMapping:
- 'SubSystemMapping' logicalSubSys=[room::SubSystemRef|ID] '->' node=[phys::NodeRef|ID] ('{'
- threadMappings+=ThreadMapping*
- '}')?
-;
-
-ThreadMapping:
- 'ThreadMapping' logicalThread=[room::LogicalThread|ID] '->' physicalThread=[phys::PhysicalThread|ID]
-;
-
-
-Import :
- 'import' (importedNamespace=ImportedFQN 'from' | 'model') importURI=STRING;
-
-ImportedFQN:
- FQN ('.*')?;
-
-FQN:
- ID ('.' ID)*;
+/*******************************************************************************
+ * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+grammar org.eclipse.etrice.core.etmap.ETMap with org.eclipse.xtext.common.Terminals
+
+generate eTMap "http://www.eclipse.org/etrice/core/etmap/ETMap"
+
+import "http://www.eclipse.org/emf/2002/Ecore" as ecore
+import "http://www.eclipse.org/etrice/Room" as room
+import "http://www.eclipse.org/etrice/core/etphys/ETPhys" as phys
+
+MappingModel:
+ 'MappingModel' name=FQN '{'
+ (imports+=Import)*
+ mappings+=Mapping*
+ '}'
+;
+
+Mapping:
+ 'Mapping' logicalSys=[room::LogicalSystem|FQN] '->' physicalSys=[phys::PhysicalSystem|FQN] '{'
+ subsysMappings+=SubSystemMapping*
+ '}'
+;
+
+SubSystemMapping:
+ 'SubSystemMapping' logicalSubSys=[room::SubSystemRef|ID] '->' node=[phys::NodeRef|ID] ('{'
+ threadMappings+=ThreadMapping*
+ '}')?
+;
+
+ThreadMapping:
+ 'ThreadMapping' logicalThread=[room::LogicalThread|ID] '->' physicalThread=[phys::PhysicalThread|ID]
+;
+
+
+Import :
+ 'import' (importedNamespace=ImportedFQN 'from' | 'model') importURI=STRING;
+
+ImportedFQN:
+ FQN ('.*')?;
+
+FQN:
+ ID ('.' ID)*;
diff --git a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/ETMapPostprocessor.ext b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/ETMapPostprocessor.ext
index 65d3e6a2e..5ba80cc92 100644
--- a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/ETMapPostprocessor.ext
+++ b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/ETMapPostprocessor.ext
@@ -1,17 +1,17 @@
-/*******************************************************************************
- * Copyright (c) 2012 Juergen Haug
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Juergen Haug
- *
- *******************************************************************************/
-
-import xtext;
-
-process(GeneratedMetamodel this) :
- JAVA org.eclipse.etrice.core.etmap.postprocessing.PostprocessorController.process(org.eclipse.xtext.GeneratedMetamodel)
+/*******************************************************************************
+ * Copyright (c) 2012 Juergen Haug
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Juergen Haug
+ *
+ *******************************************************************************/
+
+import xtext;
+
+process(GeneratedMetamodel this) :
+ JAVA org.eclipse.etrice.core.etmap.postprocessing.PostprocessorController.process(org.eclipse.xtext.GeneratedMetamodel)
; \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/GenerateETMap.mwe2 b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/GenerateETMap.mwe2
index bdbea6f8c..7b368860a 100644
--- a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/GenerateETMap.mwe2
+++ b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/GenerateETMap.mwe2
@@ -1,152 +1,152 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-module org.eclipse.etrice.core.etmap.GenerateETMap
-
-import org.eclipse.emf.mwe.utils.*
-import org.eclipse.xtext.generator.*
-import org.eclipse.xtext.ui.generator.*
-
-var grammarURI = "classpath:/org/eclipse/etrice/core/etmap/ETMap.xtext"
-var file.extensions = "etmap"
-var projectName = "org.eclipse.etrice.core.etmap"
-var runtimeProject = "../${projectName}"
-
-Workflow {
- bean = StandaloneSetup {
- scanClassPath = true
- platformUri = "${runtimeProject}/.."
- registerGeneratedEPackage = "org.eclipse.etrice.core.room.RoomPackage"
- registerGenModelFile = "platform:/resource/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.genmodel"
- registerGeneratedEPackage = "org.eclipse.etrice.core.etphys.eTPhys.ETPhysPackage"
- registerGenModelFile = "platform:/resource/org.eclipse.etrice.core.etphys/src-gen/org/eclipse/etrice/core/etphys/ETPhys.genmodel"
- }
-
- component = DirectoryCleaner {
- directory = "${runtimeProject}/src-gen"
- }
-
- component = DirectoryCleaner {
- directory = "${runtimeProject}.ui/src-gen"
- }
-
- component = Generator {
- pathRtProject = runtimeProject
- pathUiProject = "${runtimeProject}.ui"
- pathTestProject = "../../tests/${projectName}.tests"
- projectNameRt = projectName
- projectNameUi = "${projectName}.ui"
- language = {
- uri = grammarURI
- fileExtensions = file.extensions
-
- // Java API to access grammar elements (required by several other fragments)
- fragment = grammarAccess.GrammarAccessFragment {}
-
- // generates Java API for the generated EPackages
- fragment = ecore.EcoreGeneratorFragment {
- // referencedGenModels = "
- // platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel,
- // platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel
- // "
- }
-
- // Serializer 2.0
- fragment = serializer.SerializerFragment {
- generateStub = false
- }
-
- // the serialization component (1.0)
- // fragment = parseTreeConstructor.ParseTreeConstructorFragment {}
-
- // a custom ResourceFactory for use with EMF
- fragment = resourceFactory.ResourceFactoryFragment {
- fileExtensions = file.extensions
- }
-
- // The antlr parser generator fragment.
- fragment = parser.antlr.XtextAntlrGeneratorFragment {
- // options = {
- // backtrack = true
- // }
- }
-
- // java-based API for validation
- fragment = validation.JavaValidatorFragment {
- composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
- // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
- }
-
- // scoping and exporting API
- // fragment = scoping.ImportURIScopingFragment {}
- // fragment = exporting.SimpleNamesFragment {}
-
- // scoping and exporting API
- fragment = scoping.ImportURIScopingFragment {}
- fragment = exporting.QualifiedNamesFragment {}
- //fragment = builder.BuilderIntegrationFragment {}
-
- // generator API
- fragment = generator.GeneratorFragment {
- generateMwe = false
- generateJavaMain = false
- }
-
- // formatter API
- fragment = formatting.FormatterFragment {}
-
- // labeling API
- fragment = labeling.LabelProviderFragment {}
-
- // outline API
- fragment = outline.OutlineTreeProviderFragment {}
- fragment = outline.QuickOutlineFragment {}
-
- // quickfix API
- fragment = quickfix.QuickfixProviderFragment {}
-
- // content assist API
- fragment = contentAssist.JavaBasedContentAssistFragment {}
-
- // generates a more lightweight Antlr parser and lexer tailored for content assist
- fragment = parser.antlr.XtextAntlrUiGeneratorFragment {}
-
- // generates junit test support classes into Generator#pathTestProject
- fragment = junit.Junit4Fragment {}
-
- // project wizard (optional)
- // fragment = projectWizard.SimpleProjectWizardFragment {
- // generatorProjectName = "${projectName}"
- // modelFileExtension = file.extensions
- // }
-
- // rename refactoring
- fragment = refactoring.RefactorElementNameFragment {}
-
- // provides the necessary bindings for java types integration
- //fragment = types.TypesGeneratorFragment {}
-
- // generates the required bindings only if the grammar inherits from Xbase
- fragment = xbase.XbaseGeneratorFragment {}
-
- // provides a preference page for template proposals
- fragment = templates.CodetemplatesGeneratorFragment {}
-
- // provides a compare view
- fragment = compare.CompareFragment {
- fileExtensions = file.extensions
- }
-
- }
- }
-}
-
+/*******************************************************************************
+ * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+module org.eclipse.etrice.core.etmap.GenerateETMap
+
+import org.eclipse.emf.mwe.utils.*
+import org.eclipse.xtext.generator.*
+import org.eclipse.xtext.ui.generator.*
+
+var grammarURI = "classpath:/org/eclipse/etrice/core/etmap/ETMap.xtext"
+var file.extensions = "etmap"
+var projectName = "org.eclipse.etrice.core.etmap"
+var runtimeProject = "../${projectName}"
+
+Workflow {
+ bean = StandaloneSetup {
+ scanClassPath = true
+ platformUri = "${runtimeProject}/.."
+ registerGeneratedEPackage = "org.eclipse.etrice.core.room.RoomPackage"
+ registerGenModelFile = "platform:/resource/org.eclipse.etrice.core.room/src-gen/org/eclipse/etrice/core/Room.genmodel"
+ registerGeneratedEPackage = "org.eclipse.etrice.core.etphys.eTPhys.ETPhysPackage"
+ registerGenModelFile = "platform:/resource/org.eclipse.etrice.core.etphys/src-gen/org/eclipse/etrice/core/etphys/ETPhys.genmodel"
+ }
+
+ component = DirectoryCleaner {
+ directory = "${runtimeProject}/src-gen"
+ }
+
+ component = DirectoryCleaner {
+ directory = "${runtimeProject}.ui/src-gen"
+ }
+
+ component = Generator {
+ pathRtProject = runtimeProject
+ pathUiProject = "${runtimeProject}.ui"
+ pathTestProject = "../../tests/${projectName}.tests"
+ projectNameRt = projectName
+ projectNameUi = "${projectName}.ui"
+ language = {
+ uri = grammarURI
+ fileExtensions = file.extensions
+
+ // Java API to access grammar elements (required by several other fragments)
+ fragment = grammarAccess.GrammarAccessFragment {}
+
+ // generates Java API for the generated EPackages
+ fragment = ecore.EcoreGeneratorFragment {
+ // referencedGenModels = "
+ // platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel,
+ // platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel
+ // "
+ }
+
+ // Serializer 2.0
+ fragment = serializer.SerializerFragment {
+ generateStub = false
+ }
+
+ // the serialization component (1.0)
+ // fragment = parseTreeConstructor.ParseTreeConstructorFragment {}
+
+ // a custom ResourceFactory for use with EMF
+ fragment = resourceFactory.ResourceFactoryFragment {
+ fileExtensions = file.extensions
+ }
+
+ // The antlr parser generator fragment.
+ fragment = parser.antlr.XtextAntlrGeneratorFragment {
+ // options = {
+ // backtrack = true
+ // }
+ }
+
+ // java-based API for validation
+ fragment = validation.JavaValidatorFragment {
+ composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
+ // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
+ }
+
+ // scoping and exporting API
+ // fragment = scoping.ImportURIScopingFragment {}
+ // fragment = exporting.SimpleNamesFragment {}
+
+ // scoping and exporting API
+ fragment = scoping.ImportURIScopingFragment {}
+ fragment = exporting.QualifiedNamesFragment {}
+ //fragment = builder.BuilderIntegrationFragment {}
+
+ // generator API
+ fragment = generator.GeneratorFragment {
+ generateMwe = false
+ generateJavaMain = false
+ }
+
+ // formatter API
+ fragment = formatting.FormatterFragment {}
+
+ // labeling API
+ fragment = labeling.LabelProviderFragment {}
+
+ // outline API
+ fragment = outline.OutlineTreeProviderFragment {}
+ fragment = outline.QuickOutlineFragment {}
+
+ // quickfix API
+ fragment = quickfix.QuickfixProviderFragment {}
+
+ // content assist API
+ fragment = contentAssist.JavaBasedContentAssistFragment {}
+
+ // generates a more lightweight Antlr parser and lexer tailored for content assist
+ fragment = parser.antlr.XtextAntlrUiGeneratorFragment {}
+
+ // generates junit test support classes into Generator#pathTestProject
+ fragment = junit.Junit4Fragment {}
+
+ // project wizard (optional)
+ // fragment = projectWizard.SimpleProjectWizardFragment {
+ // generatorProjectName = "${projectName}"
+ // modelFileExtension = file.extensions
+ // }
+
+ // rename refactoring
+ fragment = refactoring.RefactorElementNameFragment {}
+
+ // provides the necessary bindings for java types integration
+ //fragment = types.TypesGeneratorFragment {}
+
+ // generates the required bindings only if the grammar inherits from Xbase
+ fragment = xbase.XbaseGeneratorFragment {}
+
+ // provides a preference page for template proposals
+ fragment = templates.CodetemplatesGeneratorFragment {}
+
+ // provides a compare view
+ fragment = compare.CompareFragment {
+ fileExtensions = file.extensions
+ }
+
+ }
+ }
+}
+
diff --git a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/postprocessing/DocuPostprocessor.xtend b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/postprocessing/DocuPostprocessor.xtend
index d87161431..94e6d14e4 100644
--- a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/postprocessing/DocuPostprocessor.xtend
+++ b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/postprocessing/DocuPostprocessor.xtend
@@ -1,140 +1,140 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Juergen Haug (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.etmap.postprocessing
-
-import org.eclipse.xtext.GeneratedMetamodel
-
-import static extension org.eclipse.etrice.core.postprocessing.PostprocessingHelpers.*
-
-class DocuPostprocessor {
-
- def process(GeneratedMetamodel metamodel) {
- val pckg = metamodel.EPackage
-
- //------------------------------------------------------------------
- var cls = pckg.getClass("MappingModel")
- cls.setDocumentation(
- '''
- The root object for the mapping model. It gives access to the mappings defined.
- ''')
-
- cls.getAttribute("name").setDocumentation(
- '''
- The model name is a dot separated fully qualified name and is
- used to provide a name space.
- ''')
-
- cls.getReference("imports").setDocumentation(
- '''
- A list of all imported models.
- ''')
-
- cls.getReference("mappings").setDocumentation(
- '''
- A list of all defined mappings.
- ''')
-
- //------------------------------------------------------------------
- cls = pckg.getClass("Mapping")
- cls.setDocumentation(
- '''
- This is the mapping of a logical system (defined in a ROOM model) to a
- physical system (defined in a physical model).
- ''')
-
- cls.getReference("logicalSys").setDocumentation(
- '''
- This is the logical system being mapped.
- ''')
-
- cls.getReference("physicalSys").setDocumentation(
- '''
- This is the physical system being mapped to.
- ''')
-
- cls.getReference("subsysMappings").setDocumentation(
- '''
- This is a list of nested mappings of the sub systems of this system.
- ''')
-
- //------------------------------------------------------------------
- cls = pckg.getClass("SubSystemMapping")
- cls.setDocumentation(
- '''
- This is the mapping of a sub system (defined in a ROOM model) to a
- node (defined in a physical model).
- ''')
-
- cls.getReference("logicalSubSys").setDocumentation(
- '''
- This is the logical sub system being mapped.
- ''')
-
- cls.getReference("node").setDocumentation(
- '''
- This is the node being mapped to.
- ''')
-
- cls.getReference("threadMappings").setDocumentation(
- '''
- This is a list of nested mappings of logical to physical threads.
- ''')
-
- //------------------------------------------------------------------
- cls = pckg.getClass("ThreadMapping")
- cls.setDocumentation(
- '''
- This is the mapping of a logical thread (defined in a ROOM model) to a
- physical thread (defined in a physical model).
- ''')
-
- cls.getReference("logicalThread").setDocumentation(
- '''
- This is the logical thread being mapped.
- ''')
-
- cls.getReference("physicalThread").setDocumentation(
- '''
- This is the physical thread being mapped to.
- ''')
-
- //------------------------------------------------------------------
- cls = pckg.getClass("Import")
- cls.setDocumentation('''
- The import declares an imported model (given as a URI) and
- an optional imported namespace.
- ''')
-
- cls.getAttribute("importedNamespace").setDocumentation(
- '''
- The imported name space has to be a dot separated qualified name followed by .*.
- Example: my.namespace.*
- ''')
-
- cls.getAttribute("importURI").setDocumentation(
- '''
- The import URI can be a relative or absolute file system path.
- It may contain environment variables in ${} which will be expanded.
- <p>
- Examples:
- <ul>
- <li>import model "AnotherModel.room"</li>
- <li>import my.namespace.* from "AnotherModel.room"</li>
- <li>import my.namespace.* from "../../AnotherProject/models/AnotherModel.room"</li>
- <li>import my.namespace.* from "/${ROOM_MODELS}/SomeModel.room"</li>
- </ul>
- </p>
- ''')
- }
-
+/*******************************************************************************
+ * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Juergen Haug (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.etmap.postprocessing
+
+import org.eclipse.xtext.GeneratedMetamodel
+
+import static extension org.eclipse.etrice.core.postprocessing.PostprocessingHelpers.*
+
+class DocuPostprocessor {
+
+ def process(GeneratedMetamodel metamodel) {
+ val pckg = metamodel.EPackage
+
+ //------------------------------------------------------------------
+ var cls = pckg.getClass("MappingModel")
+ cls.setDocumentation(
+ '''
+ The root object for the mapping model. It gives access to the mappings defined.
+ ''')
+
+ cls.getAttribute("name").setDocumentation(
+ '''
+ The model name is a dot separated fully qualified name and is
+ used to provide a name space.
+ ''')
+
+ cls.getReference("imports").setDocumentation(
+ '''
+ A list of all imported models.
+ ''')
+
+ cls.getReference("mappings").setDocumentation(
+ '''
+ A list of all defined mappings.
+ ''')
+
+ //------------------------------------------------------------------
+ cls = pckg.getClass("Mapping")
+ cls.setDocumentation(
+ '''
+ This is the mapping of a logical system (defined in a ROOM model) to a
+ physical system (defined in a physical model).
+ ''')
+
+ cls.getReference("logicalSys").setDocumentation(
+ '''
+ This is the logical system being mapped.
+ ''')
+
+ cls.getReference("physicalSys").setDocumentation(
+ '''
+ This is the physical system being mapped to.
+ ''')
+
+ cls.getReference("subsysMappings").setDocumentation(
+ '''
+ This is a list of nested mappings of the sub systems of this system.
+ ''')
+
+ //------------------------------------------------------------------
+ cls = pckg.getClass("SubSystemMapping")
+ cls.setDocumentation(
+ '''
+ This is the mapping of a sub system (defined in a ROOM model) to a
+ node (defined in a physical model).
+ ''')
+
+ cls.getReference("logicalSubSys").setDocumentation(
+ '''
+ This is the logical sub system being mapped.
+ ''')
+
+ cls.getReference("node").setDocumentation(
+ '''
+ This is the node being mapped to.
+ ''')
+
+ cls.getReference("threadMappings").setDocumentation(
+ '''
+ This is a list of nested mappings of logical to physical threads.
+ ''')
+
+ //------------------------------------------------------------------
+ cls = pckg.getClass("ThreadMapping")
+ cls.setDocumentation(
+ '''
+ This is the mapping of a logical thread (defined in a ROOM model) to a
+ physical thread (defined in a physical model).
+ ''')
+
+ cls.getReference("logicalThread").setDocumentation(
+ '''
+ This is the logical thread being mapped.
+ ''')
+
+ cls.getReference("physicalThread").setDocumentation(
+ '''
+ This is the physical thread being mapped to.
+ ''')
+
+ //------------------------------------------------------------------
+ cls = pckg.getClass("Import")
+ cls.setDocumentation('''
+ The import declares an imported model (given as a URI) and
+ an optional imported namespace.
+ ''')
+
+ cls.getAttribute("importedNamespace").setDocumentation(
+ '''
+ The imported name space has to be a dot separated qualified name followed by .*.
+ Example: my.namespace.*
+ ''')
+
+ cls.getAttribute("importURI").setDocumentation(
+ '''
+ The import URI can be a relative or absolute file system path.
+ It may contain environment variables in ${} which will be expanded.
+ <p>
+ Examples:
+ <ul>
+ <li>import model "AnotherModel.room"</li>
+ <li>import my.namespace.* from "AnotherModel.room"</li>
+ <li>import my.namespace.* from "../../AnotherProject/models/AnotherModel.room"</li>
+ <li>import my.namespace.* from "/${ROOM_MODELS}/SomeModel.room"</li>
+ </ul>
+ </p>
+ ''')
+ }
+
} \ No newline at end of file
diff --git a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/postprocessing/PostprocessorController.java b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/postprocessing/PostprocessorController.java
index c7325df85..58786cc99 100644
--- a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/postprocessing/PostprocessorController.java
+++ b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/postprocessing/PostprocessorController.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Juergen Haug
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.etmap.postprocessing;
-
-import org.eclipse.xtext.GeneratedMetamodel;
-
-public class PostprocessorController {
-
- public static void process(GeneratedMetamodel metamodel){
- new DocuPostprocessor().process(metamodel);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Juergen Haug
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.etmap.postprocessing;
+
+import org.eclipse.xtext.GeneratedMetamodel;
+
+public class PostprocessorController {
+
+ public static void process(GeneratedMetamodel metamodel){
+ new DocuPostprocessor().process(metamodel);
+ }
+}
diff --git a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/util/ETMapUtil.java b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/util/ETMapUtil.java
index 14d9c0cc4..de71714fc 100644
--- a/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/util/ETMapUtil.java
+++ b/plugins/org.eclipse.etrice.core.etmap/src/org/eclipse/etrice/core/etmap/util/ETMapUtil.java
@@ -1,249 +1,249 @@
-/*******************************************************************************
- * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * CONTRIBUTORS:
- * Henrik Rentz-Reichert (initial contribution)
- *
- *******************************************************************************/
-
-package org.eclipse.etrice.core.etmap.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map.Entry;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.etrice.core.etmap.eTMap.Mapping;
-import org.eclipse.etrice.core.etmap.eTMap.MappingModel;
-import org.eclipse.etrice.core.etmap.eTMap.SubSystemMapping;
-import org.eclipse.etrice.core.etmap.eTMap.ThreadMapping;
-import org.eclipse.etrice.core.etphys.eTPhys.ExecMode;
-import org.eclipse.etrice.core.etphys.eTPhys.NodeRef;
-import org.eclipse.etrice.core.etphys.eTPhys.PhysicalThread;
-import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.IDiagnostician;
-import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
-import org.eclipse.etrice.core.genmodel.etricegen.Root;
-import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
-import org.eclipse.etrice.core.genmodel.etricegen.SystemInstance;
-import org.eclipse.etrice.core.room.ActorInstanceMapping;
-import org.eclipse.etrice.core.room.LogicalThread;
-import org.eclipse.etrice.core.room.RefPath;
-import org.eclipse.etrice.core.room.SubSystemClass;
-
-/**
- * @author Henrik Rentz-Reichert
- *
- */
-public class ETMapUtil {
-
- @SuppressWarnings("serial")
- private static class PathToPThread extends HashMap<String, PhysicalThread> {}
-
- @SuppressWarnings("serial")
- private static class PathToNodeRef extends HashMap<String, NodeRef> {}
-
- @SuppressWarnings("serial")
- private static class LThreadToPThread extends HashMap<LogicalThread, PhysicalThread> {}
-
- @SuppressWarnings("serial")
- private static class NodeRefToSubSysInstances extends HashMap<NodeRef, List<String>> {
- void put(NodeRef nr, String path) {
- List<String> list = get(nr);
- if (list==null) {
- list = new ArrayList<String>();
- put(nr, list);
- }
- list.add(path);
- }
- }
-
- private static PathToPThread path2pthread = new PathToPThread();
- private static PathToNodeRef path2ndref = new PathToNodeRef();
- private static NodeRefToSubSysInstances ndref2ssipaths = new NodeRefToSubSysInstances();
- private static HashSet<NodeRef> noderefs = new HashSet<NodeRef>();
-
- public static Collection<NodeRef> getNodeRefs() {
- return noderefs;
- }
-
- public static List<String> getSubSystemInstancePaths(NodeRef nr) {
- return ndref2ssipaths.get(nr);
- }
-
- public static NodeRef getNodeRef(StructureInstance si) {
- String path = si.getPath();
- NodeRef nodeRef = path2ndref.get(path);
- return nodeRef;
- }
-
- public static PhysicalThread getPhysicalThread(ActorInstance ai) {
- String path = ai.getPath();
- PhysicalThread thread = path2pthread.get(path);
- return thread;
- }
-
- public static String dumpMappings() {
- StringBuilder result = new StringBuilder();
-
- ArrayList<String> keys = new ArrayList<String>(path2pthread.keySet());
- Collections.sort(keys);
-
- for (String key : keys) {
- NodeRef node = path2ndref.get(key);
- result.append("\n"+key+"\t -> "+node.getName()+":"+path2pthread.get(key).getName());
- }
-
- return result.toString();
- }
-
- public static void processModels(Root genmodel, ResourceSet rs, IDiagnostician diagnostician) {
- path2pthread.clear();
- path2ndref.clear();
- ndref2ssipaths.clear();
- noderefs.clear();
-
- for (Resource res : rs.getResources()) {
- if (!res.getContents().isEmpty()) {
- if (res.getContents().get(0) instanceof MappingModel) {
- processMappings(genmodel, (MappingModel) res.getContents().get(0));
- }
- }
- }
-
- for (Entry<String, PhysicalThread> p2t : path2pthread.entrySet()) {
- String path = p2t.getKey();
- StructureInstance si = genmodel.getInstance(path);
- if (si instanceof ActorInstance) {
- switch (((ActorInstance) si).getActorClass().getCommType()) {
- case EVENT_DRIVEN:
- if (p2t.getValue().getExecmode()==ExecMode.POLLED) {
- error(diagnostician, path, "event driven", p2t.getValue(), "polled thread");
- }
- break;
- case DATA_DRIVEN:
- if (p2t.getValue().getExecmode()==ExecMode.BLOCKED) {
- error(diagnostician, path, "data driven", p2t.getValue(), "blocked thread");
- }
- break;
- case ASYNCHRONOUS:
- if (p2t.getValue().getExecmode()==ExecMode.BLOCKED) {
- error(diagnostician, path, "asynchronous", p2t.getValue(), "blocked thread");
- }
- else if (p2t.getValue().getExecmode()==ExecMode.POLLED) {
- error(diagnostician, path, "asynchronous", p2t.getValue(), "polled thread");
- }
- break;
- case SYNCHRONOUS:
- // not implemented yet
- break;
- }
- }
- }
- }
-
- /**
- * @param diagnostician
- * @param inst
- * @param inst_comm_type
- * @param thread
- * @param thread_comm_type
- */
- private static void error(IDiagnostician diagnostician, String inst, String inst_comm_type, PhysicalThread thread, String thread_comm_type) {
- NodeRef nr = path2ndref.get(inst);
- diagnostician.error(inst_comm_type+" actor instance '"+inst+"' mapped to "
- +thread_comm_type+" '"+thread.getName()+"' of node '"+nr.getName()+"'", null, null);
- }
-
- private static void processMappings(Root genmodel, MappingModel mdl) {
- for (Mapping mp : mdl.getMappings()) {
- for (SubSystemMapping ssmp : mp.getSubsysMappings()) {
- String path = InstanceBase.pathDelim+mp.getLogicalSys().getName()
- +InstanceBase.pathDelim+ssmp.getLogicalSubSys().getName();
-
- path2ndref.put(path, ssmp.getNode());
- ndref2ssipaths.put(ssmp.getNode(), path);
- noderefs.add(ssmp.getNode());
-
- LThreadToPThread lthread2pthread = new LThreadToPThread();
- for (ThreadMapping tmp : ssmp.getThreadMappings()) {
- lthread2pthread.put(tmp.getLogicalThread(), tmp.getPhysicalThread());
- }
-
- SubSystemClass subsys = ssmp.getLogicalSubSys().getType();
- createThreadMappings(subsys.getActorInstanceMappings(), path, lthread2pthread);
- }
- }
- addImplicitMappings(genmodel);
- }
-
- private static void createThreadMappings(
- EList<ActorInstanceMapping> mappings,
- String parentPath,
- LThreadToPThread lthread2pthread) {
- for (ActorInstanceMapping aim : mappings) {
- String path = parentPath+getPath(aim.getPath());
- path2pthread.put(path, lthread2pthread.get(aim.getThread()));
-
- // recursion
- createThreadMappings(aim.getActorInstanceMappings(), path, lthread2pthread);
- }
- }
-
- private static void addImplicitMappings(Root genmodel) {
- for (SystemInstance si : genmodel.getSystemInstances()) {
- for (SubSystemInstance ssi : si.getInstances()) {
- NodeRef node = path2ndref.get(ssi.getPath());
- if (node!=null) {
- PhysicalThread dflt = getDefaultThread(node);
- addImplicitMappings(ssi, dflt, node);
- }
- }
- }
- }
-
- private static void addImplicitMappings(StructureInstance si, PhysicalThread dflt, NodeRef node) {
- for (ActorInstance ai : si.getInstances()) {
- String path = ai.getPath();
- path2ndref.put(path, node);
- PhysicalThread thread = path2pthread.get(path);
- if (thread==null) {
- thread = dflt;
- path2pthread.put(path, dflt);
- }
-
- // recursion
- addImplicitMappings(ai, thread, node);
- }
- }
-
- private static PhysicalThread getDefaultThread(NodeRef node) {
- for (PhysicalThread thread : node.getType().getThreads()) {
- if (thread.isDefault())
- return thread;
- }
- return null;
- }
-
- private static String getPath(RefPath path) {
- StringBuilder result = new StringBuilder();
-
- for (String ref : path.getRefs()) {
- result.append(InstanceBase.pathDelim+ref);
- }
-
- return result.toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2012 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.core.etmap.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.etrice.core.etmap.eTMap.Mapping;
+import org.eclipse.etrice.core.etmap.eTMap.MappingModel;
+import org.eclipse.etrice.core.etmap.eTMap.SubSystemMapping;
+import org.eclipse.etrice.core.etmap.eTMap.ThreadMapping;
+import org.eclipse.etrice.core.etphys.eTPhys.ExecMode;
+import org.eclipse.etrice.core.etphys.eTPhys.NodeRef;
+import org.eclipse.etrice.core.etphys.eTPhys.PhysicalThread;
+import org.eclipse.etrice.core.genmodel.etricegen.ActorInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.IDiagnostician;
+import org.eclipse.etrice.core.genmodel.etricegen.InstanceBase;
+import org.eclipse.etrice.core.genmodel.etricegen.Root;
+import org.eclipse.etrice.core.genmodel.etricegen.StructureInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.SubSystemInstance;
+import org.eclipse.etrice.core.genmodel.etricegen.SystemInstance;
+import org.eclipse.etrice.core.room.ActorInstanceMapping;
+import org.eclipse.etrice.core.room.LogicalThread;
+import org.eclipse.etrice.core.room.RefPath;
+import org.eclipse.etrice.core.room.SubSystemClass;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public class ETMapUtil {
+
+ @SuppressWarnings("serial")
+ private static class PathToPThread extends HashMap<String, PhysicalThread> {}
+
+ @SuppressWarnings("serial")
+ private static class PathToNodeRef extends HashMap<String, NodeRef> {}
+
+ @SuppressWarnings("serial")
+ private static class LThreadToPThread extends HashMap<LogicalThread, PhysicalThread> {}
+
+ @SuppressWarnings("serial")
+ private static class NodeRefToSubSysInstances extends HashMap<NodeRef, List<String>> {
+ void put(NodeRef nr, String path) {
+ List<String> list = get(nr);
+ if (list==null) {
+ list = new ArrayList<String>();
+ put(nr, list);
+ }
+ list.add(path);
+ }
+ }
+
+ private static PathToPThread path2pthread = new PathToPThread();
+ private static PathToNodeRef path2ndref = new PathToNodeRef();
+ private static NodeRefToSubSysInstances ndref2ssipaths = new NodeRefToSubSysInstances();
+ private static HashSet<NodeRef> noderefs = new HashSet<NodeRef>();
+
+ public static Collection<NodeRef> getNodeRefs() {
+ return noderefs;
+ }
+
+ public static List<String> getSubSystemInstancePaths(NodeRef nr) {
+ return ndref2ssipaths.get(nr);
+ }
+
+ public static NodeRef getNodeRef(StructureInstance si) {
+ String path = si.getPath();
+ NodeRef nodeRef = path2ndref.get(path);
+ return nodeRef;
+ }
+
+ public static PhysicalThread getPhysicalThread(ActorInstance ai) {
+ String path = ai.getPath();
+ PhysicalThread thread = path2pthread.get(path);
+ return thread;
+ }
+
+ public static String dumpMappings() {
+ StringBuilder result = new StringBuilder();
+
+ ArrayList<String> keys = new ArrayList<String>(path2pthread.keySet());
+ Collections.sort(keys);
+
+ for (String key : keys) {
+ NodeRef node = path2ndref.get(key);
+ result.append("\n"+key+"\t -> "+node.getName()+":"+path2pthread.get(key).getName());
+ }
+
+ return result.toString();
+ }
+
+ public static void processModels(Root genmodel, ResourceSet rs, IDiagnostician diagnostician) {
+ path2pthread.clear();
+ path2ndref.clear();
+ ndref2ssipaths.clear();
+ noderefs.clear();
+
+ for (Resource res : rs.getResources()) {
+ if (!res.getContents().isEmpty()) {
+ if (res.getContents().get(0) instanceof MappingModel) {
+ processMappings(genmodel, (MappingModel) res.getContents().get(0));
+ }
+ }
+ }
+
+ for (Entry<String, PhysicalThread> p2t : path2pthread.entrySet()) {
+ String path = p2t.getKey();
+ StructureInstance si = genmodel.getInstance(path);
+ if (si instanceof ActorInstance) {
+ switch (((ActorInstance) si).getActorClass().getCommType()) {
+ case EVENT_DRIVEN:
+ if (p2t.getValue().getExecmode()==ExecMode.POLLED) {
+ error(diagnostician, path, "event driven", p2t.getValue(), "polled thread");
+ }
+ break;
+ case DATA_DRIVEN:
+ if (p2t.getValue().getExecmode()==ExecMode.BLOCKED) {
+ error(diagnostician, path, "data driven", p2t.getValue(), "blocked thread");
+ }
+ break;
+ case ASYNCHRONOUS:
+ if (p2t.getValue().getExecmode()==ExecMode.BLOCKED) {
+ error(diagnostician, path, "asynchronous", p2t.getValue(), "blocked thread");
+ }
+ else if (p2t.getValue().getExecmode()==ExecMode.POLLED) {
+ error(diagnostician, path, "asynchronous", p2t.getValue(), "polled thread");
+ }
+ break;
+ case SYNCHRONOUS:
+ // not implemented yet
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * @param diagnostician
+ * @param inst
+ * @param inst_comm_type
+ * @param thread
+ * @param thread_comm_type
+ */
+ private static void error(IDiagnostician diagnostician, String inst, String inst_comm_type, PhysicalThread thread, String thread_comm_type) {
+ NodeRef nr = path2ndref.get(inst);
+ diagnostician.error(inst_comm_type+" actor instance '"+inst+"' mapped to "
+ +thread_comm_type+" '"+thread.getName()+"' of node '"+nr.getName()+"'", null, null);
+ }
+
+ private static void processMappings(Root genmodel, MappingModel mdl) {
+ for (Mapping mp : mdl.getMappings()) {
+ for (SubSystemMapping ssmp : mp.getSubsysMappings()) {
+ String path = InstanceBase.pathDelim+mp.getLogicalSys().getName()
+ +InstanceBase.pathDelim+ssmp.getLogicalSubSys().getName();
+
+ path2ndref.put(path, ssmp.getNode());
+ ndref2ssipaths.put(ssmp.getNode(), path);
+ noderefs.add(ssmp.getNode());
+
+ LThreadToPThread lthread2pthread = new LThreadToPThread();
+ for (ThreadMapping tmp : ssmp.getThreadMappings()) {
+ lthread2pthread.put(tmp.getLogicalThread(), tmp.getPhysicalThread());
+ }
+
+ SubSystemClass subsys = ssmp.getLogicalSubSys().getType();
+ createThreadMappings(subsys.getActorInstanceMappings(), path, lthread2pthread);
+ }
+ }
+ addImplicitMappings(genmodel);
+ }
+
+ private static void createThreadMappings(
+ EList<ActorInstanceMapping> mappings,
+ String parentPath,
+ LThreadToPThread lthread2pthread) {
+ for (ActorInstanceMapping aim : mappings) {
+ String path = parentPath+getPath(aim.getPath());
+ path2pthread.put(path, lthread2pthread.get(aim.getThread()));
+
+ // recursion
+ createThreadMappings(aim.getActorInstanceMappings(), path, lthread2pthread);
+ }
+ }
+
+ private static void addImplicitMappings(Root genmodel) {
+ for (SystemInstance si : genmodel.getSystemInstances()) {
+ for (SubSystemInstance ssi : si.getInstances()) {
+ NodeRef node = path2ndref.get(ssi.getPath());
+ if (node!=null) {
+ PhysicalThread dflt = getDefaultThread(node);
+ addImplicitMappings(ssi, dflt, node);
+ }
+ }
+ }
+ }
+
+ private static void addImplicitMappings(StructureInstance si, PhysicalThread dflt, NodeRef node) {
+ for (ActorInstance ai : si.getInstances()) {
+ String path = ai.getPath();
+ path2ndref.put(path, node);
+ PhysicalThread thread = path2pthread.get(path);
+ if (thread==null) {
+ thread = dflt;
+ path2pthread.put(path, dflt);
+ }
+
+ // recursion
+ addImplicitMappings(ai, thread, node);
+ }
+ }
+
+ private static PhysicalThread getDefaultThread(NodeRef node) {
+ for (PhysicalThread thread : node.getType().getThreads()) {
+ if (thread.isDefault())
+ return thread;
+ }
+ return null;
+ }
+
+ private static String getPath(RefPath path) {
+ StringBuilder result = new StringBuilder();
+
+ for (String ref : path.getRefs()) {
+ result.append(InstanceBase.pathDelim+ref);
+ }
+
+ return result.toString();
+ }
+
+}

Back to the top