Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add consistency perservation rules between smart home systems and uml #295

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions bundles/tools.vitruv.applications.smarthomeuml/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>
51 changes: 51 additions & 0 deletions bundles/tools.vitruv.applications.smarthomeuml/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tools.vitruv.applications.smarthomeuml</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
<filteredResources>
<filter>
<id>1720168160022</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Smarthomeuml
Bundle-SymbolicName: tools.vitruv.applications.smarthomeuml;singleton:=true
Bundle-Version: 3.0.1.qualifier
Bundle-Vendor: vitruv.tools
Export-Package: tools.vitruv.applications.smarthomeuml
Automatic-Module-Name: tools.vitruv.applications.smarthomeuml
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: edu.kit.ipd.sdq.metamodels.smarthome;visibility:=reexport,
org.eclipse.uml2.uml;visibility:=reexport,
tools.vitruv.framework.applications,
tools.vitruv.dsls.reactions.runtime
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
source.. = src/,\
src-gen/,\
xtend-gen/
output.. = target/classes/
bin.includes = META-INF/,\
.,\
plugin.xml
16 changes: 16 additions & 0 deletions bundles/tools.vitruv.applications.smarthomeuml/plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>

<!--
-->

<plugin>
<extension
id="SmartHomeUMLApplication"
name="SmartHome-UML Application"
point="tools.vitruv.framework.applications.application">
<application
class="tools.vitruv.applications.smarthomeuml.SmartHomeUMLApplication"></application>
</extension>

</plugin>
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import org.eclipse.emf.common.util.URI
import edu.kit.ipd.sdq.metamodels.smarthome.SmarthomePackage
import org.eclipse.uml2.uml.UMLPackage
import edu.kit.ipd.sdq.metamodels.smarthome.impl.SmarthomeFactoryImpl

import "http://www.eclipse.org/uml2/5.0.0/UML" as uml
import "edu.kit.ipd.sdq.metamodels.smarthome" as smarthome

reactions: smarthomeToUml
in reaction to changes in smarthome
execute actions in uml

reaction SystemArchitectureCreation {
after element smarthome::SmartHomeSystem created
call createUmlModel(affectedEObject)
}

routine createUmlModel(smarthome::SmartHomeSystem smartHomeSystem) {
match {
require absence of uml::Model corresponding to smartHomeSystem
}
create {
val model = new uml::Model
}
update {
addCorrespondenceBetween(smartHomeSystem, model)
addCorrespondenceBetween(SmarthomePackage.eINSTANCE, smartHomeSystem)
addCorrespondenceBetween(UMLPackage.eINSTANCE, model)
model.URI = smartHomeSystem.eResource.URI.appendFileExtension("uml").toString
var res = smartHomeSystem.eResource.resourceSet.createResource(URI.createURI(model.URI))
res.contents.add(model)
createComponentUmlInterface()
createProtocolUmlInterface(smartHomeSystem)
}
}


routine createProtocolUmlInterface(smarthome::SmartHomeSystem smartHomeSystem) {
match {
// require absence of uml::Action corresponding to service
val model = retrieve uml::Model corresponding to UMLPackage.eINSTANCE
}
create {
val interf = new uml::Interface
}
update {
addCorrespondenceBetween(smartHomeSystem, interf)
model.packagedElements += interf
}
}

routine createComponentUmlInterface() {
match {
// require absence of uml::Action corresponding to service
val model = retrieve uml::Model corresponding to UMLPackage.eINSTANCE
}
create {
val interf = new uml::Interface
}
update {
val smartHomeFactory = SmarthomeFactoryImpl.init()
val component = smartHomeFactory.createComponent()
addCorrespondenceBetween(component, interf)
model.packagedElements += interf
}
}

reaction DeviceInserted {
after element smarthome::Device inserted in smarthome::SmartHomeSystem[components]
call {
createDeviceUmlClass(newValue)
}
}

routine createDeviceUmlClass(smarthome::Device device) {
match {
// require absence of uml::Action corresponding to service
val model = retrieve uml::Model corresponding to UMLPackage.eINSTANCE
}
create {
val class = new uml::Class
}
update {
addCorrespondenceBetween(device, class)
model.packagedElements += class
}
}

reaction ServerInserted {
after element smarthome::Server inserted in smarthome::SmartHomeSystem[components]
call {
createServerUmlClass(newValue)
}
}

