Creating MDELite Tools using Catalina
Corrections in Green

Find a partner and form a group of two (if you can).  As a group you will make one submission.  Download a fresh version of MDELite8 (as I had to modify it for this assignment), unzip it and follow the installation instructions.  Doing so, you should be able to run Catalina

> java MDL.Catalina

Usage: Boot.MDELite.catalina option args...
all state -> java
validateViolet state -> T/F
validateMeta state -> meta
quick meta -> java

Next, you should read the Catalina manual, which is in the Docs download of MDELite8. There are two different problems in this assignment: you are to complete the construction of 2 MDE tools.


Overview of Part A: the V2YTool

Here is an annotated category diagram for an MDE tool, called Tool.V2YTool, that translates Violet class diagrams into Yuml class diagrams. If you click the diagram, you'll see its violet XML file.



You can't build the Java source of this tool until you have completed Part 1 of this assignment, which is the v2y model-to-model transformation.  Ultimately, you will be able to draw a class diagram in Violet (like the on in the left diagram below) and produce the gorgeous Yuml diagram on the right.
violet class diagram
yuml class diagram





Part A.1

The category diagram of Tool.V2YTool has 5 arrows and two database domains whose schemas are in MDELite (libpl/vpl.schema.pl and libpl/ypl.schema.pl).

Four of these arrows are already written, as they are part of MDELite:

arrow name
Java Executable
parse
Violett.KlassParser
VPL conformViolett.ClassConform
YPL conform Yuml.ClassConform
unparserYuml.ClassUnParser

What is missing is the M2M translation of a Violet database that encodes a class diagram to a Yuml database that encodes that diagram.  You are to write this tool.  I have created a NetBeans project shell to get you started.  Here is the shell.  You complete the M2M.v2y program contained within it.  Add your own test programs.

Once you get this program working, place it and MDELite on your classpath for Part 2.

Part A.2

Complete the Tool.V2TTool tool.  Here is the Violet state diagram that specifies the above V2YTool category.  You can now build the source of the tool by:

> java MDL.Catalina all V2YTool.state.violet

Where file V2YTool.state.violet is in the directory in which you invoke MDL.Catalina.  The source V2TTool.java is produced by the above call.  You can't quite compile this file as is.  Follow these steps:
> java Tool.V2YTool all example.klass.violet
to produce file example.yuml.yuml, whose contents you can copy into the yuml.me class diagram window to produce the yuml diagram above. example.yuml.yuml might look like:
[Class|name|]
[AssociationEnd|roleName;visibility;cardinality|]
[Attribute|name;visibility|]
[Class]++-[Attribute]
[Association]++-[AssociationEnd]
[Class]++-[AssociationEnd]


Overview of Part B: Completing the FSMTool

There are many ways (read: infinite) in which FSMs can be encoded in Java.  The most common are:
Here is the Catalina spec of a tool that allows its users to translate FSMs to "nested state machines" or "State design pattern". Click the figure below to see the Violet FSM spec for Catalina:


CORRECTION: SEE ABOVE FIX IN BLACK

In the
Netbeans shell that I gave you earlier, I created two src directories: src/toDP and src/toNS.  Look at the code in src/toDP/Main.java.  It sketches a RB program that you should elaborate to produce a design pattern encoding of a FSM.  Copy this shell of a program to src/toNS, and write an RB program that translates to a nested state machine.  OR a matrix-driven program. (If you do all 3, you get extra credit).  You may need to rename the RB programs (and maybe add one more arrow) to the above spec.

Now, the constraint that ties all of these implementations together is a program (which you can change below). it should work no matter which implementation has been generated:

   enum states { start, Ready, Drink, Eat, Yell, stop }

public static void main(String... args) {
DEH fsm = new DEH(); // fsm is in start state
fsm.goto(Ready);
fsm.goto(Yell); // transition ignored, stays in Ready state
fsm.goto(Eat); // chow time
fsm.goto(Drink);
fsm.goto(Eat);
fsm.goto(Drink);

fsm.goto(Eat); // chow time
fsm.goto(Drink);
fsm.goto(Ready); // transition ignored, stays in Drink state

fsm.goto(Yell);
fsm.goto(stop);
fsm.goto(start); // transition ignored, stays in stop state
}
DEH is a java class that you will generate for the following FSM of my eating habits.  Click the image to retrieve the state.violet XML file:



Your task is to:

What to Submit

  1. a single zip file that unzips into <yourName>/<yourFilesAndDirectories> (I will return submissions that do not satisfy this constraint)
  2. a PDF file that convinces the TA that your program works, works on violet class diagrams that you yourself have created.
  3. Explanation how to run your tool.
  4. A bash-script called run.script that will run your examples (so that it is easy for me to see what you have done).
  5. Repeat 3-5 for part B.

A critical part of any design is clarity and understandability.   Hence, you will be graded on the clarity of your project and its ability to work correctly.  Sloppy code, documentation, or anything that makes grading or understanding your program difficult will cost you points.  Beware, some of these "beauty" points are subjective. 


Remember: No late assignments/submissions will be accepted.