#
Template Package

###### Identifier:

com.ssaglobal.generator.templatepackage

###### Since:

5.0.0

###### Description:

Define a group of templates that can be processed against an EMF model.

###### Configuration Markup:

<!ELEMENT extension (Base , Template+ , Helper* , Property* , BuildScript?)>

<!ATTLIST extension

point CDATA #REQUIRED

id CDATA #IMPLIED

name CDATA #IMPLIED>

<!ELEMENT Template EMPTY>

<!ATTLIST Template

engine (FreeMarker|Jamon|StringTemplate) "FreeMarker"

template CDATA #REQUIRED

nameTemplate CDATA #REQUIRED

writer (none|PDF)

appliesToClass CDATA #REQUIRED

appliesToSubclasses (true | false) "true">

Defines a template to be processed by the generator.

Each template is actually a pair of templates - one provides the name of the file generated by the template, and the other provides the contents of the file.

- engine - Identifies the template engine that will process the template - choices are FreeMarker, Jamon, and StringTemplate.

  Please select FreeMarker - the Jamon and StringTemplate integrations haven't been updated to allow reading the templates from the plugin resources.

- template - Path to the template file that will generate the content of the generated file.

  The path is relative to the templateRoot attribute of the Base element.

- nameTemplate - Path to the template file that will generate the name of the generated file.

  The path is relative to the templateRoot attribute of the Base element.

- writer - Select the TemplateWriter that should be used to process the template output.

  The only writer currently implemented is PDF. To use it, the template identified by the template attribute must produce an XSL:FO (XSL Formatting Objects) document. The PDF writer transforms the XSL:FO document into a PDF file.

  Note that when using the PDF writer the nameTemplate attribute should generate the name of the .pdf file, e.g., documentation.pdf.

- appliesToClass - Fully-qualified name of the Java class that the template processes.

  The class must be an EMF model object, i.e., it must implement `org.eclipse.emf.ecore.EObject`.

- appliesToSubclasses - Indicates whether the template applies to subclasses of the class (or interface) identified by the `appliesToClass` attribute.

<!ELEMENT Base EMPTY>

<!ATTLIST Base

templateRoot CDATA #REQUIRED

outputRoot CDATA #REQUIRED>

- templateRoot - Path (relative to the template package plugin) to the folder containing the template files.

  Note that you must include the template folder in the binary build of your template package plugin.

- outputRoot - Local file system path to the folder that will receive the generated files.

  Note that this is a default value for your plugin. It can be overridden at runtime in the generator's project settings.

<!ELEMENT Helper EMPTY>

<!ATTLIST Helper

name CDATA #REQUIRED

helperClass CDATA #REQUIRED

appliesToClass CDATA #REQUIRED

appliesToSubclasses (true | false) "true">

Defines a helper class that will be used to information to the template(s) that is not directly available from the EMF model.

- name - Name by which the helper class will be referenced in the template.

  For example, if name is "properties", the className attribute of the helper class can be referenced with ${properties.className} in a FreeMarker template.

- helperClass - Fully-qualified class name of the helper class, e.g., com.ssaglobal.generator.helper.PropertiesHelper.
- appliesToClass - Fully-qualfied name of Java class (or interface) that the helper class is used with. For example, org.eclipse.emf.ecore.impl.EObjectImpl.
- appliesToSubclasses - Indicates whether the helper class is used with subclasses of `appliesToClass`.

<!ELEMENT Property EMPTY>

<!ATTLIST Property

name CDATA #REQUIRED

value CDATA #IMPLIED>

Defines a property that can be referenced in templates. The property value can be overridden at generation time using the project settings.

To make the properties available to templates in the package, the template package must include a Helper element with the following settings.

helperClass
  com.ssaglobal.generator.helper.PropertiesHelper
appliesToClass
  org.eclipse.emf.ecore.impl.EObjectImpl
appliesToSubclasses
  true

- name - Property name.
- value - Property value.

  The value specified in the extension point is the default value for the property. Generator users can use the Infor Generator->Project settings... command to override the value at generation time.

<!ELEMENT BuildScript EMPTY>

<!ATTLIST BuildScript

name CDATA #REQUIRED

generated (true | false) "false">

The BuildScript element defines an Ant build script that will be executed automatically after the templates have been processed.

- name - The path to the build.xml file, e.g., build/build.xml.

  If the generated attribute is true, the path is relative to the outputRoot folder (see Base.outputRoot), and the build script should be generated by a template in the package. Otherwise, the path is relative to the plugin - don't forget to include the build script in the template package's binary build.

- generated - Indicates whether the build script (build.xml) is generated by a template in the package.

###### Examples:

The following is an example of a template package extension point:

###### API Information:

The `appliesToClass` properties of the <Template> and <Helper> elements must identify classes that implement `org.eclipse.emf.ecore.EObject`.

The template package plug-in must include a dependency on a plugin that exports the classes identified in the `appliesToClass` elements.

The classes identified in the `helperClass` property of the <Helper> element must implement a factory method with the following signature: ``

    static public Object getInstance(GeneratorLog log, EObject object, GeneratorControlArea controlData)

    NOTICE

    THIS SOFTWARE IS THE PROPERTY OF AND CONTAINS
    CONFIDENTIAL INFORMATION OF INFOR GLOBAL SOLUTIONS
    TECHNOLOGY GMBH AND/OR ITS AFFILIATES OR SUBSIDIARIES
    AND SHALL NOT BE DISCLOSED WITHOUT PRIOR WRITTEN
    PERMISSION. LICENSED CUSTOMERS MAY COPY AND ADAPT
    THIS SOFTWARE FOR THEIR OWN USE IN ACCORDANCE WITH
    THE TERMS OF THEIR SOFTWARE LICENSE AGREEMENT.
    ALL OTHER RIGHTS RESERVED.

    (c) COPYRIGHT 2007. INFOR GLOBAL SOLUTIONS
    TECHNOLOGY GMBH AND/OR ITS AFFILIATES AND SUBSIDIARIES.
    ALL RIGHTS RESERVED.
    THE WORD AND DESIGN MARKS SET FORTH HEREIN ARE
    TRADEMARKS AND/OR REGISTERED TRADEMARKS OF INFOR
    GLOBAL SOLUTIONS TECHNOLOGY GMBH AND/OR ITS AFFILIATES AND
    SUBSIDIARIES. ALL RIGHTS RESERVED. ALL OTHER
    TRADEMARKS LISTED HEREIN ARE THE PROPERTY OF THEIR
    RESPECTIVE OWNERS.