routine createServerUmlClass(smarthome::Server server) {
match {
// require absence of uml::Action corresponding to service
val model = retrieve uml::Model corresponding to UMLPackage.eINSTANCE
}
create {
val class = new uml::Class
}
update {
addCorrespondenceBetween(server, class)
model.packagedElements += class
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package tools.vitruv.applications.smarthomeuml

class SmarthomeToUmlChangePropagationSpecification extends mir.reactions.smarthomeToUml.SmarthomeToUmlChangePropagationSpecification {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package tools.vitruv.applications.smarthomeuml;

import java.util.HashSet;
import java.util.Set;

import tools.vitruv.change.propagation.ChangePropagationSpecification;
import tools.vitruv.framework.applications.VitruvApplication;

import tools.vitruv.applications.smarthomeuml.*;

public class SmarthomeUmlApplication implements VitruvApplication{

@Override
public Set<ChangePropagationSpecification> getChangePropagationSpecifications() {
Set<ChangePropagationSpecification> specs = new HashSet<ChangePropagationSpecification>();
specs.add(new SmarthomeToUmlChangePropagationSpecification());
// specs.add(new CombinedUmlClassToPcmReactionsChangePropagationSpecification());
return specs;
}

@Override
public String getName() {
return "Smarthome <-> UML Class";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>tools.vitruv.applications.smarthomeuml.feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
<filteredResources>
<filter>
<id>1720168160024</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin.includes = feature.xml,\
feature.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
featureName=Vitruv SmartHome-UML Application
description=A Vitruv application for SmartHome and UML models
providerName=vitruv.tools
copyrightURL=http://vitruv.tools
copyright=\
Copyright (c) 2014-2022 Vitruv Tools Team\n\
Karlsruhe Institute of Technology (KIT), Karlsruhe, Germany
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="tools.vitruv.applications.smarthomeuml.feature"
label="%featureName"
version="3.0.1.qualifier"
provider-name="%providerName"
license-feature="tools.vitruv.license.feature"
license-feature-version="1.0.0">

<description>
%description
</description>

<copyright url="%copyrightURL">
%copyright
</copyright>

<license url="%licenseURL">
%license
</license>

<requires>
<import plugin="edu.kit.ipd.sdq.activextendannotations"/>
<import plugin="tools.vitruv.framework.applications"/>
<import plugin="tools.vitruv.dsls.reactions.runtime"/>
<import plugin="tools.vitruv.applications.util.temporary"/>
<import feature="tools.vitruv.applications.util.temporary.feature"/>
<import plugin="org.eclipse.uml2.uml"/>
<import plugin="org.emftext.language.java"/>
<import plugin="edu.kit.ipd.sdq.commons.util.emf"/>
<import plugin="edu.kit.ipd.sdq.commons.util.java"/>
<import plugin="edu.kit.ipd.sdq.metamodels.smarthome"/>
</requires>

<plugin
id="tools.vitruv.applications.smarthomeuml"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>

</feature>
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ Require-Bundle: tools.vitruv.dsls.reactions,
tools.vitruv.dsls.demo.insurancepersons,
edu.kit.ipd.sdq.metamodels.autosar,
edu.kit.ipd.sdq.metamodels.simulink,
edu.kit.ipd.sdq.metamodels.smarthome,
tools.vitruv.dsls.demo.insurancepersons.tests
Bundle-Vendor: tools.vitruv
15 changes: 14 additions & 1 deletion releng/tools.vitruv.casestudies.parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<vitruv.change.url>https://vitruv-tools.github.io/updatesite/nightly/change</vitruv.change.url>
<vitruv.framework.url>https://vitruv-tools.github.io/updatesite/nightly/framework</vitruv.framework.url>
<vitruv.dsls.url>https://vitruv-tools.github.io/updatesite/nightly/dsls</vitruv.dsls.url>
<kit-sdq.demometamodels.url>https://kit-sdq.github.io/updatesite/release/metamodels/demo/${sdq.demometamodels.version}</kit-sdq.demometamodels.url>
</properties>

<repositories>
Expand All @@ -39,7 +40,7 @@
<repository>
<id>Demo Metamodels</id>
<layout>p2</layout>
<url>https://kit-sdq.github.io/updatesite/release/metamodels/demo/${sdq.demometamodels.version}</url>
<url>${kit-sdq.demometamodels.url}</url>
</repository>
<repository>
<id>SDQ Commons</id>
Expand Down Expand Up @@ -123,6 +124,18 @@
</properties>
</profile>

<profile>
<id>local-demometamodels</id>
<activation>
<property>
<name>kit-sdq.demometamodels.path</name>
</property>
</activation>
<properties>
<kit-sdq.demometamodels.url>file:///${kit-sdq.demometamodels.path}/releng/edu.kit.ipd.sdq.metamodels.demo.updatesite/target/repository</kit-sdq.demometamodels.url>
</properties>
</profile>

<profile>
<id>compile-dsls</id>
<activation>
Expand Down
Loading
Loading