Skip to content

Commit c560352

Browse files
committed
Better separation between Headless engine and MEP
1 parent 07a4daa commit c560352

File tree

17 files changed

+226
-144
lines changed

17 files changed

+226
-144
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
4+
<attributes>
5+
<attribute name="maven.pomderived" value="true"/>
6+
</attributes>
7+
</classpathentry>
8+
<classpathentry kind="src" path="src/main/java"/>
9+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="output" path="target/classes"/>
15+
</classpath>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>org.eclipse.gemoc.execution.sequential.javaengine.headless.mep</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.jdt.core.javabuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.ManifestBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>org.eclipse.pde.SchemaBuilder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
<buildCommand>
29+
<name>org.eclipse.m2e.core.maven2Builder</name>
30+
<arguments>
31+
</arguments>
32+
</buildCommand>
33+
</buildSpec>
34+
<natures>
35+
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
36+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
37+
<nature>org.eclipse.pde.PluginNature</nature>
38+
<nature>org.eclipse.jdt.core.javanature</nature>
39+
</natures>
40+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4+
org.eclipse.jdt.core.compiler.compliance=1.8
5+
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
6+
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
7+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
8+
org.eclipse.jdt.core.compiler.release=disabled
9+
org.eclipse.jdt.core.compiler.source=1.8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//outlet.DEFAULT_OUTPUT.sourceFolder.src/main/java.directory=xtend-gen
2+
//outlet.DEFAULT_OUTPUT.sourceFolder.src/test/java.directory=src/test/generated-sources/xtend
3+
BuilderConfiguration.is_project_specific=true
4+
eclipse.preferences.version=1
5+
outlet.DEFAULT_OUTPUT.hideLocalSyntheticVariables=true
6+
outlet.DEFAULT_OUTPUT.installDslAsPrimarySource=false
7+
outlet.DEFAULT_OUTPUT.userOutputPerSourceFolder=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source.. = src/
2+
output.. = bin/
3+
bin.includes = META-INF/,\
4+
.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<groupId>org.eclipse.gemoc.execution.sequential.javaengine</groupId>
6+
<artifactId>org.eclipse.gemoc.execution.sequential.javaengine.headless.mep</artifactId>
7+
8+
<parent>
9+
<groupId>org.eclipse.gemoc.execution.sequential.javaengine</groupId>
10+
<artifactId>org.eclipse.gemoc.execution.sequential.javaengine.pomfirst</artifactId>
11+
<version>1.0.0-SNAPSHOT</version>
12+
</parent>
13+
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
<maven.compiler.target>1.8</maven.compiler.target>
17+
<maven.compiler.source>1.8</maven.compiler.source>
18+
<xtend.version>2.19.0</xtend.version>
19+
</properties>
20+
21+
<dependencies>
22+
<dependency>
23+
<groupId>org.eclipse.gemoc.executionframework</groupId>
24+
<artifactId>org.eclipse.gemoc.executionframework.mep</artifactId>
25+
<version>1.0.0-SNAPSHOT</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.eclipse.gemoc.modeldebugging.framework.commons</groupId>
29+
<artifactId>org.eclipse.gemoc.xdsmlframework.api</artifactId>
30+
<version>4.0.0-SNAPSHOT</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>org.eclipse.gemoc.pomfirst</groupId>
34+
<artifactId>org.eclipse.gemoc.executionframework.engine</artifactId>
35+
<version>4.0.0-SNAPSHOT</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.eclipse.gemoc.execution.sequential.javaengine</groupId>
39+
<artifactId>org.eclipse.gemoc.execution.sequential.javaengine.headless</artifactId>
40+
<version>1.0.0-SNAPSHOT</version>
41+
</dependency>
42+
<dependency>
43+
<groupId>org.eclipse.gemoc.pomfirst</groupId>
44+
<artifactId>org.eclipse.gemoc.xdsmlframework.commons</artifactId>
45+
<version>4.0.0-SNAPSHOT</version>
46+
</dependency>
47+
<dependency>
48+
<groupId>org.eclipse.emf</groupId>
49+
<artifactId>org.eclipse.emf.transaction</artifactId>
50+
<version>1.9.1.201805140824</version>
51+
<scope>system</scope>
52+
<systemPath>${basedir}/lib_not_correctly_deployed/org.eclipse.emf.transaction_1.9.1.201805140824.jar</systemPath>
53+
</dependency>
54+
<dependency>
55+
<groupId>fr.inria.diverse.k3.al</groupId>
56+
<artifactId>fr.inria.diverse.k3.al.annotationprocessor</artifactId>
57+
<version>3.2.3-SNAPSHOT</version>
58+
</dependency>
59+
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
60+
<dependency>
61+
<groupId>org.slf4j</groupId>
62+
<artifactId>slf4j-api</artifactId>
63+
<version>1.7.30</version>
64+
</dependency>
65+
</dependencies>
66+
<repositories>
67+
<repository>
68+
<id>nexus-eclipse-gemoc</id>
69+
<name>Nexus Eclipse GEMOC</name>
70+
<releases>
71+
<enabled>true</enabled>
72+
</releases>
73+
<snapshots>
74+
<enabled>true</enabled>
75+
</snapshots>
76+
<url>https://repo.eclipse.org/content/groups/gemoc/</url>
77+
</repository>
78+
<repository>
79+
<id>>maven.inria.fr</id>
80+
<name>Maven Inria</name>
81+
<releases>
82+
<enabled>true</enabled>
83+
</releases>
84+
<snapshots>
85+
<enabled>true</enabled>
86+
</snapshots>
87+
<url>http://maven.inria.fr/artifactory/public/</url>
88+
</repository>
89+
</repositories>
90+
</project>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package org.eclipse.gemoc.execution.sequential.javaengine.headless;
1+
package org.eclipse.gemoc.execution.sequential.javaengine.headless.mep;
22

