Bug 530737 - [IoTML] Init Architecture
- create the architecture plug-in and its test fragment
- create the architecture model
- create the CreateIoTMLModelCommand class to initializz the model
- add 2 tests to validate the model and check that emf id and
identifier are equals.
- switch IoTML.profile.uml to viewpoint architecture
- create bundle.properties files
Change-Id: Idd3f8adfff86289ad1d5190a10a631bd8b11f1cd
Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
diff --git a/org.eclipse.papyrus.iotml.architecture.tests/.classpath b/org.eclipse.papyrus.iotml.architecture.tests/.classpath
new file mode 100644
index 0000000..83be1d9
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture.tests/.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="test"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.papyrus.iotml.architecture.tests/.project b/org.eclipse.papyrus.iotml.architecture.tests/.project
new file mode 100644
index 0000000..5e732fa
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.iotml.architecture.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.papyrus.iotml.architecture.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.papyrus.iotml.architecture.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..0c68a61
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.eclipse.papyrus.iotml.architecture.tests/META-INF/MANIFEST.MF b/org.eclipse.papyrus.iotml.architecture.tests/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a64a292
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.iotml.architecture.tests
+Bundle-Version: 0.7.0.qualifier
+Fragment-Host: org.eclipse.papyrus.iotml.architecture;bundle-version="0.7.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.junit
+Bundle-Vendor: %Bundle-Vendor
diff --git a/org.eclipse.papyrus.iotml.architecture.tests/OSGI-INF/l10n/bundle.properties b/org.eclipse.papyrus.iotml.architecture.tests/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..995795b
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture.tests/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2018 CEA.
+# 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:
+# Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - initial API and implementation
+##################################################################################
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = IoTML Architecture Tests
\ No newline at end of file
diff --git a/org.eclipse.papyrus.iotml.architecture.tests/build.properties b/org.eclipse.papyrus.iotml.architecture.tests/build.properties
new file mode 100644
index 0000000..b17d445
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture.tests/build.properties
@@ -0,0 +1,5 @@
+source.. = test/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/
diff --git a/org.eclipse.papyrus.iotml.architecture.tests/pom.xml b/org.eclipse.papyrus.iotml.architecture.tests/pom.xml
new file mode 100644
index 0000000..2eafeeb
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture.tests/pom.xml
@@ -0,0 +1,11 @@
+<?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>
+ <artifactId>org.eclipse.papyrus.iotml.parent</artifactId>
+ <groupId>org.eclipse.papyrus.iotml</groupId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.iotml.architecture.tests</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+</project>
\ No newline at end of file
diff --git a/org.eclipse.papyrus.iotml.architecture.tests/test/org/eclipse/papyrus/iotml/architecture/tests/resources/ArchitectureValidationTest.java b/org.eclipse.papyrus.iotml.architecture.tests/test/org/eclipse/papyrus/iotml/architecture/tests/resources/ArchitectureValidationTest.java
new file mode 100644
index 0000000..5990702
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture.tests/test/org/eclipse/papyrus/iotml/architecture/tests/resources/ArchitectureValidationTest.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA and others.
+ *
+ * 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:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.iotml.architecture.tests.resources;
+
+import java.lang.reflect.Method;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.papyrus.infra.types.core.registries.ElementTypeSetConfigurationRegistry;
+import org.eclipse.papyrus.iotml.architecture.Activator;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Test the architecture model : - validate the model
+ *
+ */
+@SuppressWarnings("nls")
+public class ArchitectureValidationTest {
+
+ public static final String ARCHITECTURE_PATH = Activator.PLUGIN_ID+"/resources/iotml.architecture";
+
+ @BeforeClass
+ public static void loadElementTypeSet() {
+ ElementTypeSetConfigurationRegistry.getInstance();
+ }
+
+ /**
+ * Check that if an element has a field id then xmi:id should be the same
+ */
+ @Test
+ public void checkXMIIds() {
+ URI createPlatformPluginURI = URI.createPlatformPluginURI(ARCHITECTURE_PATH, true);
+ ResourceSetImpl resourceSetImpl = new ResourceSetImpl();
+ Resource resource = resourceSetImpl.getResource(createPlatformPluginURI, true);
+
+ TreeIterator<EObject> allContents = resource.getAllContents();
+ while (allContents.hasNext()) {
+ EObject eObject = (EObject) allContents.next();
+
+ String id = getId(eObject);
+ String xmiId = ((XMIResource) resource).getID(eObject);
+ if (id != null) {
+ Assert.assertEquals("Xmi id and id field should be the same", id, xmiId);
+ }
+ }
+ }
+
+ // SMALL hack to get id if present
+ // TODO: Would be nice to have an IIdentifiedElement interface in the MetaModel
+ public static String getId(Object obj) {
+ try {
+ Method method = obj.getClass().getMethod("getId");
+ if (method != null) {
+ return method.invoke(obj).toString();
+ }
+ } catch (Exception e) {
+ // doesn't matter
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.papyrus.iotml.architecture.tests/test/org/eclipse/papyrus/iotml/architecture/tests/resources/ModelValidationTest.java b/org.eclipse.papyrus.iotml.architecture.tests/test/org/eclipse/papyrus/iotml/architecture/tests/resources/ModelValidationTest.java
new file mode 100644
index 0000000..e9371e1
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture.tests/test/org/eclipse/papyrus/iotml/architecture/tests/resources/ModelValidationTest.java
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA and others.
+ *
+ * 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:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.iotml.architecture.tests.resources;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.Diagnostician;
+import org.eclipse.papyrus.infra.types.core.registries.ElementTypeSetConfigurationRegistry;
+import org.eclipse.papyrus.iotml.architecture.Activator;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * This is a parameterized test to validate all model in the plugin
+ *
+ */
+@SuppressWarnings("nls")
+@RunWith(Parameterized.class)
+public class ModelValidationTest {
+
+ @Parameters
+ public static Collection<Object[]> data() {
+ return Arrays.asList(new Object[][] {
+ {"/resources/iotml.architecture"},
+ });
+ }
+
+ private String modelPath;
+
+ public ModelValidationTest(String modelPath) {
+ this.modelPath = modelPath;
+ }
+
+ @BeforeClass
+ public static void loadElementTypeSet(){
+ ElementTypeSetConfigurationRegistry.getInstance();
+ }
+
+ /**
+ * Validate the model with the rules defined in the meta-model tooling
+ */
+ @Test
+ public void validateModel() {
+ String fullPath = Activator.PLUGIN_ID + this.modelPath;
+ URI modelPlatformURI = URI.createPlatformPluginURI(fullPath, true);
+ Resource resource = new ResourceSetImpl().getResource(modelPlatformURI, true);
+ Diagnostic diagnostic = Diagnostician.INSTANCE.validate(resource.getContents().get(0));
+ Assert.assertEquals("The "+modelPath+" model is invalid " +print(diagnostic), Diagnostic.OK, diagnostic.getSeverity());
+ }
+
+ // FIXME : Something should exist in API to do that
+ private String print(Diagnostic diagnostic) {
+ List<Diagnostic> children = diagnostic.getChildren();
+ StringBuilder stringBuilder = new StringBuilder(diagnostic.getMessage());
+ for (Diagnostic diagnosticChildren : children) {
+ stringBuilder.append("\n"); //$NON-NLS-1$
+ stringBuilder.append(diagnosticChildren.getMessage());
+ }
+ return stringBuilder.toString();
+ }
+
+}
diff --git a/org.eclipse.papyrus.iotml.architecture/.classpath b/org.eclipse.papyrus.iotml.architecture/.classpath
new file mode 100644
index 0000000..eca7bdb
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture/.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/org.eclipse.papyrus.iotml.architecture/.project b/org.eclipse.papyrus.iotml.architecture/.project
new file mode 100644
index 0000000..8dafdd1
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.iotml.architecture</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.papyrus.iotml.architecture/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.papyrus.iotml.architecture/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..0c68a61
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/org.eclipse.papyrus.iotml.architecture/META-INF/MANIFEST.MF b/org.eclipse.papyrus.iotml.architecture/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..6f4e7b4
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.iotml.architecture;singleton:=true
+Bundle-Version: 0.7.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.iotml.architecture.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.architecture,
+ org.eclipse.papyrus.infra.types.core;bundle-version="3.1.0",
+ org.eclipse.uml2.uml;bundle-version="5.3.0",
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="3.1.0",
+ org.eclipse.papyrus.iotml.profile,
+ org.eclipse.papyrus.uml.diagram.clazz;bundle-version="3.0.0",
+ org.eclipse.papyrus.infra.nattable.common;bundle-version="4.0.0",
+ org.eclipse.papyrus.uml.architecture;bundle-version="1.1.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.papyrus.iotml.architecture
+Bundle-Vendor: %Bundle-Vendor
diff --git a/org.eclipse.papyrus.iotml.architecture/OSGI-INF/l10n/bundle.properties b/org.eclipse.papyrus.iotml.architecture/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..dde7302
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2018 CEA.
+# 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:
+# Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - initial API and implementation
+##################################################################################
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = IoTML Architecture
\ No newline at end of file
diff --git a/org.eclipse.papyrus.iotml.architecture/build.properties b/org.eclipse.papyrus.iotml.architecture/build.properties
new file mode 100644
index 0000000..99c582e
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ resources/,\
+ OSGI-INF/
diff --git a/org.eclipse.papyrus.iotml.architecture/plugin.xml b/org.eclipse.papyrus.iotml.architecture/plugin.xml
new file mode 100644
index 0000000..cf738c5
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture/plugin.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension point="org.eclipse.papyrus.infra.architecture.models">
+ <model path="resources/iotml.architecture"/>
+ </extension>
+</plugin>
diff --git a/org.eclipse.papyrus.iotml.architecture/pom.xml b/org.eclipse.papyrus.iotml.architecture/pom.xml
new file mode 100644
index 0000000..0e43d62
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture/pom.xml
@@ -0,0 +1,11 @@
+<?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>
+ <artifactId>org.eclipse.papyrus.iotml.parent</artifactId>
+ <groupId>org.eclipse.papyrus.iotml</groupId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.iotml.architecture</artifactId>
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file
diff --git a/org.eclipse.papyrus.iotml.architecture/resources/iotml.architecture b/org.eclipse.papyrus.iotml.architecture/resources/iotml.architecture
new file mode 100644
index 0000000..10060b8
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture/resources/iotml.architecture
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<architecture:ArchitectureDomain xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" xmlns:gmfdiagrepresentation="http://www.eclipse.org/papyrus/infra/gmfdiag/representation" xmlns:nattablerepresentation="http://www.eclipse.org/papyrus/infra/nattable/representation" xmi:id="org.eclipse.papyrus.iotml.iotEngineering" id="org.eclipse.papyrus.iotml.iotEngineering" name="IoT Engineering" description="The domain of developing IoT" icon="platform:/plugin/org.eclipse.papyrus.uml.architecture/icons/domain.gif">
+ <contexts xsi:type="architecture:ArchitectureDescriptionLanguage" xmi:id="org.eclipse.papyrus.sysml.architecture.IoTML" id="org.eclipse.papyrus.sysml.architecture.IoTML" name="IoTML" description="The IoT Modeling Language" creationCommandClass="org.eclipse.papyrus.iotml.architecture.CreateIoTMLModelCommand">
+ <viewpoints xmi:id="org.eclipse.papyrus.iotml.standard.modeling" id="org.eclipse.papyrus.iotml.standard.modeling" name="Standard IoT Modeling" description="A viewpoint allowing standard modeling for IoT" icon="platform:/plugin/org.eclipse.papyrus.uml.architecture/icons/viewpoint.gif">
+ <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" href="#org.eclipse.papyrus.iotml.diagram.clazz"/>
+ </viewpoints>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.emf/model/infra-emf.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/model/gmfdiag-common.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/model/notation.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.nattable/model/nattable-tablecontents.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.nattable/model/nattable-tablecontext.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.nattable.common/model/nattable-common.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.services.controlmode/model/controlmode.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.services.edit/model/marker.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.types.rulebased/model/rulebased.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.elementtypesconfigurations#_x8G0YGaNEeSyJIsxLao1Pw"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.elementtypesconfigurations#_tL86sLazEeSbnofizoRSMQ"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.interactionoverview/model/interactionOverviewDiagram.elementtypesconfigurations#_x8G0YGaNEeSyJIsxLao1Pw"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.elementtypesconfigurations#_wYwtMMeDEeSwP_9Vn5UnWg"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.stereotype.edition/model/stereotype-edit.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram-uml.elementtypesconfigurations#_BJMa0PyeEeWbo9Y7g2MLdw"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/StandardProfile.elementtypesconfigurations#_jfoLkGT_EeSEqNuV3JpFCA"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/uml-containments.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/umldi.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/>
+ <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types.ui/model/uml-advice.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/>
+ <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="org.eclipse.papyrus.iotml.diagram.clazz" id="org.eclipse.papyrus.iotml.diagram.clazz" name="IoT Class Diagram" description="IoT Class Diagram" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.clazz/icons/obj16/Diagram_Class.gif" implementationID="PapyrusUMLClassDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand">
+ <modelRules xmi:id="_zzf4gXDtEeWh-MssWmCB_A">
+ <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
+ </modelRules>
+ <owningRules xmi:id="_zzf4gnDtEeWh-MssWmCB_A">
+ <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
+ </owningRules>
+ <childRules xmi:id="_zzf4g3DtEeWh-MssWmCB_A"/>
+ <palettes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.clazz/model/PapyrusUMLClassDiagram.paletteconfiguration#/"/>
+ </representationKinds>
+ <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
+ </contexts>
+</architecture:ArchitectureDomain>
diff --git a/org.eclipse.papyrus.iotml.architecture/src/org/eclipse/papyrus/iotml/architecture/Activator.java b/org.eclipse.papyrus.iotml.architecture/src/org/eclipse/papyrus/iotml/architecture/Activator.java
new file mode 100644
index 0000000..435d157
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture/src/org/eclipse/papyrus/iotml/architecture/Activator.java
@@ -0,0 +1,50 @@
+package org.eclipse.papyrus.iotml.architecture;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.iotml.architecture"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/org.eclipse.papyrus.iotml.architecture/src/org/eclipse/papyrus/iotml/architecture/CreateIoTMLModelCommand.java b/org.eclipse.papyrus.iotml.architecture/src/org/eclipse/papyrus/iotml/architecture/CreateIoTMLModelCommand.java
new file mode 100644
index 0000000..e2d62a7
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.architecture/src/org/eclipse/papyrus/iotml/architecture/CreateIoTMLModelCommand.java
@@ -0,0 +1,89 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA.
+ *
+ * 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:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.iotml.architecture;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.iotml.IoTMLResource;
+import org.eclipse.papyrus.sysml14.util.SysMLResource;
+import org.eclipse.papyrus.uml.diagram.common.commands.ModelCreationCommandBase;
+import org.eclipse.papyrus.uml.tools.utils.PackageUtil;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.PackageImport;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.resource.UMLResource;
+
+
+/**
+ */
+public class CreateIoTMLModelCommand extends ModelCreationCommandBase {
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#createRootElement()
+ *
+ * @return
+ */
+
+ @Override
+ protected EObject createRootElement() {
+ return UMLFactory.eINSTANCE.createModel();
+ }
+
+ /**
+ * A standard IoTML model should have :
+ * - the SysML profile applied
+ * - the UML standard profile applied
+ * - the UML primitive library imported
+ * - the SysML library imported
+ * - the Marte profile applied
+ * - the IoTML profile applied
+ *
+ * @param owner
+ */
+
+ @Override
+ protected void initializeModel(EObject owner) {
+ super.initializeModel(owner);
+ Package packageOwner = (Package) owner;
+
+ Profile standardUMLProfile = (Profile) PackageUtil.loadPackage(URI.createURI(UMLResource.STANDARD_PROFILE_URI), owner.eResource().getResourceSet());
+ if (standardUMLProfile != null) {
+ PackageUtil.applyProfile(packageOwner, standardUMLProfile, true);
+ }
+
+ Profile sysmlProfile = (Profile) PackageUtil.loadPackage(URI.createURI(SysMLResource.PROFILE_PATH), owner.eResource().getResourceSet());
+ if (sysmlProfile != null) {
+ PackageUtil.applyProfile(packageOwner, sysmlProfile, true);
+ }
+
+ Profile marteProfile = (Profile) PackageUtil.loadPackage(URI.createURI("platform:/plugin/org.eclipse.papyrus.marte.static.profile/resources/MARTE.profile.uml"), owner.eResource().getResourceSet());
+ if (marteProfile != null) {
+ PackageUtil.applyProfile(packageOwner, marteProfile, true);
+ }
+
+ Profile iotml = (Profile) PackageUtil.loadPackage(URI.createURI(IoTMLResource.PROFILE_PATH), owner.eResource().getResourceSet());
+ if (iotml != null) {
+ PackageUtil.applyProfile(packageOwner, iotml, true);
+ }
+
+
+ Package umlPrimitiveTypes = PackageUtil.loadPackage(URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI), owner.eResource().getResourceSet());
+ if (umlPrimitiveTypes != null){
+ PackageImport pi = UMLFactory.eINSTANCE.createPackageImport();
+ pi.setImportedPackage(umlPrimitiveTypes);
+ packageOwner.getPackageImports().add(pi);
+ }
+
+ }
+
+}
diff --git a/org.eclipse.papyrus.iotml.feature/feature.xml b/org.eclipse.papyrus.iotml.feature/feature.xml
index 35e31f6..6b14e14 100644
--- a/org.eclipse.papyrus.iotml.feature/feature.xml
+++ b/org.eclipse.papyrus.iotml.feature/feature.xml
@@ -36,6 +36,13 @@
install-size="0"
version="0.0.0"
unpack="false"/>
+
+ <plugin
+ id="org.eclipse.papyrus.iotml.architecture"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
<plugin
id="org.eclipse.papyrus.iotml.ui"
diff --git a/org.eclipse.papyrus.iotml.profile.tests/META-INF/MANIFEST.MF b/org.eclipse.papyrus.iotml.profile.tests/META-INF/MANIFEST.MF
index 8aa8a1d..00a3d6c 100644
--- a/org.eclipse.papyrus.iotml.profile.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.papyrus.iotml.profile.tests/META-INF/MANIFEST.MF
@@ -1,8 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Profile Tests
+Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.papyrus.iotml.profile.tests
Bundle-Version: 0.7.0.qualifier
Fragment-Host: org.eclipse.papyrus.iotml.profile;bundle-version="0.7.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.junit
+Bundle-Vendor: %Bundle-Vendor
diff --git a/org.eclipse.papyrus.iotml.profile.tests/OSGI-INF/l10n/bundle.properties b/org.eclipse.papyrus.iotml.profile.tests/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..02c7602
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.profile.tests/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2018 CEA.
+# 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:
+# Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - initial API and implementation
+##################################################################################
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = IoTML Profile Tests
\ No newline at end of file
diff --git a/org.eclipse.papyrus.iotml.profile.tests/build.properties b/org.eclipse.papyrus.iotml.profile.tests/build.properties
index e0715e4..b17d445 100644
--- a/org.eclipse.papyrus.iotml.profile.tests/build.properties
+++ b/org.eclipse.papyrus.iotml.profile.tests/build.properties
@@ -1,4 +1,5 @@
source.. = test/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ OSGI-INF/
diff --git a/org.eclipse.papyrus.iotml.profile.tests/test/org/eclipse/papyrus/iotml/tests/IotMLProfileTest.java b/org.eclipse.papyrus.iotml.profile.tests/test/org/eclipse/papyrus/iotml/tests/IotMLProfileTest.java
index db5bddf..ff726d3 100644
--- a/org.eclipse.papyrus.iotml.profile.tests/test/org/eclipse/papyrus/iotml/tests/IotMLProfileTest.java
+++ b/org.eclipse.papyrus.iotml.profile.tests/test/org/eclipse/papyrus/iotml/tests/IotMLProfileTest.java
@@ -13,6 +13,7 @@
*****************************************************************************/
package org.eclipse.papyrus.iotml.tests;
+import org.eclipse.papyrus.iotml.IoTMLResource;
import org.eclipse.uml2.uml.UMLPlugin;
import org.junit.Assert;
import org.junit.Test;
@@ -27,12 +28,12 @@
/**
* Check that we have a profile registered here :
- * "http://www.eclipse.org/papyrus/iotML/0.7/IotML"
+ * "http://www.eclipse.org/papyrus/iotML/0.7/IoTML"
*/
@Test
public void testProfilRegistration() {
Assert.assertNotNull(
- UMLPlugin.getEPackageNsURIToProfileLocationMap().get("http://www.eclipse.org/papyrus/iotML/0.7/IotML"));
+ UMLPlugin.getEPackageNsURIToProfileLocationMap().get(IoTMLResource.PROFILE_URI));
}
}
diff --git a/org.eclipse.papyrus.iotml.profile/META-INF/MANIFEST.MF b/org.eclipse.papyrus.iotml.profile/META-INF/MANIFEST.MF
index e00a8fe..e0d3a66 100644
--- a/org.eclipse.papyrus.iotml.profile/META-INF/MANIFEST.MF
+++ b/org.eclipse.papyrus.iotml.profile/META-INF/MANIFEST.MF
@@ -1,12 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
+Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.papyrus.iotml.profile;singleton:=true
Bundle-Version: 0.7.0.qualifier
Bundle-ClassPath: .
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package: org.eclipse.papyrus.iotml.Animate,
+Bundle-Vendor: %Bundle-Vendor
+Export-Package: org.eclipse.papyrus.iotml,
+ org.eclipse.papyrus.iotml.Animate,
org.eclipse.papyrus.iotml.Animate.impl,
org.eclipse.papyrus.iotml.Animate.util,
org.eclipse.papyrus.iotml.Hardware.Actuator,
diff --git a/org.eclipse.papyrus.iotml.profile/OSGI-INF/l10n/bundle.properties b/org.eclipse.papyrus.iotml.profile/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..dde7302
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.profile/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2018 CEA.
+# 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:
+# Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - initial API and implementation
+##################################################################################
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = IoTML Architecture
\ No newline at end of file
diff --git a/org.eclipse.papyrus.iotml.profile/build.properties b/org.eclipse.papyrus.iotml.profile/build.properties
index f7cd8a9..1939160 100644
--- a/org.eclipse.papyrus.iotml.profile/build.properties
+++ b/org.eclipse.papyrus.iotml.profile/build.properties
@@ -4,7 +4,7 @@
model/,\
META-INF/,\
plugin.xml,\
- plugin.properties
+ OSGI-INF/
jars.compile.order = .
source.. = src/,\
src-gen/
diff --git a/org.eclipse.papyrus.iotml.profile/model/IoT-ML.profile.di b/org.eclipse.papyrus.iotml.profile/model/IoT-ML.profile.di
index bf9abab..247ed5e 100644
--- a/org.eclipse.papyrus.iotml.profile/model/IoT-ML.profile.di
+++ b/org.eclipse.papyrus.iotml.profile/model/IoT-ML.profile.di
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"/>
+<architecture:ArchitectureDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" contextId="org.eclipse.papyrus.uml.architecture.Profile"/>
diff --git a/org.eclipse.papyrus.iotml.profile/plugin.properties b/org.eclipse.papyrus.iotml.profile/plugin.properties
deleted file mode 100644
index 9a23b16..0000000
--- a/org.eclipse.papyrus.iotml.profile/plugin.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-
-pluginName = IoT-ML Model
-providerName = Eclipse Modeling Project
diff --git a/org.eclipse.papyrus.iotml.profile/plugin.xml b/org.eclipse.papyrus.iotml.profile/plugin.xml
index a48cb20..cb1ccc0 100644
--- a/org.eclipse.papyrus.iotml.profile/plugin.xml
+++ b/org.eclipse.papyrus.iotml.profile/plugin.xml
@@ -89,7 +89,7 @@
<extension point="org.eclipse.uml2.uml.generated_package">
- <profile uri="http://www.eclipse.org/papyrus/iotML/0.7/IotML"
+ <profile uri="http://www.eclipse.org/papyrus/iotML/0.7/IoTML"
location="pathmap://IOTML_PROFILE/IoT-ML.profile.uml#IoT-ML"/>
</extension>
diff --git a/org.eclipse.papyrus.iotml.profile/src/org/eclipse/papyrus/iotml/IoTMLResource.java b/org.eclipse.papyrus.iotml.profile/src/org/eclipse/papyrus/iotml/IoTMLResource.java
new file mode 100644
index 0000000..2b0ec7b
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.profile/src/org/eclipse/papyrus/iotml/IoTMLResource.java
@@ -0,0 +1,158 @@
+/*****************************************************************************
+ * Copyright (c) 2018 CEA.
+ *
+ * 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:
+ * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.iotml;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.sysml14.util.SysMLResource;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Model;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.UMLFactory;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.resource.UMLResource;
+
+/**
+ * Utility class to get informations on IoT resources
+ */
+public final class IoTMLResource {
+
+ public static final String PROFILES_PATHMAP = "pathmap://IOTML_PROFILE/"; //$NON-NLS-1$
+
+ public static final String PROFILE_PATH = PROFILES_PATHMAP+"IoT-ML.profile.uml"; //$NON-NLS-1$
+
+ public static final String PROFILE_URI = "http://www.eclipse.org/papyrus/iotML/0.7/IoTML"; //$NON-NLS-1$
+
+ private static final String UNNAMED = "unnamed"; //$NON-NLS-1$
+
+ private IoTMLResource(){
+ }
+
+ /**
+ * Creates a model with IoTML profile applied
+ *
+ * @param resourceSet
+ * the resource set in which to create the model
+ * @return the created model
+ */
+ public static Model createIoTMLModel(ResourceSet resourceSet) {//, String modelName
+ return createIoTMLModel(resourceSet, UNNAMED+"."+UMLResource.FILE_EXTENSION, UNNAMED); //$NON-NLS-1$
+ }
+
+ /**
+ * Creates a IoTML model with SysML, Marte and IoTML profiles applied
+ *
+ * @param resourceSet the resource set in which to create the model
+ * @param resourceName name of the resource
+ * @param modelName name of the model
+ * @return the created model
+ */
+ public static Model createIoTMLModel(ResourceSet resourceSet, String resourceName, String modelName) {
+ Model model = UMLFactory.eINSTANCE.createModel();
+ model.setName(modelName);
+ Resource resource = resourceSet.createResource(URI.createURI(resourceName));
+ resource.getContents().add(model);
+ // Apply UML Standard profile
+ // Retrieve standard profile
+ Resource standardProfileResource = resourceSet.getResource(URI.createURI(UMLResource.STANDARD_PROFILE_URI), true);
+ Profile umlStdProfile = (Profile) EcoreUtil.getObjectByType(standardProfileResource.getContents(), UMLPackage.Literals.PACKAGE);
+ // Apply to the model
+ model.applyProfile(umlStdProfile);
+
+ // Retrieve and apply SysML profile
+ Resource sysmlProfileResource = resourceSet.getResource(URI.createURI(SysMLResource.PROFILE_PATH), true);
+ Profile sysmlProfile = (Profile) EcoreUtil.getObjectByType(sysmlProfileResource.getContents(), UMLPackage.Literals.PACKAGE);
+ model.applyProfile(sysmlProfile);
+
+ // Retrieve and apply Marte profile
+ Resource marteProfileResource = resourceSet.getResource(URI.createURI("platform:/plugin/org.eclipse.papyrus.marte.static/resources/MARTE.profile.uml"), true);
+ Profile marteProfile = (Profile) EcoreUtil.getObjectByType(marteProfileResource.getContents(), UMLPackage.Literals.PACKAGE);
+ model.applyProfile(marteProfile);
+
+ // Retrieve and apply IoTML profile
+ Resource iotMLProfileResource = resourceSet.getResource(URI.createURI(IoTMLResource.PROFILE_PATH), true);
+ Profile iotProfile = (Profile) EcoreUtil.getObjectByType(iotMLProfileResource.getContents(), UMLPackage.Literals.PACKAGE);
+ model.applyProfile(iotProfile);
+
+ return model;
+ }
+
+ /**
+ * Recursive function
+ * @param element the initial uml2 element
+ * @param profileLookup the profile we are looking for
+ * @return a package, a model profiled by IoTML or null
+ */
+ public static Package getFirstMatchingContainerProfiledByIoTMLProfile(Element element){
+ return getFirstMatchingContainerProfiledBy(element,IoTMLResource.PROFILE_URI);
+ }
+
+ /**
+ * Recursive function
+ * @param element the initial uml2 element
+ * @param profileUri the profile we are looking for
+ * @return a package, a model or null
+ */
+ public static Package getFirstMatchingContainerProfiledBy(Element element, String profileUri){
+ if(element instanceof Package){
+ Package pakage = (Package)element;
+
+ EList<Profile> appliedProfiles = pakage.getAppliedProfiles();
+ if (appliedProfiles!=null){
+ for (Profile appliedProfile : appliedProfiles) {
+ //as soon as we match with the profile we return true
+ if(appliedProfile.getURI()!=null && appliedProfile.getURI().compareTo(profileUri)==0){
+ return pakage;
+ }
+ }
+ }
+
+ Element elementOwner = element.getOwner();
+ if(elementOwner!=null){
+ return getFirstMatchingContainerProfiledBy(elementOwner, profileUri);
+ }
+ }
+ //If no match then look at the nearest package
+ if(element!=null){
+ Package myNearestPackage = element.getNearestPackage();
+ if(myNearestPackage!=element){
+ return getFirstMatchingContainerProfiledBy(myNearestPackage, profileUri);
+ }
+ }
+ //If we are here, it means we have no lookuped profile attached at one container of our element.
+ return null;
+ }
+
+
+ /**
+ * @param element
+ * @return true if the element is profiled with SysML profile
+ */
+ public static boolean isIoTMLProfileApplied(Element element){
+ return isProfiledByProfile(element,IoTMLResource.PROFILE_URI);
+ }
+
+
+ /**
+ * @param element
+ * @param profileUri
+ * @return true if the element is profiled by the given profileUri
+ */
+ public static boolean isProfiledByProfile(Element element, String profileUri){
+ return getFirstMatchingContainerProfiledBy(element,profileUri)!=null;
+ }
+}
diff --git a/org.eclipse.papyrus.iotml.ui/META-INF/MANIFEST.MF b/org.eclipse.papyrus.iotml.ui/META-INF/MANIFEST.MF
index aae2052..dd5b8fd 100644
--- a/org.eclipse.papyrus.iotml.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.papyrus.iotml.ui/META-INF/MANIFEST.MF
@@ -1,8 +1,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: IoTML UI
+Bundle-Name: %Bundle-Name
Bundle-SymbolicName: org.eclipse.papyrus.iotml.ui;singleton:=true
Bundle-Version: 0.7.0.qualifier
-Bundle-Vendor: Eclipse Modeling Project
+Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.3.0"
diff --git a/org.eclipse.papyrus.iotml.ui/OSGI-INF/l10n/bundle.properties b/org.eclipse.papyrus.iotml.ui/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 0000000..f29440f
--- /dev/null
+++ b/org.eclipse.papyrus.iotml.ui/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2018 CEA.
+# 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:
+# Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - initial API and implementation
+##################################################################################
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = IoTML UI
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index f753b84..7d5a834 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,6 +21,8 @@
<modules>
<module>org.eclipse.papyrus.iotml.profile</module>
<module>org.eclipse.papyrus.iotml.profile.tests</module>
+ <module>org.eclipse.papyrus.iotml.architecture</module>
+ <module>org.eclipse.papyrus.iotml.architecture.tests</module>
<module>org.eclipse.papyrus.iotml.ui</module>
<module>org.eclipse.papyrus.iotml.targetplatform.oxygen</module>
<module>org.eclipse.papyrus.iotml.feature</module>