Introducing IBM Rational Software Architect Prof. dr Angelina Njeguš Associate Professor
Intro to RSA IBM® Rational® Software Architect - part of the IBM Software Development Platform - is the first major release of Rational products since IBM's acquisition of Rational in February 2003. IBM release of the Rational products is built on Eclipse open-source software framework, which provides a unified interface for all the technicals (architects, designers, and developers). Because Rational Software Architect is built on Eclipse, you can use Rational Software Architect for Java 2 Platform, Enterprise Edition (J2EE Platform) technology. In addition, using the code-generation features that are a part of Rational Software Architect, you can convert designs and UML diagrams drawn in the Modeling perspective into code. Finally, the underlying Eclipse platform also provides a robust and feature-rich IDE for developers.
What is RSA? Comprehensive Modeling and Development environment that leverages the Unified Modeling Language (UML) for designing architecture for C++ and Java 2 Enterprise Edition (J2EE) applications and web services
Model A model is a complete description of the system from a particular perspective.
Lab 1: Create and run Java application in RSA Open IBM Rational Software Architect Standard Edition
Choose the path Choose the workspace (folder) where you want your projects to be stored and click OK.
Open desired perspective Go to Window, click Open Perspective, and then select Other Check Show all, select Java, and click OK
Create new project Click File, click New, and then select Project
Create Java project Select Java Project, and click Next
Name a project Choose a name for your project and click Finish. You have now successfully created a java project.
Create Java class In the Package Explorer, right click on your SampleProject and click on New > Class. The next Window will appear, and fill with data: Package: com.sampleproject.common Name: HelloWorld Check: public static void main... Click Finish.
Add some code The code of HelloWorld class will appear on the screen In main method add the next line code: System.out.println ("Hello World! This is my Java project in RSA"); Click File > Save All
Run the code Go to Window > Show View > Console In the Package Explorer, right click on HelloWorld.java Click on Run as > Java Application
Result In the Console View, the result of the code will be shown:
Lab 2: Create UML project and model File > New > Project Check Show all wizards Expand Modelling folder, select UML Project, and click Next Choose a name for your project and click Next. Project name: Bank
Create a package Select General > Blank Package Choose a name for your package and click Finish. File name: BankAccount What is package? A package is a general purpose mechanism for organising elements into groups. Packages may be nested within other packages.
Create UML package within package In the Palette view, click on Class > Package Click on Main editor, and expand the current package element Choose the name for this package: Customer Account Management
Lab 3: Class modelling Double click on Main in the Customer Account Management package In the Palette view, click on Class, and name it Account Right click on Account, and select Add UML > Attribute Name the attribute: -balance : double, and click Enter.
Add operations Right click on class Account, and select Operation Name the operation: deposit(amount:double):double, and click Enter Add another operation: withdrawal(amount:double):double
Add new classes Add new class: CheckingAccount Attribute: insufficientFundsFee:double Operation: withdrawal(amount:double) Add new class SavingsAccount Attribute: annualInterestRate:integer Operations: depositMonthlyInterest(), and withdrawal(amount:double)
Add relationships In the Pallete, under Class, select Generalization
Lab 4: UML-to-Java transformation Create a class diagram: https://www.ibm.com/developerworks/rational/library/08/1202_berfeld/ https://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/
Configure the transformation To create a new UML-to-Java transformation configuration, select Modeling >Transform > New Configuration in the Main menu.
Configure the transformation In the Name field of the opened New Transformation Configuration wizard, enter the name of the transformation configuration: Name: MyUMLtoJavaTransform Click the ellipses (...) button to browse to the UML project Bank In the list of deployed transformations, open the Java Transformations folder and select the UML-to-Java transformation. Select the Conceptual protocol type, and click Next. Note: Choose Conceptual protocol if the intention is to use the source model as a primary engineering artifact in future iterative development. Any changes made to the source model will be propagated to the target project when someone runs the transformation.
Specify the source and target elements for the transformation Select the model BankAccount from the created UML project as a source Select Create a Target Container
Create a new Java project Create a new Java project named myBankCode, and click Finish Select it as a target in the Transformation Configuration wizard, and click Finish
Run the transformation configuration The Java project and transformation configuration files created are visible in the Project Explorer view The Transformation configuration is opened in the Editor view Click Run to run the configuration
Generated transformation output The Java code will be generated in the target project
Lab 5: Export the project File > Export Expand General, and click on Archive File
Export the projects Check the projects that you want to export Click on Browse to select the path, and name of the archived file Click Finish
Lab 6: Closing the project File > Save All File > Close All Right click on the project in Project Explorer, and click on Close Project.