Upgraded to Moka latest
- Added SUML Feature and plugins (0.1.0)
- FMI and Parametrics are out of the build until refactor
- FMI and Parametrics out of the P2, added SUML
Change-Id: I1d799250926a1d21ad5d6367a26b91359ae8d308
Signed-off-by: David Lopez <david.lopez@cea.fr>
diff --git a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmi.master/META-INF/MANIFEST.MF b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmi.master/META-INF/MANIFEST.MF
index 77bdb61..ce364aa 100644
--- a/bundles/fmi/engines/org.eclipse.papyrus.moka.fmi.master/META-INF/MANIFEST.MF
+++ b/bundles/fmi/engines/org.eclipse.papyrus.moka.fmi.master/META-INF/MANIFEST.MF
@@ -9,7 +9,6 @@
com.github.jnr.jffi;bundle-version="[1.2.15,1.3.0)",
com.github.jnr.ffi;bundle-version="[2.1.4,3.0.0)",
org.eclipse.core.runtime;bundle-version="[3.14.0,4.0.0)",
- org.eclipse.papyrus.moka;bundle-version="4.0.0",
org.eclipse.papyrus.moka.fmi;bundle-version="0.7.0",
org.eclipse.papyrus.moka.fmi.profile;bundle-version="0.7.0",
org.eclipse.papyrus.moka.fuml;bundle-version="4.0.0",
diff --git a/bundles/fmi/pom.xml b/bundles/fmi/pom.xml
index 2ac1ccf..273ce49 100644
--- a/bundles/fmi/pom.xml
+++ b/bundles/fmi/pom.xml
@@ -22,7 +22,7 @@
<module>language</module>
<module>tools</module>
<module>ui</module>
- <module>org.eclipse.papyrus.moka.fmi.ease</module>
+ <!--<module>org.eclipse.papyrus.moka.fmi.ease</module> -->
<module>products</module>
</modules>
diff --git a/bundles/pom.xml b/bundles/pom.xml
index ae344af..ed4878c 100644
--- a/bundles/pom.xml
+++ b/bundles/pom.xml
@@ -20,11 +20,12 @@
<modules>
<module>annotations</module>
<module>instancespecification</module>
- <module>parametric</module>
- <module>scripting</module>
+ <!-- <module>parametric</module> -->
+ <!-- <module>scripting</module> -->
<module>simex</module>
+ <module>suml</module>
<module>visualization</module>
- <module>fmi</module>
+ <!-- <module>fmi</module> -->
</modules>
</project>
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.classpath b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.classpath
new file mode 100644
index 0000000..eca7bdb
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.classpath
@@ -0,0 +1,7 @@
+<?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.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.gitignore b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/META-INF/MANIFEST.MF b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..6d24f41
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.papyrus.moka.engine.suml.ease
+Bundle-SymbolicName: org.eclipse.papyrus.moka.engine.suml.ease
+Bundle-Version: 0.1.0.qualifier
+Automatic-Module-Name: org.eclipse.papyrus.moka.engine.suml.ease
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.papyrus.moka.engine.suml;visibility:=reexport,
+ org.eclipse.emf.common;bundle-version="2.16.0",
+ org.eclipse.ease;bundle-version="0.7.0";visibility:=reexport
+Export-Package: org.eclipse.papyrus.moka.engine.suml.ease
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/build.properties b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/pom.xml b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/pom.xml
new file mode 100644
index 0000000..49889a4
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/pom.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus.moka.incubation</groupId>
+ <artifactId>org.eclipse.papyrus.moka.engine.suml.root</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.papyrus.moka.engine.suml.ease</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>org.eclipse.papyrus.moka.engine.suml.ease</name>
+
+</project>
\ No newline at end of file
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/src/org/eclipse/papyrus/moka/engine/suml/ease/EASEBodyScriptConstants.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/src/org/eclipse/papyrus/moka/engine/suml/ease/EASEBodyScriptConstants.java
new file mode 100644
index 0000000..daa20a5
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/src/org/eclipse/papyrus/moka/engine/suml/ease/EASEBodyScriptConstants.java
@@ -0,0 +1,18 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.ease;
+
+public interface EASEBodyScriptConstants {
+ public static final String SCRIPT_FUNCTION_NAME = "run";
+ public static final String SCRIPT_FUNCTION_PARAM_NAME = "block";
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/src/org/eclipse/papyrus/moka/engine/suml/ease/EASEBodyScriptFactory.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/src/org/eclipse/papyrus/moka/engine/suml/ease/EASEBodyScriptFactory.java
new file mode 100644
index 0000000..d3a48b9
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.ease/src/org/eclipse/papyrus/moka/engine/suml/ease/EASEBodyScriptFactory.java
@@ -0,0 +1,88 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.ease;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.eclipse.ease.AbstractScriptEngine;
+import org.eclipse.ease.IReplEngine;
+import org.eclipse.ease.Script;
+import org.eclipse.ease.service.EngineDescription;
+import org.eclipse.ease.service.IScriptService;
+import org.eclipse.ease.service.ScriptService;
+import org.eclipse.papyrus.moka.engine.suml.script.IBodyScriptFactory;
+
+public abstract class EASEBodyScriptFactory implements IBodyScriptFactory{
+ private String languageId;
+ private IReplEngine engine;
+ protected URI modelURI;
+
+ public EASEBodyScriptFactory(String languageId) {
+ this.languageId = languageId;
+ }
+
+ public IReplEngine getEngine() {
+ if( engine == null || engine.isFinished() ) {
+ engine = createEngine();
+ startEngine(engine);
+ }
+
+ return engine;
+ }
+
+ abstract protected URL getBootstrap();
+
+ protected IReplEngine createEngine() {
+ final IScriptService scriptService = ScriptService.getService();
+ EngineDescription ed = scriptService.getEngineByID(languageId);
+ IReplEngine eng = (IReplEngine) ed.createEngine();
+
+ if( eng instanceof AbstractScriptEngine ) {
+ ((AbstractScriptEngine)eng).setExecutionRootFile(this.modelURI);
+ }
+
+ return eng;
+ }
+
+ protected void startEngine(IReplEngine engine) {
+ engine.setTerminateOnIdle(false);
+ engine.schedule();
+
+ URL bootstrapEntry = getBootstrap();
+ if( bootstrapEntry != null )
+ runBootstrap(engine, bootstrapEntry);
+
+ }
+
+ protected void runBootstrap(IReplEngine engine, URL bootstrapEntry) {
+ Script script = new Script("EASEBootstrapScript", bootstrapEntry, false);
+
+ try {
+ engine.executeSync(script);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void configure(URI modelURI) {
+ this.modelURI = modelURI;
+ }
+
+ @Override
+ public void terminate() {
+ getEngine().terminate();
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/.classpath b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/.classpath
new file mode 100644
index 0000000..c34bb53
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/.classpath
@@ -0,0 +1,11 @@
+<?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">
+ <attributes>
+ <attribute name="module" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/.gitignore b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/META-INF/MANIFEST.MF b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..b33872d
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/META-INF/MANIFEST.MF
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.papyrus.moka.engine.suml.python
+Bundle-SymbolicName: org.eclipse.papyrus.moka.engine.suml.python;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Automatic-Module-Name: org.eclipse.papyrus.moka.engine.suml.python
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.debug.core,
+ org.eclipse.papyrus.moka.engine.suml.ease,
+ org.jython;bundle-version="2.7.0"
+Bundle-ClassPath: .
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/build.properties b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/plugin.xml b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/plugin.xml
new file mode 100644
index 0000000..eed473a
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/plugin.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.moka.engine.suml.bodyScriptFactory">
+ <factory
+ class="org.eclipse.papyrus.moka.engine.suml.python.PythonBodyScriptFactory"
+ description="Python body script factory"
+ language="Python">
+ </factory>
+ </extension>
+</plugin>
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/pom.xml b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/pom.xml
new file mode 100644
index 0000000..9df2347
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/pom.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus.moka.incubation</groupId>
+ <artifactId>org.eclipse.papyrus.moka.engine.suml.root</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.papyrus.moka.engine.suml.python</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>org.eclipse.papyrus.moka.engine.suml.python</name>
+
+</project>
\ No newline at end of file
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/scripts/Bootstrap.py b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/scripts/Bootstrap.py
new file mode 100644
index 0000000..facc74d
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/scripts/Bootstrap.py
@@ -0,0 +1,158 @@
+import sys
+import traceback
+import py4j
+from py4j.java_collections import ListConverter
+
+def isJython():
+ return hasattr(sys, 'subversion') and (sys.subversion[0]== 'Jython')
+
+
+class ReflectiveModule(object):
+ def __init__(self, realModule):
+ self.realModule = realModule;
+
+ def __getattr__( self, name ):
+ def wrappedMethod(*args):
+ unwrappedArgs = [ unwrap(e) for e in args ]
+ result = getattr(self.realModule, name)(*unwrappedArgs)
+ return wrap(result);
+
+ return wrappedMethod;
+
+class PythonListWrapper:
+ def __init__(self, list):
+ self.list = list;
+ self.i = 0;
+ self.n = list.size();
+
+ def __getitem__(self, key):
+ obj = self.list[key];
+ return wrap(self.list[key]);
+
+ def __setitem__(self, key, val):
+ self.list[key] = val;
+
+ def __iter__(self):
+ return self;
+
+ def __len__(self):
+ return self.n;
+
+ def __next__(self):
+ if self.i < self.n:
+ i = self.i
+ self.i += 1
+ return wrap(self.list[i]);
+ else:
+ raise StopIteration()
+
+ def unwrap(self):
+ return self.list;
+
+ next = __next__ # Alias for Python 2
+
+def getListClass():
+ if isJython() :
+ #return org.eclipse.papyrus.moka.parametric.semantics.proxy.ValueListProxy
+ return org.eclipse.papyrus.moka.engine.suml.accessor.structures.ListAccess
+ else:
+ return py4j.java_collections.JavaList
+
+
+def getMapClass():
+ if isJython() :
+ #return org.eclipse.papyrus.moka.parametric.semantics.proxy.MapProxy
+ return org.eclipse.papyrus.moka.engine.suml.accessor.structures.MapAccess
+ else:
+ return py4j.java_collections.JavaMap
+
+def isOperation(value):
+ if not (isinstance(value, py4j.java_gateway.JavaObject)) :
+ return False;
+ return value.getClass().getName() == "org.eclipse.papyrus.moka.engine.suml.accessor.structures.OperationAccess";
+
+class PythonOperationWrapper:
+ def __init__(self, opAccess) :
+ self.opAccess = opAccess;
+
+ def __call__(self, *arg ):
+ return self.opAccess.call(arg);
+
+class PythonWrapper:
+ def __init__(self, obj):
+ self.__dict__["obj"] = obj;
+
+ def __getattr__(self, name):
+ if name in self.__dict__ :
+ return self.__dict__[name];
+
+ if name.startswith('_') :
+ if name[1:] in self.__dict__ :
+ return self.__dict__[name[1:]];
+
+ return wrap(self.__dict__["obj"][name[1:]])
+
+ if name in self.__dict__["obj"] :
+ return wrap(self.__dict__["obj"][name]);
+
+ raise ValueError( "'" + name + "' not found in " + str(self) );
+
+ def __setattr__(self, name, value):
+ if name in self.__dict__ :
+ self.__dict__[name] = value;
+ return;
+
+ if name.startswith('_') :
+ self.__dict__["obj"][name[1:]] = unwrap(value);
+ return;
+
+ if name in self.__dict__["obj"]:
+ self.__dict__["obj"][name] = unwrap(value);
+ return;
+
+ self.__dict__[name] = value;
+
+ def __getitem__(self, key):
+ return wrap(self.__dict__["obj"].valueAt(key));
+
+ def __str__(self):
+ return self.__dict__["obj"].toString()
+
+ def unwrap(self):
+ return self.__dict__["obj"]
+
+def unwrap(obj):
+ if isinstance(obj, PythonWrapper):
+ return obj.unwrap();
+
+ if isinstance(obj, PythonListWrapper):
+ return obj.unwrap();
+
+ if isinstance(obj, list ) :
+ return ListConverter().convert( [ unwrap(e) for e in obj ], gateway._gateway_client)
+
+ return obj;
+
+
+
+def wrap(value):
+ if ( value == None ) :
+ return value;
+
+ #Already wrapped
+ if isinstance(value, PythonWrapper):
+ return value;
+
+
+ if isinstance(value, getListClass()):
+ return PythonListWrapper(value);
+
+ if isinstance(value, getMapClass()):
+ return PythonWrapper(value);
+
+ if isOperation(value):
+ return PythonOperationWrapper(value);
+
+ return value;
+
+#print("Python Bootstrap executed.")
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/ease/parametric/python/PythonBehaviorFunctionInfo.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/ease/parametric/python/PythonBehaviorFunctionInfo.java
new file mode 100644
index 0000000..409dc91
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/ease/parametric/python/PythonBehaviorFunctionInfo.java
@@ -0,0 +1,126 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.ease.parametric.python;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PythonBehaviorFunctionInfo {
+
+ public static class PythonAccess{
+ private String name;
+ private int line;
+ private int column;
+ private boolean read;
+
+ public PythonAccess(String name, int line, int column, boolean read) {
+ super();
+ this.name = name;
+ this.line = line;
+ this.column = column;
+ this.read = read;
+ }
+
+ public String getName() {
+ return name;
+ }
+ public int getLine() {
+ return line;
+ }
+ public int getColumn() {
+ return column;
+ }
+
+ public boolean isRead() {
+ return read;
+ }
+ }
+
+ public static class PythonError{
+ private Throwable error;
+ private int line;
+ private int column;
+
+ public PythonError(Throwable error, int line, int column) {
+ super();
+ this.error = error;
+ this.line = line;
+ this.column = column;
+ }
+ public Throwable getError() {
+ return error;
+ }
+ public int getLine() {
+ return line;
+ }
+ public int getColumn() {
+ return column;
+ }
+ public String getFirstErrorLine() {
+ if( this.error == null )
+ return null;
+
+ String msg = this.error.getMessage();
+ int index = msg.indexOf('\n');
+ if( index > 0 )
+ return msg.substring(0, index);
+
+ return msg;
+ }
+ }
+
+ private String name;
+ private int codeLineDefinition;
+ private String blockParamName;
+ private List<PythonAccess> paramAccesses;
+ private PythonError parserError;
+
+ public PythonBehaviorFunctionInfo() {
+ paramAccesses = new ArrayList<>();
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getBlockParamName() {
+ return blockParamName;
+ }
+ public void setBlockParamName(String blockParamName) {
+ this.blockParamName = blockParamName;
+ }
+ public List<PythonAccess> getParamAccesses() {
+ return paramAccesses;
+ }
+
+ public int getCodeLineDefinition() {
+ return codeLineDefinition;
+ }
+ public void setCodeLineDefinition(int codeLineDefinition) {
+ this.codeLineDefinition = codeLineDefinition;
+ }
+
+ public PythonError getParserError() {
+ return parserError;
+ }
+ public void setParserError(PythonError parserError) {
+ this.parserError = parserError;
+ }
+ @Override
+ public String toString() {
+ return "PythonOpaqueBehaviorFunction [name=" + name + ", blockParamName=" + blockParamName + ", paramsAccessed="
+ + paramAccesses + "]";
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/engine/suml/python/PythonBodyScriptCodeGen.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/engine/suml/python/PythonBodyScriptCodeGen.java
new file mode 100644
index 0000000..2cc365f
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/engine/suml/python/PythonBodyScriptCodeGen.java
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.python;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+
+import org.eclipse.papyrus.moka.engine.suml.script.gen.CodeGenHelper;
+
+public class PythonBodyScriptCodeGen {
+
+ protected static final String SPLIT_KEYWORD = "%%%%%%SPLIT%%%%%%";
+
+ public static String generateInterface(String className, String body) {
+
+ String scriptBody = new String(body);
+
+ scriptBody = CodeGenHelper.clearTabs(scriptBody);
+ scriptBody = scriptBody.replaceAll("(?m)^def.*run.*", SPLIT_KEYWORD+"\n");
+
+ BufferedReader lineReader = new BufferedReader(new StringReader(scriptBody));
+ StringBuilder bodyBuilder = new StringBuilder();
+
+
+ String bodyLine;
+ try {
+ bodyLine = lineReader.readLine()+'\n';
+
+ while (bodyLine != null && !bodyLine.startsWith((SPLIT_KEYWORD))){
+ bodyBuilder.append(bodyLine).append('\n');
+ bodyLine = lineReader.readLine();
+ }
+
+ bodyBuilder.append("class "+className+"(object):\n");
+ bodyBuilder.append(CodeGenHelper.getTab(1)+"def run(self, ctx):");
+
+ while ((bodyLine = lineReader.readLine())!= null) {
+ bodyBuilder.append(CodeGenHelper.getTab(1)+bodyLine+"\n");
+ }
+ bodyBuilder.append(CodeGenHelper.getTab(1)+"def evaluate(self, jctx):\n");
+ bodyBuilder.append(CodeGenHelper.getTab(2)+"ctx = wrap(jctx);\n");
+ bodyBuilder.append(CodeGenHelper.getTab(2)+"ctx.locus = ReflectiveModule(jctx[\"jlocus\"]);\n");
+ bodyBuilder.append(CodeGenHelper.getTab(2)+"return unwrap(self.run(ctx));\n");
+
+ bodyBuilder.append(CodeGenHelper.getTab(1)+"class Java:\n");
+ bodyBuilder.append(CodeGenHelper.getTab(2)+"implements = ['org.eclipse.papyrus.moka.engine.suml.script.IBodyScript']\n");
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return bodyBuilder.toString();
+ }
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/engine/suml/python/PythonBodyScriptFactory.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/engine/suml/python/PythonBodyScriptFactory.java
new file mode 100644
index 0000000..573b836
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/engine/suml/python/PythonBodyScriptFactory.java
@@ -0,0 +1,54 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.python;
+
+import java.net.URL;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.ease.IReplEngine;
+import org.eclipse.ease.Script;
+import org.eclipse.papyrus.moka.engine.suml.ease.EASEBodyScriptFactory;
+import org.eclipse.papyrus.moka.engine.suml.script.IBodyScript;
+import org.osgi.framework.Bundle;
+
+public class PythonBodyScriptFactory extends EASEBodyScriptFactory {
+
+ private static final String PY4J_LANG_ID = "org.eclipse.ease.lang.python.py4j.engine";
+ //JYTHON_LANG_ID = "org.eclipse.ease.python.jython";
+
+ public PythonBodyScriptFactory() {
+ super(PY4J_LANG_ID);
+ }
+
+ @Override
+ protected IReplEngine createEngine() {
+ IReplEngine engine = super.createEngine();
+ return new PythonBridgeEngine(engine);
+ }
+
+ @Override
+ protected URL getBootstrap() {
+ Bundle bundle = Platform.getBundle("org.eclipse.papyrus.moka.engine.suml.python");
+ return bundle.getEntry("scripts/Bootstrap.py");
+ }
+
+ @Override
+ public IBodyScript buildScript(Object ctx, String body) {
+ String className = "MOKA_SUML_IBodyScript";
+ String scriptBody = PythonBodyScriptCodeGen.generateInterface(className, body);
+ PythonBridgeEngine engine = (PythonBridgeEngine) getEngine();
+ engine.inject(new Script(scriptBody));
+ return engine.instanceScriptObject(className);
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/engine/suml/python/PythonBridgeEngine.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/engine/suml/python/PythonBridgeEngine.java
new file mode 100644
index 0000000..9ef15fe
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/engine/suml/python/PythonBridgeEngine.java
@@ -0,0 +1,212 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.python;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.ease.IExecutionListener;
+import org.eclipse.ease.IReplEngine;
+import org.eclipse.ease.ISecurityCheck;
+import org.eclipse.ease.ISecurityCheck.ActionType;
+import org.eclipse.ease.Script;
+import org.eclipse.ease.ScriptObjectType;
+import org.eclipse.ease.ScriptResult;
+import org.eclipse.ease.debugging.model.EaseDebugVariable;
+import org.eclipse.ease.service.EngineDescription;
+
+public class PythonBridgeEngine implements IReplEngine {
+
+ private static final String BRIDGE_OBJECT = "___bridge_python_ease___";
+ private IReplEngine pythonEngine;
+ private PythonObjectBridge<Object> bridgeObject = new PythonObjectBridge<Object>();
+
+
+ public PythonBridgeEngine(IReplEngine pythonEngine) {
+ this.pythonEngine = pythonEngine;
+ }
+
+ private void injectBridge() {
+ this.pythonEngine.setVariable(BRIDGE_OBJECT, bridgeObject);
+ }
+
+ public <T> T evalWithResult(String snippet) {
+
+ String scriptBody = BRIDGE_OBJECT + ".push(" + snippet + ");";
+ pythonEngine.inject(new Script(scriptBody));
+ return (T) this.bridgeObject.pull();
+ }
+
+ public <T> T instanceScriptObject(String className) {
+ return evalWithResult(className + "()");
+ }
+
+ public void setTerminateOnIdle(boolean terminate) {
+ pythonEngine.setTerminateOnIdle(terminate);
+ }
+
+ public boolean getTerminateOnIdle() {
+ return pythonEngine.getTerminateOnIdle();
+ }
+
+ public Collection<EaseDebugVariable> getDefinedVariables() {
+ return pythonEngine.getDefinedVariables();
+ }
+
+ public ScriptObjectType getType(Object object) {
+ return pythonEngine.getType(object);
+ }
+
+ public ScriptResult executeAsync(Object content) {
+ return pythonEngine.executeAsync(content);
+ }
+
+ public String toString(Object object) {
+ return pythonEngine.toString(object);
+ }
+
+ public EaseDebugVariable getLastExecutionResult() {
+ return pythonEngine.getLastExecutionResult();
+ }
+
+ public ScriptResult executeSync(Object content) throws InterruptedException {
+ return pythonEngine.executeSync(content);
+ }
+
+ public Object inject(Object content) {
+ return pythonEngine.inject(content);
+ }
+
+ public Object injectUI(Object content) {
+ return pythonEngine.injectUI(content);
+ }
+
+ public Object getExecutedFile() {
+ return pythonEngine.getExecutedFile();
+ }
+
+ public void setOutputStream(OutputStream outputStream) {
+ pythonEngine.setOutputStream(outputStream);
+ }
+
+ public void setErrorStream(OutputStream errorStream) {
+ pythonEngine.setErrorStream(errorStream);
+ }
+
+ public void setInputStream(InputStream inputStream) {
+ pythonEngine.setInputStream(inputStream);
+ }
+
+ public PrintStream getOutputStream() {
+ return pythonEngine.getOutputStream();
+ }
+
+ public PrintStream getErrorStream() {
+ return pythonEngine.getErrorStream();
+ }
+
+ public InputStream getInputStream() {
+ return pythonEngine.getInputStream();
+ }
+
+ public void setCloseStreamsOnTerminate(boolean closeStreams) {
+ pythonEngine.setCloseStreamsOnTerminate(closeStreams);
+ }
+
+ public void schedule() {
+ pythonEngine.schedule();
+ injectBridge();
+ }
+
+ public void terminate() {
+ pythonEngine.terminate();
+ }
+
+ public void terminateCurrent() {
+ pythonEngine.terminateCurrent();
+ }
+
+ public void addExecutionListener(IExecutionListener listener) {
+ pythonEngine.addExecutionListener(listener);
+ }
+
+ public void removeExecutionListener(IExecutionListener listener) {
+ pythonEngine.removeExecutionListener(listener);
+ }
+
+ public String getName() {
+ return pythonEngine.getName();
+ }
+
+ public void setVariable(String name, Object content) {
+ pythonEngine.setVariable(name, content);
+ }
+
+ public Object getVariable(String name) {
+ return pythonEngine.getVariable(name);
+ }
+
+ public boolean hasVariable(String name) {
+ return pythonEngine.hasVariable(name);
+ }
+
+ public EngineDescription getDescription() {
+ return pythonEngine.getDescription();
+ }
+
+ public Map<String, Object> getVariables() {
+ return pythonEngine.getVariables();
+ }
+
+ public void registerJar(URL url) {
+ pythonEngine.registerJar(url);
+ }
+
+
+ public boolean isFinished() {
+ return pythonEngine.isFinished();
+ }
+
+ public void addSecurityCheck(ActionType type, ISecurityCheck check) {
+ pythonEngine.addSecurityCheck(type, check);
+ }
+
+ public void removeSecurityCheck(ISecurityCheck check) {
+ pythonEngine.removeSecurityCheck(check);
+ }
+
+ public ILaunch getLaunch() {
+ return pythonEngine.getLaunch();
+ }
+
+ public IProgressMonitor getMonitor() {
+ return pythonEngine.getMonitor();
+ }
+
+ @Override
+ public void join(long timeout) throws InterruptedException {
+ pythonEngine.join(timeout);
+
+ }
+
+ @Override
+ public boolean isIdle() {
+ return pythonEngine.isIdle();
+ }
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/engine/suml/python/PythonObjectBridge.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/engine/suml/python/PythonObjectBridge.java
new file mode 100644
index 0000000..c41d7a9
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml.python/src/org/eclipse/papyrus/moka/engine/suml/python/PythonObjectBridge.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.python;
+
+public class PythonObjectBridge<T> {
+ private T object;
+
+ public T pull() {
+ return object;
+ }
+
+ public void push(T object) {
+ this.object = object;
+ }
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.classpath b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.classpath
new file mode 100644
index 0000000..eca7bdb
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.classpath
@@ -0,0 +1,7 @@
+<?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.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.gitignore b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.gitignore
new file mode 100644
index 0000000..ae3c172
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/META-INF/MANIFEST.MF b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..66c1d15
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/META-INF/MANIFEST.MF
@@ -0,0 +1,36 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.papyrus.moka.engine.suml
+Bundle-SymbolicName: org.eclipse.papyrus.moka.engine.suml;singleton:=true
+Bundle-Version: 0.1.0.qualifier
+Automatic-Module-Name: org.eclipse.papyrus.moka.engine.suml
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.papyrus.moka.kernel,
+ org.eclipse.debug.core;bundle-version="[3.13.0,4.0.0)",
+ org.eclipse.equinox.registry;bundle-version="[3.8.100,4.0.0)",
+ org.eclipse.papyrus.moka.fuml.interfaces,
+ org.eclipse.papyrus.moka.fuml,
+ org.eclipse.papyrus.moka.pscs,
+ org.eclipse.papyrus.moka.pssm,
+ org.eclipse.emf.ecore;bundle-version="[2.15.0,3.0.0)",
+ org.eclipse.uml2.uml;bundle-version="[5.4.0,6.0.0)",
+ org.eclipse.papyrus.moka.utils,
+ org.eclipse.papyrus.moka.engine.uml.scheduling,
+ org.eclipse.papyrus.moka.kernel.debug,
+ org.eclipse.papyrus.moka.engine.uml.debug,
+ org.eclipse.papyrus.moka.kernel.scheduling,
+ org.eclipse.papyrus.moka.engine.uml;bundle-version="4.0.0",
+ org.eclipse.papyrus.moka.engine.uml.animation,
+ org.eclipse.papyrus.moka.kernel.animation;bundle-version="4.0.0",
+ org.eclipse.papyrus.moka.engine.uml.time;bundle-version="[4.0.0,5.0.0)",
+ org.eclipse.papyrus.moka.engine.uml.time.scheduling;bundle-version="[4.0.0,5.0.0)"
+Export-Package: org.eclipse.papyrus.moka.engine.suml,
+ org.eclipse.papyrus.moka.engine.suml.accessor,
+ org.eclipse.papyrus.moka.engine.suml.accessor.locus,
+ org.eclipse.papyrus.moka.engine.suml.accessor.structures,
+ org.eclipse.papyrus.moka.engine.suml.accessor.uml,
+ org.eclipse.papyrus.moka.engine.suml.actions,
+ org.eclipse.papyrus.moka.engine.suml.loci,
+ org.eclipse.papyrus.moka.engine.suml.opaquebehaviors,
+ org.eclipse.papyrus.moka.engine.suml.script,
+ org.eclipse.papyrus.moka.engine.suml.script.gen
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/build.properties b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/build.properties
new file mode 100644
index 0000000..e9863e2
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/plugin.xml b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/plugin.xml
new file mode 100644
index 0000000..dc90984
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/plugin.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="bodyScriptFactory" name="bodyScriptFactory" schema="schema/bodyScriptFactory.exsd"/>
+ <extension
+ point="org.eclipse.papyrus.moka.kernel.engine">
+ <engine
+ class="org.eclipse.papyrus.moka.engine.suml.SUMLExecutionEngine"
+ description="Scripting UML Execution Engine"
+ id="org.eclipse.papyrus.moka.engine.suml">
+ </engine>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.moka.kernel.service">
+ <service
+ class="org.eclipse.papyrus.moka.engine.suml.SUMLAnimationService"
+ description="SUMLAnimation service">
+ <context
+ engineID="org.eclipse.papyrus.moka.engine.suml">
+ </context>
+ </service>
+ </extension>
+<extension
+ point="org.eclipse.papyrus.moka.kernel.service">
+ <service
+ class="org.eclipse.papyrus.moka.engine.suml.SUMLDebugService"
+ description="SUMLDebug service">
+ <context
+ engineID="org.eclipse.papyrus.moka.engine.suml">
+ </context>
+
+ </service>
+ </extension>
+</plugin>
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/pom.xml b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/pom.xml
new file mode 100644
index 0000000..c195296
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/pom.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus.moka.incubation</groupId>
+ <artifactId>org.eclipse.papyrus.moka.engine.suml.root</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.eclipse.papyrus.moka.engine.suml</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <name>org.eclipse.papyrus.moka.engine.suml</name>
+
+</project>
\ No newline at end of file
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/schema/bodyScriptFactory.exsd b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/schema/bodyScriptFactory.exsd
new file mode 100644
index 0000000..a2b5d76
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/schema/bodyScriptFactory.exsd
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.moka.engine.suml" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.papyrus.moka.engine.suml" id="bodyScriptFactory" name="bodyScriptFactory"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ <documentation>
+ Contributing to this extension point enables to register a new body script factory, that is able to provide Body Scripts for a particular language.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="factory"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="factory">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.moka.engine.suml.script.IBodyScriptFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="language" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/BodyScriptFactoryRegistry.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/BodyScriptFactoryRegistry.java
new file mode 100644
index 0000000..c00a58b
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/BodyScriptFactoryRegistry.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.papyrus.moka.engine.suml.script.IBodyScriptFactory;
+
+public class BodyScriptFactoryRegistry {
+
+ //Extension points
+ public static String MOKA_BODYSCRIPTFACTORY_EXT_POINT = "org.eclipse.papyrus.moka.engine.suml.bodyScriptFactory" ; //$NON-NLS-1$
+
+ private Map<String, IBodyScriptFactory> registry;
+
+ private void loadBodyScriptFactories() {
+ registry = new HashMap<String, IBodyScriptFactory>();
+
+ IExtensionRegistry extRegistry = Platform.getExtensionRegistry();
+ IConfigurationElement[] config = extRegistry.getConfigurationElementsFor(MOKA_BODYSCRIPTFACTORY_EXT_POINT);
+ try {
+ for( IConfigurationElement element : config ) {
+ String lang = element.getAttribute("language");//$NON-NLS-1$
+ IBodyScriptFactory factory = (IBodyScriptFactory) element.createExecutableExtension("class");//$NON-NLS-1$
+ registry.put(lang, factory);
+ }
+ } catch (CoreException ex) {
+ ex.printStackTrace();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ private BodyScriptFactoryRegistry() {
+ loadBodyScriptFactories();
+ }
+
+ private static BodyScriptFactoryRegistry instance = null;
+
+ public static BodyScriptFactoryRegistry getInstance() {
+ if( instance == null )
+ instance = new BodyScriptFactoryRegistry();
+
+ return instance;
+ }
+
+ public boolean isSupported(String language) {
+ return registry.containsKey(language);
+ }
+
+ public IBodyScriptFactory getBodyScriptFactoryFor(String language) {
+ return registry.get(language);
+ }
+
+ public void terminateEngines() {
+ for( IBodyScriptFactory factory : registry.values() )
+ factory.terminate();
+ }
+
+ public Set<String> getRegisteredLanguages(){
+ return registry.keySet();
+ }
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLAnimationService.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLAnimationService.java
new file mode 100644
index 0000000..6c9ac40
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLAnimationService.java
@@ -0,0 +1,18 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/package org.eclipse.papyrus.moka.engine.suml;
+
+import org.eclipse.papyrus.moka.engine.uml.animation.service.UMLAnimationService;
+
+public class SUMLAnimationService extends UMLAnimationService {
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLDebugService.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLDebugService.java
new file mode 100644
index 0000000..b6bd399
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLDebugService.java
@@ -0,0 +1,19 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml;
+
+import org.eclipse.papyrus.moka.engine.uml.debug.service.UMLDebugService;
+
+public class SUMLDebugService extends UMLDebugService {
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLExecutionEngine.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLExecutionEngine.java
new file mode 100644
index 0000000..628f22f
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/SUMLExecutionEngine.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.papyrus.moka.engine.suml.accessor.AccessAdapterRegistry;
+import org.eclipse.papyrus.moka.engine.suml.accessor.locus.FeatureValueAdapter;
+import org.eclipse.papyrus.moka.engine.suml.accessor.locus.IValueConverter;
+import org.eclipse.papyrus.moka.engine.suml.accessor.locus.ParameterValueAdapter;
+import org.eclipse.papyrus.moka.engine.suml.loci.SUML_ExecutionFactory;
+import org.eclipse.papyrus.moka.engine.suml.opaquebehaviors.SUMLScriptExecutionFactory;
+import org.eclipse.papyrus.moka.engine.uml.UMLExecutionEngine;
+import org.eclipse.papyrus.moka.fuml.loci.ILocus;
+import org.eclipse.papyrus.moka.kernel.engine.EngineConfiguration;
+import org.eclipse.papyrus.moka.pscs.loci.CS_Executor;
+import org.eclipse.papyrus.moka.pssm.loci.SM_Locus;
+
+public class SUMLExecutionEngine extends UMLExecutionEngine {
+
+ @Override
+ public ILocus createLocus() {
+ ILocus locus = new SM_Locus();
+ locus.setExecutor(new CS_Executor());
+ locus.setFactory(new SUML_ExecutionFactory());
+ return locus;
+ }
+
+ @Override
+ public void init(EngineConfiguration configuration, SubMonitor monitor) {
+ super.init(configuration, monitor);
+
+ //Register the used component/value type
+ AccessAdapterRegistry.getInstance().registerAdapter(ParameterValueAdapter.class);
+ AccessAdapterRegistry.getInstance().registerAdapter(FeatureValueAdapter.class);
+ AccessAdapterRegistry.getInstance().registerConverter(IValueConverter.class);
+
+ ScriptExecutionFactoryRegistry.getInstance().setFactory(new SUMLScriptExecutionFactory());
+
+ BodyScriptFactoryRegistry registry = BodyScriptFactoryRegistry.getInstance();
+
+ URI modelURI = null;
+ try {
+ modelURI = new URI(configuration.getModelURI().toString());
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+
+ //Init factories
+ for( String k : registry.getRegisteredLanguages())
+ registry.getBodyScriptFactoryFor(k).configure(modelURI);
+
+ }
+
+
+
+ @Override
+ public void run(EngineConfiguration configuration, SubMonitor monitor) {
+ try {
+ super.run(configuration, monitor);
+ }catch( Exception e) {
+ this.dispose(monitor);
+ throw e;
+ }
+ }
+
+ @Override
+ protected void dispose(SubMonitor monitor) {
+ super.dispose(monitor);
+ BodyScriptFactoryRegistry.getInstance().terminateEngines();
+ }
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/ScriptExecutionFactory.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/ScriptExecutionFactory.java
new file mode 100644
index 0000000..3984036
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/ScriptExecutionFactory.java
@@ -0,0 +1,19 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml;
+
+import org.eclipse.papyrus.moka.engine.suml.opaquebehaviors.ScriptExecution;
+
+public interface ScriptExecutionFactory {
+ public ScriptExecution newScriptExecution();
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/ScriptExecutionFactoryRegistry.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/ScriptExecutionFactoryRegistry.java
new file mode 100644
index 0000000..431980c
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/ScriptExecutionFactoryRegistry.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml;
+
+public class ScriptExecutionFactoryRegistry {
+
+ private static ScriptExecutionFactoryRegistry instance = new ScriptExecutionFactoryRegistry();
+
+ private ScriptExecutionFactory factory;
+
+ private ScriptExecutionFactoryRegistry() {
+
+ }
+
+ public static ScriptExecutionFactoryRegistry getInstance() {
+ return instance;
+ }
+
+ /**
+ * @return the factory
+ */
+ public ScriptExecutionFactory getFactory() {
+ return factory;
+ }
+
+ /**
+ * @param factory
+ * the factory to set
+ */
+ public void setFactory(ScriptExecutionFactory factory) {
+ this.factory = factory;
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/AccessAdapterRegistry.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/AccessAdapterRegistry.java
new file mode 100644
index 0000000..d4f0e18
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/AccessAdapterRegistry.java
@@ -0,0 +1,106 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.papyrus.moka.engine.suml.opaquebehaviors.LocusAdapter;
+
+public class AccessAdapterRegistry {
+
+ private AccessAdapterRegistry() {
+ }
+
+ private static AccessAdapterRegistry instance = new AccessAdapterRegistry();
+
+ public static AccessAdapterRegistry getInstance() {
+ return instance;
+ }
+
+ private ComponentAccessor accessor = new ComponentAccessor();
+ private HashMap<Class, ComponentAdapter> adapters = new HashMap<Class, ComponentAdapter>();
+ private HashMap<Class, ValueTypeConverter> converters = new HashMap<Class, ValueTypeConverter>();
+
+ private LocusAdapter locusAdapter = new LocusAdapter();
+
+ public ComponentAccessor getComponentAccessor() {
+ return accessor;
+ }
+
+ private <T> T instance(Class<T> class_) {
+ try {
+ //This is Deprecated in Java 9+, and replaced for:
+ //class_.getDeclaredConstructor().newInstance();
+ return class_.newInstance();
+ } catch (InstantiationException | IllegalAccessException e) {
+ return null;
+ }
+ }
+
+ public void registerAdapter(Class<? extends ComponentAdapter> adapterClass) {
+ ComponentAdapter adapter = instance(adapterClass);
+ adapters.put(adapter.getAdaptedClass(), adapter);
+ }
+
+ public void registerConverter(Class<? extends ValueTypeConverter> converterClass) {
+ ValueTypeConverter converter = instance(converterClass);
+ converters.put(converter.getValueTypeClass(), converter);
+ }
+
+ private Object findAssignableFor(Class class_, Map map) {
+ Object adapter = map.get(class_);
+
+ if( adapter != null )
+ return adapter;
+
+ for( Object o : map.entrySet() ) {
+ Entry e = (Entry)o;
+ if( ( (Class)e.getKey() ).isAssignableFrom(class_) )
+ return e.getValue();
+ }
+ return null;//Not found at all
+ }
+
+ private Object accessOrCreate(Class class_, Map map) {
+ Object obj = findAssignableFor(class_, map);
+ if( obj == null ) {
+ obj = instance(class_);
+ map.put(class_, obj);
+ }
+ return obj;
+ }
+
+ public ComponentAdapter getAdapterForObject(Object obj) {
+ ComponentAdapter adapter = (ComponentAdapter) findAssignableFor(obj.getClass(), adapters);
+ return adapter;
+ }
+
+ public <T extends ComponentAdapter> T getAdapterForClass(Class<T> class_) {
+ return (T) accessOrCreate(class_, adapters);
+ }
+
+ public ValueTypeConverter getConverterForValue(Object obj) {
+ ValueTypeConverter converter = (ValueTypeConverter) findAssignableFor(obj.getClass(), converters);
+ return converter;
+ }
+
+ public <T extends ValueTypeConverter> T getConverterForClass(Class class_) {
+ return (T) accessOrCreate(class_, converters);
+ }
+
+ public LocusAdapter getLocusAdapter() {
+ return locusAdapter;
+ }
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/ComponentAccessor.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/ComponentAccessor.java
new file mode 100644
index 0000000..1f61eee
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/ComponentAccessor.java
@@ -0,0 +1,223 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.papyrus.moka.engine.suml.accessor.structures.ListAccess;
+import org.eclipse.papyrus.moka.engine.suml.accessor.structures.MapAccess;
+import org.eclipse.papyrus.moka.engine.suml.accessor.structures.OperationAccess;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IStructuredValue;
+import org.eclipse.uml2.uml.MultiplicityElement;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.TypedElement;
+
+
+//ComponentType -> IFeatureValue, Slot, ParameterValue
+//ValueType -> IValue, ValueSpecification
+//They are usually contained in another ValueType
+//InstanceSpecification { Slot* }
+//IStructuredValue { IFeatureValue* }
+
+public class ComponentAccessor<ComponentType, ValueType> {
+
+ public Object componentValueToScript(ComponentType component) {
+ if( component == null )
+ return null;
+
+ if( this.getDescriptor(component).isMultivalued() )
+ return new ListAccess<ComponentType, ValueType>(this, component);
+
+ return componentValueIndexToScript(component, 0);
+ }
+
+ /** If the component is multivalued will return a ListAccess
+ * If the component is structured will return a MapAccess
+ * If the component is univalued will return a Raw value (Double, Integer ...)
+ * @param component
+ * @return
+ */
+ public Object componentValueIndexToScript(ComponentType component, int valueIndex) {
+
+ List<ValueType> values = getValues(component);
+
+ if( values.isEmpty() )
+ return null;
+
+ ValueType value = (ValueType) values.get(valueIndex);
+ return valueToScript(value);
+ }
+
+ public Object valueToScript(ValueType value) {
+ if( value == null )
+ return null;
+
+ ValueTypeConverter<ValueType> converter = converter(value);
+ if( converter.isComposite(value) )
+ return new MapAccess<ComponentType, ValueType>(this, value, destructure(value), getOperations(value) );
+
+ return converter.getRawValue(value);
+ }
+
+ public Object valueListToScript(List<ValueType> values) {
+ if( values.size() == 0 )
+ return Void.TYPE;
+
+ if( values.size() == 1 )
+ return valueToScript(values.get(0));
+
+ List<Object> objs = new ArrayList<Object>(values.size());
+ for( ValueType v : values )
+ objs.add( valueToScript(v) );
+
+ return objs;
+ }
+
+ private Map<String, OperationAccess> getOperations(ValueType value){
+ HashMap<String, OperationAccess> map = new HashMap<String, OperationAccess>();
+
+ if( value instanceof IStructuredValue ) {
+ IStructuredValue structuredValue = (IStructuredValue)value;
+ List<Operation> ops = structuredValue.getTypes().get(0).getAllOperations();
+ for( Operation o : ops ) {
+ map.put(o.getName(), new OperationAccess(value, o));
+ }
+
+ }
+
+ return map;
+ }
+
+ protected Map<String, ComponentType> destructure(ValueType value) {
+ ValueTypeConverter<ValueType> converter = converter(value);
+ List<ComponentType> parts = converter.getComponents(value);
+
+ HashMap<String, ComponentType> map = new HashMap<String, ComponentType>();
+
+ for( ComponentType part : parts)
+ map.put(getDescriptor(part).getName(), part);
+
+
+ return map;
+ }
+
+ public void setValueFromScript(ComponentType component, Object obj) {
+ if( getDescriptor(component).isMultivalued() ) {
+ setListValue(component, obj);
+ return;
+ }
+
+ setSingleValue(component, obj);
+ }
+
+ private void setSingleValue(ComponentType component, Object obj) {
+ List<ValueType> values = getValues(component);
+
+ if( values.isEmpty() ) {
+ if( obj != null )
+ values.add(newValue( component, obj ));
+ return;
+ }
+
+ setValueFromScriptAt(component, 0, obj);
+ }
+
+ private ValueType newValue(ComponentType component, Object obj) {
+
+ ValueTypeConverter<ValueType> converter = converterForComponent(component);
+
+ if( converter.isValueType(obj) )
+ return (ValueType) obj;
+
+ Type type = getDescriptor(component).getType();
+
+ if( !converter.isPrimitive(type) ) {
+ if( !(obj instanceof MapAccess) )
+ throw new RuntimeException("Value ["+ obj + "] can't be assigned to type: " + type );
+
+ MapAccess map = (MapAccess)obj;
+ return (ValueType) map.unwrap();
+ }
+
+ return converter.newPrimitiveValue( type, obj);
+ }
+
+ public void setValueFromScriptAt(ComponentType component, int index, Object obj) {
+ List<ValueType> values = getValues(component);
+
+ if( obj == null ) {
+ values.set(index, null);
+ return;
+ }
+
+ ValueTypeConverter<ValueType> converter = converterForComponent(component);
+ if( converter.isValueType(obj) ) {
+ values.set(index, (ValueType)obj);
+ return;
+ }
+
+ ValueType value = values.get(index);
+ if( value == null ) {
+ value = newValue(component, obj);
+ values.set(index, value);
+ return;
+ }
+
+ converter(value).setRawValue(values.get(index), obj);
+ }
+
+ private void setListValue(ComponentType component, Object obj ) {
+ List<ValueType> values = getValues(component);
+
+ if( !(obj instanceof List) )
+ throw new RuntimeException("Operation not supported for this object");
+
+ //This operation should replace the whole list
+ values.clear();
+
+ //Has to create new values
+ for( Object item : (List<Object>)obj )
+ values.add( newValue( component, item) );
+ }
+
+ public boolean addValueFromScript(ComponentType component, Object obj) {
+ List<ValueType> values = getValues(component);
+ return values.add( newValue( component, obj) );
+ }
+
+ private boolean isComposite(ComponentType component) {
+ return converterForComponent(component).isPrimitive( getDescriptor(component).getType() );
+ }
+
+ private ValueTypeConverter<ValueType> converter(ValueType value){
+ return AccessAdapterRegistry.getInstance().getConverterForValue(value);
+ }
+
+ private ValueTypeConverter<ValueType> converterForComponent(ComponentType component){
+ ComponentAdapter adapter = AccessAdapterRegistry.getInstance().getAdapterForObject(component);
+ return AccessAdapterRegistry.getInstance().getConverterForClass(adapter.getValueType());
+ }
+
+ public <ValueType> List<ValueType> getValues(ComponentType component){
+ return AccessAdapterRegistry.getInstance().getAdapterForObject(component).getValues(component);
+ }
+
+ public <DescriptorType extends MultiplicityElement & TypedElement> DescriptorType getDescriptor(ComponentType component) {
+ return (DescriptorType) AccessAdapterRegistry.getInstance().getAdapterForObject(component).getDescriptor(component);
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/ComponentAdapter.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/ComponentAdapter.java
new file mode 100644
index 0000000..3065b10
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/ComponentAdapter.java
@@ -0,0 +1,31 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor;
+
+import java.util.List;
+
+import org.eclipse.uml2.uml.MultiplicityElement;
+import org.eclipse.uml2.uml.TypedElement;
+
+public interface ComponentAdapter<ComponentType, ValueType> {
+
+ public List<ValueType> getValues(ComponentType element);
+
+ public <DescriptorType extends MultiplicityElement & TypedElement> DescriptorType getDescriptor(ComponentType component);
+
+ public Class<ComponentType> getAdaptedClass();
+
+ public Class<ValueType> getValueType();
+
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/IndexableMapAccess.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/IndexableMapAccess.java
new file mode 100644
index 0000000..2e4e354
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/IndexableMapAccess.java
@@ -0,0 +1,19 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor;
+
+import java.util.Map;
+
+public interface IndexableMapAccess<K, V> extends Map<K, V>{
+ public V valueAt(int index);
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/ValueTypeConverter.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/ValueTypeConverter.java
new file mode 100644
index 0000000..646c362
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/ValueTypeConverter.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor;
+
+import java.util.List;
+
+import org.eclipse.uml2.uml.Type;
+
+public interface ValueTypeConverter<ValueType> {
+
+ public abstract boolean isComposite(ValueType value);
+
+ public abstract <T> List<T> getComponents(ValueType value);
+
+ public abstract Object getRawValue(ValueType value);
+
+ public abstract void setRawValue(ValueType value, Object obj);
+
+ public abstract boolean isValueType(Object obj);
+
+ public abstract ValueType newPrimitiveValue(Type type, Object obj);
+
+ public abstract ValueType newValue(Object obj);
+
+ public abstract boolean isPrimitive(Type type);
+
+ public abstract Class<ValueType> getValueTypeClass();
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/ValueTypeWrapper.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/ValueTypeWrapper.java
new file mode 100644
index 0000000..b835dc4
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/ValueTypeWrapper.java
@@ -0,0 +1,17 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor;
+
+public interface ValueTypeWrapper<ValueType> {
+ public ValueType unwrap();
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/locus/FeatureValueAdapter.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/locus/FeatureValueAdapter.java
new file mode 100644
index 0000000..ac86e5d
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/locus/FeatureValueAdapter.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor.locus;
+
+import java.util.List;
+
+import org.eclipse.papyrus.moka.engine.suml.accessor.ComponentAdapter;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IFeatureValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IValue;
+import org.eclipse.uml2.uml.StructuralFeature;
+
+public class FeatureValueAdapter implements ComponentAdapter<IFeatureValue, IValue> {
+ @Override
+ public List<IValue> getValues(IFeatureValue element) {
+ return element.getValues();
+ }
+
+ @Override
+ public StructuralFeature getDescriptor(IFeatureValue component) {
+ return component.getFeature();
+ }
+
+
+ @Override
+ public Class<IFeatureValue> getAdaptedClass() {
+ return IFeatureValue.class;
+ }
+
+
+ @Override
+ public Class<IValue> getValueType() {
+ return IValue.class;
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/locus/IValueConverter.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/locus/IValueConverter.java
new file mode 100644
index 0000000..74da855
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/locus/IValueConverter.java
@@ -0,0 +1,206 @@
+package org.eclipse.papyrus.moka.engine.suml.accessor.locus;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.papyrus.moka.engine.suml.accessor.ValueTypeConverter;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.BooleanValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IBooleanValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IEnumerationValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IIntegerValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IRealValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IStringValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IStructuredValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IUnlimitedNaturalValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IntegerValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.PrimitiveValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.RealValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.StringValue;
+import org.eclipse.uml2.uml.PrimitiveType;
+import org.eclipse.uml2.uml.Type;
+
+public class IValueConverter implements ValueTypeConverter<IValue>{
+
+ @Override
+ public Object getRawValue(IValue value) {
+
+ if (value == null)
+ return null;
+
+ if( value instanceof IBooleanValue )
+ return ((IBooleanValue)value).getValue();
+
+ if( value instanceof IIntegerValue )
+ return ((IIntegerValue)value).getValue();
+
+ if( value instanceof IRealValue )
+ return ((IRealValue)value).getValue();
+
+ if( value instanceof IStringValue )
+ return ((IStringValue)value).getValue();
+
+ if( value instanceof IUnlimitedNaturalValue)
+ return ((IUnlimitedNaturalValue)value).getValue();
+
+ if( value instanceof IEnumerationValue )
+ return value;
+
+ //Not supported,
+ throw new RuntimeException("Proxies for " + value.getClass() + " are not supported yet.");
+ }
+
+
+ @Override
+ public boolean isComposite(IValue value) {
+ return value instanceof IStructuredValue;
+ }
+
+ @Override
+ public <T> List<T> getComponents(IValue val) {
+ if( val instanceof IStructuredValue )
+ return (List<T>) ((IStructuredValue)val).getFeatureValues();
+
+ return null;
+ }
+
+ @Override
+ public IValue newValue(Object obj) {
+ if( obj == null )
+ return null;
+
+ if( obj instanceof List ) {
+ throw new RuntimeException("Lists are supported yet");
+ }
+
+ if( obj instanceof Map ) {
+ throw new RuntimeException("Maps are supported yet");
+ }
+
+
+ if( obj instanceof Integer ) {
+ IntegerValue v = new IntegerValue();
+ v.setValue((Integer)obj);
+ return v;
+ }
+
+ if( obj instanceof Double ) {
+ RealValue v = new RealValue();
+ v.setValue((Double)obj);
+ return v;
+ }
+
+ if( obj instanceof Boolean ) {
+ BooleanValue v = new BooleanValue();
+ v.setValue((Boolean)obj);
+ return v;
+ }
+
+ if( obj instanceof String ) {
+ StringValue v = new StringValue();
+ v.setValue((String)obj);
+ return v;
+ }
+
+ throw new RuntimeException(obj + " can't be transformed to an IValue.");
+ }
+
+ private PrimitiveValue primitiveFromType(Type type, Object obj) {
+ switch( type.getName() ) {
+ case "Real":
+ RealValue r = new RealValue();
+
+ if ( !(obj instanceof Number ) )
+ throw new RuntimeException("Can't assign " + obj + " to type " + type);
+
+ r.setValue( ((Number)obj).doubleValue() );
+
+ return r;
+ case "Integer":
+ IntegerValue i = new IntegerValue();
+
+ if ( !(obj instanceof Number ) )
+ throw new RuntimeException("Can't assign " + obj + " to type " + type);
+
+ i.setValue( ((Number)obj).intValue() );
+
+ return i;
+ case "Boolean":
+ BooleanValue b = new BooleanValue();
+
+ if ( !(obj instanceof Boolean ) )
+ throw new RuntimeException("Can't assign " + obj + " to type " + type);
+
+ b.setValue((Boolean)obj);
+
+ return b;
+ case "String":
+ StringValue s = new StringValue();
+ s.setValue(String.valueOf(obj));
+ return s;
+ default:
+ //Not supported primitive?
+ return null;
+ }
+ }
+
+ @Override
+ public IValue newPrimitiveValue(Type type, Object obj) {
+
+ if( obj == null )
+ return null;
+
+ if (! isPrimitive(type) )
+ return null;
+
+
+ PrimitiveValue value = primitiveFromType(type, obj);
+ value.setType((PrimitiveType) type);
+ return value;
+ }
+
+ @Override
+ public boolean isValueType(Object obj) {
+ return obj instanceof IValue;
+ }
+
+
+ @Override
+ public void setRawValue(IValue value, Object obj) {
+ Type type = value.getTypes().get(0);
+ if (! isPrimitive(type) )
+ throw new RuntimeException("Couldn't assign " + obj + " to type: " + type);
+
+ switch( type.getName() ) {
+ case "Real":
+ Number nr = (Number)obj;
+ ( (RealValue) value) .setValue( nr.doubleValue() );
+ break;
+ case "Integer":
+ Number ni = (Number)obj;
+ ( (IntegerValue) value) .setValue( ni.intValue() );
+ break;
+ case "Boolean":
+ ( (BooleanValue) value) .setValue( (Boolean) obj );
+ break;
+ case "String":
+ ( (StringValue) value) .setValue( (String) obj );
+ break;
+ default:
+ throw new RuntimeException("Not supported type: " + type);
+ }
+
+ }
+
+
+ @Override
+ public boolean isPrimitive(Type type) {
+ return (type instanceof PrimitiveType);
+ }
+
+ @Override
+ public Class<IValue> getValueTypeClass() {
+ return IValue.class;
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/locus/ParameterValueAdapter.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/locus/ParameterValueAdapter.java
new file mode 100644
index 0000000..ebf6295
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/locus/ParameterValueAdapter.java
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor.locus;
+
+import java.util.List;
+
+import org.eclipse.papyrus.moka.engine.suml.accessor.ComponentAdapter;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.IParameterValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IValue;
+import org.eclipse.uml2.uml.Parameter;
+
+public class ParameterValueAdapter implements ComponentAdapter<IParameterValue, IValue> {
+ @Override
+ public List<IValue> getValues(IParameterValue element) {
+ return element.getValues();
+ }
+
+ @Override
+ public Parameter getDescriptor(IParameterValue element) {
+ return element.getParameter();
+ }
+
+ @Override
+ public Class<IParameterValue> getAdaptedClass() {
+ return IParameterValue.class;
+ }
+
+ @Override
+ public Class<IValue> getValueType() {
+ return IValue.class;
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/structures/ArrayIndexableMapAccess.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/structures/ArrayIndexableMapAccess.java
new file mode 100644
index 0000000..33eef0b
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/structures/ArrayIndexableMapAccess.java
@@ -0,0 +1,98 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor.structures;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.papyrus.moka.engine.suml.accessor.IndexableMapAccess;
+
+public class ArrayIndexableMapAccess<K, V> implements IndexableMapAccess<K, V> {
+ private Map<K, V> map;
+ private ArrayList<V> list;
+
+ public ArrayIndexableMapAccess() {
+ map = new HashMap<K, V>();
+ list = new ArrayList<V>();
+ }
+
+ public void clear() {
+ map.clear();
+ list.clear();
+ }
+
+ public boolean containsKey(Object key) {
+ return map.containsKey(key);
+ }
+
+ public boolean containsValue(Object value) {
+ return map.containsValue(value);
+ }
+
+ public Set<Entry<K, V>> entrySet() {
+ return map.entrySet();
+ }
+
+ public boolean equals(Object o) {
+ return map.equals(o);
+ }
+
+ public V get(Object key) {
+ return map.get(key);
+ }
+
+ public int hashCode() {
+ return map.hashCode();
+ }
+
+ public boolean isEmpty() {
+ return map.isEmpty();
+ }
+
+ public Set<K> keySet() {
+ return map.keySet();
+ }
+
+ public V put(K key, V value) {
+ list.add(value);
+ return map.put(key, value);
+ }
+
+ public void putAll(Map<? extends K, ? extends V> m) {
+ list.addAll(m.values());
+ map.putAll(m);
+ }
+
+ public V remove(Object key) {
+ V value = map.remove(key);
+ list.remove(value);
+ return value;
+ }
+
+ public int size() {
+ return map.size();
+ }
+
+ public Collection<V> values() {
+ return map.values();
+ }
+
+ @Override
+ public V valueAt(int index) {
+ return list.get(index);
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/structures/ListAccess.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/structures/ListAccess.java
new file mode 100644
index 0000000..009c749
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/structures/ListAccess.java
@@ -0,0 +1,151 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor.structures;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.papyrus.moka.engine.suml.accessor.ComponentAccessor;
+
+public class ListAccess<ComponentType, ValueType> implements List<Object>{
+
+ private ComponentAccessor<ComponentType, ValueType> adapter;
+ private ComponentType component;
+
+ public ListAccess(ComponentAccessor<ComponentType, ValueType> adapter, ComponentType component) {
+ this.adapter = adapter;
+ this.component = component;
+ }
+
+ @Override
+ public boolean add(Object e) {
+ return adapter.addValueFromScript(component, e);
+ }
+
+ @Override
+ public void add(int index, Object e) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends Object> c) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public boolean addAll(int index, Collection<? extends Object> c) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public void clear() {
+ adapter.getValues(component).clear();
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public boolean containsAll(Collection<?> c) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public Object get(int index) {
+ return adapter.componentValueIndexToScript( component, index );
+ }
+
+ @Override
+ public int indexOf(Object o) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return adapter.getValues(component).isEmpty();
+ }
+
+ @Override
+ public Iterator<Object> iterator() {
+ return null; //There's a special object to create
+ }
+
+ @Override
+ public int lastIndexOf(Object o) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public ListIterator<Object> listIterator() {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public ListIterator<Object> listIterator(int index) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public Object remove(int index) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> c) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public boolean retainAll(Collection<?> c) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ /**
+ * Supposes there's a value at index. If not an exception will be raised
+ */
+ public Object set(int index, Object obj) {
+ adapter.setValueFromScriptAt(component, index, obj);
+ return null;
+ }
+
+ @Override
+ public int size() {
+ return adapter.getValues(component).size();
+ }
+
+ @Override
+ public List<Object> subList(int fromIndex, int toIndex) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public Object[] toArray() {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public <T> T[] toArray(T[] a) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/structures/MapAccess.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/structures/MapAccess.java
new file mode 100644
index 0000000..a7bf9df
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/structures/MapAccess.java
@@ -0,0 +1,141 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor.structures;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.papyrus.moka.engine.suml.accessor.ComponentAccessor;
+import org.eclipse.papyrus.moka.engine.suml.accessor.ValueTypeWrapper;
+
+public class MapAccess<ComponentType, ValueType> implements Map<String, Object>, ValueTypeWrapper<ValueType>{
+ private Map<String, ComponentType> components;
+ private Map<String, OperationAccess> operations;
+ private ComponentAccessor<ComponentType, ValueType> adapter;
+
+ private ValueType value;
+
+ public MapAccess(ComponentAccessor<ComponentType, ValueType> adapter, ValueType value, Map<String, ComponentType> components) {
+ this.components = components;
+ this.adapter = adapter;
+ this.value = value;
+ this.operations = new HashMap<String, OperationAccess>();
+ }
+
+ public MapAccess(ComponentAccessor<ComponentType, ValueType> adapter, ValueType value, Map<String, ComponentType> components, Map<String, OperationAccess> operations) {
+ this.components = components;
+ this.adapter = adapter;
+ this.value = value;
+ this.operations = operations;
+ }
+
+ @Override
+ public void clear() {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public boolean containsKey(Object arg0) {
+ return components.containsKey((String)arg0) || this.operations.containsKey((String)arg0) ;
+ }
+
+ @Override
+ public boolean containsValue(Object arg0) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public Set<Entry<String, Object>> entrySet() {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public Object get(Object arg0) {
+ if( this.components.containsKey(arg0) )
+ //Returns a ValueType as Raw
+ return adapter.componentValueToScript(components.get((String) arg0));
+
+ if( this.operations.containsKey(arg0) )
+ return this.operations.get(arg0);
+
+ throw new RuntimeException(arg0 + " property not found in MapAccess.");
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return components.isEmpty();
+ }
+
+ @Override
+ public Set<String> keySet() {
+ Set<String> keys = new HashSet<String>();
+ keys.addAll(components.keySet());
+ keys.addAll(operations.keySet());
+ return keys;
+ }
+
+ @Override
+ public Object put(String key, Object object) {
+ Object old = get(key);
+ adapter.setValueFromScript(components.get((String)key), object);
+ return old;
+ }
+
+ @Override
+ public void putAll(Map<? extends String, ? extends Object> arg0) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public Object remove(Object arg0) {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public int size() {
+ return components.size();
+ }
+
+ @Override
+ public Collection<Object> values() {
+ throw new RuntimeException("Operation not supported for this object");
+ }
+
+ @Override
+ public ValueType unwrap() {
+ return value;
+ }
+
+ @Override
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("MapAccess: {");
+ for ( String k : components.keySet() )
+ buf.append(k).append(":").append(get(k)).append(", ");
+
+ buf.append("}");
+ return buf.toString();
+ }
+
+ public boolean hasOperation(String operation) {
+ return operations.containsKey(operation);
+ }
+
+ public OperationAccess getOperationAccess(String operation) {
+ return operations.get(operation);
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/structures/OperationAccess.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/structures/OperationAccess.java
new file mode 100644
index 0000000..d1d01ef
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/structures/OperationAccess.java
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor.structures;
+
+import java.util.List;
+
+import org.eclipse.papyrus.moka.engine.suml.accessor.AccessAdapterRegistry;
+import org.eclipse.papyrus.moka.fuml.structuredclassifiers.IReference;
+import org.eclipse.uml2.uml.Operation;
+
+public class OperationAccess<ValueType> {
+ private Operation op;
+ private ValueType target;
+
+ public OperationAccess(ValueType target, Operation op) {
+ super();
+ this.op = op;
+ this.target = target;
+ }
+
+ public Object call(List<Object> params) {
+ Object ret = AccessAdapterRegistry.getInstance().getLocusAdapter().callOperation(op, (IReference)target, params);
+ return ret;
+ }
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/uml/SlotAdapter.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/uml/SlotAdapter.java
new file mode 100644
index 0000000..2a8872a
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/uml/SlotAdapter.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor.uml;
+
+import java.util.List;
+
+import org.eclipse.papyrus.moka.engine.suml.accessor.ComponentAdapter;
+import org.eclipse.uml2.uml.Slot;
+import org.eclipse.uml2.uml.StructuralFeature;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+public class SlotAdapter implements ComponentAdapter<Slot, ValueSpecification> {
+
+ @Override
+ public List<ValueSpecification> getValues(Slot element) {
+ return element.getValues();
+ }
+
+ @Override
+ public StructuralFeature getDescriptor(Slot component) {
+ return component.getDefiningFeature();
+ }
+
+ @Override
+ public Class<Slot> getAdaptedClass() {
+ return Slot.class;
+ }
+
+ @Override
+ public Class<ValueSpecification> getValueType() {
+ return ValueSpecification.class;
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/uml/ValueSpecificationConverter.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/uml/ValueSpecificationConverter.java
new file mode 100644
index 0000000..ed7a919
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/accessor/uml/ValueSpecificationConverter.java
@@ -0,0 +1,133 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.accessor.uml;
+
+import java.util.List;
+
+import org.eclipse.papyrus.moka.engine.suml.accessor.ValueTypeConverter;
+import org.eclipse.uml2.uml.InstanceValue;
+import org.eclipse.uml2.uml.LiteralBoolean;
+import org.eclipse.uml2.uml.LiteralInteger;
+import org.eclipse.uml2.uml.LiteralNull;
+import org.eclipse.uml2.uml.LiteralReal;
+import org.eclipse.uml2.uml.LiteralString;
+import org.eclipse.uml2.uml.LiteralUnlimitedNatural;
+import org.eclipse.uml2.uml.Slot;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+public class ValueSpecificationConverter implements ValueTypeConverter<ValueSpecification> {
+
+ @Override
+ public boolean isComposite(ValueSpecification value) {
+ return value instanceof InstanceValue;
+ }
+
+ @Override
+ public List<Slot> getComponents(ValueSpecification value) {
+ InstanceValue iv = (InstanceValue) value;
+ return iv.getInstance().getSlots();
+ }
+
+ @Override
+ public Object getRawValue(ValueSpecification value) {
+ if( value instanceof LiteralBoolean )
+ return value.booleanValue();
+
+ if( value instanceof LiteralInteger )
+ return value.integerValue();
+
+ if( value instanceof LiteralNull )
+ return null;
+
+ if( value instanceof LiteralReal )
+ return value.realValue();
+
+ if( value instanceof LiteralString )
+ return value.stringValue();
+
+ if( value instanceof LiteralUnlimitedNatural )
+ return value.integerValue();
+
+ return null;
+ }
+
+ @Override
+ public boolean isValueType(Object obj) {
+ return obj instanceof ValueSpecification;
+ }
+
+ @Override
+ public ValueSpecification newPrimitiveValue(Type type, Object obj) {
+ if( obj instanceof Double || obj instanceof Float ) {
+ LiteralReal realValue = UMLFactory.eINSTANCE.createLiteralReal();
+ realValue.setValue( (Double)obj );
+ return realValue;
+ }
+
+ if( obj instanceof Integer ) {
+ LiteralInteger integerValue = UMLFactory.eINSTANCE.createLiteralInteger();
+ integerValue.setValue( (Integer)obj);
+ return integerValue;
+ }
+
+ if( obj instanceof Boolean ) {
+ LiteralBoolean boolValue = UMLFactory.eINSTANCE.createLiteralBoolean();
+ boolValue.setValue( (Boolean)obj );
+ return boolValue;
+ }
+
+ if( obj instanceof String ) {
+ LiteralString strValue = UMLFactory.eINSTANCE.createLiteralString();
+ strValue.setValue( (String)obj );
+ return strValue;
+ }
+
+ return null;
+ }
+
+ @Override
+ public void setRawValue(ValueSpecification value, Object obj) {
+ if( value instanceof LiteralBoolean )
+ ((LiteralBoolean)value).setValue((Boolean) obj);
+
+ if( value instanceof LiteralInteger )
+ ((LiteralInteger)value).setValue((Integer) obj);
+
+ if( value instanceof LiteralUnlimitedNatural )
+ ((LiteralUnlimitedNatural)value).setValue((Integer) obj);
+
+ if( value instanceof LiteralReal )
+ ((LiteralReal)value).setValue((Double) obj);
+
+ if( value instanceof LiteralString )
+ ((LiteralString)value).setValue((String) obj);
+
+ }
+
+ @Override
+ public boolean isPrimitive(Type type) {
+ return false;
+ }
+
+ @Override
+ public Class<ValueSpecification> getValueTypeClass() {
+ return ValueSpecification.class;
+ }
+
+ @Override
+ public ValueSpecification newValue(Object obj) {
+ return null;
+ }
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/actions/OpaqueActionActivation.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/actions/OpaqueActionActivation.java
new file mode 100644
index 0000000..9eaf5c0
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/actions/OpaqueActionActivation.java
@@ -0,0 +1,91 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.papyrus.moka.engine.suml.ScriptExecutionFactoryRegistry;
+import org.eclipse.papyrus.moka.engine.suml.opaquebehaviors.ScriptExecution;
+import org.eclipse.papyrus.moka.fuml.actions.ActionActivation;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.ParameterValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IValue;
+import org.eclipse.uml2.uml.InputPin;
+import org.eclipse.uml2.uml.OpaqueAction;
+import org.eclipse.uml2.uml.OutputPin;
+import org.eclipse.uml2.uml.Parameter;
+import org.eclipse.uml2.uml.ParameterDirectionKind;
+import org.eclipse.uml2.uml.Pin;
+import org.eclipse.uml2.uml.UMLFactory;
+
+public class OpaqueActionActivation extends ActionActivation {
+
+ private static Parameter parameterFromPin(final Pin pin) {
+
+ Parameter p = UMLFactory.eINSTANCE.createParameter();
+ p.setName(pin.getName());
+ p.setType(pin.getType());
+ p.setUpper(pin.getUpper());
+ p.setLower(pin.getLower());
+ p.setType( pin.getType() );
+
+ if( pin instanceof InputPin )
+ p.setDirection(ParameterDirectionKind.IN_LITERAL);
+ else
+ p.setDirection(ParameterDirectionKind.OUT_LITERAL);
+
+ return p;
+ }
+
+ private boolean hasBody() {
+ OpaqueAction opaqueAction = (OpaqueAction)this.node;
+ return ( opaqueAction.getLanguages().size() > 0 && opaqueAction.getBodies().size() > 0 );
+ }
+
+ @Override
+ public void doAction() {
+ if( !hasBody() ) //Doesn't have a script
+ return;
+
+ ScriptExecution scriptExecution = ScriptExecutionFactoryRegistry.getInstance().getFactory().newScriptExecution();
+ scriptExecution.setContext(getExecutionContext());
+
+ OpaqueAction opaqueAction = (OpaqueAction)this.node;
+ scriptExecution.setLanguage(opaqueAction.getLanguages().get(0));
+ scriptExecution.setBody(opaqueAction.getBodies().get(0));
+
+ for( InputPin in : opaqueAction.getInputs() ) {
+ ParameterValue parameterValue = new ParameterValue();
+ parameterValue.parameter = parameterFromPin(in);
+ parameterValue.values = this.takeTokens(in);
+ scriptExecution.setParameterValue(parameterValue);
+ }
+
+ for( OutputPin out : opaqueAction.getOutputs() ) {
+ ParameterValue parameterValue = new ParameterValue();
+ parameterValue.parameter = parameterFromPin(out);
+ parameterValue.values = new ArrayList<IValue>();
+ scriptExecution.setParameterValue(parameterValue);
+ }
+
+ scriptExecution.execute();
+
+ for( OutputPin out : opaqueAction.getOutputs() ) {
+ List<IValue> values = scriptExecution.getOutParamValues(out.getName());
+ this.putTokens(out, values );
+ }
+
+ scriptExecution.destroy();
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_ExecutionFactory.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_ExecutionFactory.java
new file mode 100644
index 0000000..4a86012
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_ExecutionFactory.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.loci;
+
+import org.eclipse.papyrus.moka.engine.suml.BodyScriptFactoryRegistry;
+import org.eclipse.papyrus.moka.engine.suml.actions.OpaqueActionActivation;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.IOpaqueBehaviorExecution;
+import org.eclipse.papyrus.moka.fuml.loci.ISemanticVisitor;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IEvaluation;
+import org.eclipse.papyrus.moka.pssm.loci.SM_ExecutionFactory;
+import org.eclipse.uml2.uml.BodyOwner;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.OpaqueAction;
+import org.eclipse.uml2.uml.OpaqueBehavior;
+import org.eclipse.uml2.uml.OpaqueExpression;
+import org.eclipse.uml2.uml.ValueSpecification;
+
+public class SUML_ExecutionFactory extends SM_ExecutionFactory {
+
+ @Override
+ public ISemanticVisitor instantiateVisitor(Element element) {
+ //Look for the elements that might have scripts inside
+ if (element instanceof OpaqueAction) {
+ if( isSupported( (BodyOwner) element ) )
+ return new OpaqueActionActivation();
+ }
+
+ if( element instanceof OpaqueExpression) {
+ if( isSupported( (BodyOwner) element ) )
+ return new SUML_OpaqueExpressionEvaluation();
+ }
+
+
+ return super.instantiateVisitor(element);
+ }
+
+ private boolean isSupported(BodyOwner bodyOwner) {
+ if( bodyOwner.getBodies().size() < 1 )
+ return false;
+
+ if( bodyOwner.getLanguages().size() < 1 )
+ return false;
+
+ //Maybe iterate on the languages until there's at least one supported?
+ return BodyScriptFactoryRegistry.getInstance().isSupported( bodyOwner.getLanguages().get(0) );
+ }
+
+ //Check the prototype copying mechanism on the super class ExecutionFactory
+ @Override
+ public IOpaqueBehaviorExecution instantiateOpaqueBehaviorExecution(OpaqueBehavior behavior) {
+ if( !isSupported(behavior) )
+ return super.instantiateOpaqueBehaviorExecution(behavior);
+
+ SUML_OpaqueBehaviorExecution execution = new SUML_OpaqueBehaviorExecution();
+ execution.addType(behavior);
+ return execution;
+ }
+
+ @Override
+ public IEvaluation createEvaluation(ValueSpecification specification) {
+ return super.createEvaluation(specification);
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_OpaqueBehaviorExecution.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_OpaqueBehaviorExecution.java
new file mode 100644
index 0000000..9fe0f57
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_OpaqueBehaviorExecution.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.loci;
+
+import java.util.List;
+
+import org.eclipse.papyrus.moka.engine.suml.ScriptExecutionFactoryRegistry;
+import org.eclipse.papyrus.moka.engine.suml.accessor.AccessAdapterRegistry;
+import org.eclipse.papyrus.moka.engine.suml.accessor.locus.IValueConverter;
+import org.eclipse.papyrus.moka.engine.suml.opaquebehaviors.ScriptExecution;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.IParameterValue;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.OpaqueBehaviorExecution;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IValue;
+import org.eclipse.uml2.uml.OpaqueBehavior;
+
+public class SUML_OpaqueBehaviorExecution extends OpaqueBehaviorExecution{
+
+ @Override
+ public void doBody(List<IParameterValue> inputParameters, List<IParameterValue> outputParameters) {
+
+ ScriptExecution scriptExecution = ScriptExecutionFactoryRegistry.getInstance().getFactory().newScriptExecution();
+ scriptExecution.setContext(getContext());
+
+ OpaqueBehavior behavior = (OpaqueBehavior) getBehavior();
+ scriptExecution.setLanguage(behavior.getLanguages().get(0));
+ scriptExecution.setBody(behavior.getBodies().get(0));
+
+ for( IParameterValue in : inputParameters)
+ scriptExecution.setParameterValue(in);
+
+ for( IParameterValue out : outputParameters )
+ scriptExecution.setParameterValue(out);
+
+ scriptExecution.execute();
+ scriptExecution.destroy();
+ }
+
+ @Override
+ public IValue new_() {
+ return new SUML_OpaqueBehaviorExecution();
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_OpaqueExpressionEvaluation.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_OpaqueExpressionEvaluation.java
new file mode 100644
index 0000000..244ea73
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/loci/SUML_OpaqueExpressionEvaluation.java
@@ -0,0 +1,121 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.loci;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.papyrus.moka.engine.suml.ScriptExecutionFactoryRegistry;
+import org.eclipse.papyrus.moka.engine.suml.accessor.AccessAdapterRegistry;
+import org.eclipse.papyrus.moka.engine.suml.accessor.ComponentAccessor;
+import org.eclipse.papyrus.moka.engine.suml.accessor.locus.IValueConverter;
+import org.eclipse.papyrus.moka.engine.suml.accessor.structures.ArrayIndexableMapAccess;
+import org.eclipse.papyrus.moka.engine.suml.opaquebehaviors.ScriptExecution;
+import org.eclipse.papyrus.moka.engine.suml.opaquebehaviors.ScriptExecutionContext;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.ICallEventOccurrence;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.IEventOccurrence;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.IParameterValue;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.ISignalEventOccurrence;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IFeatureValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IValue;
+import org.eclipse.papyrus.moka.pscs.commonbehavior.CS_EventOccurrence;
+import org.eclipse.papyrus.moka.pssm.values.SM_OpaqueExpressionEvaluation;
+import org.eclipse.uml2.uml.Behavior;
+import org.eclipse.uml2.uml.BodyOwner;
+import org.eclipse.uml2.uml.OpaqueExpression;
+
+public class SUML_OpaqueExpressionEvaluation extends SM_OpaqueExpressionEvaluation{
+
+ private ScriptExecution scriptExecution = ScriptExecutionFactoryRegistry.getInstance().getFactory().newScriptExecution();
+
+ @Override
+ public void initialize(IEventOccurrence eventOccurrence) {
+
+ IEventOccurrence evtInstance = eventOccurrence;
+
+ if( eventOccurrence instanceof CS_EventOccurrence ) {
+ evtInstance = ( (CS_EventOccurrence)eventOccurrence ).getWrappedEventOccurrence();
+ }
+
+
+ if( evtInstance instanceof ISignalEventOccurrence ) {
+ setupSignalEvent((ISignalEventOccurrence) evtInstance);
+ }
+
+ if( evtInstance instanceof ICallEventOccurrence ) {
+ setupCallEvent((ICallEventOccurrence) evtInstance);
+ }
+
+
+ }
+
+ private void setupSignalEvent(ISignalEventOccurrence evt) {
+
+ ArrayIndexableMapAccess<String, Object> event = new ArrayIndexableMapAccess<String, Object>();
+ ComponentAccessor ca = AccessAdapterRegistry.getInstance().getComponentAccessor();
+
+ for( IFeatureValue paramValue : evt.getSignalInstance().getFeatureValues() ) {
+ Object value = ca.componentValueToScript(paramValue);
+ event.put(paramValue.getFeature().getName(), value);
+ }
+ ScriptExecutionContext ctx = scriptExecution.getScriptExecutionContext();
+
+ ctx.inject("event", event);
+ }
+
+
+ private void setupCallEvent(ICallEventOccurrence evt) {
+
+ ArrayIndexableMapAccess<String, Object> event = new ArrayIndexableMapAccess<String, Object>();
+ ComponentAccessor ca = AccessAdapterRegistry.getInstance().getComponentAccessor();
+
+ for( IParameterValue paramValue : evt.getParameterValues() ) {
+ Object value = ca.componentValueToScript(paramValue);
+ event.put(paramValue.getParameter().getName(), value);
+ }
+ ScriptExecutionContext ctx = scriptExecution.getScriptExecutionContext();
+
+ ctx.inject("event", event);
+ }
+
+
+ @Override
+ public List<IValue> executeExpressionBehavior() {
+ OpaqueExpression expression = (OpaqueExpression)this.specification;
+ Behavior behavior = expression.getBehavior();
+ return executeBodyOwner(expression);
+ }
+
+ private List<IValue> executeBodyOwner(BodyOwner bo){
+ scriptExecution.setContext(getContext());
+ scriptExecution.setLanguage(bo.getLanguages().get(0));
+ scriptExecution.setBody(bo.getBodies().get(0));
+
+ for( IParameterValue param : this.parameterValues)
+ scriptExecution.setParameterValue(param);
+
+ scriptExecution.execute();
+
+ //Adapt Value
+ IValueConverter conv = (IValueConverter)AccessAdapterRegistry.getInstance().getConverterForClass(IValue.class);
+ IValue value = conv.newValue(scriptExecution.getReturnObject());
+
+ List<IValue> list = new ArrayList<IValue>();
+ list.add(value);
+
+ scriptExecution.destroy();
+
+ return list;
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/opaquebehaviors/LocusAdapter.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/opaquebehaviors/LocusAdapter.java
new file mode 100644
index 0000000..8305a6c
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/opaquebehaviors/LocusAdapter.java
@@ -0,0 +1,302 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.opaquebehaviors;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.papyrus.moka.engine.suml.accessor.AccessAdapterRegistry;
+import org.eclipse.papyrus.moka.engine.suml.accessor.ComponentAccessor;
+import org.eclipse.papyrus.moka.engine.suml.accessor.ValueTypeWrapper;
+import org.eclipse.papyrus.moka.engine.suml.accessor.locus.IValueConverter;
+import org.eclipse.papyrus.moka.engine.suml.accessor.structures.ListAccess;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.IExecution;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.IParameterValue;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.ParameterValue;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.SignalEventOccurrence;
+import org.eclipse.papyrus.moka.fuml.loci.ILocus;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.EnumerationValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IEnumerationValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.SignalInstance;
+import org.eclipse.papyrus.moka.fuml.structuredclassifiers.IObject_;
+import org.eclipse.papyrus.moka.fuml.structuredclassifiers.IReference;
+import org.eclipse.papyrus.moka.fuml.structuredclassifiers.Reference;
+import org.eclipse.uml2.uml.Behavior;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Classifier;
+import org.eclipse.uml2.uml.Enumeration;
+import org.eclipse.uml2.uml.EnumerationLiteral;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Parameter;
+import org.eclipse.uml2.uml.ParameterDirectionKind;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Signal;
+
+public class LocusAdapter {
+ private IObject_ ctxInstance;
+
+ public void setExecutionInstance(IObject_ context) {
+ this.ctxInstance = context;
+ }
+
+ private ILocus getLocus() {
+ return ctxInstance.getLocus();
+ }
+
+ private Classifier getContextType() {
+ return ctxInstance.getTypes().get(0);
+ }
+
+ private NamedElement findNamedElement(String qualifiedName) {
+
+ Classifier context = getContextType();
+
+ if( qualifiedName.startsWith("::") ) {
+ String parent = context.getPackage().getQualifiedName();
+ qualifiedName = parent + qualifiedName;
+ }
+
+ if ( !(context instanceof EObject) || (((EObject)context).eResource() == null) )
+ throw new RuntimeException("Failed to find a contextual resource for object");
+
+ ResourceSet resSet = ((EObject)context).eResource().getResourceSet();
+
+ Collection<NamedElement> elems = org.eclipse.uml2.uml.util.UMLUtil.findNamedElements(resSet, qualifiedName);
+ if (!elems.isEmpty()) {
+ return elems.iterator().next();
+ }else {
+ throw new RuntimeException("Failed to find a NamedElement with qualified name: "+ qualifiedName);
+ }
+ }
+
+ public Object importEnumeration(String qualifiedName) {
+ NamedElement elm = findNamedElement(qualifiedName);
+ if( !(elm instanceof Enumeration) )
+ throw new RuntimeException("The NamedElement is not an Enumeration: "+ qualifiedName);
+
+ Enumeration enumeration = (Enumeration) elm;
+ //Map with IEnumValues
+ HashMap<String, IEnumerationValue> enumObject = new HashMap<String, IEnumerationValue>();
+
+ for(EnumerationLiteral lit : enumeration.getOwnedLiterals()) {
+ EnumerationValue eValue = new EnumerationValue();
+ eValue.literal = lit;
+ eValue.type = enumeration;
+ enumObject.put(lit.getName(), eValue );
+ }
+
+ return enumObject;
+ }
+
+ public Object instantiate(String qualifiedName) {
+ NamedElement elm = findNamedElement(qualifiedName);
+
+ if( !(elm instanceof org.eclipse.uml2.uml.Class) )
+ throw new RuntimeException("The NamedElement is not a class: "+ qualifiedName);
+
+ ILocus locus = getLocus();
+ //Wrap it
+ Reference reference = new Reference();
+ reference.referent = locus.instantiate((Class) elm);
+
+ Class type = (Class)reference.referent.getTypes().get(0);
+
+ //Start behavior if it's not null
+ if( type.getClassifierBehavior() != null )
+ reference.referent.startBehavior(type, new ArrayList<IParameterValue>());
+
+ return AccessAdapterRegistry.getInstance().getComponentAccessor().valueToScript( reference );
+ }
+
+
+ public Object callBehavior( String qualifiedName ) {
+ return callBehavior(qualifiedName, ctxInstance);
+ }
+
+ public Object callBehavior(String qualifiedName, Object context) {
+ return callBehavior(qualifiedName, context, null);
+ }
+
+ private IObject_ getRightContext(Object context) {
+ if( context == null )
+ return ctxInstance;
+
+ if( context instanceof IObject_ )
+ return (IObject_) context;
+
+ if( !(context instanceof ValueTypeWrapper) )
+ throw new RuntimeException("The object "+ context + " is not a valid Reference, and can't be the context of a behavior call");
+
+ ValueTypeWrapper<IValue> target = (ValueTypeWrapper<IValue>)context;
+ return ((IReference)target.unwrap()).getReferent();
+ }
+
+ public Object toLocusList(List<Object> params) {
+
+ if( params == null )
+ return null;
+
+ ArrayList locusList = new ArrayList<IValue>();
+
+ for(Object o : params)
+ locusList.add(o);
+
+ return locusList;
+ }
+
+ public Object callBehavior( String qualifiedName , Object context, List<Object> params ) {
+ NamedElement element = findNamedElement(qualifiedName);
+
+ if( !(element instanceof Behavior ) )
+ throw new RuntimeException("The class "+ qualifiedName + " is not a behavior");
+
+
+ Behavior behavior = (Behavior)element;
+ IExecution execution = getLocus().getFactory().createExecution(behavior, getRightContext(context));
+
+ IValueConverter conv = AccessAdapterRegistry.getInstance().getConverterForClass(IValue.class);
+
+ ComponentAccessor accesor = AccessAdapterRegistry.getInstance().getComponentAccessor();
+
+ if( params != null ) {
+ for( int i = 0; i < params.size(); i++ ) {
+ Parameter p = behavior.getOwnedParameters().get(i);
+
+ ParameterValue pv = new ParameterValue();
+ pv.parameter = p;
+ pv.values = new ArrayList<IValue>();
+ pv.values.add( conv.newValue(params.get(i)) );
+ execution.setParameterValue(pv);
+ }
+ }
+
+ execution.execute();
+
+ Object returnObject = Void.TYPE;
+
+ for( IParameterValue pv : execution.getOutputParameterValues() )
+ if( pv.getParameter().getDirection() == ParameterDirectionKind.RETURN_LITERAL ) {
+ returnObject = accesor.valueListToScript( pv.getValues() );
+ break;
+ }
+
+ execution.destroy();
+
+ return returnObject;
+ }
+
+ public Object callOperation(Operation operation, IReference reference, List<Object> params) {
+ IExecution callExecution = reference.dispatch(operation);
+
+ if( params != null ) {
+ IValueConverter conv = AccessAdapterRegistry.getInstance().getConverterForClass(IValue.class);
+
+ List<Parameter> parameters = callExecution.getBehavior().getOwnedParameters();
+
+ for( int i = 0; i < parameters.size(); i++ ) {
+ Parameter parameter = parameters.get(i);
+ ParameterValue parameterValue = new ParameterValue();
+ parameterValue.parameter = parameter;
+ parameterValue.values = new ArrayList<IValue>();
+ callExecution.setParameterValue(parameterValue);
+
+ if( parameter.getDirection() == ParameterDirectionKind.RETURN_LITERAL ||
+ parameter.getDirection() == ParameterDirectionKind.OUT_LITERAL)
+ continue;
+
+ parameterValue.values.add( conv.newValue(params.get(i)));
+ }
+
+ }
+
+ callExecution.execute();
+
+ ComponentAccessor accesor = AccessAdapterRegistry.getInstance().getComponentAccessor();
+
+ Object returnObject = Void.TYPE;
+
+ for( IParameterValue pv : callExecution.getOutputParameterValues() )
+ if( pv.getParameter().getDirection() == ParameterDirectionKind.RETURN_LITERAL ) {
+ returnObject = accesor.valueListToScript( pv.getValues() );
+ break;
+ }
+
+ callExecution.destroy();
+
+ return returnObject;
+ }
+
+ public Object callOperation( String opName, Object obj, List<Object> params) {
+ if( !(obj instanceof ValueTypeWrapper) )
+ throw new RuntimeException("The object "+ obj + " is not a valid Reference, and can't be targeted by a signal");
+
+ ValueTypeWrapper<IValue> target = (ValueTypeWrapper<IValue>)obj;
+ IReference ref = (IReference) target.unwrap();
+
+ Classifier c = ref.getTypes().get(0);
+ Operation operation = null;
+ for( Operation op : c.getOperations() ) {
+ if( op.getName().equals(opName) ) {
+ operation = op;
+ break;
+ }
+ }
+
+ if( operation == null )
+ throw new RuntimeException("The operation "+ opName + " doesn't exist in the object " + obj);
+
+ return callOperation(operation, ref, params);
+ }
+
+ public void sendSignal(String qualifiedName, Object obj, List<Object> params ) {
+
+ if( !(obj instanceof ValueTypeWrapper) )
+ throw new RuntimeException("The object "+ obj + " is not a valid Reference, and can't be targeted by a signal");
+
+ ValueTypeWrapper<IValue> target = (ValueTypeWrapper<IValue>)obj;
+
+ NamedElement element = findNamedElement(qualifiedName);
+
+ if( !(element instanceof Signal ) )
+ throw new RuntimeException("The signal "+ qualifiedName + " does not exist");
+
+ Signal signal = (Signal)element;
+
+ SignalInstance signalInstance = new SignalInstance();
+ signalInstance.type = signal;
+
+ IValueConverter conv = AccessAdapterRegistry.getInstance().getConverterForClass(IValue.class);
+
+ if( params != null ) {
+ List<Property> attributes = signal.getOwnedAttributes();
+ for (int i = 0; i < attributes.size(); i++) {
+ Property attribute = attributes.get(i);
+ List<IValue> values = new ArrayList<IValue>();
+ values.add( conv.newValue(params.get(i)) );
+ signalInstance.setFeatureValue(attribute, values, 0);
+ }
+ }
+
+ SignalEventOccurrence signalEventOccurrence = new SignalEventOccurrence();
+ signalEventOccurrence.signalInstance = (SignalInstance) signalInstance.copy();
+ signalEventOccurrence.sendTo((IReference) target.unwrap());
+ }
+
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/opaquebehaviors/SUMLScriptExecutionFactory.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/opaquebehaviors/SUMLScriptExecutionFactory.java
new file mode 100644
index 0000000..d3293ef
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/opaquebehaviors/SUMLScriptExecutionFactory.java
@@ -0,0 +1,24 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.opaquebehaviors;
+
+import org.eclipse.papyrus.moka.engine.suml.ScriptExecutionFactory;
+
+public class SUMLScriptExecutionFactory implements ScriptExecutionFactory {
+
+ @Override
+ public ScriptExecution newScriptExecution() {
+ return new ScriptExecution();
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/opaquebehaviors/ScriptExecution.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/opaquebehaviors/ScriptExecution.java
new file mode 100644
index 0000000..607969f
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/opaquebehaviors/ScriptExecution.java
@@ -0,0 +1,106 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.opaquebehaviors;
+
+import java.util.List;
+
+import org.eclipse.papyrus.moka.engine.suml.BodyScriptFactoryRegistry;
+import org.eclipse.papyrus.moka.engine.suml.script.IBodyScript;
+import org.eclipse.papyrus.moka.engine.suml.script.IBodyScriptFactory;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.Execution;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.IParameterValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IValue;
+import org.eclipse.uml2.uml.ParameterDirectionKind;
+
+public class ScriptExecution extends Execution {
+
+ private String body, language;
+ protected ScriptExecutionContext ctx;
+ private Object returnObject;
+ private String returnParameterName;
+
+ protected ScriptExecution() {
+ this.ctx = new ScriptExecutionContext();
+ }
+
+ public String getBody() {
+ return body;
+ }
+
+ public void setBody(String body) {
+ this.body = body;
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+
+ private void buildScriptContext() {
+ ctx.setInstance(getContext());
+
+ for (IParameterValue param : this.getParameterValues()) {
+ if (param.getParameter().getDirection() == ParameterDirectionKind.IN_LITERAL ||
+ param.getParameter().getDirection() == ParameterDirectionKind.INOUT_LITERAL)
+ ctx.addInParameter(param);
+
+ if (param.getParameter().getDirection() == ParameterDirectionKind.OUT_LITERAL ||
+ param.getParameter().getDirection() == ParameterDirectionKind.INOUT_LITERAL ||
+ param.getParameter().getDirection() == ParameterDirectionKind.RETURN_LITERAL)
+ ctx.addOutParameter(param);
+
+ if (param.getParameter().getDirection() == ParameterDirectionKind.RETURN_LITERAL) {
+ returnParameterName = param.getParameter().getName();
+ }
+ }
+ }
+
+ @Override
+ public void execute() {
+ BodyScriptFactoryRegistry registry = BodyScriptFactoryRegistry.getInstance();
+ IBodyScriptFactory factory = registry.getBodyScriptFactoryFor(language);
+
+ IBodyScript bodyScript = factory.buildScript(this, body);
+ buildScriptContext();
+
+ returnObject = bodyScript.evaluate(ctx.toHashMap());
+
+ setReturnObjectValue(returnObject);
+ ctx.assignOutputValues();
+ }
+
+ private void setReturnObjectValue(Object obj) {
+ if (ctx.getOut().get(returnParameterName) == null || obj != null)
+ ctx.getOut().put(returnParameterName, obj);
+ }
+
+ public ScriptExecutionContext getScriptExecutionContext() {
+ return ctx;
+ }
+
+ public Object getReturnObject() {
+ return returnObject;
+ }
+
+ public List<IValue> getOutParamValues(String name) {
+ return ctx.getOutParamValues(name);
+ }
+
+ @Override
+ public IValue new_() {
+ return null;
+ }
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/opaquebehaviors/ScriptExecutionContext.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/opaquebehaviors/ScriptExecutionContext.java
new file mode 100644
index 0000000..729f735
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/opaquebehaviors/ScriptExecutionContext.java
@@ -0,0 +1,97 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.opaquebehaviors;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.papyrus.moka.engine.suml.accessor.AccessAdapterRegistry;
+import org.eclipse.papyrus.moka.engine.suml.accessor.ComponentAccessor;
+import org.eclipse.papyrus.moka.engine.suml.accessor.structures.ArrayIndexableMapAccess;
+import org.eclipse.papyrus.moka.fuml.commonbehavior.IParameterValue;
+import org.eclipse.papyrus.moka.fuml.simpleclassifiers.IValue;
+import org.eclipse.papyrus.moka.fuml.structuredclassifiers.IObject_;
+
+public class ScriptExecutionContext {
+
+ public static final String KEY_INSTANCE = "instance";
+ public static final String KEY_IN = "in";
+ public static final String KEY_OUT = "out";
+ public static final String KEY_LOCUS = "jlocus";
+
+ private HashMap<String, IParameterValue> outParams;
+
+ protected HashMap<String, Object> map = new HashMap<String, Object>();
+
+ public ScriptExecutionContext() {
+ outParams = new HashMap<String, IParameterValue>();
+ map.put(KEY_IN, new ArrayIndexableMapAccess<String, Object>());
+ map.put(KEY_OUT, new ArrayIndexableMapAccess<String, Object>());
+ }
+
+ public void setInstance(IObject_ instance) {
+ LocusAdapter locusAdapter = AccessAdapterRegistry.getInstance().getLocusAdapter();
+ locusAdapter.setExecutionInstance(instance);
+ map.put(KEY_LOCUS, locusAdapter);
+
+ //Adapt the object
+ Object adapted = AccessAdapterRegistry.getInstance().getComponentAccessor().valueToScript( instance );
+
+ map.put(KEY_INSTANCE, adapted);
+ }
+
+ public ArrayIndexableMapAccess<String, Object> getIn() {
+ return (ArrayIndexableMapAccess<String, Object>) map.get(KEY_IN);
+ }
+
+ public ArrayIndexableMapAccess<String, Object> getOut() {
+ return (ArrayIndexableMapAccess<String, Object>) map.get(KEY_OUT);
+ }
+
+ private ComponentAccessor getParameterAdapter() {
+ return AccessAdapterRegistry.getInstance().getComponentAccessor();
+ }
+
+ public void addInParameter(IParameterValue paramValue) {
+ Object value = getParameterAdapter().componentValueToScript(paramValue);
+ getIn().put(paramValue.getParameter().getName(), value);
+ }
+
+ public void addOutParameter(IParameterValue paramValue) {
+ Object value = getParameterAdapter().componentValueToScript(paramValue);
+ getOut().put(paramValue.getParameter().getName(), value);
+
+ outParams.put(paramValue.getParameter().getName(), paramValue);
+ }
+
+ protected void assignOutputValues() {
+ for( String name : outParams.keySet() ) {
+ IParameterValue p = outParams.get(name);
+ getParameterAdapter().setValueFromScript(p, getOut().get(name));
+ }
+ }
+
+ public HashMap<String, Object> toHashMap() {
+ return map;
+ }
+
+ public void inject(String key, Object object) {
+ map.put(key, object);
+ }
+
+ public List<IValue> getOutParamValues(String name) {
+ IParameterValue p = outParams.get(name);
+ return p.getValues();
+ }
+
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/script/IBodyScript.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/script/IBodyScript.java
new file mode 100644
index 0000000..b993b15
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/script/IBodyScript.java
@@ -0,0 +1,17 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.script;
+
+public interface IBodyScript {
+ public Object evaluate(Object param);
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/script/IBodyScriptFactory.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/script/IBodyScriptFactory.java
new file mode 100644
index 0000000..1391286
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/script/IBodyScriptFactory.java
@@ -0,0 +1,23 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.script;
+
+import java.net.URI;
+
+public interface IBodyScriptFactory {
+ public IBodyScript buildScript(Object ctx, String scriptBody);
+
+ public void configure(URI modelUri);
+
+ public void terminate();
+}
diff --git a/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/script/gen/CodeGenHelper.java b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/script/gen/CodeGenHelper.java
new file mode 100644
index 0000000..2f3e2e0
--- /dev/null
+++ b/bundles/suml/org.eclipse.papyrus.moka.engine.suml/src/org/eclipse/papyrus/moka/engine/suml/script/gen/CodeGenHelper.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST
+ *
+ * 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:
+ * David Lopez david.lopez@cea.fr(CEA LIST)
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.moka.engine.suml.script.gen;
+
+public class CodeGenHelper {
+
+ //https://www.python.org/dev/peps/pep-0008/#indentation
+ protected static final int TAB_SPACES = 4;
+ protected static final String TAB_PLACEHOLDER = " ";
+
+ public static String getTab(int tabsNum) {
+ StringBuilder builder = new StringBuilder();
+
+ for( int i = 0; i < tabsNum; i++ )
+ builder.append(TAB_PLACEHOLDER);
+
+ return builder.toString();
+ }
+
+ public static String clearTabs(String body) {
+ return body.replaceAll("\t", getTab(1));
+ }
+}
diff --git a/bundles/suml/pom.xml b/bundles/suml/pom.xml
new file mode 100644
index 0000000..d6be089
--- /dev/null
+++ b/bundles/suml/pom.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- Parent of this POM -->
+ <parent>
+ <version>0.7.0-SNAPSHOT</version>
+ <groupId>org.eclipse.papyrus.moka.incubation</groupId>
+ <artifactId>org.eclipse.papyrus.moka.incubation.bundles.root</artifactId>
+ </parent>
+
+ <!-- Moka project root POM (aggregator) -->
+ <artifactId>org.eclipse.papyrus.moka.engine.suml.root</artifactId>
+ <name>Moka Incubation Scripting UML Engine</name>
+ <packaging>pom</packaging>
+ <version>0.1.0-SNAPSHOT</version>
+
+ <!-- Children modules to build -->
+ <modules>
+ <module>org.eclipse.papyrus.moka.engine.suml</module>
+ <module>org.eclipse.papyrus.moka.engine.suml.ease</module>
+ <module>org.eclipse.papyrus.moka.engine.suml.python</module>
+ </modules>
+
+</project>
diff --git a/features/org.eclipse.papyrus.moka.engine.suml.feature/build.properties b/features/org.eclipse.papyrus.moka.engine.suml.feature/build.properties
new file mode 100644
index 0000000..b3a611b
--- /dev/null
+++ b/features/org.eclipse.papyrus.moka.engine.suml.feature/build.properties
@@ -0,0 +1,2 @@
+bin.includes = feature.xml,\
+ feature.properties
diff --git a/features/org.eclipse.papyrus.moka.engine.suml.feature/feature.properties b/features/org.eclipse.papyrus.moka.engine.suml.feature/feature.properties
new file mode 100644
index 0000000..d2bf69b
--- /dev/null
+++ b/features/org.eclipse.papyrus.moka.engine.suml.feature/feature.properties
@@ -0,0 +1,30 @@
+###############################################################################
+# Copyright (c) 2019 CEA LIST and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+###############################################################################
+
+# "featureName" property - name of the feature
+featureName=Scripting UML Engine
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse Modeling Project
+
+# description property - text of the "Feature Description"
+description=\
+This feature gathers all plugins of a Moka execution engine that enables scripting the bodies of OpaqueBehaviors.\n
+
+# "copyright" property - text of the "Feature Update Copyright"
+copyright=\
+Copyright (c) 2019 CEA LIST and others.\n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License 2.0\n\
+which accompanies this distribution, and is available at\n\
+https://www.eclipse.org/legal/epl-2.0/\n\
+\n\
+SPDX-License-Identifier: EPL-2.0\n
+################ end of copyright property ####################################
diff --git a/features/org.eclipse.papyrus.moka.engine.suml.feature/feature.xml b/features/org.eclipse.papyrus.moka.engine.suml.feature/feature.xml
new file mode 100644
index 0000000..e426266
--- /dev/null
+++ b/features/org.eclipse.papyrus.moka.engine.suml.feature/feature.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.papyrus.moka.engine.suml.feature"
+ label="%featureName"
+ version="0.1.0.qualifier"
+ provider-name="%providerName"
+ license-feature="org.eclipse.license"
+ license-feature-version="2.0.2">
+
+ <description url="https://eclipse.org/papyrus/">
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.papyrus.moka.engine.suml"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.moka.engine.suml.python"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.moka.engine.suml.ease"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/features/org.eclipse.papyrus.moka.engine.suml.feature/pom.xml b/features/org.eclipse.papyrus.moka.engine.suml.feature/pom.xml
new file mode 100644
index 0000000..4b4acbb
--- /dev/null
+++ b/features/org.eclipse.papyrus.moka.engine.suml.feature/pom.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- Parent POM (i.e., POM located in the feature folder) -->
+ <parent>
+ <version>0.7.0-SNAPSHOT</version>
+ <groupId>org.eclipse.papyrus.moka.incubation</groupId>
+ <artifactId>org.eclipse.papyrus.moka.incubation.features.root</artifactId>
+ </parent>
+
+ <!-- POM description -->
+ <artifactId>org.eclipse.papyrus.moka.engine.suml.feature</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <packaging>eclipse-feature</packaging>
+ <name>org.eclipse.papyrus.moka.engine.suml.feature</name>
+ <description>This feature gathers all plugins of a Moka execution engine that enables scripting the bodies of OpaqueBehaviors.</description>
+</project>
diff --git a/features/pom.xml b/features/pom.xml
index baf8562..18b83f6 100644
--- a/features/pom.xml
+++ b/features/pom.xml
@@ -19,10 +19,11 @@
<!-- Children modules to build -->
<modules>
<module>org.eclipse.papyrus.moka.annotations.feature</module>
- <module>org.eclipse.papyrus.moka.fmi.feature</module>
- <module>org.eclipse.papyrus.moka.fmi.scripting.feature</module>
+ <!--<module>org.eclipse.papyrus.moka.fmi.feature</module> -->
+ <!--<module>org.eclipse.papyrus.moka.fmi.scripting.feature</module> -->
<module>org.eclipse.papyrus.moka.instancespecification.feature</module>
- <module>org.eclipse.papyrus.moka.parametric.feature</module>
+ <!--<module>org.eclipse.papyrus.moka.parametric.feature</module> -->
+ <module>org.eclipse.papyrus.moka.engine.suml.feature</module>
<module>org.eclipse.papyrus.moka.simex.feature</module>
<module>org.eclipse.papyrus.moka.visualization.feature</module>
</modules>
diff --git a/releng/org.eclipse.papyrus.moka.incubation.configuration/pom.xml b/releng/org.eclipse.papyrus.moka.incubation.configuration/pom.xml
index 3934857..a8e988c 100644
--- a/releng/org.eclipse.papyrus.moka.incubation.configuration/pom.xml
+++ b/releng/org.eclipse.papyrus.moka.incubation.configuration/pom.xml
@@ -29,7 +29,7 @@
<component.bugzilla.name>Moka</component.bugzilla.name>
<component.package.rootname>org.eclipse.papyrus.moka.incubation</component.package.rootname>
<component.apibaseline.url>http://download.eclipse.org/modeling/mdt/papyrus/components/moka/</component.apibaseline.url>
- <eclipse.targetrelease>2019-03</eclipse.targetrelease>
+ <eclipse.targetrelease>master</eclipse.targetrelease>
<target.version>0.7.0-SNAPSHOT</target.version>
<jboss.version>1.3.0</jboss.version>
</properties>
diff --git a/releng/org.eclipse.papyrus.moka.incubation.p2/category.xml b/releng/org.eclipse.papyrus.moka.incubation.p2/category.xml
index acc8bfc..0328b7b 100644
--- a/releng/org.eclipse.papyrus.moka.incubation.p2/category.xml
+++ b/releng/org.eclipse.papyrus.moka.incubation.p2/category.xml
@@ -3,24 +3,18 @@
<feature url="org.eclipse.papyrus.moka.annotations.feature_0.7.0.qualifier.jar" id="org.eclipse.papyrus.moka.annotations.feature" version="0.7.0.qualifier">
<category name="org.eclipse.papyrus.moka.incubation"/>
</feature>
- <feature url="org.eclipse.papyrus.moka.fmi.feature_0.7.0.qualifier.jar" id="org.eclipse.papyrus.moka.fmi.feature" version="0.7.0.qualifier">
- <category name="org.eclipse.papyrus.moka.incubation"/>
- </feature>
- <feature url="org.eclipse.papyrus.moka.fmi.scripting.feature_0.7.0.qualifier.jar" id="org.eclipse.papyrus.moka.fmi.scripting.feature" version="0.7.0.qualifier">
- <category name="org.eclipse.papyrus.moka.incubation"/>
- </feature>
<feature url="org.eclipse.papyrus.moka.instancespecification.feature_0.7.0.qualifier.jar" id="org.eclipse.papyrus.moka.instancespecification.feature" version="0.7.0.qualifier">
<category name="org.eclipse.papyrus.moka.incubation"/>
</feature>
- <feature url="org.eclipse.papyrus.moka.parametric.feature_0.7.0.qualifier.jar" id="org.eclipse.papyrus.moka.parametric.feature" version="0.7.0.qualifier">
- <category name="org.eclipse.papyrus.moka.incubation"/>
- </feature>
<feature url="org.eclipse.papyrus.moka.simex.feature_0.7.0.qualifier.jar" id="org.eclipse.papyrus.moka.simex.feature" version="0.7.0.qualifier">
<category name="org.eclipse.papyrus.moka.incubation"/>
</feature>
<feature url="org.eclipse.papyrus.moka.visualization.feature_0.7.0.qualifier.jar" id="org.eclipse.papyrus.moka.visualization.feature" version="0.7.0.qualifier">
<category name="org.eclipse.papyrus.moka.incubation"/>
</feature>
+ <feature url="org.eclipse.papyrus.moka.engine.suml.feature_0.1.0.qualifier.jar" id="org.eclipse.papyrus.moka.engine.suml.feature" version="0.1.0.qualifier">
+ <category name="org.eclipse.papyrus.moka.incubation"/>
+ </feature>
<category-def name="org.eclipse.papyrus.moka.incubation" label="Moka (Incubation)">
<description>
Papyrus Model Execution Tool
diff --git a/releng/platforms/org.eclipse.papyrus.moka.incubation.targetplatform.master/org.eclipse.papyrus.moka.incubation.targetplatform.master.target b/releng/platforms/org.eclipse.papyrus.moka.incubation.targetplatform.master/org.eclipse.papyrus.moka.incubation.targetplatform.master.target
index d4183e0..acbb7d7 100644
--- a/releng/platforms/org.eclipse.papyrus.moka.incubation.targetplatform.master/org.eclipse.papyrus.moka.incubation.targetplatform.master.target
+++ b/releng/platforms/org.eclipse.papyrus.moka.incubation.targetplatform.master/org.eclipse.papyrus.moka.incubation.targetplatform.master.target
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
-<target name="Moka Incubation Nightly Target Platform" sequenceNumber="1570197123">
+<target name="Moka Incubation Nightly Target Platform" sequenceNumber="1586425497">
<locations>
<location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
<unit id="org.eclipse.platform.feature.group" version="0.0.0"/>
@@ -11,16 +11,16 @@
<unit id="org.eclipse.equinox.p2.discovery.feature.feature.group" version="0.0.0"/>
<unit id="org.eclipse.equinox.executable.feature.group" version="0.0.0"/>
<unit id="org.eclipse.xtend.sdk.feature.group" version="0.0.0"/>
- <repository id="eclipse" location="http://download.eclipse.org/releases/2019-03"/>
+ <repository id="eclipse" location="http://download.eclipse.org/releases/2019-12"/>
</location>
<location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
<unit id="org.eclipse.papyrus.sdk.feature.feature.group" version="0.0.0"/>
<unit id="org.eclipse.papyrus.junit.feature.feature.group" version="0.0.0"/>
- <repository id="papyrus" location="http://download.eclipse.org/modeling/mdt/papyrus/updates/releases/2019-03"/>
+ <repository id="papyrus" location="http://download.eclipse.org/modeling/mdt/papyrus/updates/releases/2019-12"/>
</location>
<location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
<unit id="org.eclipse.papyrus.moka.feature.feature.group" version="0.0.0"/>
- <repository id="moka" location="https://download.eclipse.org/modeling/mdt/papyrus/components/moka/2019-03/"/>
+ <repository id="moka" location="https://hudson.eclipse.org/papyrus/view/Moka/job/papyrus-moka-master/lastSuccessfulBuild/artifact/releng/org.eclipse.papyrus.moka.p2/target/repository/"/>
</location>
<location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
<unit id="org.eclipse.papyrus.ease.feature.feature.group" version="0.0.0"/>
@@ -30,7 +30,7 @@
<unit id="org.aspectj.feature.group" version="0.0.0"/>
<unit id="org.eclipse.ajdt.feature.group" version="0.0.0"/>
<unit id="org.eclipse.equinox.weaving.sdk.feature.group" version="0.0.0"/>
- <repository id="aspectj" location="http://download.eclipse.org/tools/ajdt/48/dev/update/"/>
+ <repository id="aspectj" location="http://download.eclipse.org/tools/ajdt/410/dev/update/"/>
</location>
<location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
<unit id="com.fasterxml.jackson.core.jackson-annotations" version="0.0.0"/>
@@ -66,5 +66,9 @@
<unit id="org.py4j.feature.feature.group" version="0.0.0"/>
<repository id="py4j" location="http://eclipse.py4j.org/"/>
</location>
+ <location includeMode="planner" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="false" type="InstallableUnit">
+ <unit id="org.eclipse.ease.engine.jython.feature.feature.group" version="0.0.0"/>
+ <repository location="https://bintray.com/artifact/download/pontesegger/ease-engines"/>
+ </location>
</locations>
</target>
diff --git a/releng/platforms/org.eclipse.papyrus.moka.incubation.targetplatform.master/org.eclipse.papyrus.moka.incubation.targetplatform.master.tpd b/releng/platforms/org.eclipse.papyrus.moka.incubation.targetplatform.master/org.eclipse.papyrus.moka.incubation.targetplatform.master.tpd
index 018b563..34ea4e5 100644
--- a/releng/platforms/org.eclipse.papyrus.moka.incubation.targetplatform.master/org.eclipse.papyrus.moka.incubation.targetplatform.master.tpd
+++ b/releng/platforms/org.eclipse.papyrus.moka.incubation.targetplatform.master/org.eclipse.papyrus.moka.incubation.targetplatform.master.tpd
@@ -1,6 +1,6 @@
target "Moka Incubation Nightly Target Platform" with source requirements
-location "http://download.eclipse.org/releases/2019-03" eclipse {
+location "http://download.eclipse.org/releases/2019-12" eclipse {
org.eclipse.platform.feature.group lazy
org.eclipse.rcp.feature.group lazy
org.eclipse.jdt.feature.group lazy
@@ -10,12 +10,16 @@
org.eclipse.xtend.sdk.feature.group lazy
}
-location "http://download.eclipse.org/modeling/mdt/papyrus/updates/releases/2019-03" papyrus {
+location "http://download.eclipse.org/modeling/mdt/papyrus/updates/releases/2019-12" papyrus {
org.eclipse.papyrus.sdk.feature.feature.group lazy
org.eclipse.papyrus.junit.feature.feature.group lazy
}
-location "https://download.eclipse.org/modeling/mdt/papyrus/components/moka/2019-03/" moka {
+//location "https://download.eclipse.org/modeling/mdt/papyrus/components/moka/2019-03/" moka {
+// org.eclipse.papyrus.moka.feature.feature.group lazy
+//}
+
+location "https://hudson.eclipse.org/papyrus/view/Moka/job/papyrus-moka-master/lastSuccessfulBuild/artifact/releng/org.eclipse.papyrus.moka.p2/target/repository/" moka {
org.eclipse.papyrus.moka.feature.feature.group lazy
}
@@ -23,7 +27,7 @@
org.eclipse.papyrus.ease.feature.feature.group lazy
}
-location "http://download.eclipse.org/tools/ajdt/48/dev/update/" aspectj {
+location "http://download.eclipse.org/tools/ajdt/410/dev/update/" aspectj {
org.aspectj.feature.group lazy
org.eclipse.ajdt.feature.group lazy
org.eclipse.equinox.weaving.sdk.feature.group lazy
@@ -62,3 +66,7 @@
location "http://eclipse.py4j.org/" py4j {
org.py4j.feature.feature.group lazy
}
+
+location "https://bintray.com/artifact/download/pontesegger/ease-engines" {
+ org.eclipse.ease.engine.jython.feature.feature.group lazy
+}
\ No newline at end of file