Aufgrund einer Wartung wird GitLab am 21.09. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 21.09. between 8:00 and 9:00 am.

Commit 5db3a778 authored by Paff's avatar Paff
Browse files

running example without security elements

qulifier for imports
parent 637cb4f3
......@@ -12,13 +12,8 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/main/generated-sources"/>
<classpathentry kind="src" path="src/main/generated-resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
......@@ -29,16 +24,5 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/grammars">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="target/generated-sources/monticore/sourcecode">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
/**
* Generated on Thu Sep 18 17:44:55 CEST 2014
*/
config {
Require-Model:
"/home/user/.m2/repository/de/monticore/de.monticore.java.lib/3.1.1/de.monticore.java.lib-3.1.1-symbols.jar",
"/home/user/workspace/arcdFE-Head/src/main/grammars"
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ package secarc;
import com.google.inject.Inject;
import mc.umlp.arc.ets.check.MonitArcCheckSymbolsExistVisitor;
import mc.umlp.arc.ets.qualifier.MontiArcModelNameQualifierClient;
import mc.umlp.arcd.ets.deserializers.ArcdFieldEntryDeserializer;
import mc.umlp.arcd.ets.deserializers.ArcdTypeEntryDeserializer;
......@@ -39,6 +40,7 @@ import secarc.ets.deserializers.TrustlevelEntryDeserializer;
import secarc.ets.deserializers.TrustlevelRelationEntryDeserializer;
import secarc.ets.deserializers.CPEEntryDeserializer;
import secarc.ets.entries.SecComponentEntry;
import secarc.ets.qualifier.MontiSecArcModelNameQualifierClient;
import secarc.ets.resolvers.RoleResolverClient;
import secarc.ets.resolvers.ConfigurationResolverClient;
import secarc.ets.resolvers.FilterResolverClient;
......@@ -93,6 +95,7 @@ public class MontiSecArcComponent extends LanguageComponent {
addDeserializer(new TrustlevelEntryDeserializer(arcdFactory));
addDeserializer(new CPEEntryDeserializer(arcdFactory));
addDeserializer(new TrustlevelRelationEntryDeserializer(arcdFactory));
addQualifierClient(new ComponentQualifier());
addQualifierClient(new ArcdTypeQualifier());
addQualifierClient(new ReferenceQualifier());
......@@ -118,6 +121,9 @@ public class MontiSecArcComponent extends LanguageComponent {
addModelNameQualifierClient(new MontiArcModelNameQualifierClient());
addModelNameQualifierClient(new ArcdModelNameQualifierClient());
addModelNameQualifierClient(new MontiSecArcModelNameQualifierClient());
addCheckWorkflowClient(new MonitArcCheckSymbolsExistVisitor());
addCheckWorkflowClient(new MontiSecArcCheckVisitor());
//Context conditions MontiSecArc, MontiArc and Arcd
......
......@@ -24,9 +24,13 @@ import secarc.ets.entries.CPEEntryFactory;
import secarc.ets.visitor.MontiSecArcSymtabVisitor;
import interfaces2.language.ILanguage;
import interfaces2.language.LanguageComponent;
import interfaces2.language.LanguageFamily;
import interfaces2.language.ModelingLanguage;
import interfaces2.workflows.ConcreteASTAndNameSpaceVisitor;
import mc.umlp.arc.CompositeMontiArcAndJavaLanguage;
import mc.umlp.arc.MontiArcDefaultModule;
import mc.umlp.arc.MontiArcLanguage;
import mc.umlp.arc.MontiArcLanguageFamilyFactory;
import mc.umlp.arcd.ets.entries.IArcdEntryFactory;
import mc.umlp.arcd.ets.entries.IComponentEntryFactory;
import mc.umlp.arcd.ets.entries.IConnectorEntryFactory;
......
......@@ -12,6 +12,7 @@ import secarc.ets.check.MontiSecArcContextConditionCreator;
import interfaces2.language.ETSTool;
import interfaces2.language.LanguageFamily;
import mc.MCG;
import mc.umlp.arc.MontiArcLanguageFamilyFactory;
import mc.umlp.arcd.InjectorProvider;
/**
......@@ -52,8 +53,7 @@ public class MontiSecArcTool extends ETSTool {
Injector injector = Guice.createInjector(new MontiSecArcDefaultModule());
InjectorProvider.setInjector(injector);
LanguageFamily languageFamily = new LanguageFamily();
languageFamily.addLanguage(MontiSecArc.newLanguage(injector.getInstance(MontiSecArcComponent.class)));
LanguageFamily languageFamily = MontiArcLanguageFamilyFactory.create(MontiSecArc.newLanguage(injector.getInstance(MontiSecArcComponent.class)));
setLanguages(languageFamily);
// set default CoCos
......
......@@ -103,14 +103,14 @@ public class ASTSecArcFilterComponent extends PrototypeASTSecArcFilterComponent{
//Critical ports from ports
for(ASTArcPort port : this.getPorts()) {
if(((ASTSecArcPort) port).isCritical()) {
if(port instanceof ASTSecArcPort && ((ASTSecArcPort) port).isCritical()) {
criticalPorts.add(port);
}
}
//encrypted connectors and unencrypted connectors from connectors
for(ASTArcConnector connector : this.getConnectors()) {
if(((ASTSecArcConnector) connector).isEncrypted()) {
if(connector instanceof ASTSecArcConnector && ((ASTSecArcConnector) connector).isEncrypted()) {
encryptedConnectors.add(connector);
} else {
unencryptedConnectors.add(connector);
......@@ -119,7 +119,7 @@ public class ASTSecArcFilterComponent extends PrototypeASTSecArcFilterComponent{
//encrypted simple connectors and unencrypted simple connectors from simple connectors
for(ASTArcSimpleConnector simpleConnector : this.getSimpleConnectors()) {
if(((ASTSecArcSimpleConnector) simpleConnector).isEncrypted()) {
if(simpleConnector instanceof ASTSecArcSimpleConnector && ((ASTSecArcSimpleConnector) simpleConnector).isEncrypted()) {
encryptedSimpleConnectors.add(simpleConnector);
} else {
unencryptedSimpleConnectors.add(simpleConnector);
......
......@@ -22,7 +22,7 @@ public class ASTSecArcPort extends PrototypeASTSecArcPort {
/**
* Flags, if lazy informations have been calculated.
*/
protected boolean componentTypeCalculated;
protected boolean portTypeCalculated;
/**
* Lazy calculated roles
......@@ -68,7 +68,7 @@ public class ASTSecArcPort extends PrototypeASTSecArcPort {
* typed lists.
*/
protected void checkComponentType() {
componentTypeCalculated = false;
portTypeCalculated = false;
roles = new ArrayList<String>();
......@@ -83,7 +83,7 @@ public class ASTSecArcPort extends PrototypeASTSecArcPort {
}
}
componentTypeCalculated = true;
portTypeCalculated = true;
}
......@@ -93,7 +93,7 @@ public class ASTSecArcPort extends PrototypeASTSecArcPort {
* @return roles
*/
public List<String> getRoles() {
if(!componentTypeCalculated) {
if(!portTypeCalculated) {
checkComponentType();
}
......
package secarc.ets.qualifier;
import secarc.MontiSecArcConstants;
import mc.umlp.arc.ets.qualifier.MontiArcModelNameQualifierClient;
import mc.umlp.arcd.ArcdConstants;
import mc.umlp.arcd.ets.entries.ComponentEntry;
import mc.umlp.arcd.ets.qualifier.ArcdModelNameQualifierClient;
/**
*
* Component model name qualifier client.
*
* <br>
* <br>
* Copyright (c) 2010 RWTH Aachen. All rights reserved.
*
* @author (last commit) $Author:$
* @version $Date:$<br>
* $Revision:$
*/
public class MontiSecArcModelNameQualifierClient extends
MontiArcModelNameQualifierClient {
/**
* Model name qualifier client id.
*/
public static final String ID = "MontiSecArc";
/* (non-Javadoc)
* @see interfaces2.helper.AbstractModelNameQualifierClient#getFileEnding()
*/
@Override
public String getFileEnding() {
return MontiSecArcConstants.FILE_ENDING;
}
/* (non-Javadoc)
* @see interfaces2.helper.AbstractModelNameQualifierClient#getModelKindID()
*/
@Override
public String getModelKindID() {
return ID;
}
/* (non-Javadoc)
* @see interfaces2.helper.AbstractModelNameQualifierClient#getModelKindID()
*/
@Override
public String getSymbolKindID() {
return ArcdModelNameQualifierClient.ID;
}
/* (non-Javadoc)
* @see interfaces2.helper.AbstractModelNameQualifierClient#getModelKindIDOfCreateModelNameFileVisitor()
*/
@Override
public String getModelKindIDOfCreateModelNameFileVisitor() {
return null;
}
@Override
public String[] getExportedEntryKinds() {
return new String[] {ComponentEntry.KIND};
}
@Override
public String getSymbolTableKind() {
return ArcdConstants.ST_KIND_PROTECTED;
}
}
package secarc.ets.transform;
import mc.DSLRoot;
import mc.umlp.arc.ets.transform.PreCoCoCheckMontiArcTransformationVisitor;
public class PreCoCoCheckMontiSecArcTransformationVisitor<T extends DSLRoot<?>> extends PreCoCoCheckMontiArcTransformationVisitor<T> {
public PreCoCoCheckMontiSecArcTransformationVisitor(final T dslroot) {
super(dslroot);
}
}
......@@ -2,6 +2,7 @@ package secarc.ets.transform;
import secarc._tool.MontiSecArcRoot;
import mc.DSLWorkflow;
import mc.ast.InheritanceVisitor;
public class PreCoCoCheckMontiSecArcTransformationWorkflow<T extends MontiSecArcRoot> extends DSLWorkflow<T> {
......@@ -12,6 +13,7 @@ public class PreCoCoCheckMontiSecArcTransformationWorkflow<T extends MontiSecArc
@Override
public void run(MontiSecArcRoot dslroot) {
InheritanceVisitor.run(new PreCoCoCheckMontiSecArcTransformationVisitor<MontiSecArcRoot>(dslroot), dslroot.getAst());
}
}
package secarc;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import mc.dsltool.AmbigousException;
import mc.dsltool.CircluarDependencyException;
public class MontiSecArcRunningExampleTest extends TestWithSymbolTableSec<MontiSecArcTestTool> {
public MontiSecArcRunningExampleTest() {
super(MontiSecArcTestTool.class, new String[] { "gen/conv" });
}
/**
* Test for Running Example in MontiArc
* @throws AmbigousException
* @throws CircluarDependencyException
*/
@Test
public void testRunningExample() throws CircluarDependencyException, AmbigousException {
MontiSecArcTool tool = createTestToolWithAdditionalParameters(new String[] {"src/test/resources/secarc/cds/CashDeskSystem.secarc"}, new String[] {"src/test/resources"});
tool.init();
assertTrue(tool.run());
}
}
package secarc;
import static mc.umlp.arcd.ToolConstants.ARG_ANALYSIS;
import static mc.umlp.arcd.ToolConstants.ARG_CONF;
import static mc.umlp.arcd.ToolConstants.ARG_MODELPATH;
import static mc.umlp.arcd.ToolConstants.ARG_OUT;
import static mc.umlp.arcd.ToolConstants.ARG_SYMTABDIR;
import static mc.umlp.arcd.ToolConstants.ARG_SYNTHESIS;
import static mc.umlp.arcd.ToolConstants.WF_CREATE_SYMTAB;
import static mc.umlp.arcd.ToolConstants.WF_INIT_CHECK;
import static mc.umlp.arcd.ToolConstants.WF_INIT_SYMTAB;
import static mc.umlp.arcd.ToolConstants.WF_PARSE;
import static mc.umlp.arcd.ToolConstants.WF_PRE_CHECK_TRAFO;
import static mc.umlp.arcd.ToolConstants.WF_RUN_CHECK;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import interfaces2.language.ETSTool;
import mc.MCG;
import mc.Parameters;
import mc.ProblemReport.Type;
import mc.umlp.arcd.TestWithSymtab;
public class TestWithSymbolTableSec <T extends ETSTool> extends
TestWithSymtab<T> {
public TestWithSymbolTableSec(final Class<T> toolClass, final String[] symbolFolders) {
super(toolClass, symbolFolders);
}
/*
* (non-Javadoc)
* @see mc.umlp.arcd.TestWithSymtab#createTestToolWithoutJava(java.lang.String[], java.lang.String[])
*/
@Override
protected T createTestToolWithoutJava(String[] files, String... additionalModelPath) {
String[] args = new String[] {
ARG_MODELPATH, "src/main/java",
ARG_CONF, "mc-test.cfg",
ARG_OUT, OUTPUT_TEST_FOLDER,
ARG_SYMTABDIR, SYMTAB_FOLDER,
ARG_ANALYSIS, Parameters.ALL, WF_PARSE,
ARG_ANALYSIS, Parameters.ALL, WF_INIT_SYMTAB,
ARG_ANALYSIS, Parameters.ALL, WF_CREATE_SYMTAB,
ARG_SYNTHESIS, Parameters.ALL, WF_INIT_CHECK,
ARG_SYNTHESIS, "secarc", WF_PRE_CHECK_TRAFO,
ARG_SYNTHESIS, Parameters.ALL, WF_RUN_CHECK };
List<String> argsAsList = new LinkedList<String>();
argsAsList.addAll(Arrays.asList(args));
for (String mp : additionalModelPath) {
argsAsList.add(ARG_MODELPATH);
argsAsList.add(mp);
}
for (String file : files) {
argsAsList.add(file);
}
T tool = null;
try {
Constructor<T> constructor = toolClass.getConstructor(String[].class);
args = argsAsList.toArray(new String[argsAsList.size()]);
tool = constructor.newInstance((Object) args);
tool.setErrorLevel(Type.WARNING);
}
catch (Exception e) {
e.printStackTrace();
}
return tool;
}
/**
* Creates a DSL Tool from the type T that is configured to build the symbol
* table for the given files being able to load models and symbols from the
* src folder, the java bootstrap folder and the given additional model
* paths.
*
* @param files files to process
* @param additionalModelPath to expand the model path
* @param additionalParameters add additional parameters here to configure the tool
*
* @return the created dsl tool
*/
@Override
protected T createTestToolWithAdditionalParameters(String[] files, String[] additionalModelPath, String... additionalParameters) {
String[] args = new String[] {
ARG_MODELPATH, "src/main/java",
ARG_CONF, "mc-test.cfg",
ARG_OUT, OUTPUT_TEST_FOLDER,
ARG_SYMTABDIR, SYMTAB_FOLDER,
ARG_ANALYSIS, Parameters.ALL, WF_PARSE,
ARG_ANALYSIS, "javadsl", "setname",
ARG_ANALYSIS, "javadsl", "addImports",
ARG_ANALYSIS, Parameters.ALL, WF_INIT_SYMTAB,
ARG_ANALYSIS, Parameters.ALL, WF_CREATE_SYMTAB,
ARG_SYNTHESIS, Parameters.ALL, WF_INIT_CHECK,
ARG_SYNTHESIS, "secarc", WF_PRE_CHECK_TRAFO,
ARG_SYNTHESIS, Parameters.ALL, WF_RUN_CHECK };
List<String> argsAsList = new LinkedList<String>();
argsAsList.addAll(Arrays.asList(args));
for (String file : files) {
argsAsList.add(file);
}
for (String mp : additionalModelPath) {
argsAsList.add(ARG_MODELPATH);
argsAsList.add(mp);
}
for (String param : additionalParameters) {
argsAsList.add(param);
}
T tool = null;
try {
Constructor<T> constructor = toolClass
.getConstructor(String[].class);
args = argsAsList.toArray(new String[argsAsList.size()]);
tool = constructor.newInstance((Object) args);
tool.addErrorHandler(handler);
tool.setErrorLevel(Type.WARNING);
MCG.addErrorHandler(handler);
}
catch (Exception e) {
e.printStackTrace();
}
return tool;
}
}
package secarc.cds;
// import message types
import secarc.cds.msg.*;
import java.awt.Image;
// import components
import secarc.cds.fe.CashDesk;
import secarc.cds.be.Bank;
component CashDeskSystem {
autoconnect port;
autoinstantiate on;
port
in Event newSale,
in Image barcode,
in String identifier,
in Event endSale,
out ProductData;
port
in Event cardPay,
in CardData,
in Integer pin,
out Boolean validation;
port
out Bill;
component Store {
port
in String identifier,
out ProductData,
out PaymentAck;
port
in SaleInformation;
}
component CashDesk cashDesk
[bdOut -> bank.bankData; saleInformation -> store.saleInformation];
component Bank;
connect bank.paymentAck -> cashDesk.paIn;
connect cashDesk -> store;
connect cashDesk.productData -> productData;
}
\ No newline at end of file
package secarc.cds.be;
// import message types
import secarc.cds.msg.*;
component Bank {
port
in BankData,
out PaymentAck;
}
\ No newline at end of file
package secarc.cds.fe;
// import message types
import secarc.cds.msg.*;
import java.awt.Image;
component CashDesk {
port
in Event newSale,
in Image barcode,
in String identifier,
out String identifier,
in Event endSale,
in ProductData,
in PaymentAck,
out ProductData;
port
in Event cardPay,
in CardData,
in Integer pin,
out BankData bdOut,
in PaymentAck paIn,
out Boolean validation;
port
out SaleInformation,
out Bill;
}
\ No newline at end of file
package secarc.cds.msg;
public class BankData {
}
\ No newline at end of file
package secarc.cds.msg;
public class Bill {
}
package secarc.cds.msg;
public class CardData {
}
\ No newline at end of file
package secarc.cds.msg;
public class Event {
}
\ No newline at end of file
package secarc.cds.msg;
public class PaymentAck {
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment