ACCELEO Architect Tutorial This handbook is the exclusive ownership of its authors and was conceded to the profit of Obe o SARL. This handbook is protected by intellectual ownership rights. It deals with a software product called ACCELEO, currently distributed under the open source E clipse Public License E(PL). The distribution of this handbook is however not free. This handbook makes it possible to fully take advantage of the many advanced functionalities o f ACCELEO software and required on behalf of its authors and of OBEO an important compilation and synth esis work, as well as consequent financial and time investments. Nevertheless, there may still be mistakes le ft in this document, OBEO shall not be held responsible for any resulting inconvenience. ACCELEO as we ll as the content of this document may be altered without prior notice. This document is not under Free licens. eThis document can be downloaded without any fee f rom the OBEO website after proper registering. You may read and use it for any activity, commercial or not, related to ACCELEO. Yet permission of copying, translating or distributing freely or commercially this manual is subject to prior approval by OBEO. ____________________ "OBEO”, "ACCELEO”, as well as OBEO and ACCELEO logosa re registered trademarks of Obeo in Fra nce and in other countr.ies All other names, titles, drawings, and logos are the exclusive ownership of their authors and are protected by intellectual ownership rights. This ...
This handbook is the exclusive ownership of its authors and was conceded to the profit of Obeo SARL. This handbook is protected by intellectual ownership rights. It deals with a software product called ACCELEO, currently distributed under the open source Eclipse Public License (EPL). The distribution of this handbook is however not free. This handbook makes it possible to fully take advantage of the many advanced functionalities of ACCELEO software and required on behalf of its authors and of OBEO an important compilation and synthesis work, as well as consequent financial and time investments. Nevertheless, there may still be mistakes left in this document, OBEO shall not be held responsible for any resulting inconvenience. ACCELEO as well as the content of this document may be altered without prior notice. This document is not under Free license. This document can be downloaded without any fee from the OBEO website after proper registering. You may read and use it for any activity, commercial or not, related to ACCELEO. Yet permission of copying, translating or distributing freely or commercially this manual is subject to prior approval by OBEO. ____________________
"OBEO”, "ACCELEO”, as well as OBEO and ACCELEO logos are registered trademarks of Obeo in France and in other countries. All other names, titles, drawings, and logos are the exclusive ownership of their authors and are protected by intellectual ownership rights. This handbook was written with the following tools: OpenOffice ____________________
Authors: Jonathan MUSSET, Étienne JULIOT, Stéphane LACRAMPE With the participation of: Laurent GOUBET, Goulwen LE FUR, Julien DUPONT, Guillaume RAIMBAULT, Nathalie LEPINE, William PIERS and Cédric BRUN
Copyright 2006-2008 Obeo. All rights reserved.
Summary 1-Introduction.......................................................................................................................1 2-Installation.........................................................................................................................2 3 - Preparation.......................................................................................................................3 4 - Scenario 1: Simple XHTML Generator.............................................................................4 4.1CreationofaPrototype..............................................................................................4 -4.1.1-StructureofaPrototypeProject.........................................................................4 4.1.2-PrototypePage...................................................................................................6 4.2-CreationoftheGenerator..........................................................................................8 4.2.1-GeneratorProject...............................................................................................8 4.2.2 - Creation of the Generator..................................................................................9 4.2.3 - From the Template to the Generator: Using the Reflective Editor..................10 4.2.4 - Using Data from the Model in the Generator...................................................13 4.2.5 - Creation of the Execution Chain......................................................................17 5-Scenario2:BasicJavaClassGenerator........................................................................19 5.1 - Creation of the Prototype........................................................................................19 5.1.1-StructureofaPrototypeProject.......................................................................19 5.1.2 - Java Class Prototype.......................................................................................19 5.2-CreationoftheBasicGenerator..............................................................................22 5.2.1-StructureofaPrototypeProject.......................................................................22 5.2.2 - From the Template to the Generator:..............................................................22 5.2.3-AdaptingthePrototype.....................................................................................23 5.2.4 - Correctly formatting – Creating and using Services........................................26 5.2.5 - Selection of the Files to be Generated.............................................................29 5.2.5.1 - Stereotypes in the Model..........................................................................29 5.2.5.2 - "hasStereotype" Service ..........................................................................29 5.2.5.3 - Filtering Classes using the "hasStereotype" Service...............................30 5.2.6-CreationofanExecutionFile...........................................................................32 5.3 - Improving the Generator.........................................................................................33 5.3.1ManagingOperations.......................................................................................33 -5.3.2 - Incremental Generation – Using User Code Tags ..........................................35 5.3.3-ManagingInheritance.......................................................................................37 5.3.4 - Parameterized Constructor..............................................................................38 6 - Scenario 3: Customization of the JSP/JDBC Example Module ....................................39 6.1 - Installing and Testing the JSP/JDBC Model...........................................................39 6.1.1 - Downloading and Installing the Model from the Acceleo.org Web Site...........39
6.1.2 - Analyzing the Existing Module.........................................................................40 6.1.2.1-JSPPageGenerator.................................................................................41 6.1.2.2 - Generator for the Navigation Page...........................................................41 6.1.2.3 - Action Generation.....................................................................................41 6.1.2.4 - Configuration of the Web Application - "web.xml" file..............................42 6.1.2.5 - Data Transfer Classes..............................................................................42 6.1.2.6-DataAccessClasses................................................................................42 6.1.3 - Module's generation result...............................................................................42 6.2-CustomizationoftheModule...................................................................................44 6.2.1-AddinganSQLGenerator................................................................................45 6.2.1.1-NewGeneratorFile...................................................................................45 6.2.1.2-SQLGenerator..........................................................................................45 6.2.1.3 - Changing the Execution Chain.................................................................49 6.2.2 - Configuring the Generation – "Property" Files.................................................52 6.2.2.1 - Creation of a Default "properties" File......................................................52 6.2.2.2-AdaptingGenerators.................................................................................53 6.2.2.3 - Flexibility of the Method – Reconfiguration of the Generation.................55 7 - Scenario 4: Specific Meta-Model – Creation and Use....................................................56 7.1-CreationofaMeta-Model........................................................................................56 7.1.1-Meta-ModelProject..........................................................................................56 7.1.2-CreationoftheMeta-model..............................................................................57 7.2-CreationofaModelEditor.......................................................................................60 7.3 - Dynamic instance of a Cinematic based model......................................................61 7.4-XHTMLScreenGenerator.......................................................................................65 7.5 - Generation Chain....................................................................................................68 7.6-TheSamePossibilitieswithMeta-models...............................................................69