Commit 1b4840d5 authored by Lars Hermerschmidt's avatar Lars Hermerschmidt

working generator setup

parent 4c7f334b
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>generator</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
<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>de.se_rwth.montisecarc</groupId>
<artifactId>montiSecArcGenerator</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>generator</artifactId>
<properties>
<!-- <monticore.version>2.0.6</monticore.version> -->
<!-- <umlp.version>1.6.0</umlp.version> -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<mainClass>timeTest.StartClientTest</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>de.se_rwth.montisecarc</groupId>
<version>0.0.3-SNAPSHOT</version>
<artifactId>montiSecArcBE</artifactId>
</dependency>
<dependency>
<groupId>de.se_rwth.montisecarc</groupId>
<artifactId>montiSecArcFE</artifactId>
<version>0.0.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>de.monticore.lang.common</groupId>
<artifactId>common-values</artifactId>
<version>1.9.0</version>
</dependency>
<!-- .. MontiCore .................................................... -->
<dependency>
<groupId>de.monticore</groupId>
<artifactId>de.monticore.re</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>de.monticore.ets</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>de.monticore.gli</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>de.monticore.freemarker</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>de.monticore.java</artifactId>
<version>${monticore.version}</version>
</dependency>
<!-- UML/P Languages -->
<!-- <dependency> -->
<!-- <groupId>de.monticore.lang.umlp</groupId> -->
<!-- <artifactId>de.umlp.fe</artifactId> -->
<!-- <version>${umlp.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>de.monticore.lang.umlp</groupId> -->
<!-- <artifactId>de.umlp.cdjava.fe</artifactId> -->
<!-- <version>${umlp.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>de.monticore.lang.umlp</groupId> -->
<!-- <artifactId>de.umlp.odjava.fe</artifactId> -->
<!-- <version>${umlp.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>de.monticore.lang.umlp</groupId> -->
<!-- <artifactId>de.umlp.scjava.fe</artifactId> -->
<!-- <version>${umlp.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>de.monticore.lang.umlp</groupId> -->
<!-- <artifactId>de.umlp.sdjava.fe</artifactId> -->
<!-- <version>${umlp.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>de.monticore.lang.umlp</groupId> -->
<!-- <artifactId>de.umlp.tcjava.fe</artifactId> -->
<!-- <version>${umlp.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>de.monticore.lang.umlp</groupId> -->
<!-- <artifactId>de.umlp.ocl.fe</artifactId> -->
<!-- <version>${umlp.version}</version> -->
<!-- </dependency> -->
</dependencies>
</project>
[main]
passwordMatcher = org.apache.shiro.authc.credential.PasswordMatcher
passwordService = org.apache.shiro.authc.credential.DefaultPasswordService
passwordMatcher.passwordService = $passwordService
iniRealm.credentialsMatcher = $passwordMatcher
[users]
# user 'example' with password 'fooPassword' and the 'barRole' role
#example = fooPassword, barRole, noRoleDefined
# default User for login on connections without identity link
defaultUser = $shiro1$SHA-256$500000$cOrGwJyTzzWi2awUp2bcAA==$X/g+HElIYfQxhl+QEs458k0iGPlhOfFGwem9rQnmQNQ=, noRoleDefined
userA = $shiro1$SHA-256$500000$U0vgy5/uFpnN0aoHF32LXg==$Ka2jfaysz2en5UN1T44B95Ei7PRFF1feylRy+HA5jS4=, roleX, roleY
userB = $shiro1$SHA-256$500000$XS5KJYAi+knTto1pR7XZaQ==$Agm5uxYQifCC4FCoA77FIG/kJ++3IWxOwSCQO6qmZE8=, roleX
userC = $shiro1$SHA-256$500000$2bi6KJZziInksNcB/DT0Kw==$y0SefRRsORx4Uy5bLPlXOyW4sgOoQ6+PIc1hGzfNKdo=, roleY
[roles]
roleX = secarc_usability_ExampleModell_TimeTest_TimeTestB_ttBFirstIn
roleY = secarc_usability_ExampleModell_TimeTest_TimeTestB_ttBSecondIn
noRoleDefined = nothing
# 'barRole' role has permissions on port 1025 and 1026
#barRole = 1025, 1026:*
<#if op.callCalculator("secarc.gen.FindClients")></#if>
package ${packageName};
import java.io.IOException;
import java.net.Socket;
import constants.PortMap;
import connectionBasic.client.*;
public class ${ast.getName()}_Client extends Client{
<#list allTargets as fti>
<#if fti.getIdentity()>
<#-- an dieser Stelle kann mit fti.getEncrypted() entschieden werden, ob die Verbindung mit SSL erstellt werden müsste-->
public final Socket connect_${fti.getName()}_${fti.getPort()}(String inName, String inPassword)throws IOException{
PortMap pm = new PortMap();
return openConnection("${fti.getIp()}", pm.getPort("${fti.getFullPortName()}"), inName, inPassword);
}
<#else>
public final Socket connect_${fti.getName()}_${fti.getPort()}()throws IOException{
PortMap pm = new PortMap();
return openConnection("${fti.getIp()}", pm.getPort("${fti.getFullPortName()}"));
}
</#if>
</#list>
}
<#if op.callCalculator("secarc.gen.FindIniInfo")></#if>
[main]
passwordMatcher = org.apache.shiro.authc.credential.PasswordMatcher
passwordService = org.apache.shiro.authc.credential.DefaultPasswordService
passwordMatcher.passwordService = $passwordService
iniRealm.credentialsMatcher = $passwordMatcher
[users]
# user 'example' with password 'fooPassword' and the 'barRole' role
#example = fooPassword, barRole, noRoleDefined
# default User for login on connections without identity link
defaultUser = $shiro1$SHA-256$500000$cOrGwJyTzzWi2awUp2bcAA==$X/g+HElIYfQxhl+QEs458k0iGPlhOfFGwem9rQnmQNQ=, noRoleDefined
[roles]
<#list roles as role>
${role}
</#list>
# 'barRole' role has permissions on port 1025 and 1026
#barRole = 1025, 1026:*
<#if op.callCalculator("secarc.gen.FindPorts")></#if>
package constants;
import java.util.HashMap;
import java.util.Map.Entry;
import connectionBasic.server.PortMapInterface;
public class PortMap implements PortMapInterface {
private static final HashMap<String, Integer> actualPortMap = new HashMap<String, Integer>() {
{
<#list portList as port>
put("${port}", ${(port_index + 1025)?c});
</#list>
}
};
public int getPort(String PortName){
return actualPortMap.get(PortName);
}
public String getName(int portNumber){
for(Entry<String, Integer> entry : actualPortMap.entrySet()){
if(portNumber == entry.getValue()){
return entry.getKey();
}
}
return null;
}
}
\ No newline at end of file
<#if op.callCalculator("secarc.gen.FindServer")></#if>
package ${packageName};
import constants.PortMap;
import connectionBasic.server.*;
public class ${ast.getName()}_Server extends Server {
public ${ast.getName()}_Server(){
PortMap pm = new PortMap();
<#list incommingPorts as port>
listenPorts.add(pm.getPort("${port}"));
</#list>
}
}
\ No newline at end of file
<#-- Disable Java Comments-->
${op.setTracing(false)}
<#-- Erstellen der PortMap (einmalig bei äußerster Komponente) -->
<#if !ast.isInnerComponent()>
${op.callTemplates(
"tls.CreatePortMap",
"constants.PortMap",
"java",
ast)}
</#if>
<#if op.callCalculator("secarc.gen.ServerNeeded")>
${op.callTemplates(
"tls.CreateServer",
ast.printQualifiedName()+"."+ast.getName()+"_Server",
"java",
ast)}
${op.callTemplates(
"tls.CreateIni",
ast.printQualifiedName()+".shiro",
"ini",
ast)}
</#if>
<#if op.callCalculator("secarc.gen.ClientNeeded")>
${op.callTemplates(
"tls.CreateClient",
ast.printQualifiedName()+"."+ast.getName()+"_Client",
"java",
ast)}
</#if>
\ No newline at end of file
package secarc.usability;
component Haus {
accesscontrol off;
identity weak steuerDeinHaus -> waschmaschine;
identity weak steuerDeinHaus -> multimedia;
identity weak steuerDeinHaus -> kuehlschrank;
connect steuerDeinHaus.essen -> kuehlschrank.allesAufessen;
connect steuerDeinHaus.einkaufen -> kuehlschrank.anliefern;
connect steuerDeinHaus.mediaNutzung -> multimedia.steuern;
connect steuerDeinHaus.waschen -> waschmaschine.befuellen;
connect steuerDeinHaus.waescheAufhaengen -> waschmaschine.leeren;
component App steuerDeinHaus {
port out String essen;
port out String mediaNutzung;
port out String waschen;
port out String einkaufen;
port out String waescheAufhaengen;
}
component Waschmaschine waschmaschine{
access bewohner;
access befuellen (bewohner, putzfrau);
port in String befuellen;
port in String leeren;
}
component Multimedia multimedia{
access bewohner;
port in String steuern;
connect pc.streaming -> tv.stream;
component Fernseher tv{
port in String stream;
}
component Computer pc{
port out String streaming;
}
}
component Kuehlschrank kuehlschrank{
access bewohner;
access anliefern (bewohner, lieferant);
port in String anliefern;
port in String allesAufessen;
}
}
\ No newline at end of file
<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>de.se_rwth.montisecarc</groupId>
<artifactId>montiSecArcGenerator-example</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>generator-example</artifactId>
<properties>
<!-- <monticore.version>2.0.6</monticore.version> -->
<!-- <umlp.version>1.6.0</umlp.version> -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<mainClass>timeTest.StartClientTest</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>1.2.3</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>de.se_rwth.montisecarc</groupId>
<!-- <version>0.0.3-SNAPSHOT</version>-->
<artifactId>montiSecArcBE</artifactId>
</dependency>
<dependency>
<groupId>de.se_rwth.montisecarc</groupId>
<artifactId>montiSecArcFE</artifactId>
<!-- <version>0.0.3-SNAPSHOT</version>-->
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>de.monticore.lang.common</groupId>
<artifactId>common-values</artifactId>
<version>1.9.0</version>
</dependency>
<!-- .. MontiCore .................................................... -->
<dependency>
<groupId>de.monticore</groupId>
<artifactId>de.monticore.re</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>de.monticore.ets</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>de.monticore.gli</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>de.monticore.freemarker</artifactId>
<version>${monticore.version}</version>
</dependency>
<dependency>
<groupId>de.monticore</groupId>
<artifactId>de.monticore.java</artifactId>
<version>${monticore.version}</version>
</dependency>
<!-- UML/P Languages -->
<!-- <dependency> -->
<!-- <groupId>de.monticore.lang.umlp</groupId> -->
<!-- <artifactId>de.umlp.fe</artifactId> -->
<!-- <version>${umlp.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>de.monticore.lang.umlp</groupId> -->
<!-- <artifactId>de.umlp.cdjava.fe</artifactId> -->
<!-- <version>${umlp.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>de.monticore.lang.umlp</groupId> -->
<!-- <artifactId>de.umlp.odjava.fe</artifactId> -->
<!-- <version>${umlp.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>de.monticore.lang.umlp</groupId> -->
<!-- <artifactId>de.umlp.scjava.fe</artifactId> -->
<!-- <version>${umlp.version}</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>de.monticore.lang.umlp</groupId> -->
<!-- <artifactId>de.umlp.sdjava.fe</artifactId> -->