33
import java.io.EOFException;
44
import java.io.IOException;
@@ -11,6 +11,11 @@
1111
import java.util.concurrent.Semaphore;
1212

1313
import org.eclipse.emf.ecore.resource.Resource;
14+
import org.eclipse.gemoc.execution.sequential.javaengine.headless.AbstractHeadlessExecutionContext;
15+
import org.eclipse.gemoc.execution.sequential.javaengine.headless.HeadlessExecutionPlatform;
16+
import org.eclipse.gemoc.execution.sequential.javaengine.headless.HeadlessExecutionWorkspace;
17+
import org.eclipse.gemoc.execution.sequential.javaengine.headless.HeadlessPlainK3ExecutionEngine;
18+
import org.eclipse.gemoc.execution.sequential.javaengine.headless.StackFrame;
1419
import org.eclipse.gemoc.execution.sequential.javaengine.headless.commands.ClearBreakpointsCommand;
1520
import org.eclipse.gemoc.execution.sequential.javaengine.headless.commands.ContinueCommand;
1621
import org.eclipse.gemoc.execution.sequential.javaengine.headless.commands.DoStepCommand;
@@ -21,8 +26,10 @@
2126
import org.eclipse.gemoc.execution.sequential.javaengine.headless.commands.StopCommand;
2227
import org.eclipse.gemoc.execution.sequential.javaengine.headless.commands.StopCondition;
2328
import org.eclipse.gemoc.execution.sequential.javaengine.headless.commands.StopEvent;
29+
import org.eclipse.gemoc.execution.sequential.javaengine.headless.commands.StopReason;
2430
import org.eclipse.gemoc.execution.sequential.javaengine.headless.commands.ToggleBreakpointCommand;
2531
import org.eclipse.gemoc.executionframework.engine.commons.EngineContextException;
32+
import org.eclipse.gemoc.executionframework.engine.commons.sequential.HeadlessJavaEngineSequentialRunConfiguration;
2633
import org.eclipse.gemoc.executionframework.engine.commons.sequential.ISequentialRunConfiguration;
2734
import org.eclipse.gemoc.executionframework.mep.engine.IMEPEngine;
2835
import org.eclipse.gemoc.executionframework.mep.engine.IMEPEventListener;
@@ -102,11 +109,14 @@ public void run() {
102109
readData = gemocServerOutput.readObject();
103110
if (readData instanceof OutputEvent) {
104111
for (IMEPEventListener eventListener : mepEventListeners) {
105-
eventListener.outputReceived(new org.eclipse.gemoc.executionframework.mep.events.Output(currentEngine, ((OutputEvent) readData).output));
112+
eventListener.outputReceived(new org.eclipse.gemoc.executionframework.mep.events.Output(currentEngine,
113+
((OutputEvent) readData).output));
106114
}
107115
} else if (readData instanceof StopEvent) {
108116
for (IMEPEventListener eventListener : mepEventListeners) {
109-
eventListener.stopReceived(new org.eclipse.gemoc.executionframework.mep.events.Stopped(currentEngine, ((StopEvent) readData).stopReason));
117+
118+
eventListener.stopReceived(new org.eclipse.gemoc.executionframework.mep.events.Stopped(currentEngine,
119+
engineToMepStopReason(((StopEvent) readData).stopReason)));
110120
}
111121
} else {
112122
serverOutputBuffer.add(readData);
@@ -140,6 +150,22 @@ public void initializeResourceModel() {
140150
};
141151
}
142152

153+
private StoppedReason engineToMepStopReason(StopReason engineStopReason) {
154+
StoppedReason mepStoppedReason = null;
155+
switch (engineStopReason) {
156+
case REACHED_BREAKPOINT:
157+
mepStoppedReason = StoppedReason.REACHED_BREAKPOINT;
158+
break;
159+
case REACHED_NEXT_LOGICAL_STEP:
160+
mepStoppedReason = StoppedReason.REACHED_NEXT_LOGICAL_STEP;
161+
break;
162+
case REACHED_SIMULATION_END:
163+
mepStoppedReason = StoppedReason.REACHED_SIMULATION_END;
164+
break;
165+
}
166+
return mepStoppedReason;
167+
}
168+
143169
@Override
144170
public StoppedReason internalNext() {
145171
return internalDoStep(StepKind.NEXT);
@@ -162,7 +188,7 @@ private StoppedReason internalDoStep(StepKind stepKind) {
162188
gemocServerInput.writeObject(command);
163189
serverOutputBufferSem.acquire();
164190
Object output = serverOutputBuffer.remove(0);
165-
return (((StopCondition) output).stopReason);
191+
return engineToMepStopReason((((StopCondition) output).stopReason));
166192
} catch (IOException | InterruptedException e) {
167193
e.printStackTrace();
168194
return null;
@@ -193,6 +219,7 @@ public void internalTerminate() {
193219
gemocServerInput.writeObject(stopCommand);
194220
serverOutputBufferSem.acquire();
195221
serverOutputBuffer.remove(0);
222+
gemocServer.close();
196223
} catch (IOException | InterruptedException e) {
197224
e.printStackTrace();
198225
}

java_engine/pomfirst/org.eclipse.gemoc.execution.sequential.javaengine.headless/pom.xml

+5-6
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@
4848
<artifactId>org.eclipse.emf.mwe.utils</artifactId>
4949
<version>1.5.1</version>
5050
</dependency>
51-
<!-- warning verify version retrieved via org.eclipse.xtext.ide -->
52-
<dependency>
53-
<groupId>org.eclipse.gemoc.executionframework</groupId>
54-
<artifactId>org.eclipse.gemoc.executionframework.mep</artifactId>
55-
<version>${project.version}</version>
56-
</dependency>
5751

5852
<!-- GEMOC Java Engine dependencies -->
5953
<dependency>
@@ -125,6 +119,11 @@
125119
<artifactId>org.eclipse.gemoc.xdsmlframework.commons</artifactId>
126120
<version>4.0.0-SNAPSHOT</version>
127121
</dependency>
122+
<dependency>
123+
<groupId>org.eclipse.gemoc.pomfirst</groupId>
124+
<artifactId>org.eclipse.gemoc.executionframework.engine</artifactId>
125+
<version>4.0.0-SNAPSHOT</version>
126+
</dependency>
128127
<!-- <dependency>
129128
<groupId>org.eclipse.gemoc.trace.commons</groupId>
130129
<artifactId>org.eclipse.gemoc.trace.gemoc.api</artifactId>

0 commit comments

Comments
 (0)