Home
User Manual - Trinity College Dublin
Contents
1. DS Distributed Systems Group Trinity College Dublin LERO THE IRISH SOFTWARE ENGINEERING RESEARCH CENTRE MODEL DRIVEN THEME UML Eclipse Theme UML Plugin Manual Author Kai BECKMANN Eamonn LINEHAN 5th February 2009 The Theme UML Plugin User Manual Copyright Distributed Systems Group Department of Computer Science Trinity Col lege Dublin 2009 All rights reserved Comments may be addressed to Dr Siobh n Clarke Distributed Systems Group Department of Computer Science Trinity College Dublin 2 Permission is granted to copy distribute and or modify this document under the terms of the GNU Free Documentation License Version 1 2 or any later version published by the Free Software Foundation with no Invariant Sections no Front Cover Texts and no Back Cover Texts All code listings in this document are part of the Theme UML Plugin The Theme UML Plugin is free software you can redistribute it and or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation version 3 of the License The Theme UML Plugin is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FIT NESS FOR A PARTICULAR PURPOSE See the GNU General Public License for more details A copy of the GNU Lesser General Public License is distributed with the Theme UML Plugin It can be found in a file named COPYING txt If
2. gt i gt Handbook cvs dsg cs ted ie O lt modelFile value ANSI C composed Tol lSystemAOSD2008Demo uml gt 20 lt outputSlot value model o 21 lt component gt gt F gt Lero cvs dsg cs tcd ie 22 E netcf m2t 23 lt component id dirCleaner oon da Nro Id workflow oaw v 1 2 2009 01 15 15 30 42 beckmank Exp sai A W gt 3j 2me_m2t cvs dsg cs tcd ie Y y gt Pacemaker cvs dsg cs ted ie Ey ansic profile mdzip 1 1 id generator class oaw xpand2 Generator 28skipOnErrors false gt ansic profile uml 1 1 3 gt composed_PaceMaker uml 29 lt metaModel class oaw type emf EmfMetaModel gt Matrix_Templates_Profile prof 30 lt metaModelPackage value org eclipse emf ecore EcorePackage gt a Model_Transformation_Profile e Es 32 lt metaModel class oaw uml2 UML2MetaModeL gt Ey PaceMaker mdzip 1 1 33 lt expand value templates Root Root FOR model gt PaceMaker uml 1 1 34 lt outlet path src gen gt 35 lt outlet gt la 36 lt prSrcPaths value src gen gt UML Standard Profile Magict 37 lt prDefaultExcludes value true gt a m gt 4 pe writable Insert 19 61 s kReBBws oa J Figure 6 Insert the PSM XML file name at the OpenArchitectureWare workflow file 46 47static void _do_sensePulse HeartMonitor this 48 49 50 51 53 PROTECTED REGION ID HeartMonitor_do _s
3. into source code using OpenArchitectureWare The Theme UML Plugin supports three phases of model driven development 1 The composition of the aspect oriented model to normal UML 2 The transformation of the platform independent model to a platform specific one 3 The transformation of the platform specific model to text that is the generation of source code The code generation is done by a couple of OpenArchitectureWare eclipse projects which are provided 1 1 Files The following files are part of the Theme UML plugin and can be downloaded form the Theme UML Plugin homepage handbook pdf The Theme UML Plugin manual ThemeUMLPlugin 1 0 3 jar The eclipse plugin jar of the Theme UML Plugin oaw project ansi c zip The OpenArchitectureWare project for the ANSI C target plat form oaw project aspectj zip The OpenArchitectureWare project for the aspect target plat form oaw project j2me zip The OpenArchitectureWare project for the j2me target plat form oaw project netcf zip The OpenArchitectureWare project for the NET target plat form uml example pacemaker zip An example for an UML project modeling a pacemaker uml example_tollsystem zip An example for an UML project modeling a device for an toll system theme uml plugin source code zip The source code of the Theme UML Plugin ThemeUMLPlugin JavaDoc zip The javadoc API documentation for the Theme UML Plugin 1 2 System Requirements For producing the
4. not see lt http www gnu org licenses gt Contents 1 Introduction to the Theme UML Plugin E A A NS 1 2 System Requirements e 2 Installation 3 Using the Theme UML Plugin 3 1 Composing the Theme UML model 32 PIM2PSM a 4 44 6h boe 63 me eee ee ee alo de ide e A de 3 0 COdE GENErallON ie esa a a ee da a a e 34 JENMRAONS alice e A a eee e e dd a 3 4 1 Code Generati0n 0000 ee ee ee 3 4 2 ANSI C Code Generation 0 0004 eee 4 OOP Model for C 1 Introduction to the Theme UML Plugin The Theme UML Plugin helps you use the model driven Theme UML approach for soft ware development Figure 1 Yimaciesirew Model Driven Theme UML eclipse plugin AN Figure 1 Model driven development process Figure 1 illustrates the development process The Modelling phase involves produc ing a AO model of the program you wish to build This model must be compatible with Theme UML The output from this phase is a collection of UML and Theme UML documents stored in the XMI 2 0 format We have used MagicDraw 15 0 to produce these files but any XMI compatible modelling tool should work The composition phase uses the eclipse Theme UML plugin to perform composition of the AO and OO base model resulting in a Platform Independent Model PIM In the transformation the PIM is transformed into a Platform Specific Model PSM via the plug in This model is then transformed
5. s E e Bw we a Figure 4 How to chose the option to transform the PIM to a PSM one The process of transforming the platform independent UML model to a specific one allows the model to be able to be transformed to source code This means that the UML datatypes are replaced with the available datatypes of the target platform On the other hand there are things that can be done in UML but are not available on every target platform In this case those constructs have to be replaced with something that can be done on the target platform For example a one to many association can be modeled in UML but has to be replaced with some kind of a container on most target platforms For each supported target platform there exist a UML profile The datatypes and con tainer constructs defined there will be the replacement for the UML ones in the platform independent model To adapt to another target platform and or to modify the existing functionally the plugin has to be modified 3 3 Code Generation The code generation is provided in form of a couple of OpenArchitectureWare eclipse projects Each of those projects is responsible for one specific target platform To generate the programing code for a target platform it is necessary to import the corresponding OpenArchitectureWare project to eclipse The second step is to copy the PSM XML file to the root folder of the OpenArchitecture Ware project in eclipse see Figure 5 Java Pacem
6. the project name in it This file can be manually edited in eclipse with a XML editor Minor changes and fixes can be done this way easily The composition of the aspect themes to a normal UML model is initiated with a right click on the lt project name gt uml file and a click on the OO Compose option in the Theme UML menu A new file will be show up in the eclipse project folder called composed_ lt projectname gt uml Sometimes eclipse has a problem opening this file in this case select the refresh option from the context menu or press F5 The new generated UML file can be edited with the XML editor or the model can be viewed and modified with the eclipse UML editor For this the option Initialise Class Diagram has to be chosen from the context menu of this file 3 2 Platform independent model to platform specific model transformation There are four different supported target platforms to generate a platform specific UML model aspectj j2me NET and ANSI C The transformation is done by the plugin To start the transformation mark the composed UML file from the last step and chose the Transform to lt target gt option replace target with you intended target platform see Figure 4 A new file will be created called lt target name gt _composed_ lt project name gt uml This file contains the PSM for the select target platform Like all UML files this can also be viewed and modified with the eclipse XML edi
7. UML models a EMF XMI 2 0 compatible modelling tool is required we recommend MagicDraw The Model Driven Theme UML tool requires an eclipse Ganymede v3 4 0 2 Installation The Model Driven Theme UML tool consists of an eclipse plug in and a couple of Ope nArchitectureWare projects The Theme UML Plugin has the following eclipse dependencies e Java 1 6 JDK e EMF e UML2 e OCL e log4 The first step is to download and install the current JDK Java Development Kit from the Sun homepage Windows user or install it by using your package management system Linux Unix user We recommend to download a fresh Ganymede eclipse zip archive Version 3 4 0 or higher with Modeling Tools included After the unpacking the log4j plugin has to be installed This can be done by the eclipse software update function using the following steps Installed Software Available Software type filter text y Name Version Install dD Al EPP Usage Data Collector Update Site v El 4 Ganymede 000 C and C Development properen 000 Charting and Reporting 000 Collaboration Tools 100 Communica tions Sanini 00 Database Development 000 Enabling Features 000 Graphical Editors and Frameworks 000 Java Development Refresh 1100 Models and Model Development 000 Other Tools 000 Programming Languages 100 Remote Access and Device Development 100 SOA Development 100 Testing and Performance qd vvvvvvv v7 VAYA AY E 100 Un
8. akerANsi c composed PaceMakerunil Echipse Plattonn File Edit Source Refactor Refactor Navigate Search Project Run UML Editor Window Help Diy tv Ov Q Qy Soe E E O oo ES java t Hierarc hy O M handbook tex ANSI C_composed_PaceMaker uml 2 Y v 1 platform resource Pacemaker ANSI C_composed_PaceMaker uml b sg aspectj_m2t cvs dsg cs ted ie RAS Y 9 gt C_mat evs dsg cs to vB lt Package gt Pacemaker v gt src gt g helpers gt templates Ey gt workflow oaw 1 2 gt Bj RE System Library java 6 sun 1 D wi Reference d Libraries b lt Class gt Diagnostics b lt Association gt A_pacemaker_diagnose b lt Association gt A_pulseRate_pacemaker Z lt Association gt A_getData_send b lt Associa tion gt A_comms _ process b 7 lt Association gt A_paceModulator_dummy b lt Associa tion gt sense b lt Association gt A_modulate_pulseAnalysis Ey src gen ansic profile uml 1 1 Ej build properties 1 1 b lt Association gt A_pulseAnalysis_sense lt Class gt gt 5 gt Handbook cvs dsg cs tcd ie gt nl lt Class gt Comme J i b lt Collaboration gt Securi tyCrosscu tting b j 2me_m2t cvs dsg cs tcd ie 7 lt Ca gt H gt Lero cvs dsg cs tcd ie la lt Ca en Gnetcf_m2t E E lt Cal Y Ey gt Pacemaker cvs dsg cs tcd ie Ye lt Ca s gt ANSI C_composed_PaceMaker L Ya lt y ansic profile mdzip 1 1 e sta ansic profile
9. categorized lt Apache commons logging 4p Apache Xerces 201120080917042f Im ATI Show only the latest versions of available software W Include items that have already been installed Open the Automatic Updates preference page to set up an automatic update schedule Figure 2 Select log4j from the eclipse update service http java sun com javase downloads index jsp http www eclipse org Sif your computer is behind a proxy this have to be configured first e Click on Window Preference e Set your proxy under General Network Connections 1 Click on Help Software Updates 2 Click on Available Software 3 The log4j plugin is under Ganymede Uncategorized see Figure 2 4 Select Install See figure 2 for the right option to select at the eclipse update program Now you can copy the ThemeUMLPlugin_1 0 3 jar file into the plugin folder of your eclipse installation Under windows this could be C Program Files eclipse plugins under Linux the path might be usr lib eclipse plugins or the place where the eclipse zip archive was unpacked After this step you have to restart eclipse The plugin is now available in the context menu when you right click on an UML file Figure 3 ype Open With P File Edt S E IL Editor Window Help Show In Shift Alt w gt tiv a Y E java B Copy Ctrl C b amp E 4 Es copy qualified Name Pas
10. d into eclipse These projects contain UML files with the Theme UML approach The Theme UML Plugin can compose those into normal UML files addition to the Theme UML Plugin there are four OpenArchitectureWare projects pro vided These projects can be used to generate source code from the composed UML files These projects depend on the OpenArchitectureWare eclipse plugins that have to be installed separately To do this the following steps are necessary To add the OpenArchitectureWare update site to the eclipse software update system Oo oF W N T Click on Help Software Updates Click on Available Software Click on Add Site Add the URL http www OpenArchitectureWare org updatesite milestone site xml The new update site is added to the overview Select the combobox of the OpenArchitectureWare and click on install Restart eclipse You can now import the provided OpenArchitectureWare projects into your workspace The classpath of these project have to be set manually Right click on each project and select the Properties option Go to the Java Build Path window and remove all entries listed in the Library tab except the J lt RE If you have removed the JRE entry as well add it again by clicking on Add Library and chose there JRE System Library and click on the Next button The next step is to add all necessary libraries and plugins The files can b
11. e found in the plugin folder of the current eclipse installation Click on the External Jars button brows to the plugin folder of your eclipse installation and select the following jar files only the prefix is listed org eclipse emf common org eclipse uml2 uml org eclipse emf ecore org openarchitectureware core workflow org apache commons cli org apache commons logging org openarchitectureware core xpand2 org openarchitectureware core expressions org openarchitectureware core emftools org eclipse emf ecore xmi org openarchitectureware uml2 adapter org eclipse emf mapping ecore2xml org eclipse uml2 uml resources org antlr org eclipse uml2 common 3 Using the Theme UML Plugin The following section describes the composing and transforming phases of model driven Theme UML The three design phases are described separately but each phase builds on the output of the previous one For an introduction to Theme UML see the Theme UML book 3 1 Composing the Theme UML model After the installation of the Theme UML Plugin in the eclipse plugin folder there is a Theme UML entry on the context menu of an uml file lf a new project is started a new eclipse project for the UML files should be created as well After the modeling process with the UML tool the diagrams have to be exported as XMI encoded files EMF UML2 v2 x XMI into the eclipse project folder The export creates a couple of uml files the important one is the with
12. ensePulsefalse ENABLED START 55 insert implementation here A A A A 56 57 PROTECTED REGION END 59 return 60 Figure 7 Protected region to insert your own code 3 4 1 Code Generation The Code Generation has some limitations One of the main problems is the usage of the sequence diagrams to generate the right method calls inside an operation We found that the UML model was the source some problems Specifically if a sequence diagram is exported by MagicDraw every version including the current v16 the chrono logical information of the method calls and returns is lost The following caveats are known regarding the code generation from the sequence diagrams Only one call of an operation on one single liveline from the outside gate of the system is possible See picture 8 for a good and a bad sequence diagram example There should be only two livelines in one sequence diagram lf there are more the generated code might be wrong and have to be manually adapted The generation process does not know how the parameter of an operation and the variables inside the code are intended to be used Therefore for each call of an operation all parameters will be declared as local variables This is more a feature than a problem The order of other operation calls within one operation can be wrong You can reduce the chance of this happening by taking care that the operation calls are in the right order in the MagicDraw appl
13. ess protection 11 Single inheritance Access over parent class reference to objects polymorphism Public and private operations Public operations are over writable Operations are called by a function pointer in the class structure The first parameter is always a pointer to the instance of the class structure Constructor and Destructor for dynamic memory allocation Init and Cleanup Function for static memory management Associations Aggregations one2one by single pointer or structure member one2X Array of pointer or variables Association and Aggregation one2many Replaced by container system Simple double Linked List Done in the PIM2PSM can be adapted 12
14. ication See Figure 9 for the parts that need attention Bad Good Class A obj Class A obj vt Figure 8 Bad Good sequence diagrams Only one call from outside of the system is possible 10 File Edit View Layout Diagrams Options Tools Analyze Window Help x De gt home PacemakerPaceMakerm y i Rk AAA FAS AA A AAA al aultTo P 28 Diagram Model E amp Search qax Figure 9 The operation calls in MagicDraw have to be in the right order 3 4 2 ANSI C Code Generation Not supported e UML Template classes e Enums 4 OOP Model for C ANSI C has no language support for object oriented programing But it is possible with some workarounds The right style guide is important One problem with OOP in C is that many things have to be built manually This can be a source of errors With code generation the most of there errors can be avoided Making OOP with C more usable The Theme UML Plugin supports the following features e Class structures with public variables A class is represented by a C struct A instance of the structure is a object of the class One class is implemented in two files Header and Implementation The UML package structure is mapped to different source folders Private variables are only private by agreement no acc
15. pecial comments called PROTECTED REGION begin and end Code inserted between these comments will not be changed by OpenArchitectureWare This means that is possible to alter the model if necessary and your own code will not be changed by re generation See Figure 7 for a code example 3 4 Limitations There are some known limitations with the Theme UML Plugin If you encounter a problem that is not mentioned here please file a bug report to the mail address Eamonn Linehan0cs tcd ie E Java m2t src workflow caw Eclipse Platform File Edit Refactor Navigate Search Project Run Window Help r E e Ov y Qv eo ov B r o o og H Package E 38 fg Hierarchy O handbook tex B amp Y 1 lt 2 This file is part of the ThemeUML Eclipse Plugin gt aspecti_m2t cvs dsg cs ted ie 3 Copyright c 2009 Lero 20 4 v 5 gt c_m2t cvs dsg cs tcd ie S Alfflamonn Linehan Y gH gt sre Lero The Irish Software Engineering Research Centre gt A helpers Distributed Systems Group Department of Computer Science Trinity College Dublin Ireland 353 01 869 1543 www lero ie D Ej templates Ey gt workflow oaw 1 2 gt m RE System Library java 6 st gt mi Referenced Libraries y src gen s gt ANSI C_composed_PaceMa 5 y Al I 6 lt workf Low gt dy ansic profile uml 1 1 f 17 lt bean class oaw uml2 Setup standardUML2Setup true gt Ex build properties 1 1 8 lt component class oaw emf XmiReader
16. te rl 2 NE 8 X Delete Delete rc Primitive Types gt 53 aspect Primitive Types gt 9 gt C_m2 4 oo an d Build Path gt AcquireDataExternally gt H E Refactor Shift alt T 7 Security D 5j2me_m gt GeneratePulse gt 5 gt Lero 2 Import gt AnalysePulse Ginetcf_m 14 Export gt MonitorHeart Y Ey gt Pacen gt UpdatePacemaker gt g amp Refresh F5 k y ansid A J gt DiversityFaultTolerance Assign Working Sets ansid gt Synchronisation gt cor Initialize Use Case Diagram ency gt MonitorHeart Matr Initialize State Machine Diagram ency gt GeneratePulse E Mode Initialize Deployment Diagram ency gt AnalysePulse y Pace Initialize Composite Structures Diagram lt Package gt UML Standard Profile is Pace Initialize Component Diagram 5L Customization Then Initialize Class Diagram atrix Templates Profile 4 UML Initialize Activity Diagram emeUML E UML Run As jlidation Profile UML Debug As bdel Transformation Profile ds UML Profile As gt ML Standard Profile gt Ey gt Them Team agicDraw Profile Compare With gt r7ThemeUML profile uml Replace With Ff UML Standard Profile MagicDrav Transform to NETCF Transform to J2ME ne Pi Properties Alt Enter Figure 3 The Theme UML plugin menu entry shows up after the installation of the plu gin There are two example projects provided the Tollsystem and the Pacemaker These projects can be downloaded and importe
17. tor or the graphical UML tool Siobhan Clarke and Elisa Baniassad Aspect Oriented Analysis and Design The Theme approach Addison Wesley 2005 por Open With File Edit Source Refactor f 3 Help Show In Shift Alt w gt Civ tv Ov Qy eee tie E java fe Hit ES Copy Qualified Name z m j IE Paste Ctri v ceMaker uml X Delete Delete gt jsp aspectj_m2t cvs dsg cs t D iy C_m2t cvs dsg cs tcd ie y elevatorsim gt 55 gt Handbook cvs dsg cs td Build Path po gt yj2me_m2t cvs dsg cs ted Refactor Shift Alt T ker Dd gt Lero cvs dsg cs tcd ie a Import Wnetcf_m2t LA Export Y fey gt Pacemaker cvs dsg cs j y gt ANSI C_composed_Pa Refresh F5 l y ansic profile mdzip 1 1 Assign Working Sets alysis ies cerca Initialize Use Case Diagram ar js composed PaceMakey Initialize State Machine Diagram d QQ Matro Templates Prolil Initialize Deployment Diagram Si Model ton h Initialize Composite Structures Diagram r pr LI Initialize Component Diagram ec st Initialize Class Diagram mo prihauam Initialize Activity Diagram UML_Standard_Profile M e UML_Standard_Profile M Dake a j UML_Standard_Profile U Profile As a 4 UML_Standard_Profile V Team g gt 55 gt ThemeUML Plugin cvs Turovi Replace With Transform to NETCF Properties Alt Enter p lt collaporation gt Faurtorerancecros Wansform to J2ME po composed_PaceMaker uml Pacemaker 00 Compose
18. uml 1 1 oo Oo w nmoomomPSioomonmomomomm amp 655 5 AA AS 0600002050000 0 SS E E O ee 3 ARAALU RARA RAR VvV V V VVV V V V 3 gt composed_PaceMaker uml b gt lt C ion gt FaultTolerancec tting 2 a Py 5 Matrix_Templates_Profile profile un ls S lt C Model_Transformation_Profile prof Yg lt C PaceMaker mdzip 1 1 Yo lt C PaceMaker uml 1 1 ThemeUML profile um 1 1 gt E lt class gt HeartMonitorB b lt Collaboration gt FaultToleranceCrosscutting UML Standard Profile MagicDraw y Yo lt Call Event gt ANSI C_composed_PaceMaker uml Pacemaker esheBBbwvw ea Figure 5 Copy the PSM UML file to the corresponding OpenArchitectureWare project folder The process of generating the programing code is controlled by the file workflow oaw in the src folder At the tag modelFile the value has to be set to the file name of the PSM XML file See Figure 6 for the right location This example uses the ANSI C target platform for the others the procedure is the same If the workflow file is correctly adapted a right click on it and the selection of the op tion Runs As oAW Workflow starts the workflow The folder src gen will contain the generated source code It is possible to alter the UML file and to rerun the workflow The new changes will be applied to the source code files The code for the operations definitions contain s
Download Pdf Manuals
Related Search
Related Contents
Z30497A / Z30497B et à disque 12” manuel d`instruction Swan TF-57-010 Installation Guide LETTRE N° 105-6.pub - Initiative & Formation File MINOLTA RAVL42 Use and Maintenance Manual Philips HD3165 OLDHAM OLCT 100 Betriebsanleitung Copyright © All rights reserved.
Failed to retrieve file