Title: Rational Rose 98 RoundTrip Engineering with JAVA
1Rational Rose 98- RoundTrip Engineering with JAVA
- Chapter 1. Introduction to Rose Java Edition
- Chapter 2. Mapping Java to UML
- Chapter 3. Forward Engineering with Rose Java
Edition - Chapter 4. Reverse Engineering with Rose Java
Edition
2Chapter 1. Introduction to Rose Java Edition
3What is Rose Java Edition?
- Automatic generation of Java Source code
- JDK 1.0.2 and 1.1x
- Reverse engineering of Java source and byte code
- Round trip engineering capability that
synchronizes models and generated Java source
across multiple iterations - changes made to a model are carried through to
code during code generation - changes made to code are carried back to the
model during reverse engineering
4About Java Base Classes
- Rose automatically places a set of Java Base
Classes
5About Forward Engineering
- ???, ???, ??????? ?? ?? ??? ???? ??
- ????-centered
- ???? ????, ?? ????? ??? ?? ??? ??
- ?????? .java ?? ??
6About Reverse Engineering
- Java ?? ????? ????, Rose ???, ????? ??? ??
- Java source code(.java files)
- Java bytecodes code(.class files)
7Chapter 3. Forward Engineering with Rose Java
Edition
8Forward Engineering Process
- Loading Java base classes into a Rose model
- Defining classes, components, and other model
elements - Assigning classes to components
- Checking syntax
- View and complete the generated Java source
9Create a Logical Package and Classes
- 1. In the logical view of your new model, create
a logical package called Myapps. - 2. Create a logical class in the package and call
the class WelcomeApp.
10(No Transcript)
11Create a Component Package and Component(1)
- 1. In the component view, create a component
package called MyApps. - 2. Create a component in the package and call the
component WelcomeApp.
12(No Transcript)
13Create a Component Package and Component(2)
- 3. Double-click on the component in the Browser
or in the diagram to open its specification and
verify that the Language field is set to Java.
14Assign the Class to the Component
- 1. In the Browser window, drag the WelcomeApp
class to the WelcomeApp component to assign the
class to the component.
2. Double-click on the WelcomeApp class in the
Browser or in the class diagram. 3. Select the
Components tab in the WelcomApp class
specification. Note that the WelcomeApp component
is checked, denoting that the class is assigned
to it.
15View the Component Specification
- 1. Double-click on the WelcomeApp component in
the Browser or in the component diagram. - 2. Select the Realizes tab in the component
specification. Note that the WelcomeApp class is
checked, denoting the components class
assignment.(the Realizes relationship in Rose
corresponds to the Implements relationship in
Java)
16Add a New Method
- 1. Select the WelcomeApp class in the Browser or
in the class diagram. - 2. Right-click on the WelcomeApp class and select
New Operation from the Menu
3. Double-click on the WelcomeApp class to
display its Class Specification 4. Select the
Operations tab to view the operation you added
17Edit the New Method(1)
- 1. Double-click on the operation to edit its
Operation Specification - On the General tab, change the operation Name to
main and the Return class to Void
18Edit the New Method(2)
- On the Java tab, double-click on the Static
property and set it to True.
19Edit the New Method(3)
- On the Detail tab, specify a parameter as an
array of string. - Click OK to save your changes to the operation
specification.
20Edit the New Method(4)
- 2. Notice that the main operation now appears
both in the Operation Specification and in the
Browser. - 3. Close the specification and save your model so
you dont lose any of your work to this point
21Set the Project Directory Property(1)
- 1. Point to Model Properties on the Tools menu
and select Edit.
22Set the Project Directory Property(2)
- 2. When the WelcomeApp class specification is
displayed, go to the Java tab and click Edit Set
to access the property editor.
23Set the Project Directory Property(3)
- 3. Use the Type drop-down box to find and select
the Project type.(Remember, Directory is a
Project property, so we want to go the property
set that applies to project.)
24Set the Project Directory Property(4)
4. Double-click on the Directory property to
allow editing of its current value, which is, as
you can see, AUTO GENERATE.
- 5. Replace AUTOGENERATE with a directory of your
choice. This example uses C\MyWork\MyJava\.
25Generate Java(1)
- 1. Select the WelcomeApp component or class in
the Browser or in a diagram. - 2. On the Tools menu, point to Java and click
Generate Java.
26Generate Java(2)
- 3. Click the Rose Log window for information on
errors or successful Java generation. - 4. Close the Log window.
27View Java Source(1)
- 1. With the WelcomeApp component or class still
selected, point to Java on the Tools menu and
click Browse Java Source.
28View Java Source(2)
- You generated .java file is automatically opened
and looks like this - 2. Optionally, check Window Explore to find the
new directory you created and the generated .java
file it contains.
29Edit Java Source
- 1. Add the command to print the Welcome to
Rational Software! Message(or any message you
prefer).
Compile and Run 1. Use the Javac compiler to
compile your completed .java file. 2. Run the
application and see what you get.
30Chapter 4. Reverse Engineering with Rose Java
Edition
31Reverse Engineering Java Source(1)
- .java, .class ??? ??? ?? ????? UML ??? ???
32Reverse Engineering Java Source(2)