====== Instant Messenger case study ====== * **[[research:mdd:casestudies|Back to MDE case studies main page]]** ===== Introduction ===== This is a medium-sized case study involving the automatic generation of an [[#figure_1instant_messenger_screenshot|instant messaging client]], based on context information. This case study is based on the instant messaging scenario, developed within the [[http://www.cs.kuleuven.be/~distrinet/projects/CoDAMoS/|CoDAMoS project]]. The instant messaging client supports several network protocols (e.g. Jabber, SMS) and several user interfaces (e.g. AWT, Swing). If you would like a walk-through of the entire case study, you can view the following presentation, including flash demo: * Wagelaar, D., //MDE Case Study: Using Model Transformations for UML ands DSLs//, [[http://www.jugs.ch/html/events/2006/model_engineering.html|presentation/demo for JUGS, Zürich, Switzerland, 30 March 2006]].\\ [ [[http://ssel.vub.ac.be/Members/DennisWagelaar/docs/uml1cs-pres.odp|OpenOffice]] ] [ [[http://ssel.vub.ac.be/Members/DennisWagelaar/docs/uml1cs-pres.pdf|Adobe PDF]] ] [ [[http://ssel.vub.ac.be/Members/DennisWagelaar/uml1cs-demo/|Flash demo]] (49 min.) ] ==== Figure 1: Instant Messenger Screenshot ==== {{research:mdd:instantmessengerscreen.png?350|Figure 1: Instant Messenger Screenshot}} ===== Context-Driven Development ===== This case study is being used in the [[research:mdd:context|Context-Driven Model Refinement]] research track. Pre-generated versions of the instant messaging client can be downloaded using the [[research:mdd:platformkit]] [[http://ssel.vub.ac.be/platformkit/|web servlet]]. ===== UML 2 source models ===== The source consists of several UML 2 models, of which one forms the "core" feature (or "concept"). The other models represent optional features and are linked to the core model. The source models for this case study can be found [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/|here]] (see also the [[research:mdd:casestudies:installation|installation instructions]]. The models were all developed using the [[http://topcased-mm.gforge.enseeiht.fr/modeling/uml/index.php|Topcased UML2 editor]]. The following models (features) are available: * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/models/InstantMessengerModel.uml?view=markup|InstantMessengerModel.uml]]** \\ "Core" model, containing the minimal infrastructure of the instant messaging client. * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/models/InstantMessengerAWT.uml?view=markup|InstantMessengerAWT.uml]]** \\ Java AWT user interface. * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/models/InstantMessengerSwing.uml?view=markup|InstantMessengerSwing.uml]]** \\ Java Swing user interface. * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/models/InstantMessengerLCDUI.uml?view=markup|InstantMessengerLCDUI.uml]]** \\ Java MIDP LCDUI user interface (for mobile phones). * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/models/InstantMessengerJabber.uml?view=markup|InstantMessengerJabber.uml]]** \\ Jabber network protocol support (using the JabberWookie library). * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/models/InstantMessengerDefaultJabber.uml?view=markup|InstantMessengerDefaultJabber.uml]]** \\ Jabber default java.net.Socket transport. * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/models/InstantMessengerMEJabber.uml?view=markup|InstantMessengerMEJabber.uml]]** \\ Jabber MIDP javax.microedition.io.Connection transport. * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/models/InstantMessengerLocal.uml?view=markup|InstantMessengerLocal.uml]]** \\ Local/loopback network protocol support (also used for debug/error messages). ===== UML 2 refinement transformations ===== In addition, a series of refinement model transformations have to be applied before Java code can be generated. These refinement transformations sometimes introduce a part of static model content (doesn't vary based on input model) and always introduce a part of dynamic model content (varies based on input model). The static content is generally linked to the output model as a library. The available refinement transformations can be found [[research:mdd:casestudies#model_transformations_for_uml_2|here]]. In order to manage the selection of models and the refinement transformations applied to them, a [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/configuration/InstantMessenger.ecore?view=markup|configuration meta-model]] has been defined. Instances of this configuration meta-model can be used to generate a 'build.xml' file and 'parameters.xml' file that will implement the modelled configuration. One extra transformation has been defined for this: ==== ConfigToBuildFile ==== This transformation generates an Ant 'build.xml' file from an instant messenger configuration model. This 'build.xml' file is a complete Ant file that contains macros and all targets for executing the 'UML2...' transformations according to the given configuration. The 'build.xml' file must be [[http://wiki.eclipse.org/index.php/AM3_Ant_Tasks#am3.saveModel|extracted using AM3 Ant tasks]]. ^ [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/ConfigToBuildFile.atl?view=markup|ConfigToBuildFile.atl]] | Generates a build.xml file from an InstantMessenger.ecore config file. | | Meta-models: | CFG = [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/configuration/InstantMessenger.ecore?view=markup|InstantMessenger.ecore]]\\ XML = [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-transformations/metamodels/XML.ecore?view=markup|XML.ecore]] | | Models: | IN = a configuration model such as [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-default/config.ecore?view=markup|config.ecore]]\\ OUT = the output 'build.xml' file | ===== UML 2 pre-configured versions ===== Four pre-configured versions of the instant messaging client exist: ^ [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/svn-gen/UML2CaseStudies/uml2cs-instantmessenger-default/|default]] | The default version of the instant messaging client. Includes the following features / selective refinements / selective tranformation libraries: AWT, Jabber, DefaultJabber, Local / UML2JavaObserver, UML2Applet / JavaMappings, Java1. | ^ [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/svn-gen/UML2CaseStudies/uml2cs-instantmessenger-java2/|java2]] | The java2 version of the instant messaging client. Includes the following features / selective refinements / selective transformation libraries: AWT, Jabber, DefaultJabber, Local / UML2JavaObserver, UML2Applet / JavaMappings, Java2. | ^ [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/svn-gen/UML2CaseStudies/uml2cs-instantmessenger-swing/|swing]] | The java2/swing version of the instant messaging client. Includes the following features / selective refinements / selective transformation libraries: Swing, Jabber, DefaultJabber, Local / UML2JavaObserver, UML2Applet / JavaMappings, Java2. | ^ [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/svn-gen/UML2CaseStudies/uml2cs-instantmessenger-midp/|midp]] | The MIDP/mobile phone version of the instant messaging client. Includes the following features / selective refinements / selective transformation libraries: LCDUI, Jabber, MEJabber, Local / UML2Observer, UML2MIDlet / JavaMappings, Java1. | Each of these versions contain a 'build.xml' file in their main project directory that generates a 'build' folder with a 'build.xml' file. That 'build/build.xml' file generates the intermediate models (PSM) and code for that version. In addition, each of these versions contain a 'packaging' folder that contains 'build.xml' scripts for packaging the generated code in a particular way. The packages are stored in the [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML2CaseStudies/uml2cs-instantmessenger-model/deployment/data/|uml2cs-instantmessenger-model/deployment/data/]] folder. **N.B. All 'build.xml' files must be executed in the same JRE as Eclipse:** - Right-click build file - Select "Run As -> 2 Ant Build..." - Select "Run in the same JRE as the workspace" under the "JRE" tab ===== UML 1.4 source models ===== The source consists of several UML 1.4 models, of which one forms the "core" feature (or "concept"). The other models represent optional features that can be merged with the core model using the [[research:mdd:casestudies#mergemodel_modelmerge|MergeModel.atl]] transformation. The source models for this case study can be found [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML1CaseStudies/uml1cs-instantmessenger-model/|here]] (see also the [[research:mdd:casestudies:installation|installation instructions]]. The models were all developed using the [[http://www.gentleware.com/|Poseidon CE 3.0.1]] CASE tool. The following models (features) are available: * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML1CaseStudies/uml1cs-instantmessenger-model/models/InstantMessengerModel.xmi?view=markup|InstantMessengerModel.xmi]]** \\ "Core" model, containing the minimal infrastructure of the instant messaging client. * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML1CaseStudies/uml1cs-instantmessenger-model/models/InstantMessengerAWT.xmi?view=markup|InstantMessengerAWT.xmi]]** \\ Java AWT user interface. * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML1CaseStudies/uml1cs-instantmessenger-model/models/InstantMessengerSwing.xmi?view=markup|InstantMessengerSwing.xmi]]** \\ Java Swing user interface. * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML1CaseStudies/uml1cs-instantmessenger-model/models/InstantMessengerLCDUI.xmi?view=markup|InstantMessengerLCDUI.xmi]]** \\ Java MIDP LCDUI user interface (for mobile phones). * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML1CaseStudies/uml1cs-instantmessenger-model/models/InstantMessengerJabber.xmi?view=markup|InstantMessengerJabber.xmi]]** \\ Jabber network protocol support (using the JabberWookie library). * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML1CaseStudies/uml1cs-instantmessenger-model/models/InstantMessengerDefaultJabber.xmi?view=markup|InstantMessengerDefaultJabber.xmi]]** \\ Jabber default java.net.Socket transport. * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML1CaseStudies/uml1cs-instantmessenger-model/models/InstantMessengerMEJabber.xmi?view=markup|InstantMessengerMEJabber.xmi]]** \\ Jabber MIDP javax.microedition.io.Connection transport. * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML1CaseStudies/uml1cs-instantmessenger-model/models/InstantMessengerLocal.xmi?view=markup|InstantMessengerLocal.xmi]]** \\ Local/loopback network protocol support (also used for debug/error messages). * **[[http://ssel.vub.ac.be/viewcvs/viewcvs.py/UML1CaseStudies/uml1cs-instantmessenger-model/models/InstantMessengerSMS.xmi?view=markup|InstantMessengerSMS.xmi]]** \\ SMS network protocol support (for mobile phones). Currently just a stub/dummy. ===== UML 1.4 refinement transformations ===== In addition, a series of refinement model transformations have to be applied before Java code can be generated. These refinement transformations sometimes introduce a part of static model content (doesn't vary based on input model) and always introduce a part of dynamic model content (varies based on input model). The static content is generally merged with the input model using the transformations rules from the [[research:mdd:casestudies#mergemodel_modelmerge|MergeModel.atl]] transformation. The available refinement transformations can be found [[research:mdd:casestudies#model_transformations_for_uml1.4|here]]. ===== UML 1.4 pre-configured versions ===== Four pre-configured versions of the instant messaging client exist: ^ [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/svn-gen/UML1CaseStudies/uml1cs-instantmessenger-default/|default]] | The default version of the instant messaging client. Includes the following features / refinements: AWT, Jabber, DefaultJabber, Local / AssociationAttributes, Accessors, JavaObserver, Singleton, Applet, DataTypes, AsyncMethods. | ^ [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/svn-gen/UML1CaseStudies/uml1cs-instantmessenger-java2/|java2]] | The java2 version of the instant messaging client. Includes the following features / refinements: AWT, Jabber, DefaultJabber, Local / Java2AssociationAttributes, Java2Accessors, JavaObserver, Singleton, Applet, Java2DataTypes, AsyncMethods. | ^ [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/svn-gen/UML1CaseStudies/uml1cs-instantmessenger-swing/|swing]] | The Java2/Swing version of the instant messaging client. Includes the following features / refinements: AWT, Swing, Jabber, DefaultJabber, Local / Java2AssociationAttributes, Java2Accessors, JavaObserver, Singleton, Applet, Java2DataTypes, AsyncMethods. | ^ [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/svn-gen/UML1CaseStudies/uml1cs-instantmessenger-midp/|midp]] | The MIDP/mobile phone version of the instant messaging client. Includes the following features / refinements: LCDUI, Jabber, MEJabber, Local, SMS / AssociationAttributes, Accessors, Observer, Singleton, MIDlet, DataTypes, AsyncMethods. | The [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/svn-gen/UML1CaseStudies/uml1cs-instantmessenger-model/|source models repository]] contains an [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/svn-gen/UML1CaseStudies/uml1cs-instantmessenger-model/outmodels/|outmodels]] folder, in which the Ant build.xml files can be found to generate each of these preconfigured versions. Note that these build files and the various Config.atl files need to be adapted for the correct source code path. In addition, a [[http://ssel.vub.ac.be/viewcvs/viewcvs.py/svn-gen/UML1CaseStudies/uml1cs-instantmessenger-model/remotebuild/|remotebuild]] example Ant build.xml script has been included to illustrate how model transformation and code generation of several configurations can be offloaded to a remote (multi-processor) machine.