Skip to content

Commit

Permalink
Example behavioral interface and implementation relationship (#251)
Browse files Browse the repository at this point in the history
* example k3fsm event project

* fix classpath and build properties

* force src folder even if empty

* fix EventK3Fsm plugin structure

* upgrade java min version

contribute to #243

* add EventK3FSM example in the deployer

* add launcher for the example model of EventK3FSM

* adapt test to new label in gemoc k3fsm example

Signed-off-by: Dorian Leroy <[email protected]>

Co-authored-by: Dorian Leroy <[email protected]>
Co-authored-by: Didier Vojtisek <[email protected]>
  • Loading branch information
d-leroy and dvojtise authored Jan 7, 2022
1 parent a20ea60 commit d9df562
Show file tree
Hide file tree
Showing 77 changed files with 675 additions and 218 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class DeployOfficialExampleK3FSM_Test extends AbstractXtextTests
val newExampleBot = bot.shell("New Example").bot
newExampleBot.tree().getTreeItem("GEMOC modeling workbench examples").select();
newExampleBot.tree().getTreeItem("GEMOC modeling workbench examples").expand();
newExampleBot.tree().getTreeItem("GEMOC modeling workbench examples").getNode("GEMOC models for K3FSM Language (Sequential)").select();
newExampleBot.tree().getTreeItem("GEMOC modeling workbench examples").getNode("GEMOC models for K3FSM and EventK3FSM languages (Sequential)").select();
newExampleBot.button("Finish").click();

IResourcesSetupUtil::reallyWaitForAutoBuild
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Require-Bundle: org.eclipse.ui,
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.gemoc.example.k3fsm.design.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-Vendor: %providerName
Import-Package: org.eclipse.gemoc.example.k3fsm
Automatic-Module-Name: org.eclipse.gemoc.example.k3fsm.design
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Bundle-ClassPath: .
Bundle-Activator: org.eclipse.gemoc.example.k3fsm.provider.K3fsmEditPlugin$Implementation
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.gemoc.example.k3fsm.provider
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.gemoc.example.k3fsm;visibility:=reexport,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Bundle-ClassPath: .
Bundle-Activator: org.eclipse.gemoc.example.k3fsm.presentation.K3fsmEditorPlugin$Implementation
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-RequiredExecutionEnvironment: JavaSE-11
Export-Package: org.eclipse.gemoc.example.k3fsm.presentation
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.core.resources;visibility:=reexport,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.gemoc.example.k3fsm.event.xdsml</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.gemoc.xdsmlframework.ide.ui.GemocLanguageProjectBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.gemoc.xdsmlframework.ide.ui.GemocLanguageProjectNature</nature>
<nature>org.eclipse.gemoc.execution.sequential.javaxdsml.ide.ui.GemocSequentialLanguageNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name = org.eclipse.gemoc.example.k3fsm.event.EventK3fsm
ecore = platform:/resource/org.eclipse.gemoc.example.k3fsm/model/k3fsm.ecore
k3 = org.eclipse.gemoc.example.k3fsm.k3dsa.FSMAspect, org.eclipse.gemoc.example.k3fsm.k3dsa.TransitionAspect, org.eclipse.gemoc.example.k3fsm.k3dsa.StateAspect, org.eclipse.gemoc.example.k3fsm.event.k3dsa.FSMAspect

xtext = /org.eclipse.gemoc.example.k3fsm.xtext/bin/org/eclipse/gemoc/example/k3fsm/K3FSM.xtext

sirius = /org.eclipse.gemoc.example.k3fsm.design/description/k3fsm.odesign

metaprog = org.eclipse.gemoc.metaprog.kermeta3

implementation_relationships = org.eclipse.gemoc.example.k3fsm.relationships.implementation_relationship
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Manifest-Version: 1.0
Automatic-Module-Name: org.eclipse.gemoc.example.k3fsm.event.xdsml
Bundle-SymbolicName: org.eclipse.gemoc.example.k3fsm.event.xdsml; singleton:=true
Bundle-Name: org.eclipse.gemoc.example.k3fsm.event.xdsml
Bundle-Version: 1.0.0
Bundle-ClassPath: .
Require-Bundle: org.eclipse.xtend.lib;bundle-version="2.7.0";visibility:="private",
org.eclipse.xtext.xbase.lib;bundle-version="2.7.0";visibility:="private",
com.google.guava;bundle-version="0.0.0";visibility:="private",
org.eclipse.emf.ecore.xmi;bundle-version="2.8.0";visibility:="reexport",
org.eclipse.emf.ecore;bundle-version="2.8.0";visibility:="reexport",
org.eclipse.emf.common;bundle-version="2.8.0";visibility:="reexport",
fr.inria.diverse.melange;bundle-version="0.1.0";visibility:="reexport",
fr.inria.diverse.melange.lib;bundle-version="0.1.0";visibility:="reexport",
fr.inria.diverse.melange.resource;bundle-version="0.1.0";visibility:="reexport",
fr.inria.diverse.melange.adapters;bundle-version="0.1.0";visibility:="reexport",
fr.inria.diverse.k3.al.annotationprocessor.plugin;bundle-version="0.0.0";visibility:="reexport",
org.eclipse.gemoc.xdsmlframework.api;bundle-version="4.0.0";visibility:="reexport",
org.eclipse.gemoc.executionframework.engine;bundle-version="4.0.0";visibility:="reexport",
org.eclipse.gemoc.executionframework.extensions.sirius;bundle-version="0.0.0";visibility:=reexport,
org.eclipse.gemoc.example.k3fsm;bundle-version="0.0.0";visibility:="reexport",
org.eclipse.gemoc.example.k3fsm.k3dsa;bundle-version="1.0.0",
org.eclipse.gemoc.example.k3fsm.event;bundle-version="1.0.0"
Bundle-ManifestVersion: 2
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source.. = src/,\
src-gen/
bin.includes = plugin.xml,\
META-INF/,\
EventK3fsm.dsl,\
.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension point="org.eclipse.gemoc.gemoc_language_workbench.xdsml">
<XDSML_Definition name="org.eclipse.gemoc.example.k3fsm.event.EventK3fsm" xdsmlFilePath="/org.eclipse.gemoc.example.k3fsm.event.xdsml/EventK3fsm.dsl" modelLoader_class="org.eclipse.gemoc.executionframework.extensions.sirius.modelloader.DefaultModelLoader" />
</extension>
</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="xtend-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.gemoc.example.k3fsm.event</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BehavioralInterface K3Fsm

accepted event appendString :
parameters = [fsm:org.eclipse.gemoc.example.k3fsm.FSM, string:java.lang.String]

exposed event transitionFired :
parameters = [_self:org.eclipse.gemoc.example.k3fsm.Transition]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: K3FSM Behavioral Interface
Bundle-SymbolicName: org.eclipse.gemoc.example.k3fsm.event;singleton:=true
Bundle-Version: 1.0.0.qualifier
Automatic-Module-Name: org.eclipse.gemoc.example.k3fsm.event
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: fr.inria.diverse.k3.al.annotationprocessor.plugin;bundle-version="3.3.0",
org.eclipse.gemoc.executionframework.event.manager,
org.eclipse.gemoc.executionframework.behavioralinterface;bundle-version="1.0.0",
org.eclipse.gemoc.executionframework.event.model;bundle-version="4.0.0",
com.google.guava,
org.eclipse.xtext.xbase.lib,
org.eclipse.xtend.lib,
org.eclipse.xtend.lib.macro,
org.eclipse.gemoc.example.k3fsm;bundle-version="0.1.0"
Export-Package: org.eclipse.gemoc.example.k3fsm.event.k3dsa
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.gemoc.executionframework.event.implementationrelationship">
<implementation_relationship
class="org.eclipse.gemoc.example.k3fsm.event.K3FsmImplementationRelationship"
id="org.eclipse.gemoc.example.k3fsm.relationships.implementation_relationship"
name="K3Fsm Implementation Relationship">
</implementation_relationship>
</extension>

</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.eclipse.gemoc.example.k3fsm.event;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.eclipse.gemoc.executionframework.behavioralinterface.behavioralInterface.BehavioralInterface;
import org.eclipse.gemoc.executionframework.event.manager.IImplementationRelationship;
import org.eclipse.gemoc.executionframework.event.manager.SimpleImplementationRelationship;

public class K3FsmImplementationRelationship extends SimpleImplementationRelationship {

private static Map<String, String> computeEventToMethodMap() {
final Map<String, String> result = new HashMap<>();
result.put("appendString", "org.eclipse.gemoc.example.k3fsm.event.k3dsa.FSMAspect.appendStringToProcess");
result.put("transitionFired", "org.eclipse.gemoc.example.k3fsm.Transition.fire");
return result;
}

public K3FsmImplementationRelationship() {
this(IImplementationRelationship.loadBehavioralInterface("platform:/plugin/org.eclipse.gemoc.example.k3fsm.event/K3Fsm.bi"));
}

public K3FsmImplementationRelationship(BehavioralInterface behavioralInterface) {
super(behavioralInterface, Collections.emptySet(), computeEventToMethodMap(), "org.eclipse.gemoc.metaprog.kermeta3");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package org.eclipse.gemoc.example.k3fsm.event.k3dsa

import fr.inria.diverse.k3.al.annotationprocessor.Aspect
import fr.inria.diverse.k3.al.annotationprocessor.Step
import org.eclipse.gemoc.example.k3fsm.FSM

@Aspect(className=FSM)
class FSMAspect {
@Step
def void appendStringToProcess(String arg) {
val s = _self.unprocessedString
_self.unprocessedString = s + arg
}
}


Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="xtend-gen"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Require-Bundle: fr.inria.diverse.k3.al.annotationprocessor.plugin;bundle-version
org.eclipse.emf.common;bundle-version="2.8.0";visibility:="reexport",
org.eclipse.gemoc.example.k3fsm;bundle-version="0.0.0";visibility:=private
Bundle-ManifestVersion: 2
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-RequiredExecutionEnvironment: JavaSE-11
Loading

0 comments on commit d9df562

Please sign in to comment.