SDA SE Wiki

Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering

User Tools

Site Tools


Assignment 4: Model-Driven Architecture

All of the following tasks can be done with Topcased (which includes OAW). In case you weren't present in the introduction, refer to the description in our wiki.

Task 11 (MOF)

1. Create a EMOF-based meta model for simplified UML state diagrams. Following concepts of a state diagram need to be present:

  • An initial state node
  • A final state node
  • Regular state nodes
  • Nested state nodes
  • state transitions which are further specified by an event
    • It is enough to model the event as a string property

For details on EMOF classes you may use in meta-model see:
EMOF Classes: EMOF Classes UML Core::Basic Types Diagram: UML Core::Basic Types Diagram

Sample Solution

Task 12 (Binary Search Tree)

This task will introduce you to the Topcased UML environment and the OpenArchtectureWare framework.

  1. Install/Download both: Topcased in part of the Topcased Distribution
  2. Watch at least the screen casts 00, 01 and 04 at the openArchitectureWare page: http://www.openarchitectureware.org/staticpages/index.php/oaw_screencasts
  3. Start topcased an check out the project bst.oaw which which is located in your team's repository: https://svn.iai.uni-bonn.de/repos/IAI_Software/se/atsc2008ws/groupXX/A4_Topcased_OAW
For Mac Users: Change the text file encoding to ISO-8859-1. Otherwise the xpand files will not compile.

Eclipse→Preferences-General→Workspace→Text file encoding

Now execute the workflow

/bst.oaw/src/generator.oaw

It generates the file:

/bst.oaw/src-gen/bst_report.txt

Your task is to extend the report's template

/bst.oaw/src/templates/Root.xpt

so that under each node item all names of correlated associations (BSTRelations) and the referenced node names appear. E.g.

 	* Node: Node1
        * LessEqualRelation: lesser1 (Node2)
        * MoreRelation: more1 (Node3)

Tip: The stereotype Node extends uml::class which defines the method getAssociations()

The last chapter in the lecture atsc-2008-08-mda-II contains a short introduction to the Xpand template language.
If this is not enough the openArchitectureWare-4.3-Reference is even more detailed.

Sample Solution

Task 13 (Edit a UML2 Model + Model-2-Model Transformations)

For the following tasks, you need to check out the projects

To get an overview what the application does, read IAI_VZ_OAW/doc/oaw-IAI_VZ_Architecture_Meta_Model_And_Platform.pdf.

After the code was generated with the workflow file IAI_VZ_OAW/generator.oaw it can started by running IAI_VZ_Gen/src/main/java/org/iai/vz/Test_IAI_VZ.java.

This will launch a local webserver on port 8080. Open a browser and open the URL http://localhost:8080/. Enter the credentials of one of the users from Test_IAI_VZ.java, e.g. user: “u”, pwd: “p”.

Common Pitfalls with this project

java.net.BindException: Address already in use: JVM_Bind: The jetty web server is already running. Go to the eclipse/topcased console locate the small monitor icon with an arrow to its right and select the console of the still running innstance. Stop it with the red square.

It may happen that the webserver (Jetty) displays quite intimitating error messages. In these cases check the eclipse console and/or if you have compiled your project with errors(topcased's default configuration doesn't display awarning dialog if you try to compile an erroneous projects)

Subtask a

Follow the following steps to understand how to add new components to the model.

  • Add a new class Comment to the Entites.umldi file
  • Give it a property “text”
  • Assign the Entity stereotype via the Property view
  • Add an Association from User to Comment and make Comment's end navigable
  • Close the file and open EditDetailsActivity.umldi
  • Add a new Page::StructuredActivityNode to the existing PageFlow
  • Add a EditDetails::OpaqueAction to the Page1)
  • Add input pins to both, give the outer input pin the type User, the inner input pin the type of your new class Comment
  • Add an object flow between the input pins, assign the stereotype “transformation”
  • Add a control flow from another class in the PageFlow to your new Page
  • Validate the Model, Run the generator.oaw workflow, run /IAI_VZ_Gen/src/main/java/org/iai/vz/Test_IAI_VZ.java

Your new page should now show up at the right place and allow for editing the comment.

If you have trouble finding the right elements in the UML editor, look at these pictures:

Subtask b

There is a file normalize.ext in oaw/m2m. Find out what it what it does. Write down your explanation as a comment in the file.

Sample Solution

Task 14 (Extend a Meta-Model)

  • Add a new stereotype “TextArea” to the profile:

  • Define the Profile, otherwise the modification can not be applied to importing models

Right-click on the profile root node in the outline and select define profile

  • Save and close the profile – profile and using models must not be open at the same time
  • Open the Entities.umldi model file and re-apply the IAI_VZ profile

Either in the context-menu of the model’s root node in the outline or Via the properties view

  • Add the Stereotype to a property of you choice

  • Open IAI_VZ_OAW/oaw/templates/HtmlPage.xpt and find the ToDo Comment. Add a specialized template for the TextArea type there.
  • Open IAI_VZ_OAW/oaw/templates/EditEntityForm.xpt. Find the TodoComment and add a template for the TextArea type there, too.

Sample Solution

Task 15 (Extend the Meta-Model even further) A BONUS TASK!

a) Extend the Meta-Model to support the following feature:

  • Users should be able to leave comments on other user's pages (or even on their own).
  • All comments for a user are shown at the bottom of the Profile page.

How can this be modelled?
Propose an extension to the Meta-Model (some stereotypes) and illustrate how to use them in a reference model. You can make a copy of the EditDetailsActivity.umldi and EditDetailsActivity.uml (the second is the abstract model, the first the graphical representation) to illustrate the use of your extension.

If you're interested try to extend to generator code to support the new feature. This will need detailed knowledge of the Apache Wicket framework and we do not expect you to have it.
In (the likely) case that no team provides a generator implementation we will pick “the best” solution for this task and provide an implementation as a reference for all teams.

Good luck!

1)
Topcased doesn not allow the creation of a OpaqueAction in a StructuredActivityNode. You will have to create the action outside the StructuredActivityNode and drag it into the node.
teaching/lectures/atsc/2008/assignment_4.txt · Last modified: 2018/05/09 01:59 (external edit)

SEWiki, © 2019