This repository is part of the bachelor's thesis of Julian Waibel at the Technical University of Vienna. The following repositories also belong to it:
Contains the transformator, which generates valid out-of-the-box runnable code artifacts for SAM model files.
mvn clean install
mvn exec:java -P transformator
generates code for this SAM model file in the output-directorycode-output/
- or specify other SAM model file and output-directory:
mvn exec:java -P transformator -Dexec.args="'<local path or URL (starting with http[s]) to SAM model file>' '<local path to directory, in which the generated code artifacts should be placed>'"
e.g.
mvn exec:java -P transformator -Dexec.args="'code-input/MySAMmodel.aml' 'code-output/'"
mvn exec:java -P transformator -Dexec.args="'https://raw.githubusercontent.com/0xCAF3BAB3/sam-model/master/SAMmodel_v4.aml' 'code-output/'"
- Find the generated code in the specified output-directory.
- Import a generated service into your favored IDE as a Maven project.
Implement the business logic and logic for the communication events of the ports of the components in the generated Main
class.
Please take a look at the generated comments, which explain how and where to
- add receiver-handlers
- add asynchronous-sender-callbacks
- connect and execute senders
E.g. to specify what a receiver-port should do for a received message, register a receiver-handler:
portsService.setReceiverHandler(
CommunicationService.Receivers.PORTX.getName(),
msg -> {
System.out.println("Message received");
return Optional.absent();
}
);
- Build Maven project:
mvn clean install
- Switch to a components directory:
cd <component-name>
and run it:mvn exec:java -P <component-name>
The transformation details directory documents briefly which code artifacts get generated for which SAM model elements.
- Currently the passed SAM model file is not validated (= check, if the model elements are used correctly). Implementation should be done in method
validateModel(...)
incom.jwa.sam.transformator.service.CodegeneratorService.java
.