1 / 15

Creation of external bundles

Creation of external bundles . Gendoc2 v1.0.1 2010/03/29. External bundles usage. External bundles are used to : Provide a set of Java services that will be used inside Gendoc2 scripts Group services by functionality or model type ex : Requirements, UML, …

lynsey
Download Presentation

Creation of external bundles

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Creation of external bundles Gendoc2 v1.0.12010/03/29

  2. External bundles usage • External bundles are used to : • Provide a set of Java services that will be used inside Gendoc2 scripts • Group services by functionality or model type ex : Requirements, UML, … • External bundles can be used inside gendoc2 scripts : • Imported by default or imported explicitly using the attribute ‘importedBundles’ of the <context> tag • Bundle names are separated by a semicolon (‘;’) when importing several bundles in a script with attribute ‘importedBundles’ Example : <context model=‘${model}’ element=‘RootElement’ importedBundles=‘topcased;requirements’/> => Bundles “topcased” and “requirements” are imported. • When a bundle has been imported, all services provided by the bundle can be used directly into Gendoc2 scripts that follow this context definition

  3. Creation of an external bundle NOTE : • All the examples presented in the following steps refer to Acceleo technology for scripts. • For now, Acceleo language is the only script language handled by Gendoc2. • Acceleo language description is available at: http://wiki.eclipse.org/Acceleo • Steps to create an external bundle • Creation of an Acceleo project • Creation of an Acceleo generation file • References to the metamodel(s) • Creation of one (or several) Java file(s) containing a list of services • Creation of Acceleo queries mapped with Java methods • Registration to Gendoc2 extension point for external bundles • Export of the bundle as a plugin to integrate into Eclipse platform

  4. Creation of an Acceleo project (1/3) • Create a new Acceleo project using menu File -> New … -> Acceleo project • Fill project name :(for example : org.topcased.gendoc2.bundle.acceleo.<<your bundle name>>)

  5. Creation of an Acceleo project (2/3) • Initialize the Acceleo generation file Name of the generation module Metamodelto use for generation No impact for external bundles

  6. Creation of an Acceleo project (3/3) • Overview of the generated plugin and generation file Generatedbundle plugin Metamodel URL Generation file Module name Useless for bundles(Can be deleted manually) Acceleo script

  7. Creation of Java services • Create Java classes containing the Java services into the bundle plugin

  8. Mapping Java services to Acceleo queries • Inside Acceleo file (.mtl) : • Remove generated part containing [template …] • Add necessary metamodels (separated by ‘,’) • For each Java service needed, add a query with : • A name • A list of typed parameters • A return type • An invoke of the Java method Metamodel(s) Java class Java method Input parameters

  9. Registration to Gendoc2 extension point (1/4) • Add a dependency to org.topcased.gendoc2.script.acceleo plugin • Inside MANIFEST.MF file, in “Dependancies” tab, clic on button “Add”

  10. Registration to Gendoc2 extension point (2/4) • Inside tab “Extensions” of MANIFEST.MF, clic on ‘Add’ • Select the extension point to register to : “org.topcased.gendoc2.script.acceleo.services”

  11. Registration to Gendoc2 extension point (3/4) • The extension definition needs : • A unique name • A .emtl file (corresponds to a compiled.mtl file) => can be found in /bin directory of the plugin instead of /src • A boolean : • If false : this bundle must be explicitely referenced inside “importedBundles” attribute of the <context> tag • If true : bundle imported by default

  12. Registration to Gendoc2 extension point (4/4) • The list of metamodels that are necessary for the services provided must be associated to the extension. They can be added by a right-clic on the service • For each one, fill : • the metamodel name • the metamodel URL

  13. Export the external bundle plugin (1/2) • Before exporting, indicate specifically the export of all .emtl file(s) present in /bin directory In “Build” tab of plugin.xml file : Add .emtl file to binary build

  14. Export the external bundle plugin (2/2) • Use export wizard, present in “Overview” tab of the plugin.xml file, indicating the output directory • Put the generated JAR file inside directory “dropins” of your Eclipse install. • Restart your Eclipse : the bundle is available for use

  15. Usage in a Gendoc2 template document • Add bundle name in the “importedBundles” attribute of <context> tag(not necessary if the bundle has been created as “importedByDefault”) • Call the queries declared in the bundle inside <gendoc> tags • Generated :

More Related